aws-runtime-bridge 1.9.92 → 1.9.94
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 +22 -126
- package/dist/adapter/AdapterRegistry.d.ts +10 -38
- package/dist/adapter/ClaudeSdkAdapter.d.ts +21 -84
- package/dist/adapter/CodexSdkAdapter.d.ts +2 -10
- package/dist/adapter/OpencodeSdkAdapter.d.ts +6 -42
- package/dist/adapter/acode-tool-names.d.ts +3 -12
- package/dist/adapter/idle-poll-loop.d.ts +4 -16
- package/dist/adapter/index.d.ts +1 -4
- package/dist/adapter/instance-ai-config-resolver.d.ts +9 -29
- package/dist/adapter/types.d.ts +124 -242
- package/dist/adapters/cc-switch/common.d.ts +4 -14
- package/dist/adapters/cc-switch/index.d.ts +3 -11
- package/dist/adapters/cc-switch/mcp-acode.d.ts +1 -7
- package/dist/adapters/cc-switch/mcp-claude.d.ts +1 -5
- package/dist/adapters/cc-switch/mcp-claudecode.d.ts +1 -5
- package/dist/adapters/cc-switch/mcp-codex.d.ts +1 -7
- package/dist/adapters/cc-switch/mcp-opencode.d.ts +3 -11
- package/dist/adapters/cc-switch/mcp-placeholder.d.ts +1 -5
- package/dist/adapters/cc-switch/skill-acode.d.ts +1 -6
- package/dist/adapters/cc-switch/skill-claude.d.ts +1 -5
- package/dist/adapters/cc-switch/skill-claudecode.d.ts +1 -5
- package/dist/adapters/cc-switch/skill-opencode.d.ts +1 -5
- package/dist/adapters/cc-switch/skill-placeholder.d.ts +1 -5
- package/dist/config.d.ts +39 -57
- package/dist/index.d.ts +1 -5
- package/dist/middleware/auth.d.ts +4 -22
- package/dist/routes/acode-todos.d.ts +1 -9
- package/dist/routes/dashboard.d.ts +1 -6
- package/dist/routes/events.d.ts +1 -5
- package/dist/routes/file-browser.d.ts +2 -8
- package/dist/routes/file-diff-rollback.d.ts +13 -41
- package/dist/routes/file-snapshot.d.ts +1 -8
- package/dist/routes/git.d.ts +18 -91
- package/dist/routes/instance.d.ts +4 -15
- package/dist/routes/processes.d.ts +1 -5
- package/dist/routes/properties.d.ts +1 -5
- package/dist/routes/pty.d.ts +9 -36
- package/dist/routes/runtime-binding.d.ts +1 -4
- package/dist/routes/sessions.d.ts +2 -9
- package/dist/routes/sub-agents.d.ts +1 -12
- package/dist/routes/task-context.d.ts +1 -6
- package/dist/routes/terminal.d.ts +18 -92
- package/dist/routes/yml.d.ts +1 -5
- package/dist/services/acode-package.d.ts +2 -12
- package/dist/services/agent-event-store.d.ts +6 -26
- package/dist/services/agent-process-manager.d.ts +30 -184
- package/dist/services/ai-source-apply.d.ts +1 -3
- package/dist/services/auto-register.d.ts +29 -106
- package/dist/services/bridge-package-publish-hooks.d.ts +5 -19
- package/dist/services/cc-switch-sdk.d.ts +1 -6
- package/dist/services/cli-commands.d.ts +12 -33
- package/dist/services/cli-commands.js +6 -6
- package/dist/services/event-delta-pusher.d.ts +5 -20
- package/dist/services/fileSnapshotStore.d.ts +7 -35
- package/dist/services/instance-ai-config-service.d.ts +4 -21
- package/dist/services/instance-service.d.ts +1 -10
- package/dist/services/instance-state.d.ts +5 -30
- package/dist/services/legacy-path-migration.d.ts +1 -1
- package/dist/services/lifecycle-state.d.ts +1 -4
- package/dist/services/mcp-launch-binding-queue.d.ts +2 -8
- package/dist/services/orphan-monitor.d.ts +20 -63
- package/dist/services/panel-auth.d.ts +12 -28
- package/dist/services/process-detector.d.ts +18 -122
- package/dist/services/process-registry.d.ts +30 -150
- package/dist/services/ring-buffer.d.ts +9 -42
- package/dist/services/runtime-binding.d.ts +2 -9
- package/dist/services/runtime-lifecycle-policy.d.ts +3 -15
- package/dist/services/session-output.d.ts +14 -67
- package/dist/services/startup-config-wizard.d.ts +3 -10
- package/dist/services/system-metrics.d.ts +1 -4
- package/dist/services/terminal-persistence.d.ts +10 -53
- package/dist/services/tool-installer.d.ts +6 -18
- package/dist/services/tunnel-client.d.ts +3 -18
- package/dist/services/windows-service-manager.d.ts +1 -13
- package/dist/services/workspace-files.d.ts +17 -57
- package/dist/services/workspace-watch.d.ts +2 -6
- package/dist/services/workspaceTaskChangeWatcher.d.ts +13 -51
- package/dist/types.d.ts +2 -8
- package/dist/utils/instance-ai-config-debug-logger.d.ts +5 -20
- package/dist/utils/logger.d.ts +7 -20
- package/dist/utils/mcp-utils.d.ts +8 -44
- package/dist/utils/path-utils.d.ts +3 -15
- package/dist/utils/sdk-package-loader.d.ts +2 -8
- package/dist/utils/validation.d.ts +3 -20
- package/dist/utils/yaml-utils.d.ts +8 -56
- package/node_modules/@cc-switch/sdk/dist/index.d.ts +1 -6
- package/node_modules/@cc-switch/sdk/dist/sdk.d.ts +11 -42
- package/package/acode/dist/ask-user-question-tool.d.ts +7 -20
- package/package/acode/dist/built-in-file-tools.d.ts +3 -6
- package/package/acode/dist/built-in-symbols-tool.d.ts +1 -4
- package/package/acode/dist/builtins/commandArtifacts.d.ts +1 -4
- package/package/acode/dist/builtins/shellOutputDecoder.d.ts +3 -18
- package/package/acode/dist/commands/commandLoader.d.ts +1 -4
- package/package/acode/dist/commands/commandParser.d.ts +1 -4
- package/package/acode/dist/compaction.d.ts +38 -175
- package/package/acode/dist/config.d.ts +1 -4
- package/package/acode/dist/fs-utils.d.ts +1 -19
- package/package/acode/dist/hooks/hookBus.d.ts +1 -4
- package/package/acode/dist/mcpToolNames.d.ts +2 -8
- package/package/acode/dist/parsers/ast-cache.d.ts +7 -20
- package/package/acode/dist/parsers/language-detector.d.ts +1 -5
- package/package/acode/dist/parsers/language-queries.d.ts +1 -1
- package/package/acode/dist/parsers/tree-sitter-loader.d.ts +4 -12
- package/package/acode/dist/parsers/types.d.ts +19 -30
- package/package/acode/dist/runtime.d.ts +47 -269
- package/package/acode/dist/skill-tool.d.ts +3 -23
- package/package/acode/dist/sub-agent-manager.d.ts +41 -206
- package/package/acode/dist/sub-agent-store.d.ts +12 -61
- package/package/acode/dist/sub-agent-tools.d.ts +9 -18
- package/package/acode/dist/sub-agent-types.d.ts +32 -38
- package/package/acode/dist/todo-store.d.ts +8 -23
- package/package/acode/dist/todo-tool.d.ts +2 -2
- package/package/acode/dist/types.d.ts +17 -38
- package/package/aws-client-agent-mcp/dist/agent-client.d.ts +44 -161
- package/package/aws-client-agent-mcp/dist/config.d.ts +4 -18
- package/package/aws-client-agent-mcp/dist/constants.d.ts +1 -3
- package/package/aws-client-agent-mcp/dist/context-manager.d.ts +25 -95
- package/package/aws-client-agent-mcp/dist/context-manager.test.d.ts +1 -4
- package/package/aws-client-agent-mcp/dist/http-client.d.ts +15 -56
- package/package/aws-client-agent-mcp/dist/index.d.ts +1 -11
- package/package/aws-client-agent-mcp/dist/logger.d.ts +5 -22
- package/package/aws-client-agent-mcp/dist/mcp-server.d.ts +76 -365
- package/package/aws-client-agent-mcp/dist/mcp-tools.d.ts +21 -83
- package/package/aws-client-agent-mcp/dist/memory-store.d.ts +15 -70
- package/package/aws-client-agent-mcp/dist/memory-tools.d.ts +4 -17
- package/package/aws-client-agent-mcp/dist/message-buffer.d.ts +23 -92
- package/package/aws-client-agent-mcp/dist/messageContent.d.ts +5 -29
- package/package/aws-client-agent-mcp/dist/server-memory-store.d.ts +2 -9
- package/package/aws-client-agent-mcp/dist/status-reporter.d.ts +17 -55
- package/package/aws-client-agent-mcp/dist/types.d.ts +66 -125
- package/package/aws-client-agent-mcp/dist/websocket-client.d.ts +30 -125
- package/package/cc-switch-sdk/dist/index.d.ts +1 -6
- package/package/cc-switch-sdk/dist/sdk.d.ts +11 -42
- package/package.json +1 -1
package/dist/adapter/types.d.ts
CHANGED
|
@@ -1,72 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
* Provider Adapter 抽象层类型定义
|
|
3
|
-
* SDK 架构核心 —— 统一事件流接口
|
|
4
|
-
*
|
|
5
|
-
* 参考自 SpectrAI 项目的 adapter 设计,用于支持多种 AI Provider
|
|
6
|
-
*/
|
|
1
|
+
|
|
7
2
|
import { EventEmitter } from "node:events";
|
|
8
3
|
export type SessionStatus = "starting" | "thinking" | "tool_using" | "waiting_input" | "completed" | "terminated" | "error" | "compacting";
|
|
9
4
|
export type ProviderEventType = "ai_request" | "text_delta" | "thinking" | "command_output" | "tool_use_start" | "tool_use_end" | "permission_request" | "ask_user_question" | "exit_plan_mode" | "turn_complete" | "session_complete" | "error" | "context_compaction" | "runtime_capabilities";
|
|
10
|
-
|
|
11
|
-
* Agent 工具动作类型分类
|
|
12
|
-
* 用于细粒度显示 agent 当前正在执行的具体动作
|
|
13
|
-
*/
|
|
5
|
+
|
|
14
6
|
export type ToolActionType = "skill" | "mcp" | "idle" | "edit_file" | "write_file" | "read_file" | "bash" | "search" | "web" | "ai_request" | "lsp" | "notebook" | "other" | "context_compaction" | "runtime_capabilities";
|
|
15
|
-
|
|
16
|
-
* 工具动作信息
|
|
17
|
-
*/
|
|
7
|
+
|
|
18
8
|
export interface ToolActionInfo {
|
|
19
|
-
|
|
9
|
+
|
|
20
10
|
actionType: ToolActionType;
|
|
21
|
-
|
|
11
|
+
|
|
22
12
|
actionLabel: string;
|
|
23
|
-
|
|
13
|
+
|
|
24
14
|
actionDetail?: string;
|
|
25
15
|
}
|
|
26
|
-
|
|
27
|
-
* MCP 元数据(从 SDK tool state.metadata 中提取)
|
|
28
|
-
*/
|
|
16
|
+
|
|
29
17
|
export interface ToolMetadata {
|
|
30
|
-
|
|
18
|
+
|
|
31
19
|
mcpServer?: string;
|
|
32
|
-
|
|
20
|
+
|
|
33
21
|
[key: string]: unknown;
|
|
34
22
|
}
|
|
35
|
-
|
|
36
|
-
* 脱敏终端剪贴板生成的临时 paste 文件路径。
|
|
37
|
-
* 主流程:匹配 Windows/POSIX/裸目录形式 -> 替换为稳定占位符,避免临时文件路径进入日志与状态详情。
|
|
38
|
-
*/
|
|
23
|
+
|
|
39
24
|
export declare function redactTransientClipboardPastePaths(text: string): string;
|
|
40
|
-
|
|
41
|
-
* 判断输入是否只是终端剪贴板生成的临时 paste 文件路径。
|
|
42
|
-
* 主流程:剥离包裹引号 -> 要求整串匹配,避免误拦截显式读取该文件的正常命令。
|
|
43
|
-
*/
|
|
25
|
+
|
|
44
26
|
export declare function isTransientClipboardPasteFilePath(text: string): boolean;
|
|
45
|
-
|
|
46
|
-
* 递归脱敏工具展示参数,保留真实执行输入不变,仅用于日志/状态/时间线展示。
|
|
47
|
-
*/
|
|
27
|
+
|
|
48
28
|
export declare function redactTransientClipboardPastePathsInValue(value: unknown): unknown;
|
|
49
29
|
export declare function getCanonicalMcpDetail(rawToolName: string): string;
|
|
50
|
-
|
|
51
|
-
* 根据工具名称获取动作类型信息
|
|
52
|
-
* @param toolName 工具名称
|
|
53
|
-
* @param toolInput 工具输入参数
|
|
54
|
-
* @param metadata SDK 提供的元数据(可能包含 MCP server 信息)
|
|
55
|
-
*/
|
|
30
|
+
|
|
56
31
|
export declare function getToolActionInfo(toolName: string | undefined, toolInput?: Record<string, unknown>, metadata?: ToolMetadata): ToolActionInfo;
|
|
57
32
|
export interface RuntimeTokenUsage {
|
|
58
33
|
inputTokens: number;
|
|
59
34
|
outputTokens: number;
|
|
60
|
-
|
|
35
|
+
|
|
61
36
|
contextLimit?: number;
|
|
62
|
-
|
|
37
|
+
|
|
63
38
|
maxOutput?: number;
|
|
64
|
-
|
|
65
|
-
* 来自 runtime resolveProviderConfig,前端用于精确显示压缩点。 */
|
|
39
|
+
|
|
66
40
|
inputLimit?: number;
|
|
67
|
-
|
|
68
|
-
* 动态比例按窗口大小分级(<32K=0.70, 32K-128K=0.75, 128K-512K=0.80, >=512K=0.85)。
|
|
69
|
-
* 前端 AgentContextPanel 优先用此值显示竖线,消除前端自算公式的脱节。 */
|
|
41
|
+
|
|
70
42
|
compactionThreshold?: number;
|
|
71
43
|
}
|
|
72
44
|
export type CommandOutputStream = "stdout" | "stderr" | "mixed";
|
|
@@ -74,11 +46,11 @@ export interface RuntimeStatusActionInfo {
|
|
|
74
46
|
actionType?: ToolActionType;
|
|
75
47
|
actionLabel?: string;
|
|
76
48
|
actionDetail?: string;
|
|
77
|
-
|
|
49
|
+
|
|
78
50
|
actionInput?: string;
|
|
79
51
|
actionResult?: string;
|
|
80
52
|
actionId?: string;
|
|
81
|
-
|
|
53
|
+
|
|
82
54
|
parentId?: string;
|
|
83
55
|
usage?: RuntimeTokenUsage;
|
|
84
56
|
}
|
|
@@ -87,49 +59,49 @@ export interface ProviderEvent {
|
|
|
87
59
|
sessionId: string;
|
|
88
60
|
timestamp: string;
|
|
89
61
|
data: {
|
|
90
|
-
|
|
62
|
+
|
|
91
63
|
text?: string;
|
|
92
|
-
|
|
64
|
+
|
|
93
65
|
model?: string;
|
|
94
|
-
|
|
66
|
+
|
|
95
67
|
endpoint?: string;
|
|
96
|
-
|
|
68
|
+
|
|
97
69
|
requestMethod?: string;
|
|
98
|
-
|
|
70
|
+
|
|
99
71
|
requestUrl?: string;
|
|
100
|
-
|
|
72
|
+
|
|
101
73
|
requestHeaders?: Record<string, string>;
|
|
102
|
-
|
|
74
|
+
|
|
103
75
|
stream?: boolean | CommandOutputStream;
|
|
104
|
-
|
|
76
|
+
|
|
105
77
|
messageCount?: number;
|
|
106
|
-
|
|
78
|
+
|
|
107
79
|
toolCount?: number;
|
|
108
|
-
|
|
80
|
+
|
|
109
81
|
lastUserMessagePreview?: string;
|
|
110
|
-
|
|
82
|
+
|
|
111
83
|
requestBody?: string;
|
|
112
|
-
|
|
84
|
+
|
|
113
85
|
toolName?: string;
|
|
114
|
-
|
|
86
|
+
|
|
115
87
|
toolInput?: Record<string, unknown>;
|
|
116
|
-
|
|
88
|
+
|
|
117
89
|
toolResult?: string;
|
|
118
|
-
|
|
90
|
+
|
|
119
91
|
isError?: boolean;
|
|
120
|
-
|
|
92
|
+
|
|
121
93
|
usage?: RuntimeTokenUsage;
|
|
122
|
-
|
|
94
|
+
|
|
123
95
|
responseBody?: string;
|
|
124
|
-
|
|
96
|
+
|
|
125
97
|
finishReason?: string;
|
|
126
|
-
|
|
98
|
+
|
|
127
99
|
exitCode?: number;
|
|
128
|
-
|
|
100
|
+
|
|
129
101
|
permissionPrompt?: string;
|
|
130
|
-
|
|
102
|
+
|
|
131
103
|
toolUseId?: string;
|
|
132
|
-
|
|
104
|
+
|
|
133
105
|
questions?: Array<{
|
|
134
106
|
question: string;
|
|
135
107
|
header?: string;
|
|
@@ -139,40 +111,37 @@ export interface ProviderEvent {
|
|
|
139
111
|
}>;
|
|
140
112
|
multiple?: boolean;
|
|
141
113
|
}>;
|
|
142
|
-
|
|
114
|
+
|
|
143
115
|
actionType?: ToolActionType;
|
|
144
|
-
|
|
116
|
+
|
|
145
117
|
actionLabel?: string;
|
|
146
|
-
|
|
118
|
+
|
|
147
119
|
actionDetail?: string;
|
|
148
|
-
|
|
120
|
+
|
|
149
121
|
actionId?: string;
|
|
150
|
-
|
|
122
|
+
|
|
151
123
|
parentId?: string;
|
|
152
|
-
|
|
124
|
+
|
|
153
125
|
actionResult?: string;
|
|
154
|
-
|
|
126
|
+
|
|
155
127
|
sequence?: number;
|
|
156
|
-
|
|
128
|
+
|
|
157
129
|
cwd?: string;
|
|
158
|
-
|
|
130
|
+
|
|
159
131
|
commandFilePath?: string;
|
|
160
|
-
|
|
132
|
+
|
|
161
133
|
commandLineCount?: number;
|
|
162
|
-
|
|
134
|
+
|
|
163
135
|
capabilities?: RuntimeCapabilities;
|
|
164
136
|
};
|
|
165
137
|
}
|
|
166
|
-
|
|
167
|
-
* 运行时能力清单
|
|
168
|
-
* 描述 ACode 会话启动时加载的 MCP 工具与 Skill 列表,供前端调试面板展示。
|
|
169
|
-
*/
|
|
138
|
+
|
|
170
139
|
export interface RuntimeSkillGroup {
|
|
171
|
-
|
|
140
|
+
|
|
172
141
|
dir: string;
|
|
173
|
-
|
|
142
|
+
|
|
174
143
|
exists: boolean;
|
|
175
|
-
|
|
144
|
+
|
|
176
145
|
skills: Array<{
|
|
177
146
|
name: string;
|
|
178
147
|
description?: string;
|
|
@@ -180,117 +149,107 @@ export interface RuntimeSkillGroup {
|
|
|
180
149
|
}>;
|
|
181
150
|
}
|
|
182
151
|
export interface RuntimeCapabilities {
|
|
183
|
-
|
|
152
|
+
|
|
184
153
|
kind: "mcp" | "skill" | "combined";
|
|
185
|
-
|
|
154
|
+
|
|
186
155
|
mcpServers?: string[];
|
|
187
|
-
|
|
156
|
+
|
|
188
157
|
mcpTools?: Array<{
|
|
189
158
|
name: string;
|
|
190
159
|
source: string;
|
|
191
160
|
description?: string;
|
|
192
161
|
}>;
|
|
193
|
-
|
|
162
|
+
|
|
194
163
|
skills?: Array<{
|
|
195
164
|
name: string;
|
|
196
165
|
description?: string;
|
|
197
166
|
directory?: string;
|
|
198
167
|
}>;
|
|
199
|
-
|
|
168
|
+
|
|
200
169
|
skillsDir?: string;
|
|
201
|
-
|
|
170
|
+
|
|
202
171
|
skillGroups?: RuntimeSkillGroup[];
|
|
203
172
|
}
|
|
204
|
-
|
|
205
|
-
* 实例自配置 AI provider 覆盖(仅 ACode 适配器消费)。
|
|
206
|
-
*
|
|
207
|
-
* 优先级:API 请求体(per-launch)> 环境变量 > bridge 下的 instance-acode-config.json 文件。
|
|
208
|
-
* 实例配置优先于 acode.json 全局 provider.default 配置;AcodeSdkAdapter 内部按
|
|
209
|
-
* "instance > global > default" 三层逐字段仲裁 model / baseURL / apiKey。
|
|
210
|
-
*/
|
|
173
|
+
|
|
211
174
|
export interface AdapterInstanceAiConfig {
|
|
212
175
|
model?: string;
|
|
213
176
|
baseURL?: string;
|
|
214
177
|
apiKey?: string;
|
|
215
|
-
|
|
178
|
+
|
|
216
179
|
effort?: string;
|
|
217
|
-
|
|
180
|
+
|
|
218
181
|
subAgentModel?: string;
|
|
219
|
-
|
|
182
|
+
|
|
220
183
|
subAgentEffort?: string;
|
|
221
184
|
}
|
|
222
185
|
export interface AdapterSessionConfig {
|
|
223
|
-
|
|
186
|
+
|
|
224
187
|
command: string;
|
|
225
|
-
|
|
188
|
+
|
|
226
189
|
workingDirectory: string;
|
|
227
|
-
|
|
190
|
+
|
|
228
191
|
agentId?: string;
|
|
229
|
-
|
|
192
|
+
|
|
230
193
|
initialPrompt?: string;
|
|
231
|
-
|
|
194
|
+
|
|
232
195
|
initialPromptVisibility?: "visible" | "hidden";
|
|
233
|
-
|
|
196
|
+
|
|
234
197
|
autoAccept: boolean;
|
|
235
|
-
|
|
198
|
+
|
|
236
199
|
systemPrompt?: string | {
|
|
237
200
|
type: string;
|
|
238
201
|
preset: string;
|
|
239
202
|
append: string;
|
|
240
203
|
};
|
|
241
|
-
|
|
204
|
+
|
|
242
205
|
globalPrompt?: string;
|
|
243
|
-
|
|
206
|
+
|
|
244
207
|
rolePrompt?: string;
|
|
245
|
-
|
|
208
|
+
|
|
246
209
|
memory?: string;
|
|
247
|
-
|
|
210
|
+
|
|
248
211
|
model?: string;
|
|
249
|
-
|
|
212
|
+
|
|
250
213
|
maxTurns?: number;
|
|
251
|
-
|
|
214
|
+
|
|
252
215
|
allowedTools?: string[];
|
|
253
|
-
|
|
216
|
+
|
|
254
217
|
mcpConfigPath?: string;
|
|
255
|
-
|
|
256
|
-
* 实例自配置 AI provider 覆盖(仅 ACode 消费)。AcodeSdkAdapter 内部会按
|
|
257
|
-
* "instance > global > default" 优先级仲裁,并将 baseURL/apiKey 写入
|
|
258
|
-
* per-instance acode.json 后作为 configPath 使用。
|
|
259
|
-
*/
|
|
218
|
+
|
|
260
219
|
instanceAiConfig?: AdapterInstanceAiConfig;
|
|
261
|
-
|
|
220
|
+
|
|
262
221
|
subAgentModel?: string;
|
|
263
|
-
|
|
222
|
+
|
|
264
223
|
subAgentEffort?: string;
|
|
265
|
-
|
|
224
|
+
|
|
266
225
|
providerArgs?: string[];
|
|
267
|
-
|
|
226
|
+
|
|
268
227
|
envOverrides?: Record<string, string>;
|
|
269
|
-
|
|
228
|
+
|
|
270
229
|
extraMcpServers?: Record<string, unknown>;
|
|
271
|
-
|
|
230
|
+
|
|
272
231
|
nodeVersion?: string;
|
|
273
|
-
|
|
232
|
+
|
|
274
233
|
executablePath?: string;
|
|
275
|
-
|
|
234
|
+
|
|
276
235
|
gitBashPath?: string;
|
|
277
|
-
|
|
236
|
+
|
|
278
237
|
additionalDirectories?: string[];
|
|
279
238
|
}
|
|
280
239
|
export interface AdapterSession {
|
|
281
|
-
|
|
240
|
+
|
|
282
241
|
sessionId: string;
|
|
283
|
-
|
|
242
|
+
|
|
284
243
|
providerSessionId?: string;
|
|
285
|
-
|
|
244
|
+
|
|
286
245
|
status: SessionStatus;
|
|
287
|
-
|
|
246
|
+
|
|
288
247
|
messages: ConversationMessage[];
|
|
289
|
-
|
|
248
|
+
|
|
290
249
|
createdAt: string;
|
|
291
|
-
|
|
250
|
+
|
|
292
251
|
totalUsage: RuntimeTokenUsage;
|
|
293
|
-
|
|
252
|
+
|
|
294
253
|
pid?: number;
|
|
295
254
|
}
|
|
296
255
|
export interface ConversationMessage {
|
|
@@ -299,15 +258,15 @@ export interface ConversationMessage {
|
|
|
299
258
|
role: "user" | "assistant" | "tool_use" | "tool_result";
|
|
300
259
|
content: string;
|
|
301
260
|
timestamp: string;
|
|
302
|
-
|
|
261
|
+
|
|
303
262
|
toolName?: string;
|
|
304
|
-
|
|
263
|
+
|
|
305
264
|
toolInput?: Record<string, unknown>;
|
|
306
|
-
|
|
265
|
+
|
|
307
266
|
toolResult?: string;
|
|
308
|
-
|
|
267
|
+
|
|
309
268
|
isError?: boolean;
|
|
310
|
-
|
|
269
|
+
|
|
311
270
|
toolUseId?: string;
|
|
312
271
|
}
|
|
313
272
|
export interface PermissionRequest {
|
|
@@ -318,7 +277,7 @@ export interface PermissionRequest {
|
|
|
318
277
|
}
|
|
319
278
|
export interface AskUserQuestionRequest {
|
|
320
279
|
sessionId: string;
|
|
321
|
-
|
|
280
|
+
|
|
322
281
|
toolCallId?: string;
|
|
323
282
|
questions: Array<{
|
|
324
283
|
question: string;
|
|
@@ -330,129 +289,52 @@ export interface AskUserQuestionRequest {
|
|
|
330
289
|
multiple?: boolean;
|
|
331
290
|
}>;
|
|
332
291
|
}
|
|
333
|
-
|
|
334
|
-
* Provider Adapter 基类
|
|
335
|
-
*
|
|
336
|
-
* 每个 AI CLI 工具对应一个 Adapter 实现,负责:
|
|
337
|
-
* 1. 管理 CLI 进程/SDK 客户端的生命周期
|
|
338
|
-
* 2. 将 Provider 特定的消息格式转换为统一的 ProviderEvent
|
|
339
|
-
* 3. 维护对话消息历史
|
|
340
|
-
*
|
|
341
|
-
* 事件:
|
|
342
|
-
* - 'event'(ProviderEvent) — 统一事件流
|
|
343
|
-
* - 'status-change'(sessionId, SessionStatus) — 会话状态变更
|
|
344
|
-
* - 'permission-request'(PermissionRequest) — 权限确认请求
|
|
345
|
-
* - 'ask-user-question'(AskUserQuestionRequest) — 用户问答请求
|
|
346
|
-
*/
|
|
292
|
+
|
|
347
293
|
export declare abstract class BaseProviderAdapter extends EventEmitter {
|
|
348
|
-
|
|
294
|
+
|
|
349
295
|
abstract readonly providerId: string;
|
|
350
|
-
|
|
296
|
+
|
|
351
297
|
abstract readonly displayName: string;
|
|
352
|
-
|
|
353
|
-
* 启动新会话
|
|
354
|
-
* @param sessionId 内部会话 ID
|
|
355
|
-
* @param config 会话配置
|
|
356
|
-
*/
|
|
298
|
+
|
|
357
299
|
abstract startSession(sessionId: string, config: AdapterSessionConfig): Promise<void>;
|
|
358
|
-
|
|
359
|
-
* 发送用户消息(触发新一轮对话)
|
|
360
|
-
* @param sessionId 会话 ID
|
|
361
|
-
* @param message 用户消息文本
|
|
362
|
-
*/
|
|
300
|
+
|
|
363
301
|
abstract sendMessage(sessionId: string, message: string): Promise<void>;
|
|
364
|
-
|
|
365
|
-
* 回应权限确认请求
|
|
366
|
-
* @param sessionId 会话 ID
|
|
367
|
-
* @param accept true=允许, false=拒绝
|
|
368
|
-
*/
|
|
302
|
+
|
|
369
303
|
abstract sendConfirmation(sessionId: string, accept: boolean): Promise<void>;
|
|
370
|
-
|
|
371
|
-
* 回答 AskUserQuestion
|
|
372
|
-
* @param sessionId 会话 ID
|
|
373
|
-
* @param answers 答案映射
|
|
374
|
-
*/
|
|
304
|
+
|
|
375
305
|
abstract sendQuestionAnswer?(sessionId: string, answers: Record<string, string>): Promise<void>;
|
|
376
|
-
|
|
377
|
-
* 设置空闲命令配置(用于SDK模式)
|
|
378
|
-
* 当 AI 进入 waiting_input 状态时,自动执行这些命令
|
|
379
|
-
* @param sessionId 会话 ID
|
|
380
|
-
* @param commands 空闲命令配置
|
|
381
|
-
*/
|
|
306
|
+
|
|
382
307
|
abstract setIdleCommands?(sessionId: string, commands: {
|
|
383
308
|
idleInputCommand: string;
|
|
384
309
|
nonInputCommand: string;
|
|
385
310
|
}): void;
|
|
386
|
-
|
|
387
|
-
* 发送快捷键 token 序列(如 [enter]、[ctrl+c]),复用 SDK 输入流但不创建普通用户消息。
|
|
388
|
-
* @param sessionId 会话 ID
|
|
389
|
-
* @param command 快捷 token 文本
|
|
390
|
-
*/
|
|
311
|
+
|
|
391
312
|
abstract sendShortcutInput?(sessionId: string, command: string): Promise<void>;
|
|
392
|
-
|
|
393
|
-
* 中止当前正在执行的轮次(软中断)
|
|
394
|
-
* 会话保持活跃,用户可继续发送新消息。
|
|
395
|
-
* @param sessionId 会话 ID
|
|
396
|
-
*/
|
|
313
|
+
|
|
397
314
|
abstract abortCurrentTurn(sessionId: string): Promise<void>;
|
|
398
|
-
|
|
399
|
-
* 重置当前会话上下文但保留 SDK 会话本身。
|
|
400
|
-
*/
|
|
315
|
+
|
|
401
316
|
abstract resetContext?(sessionId: string): Promise<void>;
|
|
402
|
-
|
|
403
|
-
* 终止会话
|
|
404
|
-
* @param sessionId 会话 ID
|
|
405
|
-
*/
|
|
317
|
+
|
|
406
318
|
abstract terminateSession(sessionId: string): Promise<void>;
|
|
407
|
-
|
|
408
|
-
* 恢复之前的会话
|
|
409
|
-
* @param sessionId 内部会话 ID
|
|
410
|
-
* @param providerSessionId Provider 端的会话 ID
|
|
411
|
-
* @param config 会话配置
|
|
412
|
-
*/
|
|
319
|
+
|
|
413
320
|
abstract resumeSession?(sessionId: string, providerSessionId: string, config: AdapterSessionConfig): Promise<void>;
|
|
414
|
-
|
|
415
|
-
* 获取指定会话的对话历史
|
|
416
|
-
* @param sessionId 会话 ID
|
|
417
|
-
*/
|
|
321
|
+
|
|
418
322
|
abstract getConversation(sessionId: string): ConversationMessage[];
|
|
419
|
-
|
|
420
|
-
* 检查会话是否存在且活跃
|
|
421
|
-
* @param sessionId 会话 ID
|
|
422
|
-
*/
|
|
323
|
+
|
|
423
324
|
abstract hasSession(sessionId: string): boolean;
|
|
424
|
-
|
|
425
|
-
* 获取会话的 Provider 端会话 ID(用于恢复)
|
|
426
|
-
*/
|
|
325
|
+
|
|
427
326
|
abstract getProviderSessionId(sessionId: string): string | undefined;
|
|
428
|
-
|
|
429
|
-
* 获取会话状态
|
|
430
|
-
*/
|
|
327
|
+
|
|
431
328
|
abstract getSessionStatus(sessionId: string): SessionStatus | undefined;
|
|
432
|
-
|
|
433
|
-
* 获取会话的 SDK 进程 PID(用于孤儿进程检测)
|
|
434
|
-
*/
|
|
329
|
+
|
|
435
330
|
abstract getSessionPid?(sessionId: string): number | undefined;
|
|
436
|
-
|
|
437
|
-
* 主动查询会话的运行时能力清单(MCP 工具 + skills)。
|
|
438
|
-
* 只读 adapter 内存缓存,不触发 runtime 重新探测。
|
|
439
|
-
* 仅 AcodeSdkAdapter 实现此方法(其他 adapter 返回 undefined)。
|
|
440
|
-
* @returns 缓存的能力清单,若尚未收到任何 runtime_capabilities 事件则返回 undefined
|
|
441
|
-
*/
|
|
331
|
+
|
|
442
332
|
abstract getCapabilities?(sessionId: string): RuntimeCapabilities | undefined;
|
|
443
|
-
|
|
444
|
-
* 主动查询会话当前挂起的 ask_user_question(agent 提问)。
|
|
445
|
-
* 只读 adapter 内存缓存,不触发 runtime 重新探测。
|
|
446
|
-
* 仅 AcodeSdkAdapter 实现此方法(其他 adapter 返回 undefined)。
|
|
447
|
-
* 由 bridge GET /runtime/sdk/pending-questions 端点调用,用于前端刷新后重建提问 UI。
|
|
448
|
-
* @returns 挂起提问的 toolCallId 与 questions 数组;undefined 表示当前无挂起提问
|
|
449
|
-
*/
|
|
333
|
+
|
|
450
334
|
abstract getPendingQuestion?(sessionId: string): {
|
|
451
335
|
toolCallId: string;
|
|
452
336
|
questions: unknown[];
|
|
453
337
|
} | undefined;
|
|
454
|
-
|
|
455
|
-
* 清理所有资源(应用退出时调用)
|
|
456
|
-
*/
|
|
338
|
+
|
|
457
339
|
abstract cleanup(): void;
|
|
458
340
|
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* CC-Switch Adapters 共享类型和工具函数
|
|
3
|
-
*
|
|
4
|
-
* 从 cc-switch-sdk 包导入接口定义,在此实现具体适配器
|
|
5
|
-
*/
|
|
1
|
+
|
|
6
2
|
import type { AppId, McpServer, McpServerSpec } from '@cc-switch/sdk';
|
|
7
3
|
export type JsonRecord = Record<string, unknown>;
|
|
8
4
|
export interface ClaudeConfig {
|
|
@@ -35,17 +31,11 @@ export interface ClaudecodeConfig {
|
|
|
35
31
|
mcpServers?: Record<string, ClaudecodeServer>;
|
|
36
32
|
[key: string]: unknown;
|
|
37
33
|
}
|
|
38
|
-
|
|
39
|
-
* 将 OpenCode/Claudecode server 格式转换为 MCP spec
|
|
40
|
-
*/
|
|
34
|
+
|
|
41
35
|
export declare function toMcpSpecFromOpenCode(input: OpenCodeServer): McpServerSpec;
|
|
42
|
-
|
|
43
|
-
* 将 MCP spec 转换为 OpenCode/Claudecode server 格式
|
|
44
|
-
*/
|
|
36
|
+
|
|
45
37
|
export declare function toOpenCodeServer(input: McpServerSpec): OpenCodeServer;
|
|
46
|
-
|
|
47
|
-
* 导入时合并 App 标记
|
|
48
|
-
*/
|
|
38
|
+
|
|
49
39
|
export declare function mergeAppFlagOnImport(server: McpServer, appId: AppId): McpServer;
|
|
50
40
|
export declare const toMcpSpecFromClaudecode: typeof toMcpSpecFromOpenCode;
|
|
51
41
|
export declare const toClaudecodeServer: typeof toOpenCodeServer;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* CC-Switch Adapters 入口
|
|
3
|
-
*
|
|
4
|
-
* 提供工厂函数创建所有 MCP 和 Skill 适配器实例
|
|
5
|
-
*/
|
|
1
|
+
|
|
6
2
|
import type { AppId, IMcpAdapter, ISkillAdapter, SdkPaths } from '@cc-switch/sdk';
|
|
7
3
|
export { AcodeMcpAdapter } from './mcp-acode.js';
|
|
8
4
|
export { ClaudeMcpAdapter } from './mcp-claude.js';
|
|
@@ -17,11 +13,7 @@ export { CodexSkillAdapter } from './skill-codex.js';
|
|
|
17
13
|
export { OpenCodeSkillAdapter } from './skill-opencode.js';
|
|
18
14
|
export { PlaceholderSkillAdapter } from './skill-placeholder.js';
|
|
19
15
|
export * from './common.js';
|
|
20
|
-
|
|
21
|
-
* 创建所有 MCP 适配器实例
|
|
22
|
-
*/
|
|
16
|
+
|
|
23
17
|
export declare function createMcpAdapters(paths: SdkPaths): Record<AppId, IMcpAdapter>;
|
|
24
|
-
|
|
25
|
-
* 创建所有 Skill 适配器实例
|
|
26
|
-
*/
|
|
18
|
+
|
|
27
19
|
export declare function createSkillAdapters(paths: SdkPaths): Record<AppId, ISkillAdapter>;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* ACode MCP Adapter
|
|
3
|
-
*
|
|
4
|
-
* 主流程:读取内置 ACode 的 JSON 配置 -> 将 mcpServers 映射导入 SDK ->
|
|
5
|
-
* 按 SDK 状态增删 ACode 配置中的 MCP server。ACode 内置在 runtime-bridge 中,
|
|
6
|
-
* 因此不需要外部 CLI 安装步骤。
|
|
7
|
-
*/
|
|
1
|
+
|
|
8
2
|
import type { IMcpAdapter, McpServer } from '@cc-switch/sdk';
|
|
9
3
|
export declare class AcodeMcpAdapter implements IMcpAdapter {
|
|
10
4
|
private readonly configPath;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Codex MCP Adapter
|
|
3
|
-
*
|
|
4
|
-
* Codex does not receive per-session MCP servers from the current SDK surface.
|
|
5
|
-
* This adapter persists MCP servers into Codex's config.toml while preserving
|
|
6
|
-
* unrelated user-owned config text.
|
|
7
|
-
*/
|
|
1
|
+
|
|
8
2
|
import type { IMcpAdapter, McpServer } from '@cc-switch/sdk';
|
|
9
3
|
export declare class CodexMcpAdapter implements IMcpAdapter {
|
|
10
4
|
private readonly configPath;
|