Commit Graph
15 Commits
Author SHA1 Message Date
hh 76799179d9 feat(stream): headless claude -p transport behind a transport flag
The PTY transport stands in for a protocol that did not exist when it
was written: it pastes bracketed text into claude's TUI, guesses when
the Ink render loop has settled, re-presses Enter when the paste is
swallowed, and tails the session JSONL at 100ms. `claude -p` with
stream-json on both pipes is that protocol, so add it as a second
transport and let callers pick with `BackendOptions.transport`.

Measured on one host, same model and prompt, cold single-reply turn:
pty burns 2.3s on TUI readiness before the prompt is even submitted
(first event 2.5s, turn 5.2s); stream_json burns none (first event
0.3s, first token 1.9s, turn 2.7s). The gap is what `startup_delay`'s
60s cap exists to survive on slow hardware.

Everything the old transport relies on carries over unchanged and was
verified against a real CLI: multi-turn over one live process, MCP via
--mcp-config, --resume, and `native_jsonl` history seeding. Two things
are new rather than equal: `result` is native (so usage is the turn's
aggregate and durations are real, not synthesized), and
`include_partial_messages` yields token-level `StreamEvent`s — which
the JSONL, holding only finished blocks, could never provide.

Notably, assistant records carry `stop_reason: null` in this mode even
at the end of a turn, so `result` is not just tidier than the PTY
path's terminal-stop_reason heuristic, it is the only correct signal.

Default stays `pty`; nothing changes for existing callers.

Also: extract process-group bookkeeping into `procgroup` so both
transports sweep claude's children on shutdown, and fix a stale
assertion in test_backend that still expected the `is_error: None` that
`_block_to_dict` deliberately stopped emitting.
2026-07-28 02:56:17 +02:00
hh aa7beea1e0 fix(turn,backend): confirm submit on turn records only, resend lost paste, longer tui wait 2026-07-26 00:49:41 +02:00
hh 89065c2f4e fix(pty,turn,backend): verify submit via jsonl, killpg orphans, idle session ttl 2026-07-26 00:24:40 +02:00
hh 4f6585b1ac fix: shows live sessions for pty view 2026-06-04 22:35:39 +02:00
hh 27e6e5a1bf feat: add pty monitoring 2026-05-23 00:37:28 +02:00
hh 3394617163 fix: better "enter" after pasted text 2026-05-23 00:31:29 +02:00
hh b5e0166c48 feat: better injection, pty snapshots 2026-05-23 00:12:15 +02:00
hh d05c8dd613 feat: add more logging 2026-05-22 22:45:44 +02:00
hh 21dc26810b fix: split submit key and prompt pasting 2026-05-22 01:04:08 +02:00
hh 8eefd6f928 fix: waits for startup by markers instead of timer 2026-05-22 00:46:28 +02:00
hh 9a18091cbb fix: waits for startup by markers instead of timer 2026-05-22 00:36:11 +02:00
hh 86d8a8f4c4 fix: no null's in is_error 2026-05-21 13:00:40 +02:00
hh 1f20cef7d4 feat: add synthesize_turn_messages 2026-05-21 12:21:03 +02:00
hh a1a043373d docs: add slop badge 2026-05-19 11:27:13 +02:00
hh bf6116dc8b feat: vibed out some slop over here also 2026-05-19 11:20:14 +02:00