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
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
* OpenCode MCP Adapter
|
|
3
|
-
*
|
|
4
|
-
* 实现 IMcpAdapter 接口,负责 OpenCode 的 MCP 配置读写
|
|
5
|
-
*/
|
|
1
|
+
|
|
6
2
|
import type { IMcpAdapter, McpServer } from '@cc-switch/sdk';
|
|
7
3
|
export declare class OpenCodeMcpAdapter implements IMcpAdapter {
|
|
8
4
|
private readonly configPath;
|
|
9
5
|
readonly appId: "opencode";
|
|
10
6
|
constructor(configPath: string);
|
|
11
|
-
|
|
12
|
-
* 读取 OpenCode MCP 映射,优先使用合法的 mcp 字段,兼容历史错误写入的 mcpServers。
|
|
13
|
-
*/
|
|
7
|
+
|
|
14
8
|
private getMcpMap;
|
|
15
|
-
|
|
16
|
-
* 将 MCP 服务器写回 OpenCode 配置,只保留合法的 mcp 字段并清理错误的 mcpServers。
|
|
17
|
-
*/
|
|
9
|
+
|
|
18
10
|
private saveMcpMap;
|
|
19
11
|
importServers(): Promise<McpServer[]>;
|
|
20
12
|
syncServer(server: McpServer): Promise<void>;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* ACode Skill Adapter
|
|
3
|
-
*
|
|
4
|
-
* 主流程:复用目录型 Skill 同步,将已安装 Skill 物化到内置 ACode 的
|
|
5
|
-
* `.acode/skills` 目录,供 ACode headless runtime 启动时扫描。
|
|
6
|
-
*/
|
|
1
|
+
|
|
7
2
|
import { DirectorySkillAdapter } from './skill-directory.js';
|
|
8
3
|
export declare class AcodeSkillAdapter extends DirectorySkillAdapter {
|
|
9
4
|
constructor(skillsDir: string);
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Claude Skill Adapter
|
|
3
|
-
*
|
|
4
|
-
* 实现 ISkillAdapter 接口,负责 Claude Desktop 的 Skill 目录管理
|
|
5
|
-
*/
|
|
1
|
+
|
|
6
2
|
import { DirectorySkillAdapter } from './skill-directory.js';
|
|
7
3
|
export declare class ClaudeSkillAdapter extends DirectorySkillAdapter {
|
|
8
4
|
constructor(skillsDir: string);
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* ClaudeCode Skill Adapter
|
|
3
|
-
*
|
|
4
|
-
* 实现 ISkillAdapter 接口,负责 ClaudeCode 的 Skill 目录管理
|
|
5
|
-
*/
|
|
1
|
+
|
|
6
2
|
import { DirectorySkillAdapter } from './skill-directory.js';
|
|
7
3
|
export declare class ClaudecodeSkillAdapter extends DirectorySkillAdapter {
|
|
8
4
|
constructor(skillsDir: string);
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* OpenCode Skill Adapter
|
|
3
|
-
*
|
|
4
|
-
* 实现 ISkillAdapter 接口,负责 OpenCode 的 Skill 目录管理
|
|
5
|
-
*/
|
|
1
|
+
|
|
6
2
|
import { DirectorySkillAdapter } from './skill-directory.js';
|
|
7
3
|
export declare class OpenCodeSkillAdapter extends DirectorySkillAdapter {
|
|
8
4
|
constructor(skillsDir: string);
|
package/dist/config.d.ts
CHANGED
|
@@ -1,99 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* 集中管理所有环境变量和配置常量
|
|
5
|
-
*/
|
|
6
|
-
/** 服务端口 */
|
|
1
|
+
|
|
2
|
+
|
|
7
3
|
export declare const port: number;
|
|
8
|
-
|
|
4
|
+
|
|
9
5
|
export declare const DEFAULT_SCHEDULER_BASE_URL = "http://localhost:8080";
|
|
10
6
|
export type SchedulerBaseUrlSource = "request" | "instance-id-match" | "env" | "single-auto-register-target" | "default" | "ambiguous-auto-register-targets";
|
|
11
7
|
export interface SchedulerBaseUrlResolution {
|
|
12
8
|
url: string;
|
|
13
9
|
source: SchedulerBaseUrlSource;
|
|
14
10
|
ambiguousTargetUrls: string[];
|
|
15
|
-
|
|
11
|
+
|
|
16
12
|
instanceId?: string;
|
|
17
|
-
|
|
13
|
+
|
|
18
14
|
instanceName?: string;
|
|
19
15
|
}
|
|
20
|
-
|
|
21
|
-
* 解析调度中心基础 URL。
|
|
22
|
-
* 主流程:显式环境变量优先;未配置时,单个自动注册目标可作为宿主机部署的零额外配置回退;多目标不静默取第一个。
|
|
23
|
-
*/
|
|
16
|
+
|
|
24
17
|
export declare function resolveSchedulerBaseUrl(): SchedulerBaseUrlResolution;
|
|
25
|
-
|
|
26
|
-
* 解析调度中心基础 URL。
|
|
27
|
-
* 主流程:服务端请求携带的 scheduler 地址优先;再按 instanceId/instanceName 在 config.json 中匹配 target;
|
|
28
|
-
* 再读显式环境变量;最后回退到单个自动注册目标或默认值。
|
|
29
|
-
*/
|
|
18
|
+
|
|
30
19
|
export declare function resolveSchedulerBaseUrlFrom(requestSchedulerBaseUrl: unknown, instanceId?: unknown, instanceName?: unknown): SchedulerBaseUrlResolution;
|
|
31
|
-
|
|
20
|
+
|
|
32
21
|
export declare const schedulerBaseUrl: string;
|
|
33
|
-
|
|
22
|
+
|
|
34
23
|
export declare const nodeEnv: string;
|
|
35
|
-
|
|
24
|
+
|
|
36
25
|
export declare const allowHostFileBrowser: boolean;
|
|
37
|
-
|
|
26
|
+
|
|
38
27
|
export declare const allowedCorsOrigins: string[];
|
|
39
|
-
|
|
28
|
+
|
|
40
29
|
export declare function validateProductionToken(): void;
|
|
41
|
-
|
|
30
|
+
|
|
42
31
|
export declare function getRuntimeHomeDir(): string;
|
|
43
|
-
|
|
32
|
+
|
|
44
33
|
export declare function getClaudeConfigFile(runtimeHome: string): string;
|
|
45
|
-
|
|
34
|
+
|
|
46
35
|
export declare function getClaudeMcpConfigFile(runtimeHome: string): string;
|
|
47
|
-
|
|
36
|
+
|
|
48
37
|
export declare function getClaudeSkillsDir(runtimeHome: string): string;
|
|
49
|
-
|
|
38
|
+
|
|
50
39
|
export declare function getOpencodeConfigFile(runtimeHome: string): string;
|
|
51
|
-
|
|
40
|
+
|
|
52
41
|
export declare function getAcodeConfigFile(runtimeHome: string): string;
|
|
53
|
-
|
|
42
|
+
|
|
54
43
|
export declare function getCodexConfigFile(runtimeHome: string): string;
|
|
55
|
-
|
|
44
|
+
|
|
56
45
|
export declare function getCodexSkillsDir(runtimeHome: string): string;
|
|
57
|
-
|
|
46
|
+
|
|
58
47
|
export declare function getOpencodeSkillsDir(runtimeHome: string): string;
|
|
59
|
-
|
|
48
|
+
|
|
60
49
|
export declare function getAcodeSkillsDir(runtimeHome: string): string;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
*/
|
|
64
|
-
/** 定期扫描间隔(毫秒),默认 30 秒 */
|
|
50
|
+
|
|
51
|
+
|
|
65
52
|
export declare const ORPHAN_SCAN_INTERVAL: number;
|
|
66
|
-
|
|
53
|
+
|
|
67
54
|
export declare const ORPHAN_AUTO_CLEAN_MODE: "auto" | "alert" | "manual";
|
|
68
|
-
|
|
55
|
+
|
|
69
56
|
export declare const ORPHAN_SCAN_ENABLED: boolean;
|
|
70
|
-
|
|
57
|
+
|
|
71
58
|
export declare const ORPHAN_UNRESPONSIVE_TIMEOUT: number;
|
|
72
|
-
|
|
59
|
+
|
|
73
60
|
export declare const ORPHAN_CPU_THRESHOLD: number;
|
|
74
|
-
|
|
61
|
+
|
|
75
62
|
export declare const ORPHAN_MEMORY_THRESHOLD: number;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*/
|
|
79
|
-
/** 是否启用自动注册 */
|
|
63
|
+
|
|
64
|
+
|
|
80
65
|
export declare const AUTO_REGISTER_ENABLED: boolean;
|
|
81
|
-
|
|
66
|
+
|
|
82
67
|
export declare const AUTO_REGISTER_TENANT_ID: string;
|
|
83
|
-
|
|
68
|
+
|
|
84
69
|
export declare const AUTO_REGISTER_USER_KEY: string;
|
|
85
|
-
|
|
70
|
+
|
|
86
71
|
export declare const AUTO_REGISTER_INSTANCE_NAME: string;
|
|
87
|
-
|
|
72
|
+
|
|
88
73
|
export declare const AUTO_REGISTER_PROJECT_NAME: string;
|
|
89
|
-
|
|
74
|
+
|
|
90
75
|
export declare const AUTO_REGISTER_ROLE_NAME: string;
|
|
91
|
-
|
|
76
|
+
|
|
92
77
|
export declare const AUTO_REGISTER_WORKSPACE_PATH: string;
|
|
93
|
-
|
|
78
|
+
|
|
94
79
|
export declare const AUTO_REGISTER_VIRTUAL_IP: string;
|
|
95
|
-
|
|
96
|
-
* 读取 aws-runtime-bridge package.json 中的版本号。
|
|
97
|
-
* 缓存结果,仅在首次调用时读取文件。
|
|
98
|
-
*/
|
|
80
|
+
|
|
99
81
|
export declare function getBridgeVersion(): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
* Token 验证中间件
|
|
3
|
-
*
|
|
4
|
-
* 验证请求头中的 X-Runtime-Token 是否为已配对的 connectionKey 或 runtime binding token。
|
|
5
|
-
* 也提供联合中间件,同时支持面板 cookie 会话认证,用于可从面板 UI 触发的操作。
|
|
6
|
-
*/
|
|
1
|
+
|
|
7
2
|
import type { Request, Response, NextFunction } from "express";
|
|
8
|
-
|
|
9
|
-
* 校验 runtime token。
|
|
10
|
-
* 主流程:复用 REST 中间件的 runtime binding token 与 connectionKey 校验逻辑,供 WebSocket upgrade 使用。
|
|
11
|
-
*/
|
|
3
|
+
|
|
12
4
|
export declare function isRuntimeTokenValid(token: unknown): boolean;
|
|
13
|
-
|
|
14
|
-
* Token 验证中间件
|
|
15
|
-
* 检查请求头中的 X-Runtime-Token 或 Authorization: Bearer 是否有效。
|
|
16
|
-
*
|
|
17
|
-
* 支持面板/服务器绑定时写入的动态令牌和 bridge 实例 connectionKey。
|
|
18
|
-
*/
|
|
5
|
+
|
|
19
6
|
export declare function validateToken(req: Request, res: Response, next: NextFunction): void;
|
|
20
|
-
|
|
21
|
-
* 联合中间件:同时支持 runtime token 和面板 cookie 会话。
|
|
22
|
-
* 面板前端调用时需要 cookie 认证(由浏览器自动附带),
|
|
23
|
-
* 调度中心/服务端调用时使用 X-Runtime-Token 或 Authorization: Bearer。
|
|
24
|
-
* 适用于可从面板 UI 或外部 API 两种途径触发的操作。
|
|
25
|
-
*/
|
|
7
|
+
|
|
26
8
|
export declare function validateTokenOrPanelSession(req: Request, res: Response, next: NextFunction): void;
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* ACode Todo 读取 API 路由
|
|
3
|
-
*
|
|
4
|
-
* 直接读取 bridge 家目录下 ~/.acode/todos/{agentId}.json,
|
|
5
|
-
* 不依赖 agent 工作目录,避免 workspacePath 错误导致读取失败。
|
|
6
|
-
*
|
|
7
|
-
* 文件由 ACode 内置 TodoStore 写入(package/acode/src/todo-store.ts),
|
|
8
|
-
* 路径与 ~/.acode/cmd-dist/ 惯例一致。
|
|
9
|
-
*/
|
|
1
|
+
|
|
10
2
|
export declare const acodeTodosRouter: import("express-serve-static-core").Router;
|
package/dist/routes/events.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* 文件浏览器 API 路由
|
|
3
|
-
*
|
|
4
|
-
* 提供文件系统浏览功能
|
|
5
|
-
*/
|
|
1
|
+
|
|
6
2
|
import multer from 'multer';
|
|
7
3
|
export declare const fileBrowserRouter: import("express-serve-static-core").Router;
|
|
8
4
|
export declare const WORKSPACE_UPLOAD_FILE_LIMIT = 2000;
|
|
@@ -40,9 +36,7 @@ export declare function createWorkspaceUploadLimitResponse(error: multer.MulterE
|
|
|
40
36
|
};
|
|
41
37
|
};
|
|
42
38
|
export declare function parseWorkspaceUploadRelativePaths(body: Record<string, unknown>): string[];
|
|
43
|
-
|
|
44
|
-
* 主流程:从选中的工作目录生成目录树,根据 .gitignore 规则排除文件,不限制层数和项数。
|
|
45
|
-
*/
|
|
39
|
+
|
|
46
40
|
export declare function listHostDirectoryTree(requestPath?: string): Promise<DirectoryTreeResponse>;
|
|
47
41
|
export declare function parseGitIgnoreRules(content: string): GitIgnoreRule[];
|
|
48
42
|
export declare function isIgnoredByGitIgnore(relativePath: string, isDirectory: boolean, rules: GitIgnoreRule[]): boolean;
|
|
@@ -1,55 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
* 文件差异回滚路由
|
|
3
|
-
*
|
|
4
|
-
* 根据变更记录的反向操作执行文件回滚。
|
|
5
|
-
* 与全量快照还原不同的是,只还原被修改过的文件。
|
|
6
|
-
*
|
|
7
|
-
* 核心流程(两步走):
|
|
8
|
-
* 1. 内存预检:在内存中按修改时间逆序模拟所有反向操作,验证完整性。不触碰文件系统。
|
|
9
|
-
* - CREATE:检查文件是否存在,准备删除
|
|
10
|
-
* - UPDATE:读取 diff patch,读取当前文件内容,在内存中应用反向 patch 验证是否成功
|
|
11
|
-
* - DELETE:读取删除前的完整内容,准备重建
|
|
12
|
-
* 2. 原子执行:预检全部通过后,批量写入文件系统;任一预检失败则返回 previewFailed=true,
|
|
13
|
-
* 由调用方(前端)弹出"跳过不通过项 / 文件全量覆盖"二选一对话框。
|
|
14
|
-
* skipFailed=true 时仅执行通过项(partial);否则不写盘。
|
|
15
|
-
*
|
|
16
|
-
* 反向操作映射:
|
|
17
|
-
* CREATE → DELETE(删除创建的文件)
|
|
18
|
-
* UPDATE → 应用反向 diff patch(精确撤销修改的部分,保留用户后续改动);
|
|
19
|
-
* 若补丁无法精确应用(上下文不匹配=冲突),报为预检失败,不静默整文件覆盖
|
|
20
|
-
* DELETE → 重新创建被删除的文件(根据 cacheKey 从 bridge 本地缓存读取)
|
|
21
|
-
*/
|
|
1
|
+
|
|
22
2
|
export declare const fileDiffRollbackRouter: import("express-serve-static-core").Router;
|
|
23
3
|
export interface ReverseOperation {
|
|
24
|
-
|
|
4
|
+
|
|
25
5
|
originalOperation: 'CREATE' | 'UPDATE' | 'DELETE';
|
|
26
|
-
|
|
6
|
+
|
|
27
7
|
relativePath: string;
|
|
28
|
-
|
|
8
|
+
|
|
29
9
|
cacheKey: string | null;
|
|
30
|
-
|
|
10
|
+
|
|
31
11
|
createdAt: string;
|
|
32
12
|
}
|
|
33
13
|
export interface DiffRollbackRequest {
|
|
34
14
|
workspacePath: string;
|
|
35
15
|
operations: ReverseOperation[];
|
|
36
|
-
|
|
37
|
-
* 预检部分失败时的处理策略。
|
|
38
|
-
* - 缺省/ false:任一预检失败则直接返回 previewFailed,不写盘(由调用方决定后续动作)。
|
|
39
|
-
* - true:仅执行通过预检的操作(preview.plan 中的项),跳过失败项,
|
|
40
|
-
* 返回 partial:true,让调用方可以"跳过不通过项"而非整工作区快照覆盖。
|
|
41
|
-
*/
|
|
16
|
+
|
|
42
17
|
skipFailed?: boolean;
|
|
43
18
|
}
|
|
44
|
-
|
|
19
|
+
|
|
45
20
|
export interface OperationDetail {
|
|
46
21
|
relativePath: string;
|
|
47
22
|
originalOperation: string;
|
|
48
|
-
|
|
23
|
+
|
|
49
24
|
status: 'preview_passed' | 'preview_failed' | 'success' | 'failed' | 'skipped';
|
|
50
|
-
|
|
25
|
+
|
|
51
26
|
action?: string;
|
|
52
|
-
|
|
27
|
+
|
|
53
28
|
reason?: string;
|
|
54
29
|
}
|
|
55
30
|
export interface DiffRollbackResult {
|
|
@@ -57,13 +32,10 @@ export interface DiffRollbackResult {
|
|
|
57
32
|
restored: number;
|
|
58
33
|
skipped: number;
|
|
59
34
|
errors: string[];
|
|
60
|
-
|
|
35
|
+
|
|
61
36
|
previewFailed?: boolean;
|
|
62
|
-
|
|
63
|
-
* 部分执行标志:skipFailed=true 且仅有部分操作通过预检时,
|
|
64
|
-
* 已对通过项执行写盘、跳过失败项,返回 partial:true。
|
|
65
|
-
*/
|
|
37
|
+
|
|
66
38
|
partial?: boolean;
|
|
67
|
-
|
|
39
|
+
|
|
68
40
|
details: OperationDetail[];
|
|
69
41
|
}
|
package/dist/routes/git.d.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
* Git 快照 API 路由
|
|
3
|
-
*
|
|
4
|
-
* 提供 Git Stash 快照的创建、列表、恢复和删除功能
|
|
5
|
-
*/
|
|
1
|
+
|
|
6
2
|
export declare const gitRouter: import("express-serve-static-core").Router;
|
|
7
|
-
|
|
8
|
-
* 解析 Git 命令超时时间。
|
|
9
|
-
* 主流程:优先使用环境变量,非法或过小配置回落到默认值,避免 Git 检测请求长期挂起。
|
|
10
|
-
*/
|
|
3
|
+
|
|
11
4
|
export declare function resolveGitCommandTimeoutMs(): number;
|
|
12
5
|
interface GitRepositoryContext {
|
|
13
6
|
workspacePath: string;
|
|
@@ -33,111 +26,45 @@ interface GitDiffSummaryFile {
|
|
|
33
26
|
deletions: number;
|
|
34
27
|
staged: boolean;
|
|
35
28
|
}
|
|
36
|
-
|
|
37
|
-
* 判断 Git diff 汇总行是否应该展示在差异树中。
|
|
38
|
-
* 普通 modified 且文本增删均为 0 通常是 filemode/元数据噪声,避免显示为“无差异内容”。
|
|
39
|
-
*/
|
|
29
|
+
|
|
40
30
|
export declare function shouldIncludeGitDiffSummaryFile(status: GitDiffFileStatus, additions: number, deletions: number, isBinaryDiff: boolean): boolean;
|
|
41
|
-
|
|
42
|
-
* 判断 git stash 是否因仓库尚无初始提交而失败。
|
|
43
|
-
* 主流程:兼容 Git 不同版本输出,将底层英文错误归一成可面向用户的诊断。
|
|
44
|
-
*/
|
|
31
|
+
|
|
45
32
|
export declare function isGitStashMissingInitialCommitError(output: string): boolean;
|
|
46
33
|
export declare function createMissingInitialCommitSnapshotError(): string;
|
|
47
|
-
|
|
48
|
-
* 判断 git stash push 是否明确表示没有本地变更。
|
|
49
|
-
* 主流程:兼容不同 Git 版本把 no-change 信息输出到 stdout 或 stderr,且可能返回 0 或非 0。
|
|
50
|
-
*/
|
|
34
|
+
|
|
51
35
|
export declare function isGitStashNoChangesOutput(output: string): boolean;
|
|
52
36
|
interface LatestGitStash {
|
|
53
37
|
ref: string;
|
|
54
38
|
stashName: string;
|
|
55
39
|
message: string;
|
|
56
40
|
}
|
|
57
|
-
|
|
58
|
-
* 生成 AgentsWork 持久化 stash 快照 ref。
|
|
59
|
-
* 主流程:仅接受稳定 stash commit hash,返回项目私有 refs 命名空间下的引用路径。
|
|
60
|
-
*/
|
|
41
|
+
|
|
61
42
|
export declare function createAgentsWorkStashSnapshotRef(stashRef: string): string | null;
|
|
62
|
-
|
|
63
|
-
* 解析 git stash list --format 输出行。
|
|
64
|
-
* 主流程:优先返回稳定 stash commit hash 作为 ref,同时保留 stash@{n} 供界面展示。
|
|
65
|
-
*/
|
|
43
|
+
|
|
66
44
|
export declare function parseGitStashListLine(line: string): GitStashItem | null;
|
|
67
|
-
|
|
68
|
-
* 从 git stash list -n 1 输出解析最近一次 stash。
|
|
69
|
-
* 主流程:提取稳定 stash commit hash,供无变更快照复用最近快照引用。
|
|
70
|
-
*/
|
|
45
|
+
|
|
71
46
|
export declare function parseLatestGitStash(output: string): LatestGitStash | null;
|
|
72
|
-
|
|
73
|
-
* 持久化 stash 快照引用。
|
|
74
|
-
* 具体功能:为稳定 stash commit hash 创建私有 Git ref;失败时记录警告并保留调用方的兼容回退。
|
|
75
|
-
*/
|
|
47
|
+
|
|
76
48
|
export declare function persistAgentsWorkStashSnapshotRef(workspacePath: string, stashRef: string): Promise<string | null>;
|
|
77
|
-
|
|
78
|
-
* 解析 git diff 的 name-status 与 numstat 输出,生成前端文件树需要的汇总数据。
|
|
79
|
-
*/
|
|
49
|
+
|
|
80
50
|
export declare function parseGitStatusStagedPaths(output: string): Set<string>;
|
|
81
|
-
|
|
82
|
-
* 解析 git diff 的 name-status 与 numstat 输出,生成前端文件树需要的汇总数据。
|
|
83
|
-
*/
|
|
51
|
+
|
|
84
52
|
export declare function parseGitDiffSummary(nameStatusOutput: string, numstatOutput: string, stagedPaths?: Set<string>, forceStaged?: boolean): GitDiffSummaryFile[];
|
|
85
|
-
|
|
86
|
-
* 从 git status --porcelain 输出中提取未跟踪 (untracked) 路径。
|
|
87
|
-
* `??` 前缀表示未跟踪文件或目录。
|
|
88
|
-
*/
|
|
53
|
+
|
|
89
54
|
export declare function parseGitStatusUntrackedPaths(output: string): string[];
|
|
90
|
-
|
|
91
|
-
* 合并工作区与暂存区差异汇总。
|
|
92
|
-
* 主流程:以路径去重,保留工作区展示顺序;同一路径若也存在暂存变更则标记为 staged 并累加统计。
|
|
93
|
-
*/
|
|
55
|
+
|
|
94
56
|
export declare function mergeGitDiffSummaryFiles(unstagedFiles: GitDiffSummaryFile[], stagedFiles: GitDiffSummaryFile[]): GitDiffSummaryFile[];
|
|
95
57
|
export declare function normalizeGitCommitMessage(message: unknown): string;
|
|
96
58
|
export declare function createScopedGitPathspecArgs(context: Pick<GitRepositoryContext, 'relativeWorkspacePath'>): string[];
|
|
97
59
|
export declare function createScopedFilePathspecArgs(filePath: string, context: Pick<GitRepositoryContext, 'relativeWorkspacePath'>): string[];
|
|
98
|
-
|
|
99
|
-
* 清洗 AI 返回的提交信息,去掉元描述/代码块/超长首行等噪声。
|
|
100
|
-
*
|
|
101
|
-
* 主流程:
|
|
102
|
-
* 1. 主策略: 查找最早的 conventional commit type 模式(type(scope)?:),直接截取
|
|
103
|
-
* 这一段之前的元描述全部丢弃。位置限定在 80 字符内,避免把 body 中提到的
|
|
104
|
-
* "feat" 等字眼误当作开头。
|
|
105
|
-
* 2. 兜底: 主策略未命中时,反复剥离已知元描述前缀 pattern(最多 5 次)
|
|
106
|
-
* 3. 截断到首个空行,丢弃 body 中混入的元描述
|
|
107
|
-
* 4. 去掉尾部 markdown 代码块
|
|
108
|
-
* 5. 首行 > 100 字符视为模型仍在解释,只保留首行
|
|
109
|
-
* 6. 最终为空时返回 "chore: update staged changes" 兜底
|
|
110
|
-
*/
|
|
60
|
+
|
|
111
61
|
export declare function sanitizeCommitMessage(raw: string): string;
|
|
112
|
-
|
|
113
|
-
* 从 OpenAI-compatible SSE chunk 文本中提取增量文本。
|
|
114
|
-
* 处理:空行 / 缺少 data 字段 / [DONE] 哨兵 / 非 JSON 行的容错。
|
|
115
|
-
*/
|
|
62
|
+
|
|
116
63
|
export declare function extractOpenAiStreamDelta(chunkText: string): string;
|
|
117
|
-
|
|
118
|
-
* 调试级: 记录 AI stream 的前 N 个 chunk 的完整 JSON 结构,用于诊断
|
|
119
|
-
* 模型返回格式与标准 OpenAI 格式不同导致 delta 无法提取的问题。
|
|
120
|
-
*/
|
|
64
|
+
|
|
121
65
|
export declare function debugAiStreamChunk(chunkText: string, index: number): void;
|
|
122
|
-
|
|
123
|
-
* 调用 OpenAI-compatible API(非流式)生成 Git 提交信息。
|
|
124
|
-
*
|
|
125
|
-
* 主流程:组装 prompt → 调 chat/completions → 清洗回复 → 返回。
|
|
126
|
-
* 保留此接口为同步路径的兜底(测试 / 旧调用方),新场景请优先使用 `streamAiForCommitMessage`。
|
|
127
|
-
*/
|
|
66
|
+
|
|
128
67
|
export declare function callAiForCommitMessage(aiBaseUrl: string, aiApiKey: string, aiModel: string, diffContent: string): Promise<string>;
|
|
129
|
-
|
|
130
|
-
* 流式调用 OpenAI-compatible API 生成 Git 提交信息。
|
|
131
|
-
*
|
|
132
|
-
* 主流程:
|
|
133
|
-
* 1. 发起 stream:true 的 chat/completions 请求
|
|
134
|
-
* 2. 逐 chunk 解析 SSE,把 delta 文本回调给调用方(`onDelta`)
|
|
135
|
-
* 3. 全部读取完成后,把累积内容交给 `sanitizeCommitMessage` 清洗
|
|
136
|
-
* 4. 返回清洗后的最终提交信息
|
|
137
|
-
*
|
|
138
|
-
* 入参:
|
|
139
|
-
* - onDelta: 每次收到增量时调用,用于把"打字机"效果推给上层
|
|
140
|
-
* - abortSignal: 调用方可中止请求(用户取消时使用)
|
|
141
|
-
*/
|
|
68
|
+
|
|
142
69
|
export declare function streamAiForCommitMessage(aiBaseUrl: string, aiApiKey: string, aiModel: string, diffContent: string, onDelta: (delta: string, accumulated: string) => void, abortSignal?: AbortSignal): Promise<string>;
|
|
143
70
|
export {};
|
|
@@ -29,24 +29,13 @@ interface AmbiguousSchedulerBaseUrlResponse {
|
|
|
29
29
|
autoRegisterTargetUrls: string[];
|
|
30
30
|
hint: string;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
* 构建调度中心 ping 失败响应。
|
|
34
|
-
* 主流程:保留底层错误与 scheduler 地址,同时明确 bridge 本身已连通、失败点在 bridge 回连调度中心。
|
|
35
|
-
*/
|
|
32
|
+
|
|
36
33
|
export declare function buildSchedulerPingFailureResponse(error: Error, configuredSchedulerBaseUrl: string): SchedulerPingFailureResponse;
|
|
37
|
-
|
|
38
|
-
* Build the response for ambiguous scheduler targets.
|
|
39
|
-
* Main flow: never silently pick the first target; require an explicit scheduler URL or future scheduler identity routing.
|
|
40
|
-
*/
|
|
34
|
+
|
|
41
35
|
export declare function buildAmbiguousSchedulerBaseUrlResponse(targetUrls: string[]): AmbiguousSchedulerBaseUrlResponse;
|
|
42
|
-
|
|
43
|
-
* 构建工具状态检测目标列表。
|
|
44
|
-
* 主流程:合并实例启用工具与配置面板固定展示工具,避免历史状态缺少 Codex 时前端误判为待检测。
|
|
45
|
-
*/
|
|
36
|
+
|
|
46
37
|
export declare function buildToolStatusDetectionTargets(enabledTools: string[]): string[];
|
|
47
|
-
|
|
48
|
-
* 汇总卸载后仍可执行的工具,用于避免把部分卸载误报为成功。
|
|
49
|
-
*/
|
|
38
|
+
|
|
50
39
|
export declare function buildUninstallFailureMessage(requestedTools: string[], toolStatus: Record<string, ToolInstallStatus>): string;
|
|
51
40
|
export declare function summarizeToolStatus(toolStatus: Record<string, ToolInstallStatus>): Record<string, Pick<ToolInstallStatus, "installed" | "version" | "executable" | "error">>;
|
|
52
41
|
export {};
|