Files
revkit/packages
tkgstratorandClaude Opus 4.8 703a2afef1 kiou-usi-proxy: WS ⇄ USI bridge with YaneuraOu Mobility WASM
Bridges the KiouUsiProxy tweak (WS server on the device) to a
YaneuraOu engine, so the tweak's USI handshake + position stream
drives the engine and the engine's bestmove rides back into KIOU.

Architecture:

  YaneuraOu WASM (Mobility, cfworkers)
        ↑↓ postMessage / addMessageListener
  engine.ts   — owns setoption sweep, position→go convention,
                DepthLimit / NodesLimit / byoyomi caps.
        ↑↓ engine.feed() / engine.onLine()
  socket.ts   — WS leg. forwards tweak ↔ engine, filters engine-
                internal chatter to id/option/info, writes JSONL
                game log.
        ↑↓ ws://device:port
  tweak       — pure USI ↔ Kiou translator.

* Mobility variant has weights embedded (~164 params), so no external
  nn.bin and no MEMFS shuffle. Single-context build runs unmodified in
  Node — the pthread + Suisho5 variants need a `WorkerGlobalScope` /
  `name=="em-pthread"` polyfill that OOM'd in practice.

* Tagged logger (log.ts) splits flows: [tw>e] / [e>tw] for WS lines,
  [engine] for engine-internal speech (id / option / info /
  bestmove / usiok / readyok), [br>e] for bridge-originated commands
  (setoption / usi / isready / go), [bridge] for wrapper state.
  Mirrored to bridge.log with ms timestamps.

* JSONL game log records {sfen, bestmove} per round plus a
  `usinewgame` separator between matches — useful for postmortems.

Env knobs: KIOU_DEVICE / KIOU_PORT / KIOU_THREADS / KIOU_USI_HASH_MB /
KIOU_DEPTH_LIMIT / KIOU_NODES_LIMIT / KIOU_BYOYOMI_MS / KIOU_LOG_FILE
/ KIOU_BRIDGE_LOG.

The WASM package ships in wasm-pkg/ under file: in package.json so
the tweak side of the repo doesn't need any registry dependency.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 07:43:39 +00:00
..