@lucascouts/claude-agent-acp-plus 0.3.0 → 0.5.0
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 +1 -1
- package/dist/acp-agent.d.ts +455 -19
- package/dist/acp-agent.d.ts.map +1 -1
- package/dist/acp-agent.js +2143 -415
- package/dist/elicitation.d.ts.map +1 -1
- package/dist/elicitation.js +13 -0
- package/dist/model-deprecation.d.ts +1 -1
- package/dist/model-deprecation.d.ts.map +1 -1
- package/dist/model-deprecation.js +9 -4
- package/dist/rewind-command.d.ts +15 -3
- package/dist/rewind-command.d.ts.map +1 -1
- package/dist/rewind-command.js +37 -6
- package/dist/thinking-option.d.ts +12 -8
- package/dist/thinking-option.d.ts.map +1 -1
- package/dist/thinking-option.js +12 -8
- package/dist/tools.d.ts +2 -3
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +258 -16
- package/package.json +9 -6
- package/dist/ask-user-question-fallback.d.ts +0 -78
- package/dist/ask-user-question-fallback.d.ts.map +0 -1
- package/dist/ask-user-question-fallback.js +0 -104
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elicitation.d.ts","sourceRoot":"","sources":["../src/elicitation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EACV,wBAAwB,EAKzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,6CAA6C,CAAC;AAErD;;;;;;;;;;;;;GAaG;AAEH,yDAAyD;AACzD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;CACd,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,kBAAkB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CustomFieldKey(index) {
|
|
|
89
89
|
* extensions (`_claude/...`).
|
|
90
90
|
*/
|
|
91
91
|
const OPTION_META_KEY = "_claude/askUserQuestionOption";
|
|
92
|
+
/**
|
|
93
|
+
* Shared `_meta` key for marking a per-question free-text field as the custom
|
|
94
|
+
* answer companion for a select question. This intentionally has no
|
|
95
|
+
* agent-specific namespace so ACP clients can recognize the same marker across
|
|
96
|
+
* Codex, Claude, and other AskUserQuestion bridges.
|
|
97
|
+
*/
|
|
98
|
+
const CUSTOM_ANSWER_META_KEY = "_askUserQuestionCustomAnswer";
|
|
92
99
|
/**
|
|
93
100
|
* Render the AskUserQuestion tool's questions as an ACP form elicitation.
|
|
94
101
|
*
|
|
@@ -137,6 +144,12 @@ export function askUserQuestionsToCreateRequest(questions, sessionId, toolCallId
|
|
|
137
144
|
type: "string",
|
|
138
145
|
title: "Other",
|
|
139
146
|
description: "Type your own answer instead of choosing an option above (optional).",
|
|
147
|
+
_meta: {
|
|
148
|
+
[CUSTOM_ANSWER_META_KEY]: {
|
|
149
|
+
questionId: questionFieldKey(index),
|
|
150
|
+
isCustomAnswer: true,
|
|
151
|
+
},
|
|
152
|
+
},
|
|
140
153
|
};
|
|
141
154
|
});
|
|
142
155
|
const requestedSchema = {
|
|
@@ -8,7 +8,7 @@ import type { ModelInfo } from "@anthropic-ai/claude-agent-sdk";
|
|
|
8
8
|
* `undefined`, or empty `displayName` or `description` is treated as an empty
|
|
9
9
|
* string, so this never throws.
|
|
10
10
|
*
|
|
11
|
-
* See the module doc for WHY this is a heuristic (SDK 0.3.
|
|
11
|
+
* See the module doc for WHY this is a heuristic (SDK 0.3.220 `ModelInfo` has no
|
|
12
12
|
* deprecation field).
|
|
13
13
|
*
|
|
14
14
|
* @param info - A single SDK model row.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-deprecation.d.ts","sourceRoot":"","sources":["../src/model-deprecation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"model-deprecation.d.ts","sourceRoot":"","sources":["../src/model-deprecation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAiChE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAI1D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAEtE"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Model deprecation heuristic.
|
|
3
3
|
*
|
|
4
|
-
* The Claude Agent SDK's `ModelInfo`
|
|
5
|
-
*
|
|
6
|
-
* `supportsAdaptiveThinking`, `supportsFastMode`, and `supportsAutoMode
|
|
4
|
+
* The Claude Agent SDK's `ModelInfo` exposes NO deprecation flag — its only
|
|
5
|
+
* capability fields are `supportsEffort` / `supportedEffortLevels`,
|
|
6
|
+
* `supportsAdaptiveThinking`, `supportsFastMode`, and `supportsAutoMode`
|
|
7
|
+
* (`resolvedModel` is an alias-resolution hint, not a lifecycle signal). There
|
|
7
8
|
* is therefore no authoritative, machine-readable signal telling a host that a
|
|
8
9
|
* model row has been retired.
|
|
9
10
|
*
|
|
11
|
+
* LAST VERIFIED AGAINST SDK 0.3.220 (story 008, R5.5) — the type is byte-for-byte
|
|
12
|
+
* unchanged from 0.3.204/0.3.212, so the heuristic below is still necessary.
|
|
13
|
+
* Re-check this claim on every SDK bump and update the version named here.
|
|
14
|
+
*
|
|
10
15
|
* As a stand-in this module scans the human-facing copy — `displayName` and
|
|
11
16
|
* `description` — for the words "deprecated" or "legacy" (case-insensitive).
|
|
12
17
|
* This is deliberately a HEURISTIC: it can only catch models the SDK happens to
|
|
@@ -31,7 +36,7 @@ const DEPRECATION_MARKER = /deprecated|legacy/i;
|
|
|
31
36
|
* `undefined`, or empty `displayName` or `description` is treated as an empty
|
|
32
37
|
* string, so this never throws.
|
|
33
38
|
*
|
|
34
|
-
* See the module doc for WHY this is a heuristic (SDK 0.3.
|
|
39
|
+
* See the module doc for WHY this is a heuristic (SDK 0.3.220 `ModelInfo` has no
|
|
35
40
|
* deprecation field).
|
|
36
41
|
*
|
|
37
42
|
* @param info - A single SDK model row.
|
package/dist/rewind-command.d.ts
CHANGED
|
@@ -75,11 +75,21 @@ export declare function listCheckpoints(messages: SDKMessage[]): Checkpoint[];
|
|
|
75
75
|
export declare function formatCheckpointList(cps: Checkpoint[]): string;
|
|
76
76
|
/**
|
|
77
77
|
* Confirm a completed rewind, naming the checkpoint that was restored by its
|
|
78
|
-
* index and excerpt (R3.4).
|
|
78
|
+
* index and excerpt (R3.4). When the SDK reports files it refused to touch for
|
|
79
|
+
* link safety, the confirmation is qualified with their count (R1.1) in the
|
|
80
|
+
* grammatical number that count calls for (R1.4), so the sentence cannot claim
|
|
81
|
+
* a clean success the rewind did not have.
|
|
82
|
+
*
|
|
83
|
+
* The unqualified sentence is unchanged character for character: an absent,
|
|
84
|
+
* zero, negative or non-numeric count returns exactly what this function
|
|
85
|
+
* returned before the qualifier existed (R1.2). The SDK exposes a COUNT only,
|
|
86
|
+
* never the refused paths, so the message deliberately names no files.
|
|
79
87
|
*
|
|
80
88
|
* @param cp The checkpoint whose files were restored.
|
|
89
|
+
* @param skippedLinks How many tracked files the SDK left unchanged for link
|
|
90
|
+
* safety (`RewindFilesResult.skippedLinks`); omit or pass 0 when none were.
|
|
81
91
|
*/
|
|
82
|
-
export declare function formatRewindResult(cp: Checkpoint): string;
|
|
92
|
+
export declare function formatRewindResult(cp: Checkpoint, skippedLinks?: number): string;
|
|
83
93
|
/**
|
|
84
94
|
* Build a `/rewind` usage/error message. Always names the `/rewind` command and,
|
|
85
95
|
* when at least one checkpoint exists, the valid index range (R3.5). An optional
|
|
@@ -122,7 +132,9 @@ export interface RewindDeps {
|
|
|
122
132
|
* nothing-to-rewind notice). `restore` fetches + rebuilds the list, validates
|
|
123
133
|
* the requested index, and on a hit calls `query.rewindFiles` with the tracked
|
|
124
134
|
* uuid inside a try/catch — a rejection (or a `canRewind: false` result) is
|
|
125
|
-
* reported via {@link formatRewindError} and never claims success.
|
|
135
|
+
* reported via {@link formatRewindError} and never claims success. A success
|
|
136
|
+
* that refused files for link safety carries that count into the confirmation
|
|
137
|
+
* (R1.1), so a partial rewind is not reported as a whole one. An `invalid`
|
|
126
138
|
* invocation, an out-of-range index, or a failed transcript read each emit an
|
|
127
139
|
* error and leave files untouched (`rewindFiles` is never called); the
|
|
128
140
|
* `invalid` path still reads the transcript so its usage message can name the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewind-command.d.ts","sourceRoot":"","sources":["../src/rewind-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAMpF,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1E,uFAAuF;AACvF,MAAM,MAAM,gBAAgB,GAC1B;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3F;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAkBjF;AAkED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CA4BpE;AAED;;;;;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ACzB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,MAAM,EAAE;QACN,aAAa,CAAC,YAAY,EAAE;YAC1B,SAAS,EAAE,MAAM,CAAC;YAClB,MAAM,EAAE;gBAAE,aAAa,EAAE,qBAAqB,CAAC;gBAAC,OAAO,EAAE;oBAAE,IAAI,EAAE,MAAM,CAAC;oBAAC,IAAI,EAAE,MAAM,CAAA;iBAAE,CAAA;aAAE,CAAC;SAC3F,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KACnB,CAAC;IACF,oDAAoD;IACpD,KAAK,EAAE;QAAE,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;KAAE,CAAC;IAC1E,sEAAsE;IACtE,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;CAC9D;AAqBD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,gBAAgB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAkEf"}
|
package/dist/rewind-command.js
CHANGED
|
@@ -170,12 +170,37 @@ export function formatCheckpointList(cps) {
|
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
172
172
|
* Confirm a completed rewind, naming the checkpoint that was restored by its
|
|
173
|
-
* index and excerpt (R3.4).
|
|
173
|
+
* index and excerpt (R3.4). When the SDK reports files it refused to touch for
|
|
174
|
+
* link safety, the confirmation is qualified with their count (R1.1) in the
|
|
175
|
+
* grammatical number that count calls for (R1.4), so the sentence cannot claim
|
|
176
|
+
* a clean success the rewind did not have.
|
|
177
|
+
*
|
|
178
|
+
* The unqualified sentence is unchanged character for character: an absent,
|
|
179
|
+
* zero, negative or non-numeric count returns exactly what this function
|
|
180
|
+
* returned before the qualifier existed (R1.2). The SDK exposes a COUNT only,
|
|
181
|
+
* never the refused paths, so the message deliberately names no files.
|
|
174
182
|
*
|
|
175
183
|
* @param cp The checkpoint whose files were restored.
|
|
184
|
+
* @param skippedLinks How many tracked files the SDK left unchanged for link
|
|
185
|
+
* safety (`RewindFilesResult.skippedLinks`); omit or pass 0 when none were.
|
|
176
186
|
*/
|
|
177
|
-
export function formatRewindResult(cp) {
|
|
178
|
-
|
|
187
|
+
export function formatRewindResult(cp, skippedLinks) {
|
|
188
|
+
const confirmation = `Rewound files to checkpoint ${cp.index}: "${cp.excerpt}".`;
|
|
189
|
+
// Type AND value are checked: the SDK field is optional, so `undefined` is
|
|
190
|
+
// the normal path, and testing `> 0` on a number also rejects NaN, which a
|
|
191
|
+
// `typeof` test alone would admit (`typeof NaN === "number"`).
|
|
192
|
+
//
|
|
193
|
+
// It does NOT reject every malformed number: `Infinity` and `0.5` pass this
|
|
194
|
+
// guard and would render as "Infinity files were" / "0.5 files were". The
|
|
195
|
+
// SDK returns an integer count, so those are UNREACHABLE rather than
|
|
196
|
+
// handled — stated plainly because a comment claiming a guarantee it does
|
|
197
|
+
// not deliver is the exact failure this function was changed to fix.
|
|
198
|
+
if (typeof skippedLinks === "number" && skippedLinks > 0) {
|
|
199
|
+
// Subject + verb agree with the count (R1.4): "1 file was", "2 files were".
|
|
200
|
+
const refusal = skippedLinks === 1 ? "1 file was" : `${skippedLinks} files were`;
|
|
201
|
+
return `${confirmation} ${refusal} left unchanged for link safety.`;
|
|
202
|
+
}
|
|
203
|
+
return confirmation;
|
|
179
204
|
}
|
|
180
205
|
/**
|
|
181
206
|
* Build a `/rewind` usage/error message. Always names the `/rewind` command and,
|
|
@@ -216,7 +241,9 @@ async function emit(deps, text) {
|
|
|
216
241
|
* nothing-to-rewind notice). `restore` fetches + rebuilds the list, validates
|
|
217
242
|
* the requested index, and on a hit calls `query.rewindFiles` with the tracked
|
|
218
243
|
* uuid inside a try/catch — a rejection (or a `canRewind: false` result) is
|
|
219
|
-
* reported via {@link formatRewindError} and never claims success.
|
|
244
|
+
* reported via {@link formatRewindError} and never claims success. A success
|
|
245
|
+
* that refused files for link safety carries that count into the confirmation
|
|
246
|
+
* (R1.1), so a partial rewind is not reported as a whole one. An `invalid`
|
|
220
247
|
* invocation, an out-of-range index, or a failed transcript read each emit an
|
|
221
248
|
* error and leave files untouched (`rewindFiles` is never called); the
|
|
222
249
|
* `invalid` path still reads the transcript so its usage message can name the
|
|
@@ -263,8 +290,12 @@ export async function handleRewindCommand(deps, invocation) {
|
|
|
263
290
|
await emit(deps, formatRewindError(checkpoints.length, `There is no checkpoint ${invocation.index}.`));
|
|
264
291
|
return;
|
|
265
292
|
}
|
|
293
|
+
// Declared out here (same shape as `checkpoints` above) so the confirmation
|
|
294
|
+
// below can read `skippedLinks` off it; the assignment and every early
|
|
295
|
+
// `return` stay inside the try/catch exactly where they were.
|
|
296
|
+
let result;
|
|
266
297
|
try {
|
|
267
|
-
|
|
298
|
+
result = await deps.query.rewindFiles(checkpoint.uuid);
|
|
268
299
|
if (result.canRewind === false) {
|
|
269
300
|
await emit(deps, formatRewindError(checkpoints.length, `Rewind failed: ${result.error ?? "the SDK could not rewind these files"}.`));
|
|
270
301
|
return;
|
|
@@ -274,5 +305,5 @@ export async function handleRewindCommand(deps, invocation) {
|
|
|
274
305
|
await emit(deps, formatRewindError(checkpoints.length, `Rewind failed: ${reasonText(error)}.`));
|
|
275
306
|
return;
|
|
276
307
|
}
|
|
277
|
-
await emit(deps, formatRewindResult(checkpoint));
|
|
308
|
+
await emit(deps, formatRewindResult(checkpoint, result.skippedLinks));
|
|
278
309
|
}
|
|
@@ -5,11 +5,15 @@
|
|
|
5
5
|
* session's thinking intent with the legacy `MAX_THINKING_TOKENS` env
|
|
6
6
|
* resolution into the SDK's `thinking` option.
|
|
7
7
|
*
|
|
8
|
-
* Kept self-contained
|
|
9
|
-
*
|
|
10
|
-
* unit-testable in isolation
|
|
11
|
-
* `
|
|
12
|
-
*
|
|
8
|
+
* Kept self-contained — no import from `acp-agent.ts`; what this module needs
|
|
9
|
+
* from the adapter (a logger, the raw env value) is injected instead, which
|
|
10
|
+
* also leaves the logic unit-testable in isolation. This mirrors the
|
|
11
|
+
* `rewind-command.ts` precedent, likewise isolated from the adapter so it can
|
|
12
|
+
* be unit tested without a live SDK session. The reason is merge cost:
|
|
13
|
+
* `acp-agent.ts` is a ~7,900-line file that changes upstream almost daily, so
|
|
14
|
+
* every coupling to it is paid again at each sync. `acp-agent.ts` wires these
|
|
15
|
+
* helpers into `buildConfigOptions`, `setSessionConfigOption` and query
|
|
16
|
+
* creation.
|
|
13
17
|
*/
|
|
14
18
|
import type { SessionConfigOption } from "@agentclientprotocol/sdk";
|
|
15
19
|
import type { ThinkingConfig } from "@anthropic-ai/claude-agent-sdk";
|
|
@@ -53,9 +57,9 @@ export declare function resolveThinkingSelection(value: unknown): boolean | null
|
|
|
53
57
|
* it); `0` → disabled; a positive integer → a fixed token budget. Anything
|
|
54
58
|
* else is ignored with a logged error, i.e. treated as unset.
|
|
55
59
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
60
|
+
* This is the single source of truth for that translation: `acp-agent.ts`
|
|
61
|
+
* carries no copy of it and reaches it only through `effectiveThinkingConfig`
|
|
62
|
+
* below.
|
|
59
63
|
*
|
|
60
64
|
* @param raw The raw `MAX_THINKING_TOKENS` value (pass
|
|
61
65
|
* `process.env.MAX_THINKING_TOKENS`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thinking-option.d.ts","sourceRoot":"","sources":["../src/thinking-option.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"thinking-option.d.ts","sourceRoot":"","sources":["../src/thinking-option.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAC7C,oDAAoD;AACpD,eAAO,MAAM,WAAW,OAAO,CAAC;AAChC,qDAAqD;AACrD,eAAO,MAAM,YAAY,QAAQ,CAAC;AAGlC;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAClC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACrC;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,mBAAmB,CAahF;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAIvE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,MAAM,EAAE,cAAc,GACrB,cAAc,GAAG,SAAS,CAQ5B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,GAAG,SAAS,EAC3B,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,MAAM,EAAE,cAAc,GACrB,cAAc,GAAG,SAAS,CAI5B"}
|
package/dist/thinking-option.js
CHANGED
|
@@ -5,11 +5,15 @@
|
|
|
5
5
|
* session's thinking intent with the legacy `MAX_THINKING_TOKENS` env
|
|
6
6
|
* resolution into the SDK's `thinking` option.
|
|
7
7
|
*
|
|
8
|
-
* Kept self-contained
|
|
9
|
-
*
|
|
10
|
-
* unit-testable in isolation
|
|
11
|
-
* `
|
|
12
|
-
*
|
|
8
|
+
* Kept self-contained — no import from `acp-agent.ts`; what this module needs
|
|
9
|
+
* from the adapter (a logger, the raw env value) is injected instead, which
|
|
10
|
+
* also leaves the logic unit-testable in isolation. This mirrors the
|
|
11
|
+
* `rewind-command.ts` precedent, likewise isolated from the adapter so it can
|
|
12
|
+
* be unit tested without a live SDK session. The reason is merge cost:
|
|
13
|
+
* `acp-agent.ts` is a ~7,900-line file that changes upstream almost daily, so
|
|
14
|
+
* every coupling to it is paid again at each sync. `acp-agent.ts` wires these
|
|
15
|
+
* helpers into `buildConfigOptions`, `setSessionConfigOption` and query
|
|
16
|
+
* creation.
|
|
13
17
|
*/
|
|
14
18
|
/** Stable id for the Thinking session config option. */
|
|
15
19
|
export const THINKING_CONFIG_ID = "thinking";
|
|
@@ -62,9 +66,9 @@ export function resolveThinkingSelection(value) {
|
|
|
62
66
|
* it); `0` → disabled; a positive integer → a fixed token budget. Anything
|
|
63
67
|
* else is ignored with a logged error, i.e. treated as unset.
|
|
64
68
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
69
|
+
* This is the single source of truth for that translation: `acp-agent.ts`
|
|
70
|
+
* carries no copy of it and reaches it only through `effectiveThinkingConfig`
|
|
71
|
+
* below.
|
|
68
72
|
*
|
|
69
73
|
* @param raw The raw `MAX_THINKING_TOKENS` value (pass
|
|
70
74
|
* `process.env.MAX_THINKING_TOKENS`).
|
package/dist/tools.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { HookCallback } from "@anthropic-ai/claude-agent-sdk";
|
|
|
3
3
|
import { TaskCreateInput, TaskCreateOutput, TaskUpdateInput } from "@anthropic-ai/claude-agent-sdk/sdk-tools.js";
|
|
4
4
|
import { ToolResultBlockParam, WebSearchToolResultBlockParam } from "@anthropic-ai/sdk/resources";
|
|
5
5
|
import { BetaBashCodeExecutionToolResultBlockParam, BetaCodeExecutionToolResultBlockParam, BetaRequestMCPToolResultBlockParam, BetaTextEditorCodeExecutionToolResultBlockParam, BetaToolResultBlockParam, BetaToolSearchToolResultBlockParam, BetaWebFetchToolResultBlockParam, BetaWebSearchToolResultBlockParam } from "@anthropic-ai/sdk/resources/beta.mjs";
|
|
6
|
-
import { Logger } from "./acp-agent.js";
|
|
7
6
|
interface ToolInfo {
|
|
8
7
|
title: string;
|
|
9
8
|
kind: ToolKind;
|
|
@@ -35,7 +34,7 @@ interface ToolUpdate {
|
|
|
35
34
|
*/
|
|
36
35
|
export declare function toDisplayPath(filePath: string, cwd?: string): string;
|
|
37
36
|
export declare function toolInfoFromToolUse(toolUse: any, supportsTerminalOutput?: boolean, cwd?: string): ToolInfo;
|
|
38
|
-
export declare function toolUpdateFromToolResult(toolResult: ToolResultBlockParam | BetaToolResultBlockParam | BetaWebSearchToolResultBlockParam | BetaWebFetchToolResultBlockParam | WebSearchToolResultBlockParam | BetaCodeExecutionToolResultBlockParam | BetaBashCodeExecutionToolResultBlockParam | BetaTextEditorCodeExecutionToolResultBlockParam | BetaRequestMCPToolResultBlockParam | BetaToolSearchToolResultBlockParam, toolUse: any | undefined, supportsTerminalOutput?: boolean): ToolUpdate;
|
|
37
|
+
export declare function toolUpdateFromToolResult(toolResult: ToolResultBlockParam | BetaToolResultBlockParam | BetaWebSearchToolResultBlockParam | BetaWebFetchToolResultBlockParam | WebSearchToolResultBlockParam | BetaCodeExecutionToolResultBlockParam | BetaBashCodeExecutionToolResultBlockParam | BetaTextEditorCodeExecutionToolResultBlockParam | BetaRequestMCPToolResultBlockParam | BetaToolSearchToolResultBlockParam, toolUse: any | undefined, supportsTerminalOutput?: boolean, toolUseResult?: unknown): ToolUpdate;
|
|
39
38
|
export type ClaudePlanEntry = {
|
|
40
39
|
content: string;
|
|
41
40
|
status: "pending" | "in_progress" | "completed";
|
|
@@ -82,7 +81,7 @@ export declare function toolUpdateFromDiffToolResponse(toolResponse: unknown): {
|
|
|
82
81
|
export declare const registerHookCallback: (toolUseID: string, { onPostToolUseHook, }: {
|
|
83
82
|
onPostToolUseHook?: (toolUseID: string, toolInput: unknown, toolResponse: unknown) => Promise<void>;
|
|
84
83
|
}) => void;
|
|
85
|
-
export declare const createPostToolUseHook: (
|
|
84
|
+
export declare const createPostToolUseHook: (options?: {
|
|
86
85
|
onEnterPlanMode?: () => Promise<void>;
|
|
87
86
|
}) => HookCallback;
|
|
88
87
|
/**
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACT,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACT,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAaL,eAAe,EACf,gBAAgB,EAChB,eAAe,EAKhB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAGL,oBAAoB,EAEpB,6BAA6B,EAE9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,yCAAyC,EAGzC,qCAAqC,EAGrC,kCAAkC,EAGlC,+CAA+C,EAI/C,wBAAwB,EACxB,kCAAkC,EAIlC,gCAAgC,EAEhC,iCAAiC,EAClC,MAAM,sCAAsC,CAAC;AA2B9C,UAAU,QAAQ;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAED,UAAU,UAAU;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,KAAK,CAAC,EAAE;QACN,aAAa,CAAC,EAAE;YACd,WAAW,EAAE,MAAM,CAAC;SACrB,CAAC;QACF,eAAe,CAAC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