Files
anomalyco_opencode/packages/opencode/test/cli/acp
Kit Langton 29cf700361 test(cli): subprocess integration tests for opencode acp
Adds the second long-lived-command builder to the cli-process harness:
`opencode.acp(opts)` spawns the real CLI in JSON-RPC-over-stdio mode
and returns a duplex handle (`send`/`receive`/`close`/`exited`) scoped
to the test's lifetime. Stdin EOF triggers a clean shutdown; the scope
finalizer also falls back to SIGTERM after 2s for a hung child.

ACP frames each JSON-RPC message as one ndjson line on stdout. The
builder forks a scope-bound `Stream.fromReadableStream` + `splitLines`
pipeline that feeds parsed responses into a `Queue.unbounded`, so tests
can `yield* acp.receive` without worrying about backpressure or framing.

Two smoke tests:
- `initialize` round-trip — sends the protocol handshake from the ACP
  README and asserts the response advertises the same protocolVersion
  and a non-empty agentCapabilities block.
- Clean shutdown on stdin EOF — proves the scope finalizer's stdin.end()
  triggers a graceful exit, not a SIGTERM-fallback exit.
2026-05-18 21:10:06 -04:00
..