@agentclientprotocol/claude-agent-acp 0.53.0 → 0.54.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/dist/acp-agent.d.ts +91 -2
- package/dist/acp-agent.d.ts.map +1 -1
- package/dist/acp-agent.js +214 -31
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +17 -0
- package/package.json +7 -7
package/dist/acp-agent.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AuthenticateRequest, CancelNotification, ClientCapabilities, CompleteElicitationNotification, CreateElicitationRequest, CreateElicitationResponse, ForkSessionRequest, ForkSessionResponse, InitializeRequest, InitializeResponse, ListSessionsRequest, ListSessionsResponse, LoadSessionRequest, LoadSessionResponse, LogoutRequest, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse, ReadTextFileRequest, ReadTextFileResponse, RequestPermissionRequest, RequestPermissionResponse, ResumeSessionRequest, ResumeSessionResponse, SessionConfigOption, SessionModeState, SessionNotification, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, SetSessionModeRequest, SetSessionModeResponse, CloseSessionRequest, CloseSessionResponse, DeleteSessionRequest, DeleteSessionResponse, WriteTextFileRequest, WriteTextFileResponse } from "@agentclientprotocol/sdk";
|
|
2
|
-
import { AgentInfo, CanUseTool, ModelInfo, Options, PermissionMode, PermissionUpdate, Query, SDKMessageOrigin, SDKPartialAssistantMessage, SDKUserMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
import { AgentInfo, CanUseTool, FastModeState, ModelInfo, Options, PermissionMode, PermissionUpdate, Query, SDKMessageOrigin, SDKPartialAssistantMessage, SDKUserMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
3
3
|
import { ContentBlockParam } from "@anthropic-ai/sdk/resources";
|
|
4
4
|
import { BetaContentBlock, BetaRawContentBlockDelta } from "@anthropic-ai/sdk/resources/beta.mjs";
|
|
5
5
|
import { SettingsManager } from "./settings.js";
|
|
@@ -97,6 +97,10 @@ type Session = {
|
|
|
97
97
|
/** The currently selected main-thread agent name, or "default" for the
|
|
98
98
|
* standard Claude Code agent (no `agent` flag applied). */
|
|
99
99
|
currentAgent: string;
|
|
100
|
+
/** Whether Fast mode is currently enabled for this session. Tracked as the
|
|
101
|
+
* user's intent so it persists across model switches; the Fast mode config
|
|
102
|
+
* option is only surfaced while the selected model supports it. */
|
|
103
|
+
fastModeEnabled: boolean;
|
|
100
104
|
abortController: AbortController;
|
|
101
105
|
/** Signal the consumer races `query.next()` against. Aborted by cancel()
|
|
102
106
|
* (after a grace period) to force the active turn to settle "cancelled" when
|
|
@@ -383,6 +387,33 @@ export declare class ClaudeAcpAgent {
|
|
|
383
387
|
private sendAvailableCommandsUpdate;
|
|
384
388
|
private updateConfigOption;
|
|
385
389
|
private applyConfigOptionValue;
|
|
390
|
+
/** Replace the Fast mode option in `session.configOptions` so it reflects
|
|
391
|
+
* `enabled` (and the client's current boolean-capability). A no-op when the
|
|
392
|
+
* option isn't present, so callers must confirm the current model surfaces
|
|
393
|
+
* it first. */
|
|
394
|
+
private refreshFastModeOption;
|
|
395
|
+
/** Toggle Fast mode for a session: push the SDK flag, record the user's
|
|
396
|
+
* intent, and refresh the Fast mode config option in place. Only reached
|
|
397
|
+
* once the option exists (i.e. the current model supports fast mode), so the
|
|
398
|
+
* option is guaranteed to be present in `configOptions`. */
|
|
399
|
+
private applyFastMode;
|
|
400
|
+
/** Reconcile the session's Fast mode toggle with an SDK-reported
|
|
401
|
+
* `fast_mode_state` (delivered on `system`/init and on user-turn `result`s).
|
|
402
|
+
* The SDK can flip fast mode independently of the user — e.g. back to `on`
|
|
403
|
+
* once a rate-limit `cooldown` clears — so we mirror definitive on/off
|
|
404
|
+
* changes into the config option and notify the client.
|
|
405
|
+
*
|
|
406
|
+
* Guards, in order:
|
|
407
|
+
* - absent state: nothing to reconcile.
|
|
408
|
+
* - no Fast mode option: the current model doesn't support fast mode, so the
|
|
409
|
+
* reported state reflects capability, not the user's intent. Leave the
|
|
410
|
+
* retained setting untouched so it's correct when a supporting model is
|
|
411
|
+
* reselected (the source of the earlier intent-clobber bug was mutating it
|
|
412
|
+
* here).
|
|
413
|
+
* - `cooldown`: a transient suspension of an already-enabled fast mode.
|
|
414
|
+
* Leave the toggle as-is rather than flapping it — and never let a stray
|
|
415
|
+
* cooldown spuriously enable a toggle the user has off. */
|
|
416
|
+
private syncFastModeState;
|
|
386
417
|
private getOrCreateSession;
|
|
387
418
|
/**
|
|
388
419
|
* Ensures the requested `cwd` is an absolute path that points at an existing
|
|
@@ -400,7 +431,65 @@ export declare const DEFAULT_AGENT_ID = "default";
|
|
|
400
431
|
* list if discovery fails so a flaky control request never blocks session
|
|
401
432
|
* creation. */
|
|
402
433
|
export declare function discoverCustomAgents(q: Query): Promise<AgentInfo[]>;
|
|
403
|
-
|
|
434
|
+
/** Stable ids for the session config options surfaced via `configOptions`.
|
|
435
|
+
* Centralized so the option declarations in `buildConfigOptions` and the
|
|
436
|
+
* handlers in `setSessionConfigOption`/`applyConfigOptionValue` reference the
|
|
437
|
+
* same identifiers and can't drift apart. */
|
|
438
|
+
export declare const MODE_CONFIG_ID = "mode";
|
|
439
|
+
export declare const MODEL_CONFIG_ID = "model";
|
|
440
|
+
export declare const EFFORT_CONFIG_ID = "effort";
|
|
441
|
+
export declare const AGENT_CONFIG_ID = "agent";
|
|
442
|
+
export declare const FAST_MODE_CONFIG_ID = "fast";
|
|
443
|
+
/** Select-fallback values used when the client has not opted into boolean
|
|
444
|
+
* config options (see {@link createFastModeConfigOption}). */
|
|
445
|
+
export declare const FAST_MODE_ON = "on";
|
|
446
|
+
export declare const FAST_MODE_OFF = "off";
|
|
447
|
+
/** Map the SDK's tri-state `fast_mode_state` onto the boolean config toggle.
|
|
448
|
+
* `cooldown` (fast mode temporarily suspended after a rate limit, per the SDK
|
|
449
|
+
* docs) keeps the toggle on so it reflects the user's intent — only an
|
|
450
|
+
* explicit `off` clears it. */
|
|
451
|
+
export declare function fastModeStateEnabled(state: FastModeState): boolean;
|
|
452
|
+
/** Whether the Client advertised support for boolean session config options
|
|
453
|
+
* (`session.configOptions.boolean`). Agents MUST only send `type: "boolean"`
|
|
454
|
+
* config options to Clients that opt in; otherwise we fall back to a `select`.
|
|
455
|
+
* See https://agentclientprotocol.com/rfds/boolean-config-option. */
|
|
456
|
+
export declare function clientSupportsBooleanConfigOptions(clientCapabilities?: ClientCapabilities | null): boolean;
|
|
457
|
+
/** Build the Fast mode config option. When the Client supports boolean config
|
|
458
|
+
* options we expose a native `type: "boolean"` toggle; otherwise we degrade to
|
|
459
|
+
* a two-value `select` ("on"/"off") so older Clients still get a usable
|
|
460
|
+
* control. */
|
|
461
|
+
export declare function createFastModeConfigOption(enabled: boolean, useBooleanOption: boolean): SessionConfigOption;
|
|
462
|
+
/** Resolve the requested Fast mode value from a `session/set_config_option`
|
|
463
|
+
* request. Accepts a native boolean (boolean-capable Clients) or the
|
|
464
|
+
* "on"/"off" select-fallback strings. */
|
|
465
|
+
export declare function resolveFastModeEnabled(params: SetSessionConfigOptionRequest): boolean;
|
|
466
|
+
/** Per-model Fast mode state threaded into {@link buildConfigOptions}. The
|
|
467
|
+
* option is only surfaced when the current model `supported`s fast mode. */
|
|
468
|
+
export type FastModeOptionState = {
|
|
469
|
+
supported: boolean;
|
|
470
|
+
enabled: boolean;
|
|
471
|
+
/** Whether the Client opted into boolean config options. */
|
|
472
|
+
useBooleanOption: boolean;
|
|
473
|
+
};
|
|
474
|
+
export declare function buildConfigOptions(modes: SessionModeState, models: SessionModelState, modelInfos: ModelInfo[], currentEffortLevel?: string, agents?: AgentInfo[], currentAgent?: string, fastMode?: FastModeOptionState): SessionConfigOption[];
|
|
475
|
+
export declare function resolveModelPreference(models: ModelInfo[], preference: string): ModelInfo | null;
|
|
476
|
+
/**
|
|
477
|
+
* Restrict the SDK's model list to the user's `availableModels` allowlist
|
|
478
|
+
* (already merged-and-deduped across settings sources by `SettingsManager`).
|
|
479
|
+
* The user's exact entries become the model IDs surfaced via configOptions
|
|
480
|
+
* and passed to `setModel`, which prevents Claude Code from silently
|
|
481
|
+
* substituting a date-pinned variant (e.g. `haiku` →
|
|
482
|
+
* `claude-haiku-4-5-20251001`) that the user may not have access to.
|
|
483
|
+
*
|
|
484
|
+
* Display info and capability flags are copied from the closest SDK match so
|
|
485
|
+
* the UI still renders sensible names and effort levels.
|
|
486
|
+
*
|
|
487
|
+
* Semantics from https://code.claude.com/docs/en/model-config#restrict-model-selection:
|
|
488
|
+
* - `undefined` is handled by the caller (no allowlist applied).
|
|
489
|
+
* - The Default option is unaffected by `availableModels` — it always remains
|
|
490
|
+
* available, even when the allowlist is `[]`.
|
|
491
|
+
*/
|
|
492
|
+
export declare function applyAvailableModelsAllowlist(sdkModels: ModelInfo[], allowlist: string[]): ModelInfo[];
|
|
404
493
|
export declare function promptToClaude(prompt: PromptRequest): SDKUserMessage;
|
|
405
494
|
/**
|
|
406
495
|
* Resolves the ACP `messageId` for a Claude SDK message (live) or a persisted
|
package/dist/acp-agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acp-agent.d.ts","sourceRoot":"","sources":["../src/acp-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EAGnB,kBAAkB,EAClB,kBAAkB,EAClB,+BAA+B,EAC/B,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EAGb,iBAAiB,EACjB,kBAAkB,EAElB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EAEpB,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EAEtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,SAAS,EACT,UAAU,
|
|
1
|
+
{"version":3,"file":"acp-agent.d.ts","sourceRoot":"","sources":["../src/acp-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EAGnB,kBAAkB,EAClB,kBAAkB,EAClB,+BAA+B,EAC/B,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EAGb,iBAAiB,EACjB,kBAAkB,EAElB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EAEpB,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EAEtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,SAAS,EACT,UAAU,EAEV,aAAa,EAKb,SAAS,EAGT,OAAO,EACP,cAAc,EAEd,gBAAgB,EAChB,KAAK,EAKL,gBAAgB,EAChB,0BAA0B,EAC1B,cAAc,EAGf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAiBlG,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EASL,SAAS,EAKV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAwC,QAAQ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kBAAkB,CAAC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,mBAAmB,EAAE,CAoDvB;AAED;;;;;;;;;;;oEAWoE;AACpE,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC,EAC3D,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,cAAc,CAAC,CAczB;AAED,wBAAgB,MAAM;;;EAqCrB"}
|
package/dist/acp-agent.js
CHANGED
|
@@ -852,6 +852,10 @@ export class ClaudeAcpAgent {
|
|
|
852
852
|
case "system":
|
|
853
853
|
switch (message.subtype) {
|
|
854
854
|
case "init":
|
|
855
|
+
// A fresh `system`/init (e.g. after reinitialize) can carry an
|
|
856
|
+
// updated Fast mode state; reconcile it with what we seeded at
|
|
857
|
+
// session creation.
|
|
858
|
+
await this.syncFastModeState(message.session_id, session, message.fast_mode_state);
|
|
855
859
|
break;
|
|
856
860
|
case "status": {
|
|
857
861
|
if (message.status === "compacting") {
|
|
@@ -1120,6 +1124,13 @@ export class ClaudeAcpAgent {
|
|
|
1120
1124
|
// They should not influence the user-turn lifecycle (stop reason,
|
|
1121
1125
|
// slash-command output forwarding) but their cost is real.
|
|
1122
1126
|
const isTaskNotification = message.origin?.kind === "task-notification";
|
|
1127
|
+
// Reconcile the Fast mode toggle with the SDK's reported state.
|
|
1128
|
+
// Gated to user-driven turns like every other side effect below; a
|
|
1129
|
+
// background followup's state lands on the next user turn's result.
|
|
1130
|
+
// Runs even when the turn errors or was cancelled.
|
|
1131
|
+
if (!isTaskNotification) {
|
|
1132
|
+
await this.syncFastModeState(params.sessionId, session, message.fast_mode_state);
|
|
1133
|
+
}
|
|
1123
1134
|
// A user-turn result needs an active turn so its stop reason is
|
|
1124
1135
|
// attributed and the turn settles at idle. Local-only commands carry
|
|
1125
1136
|
// no user-message echo to promote them, so do it here from the head.
|
|
@@ -1789,7 +1800,7 @@ export class ClaudeAcpAgent {
|
|
|
1789
1800
|
throw RequestError.internalError(undefined, SESSION_ENDED_MESSAGE);
|
|
1790
1801
|
}
|
|
1791
1802
|
await this.applySessionMode(params.sessionId, params.modeId);
|
|
1792
|
-
await this.updateConfigOption(params.sessionId,
|
|
1803
|
+
await this.updateConfigOption(params.sessionId, MODE_CONFIG_ID, params.modeId);
|
|
1793
1804
|
return {};
|
|
1794
1805
|
}
|
|
1795
1806
|
async setSessionConfigOption(params) {
|
|
@@ -1804,13 +1815,20 @@ export class ClaudeAcpAgent {
|
|
|
1804
1815
|
if (session.queryClosed) {
|
|
1805
1816
|
throw RequestError.internalError(undefined, SESSION_ENDED_MESSAGE);
|
|
1806
1817
|
}
|
|
1807
|
-
if (typeof params.value !== "string") {
|
|
1808
|
-
throw new Error(`Invalid value for config option ${params.configId}: ${params.value}`);
|
|
1809
|
-
}
|
|
1810
1818
|
const option = session.configOptions.find((o) => o.id === params.configId);
|
|
1811
1819
|
if (!option) {
|
|
1812
1820
|
throw new Error(`Unknown config option: ${params.configId}`);
|
|
1813
1821
|
}
|
|
1822
|
+
// Fast mode carries a boolean value (for Clients that opted into boolean
|
|
1823
|
+
// config options) or the "on"/"off" select fallback, so it bypasses the
|
|
1824
|
+
// string-only validation the select-style options below rely on.
|
|
1825
|
+
if (params.configId === FAST_MODE_CONFIG_ID) {
|
|
1826
|
+
await this.applyFastMode(session, resolveFastModeEnabled(params));
|
|
1827
|
+
return { configOptions: session.configOptions };
|
|
1828
|
+
}
|
|
1829
|
+
if (typeof params.value !== "string") {
|
|
1830
|
+
throw new Error(`Invalid value for config option ${params.configId}: ${params.value}`);
|
|
1831
|
+
}
|
|
1814
1832
|
const allValues = "options" in option && Array.isArray(option.options)
|
|
1815
1833
|
? option.options.flatMap((o) => ("options" in o ? o.options : [o]))
|
|
1816
1834
|
: [];
|
|
@@ -1818,7 +1836,7 @@ export class ClaudeAcpAgent {
|
|
|
1818
1836
|
// For model options, fall back to resolveModelPreference when the exact
|
|
1819
1837
|
// value doesn't match. This lets callers use human-friendly aliases like
|
|
1820
1838
|
// "opus" or "sonnet" instead of full model IDs like "claude-opus-4-6".
|
|
1821
|
-
if (!validValue && params.configId ===
|
|
1839
|
+
if (!validValue && params.configId === MODEL_CONFIG_ID) {
|
|
1822
1840
|
const modelInfos = allValues.map((o) => ({
|
|
1823
1841
|
value: o.value,
|
|
1824
1842
|
displayName: o.name,
|
|
@@ -1835,7 +1853,7 @@ export class ClaudeAcpAgent {
|
|
|
1835
1853
|
// Use the canonical option value so downstream code always receives the
|
|
1836
1854
|
// model ID rather than the caller-supplied alias.
|
|
1837
1855
|
const resolvedValue = validValue.value;
|
|
1838
|
-
if (params.configId ===
|
|
1856
|
+
if (params.configId === MODE_CONFIG_ID) {
|
|
1839
1857
|
await this.applySessionMode(params.sessionId, resolvedValue);
|
|
1840
1858
|
await this.client.sessionUpdate({
|
|
1841
1859
|
sessionId: params.sessionId,
|
|
@@ -1845,7 +1863,7 @@ export class ClaudeAcpAgent {
|
|
|
1845
1863
|
},
|
|
1846
1864
|
});
|
|
1847
1865
|
}
|
|
1848
|
-
else if (params.configId ===
|
|
1866
|
+
else if (params.configId === MODEL_CONFIG_ID) {
|
|
1849
1867
|
await this.sessions[params.sessionId].query.setModel(resolvedValue);
|
|
1850
1868
|
}
|
|
1851
1869
|
// Effort SDK sync is handled inside applyConfigOptionValue so that direct
|
|
@@ -2051,7 +2069,7 @@ export class ClaudeAcpAgent {
|
|
|
2051
2069
|
currentModeId: selectedMode,
|
|
2052
2070
|
},
|
|
2053
2071
|
});
|
|
2054
|
-
await this.updateConfigOption(sessionId,
|
|
2072
|
+
await this.updateConfigOption(sessionId, MODE_CONFIG_ID, selectedMode);
|
|
2055
2073
|
return {
|
|
2056
2074
|
behavior: "allow",
|
|
2057
2075
|
updatedInput: toolInput,
|
|
@@ -2219,11 +2237,11 @@ export class ClaudeAcpAgent {
|
|
|
2219
2237
|
});
|
|
2220
2238
|
}
|
|
2221
2239
|
async applyConfigOptionValue(sessionId, session, configId, value) {
|
|
2222
|
-
if (configId ===
|
|
2240
|
+
if (configId === MODE_CONFIG_ID) {
|
|
2223
2241
|
session.modes = { ...session.modes, currentModeId: value };
|
|
2224
2242
|
session.configOptions = session.configOptions.map((o) => o.id === configId && typeof o.currentValue === "string" ? { ...o, currentValue: value } : o);
|
|
2225
2243
|
}
|
|
2226
|
-
else if (configId ===
|
|
2244
|
+
else if (configId === MODEL_CONFIG_ID) {
|
|
2227
2245
|
// `ModelInfo.supportsAutoMode` is the canonical SDK signal for clamping
|
|
2228
2246
|
// modes below; its `displayName`/`description` also let us infer the
|
|
2229
2247
|
// context window for semantic aliases (e.g. `default`) whose ID alone
|
|
@@ -2266,11 +2284,18 @@ export class ClaudeAcpAgent {
|
|
|
2266
2284
|
session.modes = { ...session.modes, availableModes: newAvailableModes };
|
|
2267
2285
|
}
|
|
2268
2286
|
// Rebuild config options since effort levels depend on the selected model
|
|
2269
|
-
const effortOpt = session.configOptions.find((o) => o.id ===
|
|
2287
|
+
const effortOpt = session.configOptions.find((o) => o.id === EFFORT_CONFIG_ID);
|
|
2270
2288
|
const currentEffort = typeof effortOpt?.currentValue === "string" ? effortOpt.currentValue : undefined;
|
|
2271
|
-
session.configOptions = buildConfigOptions(session.modes, session.models, session.modelInfos, currentEffort, session.agents, session.currentAgent
|
|
2289
|
+
session.configOptions = buildConfigOptions(session.modes, session.models, session.modelInfos, currentEffort, session.agents, session.currentAgent, {
|
|
2290
|
+
// The toggle follows the newly selected model: it disappears when the
|
|
2291
|
+
// model lacks fast support and reappears (with the retained user
|
|
2292
|
+
// intent) when a supporting model is selected again.
|
|
2293
|
+
supported: newModelInfo?.supportsFastMode ?? false,
|
|
2294
|
+
enabled: session.fastModeEnabled,
|
|
2295
|
+
useBooleanOption: clientSupportsBooleanConfigOptions(this.clientCapabilities),
|
|
2296
|
+
});
|
|
2272
2297
|
// Sync effort with the SDK if it changed after the model switch
|
|
2273
|
-
const newEffortOpt = session.configOptions.find((o) => o.id ===
|
|
2298
|
+
const newEffortOpt = session.configOptions.find((o) => o.id === EFFORT_CONFIG_ID);
|
|
2274
2299
|
const newEffort = typeof newEffortOpt?.currentValue === "string" ? newEffortOpt.currentValue : undefined;
|
|
2275
2300
|
if (newEffort !== currentEffort) {
|
|
2276
2301
|
await session.query.applyFlagSettings({
|
|
@@ -2293,7 +2318,7 @@ export class ClaudeAcpAgent {
|
|
|
2293
2318
|
});
|
|
2294
2319
|
}
|
|
2295
2320
|
}
|
|
2296
|
-
else if (configId ===
|
|
2321
|
+
else if (configId === AGENT_CONFIG_ID) {
|
|
2297
2322
|
// Live agent switch — no subprocess restart needed. Apply the SDK flag
|
|
2298
2323
|
// first so a rejected control request leaves both `currentAgent` and the
|
|
2299
2324
|
// config option untouched (no UI/SDK desync). Passing `null` clears the
|
|
@@ -2307,13 +2332,72 @@ export class ClaudeAcpAgent {
|
|
|
2307
2332
|
}
|
|
2308
2333
|
else {
|
|
2309
2334
|
session.configOptions = session.configOptions.map((o) => o.id === configId && typeof o.currentValue === "string" ? { ...o, currentValue: value } : o);
|
|
2310
|
-
if (configId ===
|
|
2335
|
+
if (configId === EFFORT_CONFIG_ID) {
|
|
2311
2336
|
await session.query.applyFlagSettings({
|
|
2312
2337
|
effortLevel: toSdkEffortLevel(value),
|
|
2313
2338
|
});
|
|
2314
2339
|
}
|
|
2315
2340
|
}
|
|
2316
2341
|
}
|
|
2342
|
+
/** Replace the Fast mode option in `session.configOptions` so it reflects
|
|
2343
|
+
* `enabled` (and the client's current boolean-capability). A no-op when the
|
|
2344
|
+
* option isn't present, so callers must confirm the current model surfaces
|
|
2345
|
+
* it first. */
|
|
2346
|
+
refreshFastModeOption(session, enabled) {
|
|
2347
|
+
const refreshed = createFastModeConfigOption(enabled, clientSupportsBooleanConfigOptions(this.clientCapabilities));
|
|
2348
|
+
session.configOptions = session.configOptions.map((o) => o.id === FAST_MODE_CONFIG_ID ? refreshed : o);
|
|
2349
|
+
}
|
|
2350
|
+
/** Toggle Fast mode for a session: push the SDK flag, record the user's
|
|
2351
|
+
* intent, and refresh the Fast mode config option in place. Only reached
|
|
2352
|
+
* once the option exists (i.e. the current model supports fast mode), so the
|
|
2353
|
+
* option is guaranteed to be present in `configOptions`. */
|
|
2354
|
+
async applyFastMode(session, enabled) {
|
|
2355
|
+
// Apply the SDK flag first so a rejected control request leaves both the
|
|
2356
|
+
// session state and the config option untouched (no UI/SDK desync).
|
|
2357
|
+
await session.query.applyFlagSettings({ fastMode: enabled });
|
|
2358
|
+
session.fastModeEnabled = enabled;
|
|
2359
|
+
this.refreshFastModeOption(session, enabled);
|
|
2360
|
+
}
|
|
2361
|
+
/** Reconcile the session's Fast mode toggle with an SDK-reported
|
|
2362
|
+
* `fast_mode_state` (delivered on `system`/init and on user-turn `result`s).
|
|
2363
|
+
* The SDK can flip fast mode independently of the user — e.g. back to `on`
|
|
2364
|
+
* once a rate-limit `cooldown` clears — so we mirror definitive on/off
|
|
2365
|
+
* changes into the config option and notify the client.
|
|
2366
|
+
*
|
|
2367
|
+
* Guards, in order:
|
|
2368
|
+
* - absent state: nothing to reconcile.
|
|
2369
|
+
* - no Fast mode option: the current model doesn't support fast mode, so the
|
|
2370
|
+
* reported state reflects capability, not the user's intent. Leave the
|
|
2371
|
+
* retained setting untouched so it's correct when a supporting model is
|
|
2372
|
+
* reselected (the source of the earlier intent-clobber bug was mutating it
|
|
2373
|
+
* here).
|
|
2374
|
+
* - `cooldown`: a transient suspension of an already-enabled fast mode.
|
|
2375
|
+
* Leave the toggle as-is rather than flapping it — and never let a stray
|
|
2376
|
+
* cooldown spuriously enable a toggle the user has off. */
|
|
2377
|
+
async syncFastModeState(sessionId, session, state) {
|
|
2378
|
+
if (state === undefined) {
|
|
2379
|
+
return;
|
|
2380
|
+
}
|
|
2381
|
+
if (!session.configOptions.some((o) => o.id === FAST_MODE_CONFIG_ID)) {
|
|
2382
|
+
return;
|
|
2383
|
+
}
|
|
2384
|
+
if (state === "cooldown") {
|
|
2385
|
+
return;
|
|
2386
|
+
}
|
|
2387
|
+
const enabled = state === "on";
|
|
2388
|
+
if (enabled === session.fastModeEnabled) {
|
|
2389
|
+
return;
|
|
2390
|
+
}
|
|
2391
|
+
session.fastModeEnabled = enabled;
|
|
2392
|
+
this.refreshFastModeOption(session, enabled);
|
|
2393
|
+
await this.client.sessionUpdate({
|
|
2394
|
+
sessionId,
|
|
2395
|
+
update: {
|
|
2396
|
+
sessionUpdate: "config_option_update",
|
|
2397
|
+
configOptions: session.configOptions,
|
|
2398
|
+
},
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2317
2401
|
async getOrCreateSession(params) {
|
|
2318
2402
|
const existingSession = this.sessions[params.sessionId];
|
|
2319
2403
|
if (existingSession) {
|
|
@@ -2524,7 +2608,7 @@ export class ClaudeAcpAgent {
|
|
|
2524
2608
|
currentModeId: "plan",
|
|
2525
2609
|
},
|
|
2526
2610
|
});
|
|
2527
|
-
await this.updateConfigOption(sessionId,
|
|
2611
|
+
await this.updateConfigOption(sessionId, MODE_CONFIG_ID, "plan");
|
|
2528
2612
|
},
|
|
2529
2613
|
}),
|
|
2530
2614
|
],
|
|
@@ -2666,9 +2750,20 @@ export class ClaudeAcpAgent {
|
|
|
2666
2750
|
const currentAgent = requestedAgent && agents.some((a) => a.name === requestedAgent)
|
|
2667
2751
|
? requestedAgent
|
|
2668
2752
|
: DEFAULT_AGENT_ID;
|
|
2669
|
-
|
|
2753
|
+
// Seed Fast mode from the SDK's reported state so the UI reflects reality
|
|
2754
|
+
// (the CLI may start a session with fast mode already on, or force it off
|
|
2755
|
+
// when `fastModePerSessionOptIn` is set). The toggle is only surfaced while
|
|
2756
|
+
// the resolved model advertises `supportsFastMode`.
|
|
2757
|
+
const fastModeEnabled = initializationResult.fast_mode_state !== undefined &&
|
|
2758
|
+
fastModeStateEnabled(initializationResult.fast_mode_state);
|
|
2759
|
+
const fastMode = {
|
|
2760
|
+
supported: currentModelInfo?.supportsFastMode ?? false,
|
|
2761
|
+
enabled: fastModeEnabled,
|
|
2762
|
+
useBooleanOption: clientSupportsBooleanConfigOptions(this.clientCapabilities),
|
|
2763
|
+
};
|
|
2764
|
+
const configOptions = buildConfigOptions(modes, models, allowedModels, settingsManager.getSettings().effortLevel, agents, currentAgent, fastMode);
|
|
2670
2765
|
// Apply the initial effort level to the SDK so it matches the UI default
|
|
2671
|
-
const initialEffort = configOptions.find((o) => o.id ===
|
|
2766
|
+
const initialEffort = configOptions.find((o) => o.id === EFFORT_CONFIG_ID);
|
|
2672
2767
|
if (initialEffort &&
|
|
2673
2768
|
typeof initialEffort.currentValue === "string" &&
|
|
2674
2769
|
initialEffort.currentValue !== "default") {
|
|
@@ -2695,6 +2790,7 @@ export class ClaudeAcpAgent {
|
|
|
2695
2790
|
configOptions,
|
|
2696
2791
|
agents,
|
|
2697
2792
|
currentAgent,
|
|
2793
|
+
fastModeEnabled,
|
|
2698
2794
|
abortController,
|
|
2699
2795
|
emitRawSDKMessages: sessionMeta?.claudeCode?.emitRawSDKMessages ?? false,
|
|
2700
2796
|
contextWindowSize: inferContextWindowFromModel(models.currentModelId, currentModelInfo?.displayName, currentModelInfo?.description) ?? DEFAULT_CONTEXT_WINDOW,
|
|
@@ -2874,10 +2970,78 @@ export async function discoverCustomAgents(q) {
|
|
|
2874
2970
|
return [];
|
|
2875
2971
|
}
|
|
2876
2972
|
}
|
|
2877
|
-
|
|
2973
|
+
/** Stable ids for the session config options surfaced via `configOptions`.
|
|
2974
|
+
* Centralized so the option declarations in `buildConfigOptions` and the
|
|
2975
|
+
* handlers in `setSessionConfigOption`/`applyConfigOptionValue` reference the
|
|
2976
|
+
* same identifiers and can't drift apart. */
|
|
2977
|
+
export const MODE_CONFIG_ID = "mode";
|
|
2978
|
+
export const MODEL_CONFIG_ID = "model";
|
|
2979
|
+
export const EFFORT_CONFIG_ID = "effort";
|
|
2980
|
+
export const AGENT_CONFIG_ID = "agent";
|
|
2981
|
+
export const FAST_MODE_CONFIG_ID = "fast";
|
|
2982
|
+
/** Select-fallback values used when the client has not opted into boolean
|
|
2983
|
+
* config options (see {@link createFastModeConfigOption}). */
|
|
2984
|
+
export const FAST_MODE_ON = "on";
|
|
2985
|
+
export const FAST_MODE_OFF = "off";
|
|
2986
|
+
const FAST_MODE_DESCRIPTION = "Faster responses on supported models";
|
|
2987
|
+
/** Map the SDK's tri-state `fast_mode_state` onto the boolean config toggle.
|
|
2988
|
+
* `cooldown` (fast mode temporarily suspended after a rate limit, per the SDK
|
|
2989
|
+
* docs) keeps the toggle on so it reflects the user's intent — only an
|
|
2990
|
+
* explicit `off` clears it. */
|
|
2991
|
+
export function fastModeStateEnabled(state) {
|
|
2992
|
+
return state !== "off";
|
|
2993
|
+
}
|
|
2994
|
+
/** Whether the Client advertised support for boolean session config options
|
|
2995
|
+
* (`session.configOptions.boolean`). Agents MUST only send `type: "boolean"`
|
|
2996
|
+
* config options to Clients that opt in; otherwise we fall back to a `select`.
|
|
2997
|
+
* See https://agentclientprotocol.com/rfds/boolean-config-option. */
|
|
2998
|
+
export function clientSupportsBooleanConfigOptions(clientCapabilities) {
|
|
2999
|
+
return clientCapabilities?.session?.configOptions?.boolean != null;
|
|
3000
|
+
}
|
|
3001
|
+
/** Build the Fast mode config option. When the Client supports boolean config
|
|
3002
|
+
* options we expose a native `type: "boolean"` toggle; otherwise we degrade to
|
|
3003
|
+
* a two-value `select` ("on"/"off") so older Clients still get a usable
|
|
3004
|
+
* control. */
|
|
3005
|
+
export function createFastModeConfigOption(enabled, useBooleanOption) {
|
|
3006
|
+
const base = {
|
|
3007
|
+
id: FAST_MODE_CONFIG_ID,
|
|
3008
|
+
name: "Fast mode",
|
|
3009
|
+
description: FAST_MODE_DESCRIPTION,
|
|
3010
|
+
category: "model_config",
|
|
3011
|
+
};
|
|
3012
|
+
if (useBooleanOption) {
|
|
3013
|
+
return { ...base, type: "boolean", currentValue: enabled };
|
|
3014
|
+
}
|
|
3015
|
+
return {
|
|
3016
|
+
...base,
|
|
3017
|
+
type: "select",
|
|
3018
|
+
currentValue: enabled ? FAST_MODE_ON : FAST_MODE_OFF,
|
|
3019
|
+
options: [
|
|
3020
|
+
{ value: FAST_MODE_ON, name: "On" },
|
|
3021
|
+
{ value: FAST_MODE_OFF, name: "Off" },
|
|
3022
|
+
],
|
|
3023
|
+
};
|
|
3024
|
+
}
|
|
3025
|
+
/** Resolve the requested Fast mode value from a `session/set_config_option`
|
|
3026
|
+
* request. Accepts a native boolean (boolean-capable Clients) or the
|
|
3027
|
+
* "on"/"off" select-fallback strings. */
|
|
3028
|
+
export function resolveFastModeEnabled(params) {
|
|
3029
|
+
const value = params.value;
|
|
3030
|
+
if (typeof value === "boolean") {
|
|
3031
|
+
return value;
|
|
3032
|
+
}
|
|
3033
|
+
if (value === FAST_MODE_ON) {
|
|
3034
|
+
return true;
|
|
3035
|
+
}
|
|
3036
|
+
if (value === FAST_MODE_OFF) {
|
|
3037
|
+
return false;
|
|
3038
|
+
}
|
|
3039
|
+
throw new Error(`Invalid value for config option ${FAST_MODE_CONFIG_ID}: ${value}`);
|
|
3040
|
+
}
|
|
3041
|
+
export function buildConfigOptions(modes, models, modelInfos, currentEffortLevel, agents = [], currentAgent = DEFAULT_AGENT_ID, fastMode) {
|
|
2878
3042
|
const options = [
|
|
2879
3043
|
{
|
|
2880
|
-
id:
|
|
3044
|
+
id: MODE_CONFIG_ID,
|
|
2881
3045
|
name: "Mode",
|
|
2882
3046
|
description: "Session permission mode",
|
|
2883
3047
|
category: "mode",
|
|
@@ -2890,7 +3054,7 @@ export function buildConfigOptions(modes, models, modelInfos, currentEffortLevel
|
|
|
2890
3054
|
})),
|
|
2891
3055
|
},
|
|
2892
3056
|
{
|
|
2893
|
-
id:
|
|
3057
|
+
id: MODEL_CONFIG_ID,
|
|
2894
3058
|
name: "Model",
|
|
2895
3059
|
description: "AI model to use",
|
|
2896
3060
|
category: "model",
|
|
@@ -2922,7 +3086,7 @@ export function buildConfigOptions(modes, models, modelInfos, currentEffortLevel
|
|
|
2922
3086
|
const includes = (l) => l === "default" || supportedLevels.includes(l);
|
|
2923
3087
|
const validEffort = currentEffortLevel && includes(currentEffortLevel) ? currentEffortLevel : "default";
|
|
2924
3088
|
options.push({
|
|
2925
|
-
id:
|
|
3089
|
+
id: EFFORT_CONFIG_ID,
|
|
2926
3090
|
name: "Effort",
|
|
2927
3091
|
description: "Available effort levels for this model",
|
|
2928
3092
|
category: "thought_level",
|
|
@@ -2931,13 +3095,19 @@ export function buildConfigOptions(modes, models, modelInfos, currentEffortLevel
|
|
|
2931
3095
|
options: effortOptions,
|
|
2932
3096
|
});
|
|
2933
3097
|
}
|
|
3098
|
+
// Surface the Fast mode toggle only when the current model supports it. The
|
|
3099
|
+
// option renders as a native boolean toggle for Clients that opted in, and a
|
|
3100
|
+
// two-value select otherwise.
|
|
3101
|
+
if (fastMode?.supported) {
|
|
3102
|
+
options.push(createFastModeConfigOption(fastMode.enabled, fastMode.useBooleanOption));
|
|
3103
|
+
}
|
|
2934
3104
|
// Only surface the Agent picker when there's a real choice — i.e. the user
|
|
2935
3105
|
// has configured at least one custom agent (built-ins are filtered out in
|
|
2936
3106
|
// discoverCustomAgents). With none configured, "Default" would be the only
|
|
2937
3107
|
// entry, so we omit the option entirely.
|
|
2938
3108
|
if (agents.length > 0) {
|
|
2939
3109
|
options.push({
|
|
2940
|
-
id:
|
|
3110
|
+
id: AGENT_CONFIG_ID,
|
|
2941
3111
|
name: "Agent",
|
|
2942
3112
|
description: "Main-thread agent persona",
|
|
2943
3113
|
type: "select",
|
|
@@ -2957,13 +3127,17 @@ export function buildConfigOptions(modes, models, modelInfos, currentEffortLevel
|
|
|
2957
3127
|
// Claude Code CLI persists display strings like "opus[1m]" in settings,
|
|
2958
3128
|
// but the SDK model list uses IDs like "claude-opus-4-6-1m".
|
|
2959
3129
|
const MODEL_CONTEXT_HINT_PATTERN = /\[(\d+m)\]$/i;
|
|
2960
|
-
// Captures a model family version
|
|
2961
|
-
// `
|
|
2962
|
-
//
|
|
2963
|
-
const MODEL_FAMILY_VERSION_PATTERN = /\b(\d+)[-.](\d+)
|
|
3130
|
+
// Captures a model family version: `4-6`/`4.7` for dated generations, or a
|
|
3131
|
+
// bare `5` for single-number ones like "Sonnet 5". Used to keep a pinned
|
|
3132
|
+
// `claude-opus-4-6` from matching the `opus` alias once it points at 4.7.
|
|
3133
|
+
const MODEL_FAMILY_VERSION_PATTERN = /\b(\d+)(?:[-.](\d+))?\b/;
|
|
2964
3134
|
function extractModelFamilyVersion(s) {
|
|
2965
|
-
|
|
2966
|
-
|
|
3135
|
+
// Strip "[1m]"-style context hints first — that digit is context window
|
|
3136
|
+
// size, not a model generation version.
|
|
3137
|
+
const match = s.replace(/\[\d+m\]/gi, "").match(MODEL_FAMILY_VERSION_PATTERN);
|
|
3138
|
+
if (!match)
|
|
3139
|
+
return null;
|
|
3140
|
+
return match[2] ? `${match[1]}.${match[2]}` : match[1];
|
|
2967
3141
|
}
|
|
2968
3142
|
function modelVersionsCompatible(preference, candidate) {
|
|
2969
3143
|
const preferred = extractModelFamilyVersion(preference);
|
|
@@ -3008,7 +3182,7 @@ function scoreModelMatch(model, tokens, contextHint) {
|
|
|
3008
3182
|
return 0;
|
|
3009
3183
|
return score;
|
|
3010
3184
|
}
|
|
3011
|
-
function resolveModelPreference(models, preference) {
|
|
3185
|
+
export function resolveModelPreference(models, preference) {
|
|
3012
3186
|
const trimmed = preference.trim();
|
|
3013
3187
|
if (!trimmed)
|
|
3014
3188
|
return null;
|
|
@@ -3019,6 +3193,15 @@ function resolveModelPreference(models, preference) {
|
|
|
3019
3193
|
model.displayName.toLowerCase() === lower);
|
|
3020
3194
|
if (directMatch)
|
|
3021
3195
|
return directMatch;
|
|
3196
|
+
// Exact match on the alias's canonical resolved id (e.g. a pinned
|
|
3197
|
+
// "claude-sonnet-5" against the "sonnet" row's `resolvedModel`). SDK-
|
|
3198
|
+
// reported and unambiguous, so it's tried before the fuzzier tiers below.
|
|
3199
|
+
// "default" is skipped first since it shares a resolvedModel with
|
|
3200
|
+
// whichever alias the CLI currently recommends — a specific pin should
|
|
3201
|
+
// land on that named alias, not "default".
|
|
3202
|
+
const resolvedMatch = models.find((model) => model.value !== "default" && model.resolvedModel?.toLowerCase() === lower) ?? models.find((model) => model.resolvedModel?.toLowerCase() === lower);
|
|
3203
|
+
if (resolvedMatch)
|
|
3204
|
+
return resolvedMatch;
|
|
3022
3205
|
// Substring match
|
|
3023
3206
|
const includesMatch = models.find((model) => {
|
|
3024
3207
|
if (!modelVersionsCompatible(trimmed, model))
|
|
@@ -3073,7 +3256,7 @@ function resolveSettingsModel(models, settingsModel, logger) {
|
|
|
3073
3256
|
* - The Default option is unaffected by `availableModels` — it always remains
|
|
3074
3257
|
* available, even when the allowlist is `[]`.
|
|
3075
3258
|
*/
|
|
3076
|
-
function applyAvailableModelsAllowlist(sdkModels, allowlist) {
|
|
3259
|
+
export function applyAvailableModelsAllowlist(sdkModels, allowlist) {
|
|
3077
3260
|
// Default is always preserved per the docs. Synthesize one if the SDK
|
|
3078
3261
|
// didn't surface it so downstream code (e.g. `getAvailableModels` picking
|
|
3079
3262
|
// `models[0]` as a fallback) still has something to work with.
|
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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AS,GAAG,IAAI,CAiB1F;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,EAAE,CAMpE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQnD;AAeD;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,YAAY,EAAE,OAAO,GAAG;IACrE,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAChC,CAoCA;AAcD,eAAO,MAAM,oBAAoB,GAC/B,WAAW,MAAM,EACjB,wBAEG;IACD,iBAAiB,CAAC,EAAE,CAClB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,OAAO,EAClB,YAAY,EAAE,OAAO,KAClB,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB,SAKF,CAAC;AAGF,eAAO,MAAM,qBAAqB,GAE9B,SAAQ,MAAgB,EACxB,UAAU;IACR,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC,KACA,YAoBF,CAAC;AAEJ;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GACxB,SAAS;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,KAAG,YAsBpE,CAAC"}
|
package/dist/tools.js
CHANGED
|
@@ -234,6 +234,23 @@ export function toolInfoFromToolUse(toolUse, supportsTerminalOutput = false, cwd
|
|
|
234
234
|
content: [],
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
|
+
case "ReportFindings": {
|
|
238
|
+
const input = toolUse.input;
|
|
239
|
+
const findings = input?.findings ?? [];
|
|
240
|
+
return {
|
|
241
|
+
title: findings.length === 0
|
|
242
|
+
? "Report findings: none found"
|
|
243
|
+
: `Report ${findings.length} finding${findings.length === 1 ? "" : "s"}`,
|
|
244
|
+
kind: "think",
|
|
245
|
+
content: findings.map((finding) => ({
|
|
246
|
+
type: "content",
|
|
247
|
+
content: {
|
|
248
|
+
type: "text",
|
|
249
|
+
text: `**${finding.file}${finding.line ? `:${finding.line}` : ""}** — ${finding.summary}`,
|
|
250
|
+
},
|
|
251
|
+
})),
|
|
252
|
+
};
|
|
253
|
+
}
|
|
237
254
|
case "TaskCreate": {
|
|
238
255
|
const input = toolUse.input;
|
|
239
256
|
return {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.54.0",
|
|
7
7
|
"description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
|
|
8
8
|
"main": "dist/lib.js",
|
|
9
9
|
"types": "dist/lib.d.ts",
|
|
@@ -63,21 +63,21 @@
|
|
|
63
63
|
"node": ">=22"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@agentclientprotocol/sdk": "1.
|
|
67
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
66
|
+
"@agentclientprotocol/sdk": "1.1.0",
|
|
67
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.197",
|
|
68
68
|
"zod": "^3.25.0 || ^4.0.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@anthropic-ai/sdk": "0.
|
|
71
|
+
"@anthropic-ai/sdk": "0.108.0",
|
|
72
72
|
"@eslint/js": "10.0.1",
|
|
73
73
|
"@tsconfig/node22": "22.0.5",
|
|
74
74
|
"@types/node": "26.0.1",
|
|
75
|
-
"@typescript-eslint/eslint-plugin": "8.62.
|
|
76
|
-
"@typescript-eslint/parser": "8.62.
|
|
75
|
+
"@typescript-eslint/eslint-plugin": "8.62.1",
|
|
76
|
+
"@typescript-eslint/parser": "8.62.1",
|
|
77
77
|
"eslint": "10.6.0",
|
|
78
78
|
"eslint-config-prettier": "10.1.8",
|
|
79
79
|
"globals": "17.7.0",
|
|
80
|
-
"prettier": "3.9.
|
|
80
|
+
"prettier": "3.9.4",
|
|
81
81
|
"ts-node": "10.9.2",
|
|
82
82
|
"typescript": "6.0.3",
|
|
83
83
|
"vitest": "4.1.9"
|