mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-12-02 14:11:58 +00:00
Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
764fb84f9f | ||
|
|
0f095f678d | ||
|
|
677a6d9afa | ||
|
|
893f7680c7 | ||
|
|
aa93ed06c1 | ||
|
|
f2897d6687 | ||
|
|
d5be0e5827 | ||
|
|
743ae8dcd4 | ||
|
|
f6525de507 | ||
|
|
9062779cda | ||
|
|
2c37f979b6 | ||
|
|
fa02bc239f | ||
|
|
37241a9e28 | ||
|
|
105e1c38da | ||
|
|
ffb3225413 | ||
|
|
74abe32983 | ||
|
|
7c86d4b5a4 | ||
|
|
9ca8984d55 | ||
|
|
f9c25404ec | ||
|
|
130fbbc02a | ||
|
|
4af4581ad5 | ||
|
|
988a58b908 | ||
|
|
6d9e2766c7 | ||
|
|
85a0d6c6f1 | ||
|
|
b977017ed8 | ||
|
|
3304ca724c | ||
|
|
6a760cbca6 | ||
|
|
022ff53244 | ||
|
|
184b7df993 | ||
|
|
a4f0f78bb3 | ||
|
|
1c90fb959a | ||
|
|
80440d8b82 | ||
|
|
eb4c16f10a |
4
.github/workflows/publish.yml
vendored
4
.github/workflows/publish.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
||||
# Generating a GitHub token, so that PRs and tags created by
|
||||
# the release-please-action can trigger actions workflows.
|
||||
- name: Generate GitHub token
|
||||
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510
|
||||
uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc
|
||||
id: generate-token
|
||||
with:
|
||||
# GitHub App ID secret name
|
||||
@@ -292,7 +292,7 @@ jobs:
|
||||
exit 1
|
||||
|
||||
- name: Generate token scoped to the registry repo
|
||||
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510
|
||||
uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc
|
||||
id: registry-token
|
||||
with:
|
||||
app-id: ${{ secrets.REGISTRY_UPDATER_APP_ID }}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
".": "0.109.0"
|
||||
".": "0.113.0"
|
||||
}
|
||||
|
||||
72
CHANGELOG.md
72
CHANGELOG.md
@@ -1,5 +1,77 @@
|
||||
# Changelog
|
||||
|
||||
## [0.113.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.112.0...v0.113.0) (2026-11-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* serve /plugin in ACP sessions ([#1716](https://github.com/agentclientprotocol/claude-agent-acp/issues/1716)) ([0f095f6](https://github.com/agentclientprotocol/claude-agent-acp/commit/0f095f678dac9cf4a7ca3623261fa3f6729e73b0))
|
||||
* start Remote Control with the session when Claude Code asks for it ([#1523](https://github.com/agentclientprotocol/claude-agent-acp/issues/1523)) ([893f768](https://github.com/agentclientprotocol/claude-agent-acp/commit/893f7680c7ed57be7fc7be7f4e9abac268884ff2))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **background:** keep a tool call whose task joins the live set after its result ([#1639](https://github.com/agentclientprotocol/claude-agent-acp/issues/1639)) ([677a6d9](https://github.com/agentclientprotocol/claude-agent-acp/commit/677a6d9afab3c7bad41fdf2587a24b2414236b29))
|
||||
|
||||
## [0.112.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.111.0...v0.112.0) (2026-11-24)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* rewind the same provider session on an edited message ([#1704](https://github.com/agentclientprotocol/claude-agent-acp/issues/1704)) ([f2897d6](https://github.com/agentclientprotocol/claude-agent-acp/commit/f2897d6687f594220c07836c3e3528de552e30ef))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* stop holding an MCP request that Claude Code gave up ([#1711](https://github.com/agentclientprotocol/claude-agent-acp/issues/1711)) ([d5be0e5](https://github.com/agentclientprotocol/claude-agent-acp/commit/d5be0e5827fb111e5e95020d76920fe8a59e671b))
|
||||
|
||||
## [0.111.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.110.1...v0.111.0) (2026-11-24)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* name the session and tool call of MCP requests sent over ACP ([#1705](https://github.com/agentclientprotocol/claude-agent-acp/issues/1705)) ([fa02bc2](https://github.com/agentclientprotocol/claude-agent-acp/commit/fa02bc239ff3f3557b1797d1137a9bc34bd4d339))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* start a session without the MCP servers that Claude Code refuses ([#1708](https://github.com/agentclientprotocol/claude-agent-acp/issues/1708)) ([f6525de](https://github.com/agentclientprotocol/claude-agent-acp/commit/f6525de507f9f628d4e3e8781eb61488f965b7de))
|
||||
* update to @anthropic-ai/claude-agent-sdk 0.3.331 ([#1707](https://github.com/agentclientprotocol/claude-agent-acp/issues/1707)) ([9062779](https://github.com/agentclientprotocol/claude-agent-acp/commit/9062779cda651aaeaf8a07a8ea2c8edeb76924fa))
|
||||
* write error messages as plain text ([#1709](https://github.com/agentclientprotocol/claude-agent-acp/issues/1709)) ([2c37f97](https://github.com/agentclientprotocol/claude-agent-acp/commit/2c37f979b60e0db2a069f99fdc85da3c8822dc1e))
|
||||
|
||||
## [0.110.1](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.110.0...v0.110.1) (2026-11-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Closing the gaps for the ACP v2 support ([#1542](https://github.com/agentclientprotocol/claude-agent-acp/issues/1542)) ([105e1c3](https://github.com/agentclientprotocol/claude-agent-acp/commit/105e1c38daf76bc832e872e95904be6dabd32372))
|
||||
* preserve existing line endings in ACP v2 terminal output ([#1697](https://github.com/agentclientprotocol/claude-agent-acp/issues/1697)) ([9ca8984](https://github.com/agentclientprotocol/claude-agent-acp/commit/9ca8984d55132991b2eec0f87c45acbb820b38a3))
|
||||
|
||||
## [0.110.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.109.1...v0.110.0) (2026-11-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* name each model's effort levels in its model option entry for AIR ([#1692](https://github.com/agentclientprotocol/claude-agent-acp/issues/1692)) ([130fbbc](https://github.com/agentclientprotocol/claude-agent-acp/commit/130fbbc02ab4771443b2f365f2af1659ceb0c591))
|
||||
|
||||
## [0.109.1](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.109.0...v0.109.1) (2026-11-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* announce a live subagent again when its session is loaded or resumed ([#1688](https://github.com/agentclientprotocol/claude-agent-acp/issues/1688)) ([b977017](https://github.com/agentclientprotocol/claude-agent-acp/commit/b977017ed88148fbbc8bdd6e24cd275313c546e6))
|
||||
* apply a provider's route to the running session ([#1691](https://github.com/agentclientprotocol/claude-agent-acp/issues/1691)) ([988a58b](https://github.com/agentclientprotocol/claude-agent-acp/commit/988a58b908d55a933e9d297c142e9040d478bd69))
|
||||
* give a forked skill's child session its tool calls and text ([#1677](https://github.com/agentclientprotocol/claude-agent-acp/issues/1677)) ([1c90fb9](https://github.com/agentclientprotocol/claude-agent-acp/commit/1c90fb959a003eba1eed1dac94400c9cdef63195))
|
||||
* keep built-in web-fetch and claude-code-guide agents out of the Agent picker ([#1672](https://github.com/agentclientprotocol/claude-agent-acp/issues/1672)) ([eb4c16f](https://github.com/agentclientprotocol/claude-agent-acp/commit/eb4c16f10a753925090289c21f2d95bd902a7b63))
|
||||
* match v1 session/options to resume when workspace roots change ([#1679](https://github.com/agentclientprotocol/claude-agent-acp/issues/1679)) ([184b7df](https://github.com/agentclientprotocol/claude-agent-acp/commit/184b7df993c0c64df593188f15bb0e5206f3e6fb))
|
||||
* reject requests that name a replayed subagent session with -32602 ([#1686](https://github.com/agentclientprotocol/claude-agent-acp/issues/1686)) ([3304ca7](https://github.com/agentclientprotocol/claude-agent-acp/commit/3304ca724c25c7258c837cc0394adb4111ea8987))
|
||||
* report unusable Claude subscriptions as unauthenticated ([#1678](https://github.com/agentclientprotocol/claude-agent-acp/issues/1678)) ([a4f0f78](https://github.com/agentclientprotocol/claude-agent-acp/commit/a4f0f78bb31539005d0d54ab69f7e28f91443b14))
|
||||
* send a replayed subagent's configuration after the replay, not inside it ([#1685](https://github.com/agentclientprotocol/claude-agent-acp/issues/1685)) ([6a760cb](https://github.com/agentclientprotocol/claude-agent-acp/commit/6a760cbca64adc72634274088914e99a51da084a))
|
||||
* show readable titles for MCP tool calls ([#1674](https://github.com/agentclientprotocol/claude-agent-acp/issues/1674)) ([80440d8](https://github.com/agentclientprotocol/claude-agent-acp/commit/80440d8b8294f9d4cd086d7cba39c716107657f0))
|
||||
* update to @agentclientprotocol/sdk 2.9.0 ([#1687](https://github.com/agentclientprotocol/claude-agent-acp/issues/1687)) ([022ff53](https://github.com/agentclientprotocol/claude-agent-acp/commit/022ff532449371198a0d715a921578e27c101532))
|
||||
* update to @agentclientprotocol/sdk 2.9.1 ([#1690](https://github.com/agentclientprotocol/claude-agent-acp/issues/1690)) ([85a0d6c](https://github.com/agentclientprotocol/claude-agent-acp/commit/85a0d6c6f111119855b0e199801a9f71b60f50bf))
|
||||
* update to @anthropic-ai/claude-agent-sdk 0.3.330 ([#1689](https://github.com/agentclientprotocol/claude-agent-acp/issues/1689)) ([6d9e276](https://github.com/agentclientprotocol/claude-agent-acp/commit/6d9e2766c74dcd9ccd5c5a83b8523b65c234041f))
|
||||
|
||||
## [0.109.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.108.1...v0.109.0) (2026-11-19)
|
||||
|
||||
|
||||
|
||||
27
README.md
27
README.md
@@ -16,9 +16,10 @@ This tool implements an ACP agent by using the official [Claude Agent SDK](https
|
||||
- Nested subagent transcripts
|
||||
- Interactive (and background) terminals
|
||||
- Custom [Slash commands](https://docs.anthropic.com/en/docs/claude-code/slash-commands)
|
||||
- Client MCP servers, including the ones that the client serves over the ACP connection ([MCP-over-ACP](https://agentclientprotocol.com/rfds/mcp-over-acp), `"type": "acp"`)
|
||||
- Client MCP servers, including the ones that the client serves over the ACP connection ([MCP-over-ACP](https://agentclientprotocol.com/rfds/mcp-over-acp), `"type": "acp"`). Where an organization's managed settings (`disableSideloadFlags`) keep them out, a session starts without them and says so in a notice
|
||||
- An Ultracode session config option, which turns on Claude Code's dynamic workflows for every task. It appears when dynamic workflows are enabled and the model supports ultracode (any model with `xhigh` effort)
|
||||
- `/mcp` in the chat: the MCP server status as a list. The adapter runs `/mcp reconnect`, `/mcp enable`, and `/mcp disable` through the SDK control API, because Claude Code refuses them in SDK mode. A reconnect of an ACP server that needs authentication starts MCP OAuth through URL elicitation
|
||||
- `/plugin` (aliases `/plugins`, `/marketplace`) in the chat: the adapter runs `claude plugin …` for install, uninstall, enable, disable, update, and list, and `marketplace add|list|remove|update`, because Claude Code refuses `/plugin` in SDK mode, then reloads the session's plugins. It is not available in remote (`sdk-url`) sessions
|
||||
- Prompt suggestions: the prompt that Claude Code predicts the user sends next, as ACP's unstable `prompt_suggestions_update`, for a client that advertises `session.promptSuggestions`
|
||||
- Session-scoped long-running goals for AIR through the [goal extension](docs/air-extensions.md#goal) under `_meta.jetbrains.air.goal`
|
||||
- Structured errors, recovery, and warnings through the opt-in [session failure extension](docs/air-extensions.md#session-failure)
|
||||
@@ -58,11 +59,11 @@ npm run build:binary
|
||||
npm run smoke:binary # add `-- --full` to drive a real session; needs a Claude login
|
||||
```
|
||||
|
||||
### Experimental ACP v2
|
||||
### ACP v2 (Preview)
|
||||
|
||||
The adapter also serves the [draft ACP v2](https://agentclientprotocol.com/protocol/v2/overview):
|
||||
a client that asks for protocol version 2 or later in `initialize` gets v2, and every other client
|
||||
gets v1. The draft can still change, and this surface changes with it.
|
||||
The adapter also serves [ACP v2](https://agentclientprotocol.com/protocol/v2/overview), which is in
|
||||
Preview: a client that asks for protocol version 2 or later in `initialize` gets v2, and every other
|
||||
client gets v1. v2 is not frozen yet, and this surface changes with it.
|
||||
|
||||
`CLAUDE_AGENT_ACP_PROTOCOL` limits the adapter to one version. With `v1`, a client that asks
|
||||
for v2 is negotiated down to v1. With `v2`, the adapter rejects the `initialize` of a v1 client.
|
||||
@@ -75,14 +76,26 @@ with replay, which `replay_complete` ends, `session/close`, `session/prompt`, `s
|
||||
compaction, display terminals for commands, permission requests, elicitation, providers, auth, and
|
||||
[subagents](docs/subagent-sessions.md). Steering is v1 only for now.
|
||||
|
||||
On v2, the `command` of a stdio MCP server must be an absolute path, such as `/usr/local/bin/npx`.
|
||||
`session/new`, `session/resume` and `session/fork` fail with `-32602` for a relative one, such as
|
||||
`npx`. A v1 client can still send one.
|
||||
|
||||
`session/prompt` takes an `idempotencyKey`: a prompt that a client sends again with the same key
|
||||
is inserted once, and the retry gets the first `messageId`. The key is known for as long as Claude
|
||||
Code stores the message, also after a restart.
|
||||
Code stores the message, also after a restart. A prompt that Claude Code does not store, such as a
|
||||
local command, keeps its key until `session/close` or the end of the connection.
|
||||
|
||||
The adapter announces a session cursor (`cursor_update`) before each user message that follows
|
||||
another entry of the conversation, live and in a replay. `session/fork` with its `cursorId` copies
|
||||
the history before that message, and fails with `-32602` for any other `cursorId`. A v1 client gets
|
||||
no cursors yet.
|
||||
cursors only when it declares `clientCapabilities.session.cursors`. A v1 replay (`session/load`)
|
||||
anchors each cursor `before` its replayed user message. A live v1 prompt is not reported to the
|
||||
client that sent it, so its cursor is anchored `after` the last agent message, thought, tool call or
|
||||
compaction before it, with the same `cursorId` that a later replay issues. A session that was
|
||||
resumed without a replay has no such entity, so its live prompts get no cursor until it replays.
|
||||
When a v1 turn reports no entity (it was cancelled or failed before any output, or it was a slash
|
||||
command), the next prompt's cursor has the same `after <entity>` anchor as the previous prompt's
|
||||
cursor, with a different `cursorId`: the client uses the latest.
|
||||
|
||||
v2 is served by the v2 agent in `src/v2/`, which runs straight on Claude
|
||||
Code instead of translating to v1. A v2 client that declares JetBrains AIR
|
||||
|
||||
@@ -22,6 +22,7 @@ It describes only this adapter.
|
||||
- [Goal](#goal)
|
||||
- [Predicted follow-up prompt](#predicted-follow-up-prompt)
|
||||
- [Recommended config values](#recommended-config-values)
|
||||
- [Model reasoning efforts](#model-reasoning-efforts)
|
||||
- [Async tasks](#async-tasks)
|
||||
- [Agent file-change report](#agent-file-change-report)
|
||||
- [Session failure](#session-failure)
|
||||
@@ -32,6 +33,7 @@ It describes only this adapter.
|
||||
- [Question custom answers](#question-custom-answers)
|
||||
- [Load replay end](#load-replay-end)
|
||||
- [Session fork point](#session-fork-point)
|
||||
- [Session rewind](#session-rewind)
|
||||
- [Presentation hints](#presentation-hints)
|
||||
- [Removed keys](#removed-keys)
|
||||
|
||||
@@ -147,6 +149,12 @@ The response to a client that is not AIR has no `_meta.jetbrains` key.
|
||||
|
||||
### ACP v2
|
||||
|
||||
A busy `session/prompt` steers the current turn on ACP v2.
|
||||
It waits while a root or child permission request or elicitation is open.
|
||||
The adapter does not advertise `claudeCode.promptQueueing` on v2.
|
||||
On ACP v1, an ordinary `session/prompt` queues behind the current turn.
|
||||
The separate `_session/steering` request steers that turn.
|
||||
|
||||
The v2 core (`src/v2/`) serves an AIR client only the extensions that ACP v2 does not cover.
|
||||
Its `initialize` response lists `agentFileChangeReport` and `recommendedValue`.
|
||||
It also serves the [permission presentation](#permission-presentation), the [question custom answers](#question-custom-answers), the [predicted follow-up prompt](#predicted-follow-up-prompt), and [load replay end](#load-replay-end).
|
||||
@@ -172,6 +180,7 @@ It does not serve the [tool call contract](#tool-call-contract) yet.
|
||||
| `sessionRename` | with `sessionIndex` | Nothing on its own: the agent lists it to tell that it supports `_session/rename`. | [Rename](#rename) |
|
||||
| `sessionListSubscribe` | with `sessionIndex` | Nothing on its own: the agent lists it to tell that it supports `_session/list/subscribe`. | [List subscription](#list-subscription) |
|
||||
| `sessionWorktrees` | with `sessionIndex` | Nothing on its own: the agent lists it to tell that rows carry `agentWorktree` for a worktree Claude Code made. | [List response](#list-response) |
|
||||
| `sessionRewind` | on request | Accepts `_session/rewind`, and announces its session cursors with the `rewind` capability. | [Session rewind](#session-rewind) |
|
||||
| `loadReplayEnd` | no | Sends one `session_info_update` after the whole history replay of a loaded session. | [Load replay end](#load-replay-end) |
|
||||
| `rawInputRendering` | no | Sends no display copy of readable input in `content`. The client renders `rawInput`. | [Tool call contract](#tool-call-contract) |
|
||||
|
||||
@@ -195,6 +204,7 @@ The adapter sends these keys only to an AIR client. "AIR" in the Gate column mea
|
||||
| `diffPatch` | tool call and permission request `content[]` of type `diff`, `_meta.jetbrains.air` | `{version: 1, format: "git_patch", text}` | `diffPatch` |
|
||||
| `permission` | `session/request_permission` request `_meta.jetbrains.air` | `{version: 1, title, description?, defaultToNo?}` | AIR |
|
||||
| `recommendedValue` | `model` and effort config options, `_meta.jetbrains.air` | option value string | `recommendedValue` |
|
||||
| `reasoningEfforts` | entry of the `model` config option, `_meta.jetbrains.air` | `{values: string[], recommended: string}` | AIR |
|
||||
| `asyncTasks` | Bash `tool_call_update._meta.jetbrains.air` | `{backgrounded: true}` | `asyncTasks` |
|
||||
| `agentFileChangeReportRequest` | `session/prompt` request `_meta.jetbrains.air` (client to agent) | `{version: 1, requestId}` | `agentFileChangeReport` |
|
||||
| `agentFileChangeReport` | `session_info_update._meta.jetbrains.air` | report object | `agentFileChangeReport` |
|
||||
@@ -205,6 +215,7 @@ The adapter sends these keys only to an AIR client. "AIR" in the Gate column mea
|
||||
| `mcp` | MCP tool call `_meta.jetbrains.air` | `{server, tool}` | AIR |
|
||||
| `contextCompaction` | compaction tool call or `compaction_update`, `_meta.jetbrains.air` | `{version: 1, trigger?, preTokens?, postTokens?, durationMs?, error?}` | AIR |
|
||||
| `customAnswer` | elicitation schema property `_meta.jetbrains.air` | `{questionId, isCustomAnswer: true}` | AIR, when the client supports form elicitation |
|
||||
| `customAnswerFields` | elicitation request `_meta.jetbrains.air` | companion field keys | AIR, when the client supports form elicitation |
|
||||
| `kind` | session mode `_meta.jetbrains.air` and mode config option value `_meta.jetbrains.air` | `standard`, `plan`, `auto_review`, or `full_access` | AIR |
|
||||
| `kind` | available command `_meta.jetbrains.air` of a skill | `skill` | AIR, when the skill's `SKILL.md` is found; not for a built-in command or an MCP prompt |
|
||||
| `skillPath` | available command `_meta.jetbrains.air` of a skill | absolute path of the skill's `SKILL.md` | AIR, together with `kind: "skill"` |
|
||||
@@ -228,7 +239,9 @@ The adapter keeps them where they are.
|
||||
|
||||
## Auth source display
|
||||
|
||||
The connection-scoped `_auth/status_update` continues to report agent-owned authentication, not client-owned `providers/set` routing. The adapter also reports the same identity through the ACP `auth/status` method and `auth/status_update` notification (advertised as `auth.status`), with `kind`, `detail` and `plan` under the account's `_meta.claudeCode`. The account's `description` carries the `detail` too, e.g. `label: "Anthropic API key"` with `description: "ANTHROPIC_API_KEY"`. Each notification is sent when its own payload changed. `auth/status` answers with the identity last reported and starts a new read, whose change arrives as a notification. When the active key source is `apiKeyHelper`, the adapter reads the effective helper command through SDK `resolveSettings` / the session's `SettingsManager`, including programmatic settings overrides.
|
||||
The connection-scoped `_auth/status_update` reports agent-owned authentication, not client-owned `providers/set` routing. The adapter also reports that login through the ACP `auth/status` method and `auth/status_update` notification (advertised as `auth.status`). Under `--hide-claude-auth`, a subscription the integration cannot use is `unauthenticated`, with no active account; the legacy notification still describes the stored login. Enterprise subscriptions, API keys, and setup tokens remain usable.
|
||||
|
||||
For a reported account, `_meta.claudeCode` carries `kind`, `detail` and `plan`. The account's `description` carries the `detail` too, e.g. `label: "Anthropic API key"` with `description: "ANTHROPIC_API_KEY"`. Each notification is sent when its own payload changed. `auth/status` answers with the identity last reported and starts a new read, whose change arrives as a notification. When the active key source is `apiKeyHelper`, the adapter reads the effective helper command through SDK `resolveSettings` / the session's `SettingsManager`, including programmatic settings overrides.
|
||||
|
||||
A command containing the whole word `central` and the word sequence `proxy start` is displayed as:
|
||||
|
||||
@@ -344,11 +357,11 @@ For every tool, a client that is not AIR also gets these upstream fields:
|
||||
| `Skill` | `kind: other`, `title: "Load skill: <name>"`. | `_meta.jetbrains.air.skill`. | none |
|
||||
| `TodoWrite`, `TaskCreate`, `TaskUpdate`, `TaskList`, `TaskGet` | The stream reports them as a standard `plan` with entries. Only a permission request shows them as a tool call. | A plan that repeats the previous plan is not sent. | Every plan goes out. |
|
||||
| `ReportFindings` | `kind: think`, `title: "Report <n> findings"`. | With `rawInputRendering`, no copy of the findings in `content`. | none |
|
||||
| MCP tools (`mcp__*`) and other tools | `kind: other`, `title` is the tool name. The result text goes to `content`. | `_meta.is_mcp_tool_call` for MCP, and `_meta.jetbrains.air.mcp = {server, tool}`. | none |
|
||||
| MCP tools (`mcp__*`) and other tools | `kind: other`, `title` is `server: tool` for a complete MCP name, otherwise the tool name. Result text goes to `content`. | `_meta.is_mcp_tool_call` for MCP, and `_meta.jetbrains.air.mcp = {server, tool}`. | none |
|
||||
| Context compaction | `compaction_update` when the client declares `session.compaction`. Otherwise a synthetic tool call. | Both forms carry `_meta.jetbrains.air.contextCompaction`. | See [Context compaction](#context-compaction). |
|
||||
| Background work that is not a subagent | none | With `asyncTasks`, async task updates. | none |
|
||||
|
||||
`_meta.jetbrains.air.mcp` comes from the tool name `mcp__<server>__<tool>`, on `tool_call` and on a `tool_call_update` that changes it.
|
||||
The standard `name` stays `mcp__<server>__<tool>`. AIR also gets those parts in `_meta.jetbrains.air.mcp` on `tool_call` and on a `tool_call_update` that changes it.
|
||||
`server` is the part up to the next `__`. `tool` is the whole rest and can contain `__`, as in Claude Code.
|
||||
A name that does not split (`mcp__x`) gets no `mcp` key, and `_meta.is_mcp_tool_call` still marks it.
|
||||
|
||||
@@ -982,6 +995,58 @@ RUN_INTEGRATION_TESTS=true npx vitest run src/tests/model-presentation.test.ts
|
||||
Review the changes to the Opus entries and labels before you update the version guard.
|
||||
The live test only initializes the SDK. It sends no model prompt.
|
||||
|
||||
## Model reasoning efforts
|
||||
|
||||
The `reasoningEfforts` key lets a client show the effort levels of a model before the client selects that model.
|
||||
The effort option shows only the levels of the current model.
|
||||
|
||||
### Activation
|
||||
|
||||
The adapter sends the key to every AIR client.
|
||||
The key has no capability, because it only adds data.
|
||||
A client that is not AIR gets no `reasoningEfforts`.
|
||||
The key does not depend on `recommendedValue`.
|
||||
|
||||
### Entry metadata
|
||||
|
||||
Each entry of the `model` option gets the levels of its model at `_meta.jetbrains.air.reasoningEfforts`:
|
||||
|
||||
```json
|
||||
{
|
||||
"value": "claude-opus-5-5",
|
||||
"name": "Opus 5.5",
|
||||
"_meta": {
|
||||
"jetbrains": {
|
||||
"air": {
|
||||
"version": 1,
|
||||
"reasoningEfforts": {
|
||||
"values": ["low", "medium", "high", "xhigh", "max"],
|
||||
"recommended": "medium"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`values` are the `supportedEffortLevels` of the SDK `ModelInfo` of the entry, in the SDK order.
|
||||
The effort option lists the same levels in the same order.
|
||||
`values` never contain the `default` row of the effort option.
|
||||
|
||||
`recommended` is `medium` when the model offers it, else the first level.
|
||||
The SDK names no recommended effort, so the adapter uses the rule of the effort option.
|
||||
For the current model, `recommended` is the `recommendedValue` of the effort option.
|
||||
|
||||
The adapter finds the `ModelInfo` of an entry by its value.
|
||||
The `default` entry gets the levels of the listed model that its `resolvedModel` names.
|
||||
When no listed model has that `resolvedModel`, the `default` entry gets no `reasoningEfforts`.
|
||||
A running model that the picker does not list gets its own entry, with the same lookup.
|
||||
A model without effort support, or with no levels, gets no `reasoningEfforts`.
|
||||
|
||||
The entries carry the metadata in each answer that carries config options, on ACP v1 and v2.
|
||||
These are `session/new`, `session/load` on v1, `session/resume`, `session/fork`, `session/set_config_option`, and `config_option_update`.
|
||||
The `model` option of a subagent's session has no `reasoningEfforts`.
|
||||
|
||||
## Async tasks
|
||||
|
||||
Claude can run work in the background, for example a backgrounded Bash command or a workflow.
|
||||
@@ -1298,7 +1363,7 @@ A client without the capability gets the original transcript and no typed record
|
||||
|
||||
## Native subagent sessions
|
||||
|
||||
The adapter implements the draft [ACP subagent RFD](https://github.com/agentclientprotocol/agent-client-protocol/pull/1992).
|
||||
The adapter implements ACP's [subagents](https://agentclientprotocol.com/protocol/v1/subagents).
|
||||
This section covers only the AIR bridge.
|
||||
|
||||
- The canonical client field is `clientCapabilities.subagents: {}`.
|
||||
@@ -1313,6 +1378,10 @@ This section covers only the AIR bridge.
|
||||
The source is the `task_started` prompt, else the Agent or Task input `prompt`.
|
||||
A resumed generation gets the SendMessage `message` text.
|
||||
The field is absent when the adapter has no prompt. The adapter does not truncate it.
|
||||
- A forked skill (`context: fork`, such as `/code-review`) is a child session too, without an Agent or Task call.
|
||||
The parent of one that Claude runs with the Skill tool is the session that made the Skill call, which stays a tool call.
|
||||
The parent of one that the user types is the root session.
|
||||
Claude Code sends the output of a typed one only when the command ends: its `subagent_state_update` follows that output.
|
||||
- Without either signal, Agent and Task stay ordinary tool calls. AIR gets `_meta.jetbrains.air.subagent: true` on them.
|
||||
Child interactions stay on the root session.
|
||||
- A client that uses the older `_meta["subagent-transcript"]` capability or the `forwardSubagentText` session option keeps the flat child transcript.
|
||||
@@ -1749,6 +1818,18 @@ For AIR, the companion field also carries the same value under the root key `_me
|
||||
Released AIR versions read only that key.
|
||||
A client that is not AIR gets neither key.
|
||||
|
||||
For AIR on both protocol versions, the request also lists the companion field keys in `_meta.jetbrains.air.customAnswerFields`:
|
||||
|
||||
```json
|
||||
{ "jetbrains": { "air": { "version": 1, "customAnswerFields": ["question_0_custom"] } } }
|
||||
```
|
||||
|
||||
The Kotlin ACP SDK property models do not retain `_meta`.
|
||||
The TypeScript v2 schema supports property metadata.
|
||||
AIR reads the request list to show the companion with its question.
|
||||
The field keys and the response content stay the same in both versions.
|
||||
A client that is not AIR gets no `customAnswerFields` key.
|
||||
|
||||
## Load replay end
|
||||
|
||||
ACP v1 has no signal that the history replay of `session/load` is over, other than the response.
|
||||
@@ -1811,6 +1892,48 @@ It adds this object to the `session/fork` request:
|
||||
- With or without this object, the forked session runs once the response arrives, so the client can prompt it without `session/load` or `session/resume`.
|
||||
A later load replays its history into it, and a later resume returns it. A load or resume with other settings (`cwd`, MCP servers, additional directories, or the session options in `_meta`) restarts it, as for any loaded session.
|
||||
|
||||
## Session rewind
|
||||
|
||||
AIR edits a user message by removing that message and everything after it from the provider's context, in the same session: same session id, no fork.
|
||||
`_session/rewind` asks the agent for that, at a session cursor:
|
||||
|
||||
```json
|
||||
{ "sessionId": "0f7c…", "cursorId": "before:<uuid of the user message>" }
|
||||
```
|
||||
|
||||
The response is `{ "rewound": true }`, which means that the cut is live and persisted, or `{ "rewound": false, "reason": "<reason>" }` when the conversation was left as it was.
|
||||
The client keeps its own history then.
|
||||
|
||||
- ACP v1 only. The agent advertises `sessionRewind` to a client that declares it, and then announces each `cursor_update` with the capabilities `{ "fork": {}, "rewind": {} }`, except a cursor whose resume point is before the newest compaction (`beforeCompaction`) and every cursor of a session whose context was cleared (`clearedContext`): those get `{ "fork": {} }`. Every other client gets `{ "fork": {} }` on all cursors, and the method is not found (`-32601`) for it. ACP v2 does not list `sessionRewind` and has no `_session/rewind`; it only honours a cut that v1 made.
|
||||
- `cursorId` is one that the session announced with `rewind`: the cursor before a user message of its history. The first user message has no cursor, since Claude Code has no entry before it to resume at, so a client offers no edit for it.
|
||||
- The adapter resumes the stored conversation of the session at the entry before the cursor's message (`resumeSessionAt`). The agent replaces its query with that resume and restores the model, mode, effort, agent and Fast mode as the user left them. Claude Code deletes nothing: the dropped entries stay in the transcript as an orphan branch, and the agent records the cut in `rewind.json` beside the session's `subagents/` directory before it replaces the query, and puts the file back as it was when the cut does not happen (`busy`, `backgroundWork` or `providerRefused` after the file was written). When putting it back fails, the request fails with an internal error instead of `rewound: false`: the rewind did not happen and its point could not be removed, so the next load of the session applies the cut. A failed cut then still resumes the conversation first, so the session can be prompted. A crash between the two leaves the point on disk: the next resume of the session applies the cut, and the client's next load replays the cut history.
|
||||
- A live prompt is not reported to the client that sent it, so its cursor is anchored `after` the last entity the client holds. After a rewind it is the entity the client held before the removed message; if the agent holds no such record, the next prompt gets no cursor. When a turn reports no entity (it was cancelled or failed before any output, or it was a slash command), the next prompt's cursor has the same `after <entity>` anchor as the previous prompt's cursor, with a different `cursorId`: the client uses the latest.
|
||||
- The cut also removes the cursors at and after it: the session no longer announces them, and a request that names one fails as an unknown cursor.
|
||||
- The cut holds until the next prompt stores a branch from it. Until then, the agent applies `rewind.json` wherever it reads or resumes the session: a `session/load` (v1) or `session/resume` with a replay (v2) replays the history before the cut, with its cursors only; a restart of the query, a later load or resume, and a v2 resume continue at the cut; `session/fork` copies the history before it, also without a `cursorId`, and rejects a `cursorId` or `jetbrains.air.fork` message from the removed part with `-32602`. The first resume after that prompt removes the file. `session/options` neither reads nor writes it. When the cut cannot be prepared (the stored history or `rewind.json` cannot be read, or `rewind.json` is not a valid record), the load, resume, replay or fork fails with an internal error instead of using the whole conversation, and the client can retry; the point stays on disk.
|
||||
- A rewind keeps the task list and the published session failures of the session. Its token totals start again, as they do after any restart of the query.
|
||||
- No file change is reverted. The files stay as the removed turns left them.
|
||||
- A prompt sent while the rewind runs waits for it, and runs on the rewound conversation.
|
||||
|
||||
| `reason` | When |
|
||||
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `busy` | Claude is working, a prompt is queued, Claude Code runs a cycle on its own, or a `/remote-control` command is in flight. AIR stops the turn before it sends the request. |
|
||||
| `backgroundWork` | A background task or subagent runs. Closing the query would end it. |
|
||||
| `beforeCompaction` | The message is before the newest compaction of the conversation: Claude Code resumes from that compaction on and finds no entry before it. |
|
||||
| `clearedContext` | The session's context was cleared when a plan was accepted: the conversation went on in another Claude Code session. |
|
||||
| `providerRefused` | Claude Code refused the cut, or the query could not restart with it. The agent resumed the conversation as it was, once, and the session can be prompted. |
|
||||
| `persistFailed` | `rewind.json` could not be written. The conversation and the rewind point are unchanged: the query was not replaced. The transcript can gain the `last-prompt` line that any resume writes. |
|
||||
|
||||
When the removed message is the last user message, Claude Code also checks the removed range and refuses a cut that would remove what the client never saw, such as a message the session absorbed mid-turn.
|
||||
The refusal is deterministic, so the agent never retries it.
|
||||
If the recovery resume fails too, the request fails with an internal error, the session ends, and the client loads it again. When it fails because the account needs a sign-in, the request fails with `authRequired` and the session stays: the next prompt after the sign-in resumes it.
|
||||
|
||||
The request fails with `-32602` for:
|
||||
|
||||
- a `cursorId` that the session's history does not hold: an unknown id, an id that is no cursor, the first message, a message before the newest compaction when the history before it cannot be read (the fallback in `src/resumed-session.ts`), or one that an earlier rewind removed;
|
||||
- a session id that names a subagent's child session.
|
||||
|
||||
A `sessionId` that is not held by the agent fails with `-32002`.
|
||||
|
||||
## Presentation hints
|
||||
|
||||
Each session mode and each value of the mode config option carries `_meta.jetbrains.air.kind`:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Subagent sessions
|
||||
|
||||
A client that declares `clientCapabilities.subagents`, other than JetBrains AIR, gets each Agent or
|
||||
Task subagent as its own child session, following the [subagents RFD](https://github.com/agentclientprotocol/agent-client-protocol/blob/main/docs/rfds/subagents.mdx):
|
||||
Task subagent as its own child session, following ACP's [subagents](https://agentclientprotocol.com/protocol/v1/subagents):
|
||||
|
||||
- `subagent_update` on the parent announces the child before any of its traffic, with the
|
||||
parent's `title` and `description` for it, and reports its work state: `running`,
|
||||
@@ -32,6 +32,25 @@ Task subagent as its own child session, following the [subagents RFD](https://gi
|
||||
message to the parent instead, in both transcripts and linked the same way.
|
||||
- A launch whose child is never exposed is shown as a tool call after all, with its final
|
||||
status.
|
||||
- A forked skill (a skill with `context: fork`, such as `/code-review`) is a child session too.
|
||||
Claude Code runs it as a subagent that no Agent or Task call launched:
|
||||
- When Claude runs it with the Skill tool, the child is announced on the session that made the
|
||||
Skill call, once Claude Code reports its task. The Skill call stays a tool call of that session,
|
||||
with the skill's result. The skill's prompt is a `session_message` in the child's transcript
|
||||
only, with the Skill call's tool use id.
|
||||
- When the user types it, there is no call: the child is announced on the root session, and the
|
||||
command's output is the root's message. Claude Code (2.1.328) sends such a child's messages
|
||||
only when the command ends, after it reports the task's end. The adapter keeps the child
|
||||
`running` until they came, so its `idle` follows its tool calls and text. They all arrive at
|
||||
once: the child's transcript is not live.
|
||||
- A subagent that a typed skill launches gets no session: Claude Code reports the end of its
|
||||
task before the Agent call that launched it. That call is a tool call of the skill's child,
|
||||
with its final status.
|
||||
- After a `session/cancel` of the root session, a typed skill's messages are the output of
|
||||
stopped work, which the adapter drops: the child reports `idle` with `cancelled` and no more.
|
||||
After a `session/cancel` of the child itself, they still go to the child, before its `idle`
|
||||
with `cancelled`.
|
||||
- A replay shows no child for a forked skill. The Skill call stays a tool call.
|
||||
- On v1, the parent's prompt turn ends at its result, also while a background child that it
|
||||
launched or resumed still runs. The child's updates and requests follow the prompt response: the
|
||||
RFD has a client keep receiving child events after it. The parent's summary when the child ends
|
||||
@@ -48,10 +67,11 @@ Task subagent as its own child session, following the [subagents RFD](https://gi
|
||||
carries the RFD's `session` content, `{ "type": "session", "sessionId": "<child>" }`, after its
|
||||
other content: a TaskStop call whose `task_id`, or a SendMessage call whose `to`, is the child's
|
||||
agent id; a SendMessage call that resumed the child and stays shown because a permission request
|
||||
showed it first; and, on v1, an Agent or Task call that stays shown for the same reason. A
|
||||
`tool_call_update` without content carries none, since it would replace the content the client
|
||||
holds. A call that names the child by its name gets no reference: Claude Code resolves the
|
||||
name, and the adapter cannot tell which agent it picked.
|
||||
showed it first; on v1, an Agent or Task call that stays shown for the same reason; and the
|
||||
Skill call that launched a forked skill's child. A `tool_call_update` without content carries
|
||||
none, since it would replace the content the client holds. A call that names the child by its
|
||||
name gets no reference: Claude Code resolves the name, and the adapter cannot tell which agent it
|
||||
picked.
|
||||
- `session/cancel` on the parent interrupts Claude Code, which stops the foreground children that
|
||||
the turn waits on. Background children keep running, as the RFD prefers; a client stops one with
|
||||
its own `cancel`. Each stopped child reports `idle` with `cancelled` from Claude Code's own
|
||||
@@ -72,8 +92,20 @@ Task subagent as its own child session, following the [subagents RFD](https://gi
|
||||
session messages and `session` references as live, and its end is an `idle` before the response.
|
||||
Each replayed child's current state follows the response: on v1, the response is what separates
|
||||
a replayed child state from a current one.
|
||||
A replay sends no `config_option_update` of a child, since one that arrives before the response
|
||||
is a past value to the client. Each replayed child's configuration follows its current state:
|
||||
the configuration of a child that still runs, else its `model` option with the model of the
|
||||
latest response in its transcript, as the session's `model` option names it. A child that
|
||||
neither runs nor has a response gets none.
|
||||
A launch without Claude Code's metadata file for the child stays an ordinary tool call of the
|
||||
parent, and a notice, for a client that takes notices, says that subagent history is missing.
|
||||
- A session that is loaded or resumed with the same settings while it runs keeps its children's
|
||||
runs. After the response, each child that works and that no replay announced is announced
|
||||
again on its parent, with its labels, the `cancel` capability and its state, and then gets the
|
||||
configuration that the client last had for it: every working child after a `session/resume`,
|
||||
which replays nothing, and after a `session/load` a child whose launch the history does not
|
||||
have, such as a forked skill's. A child that no longer works but has a working child of its own
|
||||
is named first, with its labels only.
|
||||
- After a load or resume, with or without replay, a SendMessage that resumes an agent from before
|
||||
it runs that agent in its session from before. Before the agent's traffic, each of its ancestors
|
||||
that the client was not told about in this connection is announced, parent before child and
|
||||
@@ -84,17 +116,27 @@ Task subagent as its own child session, following the [subagents RFD](https://gi
|
||||
parent's: Claude Code also stops the foreground children it waits on, and the parent's turn goes
|
||||
on. Each stopped child reports `idle` with `cancelled` from Claude Code's own events, and its
|
||||
requests that the stop withdraws report no `running` first. A replayed child, which no longer
|
||||
runs, gets no capabilities. A client cannot prompt or otherwise change a child: any other request
|
||||
that names an announced child of a running session fails with `-32602` (Invalid params),
|
||||
`session/close` and `session/delete` too.
|
||||
runs, gets no capabilities, and a `session/cancel` of it does nothing. A client cannot prompt or
|
||||
otherwise change a child: any other request that names a child fails with `-32602` (Invalid
|
||||
params), `session/close` and `session/delete` too. That holds for every child that a
|
||||
`subagent_update` announced, while it ran or in a replay, until the client closes the child's
|
||||
root session: also after `/clear` and after a restart of the root's Claude Code process.
|
||||
|
||||
An [ACP v2](../README.md#experimental-acp-v2) client gets the same without declaring anything, since subagents
|
||||
An [ACP v2](../README.md#acp-v2-preview) client gets the same without declaring anything, since subagents
|
||||
are part of v2's baseline. Each child also reports its work state as its own `state_update`, right
|
||||
after the parent's copy. A replay ends each child's history with a `replay_complete` on the child's
|
||||
session. On v2, the parent's `replay_complete` is what separates a replayed child state from a
|
||||
current one, so each replayed child's current state follows the root session's `replay_complete`
|
||||
and comes before the response: on its parent, with the cleared `cwd`, and then as the child's own
|
||||
`idle`. The notice that subagent history is missing follows the root's `replay_complete` too.
|
||||
`idle`. The child's configuration follows it there, since v2 asks an agent not to replay a past
|
||||
`config_option_update`. The notice that subagent history is missing follows the root's
|
||||
`replay_complete` too.
|
||||
|
||||
On v2, a resume of the active session that replays can meet a child that the stored history does
|
||||
not launch: a forked skill's child, or a subagent that Claude launched after the history was written.
|
||||
Such a child is announced again right after the root's `replay_complete`, when it works, when its
|
||||
parent lists it, or when the replay held one of its updates. Its own `replay_complete` follows at
|
||||
once, since its replay is empty, and then come the updates that the replay held.
|
||||
|
||||
JetBrains AIR keeps the earlier draft of the RFD (`subagent_spawned`, `subagent_state_update`),
|
||||
which it enables with `nativeSubagentSessions` in `_meta.jetbrains.air.capabilities`. See
|
||||
|
||||
248
package-lock.json
generated
248
package-lock.json
generated
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"name": "@agentclientprotocol/claude-agent-acp",
|
||||
"version": "0.109.0",
|
||||
"version": "0.113.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@agentclientprotocol/claude-agent-acp",
|
||||
"version": "0.109.0",
|
||||
"version": "0.113.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "2.8.0",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.328",
|
||||
"@agentclientprotocol/sdk": "2.12.0",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.331",
|
||||
"diff": "9.0.0",
|
||||
"zod": "4.6.7"
|
||||
},
|
||||
@@ -18,12 +18,12 @@
|
||||
"claude-agent-acp": "dist/index.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anthropic-ai/sdk": "1.10.0",
|
||||
"@anthropic-ai/sdk": "1.13.0",
|
||||
"@eslint/js": "10.0.1",
|
||||
"@tsconfig/node22": "22.0.7",
|
||||
"@types/node": "26.6.6",
|
||||
"@typescript-eslint/eslint-plugin": "8.73.0",
|
||||
"@typescript-eslint/parser": "8.73.0",
|
||||
"@typescript-eslint/eslint-plugin": "8.74.0",
|
||||
"@typescript-eslint/parser": "8.74.0",
|
||||
"ajv": "8.20.0",
|
||||
"ajv-formats": "3.0.1",
|
||||
"eslint": "10.15.0",
|
||||
@@ -38,9 +38,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@agentclientprotocol/sdk": {
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@agentclientprotocol/sdk/-/sdk-2.8.0.tgz",
|
||||
"integrity": "sha512-EjsvoRX8nEH2z3PAVI2ILsVXAefVcSlLPeXGjlQoFgkJE71F2J0Fj7N6oL/k7SnP0vY+9hmONPFz/K2zalnTiw==",
|
||||
"version": "2.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@agentclientprotocol/sdk/-/sdk-2.12.0.tgz",
|
||||
"integrity": "sha512-nSkamfY4Lw9/AVBU5G5V9p82ScXhANDMBybQwcPH/9+euUtZm04/VFUMaLj4gLFEXxQEy+QP1VQiKgSRbYVIPg==",
|
||||
"license": "Apache-2.0",
|
||||
"peerDependencies": {
|
||||
"@modelcontextprotocol/server": "^2.4.0",
|
||||
@@ -53,22 +53,22 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk/-/claude-agent-sdk-0.3.328.tgz",
|
||||
"integrity": "sha512-YcOWlpXVm7etPjPVrvSJEfynDksMiG11zvEybSBnk1EVWji6rSjU75HbbhJ8XPEB2ECEwRRP597Udu6IWMtsDw==",
|
||||
"version": "0.3.331",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk/-/claude-agent-sdk-0.3.331.tgz",
|
||||
"integrity": "sha512-ml/MPqgO95tG5zcApBFxEyoDk57d9htP09R8AtPbKPUCHpsobf84IjkN4zhGvQgk8zsA9dXoeMGrQcCc8gQE/w==",
|
||||
"license": "SEE LICENSE IN README.md",
|
||||
"engines": {
|
||||
"node": ">=18.14.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.328",
|
||||
"@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.328"
|
||||
"@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.331",
|
||||
"@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.331",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.331",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.331",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.331",
|
||||
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.331",
|
||||
"@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.331",
|
||||
"@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.331"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@anthropic-ai/sdk": ">=0.93.0",
|
||||
@@ -77,9 +77,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-darwin-arm64": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-arm64/-/claude-agent-sdk-darwin-arm64-0.3.328.tgz",
|
||||
"integrity": "sha512-vjBASSSZFNs5M84XONCM4xAJMKPD0E9RtF0UDQ/a1Qqt5L+slNxhSADkH5n0tEM5HJMK7j9DCPi+0FVOBpZr3w==",
|
||||
"version": "0.3.331",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-arm64/-/claude-agent-sdk-darwin-arm64-0.3.331.tgz",
|
||||
"integrity": "sha512-PQrn7YTiSV5Bg+ueF2hNvswc+wI7YKC2c32XNedvs6vfMCUUnIlq93VEbZiRY23b+JIVkEm8gb1VhkJTjsYISQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -90,9 +90,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-darwin-x64": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-x64/-/claude-agent-sdk-darwin-x64-0.3.328.tgz",
|
||||
"integrity": "sha512-pkZuDNi16H4yJFo6cS2sw8mFj7m7ESAxV74t2gQ9EFzZOpXbQoJqhPBHNEZJ2q/+kr/3vHUtRc2W6jURA6nS+A==",
|
||||
"version": "0.3.331",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-x64/-/claude-agent-sdk-darwin-x64-0.3.331.tgz",
|
||||
"integrity": "sha512-dc3iB+CY3jDpKpDpmvYc4V+UKSkudY29iJ62p0s5TK3h+b7Wqa2Hv0bPow0LUs4ZzDUXxEtCEHzk9X29VfLovw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -103,9 +103,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-linux-arm64": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64/-/claude-agent-sdk-linux-arm64-0.3.328.tgz",
|
||||
"integrity": "sha512-VvsUzOEf7r3ZtOPfliNGxqknsIvxEmnUOtQnq4+uw7MsfiALKR4s0bx2SP32UuXpqbmqxR1gn456D27XgsAmnA==",
|
||||
"version": "0.3.331",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64/-/claude-agent-sdk-linux-arm64-0.3.331.tgz",
|
||||
"integrity": "sha512-xiRxBxoM8Qa5fnjCFk5iFheL5GUroLuHPJ7UnD4v2Sv1tWxGoSL67AYnMZ6OdjMguZK09X4WlgOn1nL1m6NEOA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -119,9 +119,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-linux-arm64-musl": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64-musl/-/claude-agent-sdk-linux-arm64-musl-0.3.328.tgz",
|
||||
"integrity": "sha512-4Vui26/OZwr8AU7FpAt+R5s/1AKmj5qDorUZIqF1MMfdjAQf8/ut/+HyEkuMom/MVF2JeQLdvnFFFmbfgmAq/g==",
|
||||
"version": "0.3.331",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64-musl/-/claude-agent-sdk-linux-arm64-musl-0.3.331.tgz",
|
||||
"integrity": "sha512-KdIClOdBUIpvf4PTFe2qedtPCOM3tC/jbsjh8U6WXF0QS8VjYkP0QR9i2AXG1PSAnI24T5xTxQb1scPAgRTIUQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -135,9 +135,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-linux-x64": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64/-/claude-agent-sdk-linux-x64-0.3.328.tgz",
|
||||
"integrity": "sha512-saP4fWgVZj1n7MYCqvTKADHXIc/hIAMRDpLVpXD5xB0IT68vhWgIMkzIrsg5P02P6zA49TDuoijbP1YBUEXT4A==",
|
||||
"version": "0.3.331",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64/-/claude-agent-sdk-linux-x64-0.3.331.tgz",
|
||||
"integrity": "sha512-nfHSiLJdkpsVAFsXTriyW3r64gS1sp5zxvaoF2dmNqKixR4rf9ISDDi81gF9L1uk/bAEcBGRx34U6Itw+NYIEg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -151,9 +151,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-linux-x64-musl": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64-musl/-/claude-agent-sdk-linux-x64-musl-0.3.328.tgz",
|
||||
"integrity": "sha512-oJowzzjhWGbdBGyRjqV9CT0nfh4A4/fEI11LjX6b1SkhrNNgy9QT2HzSe8A2yNlliOWo1xJl6nAHT8pLwMNlVg==",
|
||||
"version": "0.3.331",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64-musl/-/claude-agent-sdk-linux-x64-musl-0.3.331.tgz",
|
||||
"integrity": "sha512-CSeT1JF++Vckf6TSXjQeuSjQ/sJnoTVL/XX44v4jHNAtU5i22nI9b27E6wkzudYVxoRoLWIU00V05dXhYYCvlg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -167,9 +167,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-win32-arm64": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-arm64/-/claude-agent-sdk-win32-arm64-0.3.328.tgz",
|
||||
"integrity": "sha512-FkqzA++c+giPH2k8svb0egWDiGDkvSLQJTp5bq7QFXOxPEael4ct1yjKit/Yu6Sd48uLEgNT1waBYbyApPzhOw==",
|
||||
"version": "0.3.331",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-arm64/-/claude-agent-sdk-win32-arm64-0.3.331.tgz",
|
||||
"integrity": "sha512-FsPHWUpgHBFgSZESwM53JsbEoQiWPnigSCyjSfHDyiWnH66e0NsuksuJ/Nu9qI8UVgBDh/y1NOnnd4eGrB3eFQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -180,9 +180,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk-win32-x64": {
|
||||
"version": "0.3.328",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-x64/-/claude-agent-sdk-win32-x64-0.3.328.tgz",
|
||||
"integrity": "sha512-9Wd0XrZ0QWkgtcKxObcYDvUpQjUzN3Uq4Chbvu1SOWOoKPfQdD40dwRQMCeKx2KGxAfMrggJ7I3JYnvRWAFYjg==",
|
||||
"version": "0.3.331",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-x64/-/claude-agent-sdk-win32-x64-0.3.331.tgz",
|
||||
"integrity": "sha512-AsLur4ov9MGTQTrnZ49ZDPasQ35U3X/rZDdF/rPhytN3h1F3w/0IkC6esW3OzldvPlci60QvggOLVGnFlUzdxw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -193,9 +193,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@anthropic-ai/sdk": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.10.0.tgz",
|
||||
"integrity": "sha512-j4uVct5p3aGIz/BU4K8VU5vt2A6AueHTvx2gfF3xr4mVpwH9IJMWEAUKNwSwdZSJOHQq1Za2tv5huYc5v02D0w==",
|
||||
"version": "1.13.0",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.13.0.tgz",
|
||||
"integrity": "sha512-F4Qu3zqRINxTV5xruOvw1gXhEsYH4lOgxffxZx4IworMefc395T458pl5Uj3TZiAlO3+gvhYoHSHU7qDsrchNA==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@opentelemetry/api": "^1.4.1",
|
||||
@@ -215,9 +215,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/runtime": {
|
||||
"version": "7.29.14",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.14.tgz",
|
||||
"integrity": "sha512-Y5tqevQaUAZhhj82BpYMNC1ssvLQTVAfwKdm8iy8qwmhvC2/CpcAu8OC+QEtjM7pMk7knx83u1Qj8gzkicyelw==",
|
||||
"version": "7.29.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.15.tgz",
|
||||
"integrity": "sha512-304gsbbGVmQc+cNGHzwHBlqepYdWLKj3VXCQBGt/EGcV7PUPfKI7kAUNW1FZEOCwlQiLvQjg1JEaAlRQ616h+Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@@ -400,9 +400,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@hono/node-server": {
|
||||
"version": "2.1.9",
|
||||
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.9.tgz",
|
||||
"integrity": "sha512-Sk4NQd3GFY0WZWCzndwFMPwJhtD0y9qjsQ+pjID0/03nK9pxyBCUoUHCho8QYBLBVhi0ssL8UkNPHqbgSOFPIQ==",
|
||||
"version": "2.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.11.tgz",
|
||||
"integrity": "sha512-KzKz9vl4vvr1vgLHamj+g5uonbrj5NwAdO3yzOS6cd2HjALVeOgTgeZOyAzNxejbkfOOPIcvuf/Tg8l1pEFLog==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
@@ -1012,17 +1012,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.73.0.tgz",
|
||||
"integrity": "sha512-UkygMFer53Yzn29MCYFTHf34hGXf5KJhiDWfIm1tXtXRrym1CS6l5H9Y3yCtPWChpC0/f93H88gdj8tN0dd4kw==",
|
||||
"version": "8.74.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.74.0.tgz",
|
||||
"integrity": "sha512-z3KXk1+Vm+d82ZRplOoC89ho4Rf1da5ju6sx8//92GnN532U62DGPjECXkkVqtYzIv0zoJlpO39SX2Z9tk6LVw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.12.2",
|
||||
"@typescript-eslint/scope-manager": "8.73.0",
|
||||
"@typescript-eslint/type-utils": "8.73.0",
|
||||
"@typescript-eslint/utils": "8.73.0",
|
||||
"@typescript-eslint/visitor-keys": "8.73.0",
|
||||
"@typescript-eslint/scope-manager": "8.74.0",
|
||||
"@typescript-eslint/type-utils": "8.74.0",
|
||||
"@typescript-eslint/utils": "8.74.0",
|
||||
"@typescript-eslint/visitor-keys": "8.74.0",
|
||||
"ignore": "^7.0.5",
|
||||
"natural-compare": "^1.4.0",
|
||||
"ts-api-utils": "^2.5.0"
|
||||
@@ -1035,22 +1035,22 @@
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@typescript-eslint/parser": "^8.73.0",
|
||||
"@typescript-eslint/parser": "^8.74.0",
|
||||
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
|
||||
"typescript": ">=4.8.4 <6.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.73.0.tgz",
|
||||
"integrity": "sha512-AuL45bVcmssHfZ3Di3cs9Q0l4gBm4ZFVrJOQEE7VpqW+PVgQaEwSwazz4TVIiFabXkk6U51EprYDwqw+HR8ePw==",
|
||||
"version": "8.74.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.74.0.tgz",
|
||||
"integrity": "sha512-ecr8AYdig7avVkxaHdQvxHnIJ/mOyliO4Gv/uWF8q69vBew/z3sexqBwHUZX5Vql+Ns0w4sH6gBLkICGbOvJkA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.73.0",
|
||||
"@typescript-eslint/types": "8.73.0",
|
||||
"@typescript-eslint/typescript-estree": "8.73.0",
|
||||
"@typescript-eslint/visitor-keys": "8.73.0",
|
||||
"@typescript-eslint/scope-manager": "8.74.0",
|
||||
"@typescript-eslint/types": "8.74.0",
|
||||
"@typescript-eslint/typescript-estree": "8.74.0",
|
||||
"@typescript-eslint/visitor-keys": "8.74.0",
|
||||
"debug": "^4.4.3"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1066,14 +1066,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/project-service": {
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.73.0.tgz",
|
||||
"integrity": "sha512-/pEf8Rc4Mjk+qJnY0uO1+Gadeal8uv50xpuic+srG2vIVatA0XxvWMUeMtFvs6OCHqftiQ7/+qH4aehG5stzIA==",
|
||||
"version": "8.74.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.74.0.tgz",
|
||||
"integrity": "sha512-z/mymuE+JlEeSFIv3Mo70EvgG1Zz74Hl0IDfExfXutARAP834bt+MppTD7mVAwmZO0GdxdOAi0jbTam749eH6g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/tsconfig-utils": "^8.73.0",
|
||||
"@typescript-eslint/types": "^8.73.0",
|
||||
"@typescript-eslint/tsconfig-utils": "^8.74.0",
|
||||
"@typescript-eslint/types": "^8.74.0",
|
||||
"debug": "^4.4.3"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1088,14 +1088,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.73.0.tgz",
|
||||
"integrity": "sha512-/TjD738Iq2rzj5z0ixVOi+TsvgjAzZPLPaH1yWdDBytR/HTR5gMpyYWZeCe5WTQZLwk3ho8AV7U3muoQCRtXBQ==",
|
||||
"version": "8.74.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.74.0.tgz",
|
||||
"integrity": "sha512-kpOdpu4CpWN5U38ox3f727DwWRBtUAVhyUJtqTBYe5gf2wYoxac7PgKP14txrxN7ICVtcjlLdzjqfRgpSnDKvQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.73.0",
|
||||
"@typescript-eslint/visitor-keys": "8.73.0"
|
||||
"@typescript-eslint/types": "8.74.0",
|
||||
"@typescript-eslint/visitor-keys": "8.74.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
@@ -1106,9 +1106,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/tsconfig-utils": {
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.73.0.tgz",
|
||||
"integrity": "sha512-lmtCFOfYaJfpqZywGuXi4FpNtE+NQ+YLe3T0K9rtEDcW8ZuGWvfI++pj8r05sYMI8vWT2CYK4rWyedmD6Rp4og==",
|
||||
"version": "8.74.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.74.0.tgz",
|
||||
"integrity": "sha512-p07wAuaS6BjCYgOSXKJi4YhvTnAf7fiG37e9THcpnYaQEt2QiTTYZWKwUFNgeRiywiMudazhzgddAirZ0GgHtQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -1123,15 +1123,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.73.0.tgz",
|
||||
"integrity": "sha512-MOC9i4xy1F7KcDde7Ip8jf1SrRiALb2Km4UWxGNjUE2YlhjIEo1ayE27GHIwIQyfWuHTmEonQT14uyurlyC6aA==",
|
||||
"version": "8.74.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.74.0.tgz",
|
||||
"integrity": "sha512-CV3Y3la8l3F9ANfxcfpgSSiQgJTe4IeLEoZV4O/gcW86Ugp8X6SKiQ0vm+QegXaRIbbDMokZZSF3A1CgiU/kPw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.73.0",
|
||||
"@typescript-eslint/typescript-estree": "8.73.0",
|
||||
"@typescript-eslint/utils": "8.73.0",
|
||||
"@typescript-eslint/types": "8.74.0",
|
||||
"@typescript-eslint/typescript-estree": "8.74.0",
|
||||
"@typescript-eslint/utils": "8.74.0",
|
||||
"debug": "^4.4.3",
|
||||
"ts-api-utils": "^2.5.0"
|
||||
},
|
||||
@@ -1148,9 +1148,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.73.0.tgz",
|
||||
"integrity": "sha512-O/1ytYzflF16QDKXx4/qOXg1IuZp+n7hr9t+S0nv7N/2Tl8rJiNCshztV1gcSUvHbPtoX3+zmNbtSAyVbzxVfw==",
|
||||
"version": "8.74.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.74.0.tgz",
|
||||
"integrity": "sha512-MpnMrJCVNpP1iVL8NiHkQZgQqIMBH5ewDGUPBh1pqQXwFtMFjsl1M03QcYPXmv6stCKEiF0PN7CGbU1ZbXFzEA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -1162,16 +1162,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.73.0.tgz",
|
||||
"integrity": "sha512-InjlBkSdWceIwIBWSwS3ENUp+i0O02PGX3Zv2wnihWJC1WDVGvG7mTHuf8b57uAaITj94d6tRPDH+sUEtXdRQQ==",
|
||||
"version": "8.74.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.74.0.tgz",
|
||||
"integrity": "sha512-wL348k6l92DNG+kPP5rVpKwNBoz7a3xRZy3TPKc1uymQttd7u7gcMv3eENmcuh4CjC4mO3FTM0DYstFXMyDLuw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/project-service": "8.73.0",
|
||||
"@typescript-eslint/tsconfig-utils": "8.73.0",
|
||||
"@typescript-eslint/types": "8.73.0",
|
||||
"@typescript-eslint/visitor-keys": "8.73.0",
|
||||
"@typescript-eslint/project-service": "8.74.0",
|
||||
"@typescript-eslint/tsconfig-utils": "8.74.0",
|
||||
"@typescript-eslint/types": "8.74.0",
|
||||
"@typescript-eslint/visitor-keys": "8.74.0",
|
||||
"debug": "^4.4.3",
|
||||
"minimatch": "^11.0.1",
|
||||
"semver": "^7.7.3",
|
||||
@@ -1196,16 +1196,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/utils": {
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.73.0.tgz",
|
||||
"integrity": "sha512-j2SVJJvVkXdUL0WcEzo4vEH1mO1vIi8KlVukcYA2MgMZvYN2LlZR4PmsW+GTSxSW24j6Q/EP7+MOifLtg5hmsA==",
|
||||
"version": "8.74.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.74.0.tgz",
|
||||
"integrity": "sha512-IpWXPxXXomzxyTcvjhZJexgdvtTR1TooLAPpuxzaGqQ8BHll1lf4Ysp/BTE/l0U5TJ+x1j7B4bEM8pLRrvY+XA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.9.1",
|
||||
"@typescript-eslint/scope-manager": "8.73.0",
|
||||
"@typescript-eslint/types": "8.73.0",
|
||||
"@typescript-eslint/typescript-estree": "8.73.0"
|
||||
"@typescript-eslint/scope-manager": "8.74.0",
|
||||
"@typescript-eslint/types": "8.74.0",
|
||||
"@typescript-eslint/typescript-estree": "8.74.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
@@ -1220,13 +1220,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.73.0.tgz",
|
||||
"integrity": "sha512-k4lsFVpRZICbltkIEEH4hZRkwXkqDF1GHBpClKQOHQY+RkoZAAuyc1ci3I6p+CB6v3U4jaHIUshc4RzzQXZWLg==",
|
||||
"version": "8.74.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.74.0.tgz",
|
||||
"integrity": "sha512-XSZmOtMUbWCBIM+2BK134FyMFxmll1mW2mPLk/PSwYQYzGIPMgJAqL929U4qXVizLv7Xq5b7r41/o7Ombuwk0g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.73.0",
|
||||
"@typescript-eslint/types": "8.74.0",
|
||||
"eslint-visitor-keys": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1418,9 +1418,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "5.0.13",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.13.tgz",
|
||||
"integrity": "sha512-Vh3dmFbc4wZeox7M9I/0L9GfFd83Su4+yCck/OF9Gi/P/dAHn0RT7X4K9R7gMNMhDck3DvhR6QXsnQdjjgwNvQ==",
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.1.0.tgz",
|
||||
"integrity": "sha512-aa11Dv491GKnYqxaul3aRJ0szew7yMJMfZPnqD44NjGrZXoj62l41OEDDpdpC4eE2P88vBFfLuSyRhpG91NUvg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -2375,9 +2375,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/hono": {
|
||||
"version": "4.13.19",
|
||||
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.19.tgz",
|
||||
"integrity": "sha512-KmXvQAXwcAHV+muzbIwoJ23niEB5nMoDVr9WcRkU8mvjUECm/1+7v4Jgp7P7a+H6MLFrh+vXrGonGrGS+RQfkA==",
|
||||
"version": "4.13.21",
|
||||
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.21.tgz",
|
||||
"integrity": "sha512-h9UsguqfVk4kjUwLvQpHOmOaJpW10jz9lp8bvKUUa04wJG/fabKFBqXZ06D6LFaeKQZtUZRVeg0gfkTTEsX7Mw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
@@ -3211,9 +3211,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/pkce-challenge": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz",
|
||||
"integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==",
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.2.tgz",
|
||||
"integrity": "sha512-vCc54+qyIfKC5e2UN28AZKElwqjLINgiIV3RKI8pDu93TjaAJoB3QrgMzEBouy8yOKsXVXdAinO1QArJf9x5WA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
@@ -3609,14 +3609,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.3.tgz",
|
||||
"integrity": "sha512-xj+WrAkyv5Qp+t7r9N5HvCBu7g1qOe6CKRNpq22X1GGcPEQADFU54v5qsPVs3/vrUFQ7XivFrcAVKA2stI0kWA==",
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.4.tgz",
|
||||
"integrity": "sha512-J7ZjMvHd9O1fcT/5V09QWaaSl2BbWx3F6O08spde82Namf9UB0GxRVIPiNbVsdKkoizHiSpTodo3vp2bAy91MA==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/standardwebhooks": {
|
||||
@@ -3647,9 +3647,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/tinybench": {
|
||||
"version": "6.2.4",
|
||||
"resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.4.tgz",
|
||||
"integrity": "sha512-SQ52jEncXxbMCzJuY2A/jGIbbAu6NYsBWW7grz2pNE+EnzQdoGaoBfpk4qC/opE7qiUcGmGgaGIz5EoHdS1O9w==",
|
||||
"version": "6.2.5",
|
||||
"resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.5.tgz",
|
||||
"integrity": "sha512-b/8GRMdnY4cqkfCLyaFpTGIv1qwfi3oT0mWaepwT++6Z/ZrYehNfZZ2JDKVLKGhNoEkS3IIB1ELtCT0XS5DtOA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
|
||||
12
package.json
12
package.json
@@ -3,7 +3,7 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"version": "0.109.0",
|
||||
"version": "0.113.0",
|
||||
"description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
|
||||
"main": "dist/lib.js",
|
||||
"types": "dist/lib.d.ts",
|
||||
@@ -68,18 +68,18 @@
|
||||
"node": ">=22"
|
||||
},
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "2.8.0",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.328",
|
||||
"@agentclientprotocol/sdk": "2.12.0",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.331",
|
||||
"diff": "9.0.0",
|
||||
"zod": "4.6.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anthropic-ai/sdk": "1.10.0",
|
||||
"@anthropic-ai/sdk": "1.13.0",
|
||||
"@eslint/js": "10.0.1",
|
||||
"@tsconfig/node22": "22.0.7",
|
||||
"@types/node": "26.6.6",
|
||||
"@typescript-eslint/eslint-plugin": "8.73.0",
|
||||
"@typescript-eslint/parser": "8.73.0",
|
||||
"@typescript-eslint/eslint-plugin": "8.74.0",
|
||||
"@typescript-eslint/parser": "8.74.0",
|
||||
"ajv": "8.20.0",
|
||||
"ajv-formats": "3.0.1",
|
||||
"eslint": "10.15.0",
|
||||
|
||||
@@ -37,6 +37,59 @@ export function restrictedChild(sessionId: string, method: string): RequestError
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The child sessions that the sessions of one connection announced with
|
||||
* `subagent_update`, while they run or in the replay of a `session/load` or
|
||||
* `session/resume`. The client knows such a session, so a request that names
|
||||
* it fails as {@link restrictedChild} says, and not as a request of an unknown
|
||||
* session.
|
||||
*
|
||||
* A child is known from its announcement until the client ends its root
|
||||
* session ({@link rootClosed}): with `session/close`, or a request that closes
|
||||
* the session too, such as `session/delete`. Nothing else removes it: after a
|
||||
* conversation reset (`/clear`), a restart of the root's query or the end of
|
||||
* the root's Claude Code process, the client still holds the child.
|
||||
*
|
||||
* AIR's draft announces a child with `subagent_spawned` and keeps its own
|
||||
* rules, so its children are never known here.
|
||||
*/
|
||||
export class AnnouncedChildren {
|
||||
/** The root session of each announced child session, by the child's id. */
|
||||
private readonly rootByChild = new Map<string, string>();
|
||||
|
||||
/**
|
||||
* Takes a session update that goes to the client. A `subagent_update`
|
||||
* announces the child session it names, or reports on one that is known
|
||||
* already. The update's own session is the child's parent, which can be a
|
||||
* child itself: its root is the child's too.
|
||||
*/
|
||||
sending(notification: {
|
||||
sessionId: string;
|
||||
update: { sessionUpdate: string; sessionId?: unknown };
|
||||
}): void {
|
||||
const { sessionId: parent, update } = notification;
|
||||
if (update.sessionUpdate !== "subagent_update" || typeof update.sessionId !== "string") return;
|
||||
this.rootByChild.set(update.sessionId, this.rootByChild.get(parent) ?? parent);
|
||||
}
|
||||
|
||||
/** Whether `sessionId` is a child session that the client knows. */
|
||||
has(sessionId: string): boolean {
|
||||
return this.rootByChild.has(sessionId);
|
||||
}
|
||||
|
||||
/** The root session of the child session `sessionId`, when the client knows it. */
|
||||
rootOf(sessionId: string): string | undefined {
|
||||
return this.rootByChild.get(sessionId);
|
||||
}
|
||||
|
||||
/** The client ended the session `rootSessionId`, and can no longer name its children. */
|
||||
rootClosed(rootSessionId: string): void {
|
||||
for (const [child, root] of this.rootByChild) {
|
||||
if (root === rootSessionId) this.rootByChild.delete(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** The form of native subagent sessions that the client gets, or none. */
|
||||
export function subagentForm(capabilities?: ClientCapabilities | null): SubagentForm | undefined {
|
||||
if (!clientSupportsSubagents(capabilities)) return undefined;
|
||||
|
||||
146
src/adapter-command.ts
Normal file
146
src/adapter-command.ts
Normal file
@@ -0,0 +1,146 @@
|
||||
/**
|
||||
* The commands the adapter serves itself instead of passing to Claude Code
|
||||
* (`/remote-control` and `/plugin`), in one place so that the command list and
|
||||
* the dispatch in the v1 and v2 cores apply the same rule.
|
||||
*/
|
||||
import type { AvailableCommand } from "@agentclientprotocol/sdk/unstable";
|
||||
import type { Query, SlashCommand } from "@anthropic-ai/claude-agent-sdk";
|
||||
import { claudeCliPath, isRemoteSession } from "./claude-cli.js";
|
||||
import type { NewSessionMeta } from "./new-session-meta.js";
|
||||
import {
|
||||
parsePluginCommand,
|
||||
pluginCommandMarkdown,
|
||||
PLUGIN_AVAILABLE_COMMAND,
|
||||
PLUGIN_COMMAND_NAME,
|
||||
runPluginCommand,
|
||||
} from "./plugin-command.js";
|
||||
import {
|
||||
adapterRemoteControlCommand,
|
||||
claudeCodeOffersCommand,
|
||||
parseRemoteControlCommand,
|
||||
REMOTE_CONTROL_COMMAND_NAME,
|
||||
type RemoteControlCommand,
|
||||
runRemoteControlCommand,
|
||||
supportsRemoteControl,
|
||||
} from "./remote-control.js";
|
||||
|
||||
type PromptContent = ReadonlyArray<{ type: string; text?: unknown }>;
|
||||
|
||||
export interface AdapterCommand {
|
||||
readonly name: typeof REMOTE_CONTROL_COMMAND_NAME | typeof PLUGIN_COMMAND_NAME;
|
||||
/** The `RequestError` text while Claude is working. */
|
||||
readonly busyMessage: string;
|
||||
/** The `RequestError` text while another adapter command runs. */
|
||||
readonly inFlightMessage: string;
|
||||
/** What `/remote-control` was asked to do. A core records it before the
|
||||
* command runs, so that a restart of the query keeps what the user chose
|
||||
* (see `RemoteControlAtStartup.commandRan`). */
|
||||
readonly remoteControl?: RemoteControlCommand;
|
||||
/** Returns the reply text. A failure is in the text: this never throws. */
|
||||
run(signal: AbortSignal): Promise<string>;
|
||||
}
|
||||
|
||||
export interface AdapterCommandContext {
|
||||
cwd: string;
|
||||
env: Record<string, string | undefined>;
|
||||
/** The session runs Claude Code remotely (`sdk-url`). */
|
||||
remoteSession: boolean;
|
||||
query: () => Query | undefined;
|
||||
logError: (message: string) => void;
|
||||
}
|
||||
|
||||
/** The session's client options (`_meta.claudeCode.options`) that decide where
|
||||
* an adapter command runs: the CLI's `env`, and whether Claude Code is remote. */
|
||||
export function sessionAdapterOptions(creationParams: { _meta?: unknown } | undefined): {
|
||||
env: Record<string, string | undefined>;
|
||||
remoteSession: boolean;
|
||||
} {
|
||||
const options = (creationParams?._meta as NewSessionMeta | undefined)?.claudeCode?.options;
|
||||
return {
|
||||
env: { ...process.env, ...options?.env },
|
||||
remoteSession: isRemoteSession(options?.extraArgs),
|
||||
};
|
||||
}
|
||||
|
||||
const REMOTE_CONTROL_ENTRY: AvailableCommand = {
|
||||
name: REMOTE_CONTROL_COMMAND_NAME,
|
||||
description:
|
||||
"Continue this session from claude.ai/code or the Claude mobile app; `off` disconnects",
|
||||
input: { hint: "[session name | off]" },
|
||||
};
|
||||
|
||||
/** A cheap synchronous check for the cores, before any await: the prompt has
|
||||
* the form of an adapter command. Whether the adapter serves it is
|
||||
* {@link adapterCommand}'s decision. */
|
||||
export function mayBeAdapterCommand(prompt: PromptContent): boolean {
|
||||
return parseRemoteControlCommand(prompt) !== null || parsePluginCommand(prompt) !== null;
|
||||
}
|
||||
|
||||
/** The adapter command of `prompt` that the adapter runs, or `null` for a
|
||||
* prompt that goes to Claude Code. */
|
||||
export async function adapterCommand(
|
||||
prompt: PromptContent,
|
||||
query: Query,
|
||||
terminalCommands: readonly string[] | undefined,
|
||||
context: AdapterCommandContext,
|
||||
): Promise<AdapterCommand | null> {
|
||||
const remoteControl = await adapterRemoteControlCommand(prompt, query, terminalCommands);
|
||||
if (remoteControl) {
|
||||
return {
|
||||
name: REMOTE_CONTROL_COMMAND_NAME,
|
||||
busyMessage:
|
||||
"Remote Control can't be changed while Claude is working. Try again when the turn ends.",
|
||||
inFlightMessage: "Remote Control is already being changed. Try again in a moment.",
|
||||
remoteControl: remoteControl.command,
|
||||
run: () =>
|
||||
runRemoteControlCommand(remoteControl.query, remoteControl.command, context.logError),
|
||||
};
|
||||
}
|
||||
|
||||
const command = parsePluginCommand(prompt);
|
||||
// A session with `sdk-url` runs Claude Code on another machine; the CLI that
|
||||
// the adapter would start here changes the plugins of this machine instead.
|
||||
if (!command || context.remoteSession) return null;
|
||||
const typed = typedCommandName(prompt);
|
||||
if (claudeCodeOffersCommand(await query.supportedCommands(), terminalCommands, typed)) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
name: PLUGIN_COMMAND_NAME,
|
||||
busyMessage: "/plugin can't run while Claude is working. Try again when the turn ends.",
|
||||
inFlightMessage: "Another command is still running. Try again in a moment.",
|
||||
run: async (signal) =>
|
||||
pluginCommandMarkdown(
|
||||
await runPluginCommand(command, {
|
||||
cliPath: claudeCliPath,
|
||||
cwd: context.cwd,
|
||||
env: context.env,
|
||||
signal,
|
||||
query: context.query,
|
||||
logError: context.logError,
|
||||
}),
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
/** The name the user typed: `plugin`, `plugins` or `marketplace`. */
|
||||
function typedCommandName(prompt: PromptContent): string {
|
||||
const text = typeof prompt[0]?.text === "string" ? prompt[0].text : "";
|
||||
return /^\/([^\s]+)/.exec(text.trim())?.[1] ?? PLUGIN_COMMAND_NAME;
|
||||
}
|
||||
|
||||
/** The entries of `available_commands_update` that the adapter serves,
|
||||
* without those that Claude Code offers under the same name. */
|
||||
export function adapterAvailableCommands(
|
||||
commands: readonly SlashCommand[],
|
||||
terminalCommands: readonly string[] | undefined,
|
||||
query: Query | undefined,
|
||||
{ remoteSession }: { remoteSession: boolean },
|
||||
): AvailableCommand[] {
|
||||
const entries: AvailableCommand[] = [];
|
||||
if (query && supportsRemoteControl(query)) entries.push(REMOTE_CONTROL_ENTRY);
|
||||
if (!remoteSession) entries.push(PLUGIN_AVAILABLE_COMMAND);
|
||||
return entries.filter(
|
||||
(entry) => !claudeCodeOffersCommand(commands, terminalCommands, entry.name),
|
||||
);
|
||||
}
|
||||
@@ -48,6 +48,13 @@ export const AIR_SESSION_LIST_SUBSCRIBE_CAPABILITY = "sessionListSubscribe";
|
||||
* {@link AIR_SESSION_INDEX_CAPABILITY} is; the client does not declare it.
|
||||
*/
|
||||
export const AIR_SESSION_WORKTREES_CAPABILITY = "sessionWorktrees";
|
||||
/**
|
||||
* `_session/rewind`: removes a user message and everything after it from the
|
||||
* context of the same session (see `docs/air-extensions.md#session-rewind`).
|
||||
* The client declares it; the agent advertises it only to such a client, and
|
||||
* then announces its session cursors with the `rewind` capability.
|
||||
*/
|
||||
export const AIR_SESSION_REWIND_CAPABILITY = "sessionRewind";
|
||||
/**
|
||||
* The client wants to know when the history replay of a loaded session is
|
||||
* whole. After the last replayed update, the agent sends one
|
||||
@@ -69,6 +76,14 @@ export const AIR_KIND_KEY = "kind";
|
||||
export const AIR_SKILL_PATH_KEY = "skillPath";
|
||||
export const AIR_PERMISSION_KEY = "permission";
|
||||
export const AIR_CUSTOM_ANSWER_KEY = "customAnswer";
|
||||
/**
|
||||
* The `_meta.jetbrains.air` key of a `model` option entry: the effort levels
|
||||
* of the model and the recommended one, `{values, recommended}`. Every AIR
|
||||
* client gets it, without a capability: the key only adds data.
|
||||
*/
|
||||
export const AIR_REASONING_EFFORTS_KEY = "reasoningEfforts";
|
||||
/** The companion field keys in an ACP form elicitation request. */
|
||||
export const AIR_CUSTOM_ANSWER_FIELDS_KEY = "customAnswerFields";
|
||||
/** The `_meta.jetbrains.air` key of the update that ends a whole history replay. */
|
||||
export const AIR_LOAD_REPLAY_END_KEY = "loadReplayEnd";
|
||||
/**
|
||||
|
||||
@@ -20,13 +20,19 @@ import {
|
||||
AUTH_STATUS_PROBE_TIMEOUT_MS,
|
||||
type AuthStatus,
|
||||
type AuthStatusKind,
|
||||
cliAuthIdentity,
|
||||
fromAccountInfo,
|
||||
fromCliStatus,
|
||||
mergeAuthStatus,
|
||||
parseCliAuthStatus,
|
||||
sameAuthStatus,
|
||||
toAcpAuthStatus,
|
||||
} from "./auth-status.js";
|
||||
import { claudeCliPath } from "./claude-cli.js";
|
||||
import {
|
||||
claudeAuthRefusal,
|
||||
isClaudeEnterprisePlan,
|
||||
shouldHideClaudeAuth,
|
||||
} from "./hide-claude-auth.js";
|
||||
import type { SettingsManager } from "./settings.js";
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
@@ -81,8 +87,7 @@ export class AuthStatusReporter {
|
||||
private probeRuns = 0;
|
||||
/** The latest-started probe run that published its read. */
|
||||
private publishedRun = 0;
|
||||
/** The last `auth/status_update` payload sent, as JSON. */
|
||||
private sentAcp?: string;
|
||||
private acpStatus: AcpAuthStatus = { state: "unknown" };
|
||||
|
||||
constructor(private readonly options: AuthStatusReporterOptions) {}
|
||||
|
||||
@@ -100,28 +105,24 @@ export class AuthStatusReporter {
|
||||
* reach here at all (see the epoch check in the probe and the guards at
|
||||
* session create).
|
||||
*/
|
||||
set(next: AuthStatus | undefined): void {
|
||||
set(next: AuthStatus | undefined, refused = false): void {
|
||||
if (!next) {
|
||||
return;
|
||||
}
|
||||
if (sameAuthStatus(this.current, next)) {
|
||||
if (!sameAuthStatus(this.current, next)) {
|
||||
this.current = next;
|
||||
// Older clients still get the actual identity, including one the guard refused.
|
||||
void Promise.resolve()
|
||||
.then(() => this.options.push(next))
|
||||
.catch((error) => {
|
||||
this.options.logger.error("Failed to send _auth/status_update:", error);
|
||||
});
|
||||
}
|
||||
const acp = toAcpAuthStatus(next, refused);
|
||||
if (JSON.stringify(acp) === JSON.stringify(this.acpStatus)) {
|
||||
return;
|
||||
}
|
||||
this.current = next;
|
||||
// ACP notifications get no reply, and clients that do not know the method
|
||||
// drop it silently — send unconditionally and never fail a caller on it.
|
||||
void Promise.resolve()
|
||||
.then(() => this.options.push(next))
|
||||
.catch((error) => {
|
||||
this.options.logger.error("Failed to send _auth/status_update:", error);
|
||||
});
|
||||
// Compared on its own payload: two identities can map to the same one.
|
||||
const acp = toAcpAuthStatus(next);
|
||||
const sent = JSON.stringify(acp);
|
||||
if (sent === this.sentAcp) {
|
||||
return;
|
||||
}
|
||||
this.sentAcp = sent;
|
||||
this.acpStatus = acp;
|
||||
void Promise.resolve()
|
||||
.then(() => this.options.pushAcp(acp))
|
||||
.catch((error) => {
|
||||
@@ -152,7 +153,7 @@ export class AuthStatusReporter {
|
||||
} else {
|
||||
await this.probe();
|
||||
}
|
||||
return toAcpAuthStatus(this.current);
|
||||
return this.acpStatus;
|
||||
}
|
||||
|
||||
/** A login or a logout: any probe already running read the world before it. */
|
||||
@@ -224,8 +225,11 @@ export class AuthStatusReporter {
|
||||
return;
|
||||
}
|
||||
const fromSession = fromAccountInfo(account, apiKeyHelper);
|
||||
if (fromSession) {
|
||||
this.set(mergeAuthStatus(this.current, fromSession, "session"));
|
||||
if (account && fromSession) {
|
||||
this.set(
|
||||
mergeAuthStatus(this.current, fromSession, "session"),
|
||||
shouldHideClaudeAuth() && claudeAuthRefusal(account) !== undefined,
|
||||
);
|
||||
} else if (!this.loggedUninformativeAccount) {
|
||||
this.loggedUninformativeAccount = true;
|
||||
this.options.logger.log(
|
||||
@@ -308,19 +312,20 @@ export class AuthStatusReporter {
|
||||
}
|
||||
stdout = failed.stdout;
|
||||
}
|
||||
let status = fromCliStatus(stdout, apiKeyHelper);
|
||||
const cli = parseCliAuthStatus(stdout);
|
||||
if (!cli) {
|
||||
logger.error("claude auth status returned unparseable output");
|
||||
return undefined;
|
||||
}
|
||||
let status = cliAuthIdentity(cli, apiKeyHelper);
|
||||
if (!context && status?.kind === "api_key" && status.detail === "API key helper") {
|
||||
try {
|
||||
const resolved = await resolveSettings({ cwd: process.cwd() });
|
||||
status = fromCliStatus(stdout, filterEscalatingDefaultMode(resolved).apiKeyHelper);
|
||||
status = cliAuthIdentity(cli, filterEscalatingDefaultMode(resolved).apiKeyHelper);
|
||||
} catch {
|
||||
logger.error("Could not resolve auth source settings");
|
||||
}
|
||||
}
|
||||
if (!status) {
|
||||
logger.error("claude auth status returned unparseable output");
|
||||
return undefined;
|
||||
}
|
||||
if (epoch !== this.epoch) {
|
||||
// A login or logout landed while this probe was running; the newer
|
||||
// state wins and this answer is discarded, never published.
|
||||
@@ -338,7 +343,14 @@ export class AuthStatusReporter {
|
||||
// same login (no organization, say). Keep those extra fields rather than
|
||||
// regressing the payload; a different identity replaces it wholesale.
|
||||
const merged = mergeAuthStatus(this.current, status, "cli");
|
||||
this.set(merged);
|
||||
// The CLI names the effective credential, not the SDK's accountInfo tokenSource.
|
||||
// An OAuth setup token can carry a plan but, like an API key, is allowed.
|
||||
const refused =
|
||||
shouldHideClaudeAuth() &&
|
||||
status.kind === "account" &&
|
||||
cli.authMethod !== "oauth_token" &&
|
||||
!isClaudeEnterprisePlan(cli.subscriptionType);
|
||||
this.set(merged, refused);
|
||||
this.options.onProbe?.(status.kind);
|
||||
return merged;
|
||||
}
|
||||
|
||||
@@ -109,14 +109,14 @@ export type AcpAuthStatus = Pick<AuthStatusResponse, "state" | "accounts">;
|
||||
* `_meta.claudeCode` carries the `kind` and `plan`, and the `detail` again
|
||||
* for clients that read it there.
|
||||
*
|
||||
* `--hide-claude-auth` does not change the payload: it reports the login the
|
||||
* CLI holds, also when the subscription guard refuses to use it.
|
||||
* The legacy extension still reports a refused identity for display. ACP
|
||||
* reports that sign-in is needed instead of listing it as an active account.
|
||||
*/
|
||||
export function toAcpAuthStatus(status: AuthStatus | undefined): AcpAuthStatus {
|
||||
export function toAcpAuthStatus(status: AuthStatus | undefined, refused = false): AcpAuthStatus {
|
||||
if (!status) {
|
||||
return { state: "unknown" };
|
||||
}
|
||||
if (status.kind === "none") {
|
||||
if (refused || status.kind === "none") {
|
||||
return { state: "unauthenticated" };
|
||||
}
|
||||
const account: AuthAccount = { label: status.label, active: true };
|
||||
@@ -236,10 +236,8 @@ export function fromAccountInfo(
|
||||
});
|
||||
}
|
||||
|
||||
/** Pre-session mapping from `claude auth status --json` stdout. Returns
|
||||
* `undefined` when the output is not the expected JSON object, so callers can
|
||||
* report "not known" instead of guessing. */
|
||||
export function fromCliStatus(stdout: string, apiKeyHelper?: string): AuthStatus | undefined {
|
||||
/** An unreadable `claude auth status --json` result is unknown, not signed out. */
|
||||
export function parseCliAuthStatus(stdout: string): CliAuthStatus | undefined {
|
||||
let parsed: unknown;
|
||||
try {
|
||||
parsed = JSON.parse(stdout);
|
||||
@@ -253,6 +251,10 @@ export function fromCliStatus(stdout: string, apiKeyHelper?: string): AuthStatus
|
||||
if (typeof status.loggedIn !== "boolean") {
|
||||
return undefined;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
export function cliAuthIdentity(status: CliAuthStatus, apiKeyHelper?: string): AuthStatus {
|
||||
// `loggedIn` tracks the claude.ai login only. On a 3P backend (Bedrock,
|
||||
// Vertex, …) it is false while the credentials live outside the agent, so the
|
||||
// backend must decide the kind before the logged-out shortcut runs.
|
||||
|
||||
@@ -34,6 +34,13 @@ export async function claudeCliPath(): Promise<string> {
|
||||
/** How an option reaches the Claude CLI: in a flag, or over stdin in the SDK's initialize request. */
|
||||
type Delivery = NonNullable<Options["mcpServersDelivery"]>;
|
||||
|
||||
/** Whether the client's `extraArgs` name `sdk-url`: a remote session. */
|
||||
export function isRemoteSession(clientExtraArgs: Options["extraArgs"]): boolean {
|
||||
return Object.keys(clientExtraArgs ?? {}).some(
|
||||
(name) => name === "sdk-url" || name.startsWith("sdk-url="),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The SDK options that say how a session's MCP servers and its `settings`
|
||||
* reach the CLI of {@link claudeCliPath}. A client's own options replace them.
|
||||
@@ -65,9 +72,7 @@ export function cliDelivery(clientExtraArgs: Options["extraArgs"]): {
|
||||
settingsDelivery: Delivery;
|
||||
} {
|
||||
const delivery = process.env.CLAUDE_CODE_EXECUTABLE ? "argv" : "initialize";
|
||||
const settingsInFlag = Object.keys(clientExtraArgs ?? {}).some(
|
||||
(name) => name === "settings" || name === "sdk-url" || name.startsWith("sdk-url="),
|
||||
);
|
||||
const settingsInFlag = "settings" in (clientExtraArgs ?? {}) || isRemoteSession(clientExtraArgs);
|
||||
return { mcpServersDelivery: delivery, settingsDelivery: settingsInFlag ? "argv" : delivery };
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* The client-provided system prompt of the unstable `systemPrompt` field on
|
||||
* The client-provided system prompt of the `systemPrompt` field on
|
||||
* `session/new`, `session/load`, `session/resume`, and `session/fork`.
|
||||
*
|
||||
* - `append` keeps the Claude Code preset and adds the text after it, the
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* The CLI records the system prompt of a conversation on its first request
|
||||
* and reuses it on resume, so a different `systemPrompt` on a later
|
||||
* `session/resume` takes effect at the next compaction. The RFD allows this
|
||||
* `session/resume` takes effect at the next compaction. ACP allows this
|
||||
* deferral.
|
||||
*/
|
||||
import type { Options } from "@anthropic-ai/claude-agent-sdk";
|
||||
@@ -30,8 +30,10 @@ export type ClientSystemPrompt = { mode: "append" | "override"; text: string };
|
||||
/**
|
||||
* The mode and text of a `systemPrompt`, or `undefined` when the request has
|
||||
* none. Throws `invalid_params` for a mode other than `append` and `override`
|
||||
* and for a content block other than text: the RFD requires an error, and no
|
||||
* session, for a prompt the agent cannot apply.
|
||||
* and for a content block other than text: ACP requires an error, and no
|
||||
* session, for a prompt the agent cannot apply. Also for an empty `content`
|
||||
* list, which a client must not send: the v2 schema rejects it before this
|
||||
* runs, and a v1 client gets the same answer.
|
||||
*/
|
||||
export function clientSystemPrompt(
|
||||
systemPrompt: SystemPrompt | null | undefined,
|
||||
@@ -44,6 +46,12 @@ export function clientSystemPrompt(
|
||||
`Unsupported systemPrompt mode: ${mode}`,
|
||||
);
|
||||
}
|
||||
if (content.length === 0) {
|
||||
throw RequestError.invalidParams(
|
||||
{ systemPrompt: { content } },
|
||||
"systemPrompt content is empty. Send at least one text block, or leave systemPrompt out.",
|
||||
);
|
||||
}
|
||||
const text: string[] = [];
|
||||
for (const block of content) {
|
||||
if (block.type !== "text") {
|
||||
|
||||
@@ -382,9 +382,10 @@ export class ContextCompactionLifecycle {
|
||||
status: terminalStatus,
|
||||
...(summary !== undefined ? { summary: [{ type: "text", text: summary }] } : {}),
|
||||
...(terminalStatus === "failed" && metadata.error ? { error: metadata.error } : {}),
|
||||
// `_meta` is a replace-patch: seed it with the first terminal, then
|
||||
// only re-send it when the boundary adds facts, so a status-only
|
||||
// duplicate can't wipe the token counts.
|
||||
// A `_meta` that is sent replaces the facts a client holds (the
|
||||
// whole `_meta` on v1, its `jetbrains` key on v2): seed it with the
|
||||
// first terminal, then only re-send it when the boundary adds facts,
|
||||
// so a status-only duplicate can't wipe the token counts.
|
||||
// The standard `error` field carries the error, so `_meta` does not.
|
||||
// Only AIR gets the compaction facts.
|
||||
...(this.airClient && (firstTerminal || hasMetadata)
|
||||
|
||||
@@ -18,6 +18,7 @@ import type {
|
||||
AskUserQuestionOutput,
|
||||
} from "@anthropic-ai/claude-agent-sdk/sdk-tools.js";
|
||||
import {
|
||||
AIR_CUSTOM_ANSWER_FIELDS_KEY,
|
||||
AIR_CUSTOM_ANSWER_KEY,
|
||||
LEGACY_AIR_CUSTOM_ANSWER_KEY,
|
||||
withAirMeta,
|
||||
@@ -257,6 +258,15 @@ export function askUserQuestionsToCreateRequest(
|
||||
...(toolCallId ? { toolCallId } : {}),
|
||||
message,
|
||||
requestedSchema,
|
||||
...(airClient && questions.length > 0
|
||||
? {
|
||||
_meta: withAirMeta(
|
||||
undefined,
|
||||
AIR_CUSTOM_ANSWER_FIELDS_KEY,
|
||||
questions.map((_, index) => questionCustomFieldKey(index)),
|
||||
),
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,14 @@ import {
|
||||
type SessionStoreEntry,
|
||||
} from "@anthropic-ai/claude-agent-sdk";
|
||||
import { createHash } from "node:crypto";
|
||||
import { loadFullSessionHistory, readHistoryAcrossCompactions } from "./resumed-session.js";
|
||||
import { loadFullSessionHistory } from "./resumed-session.js";
|
||||
import { forkPointOf } from "./session-cursors.js";
|
||||
import {
|
||||
cutAtRewindPoint,
|
||||
loadRewindableHistory,
|
||||
pendingRewindEnd,
|
||||
withoutRewoundBranch,
|
||||
} from "./session-rewind.js";
|
||||
import { assistantMessageText } from "./session-failure-extension.js";
|
||||
import { SessionTiming } from "./session-timing.js";
|
||||
|
||||
@@ -206,17 +212,15 @@ async function forkTranscript(
|
||||
): Promise<ForkSessionResponse> {
|
||||
const timing = new SessionTiming(dependencies.logger, "fork", params.sessionId);
|
||||
if (params.cursorId != null) {
|
||||
// The history as a replay reads it, which announces the cursors.
|
||||
const history = await readHistoryAcrossCompactions(
|
||||
params.sessionId,
|
||||
await getSessionMessages(params.sessionId),
|
||||
);
|
||||
// The history as a replay reads it, which announces the cursors: cut at a
|
||||
// pending rewind, so a cursor of a dropped turn is no cursor.
|
||||
const { visible: history } = await loadRewindableHistory(params.sessionId);
|
||||
const upToMessageId = forkPointOf(params.cursorId, history);
|
||||
timing.phase("cursor", ` resolution=${upToMessageId ? "found" : "missing"}`);
|
||||
if (upToMessageId === undefined) {
|
||||
throw RequestError.invalidParams(
|
||||
{ cursorId: params.cursorId },
|
||||
`Session ${params.sessionId} has no cursor ${params.cursorId} that a fork can start at. Use a cursor that the session announced with the \`fork\` capability, or send the request without \`cursorId\` to fork the whole session.`,
|
||||
`Session ${params.sessionId} has no cursor ${params.cursorId} that a fork can start at. Use a cursor that the session announced with the fork capability, or send the request without cursorId to fork the whole session.`,
|
||||
);
|
||||
}
|
||||
const forked = await forkClaudeSession(params.sessionId, { upToMessageId });
|
||||
@@ -227,7 +231,12 @@ async function forkTranscript(
|
||||
// SDK `dir` scopes source lookup, not the fork's working directory. Search
|
||||
// all projects: params.cwd can name a different workspace for the new session.
|
||||
if (!point) {
|
||||
const forked = await forkClaudeSession(params.sessionId);
|
||||
// A pending rewind ends the conversation at its point, not at the newest leaf.
|
||||
const rewoundEnd = await pendingRewindEnd(params.sessionId);
|
||||
const forked = await forkClaudeSession(
|
||||
params.sessionId,
|
||||
...(rewoundEnd ? [{ upToMessageId: rewoundEnd }] : []),
|
||||
);
|
||||
timing.phase("sdk-fork", " resolution=latest");
|
||||
return { sessionId: forked.sessionId };
|
||||
}
|
||||
@@ -236,7 +245,9 @@ async function forkTranscript(
|
||||
const liveUuid = candidateIds
|
||||
.map((candidateId) => dependencies.liveMessageIdToUuid?.get(candidateId))
|
||||
.find(Boolean);
|
||||
const history = liveUuid ? undefined : await getSessionMessages(params.sessionId);
|
||||
const history = liveUuid
|
||||
? undefined
|
||||
: await cutAtRewindPoint(params.sessionId, await getSessionMessages(params.sessionId));
|
||||
timing.phase("active-history", ` resolution=${liveUuid ? "live" : "pending"}`);
|
||||
const messageUuid =
|
||||
liveUuid ??
|
||||
@@ -253,7 +264,10 @@ async function forkTranscript(
|
||||
const fullHistoryUuid = messageUuid
|
||||
? undefined
|
||||
: resolveFromFullHistory(
|
||||
await loadFullSessionHistory(params.sessionId),
|
||||
await withoutRewoundBranch(
|
||||
params.sessionId,
|
||||
await loadFullSessionHistory(params.sessionId),
|
||||
),
|
||||
candidateIds,
|
||||
point,
|
||||
dependencies.messageIdForGrouping,
|
||||
|
||||
@@ -28,7 +28,7 @@ export function initialConfigOptions<E extends { configId: string }>(
|
||||
if (seen.has(configId)) {
|
||||
throw RequestError.invalidParams(
|
||||
{ configId },
|
||||
`\`configOptions\` sets ${configId} more than once. Send one entry for each config option.`,
|
||||
`configOptions sets ${configId} more than once. Send one entry for each config option.`,
|
||||
);
|
||||
}
|
||||
seen.add(configId);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AvailableCommand } from "@agentclientprotocol/sdk/unstable";
|
||||
import type { McpServerStatus, Query } from "@anthropic-ai/claude-agent-sdk";
|
||||
import { escapeMarkdown } from "./usage-markdown.js";
|
||||
import { codeSpan, escapeMarkdown } from "./usage-markdown.js";
|
||||
import { raceTimeoutAndAbort } from "./utils.js";
|
||||
|
||||
/** The `/mcp` entry of `available_commands_update`. The adapter shows the
|
||||
@@ -105,20 +105,6 @@ function needsReconnect(status: McpServerStatus): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
/** The text as a Markdown code span. The fence is longer than the longest
|
||||
* backtick run in the text, so the span shows the text unchanged. The user
|
||||
* can copy a server name from it into `/mcp reconnect`. */
|
||||
function codeSpan(text: string): string {
|
||||
const longestRun = Math.max(0, ...(text.match(/`+/g) ?? []).map((run) => run.length));
|
||||
const fence = "`".repeat(longestRun + 1);
|
||||
// CommonMark strips one space from each end of a span that is not all spaces
|
||||
// (line endings count as spaces), so a pad keeps the text unchanged. Plain
|
||||
// string checks, not one regex: `^ .*[^ ].* $` backtracks quadratically.
|
||||
const strippedByCommonMark = text.startsWith(" ") && text.endsWith(" ") && /[^ \r\n]/.test(text);
|
||||
const pad = text.startsWith("`") || text.endsWith("`") || strippedByCommonMark ? " " : "";
|
||||
return `${fence}${pad}${text}${pad}${fence}`;
|
||||
}
|
||||
|
||||
function isErrorCode(segment: string): boolean {
|
||||
return /^-?\d+$/.test(segment);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,71 @@
|
||||
import {
|
||||
isMcpServerAcp,
|
||||
McpOverAcpCaller,
|
||||
type HasConnectionContext,
|
||||
type McpServer,
|
||||
type McpServerAcp,
|
||||
type ToolCallStatus,
|
||||
} from "@agentclientprotocol/sdk/unstable";
|
||||
import { McpOverAcpHttpBridge } from "@agentclientprotocol/sdk/experimental/mcp-http";
|
||||
import type { McpHttpServerConfig, McpServerConfig } from "@anthropic-ai/claude-agent-sdk";
|
||||
import {
|
||||
McpOverAcpHttpBridge,
|
||||
type McpHttpRequestAttribution,
|
||||
type McpHttpRequestInfo,
|
||||
} from "@agentclientprotocol/sdk/experimental/mcp-http";
|
||||
import type {
|
||||
HookCallbackMatcher,
|
||||
McpHttpServerConfig,
|
||||
McpServerConfig,
|
||||
} from "@anthropic-ai/claude-agent-sdk";
|
||||
import { AnnouncedChildren } from "./acp-subagents.js";
|
||||
import { startupFailureReasonOf } from "./startup-failure.js";
|
||||
import { isFinalToolCallStatus } from "./tool-calls/renderer.js";
|
||||
|
||||
/**
|
||||
* Where Claude Code's MCP client (2.1.330) puts the id of the tool use in the
|
||||
* `params._meta` of the `tools/call` that it sends for it. Its other requests,
|
||||
* such as `server/discover` and `tools/list`, have none.
|
||||
*/
|
||||
const TOOL_USE_ID_META = "claudecode/toolUseId";
|
||||
|
||||
/**
|
||||
* The `agent_type` in the hooks of an agent that a workflow runs (Claude Code
|
||||
* 2.1.330). Such an agent gets no `task_started` and never a child session,
|
||||
* and its tool uses do not stream: the root session shows its work on the
|
||||
* Workflow call. A user can give an agent definition the same name: its
|
||||
* agents are ordinary subagents.
|
||||
*/
|
||||
const WORKFLOW_AGENT_TYPE = "workflow-subagent";
|
||||
|
||||
/**
|
||||
* How long an MCP request of a subagent waits for the `subagent_update` of
|
||||
* the subagent's child session, before it goes out without a session (see
|
||||
* {@link McpOverAcp.announcementWaitMs}).
|
||||
*
|
||||
* The wait covers a session that reads Claude Code's stream after the
|
||||
* request arrives. With a scripted model, which answers at once, a session
|
||||
* sent the report of a subagent's tool call 1.5 to 12 ms before the request
|
||||
* of that tool use arrived (15 runs with Claude Code 2.1.330 on one machine),
|
||||
* and it sends the child's announcement before that report. So the session
|
||||
* is ahead by milliseconds when it is not busy. 500 ms is about 40 times the
|
||||
* largest of these gaps, as room for a session that is.
|
||||
*
|
||||
* A longer wait would cost more where it cannot help: a replay can hold an
|
||||
* announcement for longer than any wait, and an agent that the adapter
|
||||
* cannot tell from a subagent, but that never gets a child session, waits
|
||||
* this long for each of its tool uses.
|
||||
*/
|
||||
const ANNOUNCEMENT_WAIT_MS = 500;
|
||||
|
||||
/**
|
||||
* The hook matcher of the tools of the MCP servers `names`. Claude Code
|
||||
* (2.1.330) matches it against the whole name of a tool, which is
|
||||
* `mcp__<server>__<tool>` with `_` for each character of the server's name
|
||||
* outside `[A-Za-z0-9_-]`: `mcp__my_tools__echo` for the server `my tools`.
|
||||
*/
|
||||
function mcpToolsMatcher(names: readonly string[]): string {
|
||||
const servers = names.map((name) => name.replace(/[^A-Za-z0-9_-]+/g, "_+"));
|
||||
return `mcp__(?:${servers.join("|")})__.*`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the SDK config of an MCP server that the client serves over the ACP
|
||||
@@ -72,6 +132,71 @@ export async function sdkMcpServers(
|
||||
return { configs, unserved };
|
||||
}
|
||||
|
||||
/**
|
||||
* What the user is told of each MCP server that a managed
|
||||
* `disableSideloadFlags` keeps out of a session.
|
||||
*/
|
||||
const NOT_FROM_AN_APPROVED_SOURCE =
|
||||
"Your organization's managed settings (disableSideloadFlags) let Claude Code use MCP servers only from sources that your administrator approved.";
|
||||
|
||||
/**
|
||||
* The names of a session's MCP servers: its ACP servers, and the servers of
|
||||
* the client's SDK options (`_meta.claudeCode.options.mcpServers`).
|
||||
*/
|
||||
export function mcpServerNames(
|
||||
servers: readonly object[] | null | undefined,
|
||||
sdkServers: Record<string, unknown> | undefined,
|
||||
): string[] {
|
||||
return [
|
||||
// A v2 server of an extension transport (`type: "_…"`) needs no name.
|
||||
...(servers ?? []).flatMap((server) =>
|
||||
"name" in server && typeof server.name === "string" ? [server.name] : [],
|
||||
),
|
||||
...Object.keys(sdkServers ?? {}),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* A session's MCP servers when Claude Code refuses to start with them (see
|
||||
* {@link startAroundRefusedMcpServers}): Claude Code gets none, and each is
|
||||
* unserved with the reason. `names` are the session's {@link mcpServerNames}.
|
||||
*/
|
||||
export function refusedMcpServers(names: Iterable<string>): SdkMcpServers {
|
||||
return {
|
||||
configs: {},
|
||||
unserved: [...new Set(names)].map((name) => ({
|
||||
name,
|
||||
status: "failed",
|
||||
error: NOT_FROM_AN_APPROVED_SOURCE,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs `start(false)`, the start of a session's query. With a managed
|
||||
* `disableSideloadFlags`, Claude Code takes MCP servers and plugins only from
|
||||
* sources that the administrator approved, and refuses a start that brings
|
||||
* others (`sideload_flags_disabled`, SDK 0.3.331). When it refuses a start
|
||||
* that has MCP servers, this runs `start(true)`: the same start without them
|
||||
* (see {@link refusedMcpServers}).
|
||||
*
|
||||
* Claude Code decides at every start. The adapter reads no policy of its own,
|
||||
* so a session gets its servers back at its next start once the setting is
|
||||
* gone. The second start can be refused too, e.g. over the client's
|
||||
* `plugins`: that error is thrown.
|
||||
*/
|
||||
export async function startAroundRefusedMcpServers<T>(
|
||||
hasMcpServers: boolean,
|
||||
start: (withoutMcpServers: boolean) => Promise<T>,
|
||||
): Promise<T> {
|
||||
try {
|
||||
return await start(false);
|
||||
} catch (error) {
|
||||
if (!hasMcpServers || startupFailureReasonOf(error) !== "sideload_flags_disabled") throw error;
|
||||
return start(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serves the MCP servers that a client declares with `"type": "acp"` to Claude
|
||||
* Code (MCP-over-ACP). Claude Code's MCP client connects to a command or a
|
||||
@@ -86,10 +211,85 @@ export async function sdkMcpServers(
|
||||
* `MCP_PROTOCOL_NEGOTIATION=legacy` or its
|
||||
* `tengu_mcp_protocol_negotiation_http` flag turns that off. Then it sends
|
||||
* `initialize`, and the server is listed as failed.
|
||||
*
|
||||
* An `mcp/message` request names the ACP session and the tool call that it is
|
||||
* sent for (`sessionId` and `toolCallId`), when the adapter knows them. An
|
||||
* HTTP request does not say them. It carries the id of its tool use (see
|
||||
* {@link TOOL_USE_ID_META}), and the adapter learns each tool use of an `acp`
|
||||
* server's tool from a PreToolUse hook, before Claude Code runs the tool
|
||||
* ({@link toolUseHooks}). Both cores report a tool call under the id of its
|
||||
* tool use, so that id is the `toolCallId`.
|
||||
*
|
||||
* When a `session/update` reported a tool call of that id ({@link sending}),
|
||||
* the request names the session of that report, and the tool call. Before
|
||||
* the report, and without one, it names by the agent that runs the tool:
|
||||
*
|
||||
* - the main conversation: the root session, and the tool call;
|
||||
* - a subagent with an announced child session: that session, and the tool
|
||||
* call;
|
||||
* - a subagent of a client without child sessions: the root session, which
|
||||
* reports the subagent's tool calls, and the tool call;
|
||||
* - an agent that never gets a child session: the root session, whose work
|
||||
* it does, and no tool call, since no session reports one. These are an
|
||||
* agent that a workflow runs, and any agent of a client without child
|
||||
* sessions that the core does not know as a subagent;
|
||||
* - a subagent whose child session is not announced yet, because the session
|
||||
* has not read its start or a replay holds its `subagent_update`: the
|
||||
* request waits for that announcement, for at most
|
||||
* {@link announcementWaitMs}, and then names the child session and the tool
|
||||
* call. When the time passes first, it names nothing;
|
||||
* - any other agent: nothing, without a wait. The core forgot its child
|
||||
* session, or no `subagent_update` announces one for it.
|
||||
*
|
||||
* The root session never stands in for a child session.
|
||||
*
|
||||
* A request names neither when one of these holds:
|
||||
*
|
||||
* - it has no tool use id, as `server/discover` and `tools/list` have none;
|
||||
* - no PreToolUse hook reported its tool use, as for a server that a resume
|
||||
* gave the session's running query ({@link sessionServersChanged}), or the
|
||||
* tool use ended;
|
||||
* - the client closed the root session, or its last setup request did not
|
||||
* declare the request's server;
|
||||
* - the session of the agent is a child session that no `subagent_update`
|
||||
* announced to the client: one of AIR's draft, one that a conversation
|
||||
* reset made the core forget, or one whose announcement did not go out
|
||||
* within {@link announcementWaitMs};
|
||||
* - the agent has the type of a workflow's agents, the client gets child
|
||||
* sessions, and the session defines an agent of that name: the agent can
|
||||
* be a subagent whose child session is not announced yet.
|
||||
*
|
||||
* Nothing orders the tool call's report before the request. Claude Code
|
||||
* streams a tool use before it runs the tool, but the session can read its
|
||||
* stream after the HTTP request arrives. The request then names a tool call
|
||||
* that the client does not hold yet.
|
||||
*/
|
||||
export class McpOverAcp {
|
||||
private readonly caller = new McpOverAcpCaller();
|
||||
private readonly bridge = new McpOverAcpHttpBridge(this.caller);
|
||||
private readonly bridge = new McpOverAcpHttpBridge(this.caller, {
|
||||
attribution: (request) => this.attribution(request),
|
||||
});
|
||||
/** The `acp` servers of each active session that has any, or whose query started with any. */
|
||||
private readonly sessions = new Map<string, SessionServers>();
|
||||
/** The child sessions that a `subagent_update` announced to the client (see {@link sending}). */
|
||||
private readonly children = new AnnouncedChildren();
|
||||
/** The tool uses of `acp` servers' tools that Claude Code runs, by id (see {@link toolUseHooks}). */
|
||||
private readonly toolUses = new Map<string, ToolUse>();
|
||||
/**
|
||||
* The session of each tool call that the client holds without a final
|
||||
* status, by tool call id (see {@link sending}).
|
||||
*/
|
||||
private readonly toolCalls = new Map<string, string>();
|
||||
/**
|
||||
* The requests that wait for the announcement of their agent's child
|
||||
* session, by tool use id: what ends each one's wait (see {@link held}).
|
||||
*/
|
||||
private readonly waiting = new Map<string, Set<() => void>>();
|
||||
/**
|
||||
* How long a request waits for the announcement of its agent's child
|
||||
* session (see {@link ANNOUNCEMENT_WAIT_MS}). Mutable so tests can change it.
|
||||
*/
|
||||
announcementWaitMs: number = ANNOUNCEMENT_WAIT_MS;
|
||||
|
||||
/**
|
||||
* Hands an `mcp/message` notification of the client (such as the progress
|
||||
@@ -127,4 +327,385 @@ export class McpOverAcp {
|
||||
headers: Object.fromEntries(http.headers.map((header) => [header.name, header.value])),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A setup request (`session/new`, `load`, `resume` or `fork`) made the
|
||||
* session `sessionId` active with `servers`, on a query that started with
|
||||
* the hooks of {@link toolUseHooks} for them.
|
||||
*/
|
||||
sessionStarted(sessionId: string, servers: readonly McpServer[] | null | undefined): void {
|
||||
const acp = (servers ?? []).filter(isMcpServerAcp);
|
||||
if (acp.length === 0) {
|
||||
this.sessions.delete(sessionId);
|
||||
return;
|
||||
}
|
||||
this.sessions.set(sessionId, {
|
||||
declared: new Set(acp.map((server) => server.serverId)),
|
||||
hooked: new Set(acp.map((server) => server.name)),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* A setup request gave the active session `sessionId` the servers
|
||||
* `servers` in place of its earlier ones, on its running query. Returns
|
||||
* the names of the `acp` servers among them that the query did not start
|
||||
* with. Its hooks cannot change, so no hook reports the tool uses of these
|
||||
* servers, and their requests name no session until the session's next
|
||||
* query starts.
|
||||
*/
|
||||
sessionServersChanged(
|
||||
sessionId: string,
|
||||
servers: readonly McpServer[] | null | undefined,
|
||||
): string[] {
|
||||
const acp = (servers ?? []).filter(isMcpServerAcp);
|
||||
const hooked = this.sessions.get(sessionId)?.hooked ?? new Set<string>();
|
||||
if (acp.length === 0 && hooked.size === 0) this.sessions.delete(sessionId);
|
||||
else {
|
||||
this.sessions.set(sessionId, {
|
||||
declared: new Set(acp.map((server) => server.serverId)),
|
||||
hooked,
|
||||
});
|
||||
}
|
||||
return acp.flatMap((server) => (hooked.has(server.name) ? [] : [server.name]));
|
||||
}
|
||||
|
||||
/**
|
||||
* The client ended the session `sessionId` (`session/close`, or a request
|
||||
* that closes it too, such as `session/delete`): its requests and those of
|
||||
* its child sessions name no session from now on. Forgets its servers, its
|
||||
* announced children, its tool uses and its tool calls.
|
||||
*/
|
||||
sessionClosed(sessionId: string): void {
|
||||
for (const [toolUseId, toolUse] of this.toolUses) {
|
||||
if (toolUse.rootSessionId !== sessionId) continue;
|
||||
this.toolUses.delete(toolUseId);
|
||||
this.release(toolUseId);
|
||||
}
|
||||
for (const [toolCallId, session] of this.toolCalls) {
|
||||
if (this.rootOf(session) === sessionId) this.toolCalls.delete(toolCallId);
|
||||
}
|
||||
this.children.rootClosed(sessionId);
|
||||
this.sessions.delete(sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a session update that goes to the client. A `subagent_update`
|
||||
* announces a child session. A `tool_call`, or a `tool_call_update` with a
|
||||
* status, reports a tool call of its session, which is kept until an update
|
||||
* of that session or of another one under the same root gives the tool call
|
||||
* a final status. That update also ends the tool use of the same id. An
|
||||
* announcement, and a tool call's report, end the wait of the requests
|
||||
* that they let name a session (see {@link held}).
|
||||
*
|
||||
* Only the tool calls of an active session with `acp` servers
|
||||
* ({@link sessionStarted}) and of its announced child sessions are kept. The
|
||||
* tool calls of a child session of AIR's draft, which a `subagent_spawned`
|
||||
* announces, are not.
|
||||
*/
|
||||
sending(notification: SentUpdate): void {
|
||||
this.children.sending(notification);
|
||||
const { sessionId, update } = notification;
|
||||
const { sessionUpdate, toolCallId, status } = update;
|
||||
if (sessionUpdate === "subagent_update") {
|
||||
for (const toolUseId of [...this.waiting.keys()]) {
|
||||
if (this.toolUses.get(toolUseId)?.awaits === update.sessionId) this.release(toolUseId);
|
||||
}
|
||||
}
|
||||
if (sessionUpdate !== "tool_call" && sessionUpdate !== "tool_call_update") return;
|
||||
if (typeof toolCallId !== "string") return;
|
||||
const root = this.rootOf(sessionId);
|
||||
if (isFinalToolCallStatus(status as ToolCallStatus | null | undefined)) {
|
||||
this.toolEnded(toolCallId, root);
|
||||
} else if ((sessionUpdate === "tool_call" || status != null) && this.sessions.has(root)) {
|
||||
this.toolCalls.set(toolCallId, sessionId);
|
||||
// A request that waits can name the session of this report.
|
||||
this.release(toolCallId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The hooks of the query of the root session `sessionId`, which starts with
|
||||
* `servers`, or undefined when none of them is an `acp` server: such a
|
||||
* query has no MCP request to name a session for. They record each tool
|
||||
* use of a tool of the `acp` servers before Claude Code runs it
|
||||
* (PreToolUse), with the session of the agent that runs it (see the class
|
||||
* doc), until the tool returned or failed (PostToolUse,
|
||||
* PostToolUseFailure). Claude Code runs them for no other tool, and they
|
||||
* make no decision.
|
||||
*
|
||||
* A tool use that neither hook ends, such as one that Claude Code does not
|
||||
* run after all, stays until its tool call gets a final status
|
||||
* ({@link sending}) or the client closes the session
|
||||
* ({@link sessionClosed}).
|
||||
*/
|
||||
toolUseHooks(
|
||||
sessionId: string,
|
||||
servers: readonly McpServer[] | null | undefined,
|
||||
agents: SessionAgents,
|
||||
): Record<"PreToolUse" | "PostToolUse" | "PostToolUseFailure", HookCallbackMatcher> | undefined {
|
||||
const acp = (servers ?? []).filter(isMcpServerAcp);
|
||||
if (acp.length === 0) return undefined;
|
||||
const matcher = mcpToolsMatcher(acp.map((server) => server.name));
|
||||
const starts: HookCallbackMatcher = {
|
||||
matcher,
|
||||
hooks: [
|
||||
async (input, toolUseId) => {
|
||||
if (toolUseId !== undefined) {
|
||||
this.toolUses.set(toolUseId, {
|
||||
rootSessionId: sessionId,
|
||||
...agentSession(sessionId, input, agents, (child) => this.children.has(child)),
|
||||
});
|
||||
}
|
||||
return { continue: true };
|
||||
},
|
||||
],
|
||||
};
|
||||
const ends: HookCallbackMatcher = {
|
||||
matcher,
|
||||
hooks: [
|
||||
async (_input, toolUseId) => {
|
||||
if (toolUseId !== undefined) this.toolEnded(toolUseId, sessionId);
|
||||
return { continue: true };
|
||||
},
|
||||
],
|
||||
};
|
||||
return { PreToolUse: starts, PostToolUse: ends, PostToolUseFailure: ends };
|
||||
}
|
||||
|
||||
/** The root session of the announced child session `sessionId`, or `sessionId` itself. */
|
||||
private rootOf(sessionId: string): string {
|
||||
return this.children.rootOf(sessionId) ?? sessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forgets the tool use `id` and its tool call, when they are of the root
|
||||
* session `root`, and ends the wait of the tool use's requests. A fork
|
||||
* replays the tool calls of its original under their ids: its updates
|
||||
* leave those of the original alone.
|
||||
*/
|
||||
private toolEnded(id: string, root: string): void {
|
||||
if (this.toolUses.get(id)?.rootSessionId === root) {
|
||||
this.toolUses.delete(id);
|
||||
this.release(id);
|
||||
}
|
||||
const reportedIn = this.toolCalls.get(id);
|
||||
if (reportedIn !== undefined && this.rootOf(reportedIn) === root) this.toolCalls.delete(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves when a request of the tool use `toolUseId` need wait no longer
|
||||
* for the announcement of its agent's child session: {@link release} ended
|
||||
* the wait, {@link announcementWaitMs} passed, or `abandoned` aborted. It
|
||||
* never rejects.
|
||||
*
|
||||
* `abandoned` is the bridge's signal for the request. It aborts when Claude
|
||||
* Code closes the request's HTTP connection or the ACP connection closes.
|
||||
* The bridge then sends nothing, whatever the request names.
|
||||
*
|
||||
* Nothing that an announcement needs waits for the request. The hook that
|
||||
* recorded the tool use has answered. The session reads Claude Code's
|
||||
* stream whatever its tools do, and Claude Code wrote the subagent's start
|
||||
* to that stream before it ran the subagent's tool. A replay ends without
|
||||
* the request too.
|
||||
*/
|
||||
private held(toolUseId: string, abandoned: AbortSignal): Promise<void> {
|
||||
if (abandoned.aborted) return Promise.resolve();
|
||||
return new Promise((resolve) => {
|
||||
const waiters = this.waiting.get(toolUseId) ?? new Set<() => void>();
|
||||
this.waiting.set(toolUseId, waiters);
|
||||
const end = () => {
|
||||
clearTimeout(timer);
|
||||
abandoned.removeEventListener("abort", end);
|
||||
waiters.delete(end);
|
||||
if (waiters.size === 0 && this.waiting.get(toolUseId) === waiters) {
|
||||
this.waiting.delete(toolUseId);
|
||||
}
|
||||
resolve();
|
||||
};
|
||||
const timer = setTimeout(end, this.announcementWaitMs);
|
||||
// The request's HTTP connection keeps the process alive, not this timer.
|
||||
timer.unref();
|
||||
abandoned.addEventListener("abort", end, { once: true });
|
||||
waiters.add(end);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends the wait of the requests of the tool use `toolUseId` ({@link held}):
|
||||
* its agent's child session is announced, its tool call is reported, or it
|
||||
* ended, also with the close of its session. Each request then names what
|
||||
* it can.
|
||||
*/
|
||||
private release(toolUseId: string): void {
|
||||
for (const end of [...(this.waiting.get(toolUseId) ?? [])]) end();
|
||||
}
|
||||
|
||||
/**
|
||||
* The session and tool call that the `mcp/message` request of the MCP
|
||||
* request `request` names, or undefined when it names none (see the class
|
||||
* doc). A request of a subagent whose child session is not announced yet
|
||||
* resolves once it is, or names nothing after {@link announcementWaitMs}.
|
||||
* It neither throws nor rejects: the bridge would answer Claude Code with
|
||||
* HTTP 500 instead of sending the request.
|
||||
*
|
||||
* It does not read `request.connection`. Each agent app (`v1AgentApp`,
|
||||
* `v2AgentApp`) makes its own `McpOverAcp` for its one connection, so every
|
||||
* request and every recorded session is of that connection.
|
||||
*/
|
||||
private attribution({
|
||||
serverId,
|
||||
params,
|
||||
signal,
|
||||
}: McpHttpRequestInfo):
|
||||
McpHttpRequestAttribution | undefined | Promise<McpHttpRequestAttribution | undefined> {
|
||||
const meta = params?._meta;
|
||||
const toolUseId =
|
||||
typeof meta === "object" && meta !== null
|
||||
? (meta as Record<string, unknown>)[TOOL_USE_ID_META]
|
||||
: undefined;
|
||||
if (typeof toolUseId !== "string") return undefined;
|
||||
const now = this.named(toolUseId, serverId);
|
||||
if (now !== "unannounced") return now;
|
||||
return this.held(toolUseId, signal).then(() => {
|
||||
const then = this.named(toolUseId, serverId);
|
||||
return then === "unannounced" ? undefined : then;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* What a request of the tool use `toolUseId` to the server `serverId` names
|
||||
* now, or `unannounced` when it names nothing because the child session of
|
||||
* its agent, which a `subagent_update` announces, is not announced yet.
|
||||
*/
|
||||
private named(
|
||||
toolUseId: string,
|
||||
serverId: string,
|
||||
): McpHttpRequestAttribution | undefined | "unannounced" {
|
||||
const toolUse = this.toolUses.get(toolUseId);
|
||||
if (!toolUse) return undefined;
|
||||
const root = toolUse.rootSessionId;
|
||||
if (!this.sessions.get(root)?.declared.has(serverId)) return undefined;
|
||||
// The session that reported the tool call names it. A tool call of
|
||||
// another root has the same id in a fork's replayed history.
|
||||
const reportedIn = this.toolCalls.get(toolUseId);
|
||||
if (reportedIn !== undefined && this.rootOf(reportedIn) === root) {
|
||||
return { sessionId: reportedIn, toolCallId: toolUseId };
|
||||
}
|
||||
const { sessionId, awaits } = toolUse;
|
||||
if (sessionId !== undefined && this.rootOf(sessionId) === root) {
|
||||
return toolUse.reportsToolCall ? { sessionId, toolCallId: toolUseId } : { sessionId };
|
||||
}
|
||||
// Not the root, and no announced child of it. Once the child session of
|
||||
// its agent is announced, that session reports the agent's tool calls.
|
||||
if (awaits === undefined) return undefined;
|
||||
return this.rootOf(awaits) === root
|
||||
? { sessionId: awaits, toolCallId: toolUseId }
|
||||
: "unannounced";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* What {@link McpOverAcp.toolUseHooks} asks the core of a session about the
|
||||
* agents of its query.
|
||||
*/
|
||||
export type SessionAgents = {
|
||||
/**
|
||||
* Whether the client gets a child session per subagent. Without child
|
||||
* sessions, the root session's updates carry the work of every agent.
|
||||
*/
|
||||
childSessions: boolean;
|
||||
/**
|
||||
* The session whose updates report the tool calls of the subagent `agentId`
|
||||
* as the core routes them now: its announced child session, or the root
|
||||
* session for a client without child sessions. Undefined for an agent that
|
||||
* the core does not know as a subagent (it has not read its
|
||||
* `task_started`, which an agent that a workflow runs never gets), and for
|
||||
* one whose child session is not announced.
|
||||
*/
|
||||
reporting(agentId: string): string | undefined;
|
||||
/**
|
||||
* The id of the child session that a `subagent_update` announces for the
|
||||
* subagent `agentId`, whether it went out yet or not. Undefined for a
|
||||
* client that gets no child session from a `subagent_update`: one without
|
||||
* child sessions, or with those of AIR's draft.
|
||||
*/
|
||||
childSessionId(agentId: string): string | undefined;
|
||||
/** Whether the session had an agent definition of the name `name` when its query started. */
|
||||
definesAgent(name: string): boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* The session of the agent that runs the tool use of the PreToolUse hook
|
||||
* `input`, for a query of the root session `root`, whether that session
|
||||
* reports the tool use as a tool call, and the child session whose
|
||||
* announcement a request of the tool use waits for (see the class doc of
|
||||
* {@link McpOverAcp}). `announced` says whether a `subagent_update` announced
|
||||
* a child session.
|
||||
*/
|
||||
function agentSession(
|
||||
root: string,
|
||||
input: { agent_id?: string; agent_type?: string },
|
||||
agents: SessionAgents,
|
||||
announced: (child: string) => boolean,
|
||||
): Pick<ToolUse, "sessionId" | "reportsToolCall" | "awaits"> {
|
||||
// A session reports the tool calls of the messages that it reads, but for
|
||||
// the work that a cancel stopped: it drops that work's tool uses, and its
|
||||
// tool can run all the same. Nothing tells that at this point, so the
|
||||
// request of such a tool use names a tool call that the client never gets.
|
||||
if (input.agent_id === undefined) return { sessionId: root, reportsToolCall: true };
|
||||
const reporting = agents.reporting(input.agent_id);
|
||||
const child = agents.childSessionId(input.agent_id);
|
||||
if (reporting !== undefined) {
|
||||
// A child session whose `subagent_update` has not gone out, as a replay
|
||||
// can hold it: a request waits for it.
|
||||
return {
|
||||
sessionId: reporting,
|
||||
reportsToolCall: true,
|
||||
...(reporting === child ? { awaits: child } : {}),
|
||||
};
|
||||
}
|
||||
// No session reports the tool calls of this agent. Its work is the root's
|
||||
// when it cannot be a child session: the client gets none, or a workflow
|
||||
// runs it. An agent definition of the workflow agents' type makes that
|
||||
// type say nothing: its agent can be a child that is not announced yet.
|
||||
const workflowType = input.agent_type === WORKFLOW_AGENT_TYPE;
|
||||
if (!agents.childSessions || (workflowType && !agents.definesAgent(WORKFLOW_AGENT_TYPE))) {
|
||||
return { sessionId: root, reportsToolCall: false };
|
||||
}
|
||||
// The core does not know the agent as a subagent. One whose start it has
|
||||
// not read yet gets its child session next: a request waits for it. Not an
|
||||
// agent of the workflow agents' type, which mostly gets none, and not one
|
||||
// whose child session was announced before: the core forgot that child at
|
||||
// a conversation reset, and reports nothing of it any more.
|
||||
const awaits = child !== undefined && !workflowType && !announced(child) ? child : undefined;
|
||||
return { sessionId: undefined, reportsToolCall: false, ...(awaits ? { awaits } : {}) };
|
||||
}
|
||||
|
||||
/** The `acp` servers of an active session. */
|
||||
type SessionServers = {
|
||||
/** The `serverId`s of the session's last setup request. */
|
||||
declared: ReadonlySet<string>;
|
||||
/** The names of the ones that its query started with, whose tool uses its hooks report. */
|
||||
hooked: ReadonlySet<string>;
|
||||
};
|
||||
|
||||
/** A tool use that Claude Code runs. */
|
||||
type ToolUse = {
|
||||
/** The root session whose query runs it. */
|
||||
rootSessionId: string;
|
||||
/** The session of the agent that runs it, when it has one that a request can name. */
|
||||
sessionId: string | undefined;
|
||||
/** Whether that session reports it as a tool call, under its id. */
|
||||
reportsToolCall: boolean;
|
||||
/**
|
||||
* The child session of its agent that a request of it waits for while no
|
||||
* `subagent_update` has announced it, and names once one has.
|
||||
*/
|
||||
awaits?: string;
|
||||
};
|
||||
|
||||
/** A session update that goes to the client, as far as {@link McpOverAcp.sending} reads it. */
|
||||
type SentUpdate = {
|
||||
sessionId: string;
|
||||
update: { sessionUpdate: string; sessionId?: unknown; toolCallId?: unknown; status?: unknown };
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
type SessionConfigOption,
|
||||
type SessionNotification,
|
||||
} from "@agentclientprotocol/sdk/unstable";
|
||||
import type { SDKUserMessage } from "@anthropic-ai/claude-agent-sdk";
|
||||
import { realpath } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import type { AcpSessionNotification, SubagentForm, SubagentState } from "./acp-subagents.js";
|
||||
@@ -56,8 +57,16 @@ export type NativeSubagent = {
|
||||
promptIds?: Set<string>;
|
||||
/** The RFD form: the calls that delegated to the child, whose runs ended. */
|
||||
endedRuns?: Set<string>;
|
||||
/** The RFD form: the calls that delegated to the child, whose runs handed back a report. */
|
||||
/** The calls that delegated to the child, whose runs handed back a report. */
|
||||
handedBack?: Set<string>;
|
||||
/** Whether a message of it came (see `NativeSubagentRuntime.messageCame`). */
|
||||
heard?: boolean;
|
||||
/**
|
||||
* The RFD form: the call that launched it is no Agent or Task call, such as
|
||||
* the Skill call of a forked skill. The client is shown that call, so the
|
||||
* prompt does not replace it.
|
||||
*/
|
||||
launchShown?: boolean;
|
||||
announced?: boolean;
|
||||
/**
|
||||
* The RFD form: the `cwd` that the client holds for the child. Undefined or
|
||||
@@ -126,6 +135,8 @@ export type TaskEnd = {
|
||||
* conversation was reset, and the runtime forgets its children.
|
||||
*/
|
||||
unobservable?: boolean;
|
||||
/** Whether the task ran in the foreground of its parent's work when it ended. */
|
||||
foreground?: boolean;
|
||||
};
|
||||
|
||||
type TaskStarted = {
|
||||
@@ -134,8 +145,52 @@ type TaskStarted = {
|
||||
subagentType?: unknown;
|
||||
description?: unknown;
|
||||
prompt?: unknown;
|
||||
/** The name of the tool of the call `toolUseId`, when the session has that call. */
|
||||
launchTool?: string;
|
||||
/** The task of the subagent that started this one. None means the root session. */
|
||||
parentTaskId?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Whether the end of a subagent's run waits for its messages. Claude Code
|
||||
* (2.1.328) holds the messages of a forked skill that the user typed, such as
|
||||
* `/code-review`, and writes them after its next `init` or before its next
|
||||
* result: most or all of them come after the task's end. Nothing but that
|
||||
* order tells such a subagent apart: no tool call launched it, and it ran in
|
||||
* the foreground.
|
||||
*/
|
||||
export function endWaitsForMessages(run: { launched: boolean; foreground: boolean }): boolean {
|
||||
return !run.launched && run.foreground;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether `message` ends the wait of an agent's end (see
|
||||
* {@link endWaitsForMessages}):
|
||||
*
|
||||
* - the turn's result, which Claude Code writes after the agent's messages;
|
||||
* - Claude Code's `idle`, for a turn that ends without a result;
|
||||
* - once a message of the agent came (`heard`), the first message of the main
|
||||
* conversation (`parent_tool_use_id: null`). Another subagent's message
|
||||
* ends no wait: Claude Code holds the messages of the subagents that the
|
||||
* agent launched along with the agent's own.
|
||||
*
|
||||
* Without a message, no more come: the turn or the query ended, or the
|
||||
* conversation was reset.
|
||||
*/
|
||||
export function endsMessageWait(
|
||||
message:
|
||||
{ type: string; subtype?: unknown; state?: unknown; parent_tool_use_id?: unknown } | undefined,
|
||||
heard: boolean,
|
||||
): boolean {
|
||||
if (message === undefined || message.type === "result") return true;
|
||||
if (message.type === "system") {
|
||||
return message.subtype === "session_state_changed" && message.state === "idle";
|
||||
}
|
||||
const conversation =
|
||||
message.type === "assistant" || message.type === "user" || message.type === "stream_event";
|
||||
return conversation && heard && message.parent_tool_use_id === null;
|
||||
}
|
||||
|
||||
export type SubagentIdentity = {
|
||||
name?: string;
|
||||
description?: string;
|
||||
@@ -204,6 +259,8 @@ export class NativeSubagentRuntime {
|
||||
*/
|
||||
private readonly childByToolCall = new Map<string, NativeSubagent>();
|
||||
private readonly taskFinishPromises = new Map<string, Promise<void>>();
|
||||
/** The ends that wait for their tasks' messages (see {@link finishTask}), by task id. */
|
||||
private readonly heldEnds = new Map<string, { status: unknown; end?: TaskEnd }>();
|
||||
/** The session that made each SendMessage call. */
|
||||
private readonly senderByToolUse = new Map<string, string>();
|
||||
/**
|
||||
@@ -347,6 +404,58 @@ export class NativeSubagentRuntime {
|
||||
return JSON.parse(published) as SessionConfigOption[];
|
||||
}
|
||||
|
||||
/**
|
||||
* The RFD form: what is current of the children that work now, for the
|
||||
* time after a `session/load` or `session/resume` of the session that runs
|
||||
* them. The client discarded the state and the capabilities it held for
|
||||
* them, and need not keep their place in the session tree, so each one is
|
||||
* announced again on its parent: with its labels, its `cwd`, the `cancel`
|
||||
* capability and its state, then the configuration that the client last
|
||||
* got for it. `covered` names the children that the load's replay reports
|
||||
* instead (see `RfdSubagentReplay.currentStates`).
|
||||
*
|
||||
* An announced child that no longer works but has one that does, such as a
|
||||
* background child of its own, is announced first, with its labels and
|
||||
* `cwd` only: nothing of it is current, but its child's updates name it.
|
||||
* Parents come before their children.
|
||||
*/
|
||||
currentChildren(covered: (sessionId: string) => boolean): AcpSessionNotification[] {
|
||||
if (this.form !== "rfd") return [];
|
||||
const bySession = new Map<string, NativeSubagent>();
|
||||
for (const child of this.children.values()) {
|
||||
if (child.announced && !covered(child.sessionId)) bySession.set(child.sessionId, child);
|
||||
}
|
||||
const ordered: NativeSubagent[] = [];
|
||||
const add = (child: NativeSubagent) => {
|
||||
if (ordered.includes(child)) return;
|
||||
const parent = bySession.get(child.parentSessionId);
|
||||
if (parent) add(parent);
|
||||
ordered.push(child);
|
||||
};
|
||||
for (const child of bySession.values()) if (isWorking(child)) add(child);
|
||||
return ordered.flatMap((child): AcpSessionNotification[] => {
|
||||
const announcement = rfdAnnouncement(child, child.reportedCwd);
|
||||
if (!isWorking(child)) return [{ sessionId: child.parentSessionId, update: announcement }];
|
||||
const configOptions = this.configurationOf(child.sessionId);
|
||||
const state: WorkState =
|
||||
child.workState === "requires_action" ? { state: "requires_action" } : { state: "running" };
|
||||
return [
|
||||
{
|
||||
sessionId: child.parentSessionId,
|
||||
update: { ...announcement, capabilities: { cancel: {} }, state },
|
||||
},
|
||||
...(configOptions
|
||||
? [
|
||||
{
|
||||
sessionId: child.sessionId,
|
||||
update: { sessionUpdate: "config_option_update" as const, configOptions },
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes configuration options of the child `agentId`: an SDK agent id, as a
|
||||
* hook names it, or a child session id. Hook observations can precede the
|
||||
@@ -605,8 +714,8 @@ export class NativeSubagentRuntime {
|
||||
await this.reportConfiguration(announcedChild.sessionId, update.configOptions, update._meta);
|
||||
return null;
|
||||
}
|
||||
if (this.form === "rfd" && announcedChild?.announced) {
|
||||
const handback = await this.routeRfdHandback(notification, announcedChild);
|
||||
if (announcedChild?.announced) {
|
||||
const handback = await this.routeHandback(notification, announcedChild);
|
||||
if (handback !== undefined) return handback;
|
||||
}
|
||||
if (owner) return this.toChild(owner, notification, toolCallId);
|
||||
@@ -629,6 +738,131 @@ export class NativeSubagentRuntime {
|
||||
return notification;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a message of the query, before its updates are routed.
|
||||
*
|
||||
* A subagent's message names it by `agent_id`. A child that no tool call
|
||||
* launched has no id that its updates could go by: a forked skill that the
|
||||
* user typed sends `forked-command-<skill>` as `parent_tool_use_id`, for
|
||||
* every run of the skill. From this message on, the updates under that id
|
||||
* are the child's, and no longer those of an earlier run's child.
|
||||
*
|
||||
* It also ends the runs whose ends waited for their messages (see
|
||||
* {@link finishTask} and {@link endsMessageWait}). Only then does it return
|
||||
* a promise, for the caller to await: a caller that awaited every message
|
||||
* would let a cancel run between a message and its handling.
|
||||
*/
|
||||
messageCame(
|
||||
message: {
|
||||
type: string;
|
||||
subtype?: unknown;
|
||||
state?: unknown;
|
||||
parent_tool_use_id?: unknown;
|
||||
agent_id?: unknown;
|
||||
},
|
||||
deliver: Publish,
|
||||
): Promise<void> | undefined {
|
||||
if (!this.enabled) return undefined;
|
||||
const { parent_tool_use_id: launchId, agent_id: agentId } = message;
|
||||
const child = typeof agentId === "string" ? this.children.get(agentId) : undefined;
|
||||
if (child && typeof agentId === "string" && typeof launchId === "string") {
|
||||
child.heard = true;
|
||||
if (
|
||||
child.parentToolUseId === undefined &&
|
||||
this.childByParentToolUse.get(launchId) !== child
|
||||
) {
|
||||
this.taskByToolUse.set(launchId, agentId);
|
||||
this.childByParentToolUse.set(launchId, child);
|
||||
}
|
||||
}
|
||||
return this.releaseHeldEnds(deliver, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends the runs whose wait `message` ends; without a message, all of them.
|
||||
* Undefined when it ends none.
|
||||
*/
|
||||
private releaseHeldEnds(
|
||||
deliver: Publish,
|
||||
message?: Parameters<typeof endsMessageWait>[0],
|
||||
): Promise<void> | undefined {
|
||||
if (this.heldEnds.size === 0) return undefined;
|
||||
const ended = [...this.heldEnds].filter(([taskId]) =>
|
||||
endsMessageWait(message, this.children.get(taskId)?.heard === true),
|
||||
);
|
||||
if (ended.length === 0) return undefined;
|
||||
return (async () => {
|
||||
for (const [taskId, held] of ended) {
|
||||
this.heldEnds.delete(taskId);
|
||||
await this.finishTask(taskId, held.status, deliver, undefined, held.end);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
/**
|
||||
* The session of the call that launched `task`, when the session has that
|
||||
* call and it is no Agent, Task or SendMessage call, such as the Skill call
|
||||
* of a forked skill: the session of the subagent that made it, once that
|
||||
* one is announced, or the root session.
|
||||
*/
|
||||
private shownLaunchParent(task: TaskStarted): string | undefined {
|
||||
if (
|
||||
!task.toolUseId ||
|
||||
task.launchTool === undefined ||
|
||||
task.launchTool === "SendMessage" ||
|
||||
isNativeSubagentControlTool(task.launchTool)
|
||||
) {
|
||||
return undefined;
|
||||
}
|
||||
if (task.parentTaskId === undefined) return this.rootSessionId;
|
||||
const parent = this.children.get(task.parentTaskId);
|
||||
return parent?.announced ? parent.sessionId : undefined;
|
||||
}
|
||||
|
||||
/** A launch result can carry the report even when the SDK sends no child stream. */
|
||||
async toolResult(message: SDKUserMessage): Promise<void> {
|
||||
if (!this.enabled || !Array.isArray(message.message.content)) return;
|
||||
const results = message.message.content.filter((block) => block.type === "tool_result");
|
||||
const result = results[0];
|
||||
if (results.length !== 1 || result?.type !== "tool_result" || result.is_error) return;
|
||||
const text = handbackReportText(message.tool_use_result);
|
||||
if (text === undefined) return;
|
||||
const launchId = result.tool_use_id;
|
||||
const child = this.childByParentToolUse.get(launchId);
|
||||
if (!child) return;
|
||||
await this.announce(child);
|
||||
if (child.handedBack?.has(launchId)) return;
|
||||
await this.publishHandback(child, launchId, text, `${launchId}:handback`);
|
||||
}
|
||||
|
||||
private async publishHandback(
|
||||
child: NativeSubagent,
|
||||
delegationId: string,
|
||||
text: string,
|
||||
messageId: string,
|
||||
): Promise<void> {
|
||||
(child.handedBack ??= new Set()).add(delegationId);
|
||||
if (this.form === "air") {
|
||||
await this.publish({
|
||||
sessionId: child.sessionId,
|
||||
update: {
|
||||
sessionUpdate: "agent_message_chunk",
|
||||
messageId,
|
||||
content: { type: "text", text },
|
||||
},
|
||||
});
|
||||
} else {
|
||||
for (const view of linkedSessionMessages(
|
||||
messageId,
|
||||
child.sessionId,
|
||||
child.parentSessionId,
|
||||
text,
|
||||
)) {
|
||||
await this.publish(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async taskStarted(task: TaskStarted, deliver: Publish): Promise<void> {
|
||||
if (!this.enabled) return;
|
||||
const known =
|
||||
@@ -678,9 +912,11 @@ export class NativeSubagentRuntime {
|
||||
|
||||
// A SendMessage resume reuses the finished generation's tool id, whose
|
||||
// control state is already cleaned up.
|
||||
const shownLaunchParent = this.shownLaunchParent(task);
|
||||
const knownParentSessionId =
|
||||
(task.toolUseId ? this.parentByToolUse.get(task.toolUseId) : undefined) ??
|
||||
(previous && this.resumedParentSessionId(previous));
|
||||
(previous && this.resumedParentSessionId(previous)) ??
|
||||
shownLaunchParent;
|
||||
const identity = task.toolUseId ? this.identityByToolUse.get(task.toolUseId) : undefined;
|
||||
// A nested child must wait for the spawning Agent/Task frame to establish
|
||||
// its immediate parent. Root children without a tool id can be announced.
|
||||
@@ -706,6 +942,7 @@ export class NativeSubagentRuntime {
|
||||
identity?.subagentType ?? task.subagentType,
|
||||
identity?.description ?? task.description,
|
||||
),
|
||||
...(shownLaunchParent !== undefined ? { launchShown: true } : {}),
|
||||
},
|
||||
!!knownParentSessionId || !task.toolUseId,
|
||||
deliver,
|
||||
@@ -804,6 +1041,8 @@ export class NativeSubagentRuntime {
|
||||
/**
|
||||
* Reports that the SDK ended the task's work. `end` has what the SDK says
|
||||
* about it: its text for a failure, and its reason for an unusual end.
|
||||
* The end of a child whose messages Claude Code holds until after it (see
|
||||
* {@link endWaitsForMessages}) is reported once they came.
|
||||
*/
|
||||
async finishTask(
|
||||
taskId: string,
|
||||
@@ -834,6 +1073,23 @@ export class NativeSubagentRuntime {
|
||||
if (this.form === "rfd") await this.supplyError(child, state, end?.error);
|
||||
return;
|
||||
}
|
||||
const held = this.heldEnds.get(taskId);
|
||||
if (held) {
|
||||
// A second report of an end that waits can give the text of its failure.
|
||||
if (end?.error && !held.end?.error) held.end = { ...held.end, error: end.error };
|
||||
return;
|
||||
}
|
||||
if (
|
||||
child.announced &&
|
||||
endWaitsForMessages({
|
||||
launched: child.parentToolUseId !== undefined,
|
||||
foreground: end?.foreground === true,
|
||||
})
|
||||
) {
|
||||
// The run ends once its messages came (see `messageCame`).
|
||||
this.heldEnds.set(taskId, { status, end: { ...end, foreground: false } });
|
||||
return;
|
||||
}
|
||||
|
||||
const finish = Promise.resolve().then(async () => {
|
||||
try {
|
||||
@@ -896,6 +1152,12 @@ export class NativeSubagentRuntime {
|
||||
: mayStillRun
|
||||
? { unobservable: true }
|
||||
: { unexplained: true };
|
||||
try {
|
||||
// An end that waited for its task's messages is that task's end.
|
||||
await this.releaseHeldEnds(deliver);
|
||||
} catch (error) {
|
||||
errors.push(error);
|
||||
}
|
||||
try {
|
||||
for (const taskId of [...this.children.keys()].reverse()) {
|
||||
try {
|
||||
@@ -953,15 +1215,6 @@ export class NativeSubagentRuntime {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The RFD form: whether `sessionId` is a child session that this runtime
|
||||
* announced. The client can cancel such a session and nothing else (see
|
||||
* `restrictedChild`). False in AIR's draft, which keeps its own rules.
|
||||
*/
|
||||
hasChild(sessionId: string): boolean {
|
||||
return this.announcedChild(sessionId) !== undefined;
|
||||
}
|
||||
|
||||
/** The RFD form: the announced child session `sessionId`, with its task id. */
|
||||
private announcedChild(sessionId: string): [string, NativeSubagent] | undefined {
|
||||
if (this.form !== "rfd") return undefined;
|
||||
@@ -1422,12 +1675,12 @@ export class NativeSubagentRuntime {
|
||||
}
|
||||
|
||||
/**
|
||||
* The RFD form: an update of a SubagentHandback call of the announced
|
||||
* `child`, which its report replaces: the child's message to its parent,
|
||||
* see {@link linkedSessionMessages}. A failed call delivered nothing, so the
|
||||
* An update of a SubagentHandback call of the announced `child`, which its
|
||||
* report replaces. RFD also sends the parent an incoming session message.
|
||||
* A failed call delivered nothing, so the
|
||||
* child is shown the call after all. `undefined` for any other update.
|
||||
*/
|
||||
private async routeRfdHandback(
|
||||
private async routeHandback(
|
||||
notification: AcpSessionNotification,
|
||||
child: NativeSubagent,
|
||||
): Promise<AcpSessionNotification | null | undefined> {
|
||||
@@ -1450,15 +1703,12 @@ export class NativeSubagentRuntime {
|
||||
if (!isFinalToolCallStatus(update.status)) return null;
|
||||
this.handbacks.delete(update.toolCallId);
|
||||
if (update.status === "completed" && handback.message) {
|
||||
for (const view of linkedSessionMessages(
|
||||
update.toolCallId,
|
||||
child.sessionId,
|
||||
child.parentSessionId,
|
||||
await this.publishHandback(
|
||||
child,
|
||||
handback.delegationId ?? update.toolCallId,
|
||||
handback.message,
|
||||
)) {
|
||||
await this.publish(view);
|
||||
}
|
||||
if (handback.delegationId) (child.handedBack ??= new Set()).add(handback.delegationId);
|
||||
update.toolCallId,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
return unexposedControlFallback(handback.initial, notification, child.sessionId);
|
||||
@@ -1519,7 +1769,9 @@ export class NativeSubagentRuntime {
|
||||
* - a SendMessage call that resumed the child, and stays shown because a
|
||||
* permission request showed it;
|
||||
* - an Agent/Task call that launched the child, and stays shown for the
|
||||
* same reason.
|
||||
* same reason;
|
||||
* - the call that launched a child and is no Agent/Task call, such as the
|
||||
* Skill call of a forked skill, which always stays shown.
|
||||
*
|
||||
* The RFD requires the announcement before the reference, so a call whose
|
||||
* child is not announced yet gets none.
|
||||
@@ -1599,6 +1851,7 @@ export class NativeSubagentRuntime {
|
||||
this.cwdBySession.clear();
|
||||
this.childByParentToolUse.clear();
|
||||
this.taskFinishPromises.clear();
|
||||
this.heldEnds.clear();
|
||||
this.senderByToolUse.clear();
|
||||
this.hiddenLaunches.clear();
|
||||
this.hiddenSendMessages.clear();
|
||||
@@ -1698,6 +1951,7 @@ export class NativeSubagentRuntime {
|
||||
| "title"
|
||||
| "role"
|
||||
| "description"
|
||||
| "launchShown"
|
||||
>,
|
||||
announce: boolean,
|
||||
deliver: Publish,
|
||||
@@ -1791,6 +2045,24 @@ export function responseModelEntry(
|
||||
return models?.entry(model) ?? { value: model, name: models?.name(model) ?? model };
|
||||
}
|
||||
|
||||
/**
|
||||
* The RFD form: the `subagent_update` that names `child` on its parent, with
|
||||
* the parent's labels for it and `cwd`, its working directory when that is
|
||||
* not its parent's.
|
||||
*/
|
||||
function rfdAnnouncement(
|
||||
child: NativeSubagent,
|
||||
cwd: string | null | undefined,
|
||||
): Extract<AcpSessionNotification["update"], { sessionUpdate: "subagent_update" }> {
|
||||
return {
|
||||
sessionUpdate: "subagent_update",
|
||||
sessionId: child.sessionId,
|
||||
...(child.title ? { title: child.title } : {}),
|
||||
...(child.description ? { description: child.description } : {}),
|
||||
...(cwd ? { cwd } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Announces the child on its parent, once, before any update of the child.
|
||||
* The RFD form announces it as running and then sends the prompt as the
|
||||
@@ -1813,18 +2085,15 @@ export async function announceNativeSubagent(
|
||||
await publish({
|
||||
sessionId: child.parentSessionId,
|
||||
update: {
|
||||
sessionUpdate: "subagent_update",
|
||||
sessionId: child.sessionId,
|
||||
...(child.title ? { title: child.title } : {}),
|
||||
...(child.description ? { description: child.description } : {}),
|
||||
...(cwd ? { cwd } : {}),
|
||||
...rfdAnnouncement(child, cwd),
|
||||
capabilities: { cancel: {} },
|
||||
state: { state: "running" },
|
||||
},
|
||||
});
|
||||
if (cwd) child.reportedCwd = cwd;
|
||||
child.announced = true;
|
||||
// The immediate parent made the Agent/Task call that launched the child.
|
||||
// The immediate parent made the call that launched the child. The
|
||||
// prompt replaces an Agent/Task call, and not a call that stays shown.
|
||||
if (child.prompt) {
|
||||
await publishPrompt(
|
||||
child,
|
||||
@@ -1832,7 +2101,7 @@ export async function announceNativeSubagent(
|
||||
child.parentToolUseId,
|
||||
child.parentSessionId,
|
||||
publish,
|
||||
{ replacesCall: true },
|
||||
{ replacesCall: !child.launchShown },
|
||||
);
|
||||
}
|
||||
return;
|
||||
@@ -2014,6 +2283,15 @@ export function withSessionReference(
|
||||
*/
|
||||
export const HANDBACK_TOOL = "SubagentHandback";
|
||||
|
||||
/** The report in an Agent result whose text only points to the hand-back message. */
|
||||
export function handbackReportText(result: unknown): string | undefined {
|
||||
const report = result as
|
||||
{ status?: unknown; handbackReport?: { text?: unknown } } | null | undefined;
|
||||
if (report?.status !== "completed") return undefined;
|
||||
const text = report.handbackReport?.text;
|
||||
return typeof text === "string" && text.trim() ? text : undefined;
|
||||
}
|
||||
|
||||
/** The report of a SubagentHandback call, from its input. */
|
||||
export function handbackMessage(input: unknown): string | undefined {
|
||||
const message = (input as { message?: unknown } | null | undefined)?.message;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* The session updates that show the session's plans. A client with the `plan`
|
||||
* capability (every v2 client, and a v1 client that asks for it) tracks plans
|
||||
* by ID and gets `plan_update` and `plan_removed`; any other client gets the
|
||||
* legacy `plan` update, which holds one ID-less plan per session.
|
||||
* The session updates that show the session's plans. A v2 client, and a v1
|
||||
* client that advertises the `plan` capability, tracks plans by ID and gets
|
||||
* `plan_update` and `plan_removed`; any other v1 client gets the legacy `plan`
|
||||
* update, which holds one ID-less plan per session.
|
||||
*/
|
||||
import type {
|
||||
PlanEntry,
|
||||
|
||||
793
src/plugin-command.ts
Normal file
793
src/plugin-command.ts
Normal file
@@ -0,0 +1,793 @@
|
||||
/**
|
||||
* `/plugin` (aliases `/plugins`, `/marketplace`), which the adapter serves
|
||||
* itself. Claude Code's own `/plugin` is an interactive terminal screen and
|
||||
* answers "/plugin isn't available in this environment." in a session without
|
||||
* a terminal, which is every ACP session. The adapter instead runs the CLI's
|
||||
* `claude plugin ...` commands, which have a `--json` form, and then reloads
|
||||
* the live session so the new plugin's commands, skills and MCP servers appear.
|
||||
*
|
||||
* Plugins bring hooks and MCP servers that run as the user, so the set of
|
||||
* commands and flags below is an allowlist, and it is the only guard. Anything
|
||||
* outside it, such as `-y`, `--accept-command` or `--json`, gets the usage
|
||||
* text and never reaches the CLI. Shared by the v1 core and the v2 core.
|
||||
*/
|
||||
import { execFile } from "node:child_process";
|
||||
import type { AvailableCommand } from "@agentclientprotocol/sdk/unstable";
|
||||
import type { Query } from "@anthropic-ai/claude-agent-sdk";
|
||||
import { codeSpan, escapeMarkdown } from "./usage-markdown.js";
|
||||
|
||||
/** The content blocks of a prompt, in v1 or v2 form: the command is one text block. */
|
||||
type PromptContent = ReadonlyArray<{ type: string; text?: unknown }>;
|
||||
|
||||
export const PLUGIN_COMMAND_NAME = "plugin";
|
||||
|
||||
/** The `/plugin` entry of `available_commands_update`. */
|
||||
export const PLUGIN_AVAILABLE_COMMAND: AvailableCommand = {
|
||||
name: PLUGIN_COMMAND_NAME,
|
||||
description: "Manage Claude Code plugins and marketplaces",
|
||||
input: { hint: "[install|uninstall|enable|disable|update|list|marketplace …] …" },
|
||||
};
|
||||
|
||||
/** The CLI operations that the adapter runs. */
|
||||
export type PluginCliOperation =
|
||||
| "list"
|
||||
| "install"
|
||||
| "uninstall"
|
||||
| "enable"
|
||||
| "disable"
|
||||
| "update"
|
||||
| "marketplace-add"
|
||||
| "marketplace-list"
|
||||
| "marketplace-remove"
|
||||
| "marketplace-update";
|
||||
|
||||
export type PluginOperation = PluginCliOperation | "overview" | "usage";
|
||||
|
||||
export type PluginCommand =
|
||||
/** Bare `/plugin` and `/plugin help`: usage, installed plugins and marketplaces. */
|
||||
| { kind: "overview" }
|
||||
/** Anything outside the allowlist, or a missing argument. `reason` says which. */
|
||||
| { kind: "usage"; reason?: string }
|
||||
/** One CLI run. `argv` is what follows `claude plugin`, without `--json`.
|
||||
* `target` is the plugin or marketplace name the command is about, if it has one. */
|
||||
| { kind: "cli"; operation: PluginCliOperation; argv: string[]; target?: string };
|
||||
|
||||
const SCOPES = ["user", "project", "local"];
|
||||
|
||||
type FlagKind = "bool" | "value" | "list" | "variadic";
|
||||
|
||||
interface FlagSpec {
|
||||
/** The flag's names, such as `["-s", "--scope"]`. The first is its key. */
|
||||
names: string[];
|
||||
kind: FlagKind;
|
||||
/** The allowed values; any value if absent. */
|
||||
values?: string[];
|
||||
}
|
||||
|
||||
interface Scanned {
|
||||
positionals: string[];
|
||||
/** Per flag key: `true` for a bool, else the values in the order given. */
|
||||
flags: Map<string, true | string[]>;
|
||||
}
|
||||
|
||||
const SCOPE_FLAG: FlagSpec = { names: ["-s", "--scope"], kind: "value", values: SCOPES };
|
||||
|
||||
/** Splits `tokens` into positionals and the flags of `specs`. Any other token
|
||||
* that starts with `-` is an error, so no user text becomes a CLI option. */
|
||||
function scan(tokens: string[], specs: FlagSpec[]): Scanned | { error: string | undefined } {
|
||||
const positionals: string[] = [];
|
||||
const flags = new Map<string, true | string[]>();
|
||||
for (let i = 0; i < tokens.length; i++) {
|
||||
let token = tokens[i]!;
|
||||
if (!token.startsWith("-")) {
|
||||
positionals.push(token);
|
||||
continue;
|
||||
}
|
||||
if (token === "-h" || token === "--help") return { error: undefined };
|
||||
let inline: string | undefined;
|
||||
const equals = token.startsWith("--") ? token.indexOf("=") : -1;
|
||||
if (equals > 0) {
|
||||
inline = token.slice(equals + 1);
|
||||
token = token.slice(0, equals);
|
||||
if (inline.startsWith("-")) return { error: `\`${token}\` needs a value.` };
|
||||
}
|
||||
const spec = specs.find((candidate) => candidate.names.includes(token));
|
||||
if (!spec) return { error: `\`${token}\` is not supported here.` };
|
||||
const key = spec.names[0]!;
|
||||
if (spec.kind === "bool") {
|
||||
if (inline !== undefined) return { error: `\`${token}\` takes no value.` };
|
||||
flags.set(key, true);
|
||||
continue;
|
||||
}
|
||||
const values: string[] = [];
|
||||
if (inline !== undefined) {
|
||||
values.push(inline);
|
||||
} else if (spec.kind === "variadic") {
|
||||
while (i + 1 < tokens.length && !tokens[i + 1]!.startsWith("-")) values.push(tokens[++i]!);
|
||||
} else if (i + 1 < tokens.length && !tokens[i + 1]!.startsWith("-")) {
|
||||
values.push(tokens[++i]!);
|
||||
}
|
||||
if (values.length === 0 || values.some((value) => value === "")) {
|
||||
return { error: `\`${token}\` needs a value.` };
|
||||
}
|
||||
if (spec.values && !values.every((value) => spec.values!.includes(value))) {
|
||||
return { error: `\`${token}\` takes one of ${spec.values.join(", ")}.` };
|
||||
}
|
||||
const previous = flags.get(key);
|
||||
if (previous !== undefined && spec.kind !== "list" && spec.kind !== "variadic") {
|
||||
return { error: `\`${token}\` is given twice.` };
|
||||
}
|
||||
flags.set(key, [...(Array.isArray(previous) ? previous : []), ...values]);
|
||||
}
|
||||
return { positionals, flags };
|
||||
}
|
||||
|
||||
function flagArgs(scanned: Scanned, specs: FlagSpec[]): string[] {
|
||||
const args: string[] = [];
|
||||
for (const spec of specs) {
|
||||
const key = spec.names[0]!;
|
||||
const value = scanned.flags.get(key);
|
||||
if (value === undefined) continue;
|
||||
const flag = spec.names.find((name) => name.startsWith("--")) ?? key;
|
||||
if (value === true) args.push(flag);
|
||||
else if (spec.kind === "list") for (const item of value) args.push(flag, item);
|
||||
else args.push(flag, ...value);
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
const USAGE_PLUGIN_ARGUMENT = "Give a plugin name, as `name` or `name@marketplace`.";
|
||||
|
||||
/** Parses the arguments of a CLI subcommand into a `cli` command. */
|
||||
function parseSubcommand(
|
||||
operation: PluginCliOperation,
|
||||
words: string[],
|
||||
specs: FlagSpec[],
|
||||
prefix: string[],
|
||||
options: { positional: "none" | "one" | "optional"; missing?: string },
|
||||
): PluginCommand {
|
||||
const scanned = scan(words, specs);
|
||||
if ("error" in scanned) return { kind: "usage", reason: scanned.error };
|
||||
const max = options.positional === "none" ? 0 : 1;
|
||||
if (scanned.positionals.length > max) {
|
||||
return { kind: "usage", reason: `Unexpected argument \`${scanned.positionals[max]}\`.` };
|
||||
}
|
||||
if (options.positional === "one" && scanned.positionals.length === 0) {
|
||||
return { kind: "usage", reason: options.missing };
|
||||
}
|
||||
const target = scanned.positionals[0];
|
||||
return {
|
||||
kind: "cli",
|
||||
operation,
|
||||
argv: [...prefix, ...scanned.positionals, ...flagArgs(scanned, specs)],
|
||||
...(target === undefined ? {} : { target }),
|
||||
};
|
||||
}
|
||||
|
||||
const LIST_FLAGS: FlagSpec[] = [{ names: ["--available"], kind: "bool" }];
|
||||
const INSTALL_FLAGS: FlagSpec[] = [
|
||||
SCOPE_FLAG,
|
||||
{ names: ["--marketplace"], kind: "value" },
|
||||
{ names: ["--config"], kind: "list" },
|
||||
];
|
||||
const UNINSTALL_FLAGS: FlagSpec[] = [SCOPE_FLAG, { names: ["--keep-data"], kind: "bool" }];
|
||||
const ENABLE_FLAGS: FlagSpec[] = [SCOPE_FLAG];
|
||||
const DISABLE_FLAGS: FlagSpec[] = [SCOPE_FLAG, { names: ["-a", "--all"], kind: "bool" }];
|
||||
const MARKETPLACE_ADD_FLAGS: FlagSpec[] = [SCOPE_FLAG, { names: ["--sparse"], kind: "variadic" }];
|
||||
|
||||
function parseMarketplace(words: string[]): PluginCommand {
|
||||
const [sub, ...rest] = words;
|
||||
switch (sub) {
|
||||
case "add":
|
||||
return parseSubcommand(
|
||||
"marketplace-add",
|
||||
rest,
|
||||
MARKETPLACE_ADD_FLAGS,
|
||||
["marketplace", "add"],
|
||||
{
|
||||
positional: "one",
|
||||
missing: "Give a marketplace source: a GitHub `owner/repo`, a git URL, or a path.",
|
||||
},
|
||||
);
|
||||
case "list":
|
||||
case "ls":
|
||||
return parseSubcommand("marketplace-list", rest, [], ["marketplace", "list"], {
|
||||
positional: "none",
|
||||
});
|
||||
case "remove":
|
||||
case "rm":
|
||||
return parseSubcommand("marketplace-remove", rest, [SCOPE_FLAG], ["marketplace", "remove"], {
|
||||
positional: "one",
|
||||
missing: "Give the name of the marketplace to remove.",
|
||||
});
|
||||
case "update":
|
||||
return parseSubcommand("marketplace-update", rest, [], ["marketplace", "update"], {
|
||||
positional: "optional",
|
||||
});
|
||||
default:
|
||||
return { kind: "usage" };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses `/plugin ...` (also `/plugins ...` and `/marketplace ...`, which are
|
||||
* aliases: `/marketplace marketplace add x` is `/plugin marketplace add x`,
|
||||
* and `/marketplace add x` is usage, like `/plugin add x`) from a single-text
|
||||
* prompt. `null` for any other prompt, which goes to Claude Code.
|
||||
*/
|
||||
export function parsePluginCommand(prompt: PromptContent): PluginCommand | null {
|
||||
const [first] = prompt;
|
||||
if (prompt.length !== 1 || first?.type !== "text" || typeof first.text !== "string") return null;
|
||||
// Check the first word before splitting, so a long prompt is not split into words.
|
||||
const text = first.text.trim();
|
||||
if (!/^\/(?:plugins?|marketplace)(?:\s|$)/.test(text)) return null;
|
||||
const [, ...words] = text.split(/\s+/);
|
||||
const [sub, ...rest] = words;
|
||||
switch (sub) {
|
||||
case undefined:
|
||||
case "help":
|
||||
return { kind: "overview" };
|
||||
case "list":
|
||||
case "ls":
|
||||
return parseSubcommand("list", rest, LIST_FLAGS, ["list"], { positional: "none" });
|
||||
case "install":
|
||||
case "i":
|
||||
return parseSubcommand("install", rest, INSTALL_FLAGS, ["install"], {
|
||||
positional: "one",
|
||||
missing: USAGE_PLUGIN_ARGUMENT,
|
||||
});
|
||||
case "uninstall":
|
||||
case "remove":
|
||||
case "rm":
|
||||
return parseSubcommand("uninstall", rest, UNINSTALL_FLAGS, ["uninstall"], {
|
||||
positional: "one",
|
||||
missing: USAGE_PLUGIN_ARGUMENT,
|
||||
});
|
||||
case "enable":
|
||||
return parseSubcommand("enable", rest, ENABLE_FLAGS, ["enable"], {
|
||||
positional: "one",
|
||||
missing: USAGE_PLUGIN_ARGUMENT,
|
||||
});
|
||||
case "disable": {
|
||||
const command = parseSubcommand("disable", rest, DISABLE_FLAGS, ["disable"], {
|
||||
positional: "optional",
|
||||
});
|
||||
if (command.kind !== "cli") return command;
|
||||
const all = command.argv.includes("--all");
|
||||
if (all === (command.target !== undefined)) {
|
||||
return {
|
||||
kind: "usage",
|
||||
reason: all
|
||||
? "Give either a plugin name or `--all`, not both."
|
||||
: `${USAGE_PLUGIN_ARGUMENT} Or use \`--all\` to disable every plugin.`,
|
||||
};
|
||||
}
|
||||
return command;
|
||||
}
|
||||
case "update":
|
||||
return parseSubcommand("update", rest, [SCOPE_FLAG], ["update"], {
|
||||
positional: "one",
|
||||
missing: USAGE_PLUGIN_ARGUMENT,
|
||||
});
|
||||
case "marketplace":
|
||||
case "market":
|
||||
return parseMarketplace(rest);
|
||||
default:
|
||||
return { kind: "usage", reason: `Unknown subcommand \`${sub}\`.` };
|
||||
}
|
||||
}
|
||||
|
||||
export type PluginReload = {
|
||||
status: "applied" | "busy" | "failed" | "unavailable";
|
||||
/** The names of the plugins the session has after a reload; with `applied`. */
|
||||
plugins?: string[];
|
||||
/** Why the reload failed; with `failed`. */
|
||||
error?: string;
|
||||
};
|
||||
|
||||
export interface PluginCommandResult {
|
||||
ok: boolean;
|
||||
operation: PluginOperation;
|
||||
/** The CLI's own message, or the adapter's when the CLI did not run or did not answer. */
|
||||
message: string;
|
||||
/** The CLI's `failureCode`, such as `not_found` or `command_source_refused`. */
|
||||
failureCode?: string;
|
||||
/** With `command_source_refused`: the command that the marketplace declares as the install. */
|
||||
shownCommand?: string;
|
||||
/** With `shownCommand`: the terminal command that lets the user confirm it. */
|
||||
terminalCommand?: string;
|
||||
/** The parsed `--json` output of a list: an array, or `{installed, available}`; for an overview, `{plugins, marketplaces}` plus `pluginsError` or `marketplacesError` for a list that failed. */
|
||||
data?: unknown;
|
||||
reload?: PluginReload;
|
||||
}
|
||||
|
||||
export interface ExecOptions {
|
||||
cwd: string;
|
||||
env: Record<string, string | undefined>;
|
||||
signal: AbortSignal;
|
||||
timeoutMs: number;
|
||||
}
|
||||
|
||||
export interface ExecOutput {
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
/** The exit code. A run that ends with a non-zero code is a result, not an error. */
|
||||
code: number;
|
||||
}
|
||||
|
||||
/** Runs a program without a shell. Rejects when it cannot start, is aborted,
|
||||
* times out, or prints too much. */
|
||||
export type ExecLike = (file: string, args: string[], options: ExecOptions) => Promise<ExecOutput>;
|
||||
|
||||
export interface PluginCommandDeps {
|
||||
cliPath: () => Promise<string>;
|
||||
cwd: string;
|
||||
env: Record<string, string | undefined>;
|
||||
signal: AbortSignal;
|
||||
/** Read after the CLI ends: the session's query can be replaced while it runs. */
|
||||
query: () => Query | undefined;
|
||||
logError: (message: string) => void;
|
||||
exec?: ExecLike;
|
||||
}
|
||||
|
||||
/** The time that one CLI run can take. A git clone of a marketplace is the slow case. */
|
||||
const PLUGIN_CLI_TIMEOUT_MS = 5 * 60_000;
|
||||
|
||||
const MAX_OUTPUT_BYTES = 16 * 1024 * 1024;
|
||||
|
||||
const defaultExec: ExecLike = (file, args, options) =>
|
||||
new Promise((resolve, reject) => {
|
||||
const child = execFile(
|
||||
file,
|
||||
args,
|
||||
{
|
||||
cwd: options.cwd,
|
||||
env: options.env,
|
||||
signal: options.signal,
|
||||
timeout: options.timeoutMs,
|
||||
maxBuffer: MAX_OUTPUT_BYTES,
|
||||
encoding: "utf8",
|
||||
},
|
||||
(error, stdout, stderr) => {
|
||||
if (!error) return resolve({ stdout, stderr, code: 0 });
|
||||
if (typeof error.code === "number") return resolve({ stdout, stderr, code: error.code });
|
||||
if (error.killed && !options.signal.aborted) {
|
||||
return reject(new Error(`Timed out after ${options.timeoutMs / 60_000} minutes.`));
|
||||
}
|
||||
reject(error);
|
||||
},
|
||||
);
|
||||
// The CLI must not wait on a terminal that does not exist.
|
||||
child.stdin?.end();
|
||||
});
|
||||
|
||||
/** The operations after which the live session reloads its plugins. */
|
||||
const RELOADING_OPERATIONS: ReadonlySet<PluginOperation> = new Set([
|
||||
"install",
|
||||
"uninstall",
|
||||
"enable",
|
||||
"disable",
|
||||
"update",
|
||||
"marketplace-remove",
|
||||
]);
|
||||
|
||||
type CliRun =
|
||||
| { type: "cancelled" }
|
||||
| { type: "error"; message: string }
|
||||
| { type: "done"; code: number; stdout: string; stderr: string };
|
||||
|
||||
interface CliJson {
|
||||
outcome?: unknown;
|
||||
message?: unknown;
|
||||
failureCode?: unknown;
|
||||
alreadyInGoalState?: unknown;
|
||||
shownCommand?: unknown;
|
||||
}
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === "object" && value !== null && !Array.isArray(value);
|
||||
}
|
||||
|
||||
/** The result line of a `--json` run: the last non-empty line of stdout. The
|
||||
* CLI can print human-readable lines before it. */
|
||||
function lastJsonLine(stdout: string): CliJson | undefined {
|
||||
const lines = stdout.split(/\r?\n/).filter((line) => line.trim() !== "");
|
||||
const last = lines[lines.length - 1];
|
||||
if (last === undefined) return undefined;
|
||||
try {
|
||||
const parsed: unknown = JSON.parse(last);
|
||||
return isRecord(parsed) ? (parsed as CliJson) : undefined;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/** The whole of stdout as JSON: a list prints an indented array or object. */
|
||||
function wholeJson(stdout: string): unknown {
|
||||
try {
|
||||
return JSON.parse(stdout.trim());
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
const MAX_TEXT_LENGTH = 1500;
|
||||
|
||||
function plainText(text: string): string {
|
||||
// eslint-disable-next-line no-control-regex
|
||||
const stripped = text.replace(/\u001b\[[0-9;]*[A-Za-z]/g, "").trim();
|
||||
return stripped.length > MAX_TEXT_LENGTH ? `${stripped.slice(0, MAX_TEXT_LENGTH)}…` : stripped;
|
||||
}
|
||||
|
||||
function isJsonOptionUnknown(run: { stdout: string; stderr: string }): boolean {
|
||||
return /unknown option.*--json/i.test(`${run.stderr}\n${run.stdout}`);
|
||||
}
|
||||
|
||||
/** Whether the CLI takes `--json` for the command: `marketplace update` without a name does not. */
|
||||
function takesJson(command: Extract<PluginCommand, { kind: "cli" }>): boolean {
|
||||
return !(command.operation === "marketplace-update" && command.target === undefined);
|
||||
}
|
||||
|
||||
async function runCli(
|
||||
deps: PluginCommandDeps,
|
||||
exec: ExecLike,
|
||||
env: Record<string, string | undefined>,
|
||||
argv: string[],
|
||||
json: boolean,
|
||||
): Promise<CliRun> {
|
||||
if (deps.signal.aborted) return { type: "cancelled" };
|
||||
const run = async (args: string[]): Promise<CliRun> => {
|
||||
try {
|
||||
const file = await deps.cliPath();
|
||||
const output = await exec(file, args, {
|
||||
cwd: deps.cwd,
|
||||
env,
|
||||
signal: deps.signal,
|
||||
timeoutMs: PLUGIN_CLI_TIMEOUT_MS,
|
||||
});
|
||||
return { type: "done", ...output };
|
||||
} catch (error) {
|
||||
if (deps.signal.aborted) return { type: "cancelled" };
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
deps.logError(`Failed to run \`claude plugin ${argv.join(" ")}\`: ${message}`);
|
||||
return { type: "error", message: `Could not run the Claude CLI: ${message}` };
|
||||
}
|
||||
};
|
||||
const first = await run(["plugin", ...argv, ...(json ? ["--json"] : [])]);
|
||||
// A CLI named by CLAUDE_CODE_EXECUTABLE can predate `--json`. It rejects the
|
||||
// flag before doing anything, so the run is repeated for its text and exit code.
|
||||
if (json && first.type === "done" && first.code !== 0 && isJsonOptionUnknown(first)) {
|
||||
return run(["plugin", ...argv]);
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
||||
function cancelled(operation: PluginOperation): PluginCommandResult {
|
||||
return { ok: false, operation, message: "Cancelled." };
|
||||
}
|
||||
|
||||
function failedToRun(operation: PluginOperation, run: CliRun): PluginCommandResult {
|
||||
return run.type === "cancelled"
|
||||
? cancelled(operation)
|
||||
: { ok: false, operation, message: run.type === "error" ? run.message : "" };
|
||||
}
|
||||
|
||||
function describeCliRun(
|
||||
command: Extract<PluginCommand, { kind: "cli" }>,
|
||||
run: Extract<CliRun, { type: "done" }>,
|
||||
): PluginCommandResult {
|
||||
const { operation } = command;
|
||||
const isList = operation === "list" || operation === "marketplace-list";
|
||||
const json = lastJsonLine(run.stdout);
|
||||
if (isList) {
|
||||
const data = wholeJson(run.stdout);
|
||||
if (run.code === 0 && data !== undefined && typeof data === "object" && data !== null) {
|
||||
return { ok: true, operation, message: "", data };
|
||||
}
|
||||
}
|
||||
if (!json || typeof json.outcome !== "string") {
|
||||
const text = plainText(run.code === 0 ? run.stdout || run.stderr : run.stderr || run.stdout);
|
||||
return {
|
||||
ok: run.code === 0,
|
||||
operation,
|
||||
message: text || (run.code === 0 ? "Done." : `The Claude CLI exited with code ${run.code}.`),
|
||||
};
|
||||
}
|
||||
const message =
|
||||
typeof json.message === "string" && json.message.trim() !== ""
|
||||
? plainText(json.message)
|
||||
: run.code === 0
|
||||
? "Done."
|
||||
: `The Claude CLI exited with code ${run.code}.`;
|
||||
const ok = json.alreadyInGoalState === true || (json.outcome !== "failed" && run.code === 0);
|
||||
const result: PluginCommandResult = { ok, operation, message };
|
||||
if (!ok && typeof json.failureCode === "string") result.failureCode = json.failureCode;
|
||||
if (!ok && isRecord(json.shownCommand) && typeof json.shownCommand.command === "string") {
|
||||
result.shownCommand = json.shownCommand.command;
|
||||
if (operation === "install" || operation === "update") {
|
||||
result.terminalCommand = `claude plugin ${command.argv.map(shellQuote).join(" ")}`;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// terminalCommand is pasted into a POSIX shell, and argv values are arbitrary
|
||||
// text: `&` would background, `*` glob and `$(x)` expand unless quoted.
|
||||
function shellQuote(arg: string): string {
|
||||
return /^[A-Za-z0-9@%+=:,./_-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", "'\\''")}'`;
|
||||
}
|
||||
|
||||
async function reloadSession(deps: PluginCommandDeps): Promise<PluginReload> {
|
||||
const query = deps.query();
|
||||
if (!query) return { status: "unavailable" };
|
||||
try {
|
||||
const response = await query.reloadPlugins({ refuseIfBusy: true });
|
||||
return { status: "applied", plugins: response.plugins.map((plugin) => plugin.name) };
|
||||
} catch (error) {
|
||||
if ((error as { errorCode?: unknown } | null)?.errorCode === "reload_plugins_busy") {
|
||||
return { status: "busy" };
|
||||
}
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
deps.logError(`Failed to reload plugins after /plugin: ${message}`);
|
||||
return { status: "failed", error: message };
|
||||
}
|
||||
}
|
||||
|
||||
/** Whether `plugin` (`name` or `name@marketplace`) is among the installed plugin ids. */
|
||||
function isInstalled(installed: unknown[], plugin: string): boolean {
|
||||
return installed.some((entry) => {
|
||||
const id = isRecord(entry) ? entry.id : undefined;
|
||||
if (typeof id !== "string") return false;
|
||||
return plugin.includes("@") ? id === plugin : id.split("@")[0] === plugin;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs a parsed `/plugin` command and, after a change, reloads the session's
|
||||
* plugins. A failure is in the result: this never throws.
|
||||
*/
|
||||
export async function runPluginCommand(
|
||||
command: PluginCommand,
|
||||
deps: PluginCommandDeps,
|
||||
): Promise<PluginCommandResult> {
|
||||
if (command.kind === "usage") {
|
||||
return {
|
||||
ok: false,
|
||||
operation: "usage",
|
||||
message: command.reason ?? "",
|
||||
};
|
||||
}
|
||||
const exec = deps.exec ?? defaultExec;
|
||||
const env = { ...deps.env };
|
||||
delete env.CLAUDECODE;
|
||||
delete env.CLAUDE_CODE_CHILD_SESSION;
|
||||
|
||||
if (command.kind === "overview") {
|
||||
const [plugins, marketplaces] = await Promise.all([
|
||||
runCli(deps, exec, env, ["list"], true),
|
||||
runCli(deps, exec, env, ["marketplace", "list"], true),
|
||||
]);
|
||||
if (plugins.type === "cancelled" || marketplaces.type === "cancelled") {
|
||||
return cancelled("overview");
|
||||
}
|
||||
const read = (run: CliRun): { value?: unknown; error?: string } => {
|
||||
if (run.type === "error") return { error: run.message };
|
||||
if (run.type === "done" && run.code === 0) {
|
||||
const value = wholeJson(run.stdout);
|
||||
return Array.isArray(value)
|
||||
? { value }
|
||||
: { error: "The Claude CLI did not return a list." };
|
||||
}
|
||||
const text = run.type === "done" ? plainText(run.stderr || run.stdout) : "";
|
||||
return {
|
||||
error: text || `The Claude CLI exited with code ${run.type === "done" ? run.code : "?"}.`,
|
||||
};
|
||||
};
|
||||
const listed = { plugins: read(plugins), marketplaces: read(marketplaces) };
|
||||
const errors = [listed.plugins.error, listed.marketplaces.error].filter((e) => e !== undefined);
|
||||
return {
|
||||
ok: errors.length === 0,
|
||||
operation: "overview",
|
||||
message: errors.join("\n"),
|
||||
data: {
|
||||
plugins: listed.plugins.value,
|
||||
marketplaces: listed.marketplaces.value,
|
||||
pluginsError: listed.plugins.error,
|
||||
marketplacesError: listed.marketplaces.error,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const { operation } = command;
|
||||
if (operation === "enable" && command.target !== undefined) {
|
||||
const listing = await runCli(deps, exec, env, ["list"], true);
|
||||
if (listing.type === "cancelled") return cancelled(operation);
|
||||
// When the list cannot be read (an old CLI), the enable runs as typed.
|
||||
const installed =
|
||||
listing.type === "done" && listing.code === 0 ? wholeJson(listing.stdout) : undefined;
|
||||
if (Array.isArray(installed) && !isInstalled(installed, command.target)) {
|
||||
return {
|
||||
ok: false,
|
||||
operation,
|
||||
message: `Plugin ${command.target} is not installed, so it can't be enabled. Install it first.`,
|
||||
failureCode: "not_installed",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const run = await runCli(deps, exec, env, command.argv, takesJson(command));
|
||||
if (run.type !== "done") return failedToRun(operation, run);
|
||||
const result = describeCliRun(command, run);
|
||||
if (result.ok && RELOADING_OPERATIONS.has(operation)) {
|
||||
if (deps.signal.aborted) return cancelled(operation);
|
||||
result.reload = await reloadSession(deps);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const USAGE_LINES = [
|
||||
"- `/plugin list [--available]`",
|
||||
"- `/plugin install <plugin>[@marketplace] [--scope user|project|local] [--marketplace <source>] [--config key=value]`",
|
||||
"- `/plugin uninstall <plugin> [--scope …] [--keep-data]`",
|
||||
"- `/plugin enable <plugin> [--scope …]`",
|
||||
"- `/plugin disable <plugin>|--all [--scope …]`",
|
||||
"- `/plugin update <plugin> [--scope …]`",
|
||||
"- `/plugin marketplace add <source> [--scope …] [--sparse <path>…]`",
|
||||
"- `/plugin marketplace list`",
|
||||
"- `/plugin marketplace remove <name> [--scope …]`",
|
||||
"- `/plugin marketplace update [<name>]`",
|
||||
];
|
||||
|
||||
function usageMarkdown(): string {
|
||||
return ["**Usage**", "", ...USAGE_LINES].join("\n");
|
||||
}
|
||||
|
||||
/** Escapes CLI or plugin text. A `claude plugin X` hint in backticks becomes
|
||||
* the `/plugin X` that works in this chat. */
|
||||
function renderCliText(text: string): string {
|
||||
return text
|
||||
.split(/\r?\n/)
|
||||
.filter((line) => line.trim() !== "")
|
||||
.map((line) =>
|
||||
line
|
||||
.split(/(`[^`\n]+`)/)
|
||||
.map((part, index) => {
|
||||
if (index % 2 === 0) return escapeMarkdown(part);
|
||||
const code = part.slice(1, -1).replace(/^claude plugins? /, "/plugin ");
|
||||
return codeSpan(code);
|
||||
})
|
||||
.join(""),
|
||||
)
|
||||
.join("\n\n");
|
||||
}
|
||||
|
||||
function str(value: unknown): string | undefined {
|
||||
return typeof value === "string" && value !== "" ? value : undefined;
|
||||
}
|
||||
|
||||
function installedLine(entry: unknown): string | undefined {
|
||||
if (!isRecord(entry)) return undefined;
|
||||
const id = str(entry.id);
|
||||
if (!id) return undefined;
|
||||
const details = [
|
||||
str(entry.version) && `v${str(entry.version)}`,
|
||||
str(entry.scope) && `${str(entry.scope)} scope`,
|
||||
entry.enabled === false ? "disabled" : "enabled",
|
||||
].filter((part): part is string => typeof part === "string");
|
||||
return `- ${codeSpan(id)} — ${escapeMarkdown(details.join(", "))}`;
|
||||
}
|
||||
|
||||
function availableLine(entry: unknown): string | undefined {
|
||||
if (!isRecord(entry)) return undefined;
|
||||
const id = str(entry.pluginId) ?? str(entry.name);
|
||||
if (!id) return undefined;
|
||||
const description = str(entry.description);
|
||||
return `- ${codeSpan(id)}${description ? ` — ${escapeMarkdown(description)}` : ""}`;
|
||||
}
|
||||
|
||||
function marketplaceLine(entry: unknown): string | undefined {
|
||||
if (!isRecord(entry)) return undefined;
|
||||
const name = str(entry.name);
|
||||
if (!name) return undefined;
|
||||
const source = str(entry.repo) ?? str(entry.url) ?? str(entry.path) ?? str(entry.source);
|
||||
return `- ${codeSpan(name)}${source ? ` — ${escapeMarkdown(source)}` : ""}`;
|
||||
}
|
||||
|
||||
/** The most available plugins that a reply lists. The official directory has hundreds. */
|
||||
const MAX_AVAILABLE_LISTED = 40;
|
||||
|
||||
function section(title: string, lines: (string | undefined)[], empty: string): string {
|
||||
const shown = lines.filter((line): line is string => line !== undefined);
|
||||
return shown.length === 0 ? `**${title}**\n\n${empty}` : `**${title}**\n\n${shown.join("\n")}`;
|
||||
}
|
||||
|
||||
function installedSection(data: unknown): string {
|
||||
return section(
|
||||
"Installed plugins",
|
||||
Array.isArray(data) ? data.map(installedLine) : [],
|
||||
"None. Run `/plugin install <plugin>` to add one.",
|
||||
);
|
||||
}
|
||||
|
||||
function marketplacesSection(data: unknown): string {
|
||||
return section(
|
||||
"Marketplaces",
|
||||
Array.isArray(data) ? data.map(marketplaceLine) : [],
|
||||
"None. Run `/plugin marketplace add <source>` to add one.",
|
||||
);
|
||||
}
|
||||
|
||||
function availableSection(entries: unknown[]): string {
|
||||
const lines = entries.map(availableLine).filter((line) => line !== undefined);
|
||||
const more = lines.length - MAX_AVAILABLE_LISTED;
|
||||
if (more > 0) lines.splice(MAX_AVAILABLE_LISTED, more, `- … and ${more} more`);
|
||||
return section("Available plugins", lines, "None.");
|
||||
}
|
||||
|
||||
function reloadLine(reload: PluginReload): string {
|
||||
if (reload.status === "applied") {
|
||||
const plugins = reload.plugins ?? [];
|
||||
return plugins.length === 0
|
||||
? "Reloaded: the session now has no plugins."
|
||||
: `Reloaded: the session now has ${plugins.map(codeSpan).join(", ")}.`;
|
||||
}
|
||||
if (reload.status === "busy") {
|
||||
return "The session is busy, so the change was not loaded into it. It applies to new sessions.";
|
||||
}
|
||||
if (reload.status === "failed") {
|
||||
return `Reloading the session's plugins failed${reload.error ? `: ${escapeMarkdown(reload.error)}` : ""}. The change applies to new sessions.`;
|
||||
}
|
||||
return "The change applies to new sessions.";
|
||||
}
|
||||
|
||||
/** The chat reply for a result of {@link runPluginCommand}. */
|
||||
export function pluginCommandMarkdown(result: PluginCommandResult): string {
|
||||
const blocks: string[] = [];
|
||||
const data = result.data;
|
||||
switch (result.operation) {
|
||||
case "usage":
|
||||
if (result.message) blocks.push(renderCliText(result.message));
|
||||
blocks.push(usageMarkdown());
|
||||
return blocks.join("\n\n");
|
||||
case "overview": {
|
||||
const parts = isRecord(data) ? data : {};
|
||||
const failure = (title: string, error: unknown): string =>
|
||||
`**${title}**\n\nCould not list: ${renderCliText(String(error))}`;
|
||||
return [
|
||||
typeof parts.pluginsError === "string"
|
||||
? failure("Installed plugins", parts.pluginsError)
|
||||
: installedSection(parts.plugins),
|
||||
typeof parts.marketplacesError === "string"
|
||||
? failure("Marketplaces", parts.marketplacesError)
|
||||
: marketplacesSection(parts.marketplaces),
|
||||
usageMarkdown(),
|
||||
].join("\n\n");
|
||||
}
|
||||
case "list":
|
||||
if (result.ok && isRecord(data)) {
|
||||
blocks.push(installedSection(data.installed));
|
||||
blocks.push(availableSection(Array.isArray(data.available) ? data.available : []));
|
||||
} else if (result.ok && data !== undefined) {
|
||||
blocks.push(installedSection(data));
|
||||
}
|
||||
break;
|
||||
case "marketplace-list":
|
||||
if (result.ok && data !== undefined) blocks.push(marketplacesSection(data));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (blocks.length === 0 && result.message) blocks.push(renderCliText(result.message));
|
||||
if (result.shownCommand !== undefined) {
|
||||
blocks.push(
|
||||
`The marketplace declares that this plugin is installed by running a command. The adapter does not run it:\n\n${codeSpan(result.shownCommand)}`,
|
||||
);
|
||||
if (result.terminalCommand) {
|
||||
blocks.push(
|
||||
`To confirm that command, run ${codeSpan(result.terminalCommand)} in a terminal.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (result.reload) blocks.push(reloadLine(result.reload));
|
||||
return blocks.join("\n\n");
|
||||
}
|
||||
@@ -4,7 +4,9 @@
|
||||
* `providers/disable`, and the legacy gateway logins (`authenticate` or
|
||||
* `auth/login` with `gateway` or `gateway-bedrock`). Each core holds its own
|
||||
* {@link ProviderConfig} and gateway login, and builds the query env of its
|
||||
* sessions with {@link createEnvForProvider}.
|
||||
* sessions with {@link createEnvForProvider}. It holds that route above the
|
||||
* user's and the project's settings with {@link providerRouteSettings} and
|
||||
* {@link applyProviderRoute}.
|
||||
*/
|
||||
import {
|
||||
RequestError,
|
||||
@@ -15,6 +17,7 @@ import {
|
||||
type ProviderInfo,
|
||||
type SetProviderRequest,
|
||||
} from "@agentclientprotocol/sdk/unstable";
|
||||
import type { Query } from "@anthropic-ai/claude-agent-sdk";
|
||||
import {
|
||||
GatewayListingError,
|
||||
listBedrockModels,
|
||||
@@ -187,6 +190,50 @@ export function createEnvForProvider(config: ProviderConfig | null): Record<stri
|
||||
};
|
||||
}
|
||||
|
||||
/** A provider's route as settings of Claude Code (see {@link providerRouteSettings}). */
|
||||
export type ProviderRouteSettings = { apiKeyHelper: ""; env: Record<string, string> };
|
||||
|
||||
/**
|
||||
* The route of a provider as settings of Claude Code, for the tier of the
|
||||
* `settings` option. `env` is the result of {@link createEnvForProvider}.
|
||||
*
|
||||
* Claude Code applies the `env` of settings files after the process env, so
|
||||
* without this tier the user's or the project's settings could restore another
|
||||
* `ANTHROPIC_BASE_URL`. The empty `apiKeyHelper` turns off a helper of theirs.
|
||||
*/
|
||||
export function providerRouteSettings(env: Record<string, string>): ProviderRouteSettings {
|
||||
return { apiKeyHelper: "", env };
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends `route` to the running session, into the tier of the `settings`
|
||||
* option (`applyFlagSettings`). Call it right after the query's initialize
|
||||
* response, before a request of the session reaches the provider:
|
||||
* `getContextUsage()` sends one (`count_tokens`).
|
||||
*
|
||||
* The `settings` option holds the route too, in one object with the client's
|
||||
* settings and the model configuration. Claude Code loads that object as a
|
||||
* whole or not at all: one value that fails validation, e.g.
|
||||
* `permissions.allow: "Bash"`, leaves all of it out. This call does not depend
|
||||
* on that object. When the object did load, the call changes nothing: Claude
|
||||
* Code merges `env` key by key.
|
||||
*
|
||||
* Throws when Claude Code refuses the route. The caller must close the query.
|
||||
*/
|
||||
export async function applyProviderRoute(
|
||||
query: Pick<Query, "applyFlagSettings">,
|
||||
route: ProviderRouteSettings,
|
||||
): Promise<void> {
|
||||
try {
|
||||
await query.applyFlagSettings(route);
|
||||
} catch (error) {
|
||||
throw RequestError.internalError(
|
||||
{ details: error instanceof Error ? error.message : String(error) },
|
||||
"The session was not started, because Claude Code did not take its provider or gateway route. Try again, or set the provider or the gateway login again.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function sameHeaders(a: Record<string, string>, b: Record<string, string>): boolean {
|
||||
const aKeys = Object.keys(a);
|
||||
return aKeys.length === Object.keys(b).length && aKeys.every((key) => b[key] === a[key]);
|
||||
@@ -253,13 +300,13 @@ export function validatedGatewayAuthRequest(params: AuthenticateRequest): Gatewa
|
||||
if (typeof gateway !== "object" || !isValidBaseUrl(gateway.baseUrl)) {
|
||||
throw RequestError.invalidParams(
|
||||
{ baseUrl: (gateway as { baseUrl?: unknown }).baseUrl },
|
||||
"`_meta.gateway.baseUrl` must be a non-empty absolute http(s) URL.",
|
||||
"_meta.gateway.baseUrl must be a non-empty absolute http(s) URL.",
|
||||
);
|
||||
}
|
||||
if (gateway.headers !== undefined && typeof gateway.headers !== "object") {
|
||||
throw RequestError.invalidParams(
|
||||
undefined,
|
||||
"`_meta.gateway.headers` must be an object of header names to values.",
|
||||
"_meta.gateway.headers must be an object of header names to values.",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -348,7 +395,7 @@ export function providerConfigFromSetRequest(params: SetProviderRequest): Provid
|
||||
) {
|
||||
throw RequestError.invalidParams(
|
||||
undefined,
|
||||
"vertex apiType requires non-empty `_meta.claudeCode.vertex.projectId` and `_meta.claudeCode.vertex.region`.",
|
||||
"vertex apiType requires non-empty _meta.claudeCode.vertex.projectId and _meta.claudeCode.vertex.region.",
|
||||
);
|
||||
}
|
||||
config.vertex = { projectId: vertex.projectId, region: vertex.region };
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/**
|
||||
* `/remote-control`, which the adapter serves itself, and the messages that a
|
||||
* `/remote-control`, which the adapter serves itself, Remote Control at the
|
||||
* start of a session when Claude Code asks for it, and the messages that a
|
||||
* person types in another client of the session (claude.ai or the Claude
|
||||
* mobile app, over Remote Control). Shared by the v1 core and the v2
|
||||
* core, which run the command each in their own turn model.
|
||||
@@ -9,10 +10,13 @@ type PromptContent = ReadonlyArray<{ type: string; text?: unknown }>;
|
||||
|
||||
import type {
|
||||
Query,
|
||||
SDKControlInitializeResponse,
|
||||
SDKUserMessage,
|
||||
SDKUserMessageReplay,
|
||||
SlashCommand,
|
||||
} from "@anthropic-ai/claude-agent-sdk";
|
||||
import type { Logger } from "./logger.js";
|
||||
import type { SessionNotice } from "./session-notices.js";
|
||||
|
||||
/** Runtime Remote Control control exposed by the pinned Agent SDK. Like
|
||||
* `mcpAuthenticate`, it is not in the public `Query` declaration yet. The CLI's
|
||||
@@ -115,6 +119,129 @@ export async function runRemoteControlCommand(
|
||||
}
|
||||
}
|
||||
|
||||
/** The `initialize` result with `remote_control_auto_enable`, which Claude Code
|
||||
* resolves from `remoteControlAtStartup` in the settings, else the policy
|
||||
* default, else a rollout, so it can be on although the user never turned it
|
||||
* on. An SDK host reads it to start Remote Control with the session as the
|
||||
* terminal does. Like `enableRemoteControl`, it is not in the public
|
||||
* declaration yet. */
|
||||
type RemoteControlInitializeResponse = SDKControlInitializeResponse & {
|
||||
remote_control_auto_enable?: boolean;
|
||||
};
|
||||
|
||||
/** Whether Claude Code asks for Remote Control to start with the session:
|
||||
* `remoteControlAtStartup` in the settings, else the policy default, else a
|
||||
* rollout (see `RemoteControlInitializeResponse`). `false` when the field is
|
||||
* missing, as from a CLI that predates it. */
|
||||
export function startsWithRemoteControl(
|
||||
initializationResult: SDKControlInitializeResponse,
|
||||
): boolean {
|
||||
return (
|
||||
(initializationResult as RemoteControlInitializeResponse).remote_control_auto_enable === true
|
||||
);
|
||||
}
|
||||
|
||||
/** Starts Remote Control for a session that starts with it, and returns the
|
||||
* notice that tells the user how it went. A notice cannot be withdrawn once
|
||||
* sent, so its title reports the connection as an event rather than a state
|
||||
* that `/remote-control off` would make untrue. A refusal, such as Remote
|
||||
* Control being disabled by policy, comes back as a warning instead of a
|
||||
* throw. */
|
||||
export async function startRemoteControl(
|
||||
query: RemoteControlQuery,
|
||||
logger: { error: (...args: unknown[]) => void },
|
||||
): Promise<SessionNotice> {
|
||||
try {
|
||||
const { session_url } = await query.enableRemoteControl(true);
|
||||
const link = session_url
|
||||
? `Continue this session from claude.ai/code or the Claude mobile app: ${session_url}`
|
||||
: "Claude Code did not return a session URL.";
|
||||
return {
|
||||
severity: "info",
|
||||
title: "Remote Control connected",
|
||||
description: `${link}\nRun /remote-control off to disconnect.`,
|
||||
};
|
||||
} catch (error) {
|
||||
logger.error(`Failed to enable Remote Control: ${error}`);
|
||||
return {
|
||||
severity: "warning",
|
||||
title: "Could not start Remote Control",
|
||||
description: error instanceof Error ? error.message : String(error),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/** What starting Remote Control with a query needs of the query's session. */
|
||||
export type RemoteControlAtStartupSession = {
|
||||
readonly sessionId: string;
|
||||
readonly logger: Logger;
|
||||
/** The session's query, or `undefined` when it has none to start Remote Control on. */
|
||||
query(): Query | undefined;
|
||||
/** Whether the session is busy in its core's sense, such as Claude working. */
|
||||
working(): boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Remote Control at the start of a query that Claude Code asked to start with
|
||||
* it (see {@link startsWithRemoteControl}). Each core keeps one per query and
|
||||
* connects it after the query's setup response and after a restart, whose new
|
||||
* query asks again: closing the old query ended its Remote Control. Unless the
|
||||
* user turned it off: a restart carries the user's last `/remote-control` into
|
||||
* the new query (see {@link restartedFrom}). A session that a failed restart
|
||||
* lost carries nothing: the client sets it up again, and that setup asks
|
||||
* afresh. Holding prompts back and sending the notice are each core's own, as
|
||||
* they follow the core's turn model.
|
||||
*/
|
||||
export class RemoteControlAtStartup {
|
||||
/** Whether the user's last `/remote-control` on this query turned it off. */
|
||||
private turnedOff = false;
|
||||
|
||||
constructor(private asked: boolean) {}
|
||||
|
||||
/**
|
||||
* The user ran `command` on this query. Recorded before its request goes
|
||||
* out, so a restart that overlaps the request already knows.
|
||||
*/
|
||||
commandRan(command: RemoteControlCommand): void {
|
||||
this.turnedOff = command.action === "disconnect";
|
||||
}
|
||||
|
||||
/**
|
||||
* A restart replaced the query of `previous` with this one. Remote Control
|
||||
* that the user turned off there stays off: this query asks again only
|
||||
* because the setting does, and the setting can come from a rollout the user
|
||||
* never chose.
|
||||
*/
|
||||
restartedFrom(previous: RemoteControlAtStartup | undefined): void {
|
||||
if (!previous?.turnedOff) return;
|
||||
this.turnedOff = true;
|
||||
this.asked = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts Remote Control on the first call, and resolves the notice that
|
||||
* tells the user how it went. When nothing starts, it returns `undefined`
|
||||
* rather than a promise, so a core can hold its prompts back in the same
|
||||
* synchronous step: Claude Code did not ask, the user turned it off before
|
||||
* a restart, an earlier call ran, the query is closed or has no Remote
|
||||
* Control, or the session is busy, as the notice would land inside that
|
||||
* work. `/remote-control` still connects the session then.
|
||||
*/
|
||||
connect(session: RemoteControlAtStartupSession): Promise<SessionNotice> | undefined {
|
||||
if (!this.asked) return undefined;
|
||||
this.asked = false;
|
||||
const query = session.query();
|
||||
if (!query || !supportsRemoteControl(query)) return undefined;
|
||||
if (session.working()) {
|
||||
session.logger.log(
|
||||
`Session ${session.sessionId} is busy, so Remote Control does not start with it. /remote-control starts it.`,
|
||||
);
|
||||
return undefined;
|
||||
}
|
||||
return startRemoteControl(query, session.logger);
|
||||
}
|
||||
}
|
||||
|
||||
/** A top-level message a person typed in another client of the session, such
|
||||
* as claude.ai or the Claude mobile app over Remote Control. Tool results and
|
||||
* the CLI's own synthetic messages are user-role too, but carry no human
|
||||
|
||||
@@ -51,7 +51,7 @@ export function serveAcp(
|
||||
/**
|
||||
* Routes a connection to the protocol version that the client negotiates in
|
||||
* `initialize`. With `auto`, a client that requests version 2 or later gets
|
||||
* the draft ACP v2, and every other client gets ACP v1. With `v1`, a v2
|
||||
* ACP v2, and every other client gets ACP v1. With `v1`, a v2
|
||||
* client is negotiated down to v1. With `v2`, the router rejects the
|
||||
* `initialize` of a v1 client as an unsupported protocol version. `onAgent`
|
||||
* receives the agent of a v1 connection (`ClaudeAcpAgent`) once the router
|
||||
|
||||
@@ -44,12 +44,25 @@ import {
|
||||
// personas, so we filter them out and only surface the Agent picker when the
|
||||
// user (or a plugin/project) has configured custom agents. Update this set if
|
||||
// the SDK's built-in roster changes.
|
||||
//
|
||||
// The set is matched by name because `AgentInfo` does not say where an agent
|
||||
// comes from. `getContextUsage().agents` lists only the agents that are not
|
||||
// built in, but session setup does not wait for that request (see
|
||||
// `readContextWindow`).
|
||||
//
|
||||
// Claude Code does not list two of them in every session: `web-fetch` only
|
||||
// where its staged rollout or `CLAUDE_CODE_WEB_FETCH_AGENT=1` turns it on, and
|
||||
// `claude-code-guide` only where the adapter's environment sets
|
||||
// `CLAUDE_CODE_ENTRYPOINT` (the SDK sets `sdk-ts` when it is unset, and Claude
|
||||
// Code leaves the agent out for that value).
|
||||
export const BUILTIN_AGENT_NAMES = new Set([
|
||||
"claude",
|
||||
"claude-code-guide",
|
||||
"general-purpose",
|
||||
"Explore",
|
||||
"Plan",
|
||||
"statusline-setup",
|
||||
"web-fetch",
|
||||
]);
|
||||
|
||||
// Value of the synthetic "Default" entry in the agent picker, which maps to the
|
||||
@@ -104,6 +117,9 @@ export type ConfigOptionPresentation = {
|
||||
/** Replace ambiguous `default` rows with concrete values and advertise the
|
||||
* SDK/adapter recommendation as `_meta.jetbrains.air.recommendedValue`. */
|
||||
useRecommendedValue: boolean;
|
||||
/** The client is AIR: each `model` option entry names its model's effort
|
||||
* levels at `_meta.jetbrains.air.reasoningEfforts`. */
|
||||
airClient?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -152,7 +168,12 @@ export function buildConfigOptions(
|
||||
// there is no model option at all.
|
||||
if (models.availableModels.length > 0) {
|
||||
options.push(
|
||||
buildModelConfigOption(models, modelInfos, presentation?.useRecommendedValue === true),
|
||||
buildModelConfigOption(
|
||||
models,
|
||||
modelInfos,
|
||||
presentation?.useRecommendedValue === true,
|
||||
presentation?.airClient === true,
|
||||
),
|
||||
);
|
||||
}
|
||||
const effort = buildEffortConfigOption(
|
||||
|
||||
@@ -21,16 +21,152 @@ import { isReplayHiddenMetaMessage, stripLocalCommandMetadata } from "./message-
|
||||
/** What the cursor ids start with. The rest is the uuid of the user message. */
|
||||
const BEFORE_MESSAGE = "before:";
|
||||
|
||||
/** The entity that a cursor is anchored to. */
|
||||
export type CursorEntity =
|
||||
| { type: "user_message" | "agent_message" | "agent_thought"; messageId: string }
|
||||
| { type: "tool_call"; toolCallId: string }
|
||||
| { type: "compaction"; compactionId: string };
|
||||
|
||||
/** The side of its {@link CursorEntity} that a cursor lies on. */
|
||||
export type CursorAnchor = CursorEntity & { position: "before" | "after" };
|
||||
|
||||
/** The `cursor_update` of the cursor before the user message `messageId`. */
|
||||
export function forkCursorUpdate(messageId: string) {
|
||||
return {
|
||||
...forkCursorBase(messageId),
|
||||
anchor: { type: "user_message" as const, messageId, position: "before" as const },
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The cursor before the user message `messageId` for a client that holds no
|
||||
* such user message: `anchor` places it (see {@link LastReportedEntity}), and the
|
||||
* `cursorId` stays that of the message.
|
||||
*/
|
||||
export function anchoredForkCursorUpdate(messageId: string, anchor: CursorAnchor) {
|
||||
return { ...forkCursorBase(messageId), anchor };
|
||||
}
|
||||
|
||||
/**
|
||||
* `update` with the `rewind` capability added: the cursor is also a position
|
||||
* that `_session/rewind` accepts. For a client that declared `sessionRewind`.
|
||||
*/
|
||||
export function withRewindCapability<U extends { capabilities: { fork: object } }>(
|
||||
update: U,
|
||||
): U & { capabilities: { fork: object; rewind: object } } {
|
||||
return { ...update, capabilities: { ...update.capabilities, rewind: {} } };
|
||||
}
|
||||
|
||||
/** The uuid of the user message that `cursorId` lies before, or undefined for an id that is no cursor. */
|
||||
export function cursorMessageId(cursorId: string): string | undefined {
|
||||
return cursorId.startsWith(BEFORE_MESSAGE) ? cursorId.slice(BEFORE_MESSAGE.length) : undefined;
|
||||
}
|
||||
|
||||
function forkCursorBase(messageId: string) {
|
||||
return {
|
||||
sessionUpdate: "cursor_update" as const,
|
||||
cursorId: `${BEFORE_MESSAGE}${messageId}`,
|
||||
capabilities: { fork: {} },
|
||||
anchor: { type: "user_message" as const, messageId, position: "before" as const },
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The last entity per session that a client can anchor a cursor to: an agent
|
||||
* message or thought with a `messageId`, a tool call, a compaction or a user
|
||||
* message with a `messageId`. v1 does not report a prompt that the client
|
||||
* sent, so its cursor lies `after` the entity before it. Each session update
|
||||
* that goes to the client passes through {@link sending}, a replay too.
|
||||
* Output of a subagent (a `parentToolUseId` in its `_meta`) is not on the
|
||||
* session's own timeline and is left out.
|
||||
*
|
||||
* It also records, for each cursor that the agent announces, the entity that
|
||||
* the client held right before that position ({@link recordCursor}). A rewind
|
||||
* to the cursor leaves the client with exactly that entity.
|
||||
*/
|
||||
export class LastReportedEntity {
|
||||
private readonly bySession = new Map<string, CursorEntity>();
|
||||
/** Per session, in announcement order: the entity before each announced cursor. */
|
||||
private readonly beforeCursor = new Map<string, Map<string, CursorEntity | undefined>>();
|
||||
|
||||
sending(notification: {
|
||||
sessionId: string;
|
||||
update: { sessionUpdate: string; _meta?: unknown } & Record<string, unknown>;
|
||||
}): void {
|
||||
const { sessionId, update } = notification;
|
||||
const meta = update._meta as { claudeCode?: { parentToolUseId?: unknown } } | null | undefined;
|
||||
if (meta?.claudeCode?.parentToolUseId) return;
|
||||
const messageId = typeof update.messageId === "string" ? update.messageId : undefined;
|
||||
switch (update.sessionUpdate) {
|
||||
case "user_message_chunk":
|
||||
if (messageId) this.bySession.set(sessionId, { type: "user_message", messageId });
|
||||
break;
|
||||
case "agent_message_chunk":
|
||||
if (messageId) this.bySession.set(sessionId, { type: "agent_message", messageId });
|
||||
break;
|
||||
case "agent_thought_chunk":
|
||||
if (messageId) this.bySession.set(sessionId, { type: "agent_thought", messageId });
|
||||
break;
|
||||
case "tool_call":
|
||||
if (typeof update.toolCallId === "string") {
|
||||
this.bySession.set(sessionId, { type: "tool_call", toolCallId: update.toolCallId });
|
||||
}
|
||||
break;
|
||||
case "compaction_update":
|
||||
if (typeof update.compactionId === "string") {
|
||||
this.bySession.set(sessionId, { type: "compaction", compactionId: update.compactionId });
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
/** The position after the last entity of the session, if the client holds one. */
|
||||
after(sessionId: string): CursorAnchor | undefined {
|
||||
const entity = this.bySession.get(sessionId);
|
||||
return entity && { ...entity, position: "after" };
|
||||
}
|
||||
|
||||
/** The last entity of the session that the client holds, if any. */
|
||||
last(sessionId: string): CursorEntity | undefined {
|
||||
return this.bySession.get(sessionId);
|
||||
}
|
||||
|
||||
/** The agent announces `cursorId`; `before` is the entity the client holds right before it. */
|
||||
recordCursor(sessionId: string, cursorId: string, before: CursorEntity | undefined): void {
|
||||
let records = this.beforeCursor.get(sessionId);
|
||||
if (!records) this.beforeCursor.set(sessionId, (records = new Map()));
|
||||
records.set(cursorId, before);
|
||||
}
|
||||
|
||||
/**
|
||||
* The session is rewound to `cursorId`: the client drops the entities from
|
||||
* there on, so the entity recorded for the cursor is its last one (none for
|
||||
* a cursor that has no record: the next prompt then gets no cursor). The
|
||||
* records of the cursors at and after the cut go too.
|
||||
*/
|
||||
rewind(sessionId: string, cursorId: string): void {
|
||||
const records = this.beforeCursor.get(sessionId);
|
||||
const before = records?.get(cursorId);
|
||||
if (before) this.bySession.set(sessionId, before);
|
||||
else this.bySession.delete(sessionId);
|
||||
if (!records?.has(cursorId)) return;
|
||||
let cut = false;
|
||||
for (const id of [...records.keys()]) {
|
||||
cut ||= id === cursorId;
|
||||
if (cut) records.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
/** The client no longer holds the session's entities: it closed, or a replay rebuilds them. */
|
||||
forget(sessionId: string): void {
|
||||
for (const map of [this.bySession, this.beforeCursor]) {
|
||||
for (const id of map.keys()) {
|
||||
if (id === sessionId || id.startsWith(`${sessionId}:`)) map.delete(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a prompt with this content gets a cursor when it is inserted live.
|
||||
* A slash command does not: Claude Code stores a command as command metadata
|
||||
@@ -52,8 +188,13 @@ export function promptGetsCursor(prompt: ReadonlyArray<{ type: string; text?: un
|
||||
*/
|
||||
export function hasForkCursor(messages: readonly SessionMessage[], index: number): boolean {
|
||||
const message = messages[index];
|
||||
if (!message || message.type !== "user" || !message.uuid) return false;
|
||||
if (!messages[index - 1]?.uuid) return false;
|
||||
if (!message || !messages[index - 1]?.uuid) return false;
|
||||
return isShownUserMessage(message);
|
||||
}
|
||||
|
||||
/** Whether a replay shows `message` as a user message of the session's own conversation. */
|
||||
function isShownUserMessage(message: SessionMessage): boolean {
|
||||
if (message.type !== "user" || !message.uuid) return false;
|
||||
if (message.parent_tool_use_id !== null) return false;
|
||||
if (isReplayHiddenMetaMessage(message) || isCompactSummaryMessage(message)) return false;
|
||||
// `null`: the message was command metadata alone, which a replay does not show.
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import type { SessionConfigOption } from "@agentclientprotocol/sdk/unstable";
|
||||
import type { EffortLevel, ModelInfo, Settings } from "@anthropic-ai/claude-agent-sdk";
|
||||
import { AIR_RECOMMENDED_CONFIG_VALUE_CAPABILITY, withAirMeta } from "./air-extension.js";
|
||||
import {
|
||||
AIR_REASONING_EFFORTS_KEY,
|
||||
AIR_RECOMMENDED_CONFIG_VALUE_CAPABILITY,
|
||||
withAirMeta,
|
||||
} from "./air-extension.js";
|
||||
import { EFFORT_CONFIG_ID } from "./session-config-ids.js";
|
||||
|
||||
export { EFFORT_CONFIG_ID } from "./session-config-ids.js";
|
||||
@@ -103,24 +107,51 @@ export function effortLevelName(level: string): string {
|
||||
.join(" ");
|
||||
}
|
||||
|
||||
/**
|
||||
* The effort levels of `model`, or `[]` when it has no effort support. They
|
||||
* are in Claude Code's order, which lists the levels from lowest to highest
|
||||
* ("low" to "max"), as ACP v2 asks of a `thought_level` select. Nothing here
|
||||
* sorts them.
|
||||
*/
|
||||
export function supportedEffortLevels(model: ModelInfo | undefined): string[] {
|
||||
return model?.supportsEffort ? [...(model.supportedEffortLevels ?? [])] : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* The effort that the adapter recommends of `levels`: "medium" when the model
|
||||
* offers it, else the first level. The SDK names no recommended effort.
|
||||
*/
|
||||
export function recommendedEffortLevel(levels: readonly string[]): string | undefined {
|
||||
return levels.includes("medium") ? "medium" : levels[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* The `_meta` of a `model` option entry for `model`: its effort levels and
|
||||
* the recommended one, at `_meta.jetbrains.air.reasoningEfforts`. They match
|
||||
* the effort option that {@link buildEffortConfigOption} builds for the
|
||||
* model, without its `default` row. Undefined for a model without effort
|
||||
* levels.
|
||||
*/
|
||||
export function modelReasoningEffortsMeta(
|
||||
model: ModelInfo | undefined,
|
||||
): Record<string, unknown> | undefined {
|
||||
const values = supportedEffortLevels(model);
|
||||
const recommended = recommendedEffortLevel(values);
|
||||
if (recommended === undefined) return undefined;
|
||||
return withAirMeta(undefined, AIR_REASONING_EFFORTS_KEY, { values, recommended });
|
||||
}
|
||||
|
||||
export function buildEffortConfigOption(
|
||||
modelInfos: ModelInfo[],
|
||||
currentModelId: string,
|
||||
currentEffortLevel: string | undefined,
|
||||
useRecommendedValue: boolean,
|
||||
): SessionConfigOption | undefined {
|
||||
const currentModelInfo = modelInfos.find((model) => model.value === currentModelId);
|
||||
// In Claude Code's order, which lists the levels from lowest to highest
|
||||
// ("low" to "max"), as ACP v2 asks of a `thought_level` select. Nothing
|
||||
// here sorts them.
|
||||
const supportedLevels = currentModelInfo?.supportsEffort
|
||||
? (currentModelInfo.supportedEffortLevels ?? [])
|
||||
: [];
|
||||
if (supportedLevels.length === 0) return undefined;
|
||||
|
||||
const recommendedEffort = (supportedLevels as string[]).includes("medium")
|
||||
? "medium"
|
||||
: supportedLevels[0];
|
||||
const supportedLevels = supportedEffortLevels(
|
||||
modelInfos.find((model) => model.value === currentModelId),
|
||||
);
|
||||
const recommendedEffort = recommendedEffortLevel(supportedLevels);
|
||||
if (recommendedEffort === undefined) return undefined;
|
||||
const options = [
|
||||
...(useRecommendedValue ? [] : [{ value: "default", name: "Default" }]),
|
||||
...supportedLevels.map((level) => ({
|
||||
@@ -129,7 +160,7 @@ export function buildEffortConfigOption(
|
||||
})),
|
||||
];
|
||||
const includes = (level: string) =>
|
||||
(!useRecommendedValue && level === "default") || (supportedLevels as string[]).includes(level);
|
||||
(!useRecommendedValue && level === "default") || supportedLevels.includes(level);
|
||||
const currentValue =
|
||||
currentEffortLevel && includes(currentEffortLevel)
|
||||
? currentEffortLevel
|
||||
|
||||
@@ -138,7 +138,7 @@ function archivedFilter(list: Record<string, unknown>): ArchivedFilter {
|
||||
if (!ARCHIVED_FILTERS.includes(value as ArchivedFilter)) {
|
||||
throw RequestError.invalidParams(
|
||||
{ archived: value },
|
||||
'`_meta.jetbrains.air.list.archived` must be "unarchived", "archived" or "all"',
|
||||
'_meta.jetbrains.air.list.archived must be "unarchived", "archived" or "all"',
|
||||
);
|
||||
}
|
||||
return value as ArchivedFilter;
|
||||
@@ -150,7 +150,7 @@ function optionalBoolean(list: Record<string, unknown>, key: string): boolean {
|
||||
if (typeof value !== "boolean") {
|
||||
throw RequestError.invalidParams(
|
||||
{ [key]: value },
|
||||
`\`_meta.jetbrains.air.list.${key}\` must be a boolean`,
|
||||
`_meta.jetbrains.air.list.${key} must be a boolean`,
|
||||
);
|
||||
}
|
||||
return value;
|
||||
@@ -165,7 +165,7 @@ export function parseListOptions(meta: unknown): ListOptions {
|
||||
if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 1) {
|
||||
throw RequestError.invalidParams(
|
||||
{ limit: raw },
|
||||
"`_meta.jetbrains.air.list.limit` must be an integer of at least 1",
|
||||
"_meta.jetbrains.air.list.limit must be an integer of at least 1",
|
||||
);
|
||||
}
|
||||
return {
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
} from "@anthropic-ai/claude-agent-sdk";
|
||||
import { AIR_RECOMMENDED_CONFIG_VALUE_CAPABILITY, withAirMeta } from "./air-extension.js";
|
||||
import { bedrockRegionPrefix } from "./gateway-models.js";
|
||||
import { modelReasoningEffortsMeta } from "./session-effort.js";
|
||||
|
||||
export const MODEL_CONFIG_ID = "model";
|
||||
|
||||
@@ -262,8 +263,17 @@ export function buildModelConfigOption(
|
||||
models: SessionModelState,
|
||||
modelInfos: ModelInfo[],
|
||||
useRecommendedValue: boolean,
|
||||
/** The client is AIR: each entry names its model's effort levels (see
|
||||
* {@link modelReasoningEffortsMeta}). A client that is not AIR gets no AIR key. */
|
||||
airClient = false,
|
||||
): SessionConfigOption {
|
||||
const defaultInfo = modelInfos.find((model) => model.value === "default");
|
||||
// The listed model that the `default` row runs, which names the row.
|
||||
const defaultTarget = defaultInfo?.resolvedModel
|
||||
? modelInfos.find(
|
||||
(info) => info.value !== "default" && info.resolvedModel === defaultInfo.resolvedModel,
|
||||
)
|
||||
: undefined;
|
||||
const selectableIds = new Set(models.availableModels.map((model) => model.modelId));
|
||||
const concreteInfos = modelInfos.filter(
|
||||
(model) => model.value !== "default" && selectableIds.has(model.value),
|
||||
@@ -287,25 +297,25 @@ export function buildModelConfigOption(
|
||||
concreteRecommendation && models.currentModelId === "default"
|
||||
? recommended.value
|
||||
: models.currentModelId;
|
||||
const options: Array<{ value: string; name: string; description?: string }> = available.map(
|
||||
(model) => {
|
||||
if (model.modelId === "default" && defaultInfo?.resolvedModel) {
|
||||
const named = modelInfos.find(
|
||||
(info) => info.value !== "default" && info.resolvedModel === defaultInfo.resolvedModel,
|
||||
);
|
||||
return {
|
||||
value: model.modelId,
|
||||
name: model.name,
|
||||
description: named?.displayName ?? defaultInfo.resolvedModel,
|
||||
};
|
||||
}
|
||||
const options: Array<{
|
||||
value: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
_meta?: Record<string, unknown>;
|
||||
}> = available.map((model) => {
|
||||
if (model.modelId === "default" && defaultInfo?.resolvedModel) {
|
||||
return {
|
||||
value: model.modelId,
|
||||
name: model.name,
|
||||
description: model.description ?? undefined,
|
||||
description: defaultTarget?.displayName ?? defaultInfo.resolvedModel,
|
||||
};
|
||||
},
|
||||
);
|
||||
}
|
||||
return {
|
||||
value: model.modelId,
|
||||
name: model.name,
|
||||
description: model.description ?? undefined,
|
||||
};
|
||||
});
|
||||
// ACP requires `currentValue` to be one of `options`. A session can run a
|
||||
// model the picker does not list: resumed onto a model excluded by the
|
||||
// `availableModels` allowlist, or switched by a refusal fallback. List that
|
||||
@@ -319,6 +329,18 @@ export function buildModelConfigOption(
|
||||
description: info?.description || undefined,
|
||||
});
|
||||
}
|
||||
if (airClient) {
|
||||
// The `default` row runs the model it resolves to; without one, it
|
||||
// names no efforts.
|
||||
for (const option of options) {
|
||||
const meta = modelReasoningEffortsMeta(
|
||||
option.value === "default"
|
||||
? defaultTarget
|
||||
: modelInfos.find((info) => info.value === option.value),
|
||||
);
|
||||
if (meta) option._meta = meta;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
id: MODEL_CONFIG_ID,
|
||||
|
||||
@@ -161,6 +161,44 @@ export function mcpServerStartupNotice(
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** A notice of {@link mcpServerStartupNotices} with the names of its servers. */
|
||||
export type McpServerStartupNotice = { servers: string[]; status: string; notice: SessionNotice };
|
||||
|
||||
/**
|
||||
* The notices of the client MCP servers that did not start, in the order of
|
||||
* `servers` (see {@link mcpServerStartupNotice}). Servers that failed with the
|
||||
* same `error` share one notice. Such are the servers that a managed
|
||||
* `disableSideloadFlags` keeps out of a session, and the `acp` servers of a
|
||||
* connection whose local endpoint cannot open.
|
||||
*/
|
||||
export function mcpServerStartupNotices(
|
||||
servers: Iterable<{ name: string; status: string; error?: string }>,
|
||||
oauthAvailable: boolean,
|
||||
): McpServerStartupNotice[] {
|
||||
const notices: McpServerStartupNotice[] = [];
|
||||
const byError = new Map<string, McpServerStartupNotice>();
|
||||
for (const server of servers) {
|
||||
const error = server.status === "failed" ? server.error : undefined;
|
||||
const shared = error === undefined ? undefined : byError.get(error);
|
||||
if (shared && error !== undefined) {
|
||||
shared.servers.push(server.name);
|
||||
const names = shared.servers.map((name) => `"${name}"`);
|
||||
shared.notice = {
|
||||
severity: "warning",
|
||||
title: `${names.length} MCP servers failed to start`,
|
||||
description: `The tools of ${names.slice(0, -1).join(", ")} and ${names.at(-1)} are unavailable in this session. ${error}`,
|
||||
};
|
||||
continue;
|
||||
}
|
||||
const notice = mcpServerStartupNotice(server, oauthAvailable);
|
||||
if (!notice) continue;
|
||||
const entry = { servers: [server.name], status: server.status, notice };
|
||||
notices.push(entry);
|
||||
if (error !== undefined) byError.set(error, entry);
|
||||
}
|
||||
return notices;
|
||||
}
|
||||
|
||||
/**
|
||||
* What Claude Code's `model_refusal_fallback` tells the user: the SDK retried
|
||||
* a refused turn on the fallback model.
|
||||
|
||||
595
src/session-rewind.ts
Normal file
595
src/session-rewind.ts
Normal file
@@ -0,0 +1,595 @@
|
||||
/**
|
||||
* `_session/rewind` (AIR -> agent): removes a user message and everything after
|
||||
* it from the context of the same Claude session, the one the client holds. A
|
||||
* fork would answer the same intent with a second session, so the edited
|
||||
* message would no longer run in the conversation that the user is looking at.
|
||||
*
|
||||
* The position is a session cursor (see `session-cursors.ts`): the one before
|
||||
* the user message to drop. The adapter resumes the stored conversation of the
|
||||
* session at the entry before that message (`resumeSessionAt`). Claude Code
|
||||
* deletes nothing: the dropped entries stay in the transcript as an orphan
|
||||
* branch, and `rewind.json` records the cut until the next prompt writes a
|
||||
* branch that descends from it.
|
||||
*
|
||||
* Every read of the stored history of a session cuts it at the point
|
||||
* (`cutAtRewindPoint`: replays, forks, v2's prompt keys), and every resume of
|
||||
* it stops there (`prepareRewoundResume`). The point is removed by the first
|
||||
* resume after the CLI stored a prompt on the rewound branch; until then the
|
||||
* file stays and cuts nothing, since the stored history no longer holds the
|
||||
* dropped prompt. v1 and v2 share this: both resume through
|
||||
* `prepareRewoundResume` and read through `cutAtRewindPoint`.
|
||||
*/
|
||||
import { RequestError } from "@agentclientprotocol/sdk/unstable";
|
||||
import {
|
||||
getSessionMessages,
|
||||
type SessionMessage,
|
||||
type SessionStoreEntry,
|
||||
} from "@anthropic-ai/claude-agent-sdk";
|
||||
import { randomBytes } from "node:crypto";
|
||||
import { appendFile, mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { isCompactSummaryMessage } from "./context-compaction.js";
|
||||
import { isReplayHiddenMetaMessage } from "./message-filters.js";
|
||||
import {
|
||||
findTranscript,
|
||||
loadFullSessionHistory,
|
||||
readHistoryAcrossCompactions,
|
||||
} from "./resumed-session.js";
|
||||
import { cursorMessageId, forkPointOf } from "./session-cursors.js";
|
||||
|
||||
export const SESSION_REWIND_METHOD = "_session/rewind";
|
||||
|
||||
export type SessionRewindRequest = {
|
||||
sessionId: string;
|
||||
/** A cursor that the session announced, before the user message to drop. */
|
||||
cursorId: string;
|
||||
};
|
||||
|
||||
/** Why the conversation was left as it was. */
|
||||
export type SessionRewindRefusal =
|
||||
/** Claude is working, or a prompt is queued. */
|
||||
| "busy"
|
||||
/** A background task or subagent is running. */
|
||||
| "backgroundWork"
|
||||
/** The message is before the newest compaction of the conversation. */
|
||||
| "beforeCompaction"
|
||||
/** The session's context was cleared into another Claude session. */
|
||||
| "clearedContext"
|
||||
/** Claude Code refused the cut. The session goes on as it was. */
|
||||
| "providerRefused"
|
||||
/** The rewind point could not be written. Nothing changed. */
|
||||
| "persistFailed";
|
||||
|
||||
export type SessionRewindResponse = {
|
||||
rewound: boolean;
|
||||
reason?: SessionRewindRefusal;
|
||||
};
|
||||
|
||||
export function parseSessionRewindRequest(params: unknown): SessionRewindRequest {
|
||||
if (!params || typeof params !== "object") {
|
||||
throw RequestError.invalidParams(undefined, "rewind params must be an object");
|
||||
}
|
||||
const { sessionId, cursorId } = params as Record<string, unknown>;
|
||||
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
||||
throw RequestError.invalidParams(undefined, "rewind params require a non-empty sessionId");
|
||||
}
|
||||
if (typeof cursorId !== "string" || cursorId.length === 0) {
|
||||
throw RequestError.invalidParams(undefined, "rewind params require a non-empty cursorId");
|
||||
}
|
||||
return { sessionId, cursorId };
|
||||
}
|
||||
|
||||
type Logger = { log: (...args: unknown[]) => void; error: (...args: unknown[]) => void };
|
||||
|
||||
/** The stored history of a session, as a replay shows it. */
|
||||
export type RewindableHistory = {
|
||||
/** Every message of the conversation the session continues, from its first
|
||||
* prompt on, across compactions. A rewind cursor is one of this list. */
|
||||
visible: readonly SessionMessage[];
|
||||
/** The part of `visible` that the newest compaction left: where Claude Code
|
||||
* can resume. */
|
||||
current: readonly SessionMessage[];
|
||||
};
|
||||
|
||||
/** What the rewind needs from the agent that holds the session. */
|
||||
export type SessionRewindHost = {
|
||||
logger: Logger;
|
||||
/** The context of the session was cleared into another Claude session. */
|
||||
clearedContext: boolean;
|
||||
/** Whether Claude works, or a prompt is queued: `startTurn`'s check. */
|
||||
claudeIsWorking(): boolean;
|
||||
/** Whether a background task or subagent runs. Closing the query ends it. */
|
||||
hasBackgroundWork(): boolean;
|
||||
loadHistory(): Promise<RewindableHistory>;
|
||||
/**
|
||||
* Closes the query and recreates the same session by resuming its
|
||||
* conversation, stopped at `resumeAt.resumeSessionAt` when it is set. Restores
|
||||
* the user's model, mode, agent, effort and Fast mode, and starts the reader.
|
||||
*/
|
||||
replaceQuery(resumeAt?: { resumeSessionAt: string; resumeDropsTurn?: string }): Promise<void>;
|
||||
/**
|
||||
* The session is rewound to `cursorId`. The next prompt's cursor anchors to
|
||||
* the entity that the client held before that cursor.
|
||||
*/
|
||||
rewound(cursorId: string): void;
|
||||
/** Deals with a session whose query is closed and could not be resumed,
|
||||
* and returns the error the rewind fails with. */
|
||||
abandon(error: unknown): Promise<unknown>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Drops the user message of `request.cursorId` and everything after it.
|
||||
*
|
||||
* `{ rewound: true }` means that the cut is live and recorded in `rewind.json`;
|
||||
* `{ rewound: false, reason }` means that the conversation and the rewind point
|
||||
* are unchanged. The transcript can still gain the `last-prompt` line that any
|
||||
* resume writes: `prepareRewoundResume` runs before the refusals that follow
|
||||
* it, and with a stale point that is not pending it also deletes `rewind.json`,
|
||||
* as any resume does. A cursor that the session's history does not hold is a
|
||||
* bad request (-32602): the rewind never acts at another position.
|
||||
*
|
||||
* The point is written before the query is replaced, and restored to what it
|
||||
* was when the cut does not happen. A crash between the write and the cut
|
||||
* leaves a point that the next resume applies. When the restore fails too, the
|
||||
* request fails with an internal error instead of `rewound: false`, since the
|
||||
* next resume applies a cut that was reported as not made.
|
||||
*/
|
||||
export async function rewindSession(
|
||||
request: SessionRewindRequest,
|
||||
host: SessionRewindHost,
|
||||
): Promise<SessionRewindResponse> {
|
||||
const { sessionId, cursorId } = request;
|
||||
const refuse = (reason: SessionRewindRefusal): SessionRewindResponse => {
|
||||
host.logger.log(`Rewind of session ${sessionId} refused: ${reason}`);
|
||||
return { rewound: false, reason };
|
||||
};
|
||||
// AIR stops the turn before it rewinds. Work still running here would be
|
||||
// killed with the query.
|
||||
const busy = (): SessionRewindResponse | undefined =>
|
||||
host.claudeIsWorking()
|
||||
? refuse("busy")
|
||||
: host.hasBackgroundWork()
|
||||
? refuse("backgroundWork")
|
||||
: undefined;
|
||||
const refusal = busy();
|
||||
if (refusal) return refusal;
|
||||
// The transcript of the session holds the conversation from before the
|
||||
// clear, which the cursor would be resolved against.
|
||||
if (host.clearedContext) return refuse("clearedContext");
|
||||
|
||||
const history = await host.loadHistory();
|
||||
const resumeSessionAt = forkPointOf(cursorId, history.visible);
|
||||
const droppedPromptUuid = cursorMessageId(cursorId);
|
||||
if (!resumeSessionAt || !droppedPromptUuid) {
|
||||
throw RequestError.invalidParams(
|
||||
{ cursorId },
|
||||
`Cursor ${cursorId} is not a rewind position of session ${sessionId}`,
|
||||
);
|
||||
}
|
||||
// Claude Code resumes a compacted conversation from its newest compaction on
|
||||
// and finds no entry before it ("No message found with message.uuid of ...").
|
||||
if (!history.current.some((message) => message.uuid === resumeSessionAt)) {
|
||||
return refuse("beforeCompaction");
|
||||
}
|
||||
// Before the query closes: marks the branch a second rewind resumes on.
|
||||
const earlierCut = await prepareRewoundResume(sessionId, host.logger);
|
||||
// Read after the preparation, which removes a point that is no longer pending.
|
||||
const previousPoint = await readRewindPoint(sessionId, host.logger);
|
||||
const dropped = history.visible.findIndex((message) => message.uuid === droppedPromptUuid);
|
||||
// `resumeDropsTurn` makes Claude Code refuse a cut that discards anything
|
||||
// the named turn does not account for, so it can guard only the last turn:
|
||||
// the turns after an earlier one are always in the discarded range.
|
||||
const dropsOneTurn = !history.visible.slice(dropped + 1).some(startsTurn);
|
||||
|
||||
try {
|
||||
await writeRewindPoint(sessionId, { resumeSessionAt, droppedPromptUuid });
|
||||
} catch (error) {
|
||||
host.logger.error(`Failed to record the rewind point of session ${sessionId}:`, error);
|
||||
return refuse("persistFailed");
|
||||
}
|
||||
// Puts `rewind.json` back, for a cut that does not happen. A failure leaves
|
||||
// the new point in place, which the next resume of the session applies.
|
||||
const restorePoint = async () => {
|
||||
try {
|
||||
if (previousPoint) await writeRewindPoint(sessionId, previousPoint);
|
||||
else await clearRewindPoint(sessionId);
|
||||
return true;
|
||||
} catch (error) {
|
||||
host.logger.error(
|
||||
`Failed to restore the rewind point of session ${sessionId}; the next resume applies the cut:`,
|
||||
error,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
const pointNotRemoved = () =>
|
||||
RequestError.internalError(
|
||||
undefined,
|
||||
`The rewind of session ${sessionId} did not happen, but its rewind point could not be removed. The next load of the session applies the cut.`,
|
||||
);
|
||||
// Claude Code can start a cycle on its own while the transcript is read,
|
||||
// prepared or the point is written. Nothing is awaited between this check
|
||||
// and `replaceQuery`, whose first statement closes the query synchronously.
|
||||
const lateRefusal = busy();
|
||||
if (lateRefusal) {
|
||||
if (!(await restorePoint())) throw pointNotRemoved();
|
||||
return lateRefusal;
|
||||
}
|
||||
|
||||
try {
|
||||
await host.replaceQuery({
|
||||
resumeSessionAt,
|
||||
...(dropsOneTurn ? { resumeDropsTurn: droppedPromptUuid } : {}),
|
||||
});
|
||||
} catch (error) {
|
||||
// Claude Code refuses a cut deterministically, so retrying fails again.
|
||||
// Recover once into the conversation as it was: the query of the session is
|
||||
// already closed, and a session the client cannot prompt is worse than one
|
||||
// that was not rewound.
|
||||
host.logger.log(
|
||||
`Rewind of session ${sessionId} ${isRewindRefusal(error) ? "was refused by Claude Code" : `failed: ${error}`}; resuming the conversation as it was`,
|
||||
);
|
||||
// Before the recovery resume, which reads `rewind.json` and would stop at
|
||||
// the new point. If the file cannot be restored, only the earlier cut is used.
|
||||
const restored = await restorePoint();
|
||||
try {
|
||||
const recoveredCut = restored
|
||||
? ((await prepareRewoundResume(sessionId, host.logger)) ?? earlierCut)
|
||||
: earlierCut;
|
||||
await host.replaceQuery(recoveredCut ? { resumeSessionAt: recoveredCut } : undefined);
|
||||
} catch (recoveryError) {
|
||||
throw await host.abandon(recoveryError);
|
||||
}
|
||||
// After the recovery, so the session can be prompted.
|
||||
if (!restored) throw pointNotRemoved();
|
||||
return { rewound: false, reason: "providerRefused" };
|
||||
}
|
||||
host.rewound(cursorId);
|
||||
return { rewound: true };
|
||||
}
|
||||
|
||||
/** Whether Claude Code refused the cut (see `resumeDropsTurn` of the SDK options). */
|
||||
export function isRewindRefusal(error: unknown): boolean {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
return message.includes("Resume rejected by --resume-drops-turn:");
|
||||
}
|
||||
|
||||
/** Whether a message opens a turn: a prompt of the user, not a tool result or injected context. */
|
||||
function startsTurn(message: SessionMessage): boolean {
|
||||
if (
|
||||
message.type !== "user" ||
|
||||
message.parent_tool_use_id !== null ||
|
||||
isReplayHiddenMetaMessage(message) ||
|
||||
isCompactSummaryMessage(message)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
const content = (message.message as { content?: unknown } | undefined)?.content;
|
||||
return !(
|
||||
Array.isArray(content) &&
|
||||
content.length > 0 &&
|
||||
content.every((block) => (block as { type?: unknown } | null)?.type === "tool_result")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The history of `sessionId` that a cursor of it is resolved against: the
|
||||
* conversation the session continues, cut at its rewind point.
|
||||
*/
|
||||
export async function loadRewindableHistory(
|
||||
sessionId: string,
|
||||
logger?: Logger,
|
||||
): Promise<RewindableHistory> {
|
||||
const current = await cutAtRewindPoint(sessionId, await getSessionMessages(sessionId), logger);
|
||||
return { current, visible: await readHistoryAcrossCompactions(sessionId, current, logger) };
|
||||
}
|
||||
|
||||
/**
|
||||
* `stored`, the `getSessionMessages` chain of `sessionId`, without the branch
|
||||
* that a pending rewind dropped. Cut before reading across compactions: the
|
||||
* newest leaf is the last retained message.
|
||||
*/
|
||||
export async function cutAtRewindPoint<M extends { uuid?: string | null }>(
|
||||
sessionId: string,
|
||||
stored: readonly M[],
|
||||
logger?: Logger,
|
||||
): Promise<M[]> {
|
||||
return activeSessionMessages(stored, await readRewindPoint(sessionId, logger));
|
||||
}
|
||||
|
||||
/**
|
||||
* The entry that a fork of the whole of `sessionId` ends at while a rewind is
|
||||
* pending, or undefined when there is none: the newest leaf then still lies in
|
||||
* the dropped branch.
|
||||
*/
|
||||
export async function pendingRewindEnd(
|
||||
sessionId: string,
|
||||
logger?: Logger,
|
||||
): Promise<string | undefined> {
|
||||
const point = await readRewindPoint(sessionId, logger);
|
||||
if (!point) return undefined;
|
||||
const stored = await getSessionMessages(sessionId);
|
||||
return stored.some((message) => message.uuid === point.droppedPromptUuid)
|
||||
? point.resumeSessionAt
|
||||
: undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* `entries`, the records of the whole transcript of `sessionId` with its
|
||||
* inactive branches, without the dropped prompt of a rewind and the records
|
||||
* that descend from it. A record comes after its parent in the transcript.
|
||||
*/
|
||||
export async function withoutRewoundBranch(
|
||||
sessionId: string,
|
||||
entries: SessionStoreEntry[],
|
||||
logger?: Logger,
|
||||
): Promise<SessionStoreEntry[]> {
|
||||
const point = await readRewindPoint(sessionId, logger);
|
||||
if (!point) return entries;
|
||||
const dropped = new Set<string>([point.droppedPromptUuid]);
|
||||
return entries.filter((entry) => {
|
||||
if (typeof entry.uuid !== "string") return true;
|
||||
const parent = entry.parentUuid || entry.logicalParentUuid;
|
||||
const inDropped =
|
||||
entry.uuid === point.droppedPromptUuid || (typeof parent === "string" && dropped.has(parent));
|
||||
if (inDropped) dropped.add(entry.uuid);
|
||||
return !inDropped;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The messages of the conversation that a session continues, given its stored
|
||||
* `history` and its `rewindPoint`. A rewind leaves the dropped branch in the
|
||||
* transcript, and until the next prompt writes a branch from the point,
|
||||
* `history` still ends in the dropped branch: it is cut before the dropped
|
||||
* prompt. Once a branch descends from the point, `history` no longer holds the
|
||||
* dropped prompt and is returned as it is.
|
||||
*/
|
||||
export function activeSessionMessages<M extends { uuid?: string | null }>(
|
||||
history: readonly M[],
|
||||
rewindPoint: RewindPoint | undefined,
|
||||
): M[] {
|
||||
const at = rewindPoint
|
||||
? history.findIndex((message) => message.uuid === rewindPoint.droppedPromptUuid)
|
||||
: -1;
|
||||
return at === -1 ? [...history] : history.slice(0, at);
|
||||
}
|
||||
|
||||
/** A rewind: the entry the session resumes at, and the prompt it dropped. */
|
||||
export type RewindPoint = {
|
||||
/** The last retained entry, for `resumeSessionAt`. */
|
||||
resumeSessionAt: string;
|
||||
/** The first entry of the dropped branch: the user prompt the rewind removed. */
|
||||
droppedPromptUuid: string;
|
||||
};
|
||||
|
||||
/** `<projectDir>/<sessionId>/rewind.json`, beside the session's `subagents/`. */
|
||||
async function rewindPointFile(sessionId: string): Promise<string | undefined> {
|
||||
const transcript = await findTranscript(sessionId);
|
||||
return transcript && path.join(path.dirname(transcript), sessionId, "rewind.json");
|
||||
}
|
||||
|
||||
/** Records the last rewind of a session. */
|
||||
export async function writeRewindPoint(sessionId: string, point: RewindPoint): Promise<void> {
|
||||
const target = await rewindPointFile(sessionId);
|
||||
if (!target) throw new Error(`Session ${sessionId} has no transcript`);
|
||||
await mkdir(path.dirname(target), { recursive: true, mode: 0o700 });
|
||||
const temporary = `${target}.tmp.${randomBytes(8).toString("hex")}`;
|
||||
try {
|
||||
await writeFile(temporary, JSON.stringify(point), { mode: 0o600, flag: "wx" });
|
||||
await rename(temporary, target);
|
||||
} catch (error) {
|
||||
await rm(temporary, { force: true });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The last rewind of a session, or undefined for one that has none (no
|
||||
* `rewind.json`, ENOENT). A record that cannot be read (EACCES, EISDIR) or
|
||||
* parsed fails with an internal error: reading it as "no rewind" would show or
|
||||
* resume the dropped turns. The file stays, so the client can retry.
|
||||
*/
|
||||
export async function readRewindPoint(
|
||||
sessionId: string,
|
||||
logger?: Logger,
|
||||
): Promise<RewindPoint | undefined> {
|
||||
try {
|
||||
const file = await rewindPointFile(sessionId);
|
||||
if (!file) return undefined;
|
||||
let point: Partial<RewindPoint>;
|
||||
try {
|
||||
point = JSON.parse(await readFile(file, "utf8"));
|
||||
} catch (error) {
|
||||
if ((error as { code?: unknown }).code === "ENOENT") return undefined;
|
||||
throw error;
|
||||
}
|
||||
const { resumeSessionAt, droppedPromptUuid } = point ?? {};
|
||||
if (typeof resumeSessionAt !== "string" || typeof droppedPromptUuid !== "string") {
|
||||
throw new Error("rewind.json holds no resumeSessionAt and droppedPromptUuid");
|
||||
}
|
||||
return { resumeSessionAt, droppedPromptUuid };
|
||||
} catch (error) {
|
||||
logger?.error(`Failed to read the rewind point of session ${sessionId}:`, error);
|
||||
throw RequestError.internalError(
|
||||
undefined,
|
||||
`Session ${sessionId} was rewound, but its rewind point cannot be read (${error instanceof Error ? error.message : String(error)}). Try again.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/** Removes the record of the last rewind. */
|
||||
export async function clearRewindPoint(sessionId: string): Promise<void> {
|
||||
const file = await rewindPointFile(sessionId);
|
||||
if (file) await rm(file, { force: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the transcript of `sessionId` for a resume, and returns the entry
|
||||
* that a pending rewind point makes the resume stop at, if any.
|
||||
*
|
||||
* Claude Code resumes the branch of the leaf that the last `last-prompt` line
|
||||
* of the transcript names, and looks up `resumeSessionAt` on that branch only.
|
||||
* A process that resumed at a rewind point keeps writing that line with the
|
||||
* leaf it loaded until it exits, and a query restart starts the next process
|
||||
* before the closed one has exited, so the line can name the branch that the
|
||||
* rewind dropped. A second rewind then fails with "No message found with
|
||||
* message.uuid of ...", and a plain resume brings the dropped turns back. So
|
||||
* the line is written for the leaf of the session's conversation: explicit at
|
||||
* a pending rewind point, whose dropped branch descends from it, and plain at
|
||||
* the newest entry otherwise. Once the point is no longer pending, the plain
|
||||
* line is all the next process needs, and `rewind.json` is removed.
|
||||
*/
|
||||
export async function prepareRewoundResume(
|
||||
sessionId: string,
|
||||
logger?: Logger,
|
||||
): Promise<string | undefined> {
|
||||
const point = await readRewindPoint(sessionId, logger);
|
||||
if (!point) return undefined;
|
||||
try {
|
||||
const history = await loadFullSessionHistory(sessionId);
|
||||
const byUuid = entriesByUuid(history);
|
||||
const newest = newestMainChainUuid(history);
|
||||
if (!newest) return undefined;
|
||||
const active = chainUuids(newest, byUuid);
|
||||
const pending = isPending(point, history, active);
|
||||
const leaf = pending ? point.resumeSessionAt : newest;
|
||||
await markResumedLeaf(sessionId, history, byUuid, leaf, pending);
|
||||
if (!pending) await clearRewindPoint(sessionId);
|
||||
return pending ? point.resumeSessionAt : undefined;
|
||||
} catch (error) {
|
||||
// A plain resume would bring the dropped turns back, so the resume fails
|
||||
// instead and the client can retry.
|
||||
logger?.error(`Failed to prepare the resume of rewound session ${sessionId}:`, error);
|
||||
throw RequestError.internalError(
|
||||
undefined,
|
||||
`Session ${sessionId} was rewound, but the cut could not be prepared (${error instanceof Error ? error.message : String(error)}). Try again.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the rewind is still to be applied: the dropped prompt is on the newest
|
||||
* conversation chain, or that chain does not pass through the point's resume
|
||||
* entry and holds nothing written after it (a branch from before the cut).
|
||||
* A chain through the resume entry without the dropped prompt is the edited
|
||||
* conversation, which a later entry of any other kind must not undo.
|
||||
*/
|
||||
function isPending(
|
||||
point: RewindPoint,
|
||||
history: SessionStoreEntry[],
|
||||
active: ReadonlySet<string>,
|
||||
): boolean {
|
||||
const pointIndex = history.findIndex((entry) => entry.uuid === point.resumeSessionAt);
|
||||
if (pointIndex < 0) return false;
|
||||
if (active.has(point.droppedPromptUuid)) return true;
|
||||
if (active.has(point.resumeSessionAt)) return false;
|
||||
return !history.some((entry, index) => index > pointIndex && active.has(entry.uuid as string));
|
||||
}
|
||||
|
||||
async function markResumedLeaf(
|
||||
sessionId: string,
|
||||
history: SessionStoreEntry[],
|
||||
byUuid: Map<string, SessionStoreEntry>,
|
||||
leaf: string,
|
||||
explicit: boolean,
|
||||
): Promise<void> {
|
||||
const transcript = await findTranscript(sessionId);
|
||||
if (!transcript) return;
|
||||
const lines = (await readFile(transcript, "utf8")).split("\n");
|
||||
for (let index = lines.length - 1; index >= 0; index--) {
|
||||
const line = lines[index]!;
|
||||
if (!line.includes('"last-prompt"')) continue;
|
||||
try {
|
||||
const record = JSON.parse(line);
|
||||
if (record.type !== "last-prompt") continue;
|
||||
if (record.leafUuid === leaf && (record.explicit === true) === explicit) return;
|
||||
break;
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
const branch = chainUuids(leaf, byUuid);
|
||||
const lastPrompt = history
|
||||
.filter((entry) => branch.has(entry.uuid as string) && entry.type === "user")
|
||||
.map(promptText)
|
||||
.findLast((text) => text !== undefined);
|
||||
const record = {
|
||||
type: "last-prompt",
|
||||
...(lastPrompt !== undefined ? { lastPrompt } : {}),
|
||||
leafUuid: leaf,
|
||||
...(explicit ? { explicit: true } : {}),
|
||||
sessionId,
|
||||
};
|
||||
const separator = lines.at(-1) === "" ? "" : "\n";
|
||||
await appendFile(transcript, `${separator}${JSON.stringify(record)}\n`);
|
||||
}
|
||||
|
||||
/** The text of a user entry that carries a prompt, undefined for any other. */
|
||||
function promptText(entry: SessionStoreEntry): string | undefined {
|
||||
if (entry.isMeta === true || isCompactSummaryMessage(entry)) return undefined;
|
||||
const content = (entry.message as { content?: unknown } | undefined)?.content;
|
||||
if (typeof content === "string") return content;
|
||||
if (!Array.isArray(content)) return undefined;
|
||||
if (content.some((block) => (block as { type?: unknown } | null)?.type === "tool_result")) {
|
||||
return undefined;
|
||||
}
|
||||
const text = content
|
||||
.map((block) => block as { type?: unknown; text?: unknown } | null)
|
||||
.flatMap((block) =>
|
||||
block?.type === "text" && typeof block.text === "string" ? [block.text] : [],
|
||||
)
|
||||
.join("");
|
||||
return text.length > 0 ? text : undefined;
|
||||
}
|
||||
|
||||
/** An entry of the main conversation: not a subagent's, and not the transcript of a tool. */
|
||||
function isMainChainEntry(entry: SessionStoreEntry): boolean {
|
||||
return (
|
||||
entry.isSidechain !== true && entry.parent_tool_use_id == null && entry.parent_agent_id == null
|
||||
);
|
||||
}
|
||||
|
||||
/** The entry types that the SDK reads as the conversation's chain; other records
|
||||
* (titles, tags, summaries) are metadata even when they carry a `uuid`. */
|
||||
const CHAIN_ENTRY_TYPES: ReadonlySet<unknown> = new Set([
|
||||
"user",
|
||||
"assistant",
|
||||
"system",
|
||||
"attachment",
|
||||
]);
|
||||
|
||||
/** The uuid of the newest entry of the main conversation: the leaf that
|
||||
* `getSessionMessages` reads. Like it, skips `progress` entries. */
|
||||
function newestMainChainUuid(entries: SessionStoreEntry[]): string | undefined {
|
||||
return entries.findLast(
|
||||
(entry) =>
|
||||
typeof entry.uuid === "string" &&
|
||||
CHAIN_ENTRY_TYPES.has(entry.type) &&
|
||||
isMainChainEntry(entry),
|
||||
)?.uuid;
|
||||
}
|
||||
|
||||
/** The uuids of `leaf` and of every entry it descends from. A compaction
|
||||
* boundary has no `parentUuid`; its `logicalParentUuid` carries the chain on. */
|
||||
function chainUuids(
|
||||
leaf: string | undefined,
|
||||
byUuid: ReadonlyMap<string, SessionStoreEntry>,
|
||||
): Set<string> {
|
||||
const chain = new Set<string>();
|
||||
let cursor = leaf;
|
||||
while (cursor && !chain.has(cursor)) {
|
||||
const entry = byUuid.get(cursor);
|
||||
if (!entry) break;
|
||||
chain.add(cursor);
|
||||
const parent = entry.parentUuid || entry.logicalParentUuid;
|
||||
cursor = typeof parent === "string" ? parent : undefined;
|
||||
}
|
||||
return chain;
|
||||
}
|
||||
|
||||
function entriesByUuid(entries: SessionStoreEntry[]): Map<string, SessionStoreEntry> {
|
||||
return new Map(
|
||||
entries.flatMap((entry) => (typeof entry.uuid === "string" ? [[entry.uuid, entry]] : [])),
|
||||
);
|
||||
}
|
||||
@@ -4,13 +4,9 @@
|
||||
*/
|
||||
import type { AvailableCommand } from "@agentclientprotocol/sdk/unstable";
|
||||
import type { Query, SlashCommand } from "@anthropic-ai/claude-agent-sdk";
|
||||
import { adapterAvailableCommands } from "./adapter-command.js";
|
||||
import { AIR_KIND_KEY, AIR_SKILL_PATH_KEY, withAirMeta } from "./air-extension.js";
|
||||
import { MCP_AVAILABLE_COMMAND } from "./mcp-command.js";
|
||||
import {
|
||||
claudeCodeOffersCommand,
|
||||
REMOTE_CONTROL_COMMAND_NAME,
|
||||
supportsRemoteControl,
|
||||
} from "./remote-control.js";
|
||||
import { resolveSkillPath, type SkillScanCache } from "./tool-calls/reporters/interaction.js";
|
||||
|
||||
export function getAvailableSlashCommands(
|
||||
@@ -29,6 +25,8 @@ export function getAvailableSlashCommands(
|
||||
// A listed skill gets its path from here; one that is not listed, or has no
|
||||
// path (remote connections), is looked up on disk.
|
||||
skillFiles?: ReadonlyMap<string, { path?: string }>,
|
||||
// A session that runs Claude Code remotely (`sdk-url`): the adapter cannot serve `/plugin` for it.
|
||||
remoteSession = false,
|
||||
): AvailableCommand[] {
|
||||
// The container listings of this one pass, so a list of a hundred commands lists each container once.
|
||||
const skillScans: SkillScanCache = new Map();
|
||||
@@ -51,18 +49,6 @@ export function getAvailableSlashCommands(
|
||||
"todos",
|
||||
];
|
||||
|
||||
const remoteControlCommands: AvailableCommand[] =
|
||||
query && supportsRemoteControl(query)
|
||||
? [
|
||||
{
|
||||
name: REMOTE_CONTROL_COMMAND_NAME,
|
||||
description:
|
||||
"Continue this session from claude.ai/code or the Claude mobile app; `off` disconnects",
|
||||
input: { hint: "[session name | off]" },
|
||||
},
|
||||
]
|
||||
: [];
|
||||
|
||||
// The adapter replaces the terminal text of `/mcp` and runs its actions,
|
||||
// even when Claude Code tags the command terminal-bound.
|
||||
const advertised = commands
|
||||
@@ -113,9 +99,7 @@ export function getAvailableSlashCommands(
|
||||
return [
|
||||
...advertised,
|
||||
MCP_AVAILABLE_COMMAND,
|
||||
...remoteControlCommands.filter(
|
||||
(command) => !claudeCodeOffersCommand(commands, terminalCommands, command.name),
|
||||
),
|
||||
...adapterAvailableCommands(commands, terminalCommands, query, { remoteSession }),
|
||||
].filter((command) => {
|
||||
if (/\s/.test(command.name) || names.has(command.name)) return false;
|
||||
names.add(command.name);
|
||||
|
||||
@@ -40,3 +40,11 @@ export function startupFailureError(error: unknown): RequestError | undefined {
|
||||
}
|
||||
return RequestError.internalError(data, message);
|
||||
}
|
||||
|
||||
/** The reason that {@link startupFailureError} put into `error`, if it made `error`. */
|
||||
export function startupFailureReasonOf(error: unknown): string | undefined {
|
||||
if (!(error instanceof RequestError)) return undefined;
|
||||
const reason = (error.data as { startupFailureReason?: unknown } | undefined)
|
||||
?.startupFailureReason;
|
||||
return typeof reason === "string" ? reason : undefined;
|
||||
}
|
||||
|
||||
4
src/steering-priority.ts
Normal file
4
src/steering-priority.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
/** An open permission or elicitation must settle before Claude Code takes in a steer. */
|
||||
export function steeringPriority(hasOpenRequests: boolean): "later" | "now" {
|
||||
return hasOpenRequests ? "later" : "now";
|
||||
}
|
||||
@@ -25,11 +25,12 @@
|
||||
* replayed child by its agent id carries the RFD's `session` reference to it
|
||||
* (`ReplayTranscript.withTarget`).
|
||||
*
|
||||
* Right after its announcement, each child gets its `model` option: the model
|
||||
* of its first response, in its transcript. A later response with another
|
||||
* model sends it again. A child without responses gets none. After the load
|
||||
* response, a model goes again only when the session's model list, which the
|
||||
* replay can lack, maps it to another entry.
|
||||
* The replay sends no `config_option_update` of a child: one that arrives
|
||||
* before the load response is a past value to the client. Each child's
|
||||
* configuration goes out after the response, with its current state
|
||||
* (`currentStates`): the configuration of a child that still runs in this
|
||||
* process, else the `model` option with the model of the latest response in
|
||||
* its transcript. A child that neither runs nor has a response gets none.
|
||||
*
|
||||
* A launch without metadata has no known id, so it is not announced: the RFD
|
||||
* forbids inventing one. Its Agent call stays an ordinary tool call of the
|
||||
@@ -46,7 +47,6 @@ import {
|
||||
isNativeSubagentControlTool,
|
||||
launchReply,
|
||||
linkedSessionMessages,
|
||||
type ModelEntry,
|
||||
nativeSubagentState,
|
||||
responseModelEntry,
|
||||
rfdEndState,
|
||||
@@ -83,8 +83,6 @@ export type ReplayChild = {
|
||||
promptSent: boolean;
|
||||
/** Whether it handed a report to its parent with a SubagentHandback call. */
|
||||
handedBack?: boolean;
|
||||
/** The `model` option entry that the replay sent. */
|
||||
model?: ModelEntry;
|
||||
/** The model id of the latest response in its transcript. */
|
||||
responseModel?: string;
|
||||
};
|
||||
@@ -102,15 +100,19 @@ export type SendMessageCall = {
|
||||
outgoingSent: boolean;
|
||||
};
|
||||
|
||||
/** A SubagentHandback call: its report, whether its result failed, and whether the replay sent it. */
|
||||
type ReplayHandback = { message: string; failed: boolean; sent: boolean };
|
||||
/** A SubagentHandback call, its result, and whether the replay sent its report. */
|
||||
type ReplayHandback = {
|
||||
message: string;
|
||||
status: "pending" | "completed" | "failed";
|
||||
sent: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* What both replays read from the transcripts before they send anything: the
|
||||
* What the v1 and v2 replays read from the transcripts before they send anything: the
|
||||
* children that launches with metadata started, the launches without metadata
|
||||
* (left out), the SendMessage calls, and the SubagentHandback calls. It sends
|
||||
* nothing; `RfdSubagentReplay` (v1) and `src/v2/subagent-replay.ts` send the
|
||||
* replay from it.
|
||||
* nothing. The v1 AIR replay, `RfdSubagentReplay`, and the v2 replay send
|
||||
* their updates from it.
|
||||
*/
|
||||
export class ReplayTranscript<Child extends ReplayChild = ReplayChild> {
|
||||
/** The children by the id of the tool use that launched each. */
|
||||
@@ -120,7 +122,7 @@ export class ReplayTranscript<Child extends ReplayChild = ReplayChild> {
|
||||
/** Launches without metadata, which the replay leaves out. */
|
||||
readonly omitted = new Set<string>();
|
||||
/** The SubagentHandback calls, by tool use id. */
|
||||
readonly handbacks = new Map<string, ReplayHandback>();
|
||||
private readonly handbacks = new Map<string, ReplayHandback>();
|
||||
/** The agent that each TaskStop or SendMessage call names (see `targetAgentId`), by tool use id. */
|
||||
private readonly targets = new Map<string, string>();
|
||||
|
||||
@@ -158,7 +160,7 @@ export class ReplayTranscript<Child extends ReplayChild = ReplayChild> {
|
||||
this.registerLaunch(block.id, inputOf(block), ownerSessionId);
|
||||
} else if (block.name === HANDBACK_TOOL) {
|
||||
const message = handbackMessage(block.input);
|
||||
if (message) this.handbacks.set(block.id, { message, failed: false, sent: false });
|
||||
if (message) this.handbacks.set(block.id, { message, status: "pending", sent: false });
|
||||
} else if (block.name === "SendMessage") {
|
||||
const input = inputOf(block);
|
||||
if (typeof input.to === "string" && typeof input.message === "string") {
|
||||
@@ -174,7 +176,7 @@ export class ReplayTranscript<Child extends ReplayChild = ReplayChild> {
|
||||
}
|
||||
} else if (block.type === "tool_result" && typeof block.tool_use_id === "string") {
|
||||
const handback = this.handbacks.get(block.tool_use_id);
|
||||
if (handback && block.is_error === true) handback.failed = true;
|
||||
if (handback) handback.status = block.is_error === true ? "failed" : "completed";
|
||||
const child = this.children.get(block.tool_use_id);
|
||||
// A background launch answers at once; its result is not the end.
|
||||
if (child && !child.record.background) {
|
||||
@@ -185,6 +187,25 @@ export class ReplayTranscript<Child extends ReplayChild = ReplayChild> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The report of a completed hand-back, once. `null` hides its other updates
|
||||
* and unfinished calls. `undefined` leaves failed calls and other updates visible.
|
||||
*/
|
||||
handbackUpdate(
|
||||
update: AcpSessionNotification["update"],
|
||||
): { messageId: string; text: string } | null | undefined {
|
||||
if (update.sessionUpdate !== "tool_call" && update.sessionUpdate !== "tool_call_update") {
|
||||
return undefined;
|
||||
}
|
||||
const handback = this.handbacks.get(update.toolCallId);
|
||||
if (!handback || handback.status === "failed") return undefined;
|
||||
if (handback.status !== "completed" || update.status !== "completed" || handback.sent) {
|
||||
return null;
|
||||
}
|
||||
handback.sent = true;
|
||||
return { messageId: update.toolCallId, text: handback.message };
|
||||
}
|
||||
|
||||
private registerLaunch(
|
||||
toolUseId: string,
|
||||
input: Record<string, unknown>,
|
||||
@@ -219,13 +240,12 @@ export class RfdSubagentReplay {
|
||||
constructor(
|
||||
private readonly history: SubagentHistory,
|
||||
private readonly publish: Publish,
|
||||
private readonly models?: SubagentModels,
|
||||
/**
|
||||
* Whether the replay maps a model to the session's model list as it goes.
|
||||
* A load lacks the list until the CLI started, so it maps only in
|
||||
* {@link currentStates}, after the load response.
|
||||
* The session's model list, which {@link currentStates} maps each child's
|
||||
* model to. A load can lack the list until the CLI started, so it is read
|
||||
* after the load response.
|
||||
*/
|
||||
private readonly mapsDuringReplay = true,
|
||||
private readonly models?: SubagentModels,
|
||||
/** The working directory of the root session, which a child inherits unless it reports its own. */
|
||||
private readonly rootCwd?: string,
|
||||
) {
|
||||
@@ -253,10 +273,8 @@ export class RfdSubagentReplay {
|
||||
/**
|
||||
* Announces `child` on its parent, as live: running, with the parent's
|
||||
* labels, and with its recorded `cwd` when that differs from its parent's.
|
||||
* Then it sends `firstModel`, the model of the child's first response, when
|
||||
* the transcript has one.
|
||||
*/
|
||||
async announce(child: ReplayChild, firstModel?: string): Promise<void> {
|
||||
async announce(child: ReplayChild): Promise<void> {
|
||||
if (child.announced) return;
|
||||
const labels = rfdLabels(
|
||||
child.record.name ?? child.input.name,
|
||||
@@ -282,7 +300,6 @@ export class RfdSubagentReplay {
|
||||
});
|
||||
child.cwd = cwd;
|
||||
child.announced = true;
|
||||
await this.responseModel(child, firstModel);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,27 +317,9 @@ export class RfdSubagentReplay {
|
||||
return this.rootCwd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes the model of a replayed response of the child `owner`. A child
|
||||
* whose model changes gets its `model` option again.
|
||||
*/
|
||||
async responseModel(owner: ReplayChild, model: string | undefined): Promise<void> {
|
||||
const entry = responseModelEntry(model, this.mapsDuringReplay ? this.models : undefined);
|
||||
if (!entry || !owner.announced) return;
|
||||
owner.responseModel = model;
|
||||
await this.sendModel(owner, entry);
|
||||
}
|
||||
|
||||
private async sendModel(child: ReplayChild, model: ModelEntry): Promise<void> {
|
||||
if (child.model?.value === model.value && child.model.name === model.name) return;
|
||||
child.model = model;
|
||||
await this.publish({
|
||||
sessionId: child.sessionId,
|
||||
update: {
|
||||
sessionUpdate: "config_option_update",
|
||||
configOptions: [childModelOption(model)],
|
||||
},
|
||||
});
|
||||
/** Takes the model of a replayed response of the child `owner` (see {@link trackResponseModel}). */
|
||||
responseModel(owner: ReplayChild, model: string | undefined): void {
|
||||
trackResponseModel(owner, model);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -367,8 +366,8 @@ export class RfdSubagentReplay {
|
||||
* Takes a replayed update of a tool call, from the transcript of `owner`
|
||||
* when it is a child's. Returns whether the client is not shown it: an
|
||||
* update of the launch of a child that the replay shows, of a SendMessage
|
||||
* call whose message the replay already delivered, or of a successful
|
||||
* SubagentHandback call of `owner`. A foreground launch's completed result
|
||||
* call whose message the replay already delivered, or of a pending or
|
||||
* successful SubagentHandback call of `owner`. A foreground launch's completed result
|
||||
* goes out as the child's reply, a delivered SendMessage as the sender's
|
||||
* outgoing message, and a hand-back as the child's message to its parent.
|
||||
*/
|
||||
@@ -399,16 +398,15 @@ export class RfdSubagentReplay {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
const handback = owner ? this.transcript.handbacks.get(update.toolCallId) : undefined;
|
||||
if (owner && handback && !handback.failed) {
|
||||
if (!handback.sent) {
|
||||
handback.sent = true;
|
||||
const handback = owner ? this.transcript.handbackUpdate(update) : undefined;
|
||||
if (owner && handback !== undefined) {
|
||||
if (handback !== null) {
|
||||
owner.handedBack = true;
|
||||
for (const view of linkedSessionMessages(
|
||||
update.toolCallId,
|
||||
owner.sessionId,
|
||||
owner.parentSessionId,
|
||||
handback.message,
|
||||
handback.text,
|
||||
)) {
|
||||
await this.publish(view);
|
||||
}
|
||||
@@ -462,11 +460,16 @@ export class RfdSubagentReplay {
|
||||
}
|
||||
}
|
||||
|
||||
/** Whether the replay announced the child session `sessionId`. */
|
||||
announced(sessionId: string): boolean {
|
||||
return this.transcript.byAgentId.get(sessionId)?.announced === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The current state of each announced child, to send after the load
|
||||
* response. The RFD makes that response the freshness boundary: a client
|
||||
* treats the replayed states before it as history, so they show no current
|
||||
* activity and allow no cancel.
|
||||
* The current state and configuration of each announced child, to send
|
||||
* after the load response. The RFD makes that response the freshness
|
||||
* boundary: a client treats the replayed states before it as history, so
|
||||
* they show no current activity and allow no cancel.
|
||||
*
|
||||
* `live` gives the work state of a child that still runs in this process, as
|
||||
* when a live session is loaded again. Such a child reports that state and
|
||||
@@ -476,6 +479,10 @@ export class RfdSubagentReplay {
|
||||
* A replayed `cwd` whose directory is gone, such as a worktree that Claude
|
||||
* Code removed when the child finished, is cleared with `cwd: null`, as the
|
||||
* RFD requires after a reconnection.
|
||||
*
|
||||
* Each child's configuration follows its state (see
|
||||
* {@link currentChildConfiguration}). `liveConfiguration` gives the one
|
||||
* that the client last got for a child that still runs in this process.
|
||||
*/
|
||||
currentStates(
|
||||
live: (sessionId: string) => WorkState["state"] | undefined,
|
||||
@@ -489,13 +496,11 @@ export class RfdSubagentReplay {
|
||||
liveState === undefined || liveState === "idle"
|
||||
? replayEndState(child)
|
||||
: { state: liveState };
|
||||
// The session's model list may be known only now, after the load response.
|
||||
const entry = responseModelEntry(child.responseModel, this.models);
|
||||
const replayed = child.model ? JSON.stringify([childModelOption(child.model)]) : undefined;
|
||||
const current =
|
||||
liveConfiguration?.(child.sessionId) ?? (entry ? [childModelOption(entry)] : undefined);
|
||||
// A configuration that the replay already sent does not go again.
|
||||
const configOptions = current && JSON.stringify(current) !== replayed ? current : undefined;
|
||||
const configOptions = currentChildConfiguration(
|
||||
child,
|
||||
liveConfiguration?.(child.sessionId),
|
||||
this.models,
|
||||
);
|
||||
return [
|
||||
{
|
||||
sessionId: child.parentSessionId,
|
||||
@@ -584,14 +589,38 @@ export class RfdSubagentReplay {
|
||||
}
|
||||
}
|
||||
|
||||
/** The model of the first response in `messages`, a subagent's transcript. */
|
||||
export function firstResponseModel(messages: readonly SessionMessage[]): string | undefined {
|
||||
for (const message of messages) {
|
||||
if (message.type !== "assistant") continue;
|
||||
const model = (message.message as { model?: unknown } | undefined)?.model;
|
||||
if (typeof model === "string" && model && model !== "<synthetic>") return model;
|
||||
/**
|
||||
* Takes `model`, the model id of a replayed response of `child`. The latest
|
||||
* one is the child's model after the replay (see
|
||||
* {@link currentChildConfiguration}). A response without a model id, or with
|
||||
* `<synthetic>`, which marks a message that no model wrote, changes nothing.
|
||||
*/
|
||||
export function trackResponseModel(child: ReplayChild, model: unknown): void {
|
||||
if (typeof model === "string" && responseModelEntry(model, undefined)) {
|
||||
child.responseModel = model;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* The configuration of the replayed `child` to send once the replay is over:
|
||||
* after the load response on v1, after the root's `replay_complete` on v2. A
|
||||
* child's `config_option_update` inside a replay is a past value to the
|
||||
* client, so the replay sends none, and this one goes also when the client
|
||||
* held the same configuration before.
|
||||
*
|
||||
* `live` is the configuration that the client last got for a child that still
|
||||
* runs in this process. Any other child gets its `model` option, with the
|
||||
* model of the latest response in its transcript, as the session's model list
|
||||
* `models` names it. Undefined for such a child without responses.
|
||||
*/
|
||||
export function currentChildConfiguration(
|
||||
child: ReplayChild,
|
||||
live: SessionConfigOption[] | undefined,
|
||||
models: SubagentModels | undefined,
|
||||
): SessionConfigOption[] | undefined {
|
||||
if (live) return live;
|
||||
const entry = responseModelEntry(child.responseModel, models);
|
||||
return entry ? [childModelOption(entry)] : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"AskUserQuestion"}},"content":[],"kind":"other","name":"AskUserQuestion","sessionUpdate":"tool_call","status":"pending","title":"Asking for your input","toolCallId":"toolu_ask"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"rawInput":{"questions":[{"header":"Database","multiSelect":false,"options":[{"description":"Relational","label":"Postgres","preview":"CREATE TABLE t ();"},{"description":"Key-value","label":"Redis"}],"question":"Which database?"}]},"sessionUpdate":"tool_call_update","toolCallId":"toolu_ask"}}}
|
||||
{"kind":"createElicitation","payload":{"message":"Which database?","mode":"form","requestedSchema":{"properties":{"question_0":{"oneOf":[{"_meta":{"_claude/askUserQuestionOption":{"preview":"CREATE TABLE t ();"}},"const":"Postgres","description":"Relational","title":"Postgres"},{"const":"Redis","description":"Key-value","title":"Redis"}],"title":"Database","type":"string"},"question_0_custom":{"_meta":{"_askUserQuestionCustomAnswer":{"isCustomAnswer":true,"questionId":"question_0"},"jetbrains":{"air":{"customAnswer":{"isCustomAnswer":true,"questionId":"question_0"},"version":1}}},"description":"Type your own answer, or add a note to the option you chose above (optional).","title":"Other","type":"string"}},"type":"object"},"sessionId":"<session>","toolCallId":"toolu_ask"}}
|
||||
{"kind":"createElicitation","payload":{"_meta":{"jetbrains":{"air":{"customAnswerFields":["question_0_custom"],"version":1}}},"message":"Which database?","mode":"form","requestedSchema":{"properties":{"question_0":{"oneOf":[{"_meta":{"_claude/askUserQuestionOption":{"preview":"CREATE TABLE t ();"}},"const":"Postgres","description":"Relational","title":"Postgres"},{"const":"Redis","description":"Key-value","title":"Redis"}],"title":"Database","type":"string"},"question_0_custom":{"_meta":{"_askUserQuestionCustomAnswer":{"isCustomAnswer":true,"questionId":"question_0"},"jetbrains":{"air":{"customAnswer":{"isCustomAnswer":true,"questionId":"question_0"},"version":1}}},"description":"Type your own answer, or add a note to the option you chose above (optional).","title":"Other","type":"string"}},"type":"object"},"sessionId":"<session>","toolCallId":"toolu_ask"}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"content":[{"content":{"text":"User has answered your questions: \"Which database?\"=\"Postgres\".","type":"text"},"type":"content"}],"sessionUpdate":"tool_call_update","status":"completed","toolCallId":"toolu_ask"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"cost":{"amount":0,"currency":"USD"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"promptResponse","payload":{"_meta":{"quota":{"model_usage":[],"token_count":{"cachedInputTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"reasoningOutputTokens":0,"totalTokens":0}}},"stopReason":"end_turn","usage":{"cachedReadTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"totalTokens":0}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"asyncTaskId":"workflow_1","canStop":true,"description":"Build assets","name":"Build assets","outputFilePath":"/tmp/tasks/workflow_1.output","sessionUpdate":"async_task_spawned","showInTranscript":true,"taskType":"workflow"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"asyncTaskId":"workflow_1","sessionUpdate":"async_task_state_update","state":"completed","summary":"done"}}}
|
||||
{"kind":"promptResponse","payload":{"_meta":{"quota":{"model_usage":[],"token_count":{"cachedInputTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"reasoningOutputTokens":0,"totalTokens":0}}},"stopReason":"end_turn","usage":{"cachedReadTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"totalTokens":0}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"asyncTaskId":"workflow_3","canStop":true,"description":"Watch the logs","name":"Watch the logs","sessionUpdate":"async_task_spawned","showInTranscript":true,"taskType":"workflow","toolCallId":"toolu_workflow"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"asyncTaskId":"workflow_3","sessionUpdate":"async_task_progress","summary":"first line","usage":{"durationMs":5,"toolUses":0,"totalTokens":0}}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"asyncTaskId":"workflow_3","sessionUpdate":"async_task_progress","summary":"second line","usage":{"durationMs":6,"toolUses":0,"totalTokens":0}}}}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"asyncTaskId":"workflow_2","canStop":true,"description":"Build assets","name":"Build assets","sessionUpdate":"async_task_spawned","showInTranscript":true,"taskType":"workflow"}}}
|
||||
{"kind":"promptResponse","payload":{"_meta":{"quota":{"model_usage":[],"token_count":{"cachedInputTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"reasoningOutputTokens":0,"totalTokens":0}}},"stopReason":"end_turn","usage":{"cachedReadTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"totalTokens":0}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Bash"},"terminal_info":{"terminal_id":"toolu_bg"}},"content":[{"terminalId":"toolu_bg","type":"terminal"}],"kind":"execute","name":"Bash","sessionUpdate":"tool_call","status":"pending","title":"Terminal","toolCallId":"toolu_bg"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"sessionUpdate":"tool_call_update","title":"sleep 100","toolCallId":"toolu_bg"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Bash"},"terminal_info":{"terminal_id":"toolu_bash"}},"content":[{"terminalId":"toolu_bash","type":"terminal"}],"kind":"execute","name":"Bash","sessionUpdate":"tool_call","status":"pending","title":"Terminal","toolCallId":"toolu_bash"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"sessionUpdate":"tool_call_update","title":"false","toolCallId":"toolu_bash"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Bash"},"terminal_info":{"terminal_id":"toolu_bash"}},"content":[{"terminalId":"toolu_bash","type":"terminal"}],"kind":"execute","name":"Bash","sessionUpdate":"tool_call","status":"pending","title":"Terminal","toolCallId":"toolu_bash"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"sessionUpdate":"tool_call_update","title":"ls -la","toolCallId":"toolu_bash"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"jetbrains":{"air":{"contextCompaction":{"version":1},"version":1}}},"kind":"think","sessionUpdate":"tool_call","status":"in_progress","title":"Compact conversation","toolCallId":"00000000-0000-4000-8000-000000000001"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"jetbrains":{"air":{"contextCompaction":{"error":"Context too small","version":1}}}},"content":[{"content":{"text":"Compaction failed: Context too small","type":"text"},"type":"content"}],"sessionUpdate":"tool_call_update","status":"failed","toolCallId":"00000000-0000-4000-8000-000000000001"}}}
|
||||
{"kind":"promptResponse","payload":{"_meta":{"quota":{"model_usage":[],"token_count":{"cachedInputTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"reasoningOutputTokens":0,"totalTokens":0}}},"stopReason":"end_turn","usage":{"cachedReadTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"totalTokens":0}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"jetbrains":{"air":{"contextCompaction":{"version":1},"version":1}}},"kind":"think","sessionUpdate":"tool_call","status":"in_progress","title":"Compact conversation","toolCallId":"00000000-0000-4000-8000-000000000001"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"sessionUpdate":"tool_call_update","status":"in_progress","toolCallId":"00000000-0000-4000-8000-000000000001"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"jetbrains":{"air":{"contextCompaction":{"durationMs":7,"postTokens":100,"preTokens":1000,"trigger":"automatic","version":1}}}},"sessionUpdate":"tool_call_update","status":"completed","toolCallId":"00000000-0000-4000-8000-000000000001"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"jetbrains":{"air":{"contextCompaction":{"version":1},"version":1}}},"compactionId":"00000000-0000-4000-8000-000000000001","sessionUpdate":"compaction_update","status":"in_progress"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"compactionId":"00000000-0000-4000-8000-000000000001","content":{"text":"The summary.","type":"text"},"sessionUpdate":"compaction_summary_chunk"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"jetbrains":{"air":{"contextCompaction":{"durationMs":7,"postTokens":100,"preTokens":1000,"trigger":"automatic","version":1},"version":1}}},"compactionId":"00000000-0000-4000-8000-000000000001","sessionUpdate":"compaction_update","status":"completed"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Edit"}},"content":[],"kind":"edit","locations":[],"name":"Edit","sessionUpdate":"tool_call","status":"pending","title":"Edit","toolCallId":"toolu_edit"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"locations":[{"path":"<cwd>/src/app.ts"}],"sessionUpdate":"tool_call_update","title":"Edit src/app.ts","toolCallId":"toolu_edit"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Edit"}},"content":[],"kind":"edit","locations":[],"name":"Edit","sessionUpdate":"tool_call","status":"pending","title":"Edit","toolCallId":"toolu_edit"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"locations":[{"path":"<cwd>/src/app.ts"}],"sessionUpdate":"tool_call_update","title":"Edit src/app.ts","toolCallId":"toolu_edit"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"ExitPlanMode"}},"content":[],"kind":"switch_mode","name":"ExitPlanMode","sessionUpdate":"tool_call","status":"pending","title":"Approve Plan","toolCallId":"toolu_plan"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"ExitPlanMode"}},"content":[],"kind":"switch_mode","name":"ExitPlanMode","sessionUpdate":"tool_call","status":"pending","title":"Approve Plan","toolCallId":"toolu_plan"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"jetbrains":{"air":{"goal":{"controlMethod":"_session/goal","objective":"Ship the feature","status":"active"},"version":1}}},"sessionUpdate":"session_info_update"}}}
|
||||
{"kind":"promptResponse","payload":{"_meta":{"quota":{"model_usage":[],"token_count":{"cachedInputTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"reasoningOutputTokens":0,"totalTokens":0}}},"stopReason":"end_turn","usage":{"cachedReadTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"totalTokens":0}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Grep"}},"content":[],"kind":"search","name":"Grep","sessionUpdate":"tool_call","status":"pending","title":"grep","toolCallId":"toolu_grep"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"sessionUpdate":"tool_call_update","title":"grep \"value\"","toolCallId":"toolu_grep"}}}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"mcp__docs__search"},"is_mcp_tool_call":true,"jetbrains":{"air":{"mcp":{"server":"docs","tool":"search"},"version":1}}},"content":[],"kind":"other","name":"mcp__docs__search","sessionUpdate":"tool_call","status":"pending","title":"mcp__docs__search","toolCallId":"toolu_mcp"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"mcp__docs__search"},"is_mcp_tool_call":true,"jetbrains":{"air":{"mcp":{"server":"docs","tool":"search"},"version":1}}},"content":[],"kind":"other","name":"mcp__docs__search","sessionUpdate":"tool_call","status":"pending","title":"docs: search","toolCallId":"toolu_mcp"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"rawInput":{"q":"acp"},"sessionUpdate":"tool_call_update","toolCallId":"toolu_mcp"}}}
|
||||
{"kind":"requestPermission","payload":{"_meta":{"jetbrains":{"air":{"permission":{"title":"mcp__docs__search","version":1},"version":1}}},"options":[{"kind":"allow_once","name":"Yes","optionId":"allow-once"},{"kind":"reject_once","name":"No","optionId":"reject"}],"sessionId":"<session>","toolCall":{"_meta":{"claudeCode":{"mcpServer":{"name":"docs","source":"project"}}},"rawInput":{"q":"acp"},"title":"mcp__docs__search","toolCallId":"toolu_mcp"}}}
|
||||
{"kind":"requestPermission","payload":{"_meta":{"jetbrains":{"air":{"permission":{"title":"docs: search","version":1},"version":1}}},"options":[{"kind":"allow_once","name":"Yes","optionId":"allow-once"},{"kind":"reject_once","name":"No","optionId":"reject"}],"sessionId":"<session>","toolCall":{"_meta":{"claudeCode":{"mcpServer":{"name":"docs","source":"project"}}},"rawInput":{"q":"acp"},"title":"docs: search","toolCallId":"toolu_mcp"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"content":[{"content":{"text":"Found 2 documents.","type":"text"},"type":"content"}],"sessionUpdate":"tool_call_update","status":"completed","toolCallId":"toolu_mcp"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"cost":{"amount":0,"currency":"USD"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"promptResponse","payload":{"_meta":{"quota":{"model_usage":[],"token_count":{"cachedInputTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"reasoningOutputTokens":0,"totalTokens":0}}},"stopReason":"end_turn","usage":{"cachedReadTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"totalTokens":0}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"memory_recall","toolResponse":{"mode":"select"}}},"kind":"read","locations":[{"path":"/memory/a.md"},{"path":"/memory/b.md"}],"sessionUpdate":"tool_call","status":"completed","title":"Recalled 2 memories","toolCallId":"00000000-0000-4000-8000-000000000001"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"memory_recall","toolResponse":{"mode":"synthesize"}}},"content":[{"content":{"text":"The user prefers tabs.","type":"text"},"type":"content"}],"kind":"read","sessionUpdate":"tool_call","status":"completed","title":"Recalled synthesized memory","toolCallId":"00000000-0000-4000-8000-000000000002"}}}
|
||||
{"kind":"promptResponse","payload":{"_meta":{"quota":{"model_usage":[],"token_count":{"cachedInputTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"reasoningOutputTokens":0,"totalTokens":0}}},"stopReason":"end_turn","usage":{"cachedReadTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"totalTokens":0}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"SandboxNetworkAccess"}},"content":[],"kind":"other","name":"SandboxNetworkAccess","rawInput":{"host":"example.com"},"sessionUpdate":"tool_call","status":"pending","title":"SandboxNetworkAccess","toolCallId":"toolu_net"}}}
|
||||
{"kind":"requestPermission","payload":{"_meta":{"jetbrains":{"air":{"permission":{"description":"Reason: Sandbox blocks network","title":"example.com","version":1},"version":1}}},"options":[{"kind":"allow_once","name":"Yes","optionId":"allow-once"},{"kind":"reject_once","name":"No","optionId":"reject"}],"sessionId":"<session>","toolCall":{"rawInput":{"host":"example.com"},"title":"example.com","toolCallId":"toolu_net"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"sessionUpdate":"tool_call_update","status":"completed","toolCallId":"toolu_net"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"NotebookEdit"}},"content":[],"kind":"edit","locations":[],"name":"NotebookEdit","sessionUpdate":"tool_call","status":"pending","title":"Edit notebook","toolCallId":"toolu_nb"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"locations":[{"path":"<cwd>/n.ipynb"}],"sessionUpdate":"tool_call_update","title":"Edit cell in n.ipynb","toolCallId":"toolu_nb"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Bash"},"terminal_info":{"terminal_id":"toolu_denied"}},"content":[{"terminalId":"toolu_denied","type":"terminal"}],"kind":"execute","name":"Bash","sessionUpdate":"tool_call","status":"pending","title":"Terminal","toolCallId":"toolu_denied"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"content":{"text":"Work","type":"text"},"messageId":"msg_rate","sessionUpdate":"agent_message_chunk"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"content":{"text":"ing.","type":"text"},"messageId":"msg_rate","sessionUpdate":"agent_message_chunk"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Read"}},"content":[],"kind":"read","locations":[],"name":"Read","sessionUpdate":"tool_call","status":"pending","title":"Read File","toolCallId":"toolu_read"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
|
||||
@@ -14,4 +14,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"sessionUpdate":"subagent_state_update","state":"completed","subagentSessionId":"<session>:replay-subagent:toolu_r_task"}}}
|
||||
{"kind":"loadSession","payload":{"configOptions":[{"category":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","id":"model","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","currentValue":"auto","description":"Session permission mode","id":"mode","name":"Mode","options":[{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Always ask before making changes","name":"Manual","value":"default"},{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"_meta":{"jetbrains":{"air":{"kind":"plan","version":1}}},"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"_meta":{"jetbrains":{"air":{"kind":"auto_review","version":1}}},"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"_meta":{"jetbrains":{"air":{"kind":"full_access","version":1}}},"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"modes":{"availableModes":[{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Always ask before making changes","id":"default","name":"Manual"},{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Automatically accept all file edits","id":"acceptEdits","name":"Accept edits"},{"_meta":{"jetbrains":{"air":{"kind":"plan","version":1}}},"description":"Create a plan before making changes","id":"plan","name":"Plan"},{"_meta":{"jetbrains":{"air":{"kind":"auto_review","version":1}}},"description":"Claude handles permission decisions","id":"auto","name":"Auto"},{"_meta":{"jetbrains":{"air":{"kind":"full_access","version":1}}},"description":"Accepts all permissions","id":"bypassPermissions","name":"Bypass permissions"}],"currentModeId":"auto"},"sessionId":"<session>"}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>:replay-subagent:toolu_r_task","update":{"configOptions":[{"category":"model","currentValue":"claude-sonnet-4-6","id":"model","name":"Model","options":[{"name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"}],"sessionUpdate":"config_option_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{"kind":"initialize","payload":{"_meta":{"jetbrains":{"air":{"capabilities":["sessionFailure","agentFileChangeReport","nativeSubagentSessions","asyncTasks","customInstructions","recommendedValue","diffPatch","planFile","backgroundSubagents"],"goal":{"actions":["set","clear"],"controlMethod":"_session/goal","version":1},"version":1}},"steering":{"supported":true}},"agentCapabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"logout":{},"status":{}},"loadSession":true,"mcpCapabilities":{"acp":true,"http":true,"sse":true},"promptCapabilities":{"embeddedContext":true,"image":true},"providers":{},"sessionCapabilities":{"additionalDirectories":{},"close":{},"delete":{},"fork":{},"list":{},"options":{},"resume":{},"status":{},"subagents":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"agentInfo":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"authMethods":[],"protocolVersion":1}}
|
||||
{"kind":"newSession","payload":{"configOptions":[{"category":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","id":"model","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","currentValue":"auto","description":"Session permission mode","id":"mode","name":"Mode","options":[{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Always ask before making changes","name":"Manual","value":"default"},{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"_meta":{"jetbrains":{"air":{"kind":"plan","version":1}}},"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"_meta":{"jetbrains":{"air":{"kind":"auto_review","version":1}}},"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"_meta":{"jetbrains":{"air":{"kind":"full_access","version":1}}},"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"modes":{"availableModes":[{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Always ask before making changes","id":"default","name":"Manual"},{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Automatically accept all file edits","id":"acceptEdits","name":"Accept edits"},{"_meta":{"jetbrains":{"air":{"kind":"plan","version":1}}},"description":"Create a plan before making changes","id":"plan","name":"Plan"},{"_meta":{"jetbrains":{"air":{"kind":"auto_review","version":1}}},"description":"Claude handles permission decisions","id":"auto","name":"Auto"},{"_meta":{"jetbrains":{"air":{"kind":"full_access","version":1}}},"description":"Accepts all permissions","id":"bypassPermissions","name":"Bypass permissions"}],"currentModeId":"auto"},"sessionId":"<session>"}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Skill"}},"content":[],"kind":"other","name":"Skill","sessionUpdate":"tool_call","status":"pending","title":"Load skill","toolCallId":"toolu_skill"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"capabilities":{},"name":"Background review","prompt":"Review the diff","sessionUpdate":"subagent_spawned","subagentSessionId":"a2","task":"Review the diff"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"capabilities":{},"name":"Check the logs","prompt":"Check logs","sessionUpdate":"subagent_spawned","subagentSessionId":"agent_late","task":"Check logs"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"capabilities":{},"name":"Fix the build","prompt":"Make the build pass","sessionUpdate":"subagent_spawned","subagentSessionId":"agent_n","task":"Make the build pass"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"capabilities":{},"name":"Plan the work","prompt":"Plan it","sessionUpdate":"subagent_spawned","subagentSessionId":"agent_outer","task":"Plan it"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"capabilities":{},"name":"Explore code","prompt":"Find the parser","sessionUpdate":"subagent_spawned","subagentSessionId":"agent_1","task":"Find the parser"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"capabilities":{},"name":"Summarize","prompt":"Summarize the repo","sessionUpdate":"subagent_spawned","subagentSessionId":"agent_t","task":"Summarize the repo"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"entries":[{"content":"Write tests","priority":"medium","status":"pending"}],"sessionUpdate":"plan"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"TaskOutput"}},"content":[],"kind":"other","name":"TaskOutput","sessionUpdate":"tool_call","status":"pending","title":"TaskOutput","toolCallId":"toolu_out"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"content":{"text":"Let me thin","type":"text"},"messageId":"msg_text","sessionUpdate":"agent_thought_chunk"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"content":{"text":"k about it.","type":"text"},"messageId":"msg_text","sessionUpdate":"agent_thought_chunk"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"entries":[{"content":"Writing tests","priority":"medium","status":"in_progress"},{"content":"Ship","priority":"medium","status":"pending"}],"sessionUpdate":"plan"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Bash"},"terminal_info":{"terminal_id":"toolu_slow"}},"content":[{"terminalId":"toolu_slow","type":"terminal"}],"kind":"execute","name":"Bash","sessionUpdate":"tool_call","status":"pending","title":"Terminal","toolCallId":"toolu_slow"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"WebFetch"}},"content":[],"kind":"fetch","name":"WebFetch","sessionUpdate":"tool_call","status":"pending","title":"Fetch","toolCallId":"toolu_fetch"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"sessionUpdate":"tool_call_update","title":"Fetch https://example.com","toolCallId":"toolu_fetch"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Write"}},"content":[],"kind":"edit","locations":[],"name":"Write","sessionUpdate":"tool_call","status":"pending","title":"Preparing file…","toolCallId":"toolu_write"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"locations":[{"path":"<cwd>/old.ts"}],"sessionUpdate":"tool_call_update","title":"Write old.ts","toolCallId":"toolu_write"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"_meta":{"claudeCode":{"toolName":"Write"}},"content":[],"kind":"edit","locations":[],"name":"Write","sessionUpdate":"tool_call","status":"pending","title":"Preparing file…","toolCallId":"toolu_write"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"locations":[{"path":"<cwd>/new.ts"}],"sessionUpdate":"tool_call_update","title":"Write new.ts","toolCallId":"toolu_write"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"/goal Ship the feature","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
@@ -13,7 +13,7 @@
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"content":{"text":"src/app.ts:2:const value = 1;","type":"text"},"type":"content"}],"rawOutput":"src/app.ts:2:const value = 1;","sessionUpdate":"tool_call_update","status":"completed","toolCallId":"toolu_grep"}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[],"kind":"search","locations":[],"name":"Glob","rawInput":{},"sessionUpdate":"tool_call_update","status":"pending","title":"Find","toolCallId":"toolu_glob"}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"rawInput":{"pattern":"**/*.ts"},"sessionUpdate":"tool_call_update","title":"Find `**/*.ts`","toolCallId":"toolu_glob"}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"rawInput":{"pattern":"**/*.ts"},"sessionUpdate":"tool_call_update","title":"Find **/*.ts","toolCallId":"toolu_glob"}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"content":{"text":"src/app.ts\nsrc/b.ts","type":"text"},"type":"content"}],"rawOutput":"src/app.ts\nsrc/b.ts","sessionUpdate":"tool_call_update","status":"completed","toolCallId":"toolu_glob"}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"cost":{"amount":0,"currency":"USD"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"_meta":{"quota":{"model_usage":[],"token_count":{"cachedInputTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"reasoningOutputTokens":0,"totalTokens":0}}},"background":[],"sessionUpdate":"state_update","state":"idle","stopReason":"end_turn","usage":{"cachedReadTokens":0,"cachedWriteTokens":0,"inputTokens":0,"outputTokens":0,"totalTokens":0}}}}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[],"kind":"other","name":"mcp__docs__search","rawInput":{},"sessionUpdate":"tool_call_update","status":"pending","title":"mcp__docs__search","toolCallId":"toolu_mcp"}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[],"kind":"other","name":"mcp__docs__search","rawInput":{},"sessionUpdate":"tool_call_update","status":"pending","title":"docs: search","toolCallId":"toolu_mcp"}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"sessionUpdate":"usage_update","size":200000,"used":3}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"rawInput":{"q":"acp"},"sessionUpdate":"tool_call_update","toolCallId":"toolu_mcp"}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"requires_action"}}}
|
||||
{"kind":"request","method":"session/request_permission","payload":{"options":[{"kind":"allow_once","name":"Yes","optionId":"allow-once"},{"kind":"reject_once","name":"No","optionId":"reject"}],"sessionId":"<session>","subject":{"toolCall":{"_meta":{"claudeCode":{"mcpServer":{"name":"docs","source":"project"}}},"content":[],"kind":"other","name":"mcp__docs__search","rawInput":{"q":"acp"},"title":"mcp__docs__search","toolCallId":"toolu_mcp"},"type":"tool_call"},"title":"mcp__docs__search"}}
|
||||
{"kind":"request","method":"session/request_permission","payload":{"options":[{"kind":"allow_once","name":"Yes","optionId":"allow-once"},{"kind":"reject_once","name":"No","optionId":"reject"}],"sessionId":"<session>","subject":{"toolCall":{"_meta":{"claudeCode":{"mcpServer":{"name":"docs","source":"project"}}},"content":[],"kind":"other","name":"mcp__docs__search","rawInput":{"q":"acp"},"title":"docs: search","toolCallId":"toolu_mcp"},"type":"tool_call"},"title":"docs: search"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"content":{"text":"Found 2 documents.","type":"text"},"type":"content"}],"rawOutput":[{"text":"Found 2 documents.","type":"text"}],"sessionUpdate":"tool_call_update","status":"completed","toolCallId":"toolu_mcp"}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"_meta":{"_claude/model":"claude-sonnet-4-6"},"cost":{"amount":0,"currency":"USD"},"sessionUpdate":"usage_update","size":200000,"used":2}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"response","method":"initialize","payload":{"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"background":[],"sessionUpdate":"state_update","state":"running"}}}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user