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/routes/pty.d.ts
CHANGED
|
@@ -30,41 +30,23 @@ interface PtySessionEntry extends PtySessionSummary {
|
|
|
30
30
|
persistent: boolean;
|
|
31
31
|
}
|
|
32
32
|
export declare const ptySessions: Map<string, PtySessionEntry>;
|
|
33
|
-
|
|
34
|
-
* 解析 PTY 空闲清理时间。
|
|
35
|
-
* 主流程:读取环境变量 -> 非法值回退默认值 -> 用于 WebSocket 全断开后的延迟清理。
|
|
36
|
-
*/
|
|
33
|
+
|
|
37
34
|
export declare function resolvePtyIdleTtlMs(env?: NodeJS.ProcessEnv): number;
|
|
38
|
-
|
|
39
|
-
* 选择默认 shell。
|
|
40
|
-
* 主流程:Windows 优先 pwsh/powershell/cmd;Unix 优先 SHELL/bash/sh,返回可执行文件名与参数。
|
|
41
|
-
*/
|
|
35
|
+
|
|
42
36
|
export declare function resolveDefaultShell(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv, existsSync?: (path: fs.PathLike) => boolean): {
|
|
43
37
|
shell: string;
|
|
44
38
|
args: string[];
|
|
45
39
|
};
|
|
46
|
-
|
|
47
|
-
* 校验并解析 shell 选择。
|
|
48
|
-
* 主流程:auto 使用默认 shell;显式 shell 必须命中 allowlist,避免前端任意执行二进制。
|
|
49
|
-
*/
|
|
40
|
+
|
|
50
41
|
export declare function resolveRequestedShell(requestedShell: unknown, platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): {
|
|
51
42
|
shell: string;
|
|
52
43
|
args: string[];
|
|
53
44
|
};
|
|
54
|
-
|
|
55
|
-
* 判断候选路径是否位于允许根目录中。
|
|
56
|
-
* 具体逻辑:使用 path.relative 处理 Windows/Unix 分隔符,拒绝向上穿越和跨盘路径。
|
|
57
|
-
*/
|
|
45
|
+
|
|
58
46
|
export declare function isPathInsideRoot(candidatePath: string, rootPath: string): boolean;
|
|
59
|
-
|
|
60
|
-
* 解析并校验 PTY 工作目录。
|
|
61
|
-
* 主流程:要求绝对目录存在;如果配置 AWS_PTY_ALLOWED_ROOTS,则必须位于允许根目录内。
|
|
62
|
-
*/
|
|
47
|
+
|
|
63
48
|
export declare function resolvePtyWorkspacePath(workspacePath: unknown, env?: NodeJS.ProcessEnv): string;
|
|
64
|
-
|
|
65
|
-
* 创建 PTY session。
|
|
66
|
-
* 主流程:校验 cwd/shell -> spawn 真实 PTY -> 注册 output/exit 事件 -> 返回元数据给控制面。
|
|
67
|
-
*/
|
|
49
|
+
|
|
68
50
|
export declare function createPtySession(input: {
|
|
69
51
|
workspacePath: unknown;
|
|
70
52
|
title?: unknown;
|
|
@@ -81,25 +63,16 @@ export declare function resolvePtyExitedTtlMs(env?: NodeJS.ProcessEnv): number;
|
|
|
81
63
|
export declare function resolveMaxPtySessions(env?: NodeJS.ProcessEnv): number;
|
|
82
64
|
export declare function listPtySessions(): PtySessionSummary[];
|
|
83
65
|
export declare function getPtySessionSummary(id: string): PtySessionSummary | undefined;
|
|
84
|
-
|
|
85
|
-
* 生成短期 PTY 连接令牌。
|
|
86
|
-
* 主流程:确认 session 存在 -> 生成随机 token -> 记录 session 绑定和过期时间。
|
|
87
|
-
*/
|
|
66
|
+
|
|
88
67
|
export declare function createPtyConnectToken(sessionId: string): {
|
|
89
68
|
token: string;
|
|
90
69
|
expiresAt: string;
|
|
91
70
|
} | undefined;
|
|
92
|
-
|
|
93
|
-
* 关闭 PTY session。
|
|
94
|
-
* 主流程:关闭连接 -> kill PTY -> 清理定时器和内存索引。
|
|
95
|
-
*/
|
|
71
|
+
|
|
96
72
|
export declare function closePtySession(id: string, reason?: string): boolean;
|
|
97
73
|
export declare function closeAllPtySessions(reason?: string): void;
|
|
98
74
|
export declare const ptyRouter: Router;
|
|
99
|
-
|
|
100
|
-
* 将 PTY WebSocket upgrade 挂到 HTTP server。
|
|
101
|
-
* 主流程:匹配 /pty/sessions/:id/stream -> token 校验 -> session 校验 -> 交给 noServer WSS。
|
|
102
|
-
*/
|
|
75
|
+
|
|
103
76
|
export declare function attachPtyWebSocketServer(server: {
|
|
104
77
|
on: (event: "upgrade", listener: (request: IncomingMessage, socket: Socket, head: Buffer) => void) => unknown;
|
|
105
78
|
}): void;
|
|
@@ -12,9 +12,6 @@ export interface RuntimeTokenRequestResult {
|
|
|
12
12
|
updated?: boolean;
|
|
13
13
|
error?: string;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
* 主流程:MCP Node token 必须通过 /runtime/binding/claim-agent 从启动绑定领取。
|
|
17
|
-
* 不再返回 bridge/user/server scoped runtime token,避免 MCP Node 降级使用旧 bridge 级凭据。
|
|
18
|
-
*/
|
|
15
|
+
|
|
19
16
|
export declare function resolveRuntimeTokenRequest(input: RuntimeTokenRequestInput): RuntimeTokenRequestResult;
|
|
20
17
|
export declare function logRuntimeBindingStartupState(): void;
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* 会话管理 API 路由
|
|
3
|
-
*
|
|
4
|
-
* 提供 SDK Agent 会话的查询和恢复功能
|
|
5
|
-
*/
|
|
1
|
+
|
|
6
2
|
export declare const sessionsRouter: import("express-serve-static-core").Router;
|
|
7
|
-
|
|
8
|
-
* 解析 active SDK 会话快照状态。
|
|
9
|
-
* 主流程:优先使用 adapter 细粒度状态,其次使用 terminal 路由内存里的最近 runtimeStatus,最后兼容旧会话回退 running。
|
|
10
|
-
*/
|
|
3
|
+
|
|
11
4
|
export declare function resolveActiveSdkSessionSnapshotStatus(adapterStatus?: string, currentRuntimeStatus?: string, currentRuntimeActionType?: string): string;
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Sub Agent HTTP 路由
|
|
3
|
-
*
|
|
4
|
-
* 提供/dashboard 直连 bridge 拉取 sub-agent 数据的接口:
|
|
5
|
-
* GET /runtime/sub-agents/:agentId 列表(含历史)
|
|
6
|
-
* GET /runtime/sub-agents/:agentId/:subId 单个详情
|
|
7
|
-
* GET /runtime/sub-agents/:agentId/:subId/events SSE 实时事件流
|
|
8
|
-
* POST /runtime/sub-agents/:agentId/:subId/abort 取消运行中的 sub-agent
|
|
9
|
-
*
|
|
10
|
-
* 设计与 acode-todos.ts 同构:validateToken 鉴权,agentId 路径隔离。
|
|
11
|
-
* 数据源:SubAgentStore(持久化历史) + SubAgentManager(运行中实时状态)。
|
|
12
|
-
*/
|
|
1
|
+
|
|
13
2
|
export declare const subAgentsRouter: import("express-serve-static-core").Router;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* 终端 API 路由
|
|
3
|
-
*
|
|
4
|
-
* 提供 SDK Agent 会话的启动、输入、调整大小和停止功能
|
|
5
|
-
* 终端 UI 仅作为 SDK Agent 的消息输入/状态输出载体
|
|
6
|
-
*/
|
|
1
|
+
|
|
7
2
|
import { TextDecoder } from "node:util";
|
|
8
3
|
import { type AdapterSessionConfig, type ProviderEvent, type RuntimeStatusActionInfo } from "../adapter/index.js";
|
|
9
4
|
import { type RuntimeOutputMetadata } from "../services/session-output.js";
|
|
@@ -23,13 +18,7 @@ export interface SdkSessionEntry {
|
|
|
23
18
|
currentRuntimeActionLabel?: string;
|
|
24
19
|
currentRuntimeActionDetail?: string;
|
|
25
20
|
currentRuntimeActionInput?: string;
|
|
26
|
-
|
|
27
|
-
* runtime_capabilities 事件的 actionDetail 缓存。
|
|
28
|
-
* 修复时序竞争条件:session 启动时 "starting" 状态变更与 runtime_capabilities
|
|
29
|
-
* 几乎同时发送到服务端,若 capabilities POST 先到达且 runtime_session_id 尚未更新,
|
|
30
|
-
* 服务端会视为过期会话直接丢弃。缓存此值后,在 session 稳定到 waiting_input 时重发,
|
|
31
|
-
* 确保能力清单最终送达前端。
|
|
32
|
-
*/
|
|
21
|
+
|
|
33
22
|
cachedCapabilitiesActionDetail?: string;
|
|
34
23
|
}
|
|
35
24
|
export declare const sdkSessions: Map<string, SdkSessionEntry>;
|
|
@@ -45,15 +34,9 @@ export type RuntimeContextResetSupport = {
|
|
|
45
34
|
error: string;
|
|
46
35
|
};
|
|
47
36
|
export declare function resolveRuntimeContextResetSupport(providerId: string, hasResetContext: boolean): RuntimeContextResetSupport;
|
|
48
|
-
|
|
49
|
-
* Decide whether SDK startup should wait for an external process PID.
|
|
50
|
-
* Main flow: in-process providers return immediately; external CLI providers keep PID probing for orphan cleanup.
|
|
51
|
-
*/
|
|
37
|
+
|
|
52
38
|
export declare function shouldProbeSdkProcessPid(providerId: string): boolean;
|
|
53
|
-
|
|
54
|
-
* 主流程:解析 runtime stop 请求的状态通知选项。
|
|
55
|
-
* 内部上下文重置可抑制 stopped 广播;普通手动停止默认继续通知调度端。
|
|
56
|
-
*/
|
|
39
|
+
|
|
57
40
|
export declare function parseRuntimeStopOptions(body: unknown): RuntimeStopOptions;
|
|
58
41
|
export declare function resolveStatusChangeUsage(actionInfo?: RuntimeStatusActionInfo): {
|
|
59
42
|
inputTokens: number;
|
|
@@ -71,88 +54,46 @@ export declare function buildAcodeCommandOutputPath(agentId: string, now?: Date)
|
|
|
71
54
|
export declare function countTerminalOutputLines(output: string): number;
|
|
72
55
|
export declare function formatCommandOutputSpilloverNotice(outputPath: string, lineLimit?: number): string;
|
|
73
56
|
export declare function formatCommandInactivityTimeoutNotice(timeoutMs?: number): string;
|
|
74
|
-
|
|
75
|
-
* 标准化终端输入:将前端回车符还原为 shell 可执行命令文本。
|
|
76
|
-
*/
|
|
57
|
+
|
|
77
58
|
export declare function normalizeTerminalCommandInput(value: unknown): string;
|
|
78
|
-
|
|
79
|
-
* 解析终端命令输出解码编码。
|
|
80
|
-
* 主流程:优先使用环境变量覆盖 -> Windows 默认 GB18030 -> 其他平台默认 UTF-8。
|
|
81
|
-
*/
|
|
59
|
+
|
|
82
60
|
export declare function resolveTerminalOutputEncoding(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): string;
|
|
83
|
-
|
|
84
|
-
* 终端输出解码器接口。
|
|
85
|
-
*/
|
|
61
|
+
|
|
86
62
|
interface TerminalOutputDecoder {
|
|
87
63
|
decode(chunk?: Uint8Array | ArrayBuffer | null, options?: {
|
|
88
64
|
stream?: boolean;
|
|
89
65
|
}): string;
|
|
90
66
|
}
|
|
91
|
-
|
|
92
|
-
* 创建终端输出流式解码器,避免多字节中文被 chunk 边界截断。
|
|
93
|
-
*
|
|
94
|
-
* 主流程:环境变量显式指定非 utf-8 时固定编码 → 否则自动检测
|
|
95
|
-
* (先 UTF-8,遇替换字符回退 GB18030,覆盖不同程序的不同编码)。
|
|
96
|
-
*/
|
|
67
|
+
|
|
97
68
|
export declare function createTerminalOutputDecoder(encoding?: string): TerminalOutputDecoder;
|
|
98
|
-
|
|
99
|
-
* 解码终端输出 chunk;end=true 时刷新解码器内部剩余字节。
|
|
100
|
-
*/
|
|
69
|
+
|
|
101
70
|
export declare function decodeTerminalOutputChunk(decoder: TerminalOutputDecoder | TextDecoder, chunk?: Buffer, end?: boolean): string;
|
|
102
|
-
|
|
103
|
-
* 解析 cd 命令目标;返回 undefined 表示不是目录切换命令,null 表示仅查看当前目录。
|
|
104
|
-
*/
|
|
71
|
+
|
|
105
72
|
export declare function parseTerminalDirectoryChangeTarget(command: string): string | null | undefined;
|
|
106
|
-
|
|
107
|
-
* 解析 SDK 会话对外展示状态。
|
|
108
|
-
* 主流程:优先使用 adapter 当前细粒度状态,其次使用路由内存记录的最近状态,最后才兼容旧会话回退 running。
|
|
109
|
-
*/
|
|
73
|
+
|
|
110
74
|
export declare function resolveSdkSessionDisplayStatus(adapterStatus?: string, currentRuntimeStatus?: string, currentRuntimeActionType?: string): string;
|
|
111
75
|
export interface PersistedSessionReuseDecision {
|
|
112
76
|
reusable: boolean;
|
|
113
77
|
reason: "active-pid" | "missing-pid" | "dead-pid" | "in-process-provider";
|
|
114
78
|
}
|
|
115
|
-
|
|
116
|
-
* Decide whether a persisted SDK session can be reused for a start request.
|
|
117
|
-
* Main flow: require a live PID, then reject in-process providers whose adapter control channel cannot be restored.
|
|
118
|
-
*/
|
|
79
|
+
|
|
119
80
|
export declare function evaluatePersistedSessionReuse(session: Pick<PersistedSession, "pid"> & Partial<Pick<PersistedSession, "command">>, isPidRunning?: (pid: number) => boolean): PersistedSessionReuseDecision;
|
|
120
|
-
|
|
121
|
-
* 根据 agentId 清理 SDK 会话的所有内存状态。
|
|
122
|
-
*
|
|
123
|
-
* 用于强制停止(force-kill)场景:当进程已被外部/强制手段终止后,
|
|
124
|
-
* 此函数清理 bridge 内部的内存残留(sdkSessions、statusRefreshTimers、
|
|
125
|
-
* startingAgents、terminalCommandStates),防止下次启动时
|
|
126
|
-
* findActiveSdkSessionByAgentId 命中旧条目导致「无法上线」。
|
|
127
|
-
*
|
|
128
|
-
* @param agentId - 要清理的 Agent ID
|
|
129
|
-
* @returns 如果找到并清理了会话则返回 sessionId,否则返回 undefined
|
|
130
|
-
*/
|
|
81
|
+
|
|
131
82
|
export declare function cleanupSdkSessionByAgentId(agentId: string): string | undefined;
|
|
132
|
-
|
|
133
|
-
* 生成显示在终端输出流中的工作目录提示符。
|
|
134
|
-
*/
|
|
83
|
+
|
|
135
84
|
export declare function formatTerminalPrompt(currentDirectory: string): string;
|
|
136
85
|
export declare function buildRuntimeEnv(agentId: string, workspacePath: string | undefined, baseEnv: NodeJS.ProcessEnv, envOverrides?: Record<string, unknown>): Record<string, string>;
|
|
137
|
-
|
|
138
|
-
* 主流程:SDK 模式输入若只是 mini-term 剪贴板临时文件路径,则展开为文件内容再发给模型。
|
|
139
|
-
* 具体实现:只处理整串匹配的绝对临时 paste 文件路径,避免影响显式 `type "path"` 等正常命令。
|
|
140
|
-
*/
|
|
86
|
+
|
|
141
87
|
export declare function resolveSdkInputMessage(input: unknown): Promise<string>;
|
|
142
88
|
export interface ClaudeCodeLaunchConfig {
|
|
143
89
|
envOverrides: Record<string, string>;
|
|
144
90
|
model?: string;
|
|
145
91
|
}
|
|
146
|
-
|
|
147
|
-
* 主流程:将已持久化的 ClaudeCode AI 配置合并到启动配置,再让请求级覆盖保持最高优先级。
|
|
148
|
-
*/
|
|
92
|
+
|
|
149
93
|
export declare function buildClaudeCodeLaunchConfig(savedClaudeConfig: {
|
|
150
94
|
env?: Record<string, unknown>;
|
|
151
95
|
} | null | undefined, requestEnvOverrides?: Record<string, unknown>): ClaudeCodeLaunchConfig;
|
|
152
|
-
|
|
153
|
-
* 将 SDK 工具结束事件转换为时间线返回数据状态。
|
|
154
|
-
* 主流程:格式化工具结果 -> 保留 MCP 专用展示 -> 其它工具按动作类型追加到对应时间线事件。
|
|
155
|
-
*/
|
|
96
|
+
|
|
156
97
|
export declare function buildToolResultTimelineActionInfo(event: ProviderEvent): RuntimeStatusActionInfo | undefined;
|
|
157
98
|
export declare function formatSdkOutputEvent(event: ProviderEvent): string | undefined;
|
|
158
99
|
export declare function buildSdkOutputMetadata(event: ProviderEvent): RuntimeOutputMetadata;
|
|
@@ -160,22 +101,7 @@ export declare function resolveRuntimeStatusFromProviderEvent(event: ProviderEve
|
|
|
160
101
|
status: string;
|
|
161
102
|
actionInfo?: RuntimeStatusActionInfo;
|
|
162
103
|
} | undefined;
|
|
163
|
-
|
|
164
|
-
* 带超时 + 重试的 sendOutput 包装器。
|
|
165
|
-
* ★ 修复 BUG:原 raceSendOutput 超时后仅放行队列,不取消底层请求,
|
|
166
|
-
* 导致顺序错乱 + 切断合法重试。新方案:
|
|
167
|
-
* 1. AbortController 在超时时真正取消底层 axios 请求(防止迟到请求污染顺序)
|
|
168
|
-
* 2. 超时或 sendOutput 抛出非 abort 错误后重试(最多 2 次,1s/2s 退避),
|
|
169
|
-
* 覆盖瞬时网络问题 / 服务端 5xx / axios 超时等
|
|
170
|
-
* 3. 服务端按 (agentId, sessionId, seq) 幂等去重,即使超时的请求最终到达也不会重复
|
|
171
|
-
* 4. 所有重试失败后 resolve(不 reject),放行队列下一条
|
|
172
|
-
* 5. 成功路径必须 clearTimeout,否则 30s 后 timeout promise reject 无人 await,
|
|
173
|
-
* 触发 unhandledRejection 导致进程崩溃
|
|
174
|
-
*
|
|
175
|
-
* @param factory - 接收 AbortSignal,返回 sendOutput Promise(每次重试创建新请求)
|
|
176
|
-
* @param timeoutMs - 单次请求超时
|
|
177
|
-
* @param maxRetries - 最大重试次数(不含首次)
|
|
178
|
-
*/
|
|
104
|
+
|
|
179
105
|
export declare function raceSendOutputWithRetry(factory: (signal: AbortSignal) => Promise<void>, timeoutMs?: number, maxRetries?: number): Promise<void>;
|
|
180
106
|
export declare function resolveSdkProviderId(command?: string): string;
|
|
181
107
|
export {};
|
package/dist/routes/yml.d.ts
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* 获取 ACode 入口文件路径。
|
|
3
|
-
* 本地开发模式:直接使用项目下 package/acode/dist/index.js(修改即生效,无需复制)。
|
|
4
|
-
* 部署模式:~/.aws-bridge/acode/dist/index.js。
|
|
5
|
-
*/
|
|
1
|
+
|
|
6
2
|
export declare function getReleasedAcodeEntryPath(): string;
|
|
7
|
-
|
|
8
|
-
* 释放随 bridge 打包的内置 ACode runtime。
|
|
9
|
-
*
|
|
10
|
-
* 本地开发模式:直接使用项目下 package/acode/dist,跳过复制(修改源码后重新 build 即生效)。
|
|
11
|
-
* 部署模式:复制 dist 与 metadata 到 ~/.aws-bridge/acode,链接 bridge node_modules,
|
|
12
|
-
* 确保 ACode 无需安装即可被 Adapter 动态加载。
|
|
13
|
-
*/
|
|
3
|
+
|
|
14
4
|
export declare function ensureAcodePackageReleased(): string | null;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Agent 事件存储
|
|
3
|
-
*
|
|
4
|
-
* 为每个 agent 维护独立的事件环状缓冲区,支持事件追加和输出合并。
|
|
5
|
-
* scheduleEventPush 会消费 entry 进行差量推送。
|
|
6
|
-
*/
|
|
1
|
+
|
|
7
2
|
import { type RingBufferEntry } from "./ring-buffer.js";
|
|
8
3
|
export interface BridgeEventPayload {
|
|
9
4
|
readonly category: "status" | "output" | "question" | "file_changed";
|
|
@@ -30,32 +25,17 @@ export interface BridgeEventPayload {
|
|
|
30
25
|
readonly eventType?: string;
|
|
31
26
|
readonly size?: number;
|
|
32
27
|
}
|
|
33
|
-
|
|
34
|
-
* per-agent 事件存储。
|
|
35
|
-
* 每条 append/appendOrMergeOutput 调用会写入对应 agent 的环状缓冲区,
|
|
36
|
-
* 并返回 RingBufferEntry 供 scheduleEventPush 消费。
|
|
37
|
-
*/
|
|
28
|
+
|
|
38
29
|
declare class AgentEventStore {
|
|
39
30
|
private readonly agents;
|
|
40
31
|
private ensureBuffer;
|
|
41
|
-
|
|
42
|
-
* 追加一条事件到指定 agent 的缓冲区。
|
|
43
|
-
* @returns 新创建的条目
|
|
44
|
-
*/
|
|
32
|
+
|
|
45
33
|
append(agentId: string, payload: BridgeEventPayload): RingBufferEntry<BridgeEventPayload>;
|
|
46
|
-
|
|
47
|
-
* 追加一条 output 事件到指定 agent 的缓冲区。
|
|
48
|
-
* 若最后一条也是 output 且来自同一 session + sourceEventType,
|
|
49
|
-
* 则在 10s 窗口内合并内容。
|
|
50
|
-
* ★ 修复 BUG:合并到 8000 上限后开新条目,而不是无脑截断头部丢内容。
|
|
51
|
-
* @returns 被合并或新创建的条目
|
|
52
|
-
*/
|
|
34
|
+
|
|
53
35
|
appendOrMergeOutput(agentId: string, payload: BridgeEventPayload): RingBufferEntry<BridgeEventPayload>;
|
|
54
|
-
|
|
55
|
-
* 获取指定 agent 的事件数量。
|
|
56
|
-
*/
|
|
36
|
+
|
|
57
37
|
size(agentId: string): number;
|
|
58
38
|
}
|
|
59
|
-
|
|
39
|
+
|
|
60
40
|
export declare const agentEventStore: AgentEventStore;
|
|
61
41
|
export {};
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
* Agent Process Manager
|
|
3
|
-
*
|
|
4
|
-
* Core lifecycle manager for agent processes on the bridge machine.
|
|
5
|
-
* Provides comprehensive process management including creation, discovery,
|
|
6
|
-
* monitoring, termination, and orphan reclamation capabilities.
|
|
7
|
-
*/
|
|
1
|
+
|
|
8
2
|
import { type ProcessRecord, type ProcessState, type HealthStatus } from './process-registry.js';
|
|
9
3
|
import { type ProcessInfo, type ProcessHealthStatus } from './process-detector.js';
|
|
10
|
-
|
|
11
|
-
* Process configuration for starting a new agent process
|
|
12
|
-
*/
|
|
4
|
+
|
|
13
5
|
export interface ProcessConfig {
|
|
14
6
|
agentId: string;
|
|
15
7
|
sessionId: string;
|
|
@@ -18,16 +10,12 @@ export interface ProcessConfig {
|
|
|
18
10
|
workspacePath: string;
|
|
19
11
|
command: string;
|
|
20
12
|
}
|
|
21
|
-
|
|
22
|
-
* Discovered process with management status
|
|
23
|
-
*/
|
|
13
|
+
|
|
24
14
|
export interface DiscoveredProcess extends ProcessInfo {
|
|
25
15
|
managementStatus: 'managed' | 'orphan' | 'unknown';
|
|
26
16
|
sessionId?: string;
|
|
27
17
|
}
|
|
28
|
-
|
|
29
|
-
* Termination result with escalation level details
|
|
30
|
-
*/
|
|
18
|
+
|
|
31
19
|
export interface TerminationResult {
|
|
32
20
|
success: boolean;
|
|
33
21
|
agentId: string;
|
|
@@ -37,164 +25,55 @@ export interface TerminationResult {
|
|
|
37
25
|
failed: number;
|
|
38
26
|
message: string;
|
|
39
27
|
}
|
|
40
|
-
|
|
41
|
-
* Reclamation result
|
|
42
|
-
*/
|
|
28
|
+
|
|
43
29
|
export interface ReclamationResult {
|
|
44
30
|
success: boolean;
|
|
45
31
|
pid: number;
|
|
46
32
|
action: 'adopted' | 'terminated' | 'failed';
|
|
47
33
|
}
|
|
48
|
-
|
|
49
|
-
* Agent Process Manager
|
|
50
|
-
*
|
|
51
|
-
* Manages the complete lifecycle of agent processes including:
|
|
52
|
-
* - Creation: Register and verify new processes
|
|
53
|
-
* - Discovery: Scan for managed, orphan, and unknown processes
|
|
54
|
-
* - Monitoring: Health checks and heartbeat tracking
|
|
55
|
-
* - Termination: Graceful stop with escalation strategy
|
|
56
|
-
* - Orphan Reclamation: Adopt or terminate orphan processes
|
|
57
|
-
*/
|
|
34
|
+
|
|
58
35
|
export declare class AgentProcessManager {
|
|
59
36
|
private static instance;
|
|
60
37
|
private readonly registry;
|
|
61
|
-
|
|
62
|
-
* Private constructor - use getAgentProcessManager() for singleton access
|
|
63
|
-
*/
|
|
38
|
+
|
|
64
39
|
private constructor();
|
|
65
|
-
|
|
66
|
-
* Get the singleton instance
|
|
67
|
-
*/
|
|
40
|
+
|
|
68
41
|
static getInstance(): AgentProcessManager;
|
|
69
|
-
|
|
70
|
-
* Start a new process and register it in the process registry
|
|
71
|
-
*
|
|
72
|
-
* Flow:
|
|
73
|
-
* 1. Register process with state='creating'
|
|
74
|
-
* 2. Verify it's running
|
|
75
|
-
* 3. Update state to 'running'
|
|
76
|
-
*
|
|
77
|
-
* @param config - Process configuration
|
|
78
|
-
* @throws Error if process registration fails or process is not running
|
|
79
|
-
*/
|
|
42
|
+
|
|
80
43
|
startProcess(config: ProcessConfig): Promise<void>;
|
|
81
|
-
|
|
82
|
-
* Discover all agent processes on the system
|
|
83
|
-
*
|
|
84
|
-
* Scans OS for all agent processes, compares with registry, and returns
|
|
85
|
-
* a list of discovered processes with their management status.
|
|
86
|
-
*
|
|
87
|
-
* @returns Array of discovered processes with management status
|
|
88
|
-
*/
|
|
44
|
+
|
|
89
45
|
discoverAllProcesses(): Promise<DiscoveredProcess[]>;
|
|
90
|
-
|
|
91
|
-
* Check health of all registered processes
|
|
92
|
-
*
|
|
93
|
-
* Updates heartbeat and health status in registry for each managed process.
|
|
94
|
-
*
|
|
95
|
-
* @returns Map of agentId to health status
|
|
96
|
-
*/
|
|
46
|
+
|
|
97
47
|
healthCheckAll(): Promise<Map<string, ProcessHealthStatus>>;
|
|
98
|
-
|
|
99
|
-
* Check health of a single process
|
|
100
|
-
*
|
|
101
|
-
* @param agentId - Agent ID to check
|
|
102
|
-
* @returns Health status of the process
|
|
103
|
-
*/
|
|
48
|
+
|
|
104
49
|
healthCheck(agentId: string): Promise<ProcessHealthStatus>;
|
|
105
|
-
|
|
106
|
-
* Stop a process with graceful escalation strategy
|
|
107
|
-
*
|
|
108
|
-
* Escalation levels:
|
|
109
|
-
* Level 1: SIGTERM → wait 3s
|
|
110
|
-
* Level 2: taskkill /T /F (Win) or kill -9 (Unix) → wait 3s
|
|
111
|
-
* Level 3: terminateProcessTree → wait 5s
|
|
112
|
-
* Level 4: mark as "unstoppable", return failure
|
|
113
|
-
*
|
|
114
|
-
* @param agentId - Agent ID to stop
|
|
115
|
-
* @returns Termination result with details
|
|
116
|
-
*/
|
|
50
|
+
|
|
117
51
|
stopProcess(agentId: string): Promise<TerminationResult>;
|
|
118
|
-
|
|
119
|
-
* Send SIGTERM to a process
|
|
120
|
-
*/
|
|
52
|
+
|
|
121
53
|
private sendSigterm;
|
|
122
|
-
|
|
123
|
-
* Send force kill (SIGKILL on Unix, taskkill /F on Windows)
|
|
124
|
-
*/
|
|
54
|
+
|
|
125
55
|
private sendForceKill;
|
|
126
|
-
|
|
127
|
-
* Force kill a process immediately using terminateProcessTree
|
|
128
|
-
*
|
|
129
|
-
* This bypasses the graceful escalation and uses the most aggressive
|
|
130
|
-
* termination method immediately.
|
|
131
|
-
*
|
|
132
|
-
* @param agentId - Agent ID to force kill
|
|
133
|
-
* @returns Termination result
|
|
134
|
-
*/
|
|
56
|
+
|
|
135
57
|
forceKill(agentId: string): Promise<TerminationResult>;
|
|
136
|
-
|
|
137
|
-
* Reclaim an orphan process by agentId
|
|
138
|
-
*
|
|
139
|
-
* Finds an orphan process by agentId, and either:
|
|
140
|
-
* - Adopts it into the registry (if found and not managed)
|
|
141
|
-
* - Terminates it (if adoption fails or process is problematic)
|
|
142
|
-
*
|
|
143
|
-
* @param agentId - Agent ID to find and reclaim
|
|
144
|
-
* @returns Reclamation result
|
|
145
|
-
*/
|
|
58
|
+
|
|
146
59
|
reclaimOrphan(agentId: string): Promise<ReclamationResult>;
|
|
147
|
-
|
|
148
|
-
* Scan all orphans and attempt to reclaim each
|
|
149
|
-
*
|
|
150
|
-
* @returns Array of reclamation results
|
|
151
|
-
*/
|
|
60
|
+
|
|
152
61
|
scanAndReclaimAll(): Promise<Array<{
|
|
153
62
|
agentId: string;
|
|
154
63
|
pid: number;
|
|
155
64
|
action: string;
|
|
156
65
|
}>>;
|
|
157
|
-
|
|
158
|
-
* Mark a process as orphaned in the registry
|
|
159
|
-
*
|
|
160
|
-
* @param agentId - Agent ID to mark
|
|
161
|
-
* @returns Whether the operation succeeded
|
|
162
|
-
*/
|
|
66
|
+
|
|
163
67
|
markOrphaned(agentId: string): Promise<boolean>;
|
|
164
|
-
|
|
165
|
-
* Check if a process is managed
|
|
166
|
-
*
|
|
167
|
-
* @param agentId - Agent ID to check
|
|
168
|
-
* @returns Whether the process is managed
|
|
169
|
-
*/
|
|
68
|
+
|
|
170
69
|
isManaged(agentId: string): boolean;
|
|
171
|
-
|
|
172
|
-
* Get all managed processes
|
|
173
|
-
*
|
|
174
|
-
* @returns Array of all managed process records
|
|
175
|
-
*/
|
|
70
|
+
|
|
176
71
|
getAllManagedProcesses(): ProcessRecord[];
|
|
177
|
-
|
|
178
|
-
* Get managed processes by state
|
|
179
|
-
*
|
|
180
|
-
* @param state - Process state to filter by
|
|
181
|
-
* @returns Array of process records matching the state
|
|
182
|
-
*/
|
|
72
|
+
|
|
183
73
|
getManagedProcessesByState(state: ProcessState): ProcessRecord[];
|
|
184
|
-
|
|
185
|
-
* Find processes running on the machine that are NOT in registry
|
|
186
|
-
*
|
|
187
|
-
* @returns Array of unmanaged process info
|
|
188
|
-
*/
|
|
74
|
+
|
|
189
75
|
getUnmanagedProcesses(): Promise<ProcessInfo[]>;
|
|
190
|
-
|
|
191
|
-
* Rebuild the process registry from persisted sessions (e.g. on startup)
|
|
192
|
-
*
|
|
193
|
-
* Scans all persisted sessions, checks which processes are still running,
|
|
194
|
-
* and registers them with appropriate state.
|
|
195
|
-
*
|
|
196
|
-
* @param sessions - Array of persisted session data
|
|
197
|
-
*/
|
|
76
|
+
|
|
198
77
|
rebuildRegistry(sessions: Array<{
|
|
199
78
|
agentId: string;
|
|
200
79
|
sessionId: string;
|
|
@@ -203,50 +82,17 @@ export declare class AgentProcessManager {
|
|
|
203
82
|
command?: string;
|
|
204
83
|
mode?: 'sdk';
|
|
205
84
|
}>): Promise<void>;
|
|
206
|
-
|
|
207
|
-
* Get process statistics
|
|
208
|
-
*
|
|
209
|
-
* @returns Statistics for all managed processes
|
|
210
|
-
*/
|
|
85
|
+
|
|
211
86
|
getStats(): Record<ProcessState | 'total', number>;
|
|
212
|
-
|
|
213
|
-
* Clean up stale registry entries
|
|
214
|
-
*
|
|
215
|
-
* Removes records where:
|
|
216
|
-
* - state is 'terminated' or 'unknown'
|
|
217
|
-
* - the process is no longer running
|
|
218
|
-
*
|
|
219
|
-
* This prevents dead entries from accumulating and inflating counts.
|
|
220
|
-
*
|
|
221
|
-
* @returns Number of entries removed
|
|
222
|
-
*/
|
|
87
|
+
|
|
223
88
|
cleanupStaleRegistry(): Promise<number>;
|
|
224
|
-
|
|
225
|
-
* Remove a process from registry
|
|
226
|
-
*
|
|
227
|
-
* @param agentId - Agent ID to remove
|
|
228
|
-
* @returns Whether the operation succeeded
|
|
229
|
-
*/
|
|
89
|
+
|
|
230
90
|
removeProcess(agentId: string): Promise<boolean>;
|
|
231
|
-
|
|
232
|
-
* Get a single process record
|
|
233
|
-
*
|
|
234
|
-
* @param agentId - Agent ID to get
|
|
235
|
-
* @returns Process record or undefined
|
|
236
|
-
*/
|
|
91
|
+
|
|
237
92
|
getProcess(agentId: string): ProcessRecord | undefined;
|
|
238
|
-
|
|
239
|
-
* Get a process record by PID
|
|
240
|
-
*
|
|
241
|
-
* @param pid - Process ID to get
|
|
242
|
-
* @returns Process record or undefined
|
|
243
|
-
*/
|
|
93
|
+
|
|
244
94
|
getProcessByPid(pid: number): ProcessRecord | undefined;
|
|
245
95
|
}
|
|
246
|
-
|
|
247
|
-
* Get the AgentProcessManager singleton instance
|
|
248
|
-
*
|
|
249
|
-
* @returns AgentProcessManager instance
|
|
250
|
-
*/
|
|
96
|
+
|
|
251
97
|
export declare function getAgentProcessManager(): AgentProcessManager;
|
|
252
98
|
export type { ProcessRecord, ProcessState, HealthStatus, ProcessInfo, ProcessHealthStatus };
|
|
@@ -40,7 +40,5 @@ export interface AppliedAiConfigSummary {
|
|
|
40
40
|
opencode: OpenCodeConfig | null;
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
* 主流程:用当前统一 AI 配置覆盖各 Agent CLI 配置,并跳过未安装 CLI。
|
|
45
|
-
*/
|
|
43
|
+
|
|
46
44
|
export declare function applyCurrentAiConfigToInstalledTools(options: ApplyCurrentAiConfigOptions): Promise<AppliedAiConfigSummary>;
|