@agentclientprotocol/claude-agent-acp 0.102.0 → 0.102.1-preview.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/acp-agent.d.ts +119 -439
- package/dist/acp-agent.d.ts.map +1 -1
- package/dist/acp-agent.js +380 -2412
- package/dist/acp-subagents.d.ts +1 -2
- package/dist/acp-subagents.d.ts.map +1 -1
- package/dist/auth-methods.d.ts +21 -0
- package/dist/auth-methods.d.ts.map +1 -0
- package/dist/auth-methods.js +68 -0
- package/dist/auth-status-reporter.d.ts +112 -0
- package/dist/auth-status-reporter.d.ts.map +1 -0
- package/dist/auth-status-reporter.js +253 -0
- package/dist/background-work.d.ts +12 -265
- package/dist/background-work.d.ts.map +1 -1
- package/dist/background-work.js +8 -558
- package/dist/client-system-prompt.d.ts +7 -0
- package/dist/client-system-prompt.d.ts.map +1 -1
- package/dist/client-system-prompt.js +24 -0
- package/dist/context-compaction.d.ts +20 -0
- package/dist/context-compaction.d.ts.map +1 -1
- package/dist/context-compaction.js +26 -0
- package/dist/context-window.d.ts +70 -0
- package/dist/context-window.d.ts.map +1 -0
- package/dist/context-window.js +132 -0
- package/dist/diff.d.ts +1 -1
- package/dist/diff.js +1 -1
- package/dist/elicitation.d.ts +66 -1
- package/dist/elicitation.d.ts.map +1 -1
- package/dist/elicitation.js +109 -0
- package/dist/file-change-audit.d.ts +4 -3
- package/dist/file-change-audit.d.ts.map +1 -1
- package/dist/file-change-audit.js +3 -2
- package/dist/mcp-oauth.d.ts +44 -0
- package/dist/mcp-oauth.d.ts.map +1 -0
- package/dist/mcp-oauth.js +142 -0
- package/dist/mcp-servers.d.ts +10 -0
- package/dist/mcp-servers.d.ts.map +1 -0
- package/dist/mcp-servers.js +29 -0
- package/dist/native-subagents.d.ts +18 -8
- package/dist/native-subagents.d.ts.map +1 -1
- package/dist/native-subagents.js +7 -35
- package/dist/permissions/presentation.d.ts +29 -0
- package/dist/permissions/presentation.d.ts.map +1 -1
- package/dist/permissions/presentation.js +38 -11
- package/dist/plans.d.ts +36 -6
- package/dist/plans.d.ts.map +1 -1
- package/dist/plans.js +49 -11
- package/dist/prompt-suggestions.d.ts +29 -0
- package/dist/prompt-suggestions.d.ts.map +1 -1
- package/dist/prompt-suggestions.js +45 -0
- package/dist/providers.d.ts +139 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +286 -0
- package/dist/remote-control.d.ts +62 -0
- package/dist/remote-control.d.ts.map +1 -0
- package/dist/remote-control.js +78 -0
- package/dist/result-end.d.ts +39 -0
- package/dist/result-end.d.ts.map +1 -0
- package/dist/result-end.js +50 -0
- package/dist/serve.d.ts +7 -2
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +10 -5
- package/dist/session-config-ids.d.ts +1 -0
- package/dist/session-config-ids.d.ts.map +1 -1
- package/dist/session-config-ids.js +1 -0
- package/dist/session-config-options.d.ts +64 -0
- package/dist/session-config-options.d.ts.map +1 -0
- package/dist/session-config-options.js +162 -0
- package/dist/session-effort.d.ts +67 -0
- package/dist/session-effort.d.ts.map +1 -1
- package/dist/session-effort.js +98 -0
- package/dist/session-env.d.ts +22 -0
- package/dist/session-env.d.ts.map +1 -0
- package/dist/session-env.js +66 -0
- package/dist/session-fast-mode.d.ts +83 -0
- package/dist/session-fast-mode.d.ts.map +1 -0
- package/dist/session-fast-mode.js +142 -0
- package/dist/session-index/connection.d.ts +2 -5
- package/dist/session-index/connection.d.ts.map +1 -1
- package/dist/session-index/connection.js +3 -5
- package/dist/session-mode.d.ts +1 -0
- package/dist/session-mode.d.ts.map +1 -1
- package/dist/session-mode.js +1 -1
- package/dist/session-model.d.ts +41 -0
- package/dist/session-model.d.ts.map +1 -1
- package/dist/session-model.js +110 -45
- package/dist/session-notices.d.ts +44 -0
- package/dist/session-notices.d.ts.map +1 -1
- package/dist/session-notices.js +68 -0
- package/dist/session-titles.d.ts +34 -12
- package/dist/session-titles.d.ts.map +1 -1
- package/dist/session-titles.js +7 -6
- package/dist/session-usage.d.ts +125 -0
- package/dist/session-usage.d.ts.map +1 -0
- package/dist/session-usage.js +196 -0
- package/dist/streamed-text.d.ts +33 -0
- package/dist/streamed-text.d.ts.map +1 -0
- package/dist/streamed-text.js +71 -0
- package/dist/subagent-configuration.d.ts +32 -0
- package/dist/subagent-configuration.d.ts.map +1 -0
- package/dist/subagent-configuration.js +70 -0
- package/dist/subagent-replay.d.ts +18 -0
- package/dist/subagent-replay.d.ts.map +1 -1
- package/dist/subagent-replay.js +25 -15
- package/dist/tool-calls/client-capabilities.d.ts +8 -8
- package/dist/tool-calls/client-capabilities.js +4 -4
- package/dist/tool-calls/renderer.d.ts +4 -5
- package/dist/tool-calls/renderer.d.ts.map +1 -1
- package/dist/tool-calls/renderer.js +4 -5
- package/dist/turn-events.d.ts +6 -46
- package/dist/turn-events.d.ts.map +1 -1
- package/dist/v2/agent.d.ts +7 -11
- package/dist/v2/agent.d.ts.map +1 -1
- package/dist/v2/agent.js +751 -331
- package/dist/v2/air.d.ts +33 -0
- package/dist/v2/air.d.ts.map +1 -0
- package/dist/v2/air.js +29 -0
- package/dist/v2/auth.d.ts +97 -0
- package/dist/v2/auth.d.ts.map +1 -0
- package/dist/v2/auth.js +216 -0
- package/dist/v2/background.d.ts +27 -16
- package/dist/v2/background.d.ts.map +1 -1
- package/dist/v2/background.js +4 -32
- package/dist/v2/child-config.d.ts +55 -0
- package/dist/v2/child-config.d.ts.map +1 -0
- package/dist/v2/child-config.js +92 -0
- package/dist/v2/clear-context.d.ts +94 -0
- package/dist/v2/clear-context.d.ts.map +1 -0
- package/dist/v2/clear-context.js +176 -0
- package/dist/v2/commands.d.ts +46 -0
- package/dist/v2/commands.d.ts.map +1 -0
- package/dist/v2/commands.js +54 -0
- package/dist/v2/config.d.ts +187 -0
- package/dist/v2/config.d.ts.map +1 -0
- package/dist/v2/config.js +494 -0
- package/dist/v2/elicitation.d.ts +93 -0
- package/dist/v2/elicitation.d.ts.map +1 -0
- package/dist/v2/elicitation.js +160 -0
- package/dist/v2/file-changes.d.ts +61 -0
- package/dist/v2/file-changes.d.ts.map +1 -0
- package/dist/v2/file-changes.js +108 -0
- package/dist/v2/file-preview.d.ts +18 -0
- package/dist/v2/file-preview.d.ts.map +1 -0
- package/dist/v2/file-preview.js +29 -0
- package/dist/v2/initialize.d.ts +10 -24
- package/dist/v2/initialize.d.ts.map +1 -1
- package/dist/v2/initialize.js +4 -111
- package/dist/v2/outcome.d.ts +81 -0
- package/dist/v2/outcome.d.ts.map +1 -0
- package/dist/v2/outcome.js +165 -0
- package/dist/v2/permissions.d.ts +92 -0
- package/dist/v2/permissions.d.ts.map +1 -0
- package/dist/v2/permissions.js +162 -0
- package/dist/v2/prompt.d.ts +2 -42
- package/dist/v2/prompt.d.ts.map +1 -1
- package/dist/v2/prompt.js +2 -119
- package/dist/v2/remote-control.d.ts +41 -0
- package/dist/v2/remote-control.d.ts.map +1 -0
- package/dist/v2/remote-control.js +63 -0
- package/dist/v2/reports.d.ts +198 -0
- package/dist/v2/reports.d.ts.map +1 -0
- package/dist/v2/reports.js +487 -0
- package/dist/v2/restarts.d.ts +128 -0
- package/dist/v2/restarts.d.ts.map +1 -0
- package/dist/v2/restarts.js +348 -0
- package/dist/v2/session-requests.d.ts +20 -0
- package/dist/v2/session-requests.d.ts.map +1 -0
- package/dist/v2/session-requests.js +108 -0
- package/dist/v2/session-update.d.ts +2 -13
- package/dist/v2/session-update.d.ts.map +1 -1
- package/dist/v2/session-update.js +2 -22
- package/dist/v2/session.d.ts +340 -41
- package/dist/v2/session.d.ts.map +1 -1
- package/dist/v2/session.js +1223 -141
- package/dist/v2/setup.d.ts +49 -0
- package/dist/v2/setup.d.ts.map +1 -0
- package/dist/v2/setup.js +62 -0
- package/dist/v2/stopped-work.d.ts +123 -0
- package/dist/v2/stopped-work.d.ts.map +1 -0
- package/dist/v2/stopped-work.js +210 -0
- package/dist/v2/stream.d.ts +228 -0
- package/dist/v2/stream.d.ts.map +1 -0
- package/dist/v2/stream.js +506 -0
- package/dist/v2/subagent-replay.d.ts +115 -0
- package/dist/v2/subagent-replay.d.ts.map +1 -0
- package/dist/v2/subagent-replay.js +479 -0
- package/dist/v2/subscription-guard.d.ts +60 -0
- package/dist/v2/subscription-guard.d.ts.map +1 -0
- package/dist/v2/subscription-guard.js +84 -0
- package/dist/v2/tasks.d.ts +492 -0
- package/dist/v2/tasks.d.ts.map +1 -0
- package/dist/v2/tasks.js +1728 -0
- package/dist/v2/terminal.d.ts.map +1 -1
- package/dist/v2/terminal.js +6 -1
- package/dist/v2/tool-call.d.ts +3 -2
- package/dist/v2/tool-call.d.ts.map +1 -1
- package/dist/v2/update-translator.d.ts +36 -0
- package/dist/v2/update-translator.d.ts.map +1 -0
- package/dist/v2/update-translator.js +80 -0
- package/dist/workflow-progress.d.ts +23 -0
- package/dist/workflow-progress.d.ts.map +1 -1
- package/dist/workflow-progress.js +31 -8
- package/package.json +1 -1
- package/dist/v2/permission.d.ts +0 -28
- package/dist/v2/permission.d.ts.map +0 -1
- package/dist/v2/permission.js +0 -41
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
export const ZERO_USAGE = Object.freeze({
|
|
2
|
+
input_tokens: 0,
|
|
3
|
+
output_tokens: 0,
|
|
4
|
+
cache_read_input_tokens: 0,
|
|
5
|
+
cache_creation_input_tokens: 0,
|
|
6
|
+
});
|
|
7
|
+
export const DEFAULT_CONTEXT_WINDOW = 200000;
|
|
8
|
+
/** `_meta.quota` for work that spent `usage` in its main agent loop and
|
|
9
|
+
* `modelUsage` by model (see `turnQuotaMeta` in `acp-agent.ts`). */
|
|
10
|
+
export function quotaMeta(usage, modelUsage) {
|
|
11
|
+
return {
|
|
12
|
+
quota: {
|
|
13
|
+
token_count: quotaTokenCount(usage),
|
|
14
|
+
model_usage: Object.entries(modelUsage ?? {}).map(([model, usage]) => ({
|
|
15
|
+
model,
|
|
16
|
+
token_count: quotaTokenCount(usage),
|
|
17
|
+
})),
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** One `token_count` object. `cachedInputTokens` is cache reads, matching
|
|
22
|
+
* codex's field; Claude also reports cache writes, which codex has no slot
|
|
23
|
+
* for, so those ride along in an extra sibling (the same name the ACP `usage`
|
|
24
|
+
* field already uses) and are counted in `totalTokens`. `reasoningOutputTokens`
|
|
25
|
+
* is always 0: Claude bills thinking inside its output tokens and never breaks
|
|
26
|
+
* it out — the key is kept so the shape stays uniform across agents. */
|
|
27
|
+
function quotaTokenCount(usage) {
|
|
28
|
+
return {
|
|
29
|
+
totalTokens: tallyTotal(usage),
|
|
30
|
+
inputTokens: usage.inputTokens,
|
|
31
|
+
cachedInputTokens: usage.cachedReadTokens,
|
|
32
|
+
cachedWriteTokens: usage.cachedWriteTokens,
|
|
33
|
+
outputTokens: usage.outputTokens,
|
|
34
|
+
reasoningOutputTokens: 0,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** Sum a tally's four counters. Per the Anthropic API `inputTokens` excludes
|
|
38
|
+
* the cache counters, so this is not double-counting (see `totalTokens`). */
|
|
39
|
+
export function tallyTotal(usage) {
|
|
40
|
+
return usage.inputTokens + usage.outputTokens + usage.cachedReadTokens + usage.cachedWriteTokens;
|
|
41
|
+
}
|
|
42
|
+
/** Project `result.modelUsage` into our tally shape. Counters are coerced the
|
|
43
|
+
* way `snapshotFromUsage` coerces the stream's: third-party backends have been
|
|
44
|
+
* observed omitting fields, and a missing or NaN counter must not reach the
|
|
45
|
+
* wire as NaN (which `JSON.stringify` writes as `null`). */
|
|
46
|
+
export function normalizeModelUsage(modelUsage) {
|
|
47
|
+
const tally = {};
|
|
48
|
+
for (const [model, usage] of Object.entries(modelUsage ?? {})) {
|
|
49
|
+
tally[model] = {
|
|
50
|
+
inputTokens: finiteCount(usage?.inputTokens),
|
|
51
|
+
outputTokens: finiteCount(usage?.outputTokens),
|
|
52
|
+
cachedReadTokens: finiteCount(usage?.cacheReadInputTokens),
|
|
53
|
+
cachedWriteTokens: finiteCount(usage?.cacheCreationInputTokens),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return tally;
|
|
57
|
+
}
|
|
58
|
+
function finiteCount(value) {
|
|
59
|
+
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
60
|
+
}
|
|
61
|
+
/** `current - previous` per model, dropping models with nothing to report so a
|
|
62
|
+
* turn only lists the models it actually ran on. A reading that fell BELOW the
|
|
63
|
+
* previous one means the running total restarted under us (a mid-session
|
|
64
|
+
* /clear, a zeroed crash result): there is no usable reference left to
|
|
65
|
+
* subtract, so the reading itself is the increment. */
|
|
66
|
+
export function modelUsageIncrement(current, previous) {
|
|
67
|
+
const increment = {};
|
|
68
|
+
for (const [model, usage] of Object.entries(current)) {
|
|
69
|
+
const base = previous[model];
|
|
70
|
+
const subtracted = base
|
|
71
|
+
? {
|
|
72
|
+
inputTokens: usage.inputTokens - base.inputTokens,
|
|
73
|
+
outputTokens: usage.outputTokens - base.outputTokens,
|
|
74
|
+
cachedReadTokens: usage.cachedReadTokens - base.cachedReadTokens,
|
|
75
|
+
cachedWriteTokens: usage.cachedWriteTokens - base.cachedWriteTokens,
|
|
76
|
+
}
|
|
77
|
+
: usage;
|
|
78
|
+
const rewound = Object.values(subtracted).some((count) => count < 0);
|
|
79
|
+
const resolved = rewound ? usage : subtracted;
|
|
80
|
+
if (tallyTotal(resolved) > 0) {
|
|
81
|
+
increment[model] = resolved;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return increment;
|
|
85
|
+
}
|
|
86
|
+
/** The per-model rows for the first result of a resumed session. Its
|
|
87
|
+
* `modelUsage` reading continues from the totals the transcript saved (SDK
|
|
88
|
+
* 0.3.277+; older transcripts may hold none), so there is no earlier reading
|
|
89
|
+
* to subtract from, and taking the reading itself would charge the whole
|
|
90
|
+
* pre-resume history to this one turn. The result's own `usage` is per-turn
|
|
91
|
+
* (main agent loop only, like the response's `usage`), so it stands in under
|
|
92
|
+
* the turn's top-level model — `key` is that model's `modelUsage` spelling
|
|
93
|
+
* when the reading has one, else the assistant message's own. Any subagent
|
|
94
|
+
* spend on this one turn goes unlisted rather than over-listed. */
|
|
95
|
+
export function resumedFirstResultModelUsage(usage, key) {
|
|
96
|
+
if (key === null) {
|
|
97
|
+
return {};
|
|
98
|
+
}
|
|
99
|
+
const row = {
|
|
100
|
+
inputTokens: finiteCount(usage.input_tokens),
|
|
101
|
+
outputTokens: finiteCount(usage.output_tokens),
|
|
102
|
+
cachedReadTokens: finiteCount(usage.cache_read_input_tokens),
|
|
103
|
+
cachedWriteTokens: finiteCount(usage.cache_creation_input_tokens),
|
|
104
|
+
};
|
|
105
|
+
return tallyTotal(row) > 0 ? { [key]: row } : {};
|
|
106
|
+
}
|
|
107
|
+
/** Fold `increment` into `base` per model — the per-model counterpart of the
|
|
108
|
+
* `+=` the turn's flat accumulator uses. */
|
|
109
|
+
export function addModelUsage(base, increment) {
|
|
110
|
+
const merged = { ...base };
|
|
111
|
+
for (const [model, usage] of Object.entries(increment)) {
|
|
112
|
+
const existing = merged[model];
|
|
113
|
+
merged[model] = existing
|
|
114
|
+
? {
|
|
115
|
+
inputTokens: existing.inputTokens + usage.inputTokens,
|
|
116
|
+
outputTokens: existing.outputTokens + usage.outputTokens,
|
|
117
|
+
cachedReadTokens: existing.cachedReadTokens + usage.cachedReadTokens,
|
|
118
|
+
cachedWriteTokens: existing.cachedWriteTokens + usage.cachedWriteTokens,
|
|
119
|
+
}
|
|
120
|
+
: usage;
|
|
121
|
+
}
|
|
122
|
+
return merged;
|
|
123
|
+
}
|
|
124
|
+
/** Sum all four fields as a proxy for post-turn context occupancy: the current
|
|
125
|
+
* turn's output becomes next turn's input. Per the Anthropic API, input_tokens
|
|
126
|
+
* excludes cache tokens — cache_read and cache_creation are reported
|
|
127
|
+
* separately — so summing all four is not double-counting. */
|
|
128
|
+
export function totalTokens(usage) {
|
|
129
|
+
return (usage.input_tokens +
|
|
130
|
+
usage.output_tokens +
|
|
131
|
+
usage.cache_read_input_tokens +
|
|
132
|
+
usage.cache_creation_input_tokens);
|
|
133
|
+
}
|
|
134
|
+
/** Project a nullable API usage object into our non-null snapshot shape.
|
|
135
|
+
* Both SDK message_start and assistant message `usage` have `number | null`
|
|
136
|
+
* cache fields; we coerce absent values to 0 so `totalTokens` never hits
|
|
137
|
+
* NaN. `input_tokens`/`output_tokens` are typed `number` by the SDK but
|
|
138
|
+
* synthetic or third-party-backend stream events have been observed emitting
|
|
139
|
+
* them as null/undefined — coerce those too so a malformed upstream event
|
|
140
|
+
* can't leak NaN into the wire `used` field. Delta events have different
|
|
141
|
+
* semantics (cumulative + prev fallback) and are handled inline. */
|
|
142
|
+
export function snapshotFromUsage(usage) {
|
|
143
|
+
return {
|
|
144
|
+
input_tokens: usage.input_tokens ?? 0,
|
|
145
|
+
output_tokens: usage.output_tokens ?? 0,
|
|
146
|
+
cache_read_input_tokens: usage.cache_read_input_tokens ?? 0,
|
|
147
|
+
cache_creation_input_tokens: usage.cache_creation_input_tokens ?? 0,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function commonPrefixLength(a, b) {
|
|
151
|
+
let i = 0;
|
|
152
|
+
while (i < a.length && i < b.length && a[i] === b[i]) {
|
|
153
|
+
i++;
|
|
154
|
+
}
|
|
155
|
+
return i;
|
|
156
|
+
}
|
|
157
|
+
/** Best-effort first guess of a model's context window, used to seed the
|
|
158
|
+
* window synchronously (via `immediateContextWindow`) until a `result` message
|
|
159
|
+
* arrives with the authoritative `modelUsage` value.
|
|
160
|
+
*
|
|
161
|
+
* Anthropic 1M-context variants encode "1m" as a distinct token in the SDK
|
|
162
|
+
* model ID (e.g., "claude-opus-4-6-1m"), which `\b1m\b` catches without also
|
|
163
|
+
* matching things like "10m" or embedded substrings. Semantic aliases like
|
|
164
|
+
* `default` carry no such token in the ID, but their `resolvedModel` and the
|
|
165
|
+
* SDK's human-facing `displayName`/`description` can (e.g.
|
|
166
|
+
* "claude-opus-4-8[1m]", "Opus 4.7 (1M context)"), so callers pass those too.
|
|
167
|
+
* This text scan can't catch every model — some resolve to extended-context
|
|
168
|
+
* models with no "1m" anywhere (e.g. `sonnet` → claude-sonnet-5, natively
|
|
169
|
+
* ~1M). Such a miss falls back to the default window, is refined by the
|
|
170
|
+
* background `getContextUsage` (`refreshContextWindowInBackground`), and is
|
|
171
|
+
* corrected by `result.modelUsage` (and cached) within one turn. */
|
|
172
|
+
export function inferContextWindowFromModel(...texts) {
|
|
173
|
+
if (texts.some((text) => text != null && /\b1m\b/i.test(text)))
|
|
174
|
+
return 1_000_000;
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
export function getMatchingModelUsage(modelUsage, currentModel) {
|
|
178
|
+
let bestKey = null;
|
|
179
|
+
let bestLen = 0;
|
|
180
|
+
for (const key of Object.keys(modelUsage)) {
|
|
181
|
+
const len = commonPrefixLength(key, currentModel);
|
|
182
|
+
if (len > bestLen) {
|
|
183
|
+
bestLen = len;
|
|
184
|
+
bestKey = key;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (bestKey) {
|
|
188
|
+
// `bestKey` is the SDK's resolved model id (e.g. "claude-sonnet-5[1m]"),
|
|
189
|
+
// the same spelling as ModelInfo.resolvedModel — the primary key the
|
|
190
|
+
// window is cached under. `currentModel` (the assistant message's
|
|
191
|
+
// `.model`) can be the bare form (e.g. "claude-sonnet-5"); the result
|
|
192
|
+
// handler caches under that spelling too, for seed-time reads that fall
|
|
193
|
+
// back to a bare id (rows without `resolvedModel`).
|
|
194
|
+
return { key: bestKey, usage: modelUsage[bestKey] };
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text and thinking of an assistant message that streamed live as
|
|
3
|
+
* deltas, and what its consolidated message adds to them. Shared by the v1
|
|
4
|
+
* core and the v2 core.
|
|
5
|
+
*/
|
|
6
|
+
import type { SDKPartialAssistantMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
7
|
+
/** Text or thinking that streamed live as deltas, accumulated per block. */
|
|
8
|
+
export type StreamedBlock = {
|
|
9
|
+
index: number;
|
|
10
|
+
type: "text" | "thinking";
|
|
11
|
+
text: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Records the text or thinking that `event` streamed in `streamedBlocks`.
|
|
15
|
+
* Contiguous deltas of the same block (same index and type) extend the
|
|
16
|
+
* current entry; anything else opens a new one. Other events change nothing.
|
|
17
|
+
*/
|
|
18
|
+
export declare function recordStreamedDelta(streamedBlocks: StreamedBlock[], event: SDKPartialAssistantMessage["event"]): void;
|
|
19
|
+
/**
|
|
20
|
+
* The blocks of a consolidated assistant message without the text that
|
|
21
|
+
* already streamed as deltas.
|
|
22
|
+
*
|
|
23
|
+
* Each assembled text/thinking block is diffed against the streamed blocks in
|
|
24
|
+
* document order: nothing is left if it streamed in full (the common case),
|
|
25
|
+
* the whole block if it never streamed (a non-streaming gateway), and just the
|
|
26
|
+
* tail if the stream was cut short mid-block. Matching on content rather than
|
|
27
|
+
* the message id keeps the dedupe robust for gateways without a stable id.
|
|
28
|
+
* Tool-use and other blocks pass through untouched.
|
|
29
|
+
*/
|
|
30
|
+
export declare function unstreamedRemainder<Block extends {
|
|
31
|
+
type: string;
|
|
32
|
+
}>(blocks: Block[], streamedBlocks: StreamedBlock[]): Block[];
|
|
33
|
+
//# sourceMappingURL=streamed-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamed-text.d.ts","sourceRoot":"","sources":["../src/streamed-text.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAEjF,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvF;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,aAAa,EAAE,EAC/B,KAAK,EAAE,0BAA0B,CAAC,OAAO,CAAC,GACzC,IAAI,CAoBN;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAChE,MAAM,EAAE,KAAK,EAAE,EACf,cAAc,EAAE,aAAa,EAAE,GAC9B,KAAK,EAAE,CA+BT"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Records the text or thinking that `event` streamed in `streamedBlocks`.
|
|
3
|
+
* Contiguous deltas of the same block (same index and type) extend the
|
|
4
|
+
* current entry; anything else opens a new one. Other events change nothing.
|
|
5
|
+
*/
|
|
6
|
+
export function recordStreamedDelta(streamedBlocks, event) {
|
|
7
|
+
if (event.type !== "content_block_delta")
|
|
8
|
+
return;
|
|
9
|
+
const delta = event.delta;
|
|
10
|
+
const chunk = delta.type === "text_delta"
|
|
11
|
+
? { type: "text", text: delta.text }
|
|
12
|
+
: delta.type === "thinking_delta"
|
|
13
|
+
? { type: "thinking", text: delta.thinking }
|
|
14
|
+
: undefined;
|
|
15
|
+
// Skip empty deltas (some gateways emit empty thinking chunks — #793):
|
|
16
|
+
// appending "" is a no-op, but pushing a "" entry would create a block the
|
|
17
|
+
// `text.length > 0` guard of `unstreamedRemainder` can never consume,
|
|
18
|
+
// stalling the diff cursor and re-emitting the next block as a duplicate.
|
|
19
|
+
if (!chunk?.text)
|
|
20
|
+
return;
|
|
21
|
+
const last = streamedBlocks[streamedBlocks.length - 1];
|
|
22
|
+
if (last && last.index === event.index && last.type === chunk.type) {
|
|
23
|
+
last.text += chunk.text;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
streamedBlocks.push({ index: event.index, type: chunk.type, text: chunk.text });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The blocks of a consolidated assistant message without the text that
|
|
31
|
+
* already streamed as deltas.
|
|
32
|
+
*
|
|
33
|
+
* Each assembled text/thinking block is diffed against the streamed blocks in
|
|
34
|
+
* document order: nothing is left if it streamed in full (the common case),
|
|
35
|
+
* the whole block if it never streamed (a non-streaming gateway), and just the
|
|
36
|
+
* tail if the stream was cut short mid-block. Matching on content rather than
|
|
37
|
+
* the message id keeps the dedupe robust for gateways without a stable id.
|
|
38
|
+
* Tool-use and other blocks pass through untouched.
|
|
39
|
+
*/
|
|
40
|
+
export function unstreamedRemainder(blocks, streamedBlocks) {
|
|
41
|
+
const kept = [];
|
|
42
|
+
let streamPos = 0;
|
|
43
|
+
for (const item of blocks) {
|
|
44
|
+
if (item.type !== "text" && item.type !== "thinking") {
|
|
45
|
+
kept.push(item);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const block = item;
|
|
49
|
+
const full = (item.type === "text" ? block.text : block.thinking) ?? "";
|
|
50
|
+
// Empty assembled blocks carry nothing: drop them.
|
|
51
|
+
if (full.length === 0)
|
|
52
|
+
continue;
|
|
53
|
+
// A streamed block of the same type whose text is a prefix of this one
|
|
54
|
+
// was already delivered, at least partly. A non-empty streamed text is
|
|
55
|
+
// required so an empty or aborted streamed block does not swallow it.
|
|
56
|
+
const streamed = streamedBlocks[streamPos];
|
|
57
|
+
if (streamed &&
|
|
58
|
+
streamed.type === item.type &&
|
|
59
|
+
streamed.text.length > 0 &&
|
|
60
|
+
full.startsWith(streamed.text)) {
|
|
61
|
+
streamPos++;
|
|
62
|
+
const remainder = full.slice(streamed.text.length);
|
|
63
|
+
if (remainder.length === 0)
|
|
64
|
+
continue;
|
|
65
|
+
kept.push({ ...item, [item.type === "text" ? "text" : "thinking"]: remainder });
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
kept.push(item);
|
|
69
|
+
}
|
|
70
|
+
return kept;
|
|
71
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The configuration of a subagent's session, as its hooks report it. Both
|
|
3
|
+
* the v1 core (`ClaudeAcpAgent.subagentConfigurationHook`, for both forms of
|
|
4
|
+
* subagent sessions) and the v2 core (`v2/child-config.ts`)
|
|
5
|
+
* build a child's config options with these.
|
|
6
|
+
*/
|
|
7
|
+
import type { SessionConfigOption, SessionModeState } from "@agentclientprotocol/sdk/unstable";
|
|
8
|
+
import type { AgentInfo, HookInput } from "@anthropic-ai/claude-agent-sdk";
|
|
9
|
+
import { type SubagentModels } from "./native-subagents.js";
|
|
10
|
+
/** What the root session knows that a child's options name. */
|
|
11
|
+
export type SubagentConfigurationContext = {
|
|
12
|
+
/** The root session's modes, for the name of the child's mode. */
|
|
13
|
+
availableModes: SessionModeState["availableModes"];
|
|
14
|
+
/** The root session's `model` entries, for the child's model. */
|
|
15
|
+
models: SubagentModels | undefined;
|
|
16
|
+
/** The custom agents of the session, for the description of the child's agent type. */
|
|
17
|
+
agents: readonly AgentInfo[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The config options that a hook of a subagent (`agent_id`) reports of it:
|
|
21
|
+
* its permission mode, its model after a `PostModelSwitch`, its effort, and
|
|
22
|
+
* its agent type. Each option lists only the child's current value. Empty
|
|
23
|
+
* for a hook of the root session, and for one that reports none of these.
|
|
24
|
+
*/
|
|
25
|
+
export declare function subagentHookOptions(input: HookInput, context: SubagentConfigurationContext): SessionConfigOption[];
|
|
26
|
+
/**
|
|
27
|
+
* A child's configuration, as it goes to the client: every option it holds,
|
|
28
|
+
* the mode first, then the model, the effort and the model config, then the
|
|
29
|
+
* rest in the order they came.
|
|
30
|
+
*/
|
|
31
|
+
export declare function orderedSubagentConfiguration(options: Iterable<SessionConfigOption>): SessionConfigOption[];
|
|
32
|
+
//# sourceMappingURL=subagent-configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent-configuration.d.ts","sourceRoot":"","sources":["../src/subagent-configuration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC/F,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAKlG,+DAA+D;AAC/D,MAAM,MAAM,4BAA4B,GAAG;IACzC,kEAAkE;IAClE,cAAc,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACnD,iEAAiE;IACjE,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC;IACnC,uFAAuF;IACvF,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;CAC9B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,4BAA4B,GACpC,mBAAmB,EAAE,CA+CvB;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GACrC,mBAAmB,EAAE,CAOvB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { childModelOption, responseModelEntry } from "./native-subagents.js";
|
|
2
|
+
import { AGENT_CONFIG_ID, EFFORT_CONFIG_ID } from "./session-config-ids.js";
|
|
3
|
+
import { effortLevelName } from "./session-effort.js";
|
|
4
|
+
import { SessionModeManager } from "./session-mode.js";
|
|
5
|
+
/**
|
|
6
|
+
* The config options that a hook of a subagent (`agent_id`) reports of it:
|
|
7
|
+
* its permission mode, its model after a `PostModelSwitch`, its effort, and
|
|
8
|
+
* its agent type. Each option lists only the child's current value. Empty
|
|
9
|
+
* for a hook of the root session, and for one that reports none of these.
|
|
10
|
+
*/
|
|
11
|
+
export function subagentHookOptions(input, context) {
|
|
12
|
+
if (!input.agent_id)
|
|
13
|
+
return [];
|
|
14
|
+
const options = [];
|
|
15
|
+
if (input.permission_mode) {
|
|
16
|
+
const mode = context.availableModes.find((mode) => mode.id === input.permission_mode);
|
|
17
|
+
options.push(SessionModeManager.configOption({
|
|
18
|
+
currentModeId: input.permission_mode,
|
|
19
|
+
availableModes: [mode ?? { id: input.permission_mode, name: input.permission_mode }],
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
const switchedModel = input.hook_event_name === "PostModelSwitch"
|
|
23
|
+
? responseModelEntry(input.to_model, context.models)
|
|
24
|
+
: undefined;
|
|
25
|
+
// The entry of the root session's `model` option, as for a child response.
|
|
26
|
+
if (switchedModel)
|
|
27
|
+
options.push(childModelOption(switchedModel));
|
|
28
|
+
if (input.effort?.level) {
|
|
29
|
+
options.push({
|
|
30
|
+
id: EFFORT_CONFIG_ID,
|
|
31
|
+
name: "Effort",
|
|
32
|
+
description: "Current reasoning effort",
|
|
33
|
+
category: "thought_level",
|
|
34
|
+
type: "select",
|
|
35
|
+
currentValue: input.effort.level,
|
|
36
|
+
options: [{ value: input.effort.level, name: effortLevelName(input.effort.level) }],
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (input.agent_type) {
|
|
40
|
+
const agent = context.agents.find((agent) => agent.name === input.agent_type);
|
|
41
|
+
options.push({
|
|
42
|
+
id: AGENT_CONFIG_ID,
|
|
43
|
+
name: "Agent",
|
|
44
|
+
description: "Subagent type",
|
|
45
|
+
type: "select",
|
|
46
|
+
currentValue: input.agent_type,
|
|
47
|
+
options: [
|
|
48
|
+
{
|
|
49
|
+
value: input.agent_type,
|
|
50
|
+
name: input.agent_type,
|
|
51
|
+
...(agent?.description ? { description: agent.description } : {}),
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return options;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A child's configuration, as it goes to the client: every option it holds,
|
|
60
|
+
* the mode first, then the model, the effort and the model config, then the
|
|
61
|
+
* rest in the order they came.
|
|
62
|
+
*/
|
|
63
|
+
export function orderedSubagentConfiguration(options) {
|
|
64
|
+
const priority = ["mode", "model", "thought_level", "model_config"];
|
|
65
|
+
const rank = (option) => {
|
|
66
|
+
const index = priority.indexOf(option.category ?? "");
|
|
67
|
+
return index < 0 ? priority.length : index;
|
|
68
|
+
};
|
|
69
|
+
return [...options].sort((left, right) => rank(left) - rank(right));
|
|
70
|
+
}
|
|
@@ -198,5 +198,23 @@ export declare function firstResponseModel(messages: readonly SessionMessage[]):
|
|
|
198
198
|
* names a stop is a cancellation, any other error a failure.
|
|
199
199
|
*/
|
|
200
200
|
export declare function replaySubagentTerminalState(block: Record<string, unknown>): "completed" | "failed" | "cancelled";
|
|
201
|
+
/** A message that a SendMessage call delivered to the child. */
|
|
202
|
+
export declare function isDelivery(message: SessionMessage): boolean;
|
|
203
|
+
/**
|
|
204
|
+
* The SendMessage call of `calls` that a delivered message `text` came from,
|
|
205
|
+
* for the child that `names` names (its agent id, its name). Claude Code
|
|
206
|
+
* frames the message for the child's model ("The coordinator sent a message
|
|
207
|
+
* while you were working:", then the message, then an instruction), so it is
|
|
208
|
+
* the first undelivered call to the child whose message the text contains.
|
|
209
|
+
*/
|
|
210
|
+
export declare function deliveredCall<T extends {
|
|
211
|
+
to: string;
|
|
212
|
+
message: string;
|
|
213
|
+
recipientSessionId?: string;
|
|
214
|
+
}>(calls: readonly T[], names: readonly unknown[], text: string): T | undefined;
|
|
215
|
+
/** The notice that the history of `missing` subagents of a replayed session is not available. */
|
|
216
|
+
export declare function missingHistoryNotice(missing: number): Extract<AcpSessionNotification["update"], {
|
|
217
|
+
sessionUpdate: "notice";
|
|
218
|
+
}>;
|
|
201
219
|
export {};
|
|
202
220
|
//# sourceMappingURL=subagent-replay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent-replay.d.ts","sourceRoot":"","sources":["../src/subagent-replay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,KAAK,EA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B,OAAO,CAAC,cAAc;IAwBtB,4FAA4F;YAC9E,UAAU;IAYxB;;;;;;;;;;OAUG;YACW,YAAY;YAoBZ,WAAW;CAmB1B;AAED,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,GAAG,SAAS,CAO1F;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,WAAW,GAAG,QAAQ,GAAG,WAAW,CAMtC;AA4DD,gEAAgE;AAChE,wBAAgB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAE3D;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,EACtE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAO7E;AAED,iGAAiG;AACjG,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,EAAE;IAAE,aAAa,EAAE,QAAQ,CAAA;CAAE,CAAC,CASxE"}
|
package/dist/subagent-replay.js
CHANGED
|
@@ -264,16 +264,7 @@ export class RfdSubagentReplay {
|
|
|
264
264
|
}
|
|
265
265
|
const missing = this.omitted.size + this.withoutHistory;
|
|
266
266
|
if (missing > 0 && supportsNotices) {
|
|
267
|
-
await this.publish({
|
|
268
|
-
sessionId: rootSessionId,
|
|
269
|
-
update: noticeUpdate({
|
|
270
|
-
severity: "info",
|
|
271
|
-
title: "Some subagent history is not available",
|
|
272
|
-
description: missing === 1
|
|
273
|
-
? "The history of 1 subagent of this session could not be restored."
|
|
274
|
-
: `The history of ${missing} subagents of this session could not be restored.`,
|
|
275
|
-
}),
|
|
276
|
-
});
|
|
267
|
+
await this.publish({ sessionId: rootSessionId, update: missingHistoryNotice(missing) });
|
|
277
268
|
}
|
|
278
269
|
}
|
|
279
270
|
/**
|
|
@@ -364,10 +355,7 @@ export class RfdSubagentReplay {
|
|
|
364
355
|
* call (see {@link toolCallUpdate}).
|
|
365
356
|
*/
|
|
366
357
|
async sendDelivery(child, message, text) {
|
|
367
|
-
const
|
|
368
|
-
const call = this.sendMessages.find((candidate) => candidate.recipientSessionId === undefined &&
|
|
369
|
-
names.includes(candidate.to) &&
|
|
370
|
-
text.includes(candidate.message.trim()));
|
|
358
|
+
const call = deliveredCall(this.sendMessages, [child.sessionId, child.record.name, child.input.name], text);
|
|
371
359
|
if (call) {
|
|
372
360
|
call.recipientSessionId = child.sessionId;
|
|
373
361
|
await this.sendMessage(child, call.toolUseId, call.message, call.senderSessionId, {
|
|
@@ -470,6 +458,28 @@ function isDirectory(dir) {
|
|
|
470
458
|
}
|
|
471
459
|
}
|
|
472
460
|
/** A message that a SendMessage call delivered to the child. */
|
|
473
|
-
function isDelivery(message) {
|
|
461
|
+
export function isDelivery(message) {
|
|
474
462
|
return message.origin?.kind === "coordinator";
|
|
475
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* The SendMessage call of `calls` that a delivered message `text` came from,
|
|
466
|
+
* for the child that `names` names (its agent id, its name). Claude Code
|
|
467
|
+
* frames the message for the child's model ("The coordinator sent a message
|
|
468
|
+
* while you were working:", then the message, then an instruction), so it is
|
|
469
|
+
* the first undelivered call to the child whose message the text contains.
|
|
470
|
+
*/
|
|
471
|
+
export function deliveredCall(calls, names, text) {
|
|
472
|
+
return calls.find((call) => call.recipientSessionId === undefined &&
|
|
473
|
+
names.includes(call.to) &&
|
|
474
|
+
text.includes(call.message.trim()));
|
|
475
|
+
}
|
|
476
|
+
/** The notice that the history of `missing` subagents of a replayed session is not available. */
|
|
477
|
+
export function missingHistoryNotice(missing) {
|
|
478
|
+
return noticeUpdate({
|
|
479
|
+
severity: "info",
|
|
480
|
+
title: "Some subagent history is not available",
|
|
481
|
+
description: missing === 1
|
|
482
|
+
? "The history of 1 subagent of this session could not be restored."
|
|
483
|
+
: `The history of ${missing} subagents of this session could not be restored.`,
|
|
484
|
+
});
|
|
485
|
+
}
|
|
@@ -18,10 +18,10 @@ export declare class ClientCapabilities {
|
|
|
18
18
|
readonly air: AirCapabilities;
|
|
19
19
|
/**
|
|
20
20
|
* The client speaks ACP v2. Its diffs carry structured `changes` and an
|
|
21
|
-
* optional git patch, which a v1 diff cannot express. Only the v2
|
|
22
|
-
* sets this, never the capabilities that a client
|
|
23
|
-
* takes the terminal extension (`terminalOutput`),
|
|
24
|
-
* sends as display terminals.
|
|
21
|
+
* optional git patch, which a v1 diff cannot express. Only the v2 core
|
|
22
|
+
* (`src/v2/`) sets this, never the capabilities that a client
|
|
23
|
+
* sends. A v2 client also takes the terminal extension (`terminalOutput`),
|
|
24
|
+
* which the v2 core sends as display terminals.
|
|
25
25
|
*/
|
|
26
26
|
readonly v2: boolean;
|
|
27
27
|
constructor(
|
|
@@ -35,10 +35,10 @@ export declare class ClientCapabilities {
|
|
|
35
35
|
air?: AirCapabilities,
|
|
36
36
|
/**
|
|
37
37
|
* The client speaks ACP v2. Its diffs carry structured `changes` and an
|
|
38
|
-
* optional git patch, which a v1 diff cannot express. Only the v2
|
|
39
|
-
* sets this, never the capabilities that a client
|
|
40
|
-
* takes the terminal extension (`terminalOutput`),
|
|
41
|
-
* sends as display terminals.
|
|
38
|
+
* optional git patch, which a v1 diff cannot express. Only the v2 core
|
|
39
|
+
* (`src/v2/`) sets this, never the capabilities that a client
|
|
40
|
+
* sends. A v2 client also takes the terminal extension (`terminalOutput`),
|
|
41
|
+
* which the v2 core sends as display terminals.
|
|
42
42
|
*/
|
|
43
43
|
v2?: boolean);
|
|
44
44
|
static from(capabilities: AcpClientCapabilities | null | undefined, { v2 }?: {
|
|
@@ -24,10 +24,10 @@ export class ClientCapabilities {
|
|
|
24
24
|
air = NO_AIR,
|
|
25
25
|
/**
|
|
26
26
|
* The client speaks ACP v2. Its diffs carry structured `changes` and an
|
|
27
|
-
* optional git patch, which a v1 diff cannot express. Only the v2
|
|
28
|
-
* sets this, never the capabilities that a client
|
|
29
|
-
* takes the terminal extension (`terminalOutput`),
|
|
30
|
-
* sends as display terminals.
|
|
27
|
+
* optional git patch, which a v1 diff cannot express. Only the v2 core
|
|
28
|
+
* (`src/v2/`) sets this, never the capabilities that a client
|
|
29
|
+
* sends. A v2 client also takes the terminal extension (`terminalOutput`),
|
|
30
|
+
* which the v2 core sends as display terminals.
|
|
31
31
|
*/
|
|
32
32
|
v2 = false) {
|
|
33
33
|
this.terminalOutput = terminalOutput;
|
|
@@ -4,13 +4,12 @@ import { ClientCapabilities } from "./client-capabilities.js";
|
|
|
4
4
|
import type { ToolResultContext, ToolResultFacts, ToolUse, ToolUseFacts } from "./facts.js";
|
|
5
5
|
export type ToolCallUpdate = SessionNotification["update"];
|
|
6
6
|
/**
|
|
7
|
-
* ACP v2's `cancelled`
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* ACP v2's `cancelled` tool call status. v1's statuses have no such value, and
|
|
8
|
+
* the shared mapping builds its reports in v1 types, so it travels as a v1
|
|
9
|
+
* status. Only a v2 client gets it, and the v2 core sends it as it is
|
|
10
|
+
* (`src/v2/tool-call.ts`).
|
|
11
11
|
*/
|
|
12
12
|
export declare const V2_CANCELLED: ToolCallStatus;
|
|
13
|
-
export declare const V2_PAUSED: ToolCallStatus;
|
|
14
13
|
/** Whether `status` ends a tool call: `completed`, `failed`, or, on v2, `cancelled`. */
|
|
15
14
|
export declare function isFinalToolCallStatus(status: ToolCallStatus | null | undefined): boolean;
|
|
16
15
|
/** The `_meta` of a tool call report. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/tool-calls/renderer.ts"],"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AAC,cAAc,EAAE,eAAe,CAAC,GAAG,SAAS;IAWjF;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,GAAG,cAAc;IAsBlB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO;IAgBzD;;;;OAIG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,eAAe,EAAE;IAS1E;;;;;OAKG;IACH,WAAW,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,cAAc;CA2BtF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAStF"}
|
|
@@ -10,13 +10,12 @@ import { grepPath } from "./reporters/search.js";
|
|
|
10
10
|
/** The id suffix of the call that clears the plan file of an approved plan for AIR. */
|
|
11
11
|
const PLAN_FILE_CLEAR_SUFFIX = ":plan-file-clear";
|
|
12
12
|
/**
|
|
13
|
-
* ACP v2's `cancelled`
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* ACP v2's `cancelled` tool call status. v1's statuses have no such value, and
|
|
14
|
+
* the shared mapping builds its reports in v1 types, so it travels as a v1
|
|
15
|
+
* status. Only a v2 client gets it, and the v2 core sends it as it is
|
|
16
|
+
* (`src/v2/tool-call.ts`).
|
|
17
17
|
*/
|
|
18
18
|
export const V2_CANCELLED = "cancelled";
|
|
19
|
-
export const V2_PAUSED = "paused";
|
|
20
19
|
/** Whether `status` ends a tool call: `completed`, `failed`, or, on v2, `cancelled`. */
|
|
21
20
|
export function isFinalToolCallStatus(status) {
|
|
22
21
|
return status === "completed" || status === "failed" || status === V2_CANCELLED;
|