You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v1.2.0: SquireOptions.keepStdinOpen for follow-up stdin input
The .send() API has existed since v1.0 but was unusable in practice:
start() unconditionally calls child.stdin.end() right after writing the
initial prompt, so any later send() throws ADAPTER_UNSUPPORTED_FEATURE
because stdin is already closed. That defeats the point of the API for
CLIs that DO accept follow-up input — Claude Code's
`--input-format stream-json` mode being the motivating case (a host
needs to deliver tool_result for AskUserQuestion mid-turn).
Adds an opt-in `keepStdinOpen` flag on SquireOptions. When set, start()
writes the initial prompt but leaves stdin open, so the host can call
.send(followup) until the child exits. Off by default — every existing
one-shot caller is unchanged.
Includes a test that drives the new path end-to-end: spawn a child that
reads stdin lines, start() with the first line, send() two more lines,
sentinel exits the child, assert assembled output matches what was
delivered across all three writes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,12 @@ The v1.0 public API surface (everything exported from `src/index.ts`) is frozen.
8
8
9
9
## [Unreleased]
10
10
11
+
## [1.2.0] - 2026-05-23
12
+
13
+
### Added
14
+
-`SquireOptions.keepStdinOpen`: when set, `start()` writes the initial prompt but does NOT close the child's stdin afterwards, so the host can deliver follow-up messages via `.send()` (e.g. a `tool_result` for a CLI that asked the user a question mid-turn). Off by default — existing one-shot callers are unchanged. Pairs with `--input-format stream-json` on the Claude Code CLI; other binaries' contracts vary.
15
+
- Test coverage for the new option: `keepStdinOpen: send() works after start() to deliver follow-up input`.
Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "@pythonluvr/squire",
3
-
"version": "1.1.0",
3
+
"version": "1.2.0",
4
4
"description": "General-purpose runtime for spawning CLI AI agents (Claude Code, Codex, Gemini CLI) as subprocesses with structured event streaming, MCP tool forwarding, and permission auto-setup.",
0 commit comments