@agentclientprotocol/claude-agent-acp 0.85.1 → 0.85.2-preview.1
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/serve.d.ts.map +1 -1
- package/dist/serve.js +1 -2
- package/dist/v2/agent.d.ts +0 -7
- package/dist/v2/agent.d.ts.map +1 -1
- package/dist/v2/agent.js +32 -21
- package/dist/v2/initialize.d.ts.map +1 -1
- package/dist/v2/initialize.js +4 -2
- package/dist/v2/session-update.d.ts +15 -0
- package/dist/v2/session-update.d.ts.map +1 -0
- package/dist/v2/session-update.js +27 -0
- package/dist/v2/session.d.ts +23 -0
- package/dist/v2/session.d.ts.map +1 -0
- package/dist/v2/session.js +96 -0
- package/package.json +2 -2
package/dist/serve.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAC/D,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAI9E;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE;IAAE,cAAc,EAAE,OAAO,CAAA;CAAE,GACnC;IAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAC/D,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAI9E;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE;IAAE,cAAc,EAAE,OAAO,CAAA;CAAE,GACnC;IAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAkBrD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GACvC,EAAE,CAAC,mBAAmB,CAKxB"}
|
package/dist/serve.js
CHANGED
|
@@ -23,8 +23,7 @@ export function serveAcp(logger, options) {
|
|
|
23
23
|
? acpProtocolRouter(logger, onAgent).connect(v2.ndJsonStream(output, input))
|
|
24
24
|
: v1AgentApp(logger, onAgent).connect(ndJsonStream(output, input));
|
|
25
25
|
return {
|
|
26
|
-
|
|
27
|
-
closed: closed,
|
|
26
|
+
closed,
|
|
28
27
|
dispose: async () => {
|
|
29
28
|
await agent?.dispose();
|
|
30
29
|
},
|
package/dist/v2/agent.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The experimental draft ACP v2 surface of the adapter.
|
|
3
|
-
*
|
|
4
|
-
* `ClaudeAcpAgent` speaks ACP v1 types. This surface translates each v2
|
|
5
|
-
* request into the v1 request that the agent serves, and each v1 message that
|
|
6
|
-
* the agent sends into its v2 form, so v1 and v2 share one implementation.
|
|
7
|
-
*/
|
|
8
1
|
import * as v2 from "@agentclientprotocol/sdk/experimental/v2";
|
|
9
2
|
import { ClaudeAcpAgent, type Logger } from "../acp-agent.js";
|
|
10
3
|
/**
|
package/dist/v2/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/v2/agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/v2/agent.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAkB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAa9E;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GACvC,EAAE,CAAC,QAAQ,CA4Bb"}
|
package/dist/v2/agent.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The experimental draft ACP v2 surface of the adapter.
|
|
3
|
-
*
|
|
4
|
-
* `ClaudeAcpAgent` speaks ACP v1 types. This surface translates each v2
|
|
5
|
-
* request into the v1 request that the agent serves, and each v1 message that
|
|
6
|
-
* the agent sends into its v2 form, so v1 and v2 share one implementation.
|
|
7
|
-
*/
|
|
8
1
|
import * as v2 from "@agentclientprotocol/sdk/experimental/v2";
|
|
9
2
|
import { ClaudeAcpAgent } from "../acp-agent.js";
|
|
10
3
|
import { v1InitializeRequest, v2InitializeResponse } from "./initialize.js";
|
|
4
|
+
import { v1NewSessionRequest, v1ResumeSessionRequest, v1SetSessionConfigOptionRequest, v2ConfigOptions, v2NewSessionResponse, v2ResumeSessionResponse, } from "./session.js";
|
|
5
|
+
import { v2SessionUpdate } from "./session-update.js";
|
|
11
6
|
/**
|
|
12
7
|
* The ACP v2 surface, for one connection.
|
|
13
8
|
*
|
|
@@ -25,15 +20,23 @@ export function v2AgentApp(logger, onAgent) {
|
|
|
25
20
|
})
|
|
26
21
|
.onRequest(v2.methods.agent.initialize, async ({ params }) => v2InitializeResponse(await agent.initialize(v1InitializeRequest(params))))
|
|
27
22
|
.onRequest(v2.methods.agent.auth.login, ({ params }) => agent.authenticate(params))
|
|
28
|
-
.onRequest(v2.methods.agent.auth.logout, ({ params }) => agent.logout(params))
|
|
23
|
+
.onRequest(v2.methods.agent.auth.logout, ({ params }) => agent.logout(params))
|
|
24
|
+
.onRequest(v2.methods.agent.session.new, async ({ params }) => v2NewSessionResponse(await agent.newSession(v1NewSessionRequest(params))))
|
|
25
|
+
.onRequest(v2.methods.agent.session.list, ({ params }) => agent.listSessions(params))
|
|
26
|
+
.onRequest(v2.methods.agent.session.resume, async ({ params }) => v2ResumeSessionResponse(await agent.resumeSession(v1ResumeSessionRequest(params))))
|
|
27
|
+
.onRequest(v2.methods.agent.session.close, ({ params }) => agent.closeSession(params))
|
|
28
|
+
.onRequest(v2.methods.agent.session.delete, ({ params }) => agent.deleteSession(params))
|
|
29
|
+
.onRequest(v2.methods.agent.session.setConfigOption, async ({ params }) => {
|
|
30
|
+
const { configOptions, ...response } = await agent.setSessionConfigOption(v1SetSessionConfigOptionRequest(params));
|
|
31
|
+
return { ...response, configOptions: v2ConfigOptions(configOptions) };
|
|
32
|
+
});
|
|
29
33
|
}
|
|
30
34
|
/**
|
|
31
35
|
* The {@link AcpClient} of an ACP v2 connection: it sends the v1 messages of
|
|
32
36
|
* the agent as v2 messages.
|
|
33
37
|
*
|
|
34
|
-
* The v2 surface
|
|
35
|
-
*
|
|
36
|
-
* session-scoped method rejects until the v2 surface serves sessions.
|
|
38
|
+
* The v2 surface does not serve prompts yet, so permission requests, which
|
|
39
|
+
* only a prompt turn makes, still reject.
|
|
37
40
|
*/
|
|
38
41
|
class V2ClientConnection {
|
|
39
42
|
ctx;
|
|
@@ -46,17 +49,28 @@ class V2ClientConnection {
|
|
|
46
49
|
}
|
|
47
50
|
return this.ctx.notify(method, params);
|
|
48
51
|
}
|
|
49
|
-
sessionUpdate() {
|
|
50
|
-
|
|
52
|
+
async sessionUpdate({ update, ...notification }) {
|
|
53
|
+
const v2Update = v2SessionUpdate(update);
|
|
54
|
+
if (v2Update) {
|
|
55
|
+
await this.ctx.notify(v2.methods.client.session.update, {
|
|
56
|
+
...notification,
|
|
57
|
+
update: v2Update,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
51
60
|
}
|
|
52
61
|
requestPermission() {
|
|
53
|
-
return
|
|
62
|
+
return Promise.reject(new Error("The ACP v2 surface does not serve session/request_permission yet"));
|
|
54
63
|
}
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
// Elicitation is the same in v1 and v2.
|
|
65
|
+
createElicitation(params, signal) {
|
|
66
|
+
return this.ctx.request(v2.methods.client.elicitation.create,
|
|
67
|
+
// The v1 types accept a property schema with any tag; the v2 types accept
|
|
68
|
+
// one only in a received value. As on v1, an MCP server's schema is
|
|
69
|
+
// relayed here unchanged, so this cast does not check it.
|
|
70
|
+
params, { cancellationSignal: signal });
|
|
57
71
|
}
|
|
58
|
-
completeElicitation() {
|
|
59
|
-
return
|
|
72
|
+
completeElicitation(params) {
|
|
73
|
+
return this.ctx.notify(v2.methods.client.elicitation.complete, params);
|
|
60
74
|
}
|
|
61
75
|
// v2 has no client file system. The agent never calls these on v2, because
|
|
62
76
|
// `v1InitializeRequest` reports no `fs` capability.
|
|
@@ -70,6 +84,3 @@ class V2ClientConnection {
|
|
|
70
84
|
function isExtensionMethod(method) {
|
|
71
85
|
return method.startsWith("_");
|
|
72
86
|
}
|
|
73
|
-
function noV2Sessions(method) {
|
|
74
|
-
return Promise.reject(new Error(`The ACP v2 surface does not serve sessions yet (${method})`));
|
|
75
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../src/v2/initialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAE/D,0DAA0D;AAC1D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../src/v2/initialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAE/D,0DAA0D;AAC1D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,GAAG,iBAAiB,CAwBpF;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,EAAE,CAAC,kBAAkB,CAcxF"}
|
package/dist/v2/initialize.js
CHANGED
|
@@ -20,8 +20,10 @@ export function v1InitializeRequest(request) {
|
|
|
20
20
|
// reads, writes, and runs commands itself.
|
|
21
21
|
fs: { readTextFile: false, writeTextFile: false },
|
|
22
22
|
terminal: false,
|
|
23
|
-
// Every v2 client handles boolean config options; v1 asks
|
|
24
|
-
|
|
23
|
+
// Every v2 client handles boolean config options and notices; v1 asks
|
|
24
|
+
// for a marker. With notices, the agent reports advisories as notices
|
|
25
|
+
// rather than as transcript messages.
|
|
26
|
+
session: { configOptions: { boolean: {} }, notices: {} },
|
|
25
27
|
// v1 marks terminal auth support with a boolean, v2 with an object.
|
|
26
28
|
auth: {
|
|
27
29
|
terminal: capabilities?.auth?.terminal != null,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The v2 form of the session updates that `ClaudeAcpAgent` sends as v1
|
|
3
|
+
* updates.
|
|
4
|
+
*/
|
|
5
|
+
import * as v2 from "@agentclientprotocol/sdk/experimental/v2";
|
|
6
|
+
import type { AcpSessionNotification } from "../acp-subagents.js";
|
|
7
|
+
/**
|
|
8
|
+
* The v2 form of a v1 session update, or `undefined` when v2 has no
|
|
9
|
+
* counterpart and the update tells a v2 client nothing new.
|
|
10
|
+
*
|
|
11
|
+
* Update kinds that the v2 surface does not translate yet throw, so a gap is
|
|
12
|
+
* an error rather than a silently missing update.
|
|
13
|
+
*/
|
|
14
|
+
export declare function v2SessionUpdate(update: AcpSessionNotification["update"]): v2.SessionUpdate | undefined;
|
|
15
|
+
//# sourceMappingURL=session-update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-update.d.ts","sourceRoot":"","sources":["../../src/v2/session-update.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAGlE;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,sBAAsB,CAAC,QAAQ,CAAC,GACvC,EAAE,CAAC,aAAa,GAAG,SAAS,CAoB9B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { v2AvailableCommands, v2ConfigOptions } from "./session.js";
|
|
2
|
+
/**
|
|
3
|
+
* The v2 form of a v1 session update, or `undefined` when v2 has no
|
|
4
|
+
* counterpart and the update tells a v2 client nothing new.
|
|
5
|
+
*
|
|
6
|
+
* Update kinds that the v2 surface does not translate yet throw, so a gap is
|
|
7
|
+
* an error rather than a silently missing update.
|
|
8
|
+
*/
|
|
9
|
+
export function v2SessionUpdate(update) {
|
|
10
|
+
switch (update.sessionUpdate) {
|
|
11
|
+
case "available_commands_update":
|
|
12
|
+
return { ...update, availableCommands: v2AvailableCommands(update.availableCommands) };
|
|
13
|
+
case "config_option_update":
|
|
14
|
+
return { ...update, configOptions: v2ConfigOptions(update.configOptions) };
|
|
15
|
+
case "session_info_update":
|
|
16
|
+
case "usage_update":
|
|
17
|
+
case "notice":
|
|
18
|
+
return update;
|
|
19
|
+
case "current_mode_update":
|
|
20
|
+
// v2 has no modes: the mode is the `mode` config option. Every mode
|
|
21
|
+
// change also reaches the client as a `config_option_update` or in the
|
|
22
|
+
// `configOptions` of a `session/set_config_option` response.
|
|
23
|
+
return undefined;
|
|
24
|
+
default:
|
|
25
|
+
throw new Error(`The ACP v2 surface does not translate ${update.sessionUpdate} session updates yet`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ACP v2 session lifecycle, expressed through the v1 session methods of
|
|
3
|
+
* `ClaudeAcpAgent`: v2 requests become the v1 requests that the agent serves,
|
|
4
|
+
* and its v1 responses become v2 responses.
|
|
5
|
+
*/
|
|
6
|
+
import { type AvailableCommand, type NewSessionRequest, type NewSessionResponse, type ResumeSessionRequest, type ResumeSessionResponse, type SessionConfigOption, type SetSessionConfigOptionRequest } from "@agentclientprotocol/sdk";
|
|
7
|
+
import * as v2 from "@agentclientprotocol/sdk/experimental/v2";
|
|
8
|
+
export declare function v1NewSessionRequest(params: v2.NewSessionRequest): NewSessionRequest;
|
|
9
|
+
/**
|
|
10
|
+
* `replayFrom` is rejected until the v2 surface can translate the replayed
|
|
11
|
+
* history, which needs the message and tool call updates.
|
|
12
|
+
*/
|
|
13
|
+
export declare function v1ResumeSessionRequest(params: v2.ResumeSessionRequest): ResumeSessionRequest;
|
|
14
|
+
/** v2 drops `modes`: the session mode is the `mode` config option, which the agent always lists. */
|
|
15
|
+
export declare function v2NewSessionResponse(response: NewSessionResponse): v2.NewSessionResponse;
|
|
16
|
+
export declare function v2ResumeSessionResponse(response: ResumeSessionResponse): v2.ResumeSessionResponse;
|
|
17
|
+
/** v2 tags a select value with `type: "id"`; v1 leaves it untagged. */
|
|
18
|
+
export declare function v1SetSessionConfigOptionRequest(params: v2.SetSessionConfigOptionRequest): SetSessionConfigOptionRequest;
|
|
19
|
+
/** v2 names the id of an option `configId` and the id of a select group `groupId`. */
|
|
20
|
+
export declare function v2ConfigOptions(options: SessionConfigOption[]): v2.SessionConfigOption[];
|
|
21
|
+
/** v2 tags the free-text input of a command with `type: "text"`. */
|
|
22
|
+
export declare function v2AvailableCommands(commands: AvailableCommand[]): v2.AvailableCommand[];
|
|
23
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/v2/session.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAEL,KAAK,gBAAgB,EAErB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAGxB,KAAK,6BAA6B,EACnC,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAE/D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,GAAG,iBAAiB,CAInF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,EAAE,CAAC,oBAAoB,GAAG,oBAAoB,CAS5F;AAED,oGAAoG;AACpG,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,EAAE,CAAC,kBAAkB,CAExF;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,EAAE,CAAC,qBAAqB,CAKjG;AAED,uEAAuE;AACvE,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,EAAE,CAAC,6BAA6B,GACvC,6BAA6B,CAgB/B;AAED,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,OAAO,EAAE,mBAAmB,EAAE,GAAG,EAAE,CAAC,mBAAmB,EAAE,CAQxF;AAWD,oEAAoE;AACpE,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAKvF"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ACP v2 session lifecycle, expressed through the v1 session methods of
|
|
3
|
+
* `ClaudeAcpAgent`: v2 requests become the v1 requests that the agent serves,
|
|
4
|
+
* and its v1 responses become v2 responses.
|
|
5
|
+
*/
|
|
6
|
+
import { RequestError, } from "@agentclientprotocol/sdk";
|
|
7
|
+
import * as v2 from "@agentclientprotocol/sdk/experimental/v2";
|
|
8
|
+
export function v1NewSessionRequest(params) {
|
|
9
|
+
const { mcpServers, ...request } = params;
|
|
10
|
+
// v1 requires the list; v2 treats an omitted list as an empty one.
|
|
11
|
+
return { ...request, mcpServers: (mcpServers ?? []).map(v1McpServer) };
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `replayFrom` is rejected until the v2 surface can translate the replayed
|
|
15
|
+
* history, which needs the message and tool call updates.
|
|
16
|
+
*/
|
|
17
|
+
export function v1ResumeSessionRequest(params) {
|
|
18
|
+
const { replayFrom, mcpServers, ...request } = params;
|
|
19
|
+
if (replayFrom != null) {
|
|
20
|
+
throw RequestError.invalidParams({ replayFrom }, "The ACP v2 surface does not replay session history yet");
|
|
21
|
+
}
|
|
22
|
+
return { ...request, ...(mcpServers ? { mcpServers: mcpServers.map(v1McpServer) } : {}) };
|
|
23
|
+
}
|
|
24
|
+
/** v2 drops `modes`: the session mode is the `mode` config option, which the agent always lists. */
|
|
25
|
+
export function v2NewSessionResponse(response) {
|
|
26
|
+
return { sessionId: response.sessionId, ...v2ResumeSessionResponse(response) };
|
|
27
|
+
}
|
|
28
|
+
export function v2ResumeSessionResponse(response) {
|
|
29
|
+
return {
|
|
30
|
+
...v2ConfigOptionsField(response.configOptions),
|
|
31
|
+
...(response._meta != null ? { _meta: response._meta } : {}),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** v2 tags a select value with `type: "id"`; v1 leaves it untagged. */
|
|
35
|
+
export function v1SetSessionConfigOptionRequest(params) {
|
|
36
|
+
const request = {
|
|
37
|
+
sessionId: params.sessionId,
|
|
38
|
+
configId: params.configId,
|
|
39
|
+
...(params._meta != null ? { _meta: params._meta } : {}),
|
|
40
|
+
};
|
|
41
|
+
if (v2.SetSessionConfigOptionRequest.isId(params)) {
|
|
42
|
+
return { ...request, value: params.value };
|
|
43
|
+
}
|
|
44
|
+
if (v2.SetSessionConfigOptionRequest.isBoolean(params)) {
|
|
45
|
+
return { ...request, type: "boolean", value: params.value };
|
|
46
|
+
}
|
|
47
|
+
throw RequestError.invalidParams({ type: params.type }, `Config option values of type ${params.type} are not supported`);
|
|
48
|
+
}
|
|
49
|
+
/** v2 names the id of an option `configId` and the id of a select group `groupId`. */
|
|
50
|
+
export function v2ConfigOptions(options) {
|
|
51
|
+
return options.map((option) => {
|
|
52
|
+
const { id, ...rest } = option;
|
|
53
|
+
if (rest.type === "select") {
|
|
54
|
+
return { ...rest, configId: id, options: v2SelectOptions(rest.options) };
|
|
55
|
+
}
|
|
56
|
+
return { ...rest, configId: id };
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function v2SelectOptions(options) {
|
|
60
|
+
if (!isGrouped(options))
|
|
61
|
+
return options;
|
|
62
|
+
return options.map(({ group, ...selectGroup }) => ({ ...selectGroup, groupId: group }));
|
|
63
|
+
}
|
|
64
|
+
function isGrouped(options) {
|
|
65
|
+
return options.some((entry) => "group" in entry);
|
|
66
|
+
}
|
|
67
|
+
/** v2 tags the free-text input of a command with `type: "text"`. */
|
|
68
|
+
export function v2AvailableCommands(commands) {
|
|
69
|
+
return commands.map(({ input, ...command }) => ({
|
|
70
|
+
...command,
|
|
71
|
+
...(input != null ? { input: { type: "text", ...input } } : {}),
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
/** v1 responses may send `null`; v2 omits the field instead. */
|
|
75
|
+
function v2ConfigOptionsField(options) {
|
|
76
|
+
return options != null ? { configOptions: v2ConfigOptions(options) } : {};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* v2 requires a `type` on every transport and makes the empty lists optional.
|
|
80
|
+
* The agent recognizes a v1 stdio server by its missing `type`, so the v2 tag
|
|
81
|
+
* is dropped. A transport that v1 cannot express is rejected rather than
|
|
82
|
+
* silently left out of the session.
|
|
83
|
+
*/
|
|
84
|
+
function v1McpServer(server) {
|
|
85
|
+
if (v2.McpServer.isStdio(server)) {
|
|
86
|
+
const { name, command, args, env, _meta } = server;
|
|
87
|
+
return { name, command, args: args ?? [], env: env ?? [], ...(_meta != null ? { _meta } : {}) };
|
|
88
|
+
}
|
|
89
|
+
if (v2.McpServer.isHttp(server)) {
|
|
90
|
+
return { ...server, headers: server.headers ?? [] };
|
|
91
|
+
}
|
|
92
|
+
if (v2.McpServer.isAcp(server)) {
|
|
93
|
+
return server;
|
|
94
|
+
}
|
|
95
|
+
throw RequestError.invalidParams({ type: server.type }, `MCP servers of type ${server.type} are not supported`);
|
|
96
|
+
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.85.1",
|
|
6
|
+
"version": "0.85.2-preview.1",
|
|
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",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"node": ">=22"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@agentclientprotocol/sdk": "1.
|
|
68
|
+
"@agentclientprotocol/sdk": "1.7.0",
|
|
69
69
|
"@anthropic-ai/claude-agent-sdk": "0.3.286",
|
|
70
70
|
"diff": "9.0.0",
|
|
71
71
|
"zod": "4.6.5"
|