@finityno/claude-code-acp 0.13.6 → 0.14.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 +34 -1
- package/dist/acp-agent.d.ts.map +1 -1
- package/dist/acp-agent.js +71 -2
- package/dist/lib.d.ts +1 -1
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +1 -1
- package/dist/tools.d.ts +10 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +122 -67
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
> **Fork of [@zed-industries/claude-code-acp](https://github.com/zed-industries/claude-code-acp)**
|
|
6
6
|
>
|
|
7
|
-
> This fork adds support for **subagent (Task tool) tracking** and
|
|
7
|
+
> This fork adds support for **subagent (Task tool) tracking** and **AskUserQuestion tool** support.
|
|
8
8
|
|
|
9
9
|
Use [Claude Code](https://www.anthropic.com/claude-code) from [ACP-compatible](https://agentclientprotocol.com) clients such as [Zed](https://zed.dev)!
|
|
10
10
|
|
|
@@ -34,6 +34,7 @@ This adapter implements an ACP agent using the official [Claude Agent SDK](https
|
|
|
34
34
|
- Custom [Slash commands](https://docs.anthropic.com/en/docs/claude-code/slash-commands)
|
|
35
35
|
- Client MCP servers
|
|
36
36
|
- **Subagent tracking** (Task tool lifecycle events)
|
|
37
|
+
- **AskUserQuestion** (Claude can ask clarifying questions)
|
|
37
38
|
|
|
38
39
|
## Subagent Tracking
|
|
39
40
|
|
|
@@ -66,6 +67,38 @@ tracker.getStats(); // Counts & avg duration
|
|
|
66
67
|
|
|
67
68
|
See [docs/subagent-tracking.md](docs/subagent-tracking.md) for full API documentation.
|
|
68
69
|
|
|
70
|
+
## AskUserQuestion
|
|
71
|
+
|
|
72
|
+
Claude can ask clarifying questions during execution. Questions are presented via the ACP permission request system:
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
// Claude sends a question like:
|
|
76
|
+
{
|
|
77
|
+
"question": "Which testing framework should we use?",
|
|
78
|
+
"header": "Testing",
|
|
79
|
+
"options": [
|
|
80
|
+
{ "label": "Jest", "description": "Popular JavaScript testing framework" },
|
|
81
|
+
{ "label": "Vitest", "description": "Vite-native, fast testing framework" }
|
|
82
|
+
],
|
|
83
|
+
"multiSelect": false
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// User selects an option, Claude receives:
|
|
87
|
+
{
|
|
88
|
+
"answers": {
|
|
89
|
+
"Which testing framework should we use?": "Vitest"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Features:
|
|
95
|
+
- Multiple questions per request (1-4)
|
|
96
|
+
- 2-4 options per question with labels and descriptions
|
|
97
|
+
- MultiSelect support for non-mutually-exclusive choices
|
|
98
|
+
- "Other" option for free-text input
|
|
99
|
+
|
|
100
|
+
See [docs/ask-user-question.md](docs/ask-user-question.md) for ACP client integration details.
|
|
101
|
+
|
|
69
102
|
## Usage
|
|
70
103
|
|
|
71
104
|
### With Zed
|
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,EACL,KAAK,EACL,mBAAmB,EACnB,mBAAmB,EAEnB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAElB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EAEpB,oBAAoB,EACpB,qBAAqB,EAErB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,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xE,aAAa,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAKjF,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU;YAmN3B,aAAa;CA6P5B;AAwED,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,cAAc,CA6EpE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,GAAG,iBAAiB,EAAE,GAAG,gBAAgB,EAAE,GAAG,wBAAwB,EAAE,EACvF,IAAI,EAAE,WAAW,GAAG,MAAM,EAC1B,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,eAAe;AACjC,kGAAkG;AAClG,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,GACjC,mBAAmB,EAAE,CAiRvB;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,0BAA0B,EACnC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,eAAe,GAChC,mBAAmB,EAAE,CAuCvB;AAED,wBAAgB,MAAM,SAMrB"}
|
package/dist/acp-agent.js
CHANGED
|
@@ -331,6 +331,71 @@ export class ClaudeAcpAgent {
|
|
|
331
331
|
};
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
+
if (toolName === "AskUserQuestion") {
|
|
335
|
+
const input = toolInput;
|
|
336
|
+
const answers = {};
|
|
337
|
+
// Process each question sequentially
|
|
338
|
+
for (const question of input.questions || []) {
|
|
339
|
+
// Build permission options from question options
|
|
340
|
+
const permissionOptions = question.options.map((opt) => ({
|
|
341
|
+
kind: "allow_once",
|
|
342
|
+
name: `${opt.label} - ${opt.description}`,
|
|
343
|
+
optionId: opt.label,
|
|
344
|
+
}));
|
|
345
|
+
// Add "Other" option for free-text input
|
|
346
|
+
permissionOptions.push({
|
|
347
|
+
kind: "allow_once",
|
|
348
|
+
name: "Other (type custom answer)",
|
|
349
|
+
optionId: "__other__",
|
|
350
|
+
});
|
|
351
|
+
const response = await this.client.requestPermission({
|
|
352
|
+
options: permissionOptions,
|
|
353
|
+
sessionId,
|
|
354
|
+
toolCall: {
|
|
355
|
+
toolCallId: toolUseID,
|
|
356
|
+
rawInput: { question: question.question, header: question.header },
|
|
357
|
+
title: question.header || "Question",
|
|
358
|
+
},
|
|
359
|
+
_meta: {
|
|
360
|
+
claudeCode: {
|
|
361
|
+
questionType: "askUserQuestion",
|
|
362
|
+
multiSelect: question.multiSelect,
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
});
|
|
366
|
+
if (signal.aborted || response.outcome?.outcome === "cancelled") {
|
|
367
|
+
return {
|
|
368
|
+
behavior: "deny",
|
|
369
|
+
message: "User cancelled the question",
|
|
370
|
+
interrupt: true,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
if (response.outcome?.outcome === "selected") {
|
|
374
|
+
const selectedId = response.outcome.optionId;
|
|
375
|
+
if (selectedId === "__other__") {
|
|
376
|
+
// Handle free-text - ACP client should provide custom text in _meta
|
|
377
|
+
const customText = response.outcome._meta?.customText ||
|
|
378
|
+
"Other";
|
|
379
|
+
answers[question.question] = customText;
|
|
380
|
+
}
|
|
381
|
+
else if (question.multiSelect) {
|
|
382
|
+
// For multiSelect, collect all selected labels
|
|
383
|
+
const existing = answers[question.question];
|
|
384
|
+
answers[question.question] = existing ? `${existing}, ${selectedId}` : selectedId;
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
answers[question.question] = selectedId;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
return {
|
|
392
|
+
behavior: "allow",
|
|
393
|
+
updatedInput: {
|
|
394
|
+
questions: input.questions,
|
|
395
|
+
answers,
|
|
396
|
+
},
|
|
397
|
+
};
|
|
398
|
+
}
|
|
334
399
|
if (session.permissionMode === "bypassPermissions" ||
|
|
335
400
|
(session.permissionMode === "acceptEdits" && EDIT_TOOL_NAMES.includes(toolName))) {
|
|
336
401
|
return {
|
|
@@ -508,8 +573,7 @@ export class ClaudeAcpAgent {
|
|
|
508
573
|
...creationOpts,
|
|
509
574
|
};
|
|
510
575
|
const allowedTools = [];
|
|
511
|
-
|
|
512
|
-
const disallowedTools = ["AskUserQuestion"];
|
|
576
|
+
const disallowedTools = [];
|
|
513
577
|
// Check if built-in tools should be disabled
|
|
514
578
|
const disableBuiltInTools = params._meta?.disableBuiltInTools === true;
|
|
515
579
|
if (!disableBuiltInTools) {
|
|
@@ -872,10 +936,13 @@ sdkParentToolUseId) {
|
|
|
872
936
|
// ignore if we can't turn it to JSON
|
|
873
937
|
}
|
|
874
938
|
// Send tool_call notification with subagent metadata
|
|
939
|
+
// Include parentToolUseId for nested subagents (Task called from within another Task)
|
|
875
940
|
update = {
|
|
876
941
|
_meta: {
|
|
877
942
|
claudeCode: {
|
|
878
943
|
toolName: chunk.name,
|
|
944
|
+
// For nested subagents, include parent reference
|
|
945
|
+
...(parentSubagentId && { parentToolUseId: parentSubagentId }),
|
|
879
946
|
subagent: {
|
|
880
947
|
id: chunk.id,
|
|
881
948
|
eventType: "subagent_started",
|
|
@@ -883,6 +950,8 @@ sdkParentToolUseId) {
|
|
|
883
950
|
description: input.description,
|
|
884
951
|
status: "running",
|
|
885
952
|
parentSessionId: sessionId,
|
|
953
|
+
// Include parent for nested subagents
|
|
954
|
+
...(parentSubagentId && { parentToolUseId: parentSubagentId }),
|
|
886
955
|
model: input.model,
|
|
887
956
|
runInBackground: input.run_in_background ?? false,
|
|
888
957
|
},
|
package/dist/lib.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ClaudeAcpAgent, runAcp, toAcpNotifications, streamEventToAcpNotifications, type ToolUpdateMeta, type NewSessionMeta, } from "./acp-agent.js";
|
|
2
2
|
export { loadManagedSettings, applyEnvironmentSettings, nodeToWebReadable, nodeToWebWritable, Pushable, unreachable, } from "./utils.js";
|
|
3
3
|
export { createMcpServer } from "./mcp-server.js";
|
|
4
|
-
export { toolInfoFromToolUse, planEntries, toolUpdateFromToolResult, createPreToolUseHook, acpToolNames as toolNames, } from "./tools.js";
|
|
4
|
+
export { toolInfoFromToolUse, planEntries, toolUpdateFromToolResult, createPreToolUseHook, acpToolNames as toolNames, normalizeToolName, getCanonicalToolName, } from "./tools.js";
|
|
5
5
|
export { SettingsManager, type ClaudeCodeSettings, type PermissionSettings, type PermissionDecision, type PermissionCheckResult, type SettingsManagerOptions, } from "./settings.js";
|
|
6
6
|
export { SubagentTracker, isTaskToolInput, extractSubagentMeta, type TrackedSubagent, type SubagentStatus, type SubagentType, type SubagentEventType, type SubagentUpdateMeta, type SubagentEventListener, type SubagentStats, type TaskToolInput, } from "./subagent-tracker.js";
|
|
7
7
|
export type { ClaudePlanEntry } from "./tools.js";
|
package/dist/lib.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,MAAM,EACN,kBAAkB,EAClB,6BAA6B,EAC7B,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,EACR,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,wBAAwB,EACxB,oBAAoB,EACpB,YAAY,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,MAAM,EACN,kBAAkB,EAClB,6BAA6B,EAC7B,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,EACR,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,wBAAwB,EACxB,oBAAoB,EACpB,YAAY,IAAI,SAAS,EACzB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,aAAa,GACnB,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/lib.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export { ClaudeAcpAgent, runAcp, toAcpNotifications, streamEventToAcpNotifications, } from "./acp-agent.js";
|
|
3
3
|
export { loadManagedSettings, applyEnvironmentSettings, nodeToWebReadable, nodeToWebWritable, Pushable, unreachable, } from "./utils.js";
|
|
4
4
|
export { createMcpServer } from "./mcp-server.js";
|
|
5
|
-
export { toolInfoFromToolUse, planEntries, toolUpdateFromToolResult, createPreToolUseHook, acpToolNames as toolNames, } from "./tools.js";
|
|
5
|
+
export { toolInfoFromToolUse, planEntries, toolUpdateFromToolResult, createPreToolUseHook, acpToolNames as toolNames, normalizeToolName, getCanonicalToolName, } from "./tools.js";
|
|
6
6
|
export { SettingsManager, } from "./settings.js";
|
|
7
7
|
// Export subagent tracking
|
|
8
8
|
export { SubagentTracker, isTaskToolInput, extractSubagentMeta, } from "./subagent-tracker.js";
|
package/dist/tools.d.ts
CHANGED
|
@@ -25,6 +25,16 @@ interface ToolUpdate {
|
|
|
25
25
|
content?: ToolCallContent[];
|
|
26
26
|
locations?: ToolCallLocation[];
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Normalize a tool name by stripping MCP prefixes.
|
|
30
|
+
* e.g., "mcp__acp__Read" -> "Read", "mcp__context7__query-docs" -> "query-docs"
|
|
31
|
+
*/
|
|
32
|
+
export declare function normalizeToolName(name: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Get the canonical tool name for categorization purposes.
|
|
35
|
+
* This maps tool names to their canonical form for icon/kind matching.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getCanonicalToolName(name: string): string;
|
|
28
38
|
export declare function toolInfoFromToolUse(toolUse: any): ToolInfo;
|
|
29
39
|
export declare function toolUpdateFromToolResult(toolResult: ToolResultBlockParam | BetaWebSearchToolResultBlockParam | BetaWebFetchToolResultBlockParam | WebSearchToolResultBlockParam | BetaCodeExecutionToolResultBlockParam | BetaBashCodeExecutionToolResultBlockParam | BetaTextEditorCodeExecutionToolResultBlockParam | BetaRequestMCPToolResultBlockParam | BetaToolSearchToolResultBlockParam, toolUse: any | undefined): ToolUpdate;
|
|
30
40
|
export type ClaudePlanEntry = {
|
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,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGlG,OAAO,EAAE,oBAAoB,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAWlG,eAA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c,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQnD;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,GAC/B,SAAQ,MAAgB,KAAG,YAa3B,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC9B,iBAAiB,eAAe,EAAE,SAAQ,MAAgB,KAAG,YA2C7D,CAAC"}
|
package/dist/tools.js
CHANGED
|
@@ -18,9 +18,59 @@ export const acpToolNames = {
|
|
|
18
18
|
bashOutput: ACP_TOOL_NAME_PREFIX + acpUnqualifiedToolNames.bashOutput,
|
|
19
19
|
};
|
|
20
20
|
export const EDIT_TOOL_NAMES = [acpToolNames.edit, acpToolNames.write];
|
|
21
|
+
/**
|
|
22
|
+
* Normalize a tool name by stripping MCP prefixes.
|
|
23
|
+
* e.g., "mcp__acp__Read" -> "Read", "mcp__context7__query-docs" -> "query-docs"
|
|
24
|
+
*/
|
|
25
|
+
export function normalizeToolName(name) {
|
|
26
|
+
// Strip mcp__<server>__ prefix
|
|
27
|
+
const mcpMatch = name.match(/^mcp__[^_]+__(.+)$/);
|
|
28
|
+
if (mcpMatch) {
|
|
29
|
+
return mcpMatch[1];
|
|
30
|
+
}
|
|
31
|
+
return name;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get the canonical tool name for categorization purposes.
|
|
35
|
+
* This maps tool names to their canonical form for icon/kind matching.
|
|
36
|
+
*/
|
|
37
|
+
export function getCanonicalToolName(name) {
|
|
38
|
+
const normalized = normalizeToolName(name);
|
|
39
|
+
// Map common variations to canonical names
|
|
40
|
+
const canonicalMap = {
|
|
41
|
+
// ACP tools
|
|
42
|
+
"Read": "Read",
|
|
43
|
+
"Edit": "Edit",
|
|
44
|
+
"Write": "Write",
|
|
45
|
+
"Bash": "Bash",
|
|
46
|
+
"BashOutput": "BashOutput",
|
|
47
|
+
"KillShell": "KillShell",
|
|
48
|
+
"TaskOutput": "TaskOutput",
|
|
49
|
+
// Search tools
|
|
50
|
+
"Glob": "Glob",
|
|
51
|
+
"Grep": "Grep",
|
|
52
|
+
"LS": "LS",
|
|
53
|
+
// Web tools
|
|
54
|
+
"WebFetch": "WebFetch",
|
|
55
|
+
"WebSearch": "WebSearch",
|
|
56
|
+
// Agent/planning tools
|
|
57
|
+
"Task": "Task",
|
|
58
|
+
"TodoWrite": "TodoWrite",
|
|
59
|
+
"ExitPlanMode": "ExitPlanMode",
|
|
60
|
+
"EnterPlanMode": "EnterPlanMode",
|
|
61
|
+
"AskUserQuestion": "AskUserQuestion",
|
|
62
|
+
"Skill": "Skill",
|
|
63
|
+
// Notebook tools
|
|
64
|
+
"NotebookRead": "NotebookRead",
|
|
65
|
+
"NotebookEdit": "NotebookEdit",
|
|
66
|
+
};
|
|
67
|
+
return canonicalMap[normalized] ?? normalized;
|
|
68
|
+
}
|
|
21
69
|
export function toolInfoFromToolUse(toolUse) {
|
|
22
|
-
const
|
|
70
|
+
const rawName = toolUse.name;
|
|
23
71
|
const input = toolUse.input;
|
|
72
|
+
// Get canonical name for matching
|
|
73
|
+
const name = getCanonicalToolName(rawName);
|
|
24
74
|
switch (name) {
|
|
25
75
|
case "Task":
|
|
26
76
|
return {
|
|
@@ -57,7 +107,6 @@ export function toolInfoFromToolUse(toolUse) {
|
|
|
57
107
|
locations: input?.notebook_path ? [{ path: input.notebook_path }] : [],
|
|
58
108
|
};
|
|
59
109
|
case "Bash":
|
|
60
|
-
case acpToolNames.bash:
|
|
61
110
|
return {
|
|
62
111
|
title: input?.command ? "`" + input.command.replaceAll("`", "\\`") + "`" : "Terminal",
|
|
63
112
|
kind: "execute",
|
|
@@ -71,32 +120,36 @@ export function toolInfoFromToolUse(toolUse) {
|
|
|
71
120
|
: [],
|
|
72
121
|
};
|
|
73
122
|
case "BashOutput":
|
|
74
|
-
case acpToolNames.bashOutput:
|
|
75
123
|
return {
|
|
76
124
|
title: "Tail Logs",
|
|
77
125
|
kind: "execute",
|
|
78
126
|
content: [],
|
|
79
127
|
};
|
|
80
128
|
case "KillShell":
|
|
81
|
-
case acpToolNames.killShell:
|
|
82
129
|
return {
|
|
83
130
|
title: "Kill Process",
|
|
84
131
|
kind: "execute",
|
|
85
132
|
content: [],
|
|
86
133
|
};
|
|
87
|
-
case
|
|
134
|
+
case "TaskOutput":
|
|
135
|
+
return {
|
|
136
|
+
title: input?.task_id ? `Task Output (${input.task_id})` : "Task Output",
|
|
137
|
+
kind: "read",
|
|
138
|
+
content: [],
|
|
139
|
+
};
|
|
140
|
+
case "Read": {
|
|
88
141
|
let limit = "";
|
|
89
|
-
if (input
|
|
142
|
+
if (input?.limit) {
|
|
90
143
|
limit =
|
|
91
144
|
" (" + ((input.offset ?? 0) + 1) + " - " + ((input.offset ?? 0) + input.limit) + ")";
|
|
92
145
|
}
|
|
93
|
-
else if (input
|
|
146
|
+
else if (input?.offset) {
|
|
94
147
|
limit = " (from line " + (input.offset + 1) + ")";
|
|
95
148
|
}
|
|
96
149
|
return {
|
|
97
|
-
title: "Read " + (input
|
|
150
|
+
title: "Read " + (input?.file_path ?? "File") + limit,
|
|
98
151
|
kind: "read",
|
|
99
|
-
locations: input
|
|
152
|
+
locations: input?.file_path
|
|
100
153
|
? [
|
|
101
154
|
{
|
|
102
155
|
path: input.file_path,
|
|
@@ -107,20 +160,6 @@ export function toolInfoFromToolUse(toolUse) {
|
|
|
107
160
|
content: [],
|
|
108
161
|
};
|
|
109
162
|
}
|
|
110
|
-
case "Read":
|
|
111
|
-
return {
|
|
112
|
-
title: "Read File",
|
|
113
|
-
kind: "read",
|
|
114
|
-
content: [],
|
|
115
|
-
locations: input.file_path
|
|
116
|
-
? [
|
|
117
|
-
{
|
|
118
|
-
path: input.file_path,
|
|
119
|
-
line: input.offset ?? 0,
|
|
120
|
-
},
|
|
121
|
-
]
|
|
122
|
-
: [],
|
|
123
|
-
};
|
|
124
163
|
case "LS":
|
|
125
164
|
return {
|
|
126
165
|
title: `List the ${input?.path ? "`" + input.path + "`" : "current"} directory's contents`,
|
|
@@ -128,9 +167,8 @@ export function toolInfoFromToolUse(toolUse) {
|
|
|
128
167
|
content: [],
|
|
129
168
|
locations: [],
|
|
130
169
|
};
|
|
131
|
-
case acpToolNames.edit:
|
|
132
170
|
case "Edit": {
|
|
133
|
-
const path = input?.file_path
|
|
171
|
+
const path = input?.file_path;
|
|
134
172
|
return {
|
|
135
173
|
title: path ? `Edit \`${path}\`` : "Edit",
|
|
136
174
|
kind: "edit",
|
|
@@ -147,7 +185,7 @@ export function toolInfoFromToolUse(toolUse) {
|
|
|
147
185
|
locations: path ? [{ path }] : undefined,
|
|
148
186
|
};
|
|
149
187
|
}
|
|
150
|
-
case
|
|
188
|
+
case "Write": {
|
|
151
189
|
let content = [];
|
|
152
190
|
if (input && input.file_path) {
|
|
153
191
|
content = [
|
|
@@ -174,22 +212,6 @@ export function toolInfoFromToolUse(toolUse) {
|
|
|
174
212
|
locations: input?.file_path ? [{ path: input.file_path }] : [],
|
|
175
213
|
};
|
|
176
214
|
}
|
|
177
|
-
case "Write":
|
|
178
|
-
return {
|
|
179
|
-
title: input?.file_path ? `Write ${input.file_path}` : "Write",
|
|
180
|
-
kind: "edit",
|
|
181
|
-
content: input && input.file_path
|
|
182
|
-
? [
|
|
183
|
-
{
|
|
184
|
-
type: "diff",
|
|
185
|
-
path: input.file_path,
|
|
186
|
-
oldText: null,
|
|
187
|
-
newText: input.content,
|
|
188
|
-
},
|
|
189
|
-
]
|
|
190
|
-
: [],
|
|
191
|
-
locations: input?.file_path ? [{ path: input.file_path }] : [],
|
|
192
|
-
};
|
|
193
215
|
case "Glob": {
|
|
194
216
|
let label = "Find";
|
|
195
217
|
if (input.path) {
|
|
@@ -302,6 +324,43 @@ export function toolInfoFromToolUse(toolUse) {
|
|
|
302
324
|
? [{ type: "content", content: { type: "text", text: input.plan } }]
|
|
303
325
|
: [],
|
|
304
326
|
};
|
|
327
|
+
case "AskUserQuestion":
|
|
328
|
+
return {
|
|
329
|
+
title: input?.questions?.[0]?.header || "Question",
|
|
330
|
+
kind: "think",
|
|
331
|
+
content: input?.questions
|
|
332
|
+
? [
|
|
333
|
+
{
|
|
334
|
+
type: "content",
|
|
335
|
+
content: {
|
|
336
|
+
type: "text",
|
|
337
|
+
text: Array.isArray(input.questions)
|
|
338
|
+
? input.questions
|
|
339
|
+
.map((q) => {
|
|
340
|
+
const options = q.options
|
|
341
|
+
?.map((o) => ` - ${o.label}: ${o.description}`)
|
|
342
|
+
.join("\n");
|
|
343
|
+
return `${q.question}\n${options || ""}`;
|
|
344
|
+
})
|
|
345
|
+
.join("\n\n")
|
|
346
|
+
: String(input.questions),
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
]
|
|
350
|
+
: [],
|
|
351
|
+
};
|
|
352
|
+
case "EnterPlanMode":
|
|
353
|
+
return {
|
|
354
|
+
title: "Enter Plan Mode",
|
|
355
|
+
kind: "switch_mode",
|
|
356
|
+
content: [],
|
|
357
|
+
};
|
|
358
|
+
case "Skill":
|
|
359
|
+
return {
|
|
360
|
+
title: input?.skill ? `/${input.skill}` : "Skill",
|
|
361
|
+
kind: "execute",
|
|
362
|
+
content: [],
|
|
363
|
+
};
|
|
305
364
|
case "Other": {
|
|
306
365
|
let output;
|
|
307
366
|
try {
|
|
@@ -311,7 +370,7 @@ export function toolInfoFromToolUse(toolUse) {
|
|
|
311
370
|
output = typeof input === "string" ? input : "{}";
|
|
312
371
|
}
|
|
313
372
|
return {
|
|
314
|
-
title:
|
|
373
|
+
title: rawName || "Unknown Tool",
|
|
315
374
|
kind: "other",
|
|
316
375
|
content: [
|
|
317
376
|
{
|
|
@@ -324,12 +383,23 @@ export function toolInfoFromToolUse(toolUse) {
|
|
|
324
383
|
],
|
|
325
384
|
};
|
|
326
385
|
}
|
|
327
|
-
default:
|
|
386
|
+
default: {
|
|
387
|
+
// For MCP tools from other servers, try to provide a reasonable title
|
|
388
|
+
const isMcpTool = rawName.startsWith("mcp__");
|
|
389
|
+
let title = rawName;
|
|
390
|
+
if (isMcpTool) {
|
|
391
|
+
// Extract server and tool name: mcp__server__toolName -> server: toolName
|
|
392
|
+
const parts = rawName.match(/^mcp__([^_]+)__(.+)$/);
|
|
393
|
+
if (parts) {
|
|
394
|
+
title = `${parts[1]}: ${parts[2]}`;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
328
397
|
return {
|
|
329
|
-
title:
|
|
330
|
-
kind: "other",
|
|
398
|
+
title: title || "Unknown Tool",
|
|
399
|
+
kind: isMcpTool ? "other" : "other",
|
|
331
400
|
content: [],
|
|
332
401
|
};
|
|
402
|
+
}
|
|
333
403
|
}
|
|
334
404
|
}
|
|
335
405
|
export function toolUpdateFromToolResult(toolResult, toolUse) {
|
|
@@ -340,9 +410,10 @@ export function toolUpdateFromToolResult(toolResult, toolUse) {
|
|
|
340
410
|
// Only return errors
|
|
341
411
|
return toAcpContentUpdate(toolResult.content, true);
|
|
342
412
|
}
|
|
343
|
-
|
|
413
|
+
// Use canonical name for matching
|
|
414
|
+
const canonicalName = toolUse?.name ? getCanonicalToolName(toolUse.name) : undefined;
|
|
415
|
+
switch (canonicalName) {
|
|
344
416
|
case "Read":
|
|
345
|
-
case acpToolNames.read:
|
|
346
417
|
if (Array.isArray(toolResult.content) && toolResult.content.length > 0) {
|
|
347
418
|
return {
|
|
348
419
|
content: toolResult.content.map((content) => ({
|
|
@@ -370,7 +441,7 @@ export function toolUpdateFromToolResult(toolResult, toolUse) {
|
|
|
370
441
|
};
|
|
371
442
|
}
|
|
372
443
|
return {};
|
|
373
|
-
case
|
|
444
|
+
case "Edit": {
|
|
374
445
|
const content = [];
|
|
375
446
|
const locations = [];
|
|
376
447
|
if (Array.isArray(toolResult.content) &&
|
|
@@ -416,30 +487,14 @@ export function toolUpdateFromToolResult(toolResult, toolUse) {
|
|
|
416
487
|
}
|
|
417
488
|
return result;
|
|
418
489
|
}
|
|
419
|
-
case
|
|
420
|
-
case "edit":
|
|
421
|
-
case "Edit":
|
|
422
|
-
case acpToolNames.write:
|
|
490
|
+
case "Bash":
|
|
423
491
|
case "Write": {
|
|
424
492
|
return {};
|
|
425
493
|
}
|
|
426
494
|
case "ExitPlanMode": {
|
|
427
495
|
return { title: "Exited Plan Mode" };
|
|
428
496
|
}
|
|
429
|
-
|
|
430
|
-
case "NotebookEdit":
|
|
431
|
-
case "NotebookRead":
|
|
432
|
-
case "TodoWrite":
|
|
433
|
-
case "exit_plan_mode":
|
|
434
|
-
case "Bash":
|
|
435
|
-
case "BashOutput":
|
|
436
|
-
case "KillBash":
|
|
437
|
-
case "LS":
|
|
438
|
-
case "Glob":
|
|
439
|
-
case "Grep":
|
|
440
|
-
case "WebFetch":
|
|
441
|
-
case "WebSearch":
|
|
442
|
-
case "Other":
|
|
497
|
+
// All other tools: return content as-is
|
|
443
498
|
default: {
|
|
444
499
|
return toAcpContentUpdate(toolResult.content, "is_error" in toolResult ? toolResult.is_error : false);
|
|
445
500
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.14.0",
|
|
7
7
|
"description": "An ACP-compatible coding agent powered by the Claude Code SDK (TypeScript)",
|
|
8
8
|
"main": "dist/lib.js",
|
|
9
9
|
"types": "dist/lib.d.ts",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"license": "Apache-2.0",
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@agentclientprotocol/sdk": "0.13.0",
|
|
64
|
-
"@anthropic-ai/claude-agent-sdk": "0.2.
|
|
64
|
+
"@anthropic-ai/claude-agent-sdk": "0.2.9",
|
|
65
65
|
"@modelcontextprotocol/sdk": "1.25.2",
|
|
66
66
|
"diff": "8.0.3",
|
|
67
67
|
"minimatch": "10.1.1"
|