aws-runtime-bridge 1.9.92 → 1.9.93
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/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/utils/logger.d.ts
CHANGED
|
@@ -1,35 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
* 统一日志模块
|
|
3
|
-
*
|
|
4
|
-
* 提供结构化日志输出,支持不同日志级别和格式化
|
|
5
|
-
* 附带环形缓冲区,capture 最近 N 条日志供面板查看
|
|
6
|
-
*/
|
|
1
|
+
|
|
7
2
|
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
8
|
-
|
|
3
|
+
|
|
9
4
|
export declare function pushLog(level: LogLevel, prefix: string, message: string): void;
|
|
10
|
-
|
|
11
|
-
* 返回缓冲区中最近的日志(按时间倒序)
|
|
12
|
-
* @param maxCount 最多返回条数
|
|
13
|
-
* @param filterLevel 可选级别过滤
|
|
14
|
-
*/
|
|
5
|
+
|
|
15
6
|
export declare function getRecentLogs(maxCount?: number, filterLevel?: LogLevel): Array<{
|
|
16
7
|
level: LogLevel;
|
|
17
8
|
timestamp: string;
|
|
18
9
|
prefix: string;
|
|
19
10
|
message: string;
|
|
20
11
|
}>;
|
|
21
|
-
|
|
12
|
+
|
|
22
13
|
export declare function setLogBufferEnabled(enabled: boolean): void;
|
|
23
|
-
|
|
14
|
+
|
|
24
15
|
export declare function clearLogBuffer(): void;
|
|
25
16
|
export interface LogConfig {
|
|
26
17
|
level: LogLevel;
|
|
27
18
|
prefix?: string;
|
|
28
19
|
timestamp?: boolean;
|
|
29
20
|
}
|
|
30
|
-
|
|
31
|
-
* 日志器类
|
|
32
|
-
*/
|
|
21
|
+
|
|
33
22
|
export declare class Logger {
|
|
34
23
|
private readonly level;
|
|
35
24
|
private readonly prefix;
|
|
@@ -41,9 +30,7 @@ export declare class Logger {
|
|
|
41
30
|
info(...args: unknown[]): void;
|
|
42
31
|
warn(...args: unknown[]): void;
|
|
43
32
|
error(...args: unknown[]): void;
|
|
44
|
-
|
|
45
|
-
* 创建子日志器
|
|
46
|
-
*/
|
|
33
|
+
|
|
47
34
|
child(prefix: string): Logger;
|
|
48
35
|
}
|
|
49
36
|
export declare const logger: {
|
|
@@ -1,60 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
* MCP 工具函数
|
|
3
|
-
*
|
|
4
|
-
* 提供 MCP 服务器配置的构建、转换和规范化功能
|
|
5
|
-
*/
|
|
1
|
+
|
|
6
2
|
import type { LegacyMcpStateItem, McpPayload, McpServerConfig, SdkApps } from '../types.js';
|
|
7
3
|
import type { McpServerSpec } from '@cc-switch/sdk';
|
|
8
|
-
|
|
9
|
-
* 构建 MCP 配置内容
|
|
10
|
-
*
|
|
11
|
-
* @param mcpServers - MCP 服务器列表
|
|
12
|
-
* @returns JSON 格式的配置内容
|
|
13
|
-
*/
|
|
4
|
+
|
|
14
5
|
export declare function buildMcpConfigContent(mcpServers: LegacyMcpStateItem[]): string;
|
|
15
|
-
|
|
16
|
-
* 规范化 MCP Payload
|
|
17
|
-
*
|
|
18
|
-
* @param payload - 原始 payload
|
|
19
|
-
* @returns 规范化后的 MCP Payload,无效返回 null
|
|
20
|
-
*/
|
|
6
|
+
|
|
21
7
|
export declare function normalizeMcpPayload(payload: unknown): McpPayload | null;
|
|
22
|
-
|
|
23
|
-
* 规范化 SDK App 标志
|
|
24
|
-
*
|
|
25
|
-
* @param rawApps - 原始 apps 配置
|
|
26
|
-
* @returns 规范化后的 SdkApps
|
|
27
|
-
*/
|
|
8
|
+
|
|
28
9
|
export declare function normalizeSdkAppFlags(rawApps: unknown): SdkApps | undefined;
|
|
29
|
-
|
|
30
|
-
* 规范化 SDK MCP 服务器规格
|
|
31
|
-
*
|
|
32
|
-
* @param rawMcp - 原始 MCP 配置
|
|
33
|
-
* @returns 规范化后的服务器配置
|
|
34
|
-
*/
|
|
10
|
+
|
|
35
11
|
export declare function normalizeSdkMcpServerSpec(rawMcp: unknown): McpServerSpec;
|
|
36
|
-
|
|
37
|
-
* SDK MCP 服务器接口
|
|
38
|
-
*/
|
|
12
|
+
|
|
39
13
|
export interface McpServerFromSdk {
|
|
40
14
|
id?: string;
|
|
41
15
|
name?: string;
|
|
42
16
|
server?: McpServerConfig;
|
|
43
17
|
apps?: SdkApps;
|
|
44
18
|
}
|
|
45
|
-
|
|
46
|
-
* 转换为 Legacy MCP State Item
|
|
47
|
-
*
|
|
48
|
-
* @param mcpServer - SDK MCP 服务器对象
|
|
49
|
-
* @returns Legacy MCP State Item
|
|
50
|
-
*/
|
|
19
|
+
|
|
51
20
|
export declare function toLegacyMcpStateItem(mcpServer: McpServerFromSdk): LegacyMcpStateItem;
|
|
52
|
-
|
|
53
|
-
* 转换为 Legacy Skill State Item
|
|
54
|
-
*
|
|
55
|
-
* @param skill - Skill 对象
|
|
56
|
-
* @returns Legacy Skill State Item
|
|
57
|
-
*/
|
|
21
|
+
|
|
58
22
|
export declare function toLegacySkillStateItem(skill: {
|
|
59
23
|
id?: string;
|
|
60
24
|
name?: string;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* 提供路径解析和标准化的工具函数
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* 解析结果接口
|
|
8
|
-
*/
|
|
1
|
+
|
|
2
|
+
|
|
9
3
|
export interface PropertiesPathResult {
|
|
10
4
|
normalizedWorkspace: string;
|
|
11
5
|
resolvedTarget: string;
|
|
@@ -13,11 +7,5 @@ export interface PropertiesPathResult {
|
|
|
13
7
|
export declare function resolveWorkspaceRoot(workspacePath: string | unknown): string;
|
|
14
8
|
export declare function ensureInsideWorkspace(workspaceRoot: string, targetPath: string): string;
|
|
15
9
|
export declare function resolveWorkspaceFilePath(workspacePath: string | unknown, relativeOrAbsolutePath: string | unknown, defaultRelativePath: string): PropertiesPathResult;
|
|
16
|
-
|
|
17
|
-
* 解析属性文件的目标路径
|
|
18
|
-
*
|
|
19
|
-
* @param workspacePath - 工作区路径
|
|
20
|
-
* @param relativeOrAbsolutePath - 相对或绝对路径
|
|
21
|
-
* @returns 解析后的路径结果
|
|
22
|
-
*/
|
|
10
|
+
|
|
23
11
|
export declare function resolvePropertiesTargetPath(workspacePath: string | unknown, relativeOrAbsolutePath: string | unknown): PropertiesPathResult;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
export declare const BRIDGE_PACKAGE_ROOT: string;
|
|
2
|
-
|
|
3
|
-
* 主干流程:从 bridge 自身安装根下的 node_modules 读取包元数据,
|
|
4
|
-
* 按 package.json 的 exports/module/main 定位真实 ESM 入口,避免猜测根目录 index.js。
|
|
5
|
-
*/
|
|
2
|
+
|
|
6
3
|
export declare function resolveBridgePackageEntryPath(packageName: string, packageRoot?: string): Promise<string>;
|
|
7
|
-
|
|
8
|
-
* 具体实现逻辑:优先从 bridge-local 安装目录显式导入真实入口;
|
|
9
|
-
* 若没有本地 package.json,则退回 Node 的包名解析以兼容开发环境。
|
|
10
|
-
*/
|
|
4
|
+
|
|
11
5
|
export declare function importBridgeSdkPackage<TModule>(packageName: string): Promise<TModule>;
|
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* 提供通用的验证和转换函数
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* 解析布尔值
|
|
8
|
-
* 支持多种格式的布尔值转换
|
|
9
|
-
*
|
|
10
|
-
* @param value - 待解析的值
|
|
11
|
-
* @param defaultValue - 默认值
|
|
12
|
-
* @returns 解析后的布尔值
|
|
13
|
-
*/
|
|
1
|
+
|
|
2
|
+
|
|
14
3
|
export declare function parseBoolean(value: unknown, defaultValue?: boolean): boolean;
|
|
15
|
-
|
|
16
|
-
* 确保启用的工具列表有效
|
|
17
|
-
* 如果传入的数组无效或为空,返回默认工具列表
|
|
18
|
-
*
|
|
19
|
-
* @param rawTools - 原始工具列表
|
|
20
|
-
* @returns 有效的工具列表
|
|
21
|
-
*/
|
|
4
|
+
|
|
22
5
|
export declare function ensureEnabledTools(rawTools: unknown): string[];
|
|
@@ -1,72 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* 提供 YAML 配置文件的读取、解析、生成和路径匹配功能
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* YAML 加载结果
|
|
8
|
-
*/
|
|
1
|
+
|
|
2
|
+
|
|
9
3
|
export interface YmlLoadResult {
|
|
10
4
|
content: string | null;
|
|
11
5
|
resolvedPath: string;
|
|
12
6
|
foundInParent: boolean;
|
|
13
7
|
matchedAgentPath: string | null;
|
|
14
8
|
}
|
|
15
|
-
|
|
16
|
-
* Agent 配置提取结果
|
|
17
|
-
*/
|
|
9
|
+
|
|
18
10
|
export interface AgentConfigResult {
|
|
19
11
|
content: string;
|
|
20
12
|
isTemplate: boolean;
|
|
21
13
|
projectFromSibling: string | null;
|
|
22
14
|
}
|
|
23
|
-
|
|
24
|
-
* 检查 YAML 配置中是否有 agent 的 path 匹配目标路径
|
|
25
|
-
* path 字段格式支持:modules\x 或 modules/x
|
|
26
|
-
*
|
|
27
|
-
* @param yamlContent - YAML 内容
|
|
28
|
-
* @param targetRelativePath - 目标相对路径
|
|
29
|
-
* @returns 匹配的 agent path,无匹配则返回 null
|
|
30
|
-
*/
|
|
15
|
+
|
|
31
16
|
export declare function hasMatchingAgentPath(yamlContent: string, targetRelativePath: string): string | null;
|
|
32
|
-
|
|
33
|
-
* 从 YAML 配置中提取匹配的 agent 配置,或生成模板
|
|
34
|
-
*
|
|
35
|
-
* @param yamlContent - YAML 内容
|
|
36
|
-
* @param targetRelativePath - 目标相对路径
|
|
37
|
-
* @returns 提取结果
|
|
38
|
-
*/
|
|
17
|
+
|
|
39
18
|
export declare function extractAgentConfigOrTemplate(yamlContent: string, targetRelativePath: string): AgentConfigResult;
|
|
40
|
-
|
|
41
|
-
* 生成空模板
|
|
42
|
-
* 注意:path 字段留空,在写入时根据工作目录自动计算
|
|
43
|
-
*
|
|
44
|
-
* @param _targetRelativePath - 目标相对路径(未使用)
|
|
45
|
-
* @returns 空模板 YAML 内容
|
|
46
|
-
*/
|
|
19
|
+
|
|
47
20
|
export declare function generateEmptyTemplate(_targetRelativePath: string): string;
|
|
48
|
-
|
|
49
|
-
* 自动填充 YAML 配置中的 path 字段
|
|
50
|
-
* 如果 path 为空、未填写或只有空白字符,则使用工作目录相对于项目根目录的路径
|
|
51
|
-
*
|
|
52
|
-
* @param ymlContent - YAML 配置内容
|
|
53
|
-
* @param workspaceRelativePath - 工作目录相对于项目根目录的路径
|
|
54
|
-
* @returns 处理后的 YAML 内容
|
|
55
|
-
*/
|
|
21
|
+
|
|
56
22
|
export declare function autoFillPathInYml(ymlContent: string, workspaceRelativePath: string): string;
|
|
57
|
-
|
|
58
|
-
* 向上查找并加载 YAML 配置文件
|
|
59
|
-
*
|
|
60
|
-
* 查找逻辑:
|
|
61
|
-
* 1. 先检查工作目录下是否有配置文件,检查 path 是否匹配
|
|
62
|
-
* 2. 如果不匹配,向上查找父目录的配置文件,检查 path 是否匹配
|
|
63
|
-
* 3. 找到匹配的配置 → 使用该配置
|
|
64
|
-
* 4. 所有层级都没有匹配的配置 → 使用最后一个找到的配置(或在工作目录创建)
|
|
65
|
-
*
|
|
66
|
-
* 例如:工作目录 D:\a\b\c\d,相对路径 .agentswork/my.yml
|
|
67
|
-
* 第1次查找:D:\a\b\c\d\.agentswork\my.yml,匹配 path="."
|
|
68
|
-
* 第2次查找:D:\a\b\c\.agentswork\my.yml,匹配 path="d"
|
|
69
|
-
* 第3次查找:D:\a\b\.agentswork\my.yml,匹配 path="c/d"
|
|
70
|
-
* ...
|
|
71
|
-
*/
|
|
23
|
+
|
|
72
24
|
export declare function loadYmlWithUpwardSearch(workspacePath: string, relativePath: string): Promise<YmlLoadResult>;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @cc-switch/sdk - 纯配置管理 SDK
|
|
3
|
-
*
|
|
4
|
-
* 负责 MCP/Skill 的 CRUD 操作和状态管理。
|
|
5
|
-
* 注意:adapters 需要外部注入,SDK 不提供默认实现。
|
|
6
|
-
*/
|
|
1
|
+
|
|
7
2
|
import type { AppId, AppFlags, McpServer, McpServerSpec, InstalledSkill, SkillSyncMethod, SdkOptions, SdkPaths, SdkState, IMcpAdapter, ISkillAdapter, AdapterOverrides } from "./types.js";
|
|
8
3
|
import { CcSwitchSdk } from "./sdk.js";
|
|
9
4
|
import { AiConfigService, buildToolSpecificAiConfig, type AiConfigTemplate, type ClaudeCodeConfig, type CodexConfig, type OpenCodeConfig, type AiConfigPaths } from "./services/ai-config-service.js";
|
|
@@ -8,16 +8,7 @@ export declare class CcSwitchSdk {
|
|
|
8
8
|
private readonly skillAdapters;
|
|
9
9
|
private state;
|
|
10
10
|
private operationQueue;
|
|
11
|
-
|
|
12
|
-
* 创建 CcSwitchSdk 实例
|
|
13
|
-
*
|
|
14
|
-
* 注意:adapters 必须通过 options.adapters 注入,
|
|
15
|
-
* cc-switch-sdk 不再提供默认的 adapter 实现。
|
|
16
|
-
*
|
|
17
|
-
* @param options - SDK 配置选项
|
|
18
|
-
* @param options.adapters.mcp - MCP 适配器映射(必需)
|
|
19
|
-
* @param options.adapters.skill - Skill 适配器映射(必需)
|
|
20
|
-
*/
|
|
11
|
+
|
|
21
12
|
constructor(options: SdkOptions);
|
|
22
13
|
private executeExclusive;
|
|
23
14
|
load(): Promise<void>;
|
|
@@ -37,22 +28,13 @@ export declare class CcSwitchSdk {
|
|
|
37
28
|
deleteMcpServer(id: string): Promise<void>;
|
|
38
29
|
toggleMcpApp(serverId: string, appId: AppId, enabled: boolean): Promise<McpServer>;
|
|
39
30
|
importMcpFromApps(): Promise<number>;
|
|
40
|
-
|
|
41
|
-
* 从单个应用导入 MCP 服务器
|
|
42
|
-
*/
|
|
31
|
+
|
|
43
32
|
private importMcpFromApp;
|
|
44
|
-
|
|
45
|
-
* 处理导入的 MCP 服务器(合并或创建)
|
|
46
|
-
* @returns 是否为新创建的 MCP
|
|
47
|
-
*/
|
|
33
|
+
|
|
48
34
|
private processImportedMcp;
|
|
49
|
-
|
|
50
|
-
* 根据名称查找 MCP 服务器
|
|
51
|
-
*/
|
|
35
|
+
|
|
52
36
|
private findMcpServerByName;
|
|
53
|
-
|
|
54
|
-
* 创建带有应用标记的 MCP 服务器
|
|
55
|
-
*/
|
|
37
|
+
|
|
56
38
|
private createMcpWithAppFlag;
|
|
57
39
|
getAllSkills(): InstalledSkill[];
|
|
58
40
|
getSkillById(id: string): InstalledSkill | undefined;
|
|
@@ -61,30 +43,17 @@ export declare class CcSwitchSdk {
|
|
|
61
43
|
uninstallSkill(id: string): Promise<void>;
|
|
62
44
|
toggleSkillApp(skillId: string, appId: AppId, enabled: boolean): Promise<InstalledSkill>;
|
|
63
45
|
importSkillsFromApps(): Promise<number>;
|
|
64
|
-
|
|
65
|
-
* 从单个应用导入 Skills
|
|
66
|
-
*/
|
|
46
|
+
|
|
67
47
|
private importSkillsFromApp;
|
|
68
|
-
|
|
69
|
-
* 处理导入的 Skill(合并或创建)
|
|
70
|
-
* @returns 是否为新创建的 Skill
|
|
71
|
-
*/
|
|
48
|
+
|
|
72
49
|
private processImportedSkill;
|
|
73
|
-
|
|
74
|
-
* 根据名称查找 Skill
|
|
75
|
-
*/
|
|
50
|
+
|
|
76
51
|
private findSkillByName;
|
|
77
|
-
|
|
78
|
-
* 合并已存在的 Skill
|
|
79
|
-
*/
|
|
52
|
+
|
|
80
53
|
private mergeExistingSkill;
|
|
81
|
-
|
|
82
|
-
* 创建新导入的 Skill
|
|
83
|
-
*/
|
|
54
|
+
|
|
84
55
|
private createNewImportedSkill;
|
|
85
|
-
|
|
86
|
-
* 创建带有应用标记的 Skill
|
|
87
|
-
*/
|
|
56
|
+
|
|
88
57
|
private createSkillWithAppFlag;
|
|
89
58
|
getPaths(): SdkPaths;
|
|
90
59
|
}
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import { type ACodeBuiltInTool } from "./built-in-file-tools.js";
|
|
2
|
-
|
|
3
|
-
* ask_user_question 工具的依赖:由 ACodeRuntime 注入,
|
|
4
|
-
* 让工具的 execute() 能通知 runtime 发出 question_request 事件,
|
|
5
|
-
* 并阻塞等待 runtime 通过 submitQuestionAnswer() 回传答案。
|
|
6
|
-
*/
|
|
2
|
+
|
|
7
3
|
export interface AcodeAskUserQuestionDeps {
|
|
8
|
-
|
|
9
|
-
* 当工具被调用时,runtime 应发出 question_request 事件,
|
|
10
|
-
* 携带 questions 与 toolCallId,让适配器转发到前端。
|
|
11
|
-
*/
|
|
4
|
+
|
|
12
5
|
onQuestion(toolCallId: string, questions: AcodeQuestionItem[]): void;
|
|
13
|
-
|
|
14
|
-
* 阻塞等待用户回答。runtime 内部用 questionWaiters Map 管理 Promise,
|
|
15
|
-
* submitQuestionAnswer() 调用时 resolve,abort/stop 时 reject。
|
|
16
|
-
*/
|
|
6
|
+
|
|
17
7
|
waitForAnswer(toolCallId: string, contextVersion: number): Promise<Record<string, string>>;
|
|
18
8
|
}
|
|
19
9
|
export interface AcodeQuestionOption {
|
|
@@ -33,14 +23,11 @@ export interface AcodeAskUserQuestionResult {
|
|
|
33
23
|
answers: Record<string, string>;
|
|
34
24
|
summary: string;
|
|
35
25
|
}
|
|
36
|
-
|
|
26
|
+
|
|
37
27
|
export declare const ASK_USER_QUESTION_TOOL_NAME = "ask_user_question";
|
|
38
|
-
|
|
39
|
-
* 创建 ask_user_question 内置工具。
|
|
40
|
-
* 由 ACodeRuntime.start() 调用并注入 deps。
|
|
41
|
-
*/
|
|
28
|
+
|
|
42
29
|
export declare function createAskUserQuestionTool(deps: AcodeAskUserQuestionDeps, contextVersionProvider: () => number): ACodeBuiltInTool;
|
|
43
|
-
|
|
30
|
+
|
|
44
31
|
export declare function isAskUserQuestionResult(value: unknown): value is AcodeAskUserQuestionResult;
|
|
45
|
-
|
|
32
|
+
|
|
46
33
|
export declare function serializeAskUserQuestionResult(result: AcodeAskUserQuestionResult): string;
|
|
@@ -15,10 +15,10 @@ export interface ACodeBuiltInTool {
|
|
|
15
15
|
}
|
|
16
16
|
export interface ACodeBuiltInToolExecutionContext {
|
|
17
17
|
readonly onOutput?: CommandOutputSink;
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
readonly toolCallId?: string;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
export interface AgentFileChangeRecord {
|
|
23
23
|
filePath: string;
|
|
24
24
|
operation: 'CREATE' | 'UPDATE' | 'DELETE';
|
|
@@ -32,9 +32,6 @@ export interface ResolvedWorkspaceTarget {
|
|
|
32
32
|
targetPath: string;
|
|
33
33
|
}
|
|
34
34
|
export declare function ensureInsideWorkspace(workspaceRoot: string, targetPath: string): string;
|
|
35
|
-
|
|
36
|
-
* 解析内置文件工具目标路径。
|
|
37
|
-
* 主流程:同时校验请求路径与 realpath 工作区边界,防止绝对路径、`..` 与符号链接目录穿透。
|
|
38
|
-
*/
|
|
35
|
+
|
|
39
36
|
export declare function resolveWorkspaceTarget(workingDirectory: string, rawFilePath: string): Promise<ResolvedWorkspaceTarget>;
|
|
40
37
|
export declare function createBuiltInFileTools(workingDirectory: string, agentId?: string, onFileChange?: OnAgentFileChange): ACodeBuiltInTool[];
|
|
@@ -6,10 +6,7 @@ export declare function countOutputLines(output: string): number;
|
|
|
6
6
|
export declare function buildAcodeCmdDistDir(agentId: string): string;
|
|
7
7
|
export declare function buildAcodeAgentDir(agentId: string): string;
|
|
8
8
|
export declare function writeCommandArtifactFile(agentId: string, suffix: string, extension: string, content: string, now?: Date): Promise<string>;
|
|
9
|
-
|
|
10
|
-
* 清理 ACode 重启时指定 agentId 的旧 spillover 输出目录。
|
|
11
|
-
* 删除 ~/.agentswork/acode/<agentId>/cmd-dist/ 下的所有内容。
|
|
12
|
-
*/
|
|
9
|
+
|
|
13
10
|
export declare function cleanupAcodeCmdDist(agentId: string): Promise<void>;
|
|
14
11
|
export declare function buildCommandOutputSpilloverContent(input: {
|
|
15
12
|
readonly commandText: string;
|
|
@@ -1,27 +1,12 @@
|
|
|
1
1
|
import { TextDecoder } from "node:util";
|
|
2
|
-
|
|
3
|
-
* 自动检测解码器接口。暴露 TextDecoder 兼容的 decode() 方法,
|
|
4
|
-
* 调用方仍可像使用 TextDecoder 一样使用(decode(chunk, options))。
|
|
5
|
-
*/
|
|
2
|
+
|
|
6
3
|
export interface OutputDecoder {
|
|
7
4
|
decode(chunk?: Uint8Array | ArrayBuffer | null, options?: {
|
|
8
5
|
stream?: boolean;
|
|
9
6
|
}): string;
|
|
10
7
|
}
|
|
11
8
|
export declare function resolveShellOutputEncoding(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): string;
|
|
12
|
-
|
|
13
|
-
* 创建一个自动检测编码的流式解码器。
|
|
14
|
-
*
|
|
15
|
-
* 主流程:优先使用环境变量指定的编码 -> Windows 上自动检测 UTF-8/GB18030 ->
|
|
16
|
-
* 非 Windows 默认 UTF-8。
|
|
17
|
-
*
|
|
18
|
-
* 自动检测策略:先用 UTF-8 解码;如果输出中出现 \uFFFD(替换字符),
|
|
19
|
-
* 说明实际编码不是 UTF-8,立即切换为 GB18030 并用已缓冲的原始字节重新解码。
|
|
20
|
-
* 这样可以同时覆盖 UTF-8 输出(PowerShell Core、WSL 等)和 GBK 输出(cmd.exe 等)。
|
|
21
|
-
*/
|
|
9
|
+
|
|
22
10
|
export declare function createShellOutputDecoder(encoding?: string): OutputDecoder;
|
|
23
|
-
|
|
24
|
-
* 解码 shell 输出 chunk。
|
|
25
|
-
* 兼容旧接口,decoder 可以是 TextDecoder 或 OutputDecoder。
|
|
26
|
-
*/
|
|
11
|
+
|
|
27
12
|
export declare function decodeShellOutputChunk(decoder: OutputDecoder | TextDecoder, chunk?: Buffer, end?: boolean): string;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { ACodeCommandSpec } from '../types.js';
|
|
2
|
-
|
|
3
|
-
* 解析 Markdown slash command。
|
|
4
|
-
* 主流程:读取可选 YAML frontmatter -> 使用正文作为 prompt 模板 -> 缺省命令名取文件名。
|
|
5
|
-
*/
|
|
2
|
+
|
|
6
3
|
export declare function parseAcodeCommandMarkdown(sourcePath: string, rawMarkdown: string): ACodeCommandSpec;
|