aws-runtime-bridge 1.7.49 → 1.8.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/adapter/AcodeSdkAdapter.d.ts +104 -0
- package/dist/adapter/AcodeSdkAdapter.d.ts.map +1 -0
- package/dist/adapter/AcodeSdkAdapter.js +644 -0
- package/dist/adapter/AcodeSdkAdapter.test.d.ts +2 -0
- package/dist/adapter/AcodeSdkAdapter.test.d.ts.map +1 -0
- package/dist/adapter/AcodeSdkAdapter.test.js +1280 -0
- package/dist/adapter/AdapterRegistry.d.ts +1 -1
- package/dist/adapter/AdapterRegistry.d.ts.map +1 -1
- package/dist/adapter/AdapterRegistry.js +2 -0
- package/dist/adapter/AdapterRegistry.test.js +10 -1
- package/dist/adapter/ClaudeSdkAdapter.test.js +31 -8
- package/dist/adapter/CodexSdkAdapter.d.ts.map +1 -1
- package/dist/adapter/CodexSdkAdapter.js +2 -0
- package/dist/adapter/OpencodeSdkAdapter.d.ts.map +1 -1
- package/dist/adapter/OpencodeSdkAdapter.js +2 -0
- package/dist/adapter/SdkProviderSpi.d.ts.map +1 -1
- package/dist/adapter/SdkProviderSpi.js +10 -1
- package/dist/adapter/adapter.test.js +2 -2
- package/dist/adapter/idle-poll-loop.d.ts +4 -4
- package/dist/adapter/idle-poll-loop.d.ts.map +1 -1
- package/dist/adapter/idle-poll-loop.js +3 -3
- package/dist/adapter/idle-poll-loop.test.js +15 -1
- package/dist/adapter/index.d.ts +1 -0
- package/dist/adapter/index.d.ts.map +1 -1
- package/dist/adapter/index.js +1 -0
- package/dist/adapter/types.d.ts +25 -6
- package/dist/adapter/types.d.ts.map +1 -1
- package/dist/adapter/types.js +221 -110
- package/dist/adapter/types.test.js +10 -3
- package/dist/adapters/cc-switch/index.d.ts +2 -0
- package/dist/adapters/cc-switch/index.d.ts.map +1 -1
- package/dist/adapters/cc-switch/index.js +6 -0
- package/dist/adapters/cc-switch/mcp-acode.d.ts +17 -0
- package/dist/adapters/cc-switch/mcp-acode.d.ts.map +1 -0
- package/dist/adapters/cc-switch/mcp-acode.js +71 -0
- package/dist/adapters/cc-switch/mcp-acode.test.d.ts +2 -0
- package/dist/adapters/cc-switch/mcp-acode.test.d.ts.map +1 -0
- package/dist/adapters/cc-switch/mcp-acode.test.js +80 -0
- package/dist/adapters/cc-switch/mcp-claude.d.ts.map +1 -1
- package/dist/adapters/cc-switch/mcp-claude.js +1 -0
- package/dist/adapters/cc-switch/mcp-claudecode.d.ts.map +1 -1
- package/dist/adapters/cc-switch/mcp-claudecode.js +1 -0
- package/dist/adapters/cc-switch/mcp-claudecode.test.js +1 -0
- package/dist/adapters/cc-switch/mcp-codex.d.ts.map +1 -1
- package/dist/adapters/cc-switch/mcp-codex.js +1 -0
- package/dist/adapters/cc-switch/mcp-codex.test.js +1 -0
- package/dist/adapters/cc-switch/mcp-opencode.d.ts.map +1 -1
- package/dist/adapters/cc-switch/mcp-opencode.js +1 -0
- package/dist/adapters/cc-switch/mcp-opencode.test.js +1 -0
- package/dist/adapters/cc-switch/skill-acode.d.ts +11 -0
- package/dist/adapters/cc-switch/skill-acode.d.ts.map +1 -0
- package/dist/adapters/cc-switch/skill-acode.js +12 -0
- package/dist/adapters/cc-switch/skill-directory.test.js +1 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +10 -0
- package/dist/index.js +2 -0
- package/dist/routes/ai-sources.js +3 -2
- package/dist/routes/instance.d.ts.map +1 -1
- package/dist/routes/instance.js +7 -8
- package/dist/routes/instance.test.js +2 -1
- package/dist/routes/mcp.js +2 -2
- package/dist/routes/mcp.test.js +2 -1
- package/dist/routes/runtime-binding.d.ts +3 -2
- package/dist/routes/runtime-binding.d.ts.map +1 -1
- package/dist/routes/runtime-binding.js +11 -58
- package/dist/routes/runtime-binding.test.js +4 -80
- package/dist/routes/sessions.d.ts +5 -0
- package/dist/routes/sessions.d.ts.map +1 -1
- package/dist/routes/sessions.js +36 -16
- package/dist/routes/sessions.test.js +13 -0
- package/dist/routes/skills.js +2 -2
- package/dist/routes/skills.test.js +2 -1
- package/dist/routes/terminal.d.ts +27 -7
- package/dist/routes/terminal.d.ts.map +1 -1
- package/dist/routes/terminal.js +439 -171
- package/dist/routes/terminal.test.js +385 -197
- package/dist/services/acode-package.d.ts +8 -0
- package/dist/services/acode-package.d.ts.map +1 -0
- package/dist/services/acode-package.js +82 -0
- package/dist/services/ai-source-apply.d.ts +4 -0
- package/dist/services/ai-source-apply.d.ts.map +1 -1
- package/dist/services/ai-source-apply.js +8 -0
- package/dist/services/ai-source-apply.test.js +8 -1
- package/dist/services/cc-switch-sdk.d.ts.map +1 -1
- package/dist/services/cc-switch-sdk.js +9 -1
- package/dist/services/instance-init-service.d.ts.map +1 -1
- package/dist/services/instance-init-service.js +3 -2
- package/dist/services/instance-init-service.test.js +6 -5
- package/dist/services/instance-service.d.ts.map +1 -1
- package/dist/services/instance-service.js +1 -0
- package/dist/services/instance-state.js +1 -1
- package/dist/services/instance-state.test.js +4 -4
- package/dist/services/mcp-launch-binding-queue.d.ts +1 -0
- package/dist/services/mcp-launch-binding-queue.d.ts.map +1 -1
- package/dist/services/mcp-launch-binding-queue.js +8 -2
- package/dist/services/mcp-launch-binding-queue.test.js +47 -4
- package/dist/services/session-output.d.ts +10 -6
- package/dist/services/session-output.d.ts.map +1 -1
- package/dist/services/session-output.js +29 -14
- package/dist/services/session-output.test.js +93 -39
- package/dist/services/tool-installer.d.ts.map +1 -1
- package/dist/services/tool-installer.js +10 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/file-utils.d.ts.map +1 -1
- package/dist/utils/file-utils.js +1 -0
- package/dist/utils/mcp-utils.d.ts.map +1 -1
- package/dist/utils/mcp-utils.js +4 -1
- package/dist/utils/validation.js +1 -1
- package/node_modules/@cc-switch/sdk/dist/constants.d.ts.map +1 -1
- package/node_modules/@cc-switch/sdk/dist/constants.js +7 -0
- package/node_modules/@cc-switch/sdk/dist/schemas.d.ts.map +1 -1
- package/node_modules/@cc-switch/sdk/dist/schemas.js +1 -0
- package/node_modules/@cc-switch/sdk/dist/sdk.d.ts.map +1 -1
- package/node_modules/@cc-switch/sdk/dist/sdk.js +7 -3
- package/node_modules/@cc-switch/sdk/dist/services/ai-config-service.d.ts +6 -0
- package/node_modules/@cc-switch/sdk/dist/services/ai-config-service.d.ts.map +1 -1
- package/node_modules/@cc-switch/sdk/dist/services/ai-config-service.js +27 -1
- package/node_modules/@cc-switch/sdk/dist/types.d.ts +4 -1
- package/node_modules/@cc-switch/sdk/dist/types.d.ts.map +1 -1
- package/package/acode/README.md +88 -0
- package/package/acode/dist/built-in-file-tools.d.ts +16 -0
- package/package/acode/dist/built-in-file-tools.d.ts.map +1 -0
- package/package/acode/dist/built-in-file-tools.js +569 -0
- package/package/acode/dist/cli.d.ts +3 -0
- package/package/acode/dist/cli.d.ts.map +1 -0
- package/package/acode/dist/cli.js +37 -0
- package/package/acode/dist/commands/commandLoader.d.ts +7 -0
- package/package/acode/dist/commands/commandLoader.d.ts.map +1 -0
- package/package/acode/dist/commands/commandLoader.js +33 -0
- package/package/acode/dist/commands/commandParser.d.ts +7 -0
- package/package/acode/dist/commands/commandParser.d.ts.map +1 -0
- package/package/acode/dist/commands/commandParser.js +77 -0
- package/package/acode/dist/commands/commandRegistry.d.ts +13 -0
- package/package/acode/dist/commands/commandRegistry.d.ts.map +1 -0
- package/package/acode/dist/commands/commandRegistry.js +30 -0
- package/package/acode/dist/config.d.ts +4 -0
- package/package/acode/dist/config.d.ts.map +1 -0
- package/package/acode/dist/config.js +80 -0
- package/package/acode/dist/hooks/hookBus.d.ts +19 -0
- package/package/acode/dist/hooks/hookBus.d.ts.map +1 -0
- package/package/acode/dist/hooks/hookBus.js +40 -0
- package/package/acode/dist/index.d.ts +8 -0
- package/package/acode/dist/index.d.ts.map +1 -0
- package/package/acode/dist/index.js +7 -0
- package/package/acode/dist/runtime.d.ts +42 -0
- package/package/acode/dist/runtime.d.ts.map +1 -0
- package/package/acode/dist/runtime.js +1283 -0
- package/package/acode/dist/types.d.ts +112 -0
- package/package/acode/dist/types.d.ts.map +1 -0
- package/package/acode/dist/types.js +1 -0
- package/package/acode/package.json +24 -0
- package/package/aws-client-agent-mcp/dist/agent-client.d.ts +4 -4
- package/package/aws-client-agent-mcp/dist/agent-client.d.ts.map +1 -1
- package/package/aws-client-agent-mcp/dist/agent-client.js +9 -6
- package/package/aws-client-agent-mcp/dist/agent-client.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/agent-client.test.js +21 -0
- package/package/aws-client-agent-mcp/dist/agent-client.test.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/http-client.d.ts +1 -17
- package/package/aws-client-agent-mcp/dist/http-client.d.ts.map +1 -1
- package/package/aws-client-agent-mcp/dist/http-client.js +7 -113
- package/package/aws-client-agent-mcp/dist/http-client.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/http-client.test.js +22 -2
- package/package/aws-client-agent-mcp/dist/http-client.test.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/mcp-server.d.ts +0 -5
- package/package/aws-client-agent-mcp/dist/mcp-server.d.ts.map +1 -1
- package/package/aws-client-agent-mcp/dist/mcp-server.js +3 -24
- package/package/aws-client-agent-mcp/dist/mcp-server.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/mcp-server.test.js +90 -5
- package/package/aws-client-agent-mcp/dist/mcp-server.test.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/runtime-launch-binding.d.ts.map +1 -1
- package/package/aws-client-agent-mcp/dist/runtime-launch-binding.js +1 -0
- package/package/aws-client-agent-mcp/dist/runtime-launch-binding.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/status-reporter.d.ts +2 -0
- package/package/aws-client-agent-mcp/dist/status-reporter.d.ts.map +1 -1
- package/package/aws-client-agent-mcp/dist/status-reporter.js +31 -3
- package/package/aws-client-agent-mcp/dist/status-reporter.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/types.d.ts +4 -1
- package/package/aws-client-agent-mcp/dist/types.d.ts.map +1 -1
- package/package/aws-client-agent-mcp/dist/types.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/websocket-client.d.ts +0 -13
- package/package/aws-client-agent-mcp/dist/websocket-client.d.ts.map +1 -1
- package/package/aws-client-agent-mcp/dist/websocket-client.js +5 -100
- package/package/aws-client-agent-mcp/dist/websocket-client.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/websocket-client.test.js +43 -0
- package/package/aws-client-agent-mcp/dist/websocket-client.test.js.map +1 -1
- package/package/cc-switch-sdk/dist/constants.d.ts.map +1 -1
- package/package/cc-switch-sdk/dist/constants.js +7 -0
- package/package/cc-switch-sdk/dist/schemas.d.ts.map +1 -1
- package/package/cc-switch-sdk/dist/schemas.js +1 -0
- package/package/cc-switch-sdk/dist/sdk.d.ts.map +1 -1
- package/package/cc-switch-sdk/dist/sdk.js +7 -3
- package/package/cc-switch-sdk/dist/services/ai-config-service.d.ts +6 -0
- package/package/cc-switch-sdk/dist/services/ai-config-service.d.ts.map +1 -1
- package/package/cc-switch-sdk/dist/services/ai-config-service.js +27 -1
- package/package/cc-switch-sdk/dist/types.d.ts +4 -1
- package/package/cc-switch-sdk/dist/types.d.ts.map +1 -1
- package/package.json +8 -4
package/dist/adapter/types.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* 参考自 SpectrAI 项目的 adapter 设计,用于支持多种 AI Provider
|
|
6
6
|
*/
|
|
7
|
-
import { EventEmitter } from
|
|
8
|
-
const TEMP_CLIPBOARD_PASTE_PLACEHOLDER =
|
|
7
|
+
import { EventEmitter } from "node:events";
|
|
8
|
+
const TEMP_CLIPBOARD_PASTE_PLACEHOLDER = "[temp clipboard paste file]";
|
|
9
9
|
const WINDOWS_TEMP_CLIPBOARD_PASTE_PATH = /[A-Z]:(?:\\\\|\\)[^\r\n"'`]*?(?:\\\\|\\)mini-term-clipboard(?:\\\\|\\)paste-\d+\.txt/gi;
|
|
10
10
|
const POSIX_TEMP_CLIPBOARD_PASTE_PATH = /\/[^\r\n"'`]*?\/mini-term-clipboard\/paste-\d+\.txt/gi;
|
|
11
11
|
const BARE_TEMP_CLIPBOARD_PASTE_PATH = /mini-term-clipboard[\\/]paste-\d+\.txt/gi;
|
|
@@ -24,8 +24,12 @@ export function redactTransientClipboardPastePaths(text) {
|
|
|
24
24
|
* 主流程:剥离包裹引号 -> 要求整串匹配,避免误拦截显式读取该文件的正常命令。
|
|
25
25
|
*/
|
|
26
26
|
export function isTransientClipboardPasteFilePath(text) {
|
|
27
|
-
const trimmed = text.trim().replace(/^(["'])(.*)\1$/,
|
|
28
|
-
return [
|
|
27
|
+
const trimmed = text.trim().replace(/^(["'])(.*)\1$/, "$2");
|
|
28
|
+
return [
|
|
29
|
+
WINDOWS_TEMP_CLIPBOARD_PASTE_PATH,
|
|
30
|
+
POSIX_TEMP_CLIPBOARD_PASTE_PATH,
|
|
31
|
+
BARE_TEMP_CLIPBOARD_PASTE_PATH,
|
|
32
|
+
].some((pattern) => {
|
|
29
33
|
pattern.lastIndex = 0;
|
|
30
34
|
const match = pattern.exec(trimmed);
|
|
31
35
|
return Boolean(match && match[0] === trimmed);
|
|
@@ -35,13 +39,13 @@ export function isTransientClipboardPasteFilePath(text) {
|
|
|
35
39
|
* 递归脱敏工具展示参数,保留真实执行输入不变,仅用于日志/状态/时间线展示。
|
|
36
40
|
*/
|
|
37
41
|
export function redactTransientClipboardPastePathsInValue(value) {
|
|
38
|
-
if (typeof value ===
|
|
42
|
+
if (typeof value === "string") {
|
|
39
43
|
return redactTransientClipboardPastePaths(value);
|
|
40
44
|
}
|
|
41
45
|
if (Array.isArray(value)) {
|
|
42
46
|
return value.map((item) => redactTransientClipboardPastePathsInValue(item));
|
|
43
47
|
}
|
|
44
|
-
if (value && typeof value ===
|
|
48
|
+
if (value && typeof value === "object") {
|
|
45
49
|
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
46
50
|
key,
|
|
47
51
|
redactTransientClipboardPastePathsInValue(item),
|
|
@@ -57,23 +61,63 @@ export function redactTransientClipboardPastePathsInValue(value) {
|
|
|
57
61
|
*/
|
|
58
62
|
const KNOWN_MCP_TOOLS = {
|
|
59
63
|
// aws-mcp 工具
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
64
|
+
get_colleague: "aws-mcp",
|
|
65
|
+
get_group_rooms: "aws-mcp",
|
|
66
|
+
get_profile: "aws-mcp",
|
|
67
|
+
get_status: "aws-mcp",
|
|
68
|
+
hire_colleague: "aws-mcp",
|
|
69
|
+
hire_colleagues_batch: "aws-mcp",
|
|
70
|
+
send_group: "aws-mcp",
|
|
71
|
+
send_private: "aws-mcp",
|
|
72
|
+
poll_message: "aws-mcp",
|
|
73
|
+
get_message: "aws-mcp",
|
|
74
|
+
get_dm_history: "aws-mcp",
|
|
75
|
+
get_group_history: "aws-mcp",
|
|
76
|
+
my_task: "aws-mcp",
|
|
77
|
+
submit_task_result: "aws-mcp",
|
|
78
|
+
reject_task: "aws-mcp",
|
|
79
|
+
terminate_task: "aws-mcp",
|
|
76
80
|
};
|
|
81
|
+
const AGENTSWORK_MCP_SERVER_ALIASES = new Set([
|
|
82
|
+
"aws-mcp",
|
|
83
|
+
"agents-work-studio",
|
|
84
|
+
]);
|
|
85
|
+
function canonicalizeMcpServer(serverName, toolName) {
|
|
86
|
+
const knownMcpServer = KNOWN_MCP_TOOLS[toolName.toLowerCase()];
|
|
87
|
+
if (knownMcpServer && AGENTSWORK_MCP_SERVER_ALIASES.has(serverName.toLowerCase())) {
|
|
88
|
+
return knownMcpServer;
|
|
89
|
+
}
|
|
90
|
+
return serverName;
|
|
91
|
+
}
|
|
92
|
+
export function getCanonicalMcpDetail(rawToolName) {
|
|
93
|
+
const normalizedRawToolName = rawToolName.trim();
|
|
94
|
+
if (!normalizedRawToolName)
|
|
95
|
+
return normalizedRawToolName;
|
|
96
|
+
if (normalizedRawToolName.includes("__")) {
|
|
97
|
+
const parts = normalizedRawToolName.split("__").filter(Boolean);
|
|
98
|
+
if (parts.length >= 3 && parts[0].toLowerCase() === "mcp") {
|
|
99
|
+
const serverName = parts[1];
|
|
100
|
+
const toolName = parts.slice(2).join("__");
|
|
101
|
+
return `${canonicalizeMcpServer(serverName, toolName)}/${toolName}`;
|
|
102
|
+
}
|
|
103
|
+
if (parts.length >= 2) {
|
|
104
|
+
const serverName = parts[0];
|
|
105
|
+
const toolName = parts.slice(1).join("__");
|
|
106
|
+
return `${canonicalizeMcpServer(serverName, toolName)}/${toolName}`;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const knownMcpServer = KNOWN_MCP_TOOLS[normalizedRawToolName.toLowerCase()];
|
|
110
|
+
return knownMcpServer
|
|
111
|
+
? `${knownMcpServer}/${normalizedRawToolName}`
|
|
112
|
+
: normalizedRawToolName;
|
|
113
|
+
}
|
|
114
|
+
function formatCanonicalMcpDetail(serverName, toolName) {
|
|
115
|
+
if (!serverName)
|
|
116
|
+
return toolName;
|
|
117
|
+
if (!toolName)
|
|
118
|
+
return serverName;
|
|
119
|
+
return `${canonicalizeMcpServer(serverName, toolName)}/${toolName}`;
|
|
120
|
+
}
|
|
77
121
|
/**
|
|
78
122
|
* 根据工具名称获取动作类型信息
|
|
79
123
|
* @param toolName 工具名称
|
|
@@ -82,32 +126,32 @@ const KNOWN_MCP_TOOLS = {
|
|
|
82
126
|
*/
|
|
83
127
|
export function getToolActionInfo(toolName, toolInput, metadata) {
|
|
84
128
|
if (!toolName) {
|
|
85
|
-
return { actionType:
|
|
129
|
+
return { actionType: "other", actionLabel: "调用工具" };
|
|
86
130
|
}
|
|
87
131
|
const name = toolName.toLowerCase();
|
|
88
|
-
const normalizedName = name.replace(/[_-]/g,
|
|
89
|
-
const semanticToolName = name.startsWith(
|
|
90
|
-
? name.split(
|
|
91
|
-
: name.includes(
|
|
92
|
-
? name.slice(name.indexOf(
|
|
132
|
+
const normalizedName = name.replace(/[_-]/g, "");
|
|
133
|
+
const semanticToolName = name.startsWith("mcp__")
|
|
134
|
+
? name.split("__").slice(2).join("__")
|
|
135
|
+
: name.includes("-mcp__")
|
|
136
|
+
? name.slice(name.indexOf("-mcp__") + 6)
|
|
93
137
|
: name;
|
|
94
|
-
const normalizedSemanticToolName = semanticToolName.replace(/[_-]/g,
|
|
138
|
+
const normalizedSemanticToolName = semanticToolName.replace(/[_-]/g, "");
|
|
95
139
|
const normalizeSkillList = (value) => {
|
|
96
140
|
if (!Array.isArray(value)) {
|
|
97
141
|
return [];
|
|
98
142
|
}
|
|
99
143
|
return value
|
|
100
|
-
.map((item) => String(item ??
|
|
144
|
+
.map((item) => String(item ?? "").trim())
|
|
101
145
|
.filter((item) => item.length > 0);
|
|
102
146
|
};
|
|
103
147
|
const firstString = (...values) => {
|
|
104
148
|
for (const value of values) {
|
|
105
|
-
if (typeof value ===
|
|
149
|
+
if (typeof value === "string" && value.trim()) {
|
|
106
150
|
return redactTransientClipboardPastePaths(value);
|
|
107
151
|
}
|
|
108
152
|
if (Array.isArray(value) && value.length > 0) {
|
|
109
153
|
const first = value[0];
|
|
110
|
-
if (typeof first ===
|
|
154
|
+
if (typeof first === "string" && first.trim()) {
|
|
111
155
|
return redactTransientClipboardPastePaths(first);
|
|
112
156
|
}
|
|
113
157
|
}
|
|
@@ -115,17 +159,16 @@ export function getToolActionInfo(toolName, toolInput, metadata) {
|
|
|
115
159
|
return undefined;
|
|
116
160
|
};
|
|
117
161
|
const matchesToolName = (...toolNames) => {
|
|
118
|
-
const normalizedToolNames = toolNames.map((item) => item.replace(/[_-]/g,
|
|
119
|
-
return normalizedToolNames.includes(normalizedName) ||
|
|
162
|
+
const normalizedToolNames = toolNames.map((item) => item.replace(/[_-]/g, ""));
|
|
163
|
+
return (normalizedToolNames.includes(normalizedName) ||
|
|
164
|
+
normalizedToolNames.includes(normalizedSemanticToolName));
|
|
120
165
|
};
|
|
121
|
-
// 调试日志:记录工具名
|
|
122
|
-
console.log(`[getToolActionInfo] toolName="${toolName}", name="${name}"`);
|
|
123
166
|
const loadSkills = normalizeSkillList(toolInput?.load_skills);
|
|
124
|
-
if ((name ===
|
|
167
|
+
if ((name === "task" || name === "task()") && loadSkills.length > 0) {
|
|
125
168
|
return {
|
|
126
|
-
actionType:
|
|
127
|
-
actionLabel:
|
|
128
|
-
actionDetail: loadSkills.join(
|
|
169
|
+
actionType: "skill",
|
|
170
|
+
actionLabel: "加载技能",
|
|
171
|
+
actionDetail: loadSkills.join(", "),
|
|
129
172
|
};
|
|
130
173
|
}
|
|
131
174
|
// Skill 调用
|
|
@@ -136,62 +179,94 @@ export function getToolActionInfo(toolName, toolInput, metadata) {
|
|
|
136
179
|
//
|
|
137
180
|
// 注意:SDK 发送的 tool_name 可能是 'Skill'(大写)或 'skill'(小写)
|
|
138
181
|
// 使用 toLowerCase() 统一处理
|
|
139
|
-
const isSkillTool = name ===
|
|
140
|
-
name ===
|
|
141
|
-
name ===
|
|
142
|
-
(name.includes(
|
|
143
|
-
|
|
182
|
+
const isSkillTool = name === "skill" ||
|
|
183
|
+
name === "load_skill" ||
|
|
184
|
+
name === "disclosecontext" ||
|
|
185
|
+
(name.includes("skill") &&
|
|
186
|
+
!name.startsWith("mcp__") &&
|
|
187
|
+
!name.includes("mcp_"));
|
|
144
188
|
if (isSkillTool) {
|
|
145
189
|
// Skill 参数可能有多种格式:
|
|
146
190
|
// 1. { skill: "skillName" }
|
|
147
191
|
// 2. { name: "skillName" }
|
|
148
192
|
// 3. { args: { name: "skillName", ... } } // task() 格式
|
|
149
193
|
// 4. { load_skills: ["skill1", "skill2"] } // task() 加载技能格式
|
|
150
|
-
let skillName =
|
|
194
|
+
let skillName = "";
|
|
151
195
|
// 检查 load_skills 格式(task 工具)
|
|
152
|
-
if (Array.isArray(toolInput?.load_skills) &&
|
|
153
|
-
|
|
196
|
+
if (Array.isArray(toolInput?.load_skills) &&
|
|
197
|
+
toolInput.load_skills.length > 0) {
|
|
198
|
+
skillName = toolInput.load_skills.join(", ");
|
|
154
199
|
}
|
|
155
200
|
// 检查 skill 参数
|
|
156
|
-
else if (typeof toolInput?.skill ===
|
|
201
|
+
else if (typeof toolInput?.skill === "string") {
|
|
157
202
|
skillName = toolInput.skill;
|
|
158
203
|
}
|
|
159
204
|
// 检查 name 参数
|
|
160
|
-
else if (typeof toolInput?.name ===
|
|
205
|
+
else if (typeof toolInput?.name === "string") {
|
|
161
206
|
skillName = toolInput.name;
|
|
162
207
|
}
|
|
163
208
|
// 检查嵌套的 args.name
|
|
164
|
-
else if (toolInput?.args && typeof toolInput.args ===
|
|
209
|
+
else if (toolInput?.args && typeof toolInput.args === "object") {
|
|
165
210
|
const args = toolInput.args;
|
|
166
|
-
if (typeof args.name ===
|
|
211
|
+
if (typeof args.name === "string") {
|
|
167
212
|
skillName = args.name;
|
|
168
213
|
}
|
|
169
|
-
else if (typeof args.skill ===
|
|
214
|
+
else if (typeof args.skill === "string") {
|
|
170
215
|
skillName = args.skill;
|
|
171
216
|
}
|
|
172
217
|
}
|
|
173
|
-
|
|
174
|
-
|
|
218
|
+
return {
|
|
219
|
+
actionType: "skill",
|
|
220
|
+
actionLabel: "使用技能",
|
|
221
|
+
actionDetail: skillName || undefined,
|
|
222
|
+
};
|
|
175
223
|
}
|
|
176
224
|
// 文件/命令工具即使走 MCP 命名,也优先按语义显示为读取/编辑/命令执行。
|
|
177
|
-
if (matchesToolName(
|
|
225
|
+
if (matchesToolName("edit", "editfile", "strreplace", "editcode", "apply_patch", "multiedit", "replace")) {
|
|
178
226
|
const filePath = firstString(toolInput?.file_path, toolInput?.filePath, toolInput?.path, toolInput?.target_file, toolInput?.targetFile);
|
|
179
|
-
return {
|
|
227
|
+
return {
|
|
228
|
+
actionType: "edit_file",
|
|
229
|
+
actionLabel: "编辑文件",
|
|
230
|
+
actionDetail: filePath,
|
|
231
|
+
};
|
|
180
232
|
}
|
|
181
|
-
if (matchesToolName(
|
|
233
|
+
if (matchesToolName("write", "writefile", "fswrite")) {
|
|
182
234
|
const filePath = firstString(toolInput?.file_path, toolInput?.filePath, toolInput?.path, toolInput?.target_file, toolInput?.targetFile);
|
|
183
|
-
return {
|
|
235
|
+
return {
|
|
236
|
+
actionType: "write_file",
|
|
237
|
+
actionLabel: "写入文件",
|
|
238
|
+
actionDetail: filePath,
|
|
239
|
+
};
|
|
184
240
|
}
|
|
185
|
-
if (matchesToolName(
|
|
241
|
+
if (matchesToolName("read", "readfile", "readcode", "readmultiplefiles", "read_file")) {
|
|
186
242
|
if (Array.isArray(toolInput?.paths)) {
|
|
187
|
-
return {
|
|
243
|
+
return {
|
|
244
|
+
actionType: "read_file",
|
|
245
|
+
actionLabel: "读取文件",
|
|
246
|
+
actionDetail: `${toolInput.paths.length}个文件`,
|
|
247
|
+
};
|
|
188
248
|
}
|
|
189
249
|
const filePath = firstString(toolInput?.file_path, toolInput?.filePath, toolInput?.path, toolInput?.paths, toolInput?.target_file, toolInput?.targetFile);
|
|
190
|
-
return {
|
|
250
|
+
return {
|
|
251
|
+
actionType: "read_file",
|
|
252
|
+
actionLabel: "读取文件",
|
|
253
|
+
actionDetail: filePath,
|
|
254
|
+
};
|
|
191
255
|
}
|
|
192
|
-
if (matchesToolName(
|
|
256
|
+
if (matchesToolName("bash", "shell", "command", "executepwsh", "controlpwshprocess", "execute", "run_command", "execute_command")) {
|
|
193
257
|
const command = firstString(toolInput?.command, toolInput?.cmd, toolInput?.argv);
|
|
194
|
-
return {
|
|
258
|
+
return {
|
|
259
|
+
actionType: "bash",
|
|
260
|
+
actionLabel: "执行命令",
|
|
261
|
+
actionDetail: command?.slice(0, 50),
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
if (matchesToolName("poll_message", "get_message")) {
|
|
265
|
+
return {
|
|
266
|
+
actionType: "idle",
|
|
267
|
+
actionLabel: "监听消息",
|
|
268
|
+
actionDetail: getCanonicalMcpDetail(toolName),
|
|
269
|
+
};
|
|
195
270
|
}
|
|
196
271
|
// MCP 工具调用
|
|
197
272
|
// 优先使用 metadata 中的 mcpServer 信息(SDK 直接提供)
|
|
@@ -202,101 +277,137 @@ export function getToolActionInfo(toolName, toolInput, metadata) {
|
|
|
202
277
|
// 4. xxx-mcp__tool (自定义格式,如 aws-mcp__get_profile)
|
|
203
278
|
// 5. 包含 'mcp_' 的工具名
|
|
204
279
|
// 6. Kiro 的 kiroPowers
|
|
205
|
-
//
|
|
280
|
+
//
|
|
206
281
|
// actionDetail 格式: server/tool(包含 MCP server 名称,便于用户识别工具来源)
|
|
207
282
|
// 优先检查 metadata 中的 MCP server 信息
|
|
208
283
|
if (metadata?.mcpServer) {
|
|
209
284
|
const mcpServer = metadata.mcpServer;
|
|
210
|
-
const mcpTool = toolName ||
|
|
211
|
-
const detail =
|
|
212
|
-
|
|
213
|
-
return { actionType: 'mcp', actionLabel: '调用MCP', actionDetail: detail };
|
|
285
|
+
const mcpTool = toolName || "";
|
|
286
|
+
const detail = formatCanonicalMcpDetail(mcpServer, mcpTool);
|
|
287
|
+
return { actionType: "mcp", actionLabel: "调用MCP", actionDetail: detail };
|
|
214
288
|
}
|
|
215
289
|
// 检查是否在已知 MCP 工具列表中
|
|
216
290
|
const knownMcpServer = KNOWN_MCP_TOOLS[toolName];
|
|
217
291
|
if (knownMcpServer) {
|
|
218
292
|
const detail = `${knownMcpServer}/${toolName}`;
|
|
219
|
-
|
|
220
|
-
return { actionType: 'mcp', actionLabel: '调用MCP', actionDetail: detail };
|
|
293
|
+
return { actionType: "mcp", actionLabel: "调用MCP", actionDetail: detail };
|
|
221
294
|
}
|
|
222
|
-
const isMcpTool = name.startsWith(
|
|
223
|
-
name.includes(
|
|
224
|
-
(name.includes(
|
|
225
|
-
name ===
|
|
295
|
+
const isMcpTool = name.startsWith("mcp__") ||
|
|
296
|
+
name.includes("-mcp__") ||
|
|
297
|
+
(name.includes("mcp_") && !name.includes("skill")) ||
|
|
298
|
+
name === "kiropowers";
|
|
226
299
|
if (isMcpTool) {
|
|
227
|
-
let mcpServer =
|
|
228
|
-
let mcpTool =
|
|
229
|
-
if (name.startsWith(
|
|
300
|
+
let mcpServer = "";
|
|
301
|
+
let mcpTool = "";
|
|
302
|
+
if (name.startsWith("mcp__")) {
|
|
230
303
|
// 标准格式: mcp__server__tool
|
|
231
|
-
const parts = toolName.split(
|
|
232
|
-
mcpServer = parts[1] ||
|
|
233
|
-
mcpTool = parts.slice(2).join(
|
|
304
|
+
const parts = toolName.split("__");
|
|
305
|
+
mcpServer = parts[1] || "";
|
|
306
|
+
mcpTool = parts.slice(2).join("__") || "";
|
|
234
307
|
}
|
|
235
|
-
else if (name.includes(
|
|
308
|
+
else if (name.includes("-mcp__")) {
|
|
236
309
|
// 自定义格式: xxx-mcp__tool (如 aws-mcp__get_profile)
|
|
237
|
-
const idx = name.indexOf(
|
|
310
|
+
const idx = name.indexOf("-mcp__");
|
|
238
311
|
mcpServer = name.substring(0, idx + 4); // "xxx-mcp"(保留完整 server 名)
|
|
239
312
|
mcpTool = name.substring(idx + 6); // 去掉 "-mcp__" 前缀,得到工具名
|
|
240
313
|
}
|
|
241
|
-
else if (name ===
|
|
242
|
-
mcpServer =
|
|
243
|
-
mcpTool = (toolInput?.powerName || toolInput?.action) ||
|
|
314
|
+
else if (name === "kiropowers") {
|
|
315
|
+
mcpServer = "kiro";
|
|
316
|
+
mcpTool = (toolInput?.powerName || toolInput?.action) || "";
|
|
244
317
|
}
|
|
245
318
|
else {
|
|
246
319
|
// 其他包含 mcp_ 的格式
|
|
247
|
-
mcpServer =
|
|
320
|
+
mcpServer = "mcp";
|
|
248
321
|
mcpTool = toolName;
|
|
249
322
|
}
|
|
250
323
|
// 格式: server/tool(便于用户识别 MCP server 来源)
|
|
251
|
-
const detail = mcpServer
|
|
252
|
-
return { actionType:
|
|
253
|
-
}
|
|
254
|
-
if (matchesToolName('poll_message', 'get_message')) {
|
|
255
|
-
return { actionType: 'idle', actionLabel: '监听消息', actionDetail: toolName };
|
|
324
|
+
const detail = formatCanonicalMcpDetail(mcpServer, mcpTool) || toolName;
|
|
325
|
+
return { actionType: "mcp", actionLabel: "调用MCP", actionDetail: detail };
|
|
256
326
|
}
|
|
257
327
|
// 文件编辑 (Kiro: strReplace, editCode)
|
|
258
|
-
if (matchesToolName(
|
|
328
|
+
if (matchesToolName("edit", "editfile", "strreplace", "editcode", "apply_patch", "multiedit", "replace")) {
|
|
259
329
|
const filePath = firstString(toolInput?.file_path, toolInput?.filePath, toolInput?.path, toolInput?.target_file, toolInput?.targetFile);
|
|
260
|
-
return {
|
|
330
|
+
return {
|
|
331
|
+
actionType: "edit_file",
|
|
332
|
+
actionLabel: "编辑文件",
|
|
333
|
+
actionDetail: filePath,
|
|
334
|
+
};
|
|
261
335
|
}
|
|
262
336
|
// 文件写入 (Kiro: fsWrite)
|
|
263
|
-
if (matchesToolName(
|
|
337
|
+
if (matchesToolName("write", "writefile", "fswrite")) {
|
|
264
338
|
const filePath = firstString(toolInput?.file_path, toolInput?.filePath, toolInput?.path, toolInput?.target_file, toolInput?.targetFile);
|
|
265
|
-
return {
|
|
339
|
+
return {
|
|
340
|
+
actionType: "write_file",
|
|
341
|
+
actionLabel: "写入文件",
|
|
342
|
+
actionDetail: filePath,
|
|
343
|
+
};
|
|
266
344
|
}
|
|
267
345
|
// 文件读取 (Kiro: readFile, readCode, readMultipleFiles)
|
|
268
|
-
if (matchesToolName(
|
|
346
|
+
if (matchesToolName("read", "readfile", "readcode", "readmultiplefiles", "read_file")) {
|
|
269
347
|
if (Array.isArray(toolInput?.paths)) {
|
|
270
|
-
return {
|
|
348
|
+
return {
|
|
349
|
+
actionType: "read_file",
|
|
350
|
+
actionLabel: "读取文件",
|
|
351
|
+
actionDetail: `${toolInput.paths.length}个文件`,
|
|
352
|
+
};
|
|
271
353
|
}
|
|
272
354
|
const filePath = firstString(toolInput?.file_path, toolInput?.filePath, toolInput?.path, toolInput?.paths, toolInput?.target_file, toolInput?.targetFile);
|
|
273
|
-
return {
|
|
355
|
+
return {
|
|
356
|
+
actionType: "read_file",
|
|
357
|
+
actionLabel: "读取文件",
|
|
358
|
+
actionDetail: filePath,
|
|
359
|
+
};
|
|
274
360
|
}
|
|
275
361
|
// Bash 命令 (Kiro: executePwsh, controlPwshProcess)
|
|
276
|
-
if (matchesToolName(
|
|
362
|
+
if (matchesToolName("bash", "shell", "command", "executepwsh", "controlpwshprocess", "execute", "run_command", "execute_command")) {
|
|
277
363
|
const command = firstString(toolInput?.command, toolInput?.cmd, toolInput?.argv);
|
|
278
|
-
return {
|
|
364
|
+
return {
|
|
365
|
+
actionType: "bash",
|
|
366
|
+
actionLabel: "执行命令",
|
|
367
|
+
actionDetail: command?.slice(0, 50),
|
|
368
|
+
};
|
|
279
369
|
}
|
|
280
370
|
// 文件搜索 (Kiro: grepSearch, fileSearch)
|
|
281
|
-
if (name ===
|
|
371
|
+
if (name === "glob" ||
|
|
372
|
+
name === "grep" ||
|
|
373
|
+
name === "find" ||
|
|
374
|
+
name === "search" ||
|
|
375
|
+
name === "grepsearch" ||
|
|
376
|
+
name === "filesearch") {
|
|
282
377
|
const query = (toolInput?.query || toolInput?.pattern);
|
|
283
|
-
return {
|
|
378
|
+
return {
|
|
379
|
+
actionType: "search",
|
|
380
|
+
actionLabel: "搜索文件",
|
|
381
|
+
actionDetail: query?.slice(0, 30),
|
|
382
|
+
};
|
|
284
383
|
}
|
|
285
384
|
// 网络操作 (Kiro: webFetch, remote_web_search)
|
|
286
|
-
if (name ===
|
|
385
|
+
if (name === "webfetch" ||
|
|
386
|
+
name === "websearch" ||
|
|
387
|
+
name === "fetch" ||
|
|
388
|
+
name === "http" ||
|
|
389
|
+
name === "remote_web_search") {
|
|
287
390
|
const url = (toolInput?.url || toolInput?.query);
|
|
288
|
-
return {
|
|
391
|
+
return {
|
|
392
|
+
actionType: "web",
|
|
393
|
+
actionLabel: "网络请求",
|
|
394
|
+
actionDetail: url?.slice(0, 50),
|
|
395
|
+
};
|
|
289
396
|
}
|
|
290
397
|
// LSP 操作
|
|
291
|
-
if (name.startsWith(
|
|
292
|
-
return { actionType:
|
|
398
|
+
if (name.startsWith("lsp") || name.includes("language_server")) {
|
|
399
|
+
return { actionType: "lsp", actionLabel: "LSP操作" };
|
|
293
400
|
}
|
|
294
401
|
// Notebook 编辑
|
|
295
|
-
if (name ===
|
|
296
|
-
return { actionType:
|
|
402
|
+
if (name === "notebookedit" || name.includes("notebook")) {
|
|
403
|
+
return { actionType: "notebook", actionLabel: "编辑Notebook" };
|
|
297
404
|
}
|
|
298
405
|
// 其他工具
|
|
299
|
-
return {
|
|
406
|
+
return {
|
|
407
|
+
actionType: "other",
|
|
408
|
+
actionLabel: "调用工具",
|
|
409
|
+
actionDetail: toolName,
|
|
410
|
+
};
|
|
300
411
|
}
|
|
301
412
|
// ============ Adapter 基类 ============
|
|
302
413
|
/**
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
2
|
import { getToolActionInfo, isTransientClipboardPasteFilePath, redactTransientClipboardPastePaths, redactTransientClipboardPastePathsInValue, } from './types.js';
|
|
3
3
|
describe('getToolActionInfo', () => {
|
|
4
|
-
it('reports poll_message as
|
|
4
|
+
it('reports poll_message as an idle MCP listening tool call', () => {
|
|
5
5
|
expect(getToolActionInfo('poll_message')).toEqual({
|
|
6
|
-
actionType: '
|
|
7
|
-
actionLabel: '
|
|
6
|
+
actionType: 'idle',
|
|
7
|
+
actionLabel: '监听消息',
|
|
8
|
+
actionDetail: 'aws-mcp/poll_message',
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
it('reports prefixed poll_message as a canonical idle MCP listening tool call', () => {
|
|
12
|
+
expect(getToolActionInfo('aws-mcp__poll_message')).toEqual({
|
|
13
|
+
actionType: 'idle',
|
|
14
|
+
actionLabel: '监听消息',
|
|
8
15
|
actionDetail: 'aws-mcp/poll_message',
|
|
9
16
|
});
|
|
10
17
|
});
|
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
* 提供工厂函数创建所有 MCP 和 Skill 适配器实例
|
|
5
5
|
*/
|
|
6
6
|
import type { AppId, IMcpAdapter, ISkillAdapter, SdkPaths } from '@cc-switch/sdk';
|
|
7
|
+
export { AcodeMcpAdapter } from './mcp-acode.js';
|
|
7
8
|
export { ClaudeMcpAdapter } from './mcp-claude.js';
|
|
8
9
|
export { ClaudecodeMcpAdapter } from './mcp-claudecode.js';
|
|
9
10
|
export { CodexMcpAdapter } from './mcp-codex.js';
|
|
10
11
|
export { OpenCodeMcpAdapter } from './mcp-opencode.js';
|
|
11
12
|
export { PlaceholderMcpAdapter } from './mcp-placeholder.js';
|
|
13
|
+
export { AcodeSkillAdapter } from './skill-acode.js';
|
|
12
14
|
export { ClaudeSkillAdapter } from './skill-claude.js';
|
|
13
15
|
export { ClaudecodeSkillAdapter } from './skill-claudecode.js';
|
|
14
16
|
export { CodexSkillAdapter } from './skill-codex.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/cc-switch/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/cc-switch/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAalF,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,cAAc,aAAa,CAAC;AAE5B;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAU7E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,CAUjF"}
|
|
@@ -3,20 +3,24 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 提供工厂函数创建所有 MCP 和 Skill 适配器实例
|
|
5
5
|
*/
|
|
6
|
+
import { AcodeMcpAdapter } from './mcp-acode.js';
|
|
6
7
|
import { ClaudecodeMcpAdapter } from './mcp-claudecode.js';
|
|
7
8
|
import { CodexMcpAdapter } from './mcp-codex.js';
|
|
8
9
|
import { OpenCodeMcpAdapter } from './mcp-opencode.js';
|
|
9
10
|
import { PlaceholderMcpAdapter } from './mcp-placeholder.js';
|
|
11
|
+
import { AcodeSkillAdapter } from './skill-acode.js';
|
|
10
12
|
import { ClaudecodeSkillAdapter } from './skill-claudecode.js';
|
|
11
13
|
import { CodexSkillAdapter } from './skill-codex.js';
|
|
12
14
|
import { OpenCodeSkillAdapter } from './skill-opencode.js';
|
|
13
15
|
import { PlaceholderSkillAdapter } from './skill-placeholder.js';
|
|
14
16
|
// 导出所有适配器类
|
|
17
|
+
export { AcodeMcpAdapter } from './mcp-acode.js';
|
|
15
18
|
export { ClaudeMcpAdapter } from './mcp-claude.js';
|
|
16
19
|
export { ClaudecodeMcpAdapter } from './mcp-claudecode.js';
|
|
17
20
|
export { CodexMcpAdapter } from './mcp-codex.js';
|
|
18
21
|
export { OpenCodeMcpAdapter } from './mcp-opencode.js';
|
|
19
22
|
export { PlaceholderMcpAdapter } from './mcp-placeholder.js';
|
|
23
|
+
export { AcodeSkillAdapter } from './skill-acode.js';
|
|
20
24
|
export { ClaudeSkillAdapter } from './skill-claude.js';
|
|
21
25
|
export { ClaudecodeSkillAdapter } from './skill-claudecode.js';
|
|
22
26
|
export { CodexSkillAdapter } from './skill-codex.js';
|
|
@@ -28,6 +32,7 @@ export * from './common.js';
|
|
|
28
32
|
*/
|
|
29
33
|
export function createMcpAdapters(paths) {
|
|
30
34
|
return {
|
|
35
|
+
acode: new AcodeMcpAdapter(paths.acodeConfigFile),
|
|
31
36
|
claude: new PlaceholderMcpAdapter("claude"),
|
|
32
37
|
claudecode: new ClaudecodeMcpAdapter(paths.claudecodeConfigFile),
|
|
33
38
|
opencode: new OpenCodeMcpAdapter(paths.opencodeConfigFile),
|
|
@@ -41,6 +46,7 @@ export function createMcpAdapters(paths) {
|
|
|
41
46
|
*/
|
|
42
47
|
export function createSkillAdapters(paths) {
|
|
43
48
|
return {
|
|
49
|
+
acode: new AcodeSkillAdapter(paths.acodeSkillsDir),
|
|
44
50
|
claude: new PlaceholderSkillAdapter("claude"),
|
|
45
51
|
claudecode: new ClaudecodeSkillAdapter(paths.claudecodeSkillsDir),
|
|
46
52
|
opencode: new OpenCodeSkillAdapter(paths.opencodeSkillsDir),
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ACode MCP Adapter
|
|
3
|
+
*
|
|
4
|
+
* 主流程:读取内置 ACode 的 JSON 配置 -> 将 mcpServers 映射导入 SDK ->
|
|
5
|
+
* 按 SDK 状态增删 ACode 配置中的 MCP server。ACode 内置在 runtime-bridge 中,
|
|
6
|
+
* 因此不需要外部 CLI 安装步骤。
|
|
7
|
+
*/
|
|
8
|
+
import type { IMcpAdapter, McpServer } from '@cc-switch/sdk';
|
|
9
|
+
export declare class AcodeMcpAdapter implements IMcpAdapter {
|
|
10
|
+
private readonly configPath;
|
|
11
|
+
readonly appId: "acode";
|
|
12
|
+
constructor(configPath: string);
|
|
13
|
+
importServers(): Promise<McpServer[]>;
|
|
14
|
+
syncServer(server: McpServer): Promise<void>;
|
|
15
|
+
removeServer(server: McpServer): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=mcp-acode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-acode.d.ts","sourceRoot":"","sources":["../../../src/adapters/cc-switch/mcp-acode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAiB,MAAM,gBAAgB,CAAC;AAiC5E,qBAAa,eAAgB,YAAW,WAAW;IAGrC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAFvC,SAAgB,KAAK,EAAG,OAAO,CAAU;gBAEZ,UAAU,EAAE,MAAM;IAEzC,aAAa,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAoBrC,UAAU,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAS5C,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAQrD"}
|