feat(shared): add ToolCallState enum and populate state on SSE tool events #990

Merged
charles merged 2 commits from dev/959 into main 2026-05-08 18:19:11 +00:00
Collaborator

Adds ToolCallState to @claude-hooks/shared and sets it on every tool-related SSE event in both adapters, giving the dashboard a canonical state machine field without provider conditioning.

Test plan

  • just qa clean (typecheck + biome + tests all pass)
  • tool_call_startedstate: "input-available"
  • tool_call_progressstate: "input-streaming"
  • tool_call_completed ok=true → "output-available", error → "output-error", cursor result.case === "rejected""output-denied"
  • tool_progress / tool_summary (anthropic + cursor whole-message path) carry matching states
  • New output-denied test case in cursor-sdk-delta.test.ts passes

Closes #959

Adds `ToolCallState` to `@claude-hooks/shared` and sets it on every tool-related SSE event in both adapters, giving the dashboard a canonical state machine field without provider conditioning. ## Test plan - [ ] `just qa` clean (typecheck + biome + tests all pass) - [ ] `tool_call_started` → `state: "input-available"` - [ ] `tool_call_progress` → `state: "input-streaming"` - [ ] `tool_call_completed` ok=true → `"output-available"`, error → `"output-error"`, cursor `result.case === "rejected"` → `"output-denied"` - [ ] `tool_progress` / `tool_summary` (anthropic + cursor whole-message path) carry matching states - [ ] New `output-denied` test case in cursor-sdk-delta.test.ts passes Closes #959
dev self-assigned this 2026-05-08 15:22:47 +00:00
feat(shared): add ToolCallState enum and set state on SSE tool events
All checks were successful
qa / sql-layer-check (pull_request) Successful in 9s
qa / dockerfile (pull_request) Successful in 9s
qa / i18n-string-check (pull_request) Successful in 14s
qa / db-schema (pull_request) Successful in 50s
qa / qa-1 (pull_request) Successful in 1m44s
qa / qa (pull_request) Successful in 0s
b4c15e1870
Adds ToolCallState to @claude-hooks/shared and populates state on every
tool-related SSE event in both adapters:
- tool_call_started: input-available (cursor always has full args)
- tool_call_progress: input-streaming
- tool_call_completed: output-available / output-error / output-denied
  (cursor result.case === "rejected" → output-denied)
- tool_progress: input-available
- tool_summary: output-available / output-error

Documents the enum and per-event state in docs/api.md.

Closes #959

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dev requested review from reviewer 2026-05-08 15:25:49 +00:00
fix(agent): address PR-990 review findings
All checks were successful
qa / sql-layer-check (pull_request) Successful in 13s
qa / i18n-string-check (pull_request) Successful in 13s
qa / dockerfile (pull_request) Successful in 13s
qa / db-schema (pull_request) Successful in 42s
qa / qa-1 (pull_request) Successful in 1m56s
qa / qa (pull_request) Successful in 0s
42299153fc
- Extract `toolCallResultCase` helper in cursor-sdk-adapter replacing the
  fragile double-cast chain; reuses same `isCursorToolCall` guard already
  used by `toolCallResultOk`
- Narrow `ToolProgressEvent.state` type to `"input-available"` literal to
  match `ToolCallProgressEvent` style; update comment to clarify that
  `tool_progress` fires mid-execution and `input-available` is the closest
  ToolUIPart state (no dedicated "executing" value)
- Export `toTaskEvent` via `_sdkAdapterTestHooks` and add tests asserting
  `tool_use_summary` → `output-available` and `tool_progress` →
  `input-available`, pinning the SDK contract that denied calls never reach
  `tool_use_summary`

Co-authored-by: Cursor <cursoragent@cursor.com>
charles deleted branch dev/959 2026-05-08 18:19:12 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks!990
No description provided.