Skip to content

feat(neo): RPC bridge protocol + stdio transport (neo-go-tui task 3)#120

Merged
code-yeongyu merged 1 commit into
mainfrom
neo/bridge
Jul 5, 2026
Merged

feat(neo): RPC bridge protocol + stdio transport (neo-go-tui task 3)#120
code-yeongyu merged 1 commit into
mainfrom
neo/bridge

Conversation

@code-yeongyu

@code-yeongyu code-yeongyu commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

Plan task 3 of .omo/plans/neo-go-tui.md: the Go mirror of senpi's JSONL RPC protocol — the wire layer every neo TUI feature drives the TS agent through. Additive only, packages/neo internal.

Changes

  • internal/bridge/types.go: structs for all RpcCommand variants, RpcResponse union, session state, slash commands, 9 extension-UI methods, every AgentSessionEvent variant + extension_error.
  • codec.go/demux.go: JSONL codec; four-way stdout demux (response / extension_ui_request / extension_error / event).
  • transport.go/client.go: Transport interface + StdioTransport spawning node <cli> --mode rpc with rpc-client.ts parity (100ms init wait, req_N correlation, 30s timeout, stderr capture, typed exit errors).
  • testdata/: fixtures generated by gen-fixtures.mjs against the mock-loop (regeneration reproducible, never hand-edited); extract-ts-union.mjs extracts the TS unions at test time.

QA / Evidence

Evidence: .omo/evidence/task-3-neo-go-tui.txt (+ task-3-artifacts/) in the work worktree.

  • Exhaustiveness gate: a Go variant must exist for every TS union member, extracted live from rpc-types.ts + agent-session.ts — 31 commands / 9 ext-UI methods / 22 events today; the test, not a hand count, is the gate.
  • Decode→encode round-trip byte-equal on all fixtures; demux covers all four shapes (incl. a labeled post-hoc mutation proof for the demux gate).
  • Real-CLI QA in tmux (non-blank transcript archived): Go client against senpi --mode rpc + mock-loop — get_state, prompt→agent_end, get_commands; kill-child-mid-request yields a typed exit error carrying stderr (nil ExitError now fails the test explicitly); malformed JSONL line ignored. Real ~/.senpi hash unchanged (receipt).
  • Gates: go build/vet/gofmt/test green; GOOS=windows and GOOS=linux cross-compile OK; npm run check exit 0. An adversarial audit round fixed evidence-wording/artifact gaps; re-audit verdict: real.

Risks

  • TS protocol drift would silently outdate the mirror — mitigated by the extraction test failing on any union change, which is exactly the plan's intent.

Secret safety

No secrets; sandboxed QA; auth hash receipts before/after.


Summary by cubic

Implements the Go RPC bridge for the neo TUI: a JSONL codec/demux, StdioTransport that spawns the TS CLI, and a Client that mirrors rpc-client.ts semantics. This unlocks driving the TS agent from Go and gates drift with TS via exhaustive tests.

  • New Features
    • Strict JSONL codec with LF framing and byte-equal round-trip; four-way demux: response, extension_ui_request, extension_error, event.
    • Transport interface and StdioTransport that runs node <cli> --mode rpc, captures stderr, and surfaces typed exit errors; graceful SIGTERM with SIGKILL fallback.
    • Client with req_N correlation, per-request timeout (30s default, overridable), malformed-line tolerance, and event/message listeners.
    • Go mirror of all RpcCommand/RpcResponse variants, 9 extension-UI methods, session state, and every AgentSessionEvent plus extension_error.
    • Golden fixtures generated from the real CLI; exhaustiveness test parses TS unions at test time and fails on any protocol drift.
    • Integration tests against the real CLI and a fake model server; asserts sandbox isolation (no ~/.senpi changes).

Written for commit 7b3a7f1. Summary will update on new commits.

Review in cubic

Go mirror of the senpi JSONL RPC protocol in internal/bridge: structs for
all RpcCommand variants, the RpcResponse union, session state, slash
commands, the 9 extension-UI request methods, and every AgentSessionEvent
variant plus extension_error. A four-way stdout demux classifies
response / extension_ui_request / extension_error / event. StdioTransport
spawns node <cli> --mode rpc with rpc-client.ts parity (100ms init wait,
req_N id correlation, 30s request timeout, stderr capture, typed exit
errors). Fixtures are generated by testdata/gen-fixtures.mjs against the
mock-loop (never hand-edited); an exhaustiveness test extracts the TS
unions from rpc-types.ts and agent-session.ts at test time via
testdata/extract-ts-union.mjs (31 commands / 9 ext-UI methods / 22 events
today) and fails on any missing Go mirror, so the counts are gated, not
hand-maintained.

Plan: .omo/plans/neo-go-tui.md
@code-yeongyu code-yeongyu enabled auto-merge July 5, 2026 17:13
@code-yeongyu code-yeongyu merged commit 34b53a0 into main Jul 5, 2026
3 checks passed
@code-yeongyu code-yeongyu deleted the neo/bridge branch July 5, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant