Repository navigation
feat(observe): classifyTool reads grok's and kimi's recorded shell tools - #139
Merged
Merged
Conversation
grok's `run_terminal_command` and kimi's `Bash` classified as `other`, so
hosts showed "Working" and grok's raw input JSON. Map them by the name
tool_call_started carries for ACP (the opening `tool_call`'s title), since
ACP's `kind` is missing (grok) or a category (kimi):
- grok `run_terminal_command` -> run_command, with `command` and
`description` from the opening `rawInput` `{command, description}`
- kimi `Bash` -> run_command; its opening `tool_call` has no `rawInput`, so
there is no command to read at the start
Only the tools in tests/replay/fixtures/grok-acp-v1.vendor.json (grok
1.0.5) and kimi-acp-v1.vendor.json (kimi 0.38.0) are added; antigravity
has no recording. The replay test runs each snapshot's tool frames through
the ACP projection (the snapshots keep rawInput keys, not values, so each
key stands for itself) and pins the activity lines and fields.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
xxchan
added a commit
that referenced
this pull request
Oct 5, 2026
Patch release: #139 (Ferryman) teaches `classifyTool` grok's `run_terminal_command` (a `run_command` with its command and description) and kimi's `Bash` (a `run_command`; its opening frame carries no input). Version bump only. 🤖 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 was referenced Oct 6, 2026
xxchan
added a commit
that referenced
this pull request
Oct 6, 2026
…ter a call starts (#148) ## What Some ACP runtimes send a tool call's real arguments only in a later `tool_call_update`. opencode opens a shell call with `rawInput {cwd}` and a file call with `{}`. kimi opens with no `rawInput` at all. `tool_call_started.input` was read only from the opening frame, so hosts never saw the command or the file path. Ferry showed `bash {"cwd":"/tmp/x"}` and `read {}`. Closes #147. Evidence (opencode 1.18.30 through Ferry, oar 0.23.0): ``` tool_call title "bash" kind execute status pending rawInput {"cwd":"/tmp/x"} tool_call_update title "echo hi > a.txt && cat a.txt" status in_progress rawInput {"command":"echo hi > a.txt && cat a.txt","cwd":"/tmp/x"} tool_call title "read" kind read status pending rawInput {} tool_call_update title "read" status in_progress rawInput {"filePath":"/tmp/x/a.txt"} ``` ## Shape (as agreed in #147) - **New event `{ kind: "tool_call_input"; callId: string; input: string }`** in `RuntimeEventBody`. It holds arguments the runtime reported after the call started. It is the WHOLE input, in the same form as `tool_call_started.input` (a string, JSON for ACP), and replaces the previous input. It is never a delta. - **Emitted in the shared ACP projection.** No runtime-specific code. The per-call state remembers the input last reported. A `tool_call_update` whose `rawInput` differs from it emits `tool_call_input`. An identical input is not emitted again. If the ending frame carries a new `rawInput`, `tool_call_input` comes before `tool_call_ended`. Nothing is read after the end. A running update with both a new input and `rawOutput` gives the input, then the progress. - **`tool_call_started` is unchanged.** It is not delayed and not rewritten. - **The session view's tool part `input` takes the latest input.** An input whose start was never seen renders as a `?` part, like an end without a start. `classifyTool` gets the latest input through the view (and `groupToolActivity`, which reads the view). - **kimi is fixed too.** Its full `rawInput` (`{command}`) arrives in one later frame. The partial-JSON `content` chunks before it are still not read. - Other consumers handle the new kind: - the status fold treats it like `tool_call_progress`: the phase stays, the clock moves; - `oar run` prints the detail the new input adds, once, e.g. `[Running command]`, then `[Running command] echo hi > a.txt && cat a.txt`. ## classifyTool Every entry comes from a recording. `<key>` placeholders are used as in #139. | runtime | tool | kind | fields | recording | |---|---|---|---|---| | opencode | `bash` | `run_command` (unchanged) | `command` (new) | `opencode-acp-v1.vendor.json`, tools[1]: `{command, cwd}`; `opencode-acp-v1-files.vendor.json`: `{command, workdir}` | | opencode | `read` | `read_file` | detail `filePath` | `opencode-acp-v1-files.vendor.json`: `{filePath}` | | opencode | `write` | `edit_file` | detail `filePath` | same: `{content, filePath}` | | opencode | `edit` | `edit_file` | detail `filePath` | same: `{filePath, newString, oldString}` | | opencode | `grep` | `search` | detail `path` | same: `{path, pattern}` | | opencode | `glob` | `search` | detail `path` | same: `{path, pattern}` | | kimi | `Bash` | `run_command` (unchanged) | `command` (new) | `kimi-acp-v1.vendor.json`, tools[2]: `{command}` | **New recording.** opencode's file tools had none. `experiments/acp-vendor-snapshot.ts` gains a `files` scenario: write, read, edit, grep, glob, then a shell `cat`, run in a scratch directory whose path is replaced by `<cwd>` in titles. It was recorded from opencode 1.18.30 (free `opencode/big-pickle`, no login) into `tests/replay/fixtures/opencode-acp-v1-files.vendor.json`. **Not added:** - `description` for opencode `bash`. #147 suggested it "if present", but no recording carries it (Ferry `{command, cwd}`, the shell fixture `{command, cwd}`, the files fixture `{command, workdir}`). It can follow once one does. - For `grep` / `glob`, the detail is the directory, not the pattern. This comes from the existing shared key order in `detailOf` (`path` before `pattern`, same as pi's and claude's grep). I left it alone. ## Compatibility **`RuntimeEventBody` (and so `EventBody` / `Event`) gains a member. A host that switches exhaustively over event kinds (`switch (event.kind)` with a `never` check or `switch-exhaustiveness-check`) stops compiling until it handles `tool_call_input`.** For release notes: ignoring it is safe, but then the host only shows the first input. A host that renders from `viewOf` / `reduceSessionView` gets the latest input with no change. In this repo, the exhaustive switches over event kinds are all updated: `observe/agent-status.ts`, `observe/session-view-events.ts`, `cli/src/progress.ts`, and the test describers in `tests/fixtures/acp-session-support.ts`, `tests/replay/claude-projection.test.ts`, `tests/replay/codex-projection.test.ts`. Lint's `switch-exhaustiveness-check` found them. Records written before this have no `tool_call_input`, so a replayed old log shows what it showed before. ## Tests - `tests/acp/acp-tool-input.test.ts` (projection): - no or partial input at start, then supplied later (opencode's bash and read frames from the evidence, plus kimi's no-`rawInput` shape); - identical input not emitted again (equal to the start, or repeated); - ending frame with a new input: `tool_call_input`, then `tool_call_ended`, and nothing after the end; - running frame with input and output: input, then progress. - `tests/acp/acp-kimi-wire-shapes.test.ts`: kimi's late `rawInput` (0.42.0 frames) is now a `tool_call_input`. The started record is unchanged. - `tests/tool-call-input.test.ts`: the view's tool part takes the latest input and keeps its state, and an input without a start renders. The status fold keeps the tool phase and moves the clock. - `tests/cli-progress.test.ts`: `oar run` prints the detail a later input adds, once. - `tests/replay/tool-activity.test.ts`: the kimi and opencode fixtures now run through the projection AND `viewOf`. The activity snapshots changed as expected: - `kimi-acp-v1.activity.txt`: `Bash │ Running command` → `Bash │ Running command: <command>` - `opencode-acp-v1.activity.txt`: `bash │ Running command` → `bash │ Running command: <command>` - new `opencode-acp-v1-files.activity.txt`: `Editing file: <filePath>`, `Reading file: <filePath>`, `Searching: <path>`, `Running command: <command>` - grok's is unchanged. Its update adds `is_background` and `variant`, which now arrive as a `tool_call_input`; the classification stays the same. - inline snapshots pin each call's started and latest input and its `ToolAction`. Verification: - `CI=1 pnpm run check` is green: typecheck, lint, 669 passed / 31 skipped, mock sea-trial 19/19. - `pnpm run build` passes. - `pnpm tsx sea-trial/all.ts`: mock, claude-aimock, codex-aimock and pi-aimock all clean. - `OAR_TEST=opencode pnpm sea-trial`: 19/19 on real opencode 1.18.30. - Ad-hoc `oar run opencode` with bash, read, edit and grep: each call got a `tool_call_input` on its first in-progress update and none on repeats, and the CLI printed the command and the file paths. ## Docs - `docs/spec/record-stream.md`: a rule for the latest input, `tool_call_input` in the event list, and which runtimes emit it. - `docs/design/chat-ui.md`: the events → view mapping row. - `docs/runtimes/kimi.md`, `docs/runtimes/opencode.md`: the "no command" paragraphs now describe the new behaviour, with opencode's recorded input keys per tool. `docs/runtimes/grok.md`: a note on its later `rawInput`. - `experiments/README.md`: the snapshot recorder row (opencode, `files`). - Root and package READMEs: the event-kind list. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- 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.
What
classifyToolnow knows the two ACP tools that appear in the recordings: grok'srun_terminal_commandand kimi'sBash. Until now both classified asother. Hosts showed "Working" for them, and for grok they also showed the raw input JSON.ACP's
kindcan't be relied on for this: grok'stool_callhas none, and kimi's is just a category (execute/other). So the mapping is by the nametool_call_startedcarries, which for ACP is the openingtool_call'stitle(seetoolNameinshared/acp/projection.ts).Mapping
run_terminal_commandrun_commandcommand,description(anddetail= command)tests/replay/fixtures/grok-acp-v1.vendor.json(grok 1.0.5),prompt.tools[0]:sessionUpdate: "tool_call",title: "run_terminal_command", nokind,rawInputKeys: ["command", "description"]Bashrun_commandrawInput, sotool_call_startedhas no inputtests/replay/fixtures/kimi-acp-v1.vendor.json(kimi 0.38.0),prompt.tools[0]:sessionUpdate: "tool_call",title: "Bash",kind: "execute", norawInputKeysWhere the command lives. grok's opening
tool_callalready carries{command, description}. Its latertool_call_update(tools[1], retitledExecute `printf …`) addsis_backgroundandvariant, buttool_call_startedonly reads the opening frame.kimi's arguments arrive only on a later update:
tools[2],rawInputKeys: ["command"], titled "Running: …". The projection doesn't reopen a call that has already started, so nocommandcan be read for kimi at the start. The input therefore gets noFIELDSentry.Before → after
{kind: "other", detail: <command>}→{kind: "run_command", detail, command, description}.{kind: "other", detail: "Bash"}→{kind: "run_command"}.Not added, because they aren't in either recording:
read_file,search_replace,web_fetch, …AgentThey can follow once a vendor snapshot records them.
Tests
tests/replay/tool-activity.test.tsreads each vendor snapshot's tool frames and runs them through the real ACP projection (projectAcpUpdate), so the call starts on the same frametool_call_starteddoes.rawInputkey names, not values, so each recorded key is filled with its own name ("<command>"). That shows which key a field comes from without inventing a value.grok-acp-v1.activity.txt(run_terminal_command │ Running command: <command>) andkimi-acp-v1.activity.txt(Bash │ Running command).ToolAction.tests/tool-activity.test.tsadds a unit case: a grok input that lacks a key (onlydescription, or no input) still classifies asrun_commandwith whatever it carries.pnpm run checkpasses after rebasing on main: typecheck, lint, 611 tests passed / 31 skipped, mock sea-trial 19/19.🤖 Generated with Claude Code