Repository navigation
feat(claude): stream tool call input - #302
Merged
Merged
Conversation
Merged
xxchan
added a commit
that referenced
this pull request
Oct 10, 2026
Release OAR and CLI 0.52.0. This PR changes only the two package version fields. **Added: streamed tool arguments** (#299, #302) - claude streams a tool call's arguments while the model writes them. A streamed call now starts with `tool_call_started` without input. Each fragment arrives as a new append-only `tool_call_input_delta { callId, delta }`, where `delta` is claude's raw `partial_json` text and may be incomplete JSON. The complete arguments then arrive as `tool_call_input`, replacing the fragments. - `SessionView`: a tool part's `input` grows with the fragments and carries `inputPartial: true` until the complete input arrives. An interrupted call keeps `inputPartial`. OAR never parses partial JSON; a host that renders early uses a tolerant parser and acts only once `inputPartial` clears. - Only claude streams arguments. Its subagents' tool calls, codex and the ACP runtimes still give the whole input at once. **Fixed** - **`reduceConversation` no longer copies its maps on every record** (#300, #301). A map is copied only on its first write in a record, and a record that changes nothing keeps the previous maps, and their identity. A 600-turn session (35,400 records) folds about 4.5× faster: 2.4 s → 0.52 s with JIT, 2.7 s → 0.60 s without. **Behavior changes** - A claude `tool_call_started` may now carry no `input`; read the later `tool_call_input` (or the view) before parsing arguments. Hosts that already handle ACP runtimes, whose input also arrives later, are unaffected. - `classifyTool` should be given only complete input; `tool-groups` already skips partial input. - Hosts with an exhaustive `switch` over event kinds need a case for `tool_call_input_delta`. Validation: #301 and #302 each passed all 17 checks on their final heads (`5885611`, `a712e02`). #301 merged with a tree equal to its CI tree. #302 was checked on the previous main; it and #301 touch different files, so the combination was verified locally (typecheck, lint, full tests: 1507 passed), and the merged tree equals that verified tree. Lookout verified #301 with a differential fold of 61,429 steps (0 differences) and #302 on four cases against the real claude CLI with a mock provider (two tools streaming in one message, an interrupt mid-argument, a resume, a subagent). After this PR passes CI and merges, tag its exact squash commit as `v0.52.0` to trigger npm trusted publishing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: exe.dev user <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
xxchan
added a commit
that referenced
this pull request
Oct 10, 2026
…uments; phaseLabel names the action (#317) Closes #314. Since 0.52 (#302), a claude call's `tool_call_started` arrives at `content_block_start`, before its arguments stream. `AgentStatus.phase` became `{ tool }` right there, so `phaseLabel` read `Running mcp__ferry__show_widget` for the whole time the model was writing the arguments. Ferry measured 9–14 s for a 2.5–4.5 KB widget. **Changes:** - **`RunningPhase` tool variant gains `writing?: true`.** It is set from the call's first `tool_call_input_delta` until its complete `tool_call_input`, and only for the current call's phase. Only deltas set it: an ACP call whose input arrives later without deltas is already running. In practice only claude streams arguments. - **`phaseLabel(phase, runtimeId?)`:** - a writing phase reads `Writing <tool> arguments`; - with a runtime id, a running call reads as its action from `classifyTool` / `toolActionLabel` (`Editing file`, `Running command`), and an MCP or unclassified tool by its short name (`Running show_widget`); - without a runtime id, today's wording stays. - **Docs:** docs/spec/conversation.md. **Tests:** - Status: writing during deltas, cleared by the complete input, untouched by another call's input. It fails without the change. - Labels: actions, MCP short name, unclassified, and writing with and without a runtime id. The full suite (1,582), lint and typecheck pass locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: exe.dev user <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claude already streams tool arguments, but OAR exposed a tool only after the full input arrived. This made a host wait through a large widget argument before rendering anything.
Project native tool block openings as one
tool_call_startedwithout input, each argument fragment as append-onlytool_call_input_delta { callId, delta }, and the completed block astool_call_input. Calls without a partial opening retain their single start with complete input. Raw frames stay available.SessionViewappends raw input text within each session/agent/call, setsinputPartial: trueon a fragment, and removes the flag when complete input replaces it. It never parses partial JSON, and late input cannot reopen an ended tool. The CLI waits for complete arguments before printing their detail. ACP retains whole-input updates. Codex 0.162.0 has no native argument-delta notification, verified from its generated schema.Host impact: consumers must allow Claude's
tool_call_started.inputto be absent and read the later completetool_call_input; hosts wanting early rendering can consume the deltas or the view's flagged preview. No capability flag is added.Validation:
content_block_stop, plus an unstreamed child. Replay preserves every frame and checks live/view agreement.Closes #299.