npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sabaki-golaxy-live

v1.0.4

Published

A Golaxy live game integration module for Sabaki Go board

Readme

sabaki-golaxy-live

A Golaxy live game integration module for Sabaki Go board and other Go applications.

Installation

npm install sabaki-golaxy-live

Usage

Basic Usage

import { golaxy, getLiveReports } from 'sabaki-golaxy-live';

// 获取直播比赛列表
async function fetchLiveGames() {
  try {
    const games = await getLiveReports();
    console.log('Live games:', games);
  } catch (error) {
    console.error('Failed to fetch live games:', error);
  }
}

// 同步特定比赛到应用
async function syncGame(gameId) {
  try {
    // 设置SGF同步回调
    golaxy.setSyncSgfCallback((gameId, sgfContent) => {
      // 在这里实现将SGF内容加载到你的Go应用中的逻辑
      console.log(`Syncing game ${gameId} with SGF content:`, sgfContent);
      // 例如:yourGoApp.loadSgf(sgfContent);
    });
    
    // 开始同步
    await golaxy.syncGolaxyOrYikeLizban([gameId]);
  } catch (error) {
    console.error('Failed to sync game:', error);
  }
}

// 停止同步
golaxy.stopSync();

Using GolaxyLiveReportsAgent

import { GolaxyLiveReportsAgent } from 'sabaki-golaxy-live';

// 创建智能体实例
const agent = new GolaxyLiveReportsAgent();

// 执行智能体任务
async function runAgent() {
  const result = await agent.execute({
    type: 'live',
    limit: 10
  });
  
  if (result.success) {
    console.log('Agent result:', result.data);
  } else {
    console.error('Agent error:', result.error);
  }
}

API

Golaxy Class

Constructor

new Golaxy(prop = 'name', today = new Date().toISOString().split('T')[0], isLive = true)

Methods

  • setSyncSgfCallback(callback): 设置SGF同步回调函数
  • async getLiveReports(name = '', page = 0): 获取直播和历史比赛报告
  • async getGolaxyLive(gameId, moveNum): 获取特定比赛的直播数据
  • getReportUrl(game, isLive = true): 获取比赛报告URL
  • async syncGolaxyOrYikeLizban(gameIds, isReport = false, requestAgain = false, isGolaxy = true): 同步Golaxy或Yike比赛
  • convertFromCoordinate(coordinateStr): 将字符串坐标转换为(x, y)坐标
  • convertCoordinate(coordinate): 将(x, y)坐标转换为字符串坐标
  • getPropsBySgfStr(sgfStr): 从SGF字符串中提取属性
  • countMovesAndGetLastMove(node): 计算步数并获取最后一步
  • async getSgfByGolaxy(url, isD = false): 通过Golaxy API获取SGF内容
  • async syncSgf(gameId, sgfContent): 同步SGF内容
  • async requestGolaxyOrYikeMove(gameId, lastMoveNum, lastMove, playerBlack, playerWhite, isGolaxy = true): 请求最新的Golaxy或Yike步数
  • startSync(gameId, lastMoveNum, lastMove, playerBlack, playerWhite): 开始同步
  • stopSync(): 停止同步

Functions

  • getLiveReports(name = '', page = 0): 获取直播和历史比赛报告
  • syncGolaxyOrYikeLizban(liveIds, is_live = true): 同步Golaxy或Yike比赛

Constants

  • AGENT_STATES: 智能体状态
  • ERROR_TYPES: 错误类型
  • TOOL_TYPES: 工具类型

License

MIT