@agentclientprotocol/claude-agent-acp 0.108.2-preview.3 → 0.108.2-preview.4
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/native-subagents.js +2 -2
- package/dist/session-config-options.d.ts +10 -2
- package/dist/session-config-options.d.ts.map +1 -1
- package/dist/session-config-options.js +35 -5
- package/dist/subagent-configuration.d.ts +2 -7
- package/dist/subagent-configuration.d.ts.map +1 -1
- package/dist/subagent-configuration.js +0 -13
- package/dist/v2/child-config.d.ts +2 -1
- package/dist/v2/child-config.d.ts.map +1 -1
- package/dist/v2/child-config.js +3 -2
- package/dist/v2/config.d.ts +2 -2
- package/dist/v2/config.js +2 -2
- package/package.json +1 -1
package/dist/native-subagents.js
CHANGED
|
@@ -2,8 +2,8 @@ import { RequestError, } from "@agentclientprotocol/sdk/unstable";
|
|
|
2
2
|
import { realpath } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { AIR_SUBAGENT_KEY, airExtensionMeta } from "./air-extension.js";
|
|
5
|
+
import { orderedConfigOptions } from "./session-config-options.js";
|
|
5
6
|
import { MODEL_CONFIG_ID } from "./session-model.js";
|
|
6
|
-
import { orderedSubagentConfiguration } from "./subagent-configuration.js";
|
|
7
7
|
import { isFinalToolCallStatus } from "./tool-calls/renderer.js";
|
|
8
8
|
const MAX_PENDING_PARENTS = 64;
|
|
9
9
|
const MAX_PENDING_UPDATES = 256;
|
|
@@ -213,7 +213,7 @@ export class NativeSubagentRuntime {
|
|
|
213
213
|
const publishing = config.publishing.then(async () => {
|
|
214
214
|
if (this.configBySession.get(child.sessionId) !== config || ended())
|
|
215
215
|
return;
|
|
216
|
-
const configOptions =
|
|
216
|
+
const configOptions = orderedConfigOptions(config.options.values());
|
|
217
217
|
const snapshot = JSON.stringify(configOptions);
|
|
218
218
|
if (config.published === snapshot)
|
|
219
219
|
return;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The config options of a session, as both the v1 core and the v2 core
|
|
3
|
-
* build them:
|
|
4
|
-
* agent.
|
|
3
|
+
* build them: model, effort, Fast mode, ultracode, mode and the main-thread
|
|
4
|
+
* agent. A client gets them in that order (`orderedConfigOptions`), for a
|
|
5
|
+
* root session and for a subagent's session.
|
|
5
6
|
*/
|
|
6
7
|
import { type ClientCapabilities, type SessionConfigOption, type SessionModeState, type SetSessionConfigOptionRequest } from "@agentclientprotocol/sdk/unstable";
|
|
7
8
|
import type { AgentInfo, ModelInfo, Query } from "@anthropic-ai/claude-agent-sdk";
|
|
@@ -38,6 +39,13 @@ export type ConfigOptionPresentation = {
|
|
|
38
39
|
* SDK/adapter recommendation as `_meta.jetbrains.air.recommendedValue`. */
|
|
39
40
|
useRecommendedValue: boolean;
|
|
40
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* `options` as a client gets them, for a root session and for a subagent's
|
|
44
|
+
* session: in {@link CONFIG_OPTION_ORDER}'s order, then each option with
|
|
45
|
+
* another id, in the order it came.
|
|
46
|
+
*/
|
|
47
|
+
export declare function orderedConfigOptions(options: Iterable<SessionConfigOption>): SessionConfigOption[];
|
|
48
|
+
/** The config options of a root session, in the order a client gets them. */
|
|
41
49
|
export declare function buildConfigOptions(modes: SessionModeState, models: SessionModelState, modelInfos: ModelInfo[], currentEffortLevel?: string, agents?: AgentInfo[], currentAgent?: string, fastMode?: FastModeOptionState, presentation?: ConfigOptionPresentation, ultracode?: UltracodeOptionState): SessionConfigOption[];
|
|
42
50
|
/**
|
|
43
51
|
* The value that a `session/set_config_option` request sets on `option`, the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-config-options.d.ts","sourceRoot":"","sources":["../src/session-config-options.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"session-config-options.d.ts","sourceRoot":"","sources":["../src/session-config-options.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAEL,KAAK,kBAAkB,EACvB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B,CAChC,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,iBAAiB,EACzB,UAAU,EAAE,SAAS,EAAE,EACvB,kBAAkB,CAAC,EAAE,MAAM,EAC3B,MAAM,GAAE,SAAS,EAAO,EACxB,YAAY,GAAE,MAAyB,EACvC,QAAQ,CAAC,EAAE,mBAAmB,EAC9B,YAAY,CAAC,EAAE,wBAAwB,EACvC,SAAS,CAAC,EAAE,oBAAoB,GAC/B,mBAAmB,EAAE,CA+DvB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,6BAA6B,EACrC,UAAU,EAAE,SAAS,EAAE,EACvB,YAAY,UAAQ,GACnB;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,IAAI,CAAA;CAAE,CA+C3D;AA+BD;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,EAC9B,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,IAAI,CAAA;CAAE,GAC3C,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The config options of a session, as both the v1 core and the v2 core
|
|
3
|
-
* build them:
|
|
4
|
-
* agent.
|
|
3
|
+
* build them: model, effort, Fast mode, ultracode, mode and the main-thread
|
|
4
|
+
* agent. A client gets them in that order (`orderedConfigOptions`), for a
|
|
5
|
+
* root session and for a subagent's session.
|
|
5
6
|
*/
|
|
6
7
|
import { RequestError, } from "@agentclientprotocol/sdk/unstable";
|
|
7
8
|
import { AIR_RECOMMENDED_CONFIG_VALUE_CAPABILITY, clientSupportsAirCapability, } from "./air-extension.js";
|
|
8
|
-
import { AGENT_CONFIG_ID, DEFAULT_AGENT_ID } from "./session-config-ids.js";
|
|
9
|
+
import { AGENT_CONFIG_ID, DEFAULT_AGENT_ID, EFFORT_CONFIG_ID } from "./session-config-ids.js";
|
|
9
10
|
import { buildEffortConfigOption } from "./session-effort.js";
|
|
10
11
|
import { createFastModeConfigOption, FAST_MODE_CONFIG_ID, resolveFastModeEnabled, } from "./session-fast-mode.js";
|
|
11
12
|
import { MODE_CONFIG_ID, SessionModeManager } from "./session-mode.js";
|
|
@@ -64,8 +65,34 @@ export function clientSupportsBooleanConfigOptions(clientCapabilities) {
|
|
|
64
65
|
export function clientSupportsRecommendedConfigValue(clientCapabilities) {
|
|
65
66
|
return clientSupportsAirCapability(clientCapabilities, AIR_RECOMMENDED_CONFIG_VALUE_CAPABILITY);
|
|
66
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* The ids of a session's config options, in the order a client gets them.
|
|
70
|
+
* An option is ranked by its id and not by its `category`, which the agent
|
|
71
|
+
* option lacks.
|
|
72
|
+
*/
|
|
73
|
+
const CONFIG_OPTION_ORDER = [
|
|
74
|
+
MODEL_CONFIG_ID,
|
|
75
|
+
EFFORT_CONFIG_ID,
|
|
76
|
+
FAST_MODE_CONFIG_ID,
|
|
77
|
+
ULTRACODE_CONFIG_ID,
|
|
78
|
+
MODE_CONFIG_ID,
|
|
79
|
+
AGENT_CONFIG_ID,
|
|
80
|
+
];
|
|
81
|
+
/**
|
|
82
|
+
* `options` as a client gets them, for a root session and for a subagent's
|
|
83
|
+
* session: in {@link CONFIG_OPTION_ORDER}'s order, then each option with
|
|
84
|
+
* another id, in the order it came.
|
|
85
|
+
*/
|
|
86
|
+
export function orderedConfigOptions(options) {
|
|
87
|
+
const rank = (option) => {
|
|
88
|
+
const index = CONFIG_OPTION_ORDER.indexOf(option.id);
|
|
89
|
+
return index < 0 ? CONFIG_OPTION_ORDER.length : index;
|
|
90
|
+
};
|
|
91
|
+
return [...options].sort((left, right) => rank(left) - rank(right));
|
|
92
|
+
}
|
|
93
|
+
/** The config options of a root session, in the order a client gets them. */
|
|
67
94
|
export function buildConfigOptions(modes, models, modelInfos, currentEffortLevel, agents = [], currentAgent = DEFAULT_AGENT_ID, fastMode, presentation, ultracode) {
|
|
68
|
-
const options = [
|
|
95
|
+
const options = [];
|
|
69
96
|
// A gateway that lists none of the SDK's models leaves no model to offer, so
|
|
70
97
|
// there is no model option at all.
|
|
71
98
|
if (models.availableModels.length > 0) {
|
|
@@ -85,6 +112,7 @@ export function buildConfigOptions(modes, models, modelInfos, currentEffortLevel
|
|
|
85
112
|
if (ultracode?.supported) {
|
|
86
113
|
options.push(createUltracodeConfigOption(ultracode.enabled, ultracode.useBooleanOption));
|
|
87
114
|
}
|
|
115
|
+
options.push(SessionModeManager.configOption(modes));
|
|
88
116
|
// Only surface the Agent picker when there's a real choice — i.e. the user
|
|
89
117
|
// has configured at least one custom agent (built-ins are filtered out in
|
|
90
118
|
// discoverCustomAgents). With none configured, "Default" would be the only
|
|
@@ -106,7 +134,9 @@ export function buildConfigOptions(modes, models, modelInfos, currentEffortLevel
|
|
|
106
134
|
],
|
|
107
135
|
});
|
|
108
136
|
}
|
|
109
|
-
|
|
137
|
+
// The statements above already follow CONFIG_OPTION_ORDER. Sorting by it
|
|
138
|
+
// keeps this list and a subagent's list on the one definition.
|
|
139
|
+
return orderedConfigOptions(options);
|
|
110
140
|
}
|
|
111
141
|
/**
|
|
112
142
|
* The value that a `session/set_config_option` request sets on `option`, the
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* The configuration of a subagent's session, as its hooks report it. Both
|
|
3
3
|
* the v1 core (`ClaudeAcpAgent.subagentConfigurationHook`, for both forms of
|
|
4
4
|
* subagent sessions) and the v2 core (`v2/child-config.ts`)
|
|
5
|
-
* build a child's config options with these
|
|
5
|
+
* build a child's config options with these, and send them in the root
|
|
6
|
+
* session's order (`orderedConfigOptions` in `session-config-options.ts`).
|
|
6
7
|
*/
|
|
7
8
|
import type { SessionConfigOption, SessionModeState } from "@agentclientprotocol/sdk/unstable";
|
|
8
9
|
import type { AgentInfo, HookInput } from "@anthropic-ai/claude-agent-sdk";
|
|
@@ -23,10 +24,4 @@ export type SubagentConfigurationContext = {
|
|
|
23
24
|
* for a hook of the root session, and for one that reports none of these.
|
|
24
25
|
*/
|
|
25
26
|
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
27
|
//# sourceMappingURL=subagent-configuration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent-configuration.d.ts","sourceRoot":"","sources":["../src/subagent-configuration.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"subagent-configuration.d.ts","sourceRoot":"","sources":["../src/subagent-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;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"}
|
|
@@ -55,16 +55,3 @@ export function subagentHookOptions(input, context) {
|
|
|
55
55
|
}
|
|
56
56
|
return options;
|
|
57
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
|
-
}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* child's hooks report (its mode, model after a `PostModelSwitch`, effort and
|
|
5
5
|
* agent type, see `subagentHookOptions`) and the model of its responses. Each
|
|
6
6
|
* report merges into the child's options, by id, and the client gets all of
|
|
7
|
-
* them again when any changed, in
|
|
7
|
+
* them again when any changed, in the root session's order
|
|
8
|
+
* (`orderedConfigOptions`).
|
|
8
9
|
*
|
|
9
10
|
* A hook can come before the child's announcement: its options wait for it.
|
|
10
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"child-config.d.ts","sourceRoot":"","sources":["../../src/v2/child-config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"child-config.d.ts","sourceRoot":"","sources":["../../src/v2/child-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC/F,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAChG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,w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
|
2
|
+
import { subagentHookOptions } from "../subagent-configuration.js";
|
|
2
3
|
/** The most children not announced yet whose options wait. */
|
|
3
4
|
const MAX_PENDING_CHILDREN = 64;
|
|
4
5
|
export class ChildConfigurations {
|
|
@@ -50,7 +51,7 @@ export class ChildConfigurations {
|
|
|
50
51
|
const config = this.children.get(agentId);
|
|
51
52
|
if (!config)
|
|
52
53
|
return undefined;
|
|
53
|
-
const options =
|
|
54
|
+
const options = orderedConfigOptions(config.options.values());
|
|
54
55
|
const snapshot = JSON.stringify(options);
|
|
55
56
|
if (config.published === snapshot)
|
|
56
57
|
return undefined;
|
package/dist/v2/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The config options of a v2 session: its
|
|
3
|
-
*
|
|
2
|
+
* The config options of a v2 session: its model, effort, Fast mode,
|
|
3
|
+
* ultracode, permission mode and main-thread agent. Claude Code owns them
|
|
4
4
|
* all. The session sets each on the query when the client picks a value, and
|
|
5
5
|
* follows the changes it learns of (an approved plan's mode, a model switch
|
|
6
6
|
* that the adapter did not make, the Fast mode state that Claude Code
|
package/dist/v2/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The config options of a v2 session: its
|
|
3
|
-
*
|
|
2
|
+
* The config options of a v2 session: its model, effort, Fast mode,
|
|
3
|
+
* ultracode, permission mode and main-thread agent. Claude Code owns them
|
|
4
4
|
* all. The session sets each on the query when the client picks a value, and
|
|
5
5
|
* follows the changes it learns of (an approved plan's mode, a model switch
|
|
6
6
|
* that the adapter did not make, the Fast mode state that Claude Code
|
package/package.json
CHANGED