aws-runtime-bridge 1.9.91 → 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.
Files changed (134) hide show
  1. package/dist/adapter/AcodeSdkAdapter.d.ts +22 -126
  2. package/dist/adapter/AdapterRegistry.d.ts +10 -38
  3. package/dist/adapter/ClaudeSdkAdapter.d.ts +21 -84
  4. package/dist/adapter/CodexSdkAdapter.d.ts +2 -10
  5. package/dist/adapter/OpencodeSdkAdapter.d.ts +6 -42
  6. package/dist/adapter/acode-tool-names.d.ts +3 -12
  7. package/dist/adapter/idle-poll-loop.d.ts +4 -16
  8. package/dist/adapter/index.d.ts +1 -4
  9. package/dist/adapter/instance-ai-config-resolver.d.ts +9 -29
  10. package/dist/adapter/types.d.ts +124 -242
  11. package/dist/adapters/cc-switch/common.d.ts +4 -14
  12. package/dist/adapters/cc-switch/index.d.ts +3 -11
  13. package/dist/adapters/cc-switch/mcp-acode.d.ts +1 -7
  14. package/dist/adapters/cc-switch/mcp-claude.d.ts +1 -5
  15. package/dist/adapters/cc-switch/mcp-claudecode.d.ts +1 -5
  16. package/dist/adapters/cc-switch/mcp-codex.d.ts +1 -7
  17. package/dist/adapters/cc-switch/mcp-opencode.d.ts +3 -11
  18. package/dist/adapters/cc-switch/mcp-placeholder.d.ts +1 -5
  19. package/dist/adapters/cc-switch/skill-acode.d.ts +1 -6
  20. package/dist/adapters/cc-switch/skill-claude.d.ts +1 -5
  21. package/dist/adapters/cc-switch/skill-claudecode.d.ts +1 -5
  22. package/dist/adapters/cc-switch/skill-opencode.d.ts +1 -5
  23. package/dist/adapters/cc-switch/skill-placeholder.d.ts +1 -5
  24. package/dist/config.d.ts +39 -57
  25. package/dist/index.d.ts +1 -5
  26. package/dist/middleware/auth.d.ts +4 -22
  27. package/dist/routes/acode-todos.d.ts +1 -9
  28. package/dist/routes/dashboard.d.ts +1 -6
  29. package/dist/routes/events.d.ts +1 -5
  30. package/dist/routes/file-browser.d.ts +2 -8
  31. package/dist/routes/file-diff-rollback.d.ts +13 -41
  32. package/dist/routes/file-snapshot.d.ts +1 -8
  33. package/dist/routes/git.d.ts +18 -91
  34. package/dist/routes/instance.d.ts +4 -15
  35. package/dist/routes/processes.d.ts +1 -5
  36. package/dist/routes/properties.d.ts +1 -5
  37. package/dist/routes/pty.d.ts +9 -36
  38. package/dist/routes/runtime-binding.d.ts +1 -4
  39. package/dist/routes/sessions.d.ts +2 -9
  40. package/dist/routes/sub-agents.d.ts +1 -12
  41. package/dist/routes/task-context.d.ts +1 -6
  42. package/dist/routes/terminal.d.ts +18 -92
  43. package/dist/routes/yml.d.ts +1 -5
  44. package/dist/services/acode-package.d.ts +2 -12
  45. package/dist/services/agent-event-store.d.ts +6 -26
  46. package/dist/services/agent-process-manager.d.ts +30 -184
  47. package/dist/services/ai-source-apply.d.ts +1 -3
  48. package/dist/services/auto-register.d.ts +29 -106
  49. package/dist/services/bridge-package-publish-hooks.d.ts +5 -19
  50. package/dist/services/cc-switch-sdk.d.ts +1 -6
  51. package/dist/services/cli-commands.d.ts +12 -33
  52. package/dist/services/cli-commands.js +6 -6
  53. package/dist/services/event-delta-pusher.d.ts +5 -20
  54. package/dist/services/fileSnapshotStore.d.ts +7 -35
  55. package/dist/services/instance-ai-config-service.d.ts +4 -21
  56. package/dist/services/instance-service.d.ts +1 -10
  57. package/dist/services/instance-state.d.ts +5 -30
  58. package/dist/services/legacy-path-migration.d.ts +1 -1
  59. package/dist/services/lifecycle-state.d.ts +1 -4
  60. package/dist/services/mcp-launch-binding-queue.d.ts +2 -8
  61. package/dist/services/orphan-monitor.d.ts +20 -63
  62. package/dist/services/panel-auth.d.ts +12 -28
  63. package/dist/services/process-detector.d.ts +18 -122
  64. package/dist/services/process-registry.d.ts +30 -150
  65. package/dist/services/ring-buffer.d.ts +9 -42
  66. package/dist/services/runtime-binding.d.ts +2 -9
  67. package/dist/services/runtime-lifecycle-policy.d.ts +3 -15
  68. package/dist/services/session-output.d.ts +14 -67
  69. package/dist/services/startup-config-wizard.d.ts +3 -10
  70. package/dist/services/system-metrics.d.ts +1 -4
  71. package/dist/services/terminal-persistence.d.ts +10 -53
  72. package/dist/services/tool-installer.d.ts +6 -18
  73. package/dist/services/tunnel-client.d.ts +3 -18
  74. package/dist/services/windows-service-manager.d.ts +1 -13
  75. package/dist/services/workspace-files.d.ts +17 -57
  76. package/dist/services/workspace-watch.d.ts +2 -6
  77. package/dist/services/workspaceTaskChangeWatcher.d.ts +13 -51
  78. package/dist/types.d.ts +2 -8
  79. package/dist/utils/instance-ai-config-debug-logger.d.ts +5 -20
  80. package/dist/utils/logger.d.ts +7 -20
  81. package/dist/utils/mcp-utils.d.ts +8 -44
  82. package/dist/utils/path-utils.d.ts +3 -15
  83. package/dist/utils/sdk-package-loader.d.ts +2 -8
  84. package/dist/utils/validation.d.ts +3 -20
  85. package/dist/utils/yaml-utils.d.ts +8 -56
  86. package/node_modules/@cc-switch/sdk/dist/index.d.ts +1 -6
  87. package/node_modules/@cc-switch/sdk/dist/sdk.d.ts +11 -42
  88. package/package/acode/dist/ask-user-question-tool.d.ts +7 -20
  89. package/package/acode/dist/built-in-file-tools.d.ts +3 -6
  90. package/package/acode/dist/built-in-symbols-tool.d.ts +1 -4
  91. package/package/acode/dist/builtins/commandArtifacts.d.ts +1 -4
  92. package/package/acode/dist/builtins/shellOutputDecoder.d.ts +3 -18
  93. package/package/acode/dist/commands/commandLoader.d.ts +1 -4
  94. package/package/acode/dist/commands/commandParser.d.ts +1 -4
  95. package/package/acode/dist/compaction.d.ts +38 -175
  96. package/package/acode/dist/config.d.ts +1 -4
  97. package/package/acode/dist/fs-utils.d.ts +1 -19
  98. package/package/acode/dist/hooks/hookBus.d.ts +1 -4
  99. package/package/acode/dist/mcpToolNames.d.ts +2 -8
  100. package/package/acode/dist/parsers/ast-cache.d.ts +7 -20
  101. package/package/acode/dist/parsers/language-detector.d.ts +1 -5
  102. package/package/acode/dist/parsers/language-queries.d.ts +1 -1
  103. package/package/acode/dist/parsers/tree-sitter-loader.d.ts +4 -12
  104. package/package/acode/dist/parsers/types.d.ts +19 -30
  105. package/package/acode/dist/runtime.d.ts +47 -269
  106. package/package/acode/dist/skill-tool.d.ts +3 -23
  107. package/package/acode/dist/sub-agent-manager.d.ts +41 -206
  108. package/package/acode/dist/sub-agent-store.d.ts +12 -61
  109. package/package/acode/dist/sub-agent-tools.d.ts +9 -18
  110. package/package/acode/dist/sub-agent-types.d.ts +32 -38
  111. package/package/acode/dist/todo-store.d.ts +8 -23
  112. package/package/acode/dist/todo-tool.d.ts +2 -2
  113. package/package/acode/dist/types.d.ts +17 -38
  114. package/package/aws-client-agent-mcp/dist/agent-client.d.ts +44 -161
  115. package/package/aws-client-agent-mcp/dist/config.d.ts +4 -18
  116. package/package/aws-client-agent-mcp/dist/constants.d.ts +1 -3
  117. package/package/aws-client-agent-mcp/dist/context-manager.d.ts +25 -95
  118. package/package/aws-client-agent-mcp/dist/context-manager.test.d.ts +1 -4
  119. package/package/aws-client-agent-mcp/dist/http-client.d.ts +15 -56
  120. package/package/aws-client-agent-mcp/dist/index.d.ts +1 -11
  121. package/package/aws-client-agent-mcp/dist/logger.d.ts +5 -22
  122. package/package/aws-client-agent-mcp/dist/mcp-server.d.ts +76 -365
  123. package/package/aws-client-agent-mcp/dist/mcp-tools.d.ts +21 -83
  124. package/package/aws-client-agent-mcp/dist/memory-store.d.ts +15 -70
  125. package/package/aws-client-agent-mcp/dist/memory-tools.d.ts +4 -17
  126. package/package/aws-client-agent-mcp/dist/message-buffer.d.ts +23 -92
  127. package/package/aws-client-agent-mcp/dist/messageContent.d.ts +5 -29
  128. package/package/aws-client-agent-mcp/dist/server-memory-store.d.ts +2 -9
  129. package/package/aws-client-agent-mcp/dist/status-reporter.d.ts +17 -55
  130. package/package/aws-client-agent-mcp/dist/types.d.ts +66 -125
  131. package/package/aws-client-agent-mcp/dist/websocket-client.d.ts +30 -125
  132. package/package/cc-switch-sdk/dist/index.d.ts +1 -6
  133. package/package/cc-switch-sdk/dist/sdk.d.ts +11 -42
  134. package/package.json +1 -1
@@ -3,11 +3,7 @@ export type RuntimeBindingState = {
3
3
  instanceId?: string;
4
4
  userId?: string;
5
5
  schedulerBaseUrl?: string;
6
- /**
7
- * Plain runtime access token issued by the scheduler.
8
- * Stored locally with 0600 permissions so child MCP processes can authenticate
9
- * scheduler calls without exposing the token in public status APIs.
10
- */
6
+
11
7
  accessToken?: string;
12
8
  tokenHash?: string;
13
9
  createdAt?: string;
@@ -40,8 +36,5 @@ export declare function saveRuntimeBinding(input: {
40
36
  schedulerBaseUrl?: string;
41
37
  }): RuntimeBindingState;
42
38
  export declare function clearRuntimeBinding(): void;
43
- /**
44
- * 将旧路径 ~/.agentswork/runtime-bridge/ 下的配置文件迁移到新路径 ~/.aws-bridge/。
45
- * 仅在旧路径存在且新路径不存在时执行,避免覆盖已有配置。
46
- */
39
+
47
40
  export declare function migrateOldBindingDir(): void;
@@ -6,21 +6,9 @@ export interface GracefulShutdownPlan {
6
6
  clearPersistedSessions: boolean;
7
7
  stopTunnelClient: boolean;
8
8
  }
9
- /**
10
- * Build shutdown side-effect policy from the requested restart mode.
11
- * Main flow: explicit bridge shutdown cleans resources; scheduler restart keeps
12
- * SDK/PTY processes and persisted metadata so the scheduler can restore state.
13
- */
9
+
14
10
  export declare function buildGracefulShutdownPlan(preserveSessions: boolean): GracefulShutdownPlan;
15
- /**
16
- * Decide whether startup may destructively clean persisted runtime sessions.
17
- * Main flow: default bridge restart is non-destructive; operators can opt into
18
- * legacy cleanup with AWS_BRIDGE_CLEAN_ORPHANS_ON_STARTUP=true.
19
- */
11
+
20
12
  export declare function shouldCleanupPersistedSessionsOnStartup(preserveSessions: boolean, env?: NodeJS.ProcessEnv): boolean;
21
- /**
22
- * Decide whether background orphan monitoring may terminate persisted sessions.
23
- * Main flow: process termination is an explicit cleanup action, not a default
24
- * monitoring behavior, so restart recovery cannot be undone by auto-clean mode.
25
- */
13
+
26
14
  export declare function shouldAutoCleanOrphanProcesses(env?: NodeJS.ProcessEnv): boolean;
@@ -1,22 +1,10 @@
1
- /**
2
- * 会话输出缓冲服务
3
- *
4
- * 管理终端会话的输出缓冲和刷新机制
5
- */
1
+
6
2
  import { type AxiosResponse } from "axios";
7
3
  import type { Session } from "../types.js";
8
4
  import { RingBuffer, type RingBufferEntry, type RingBufferSlice } from "./ring-buffer.js";
9
- /**
10
- * 桥接侧本地事件的 category 分类。
11
- * status — 状态变更事件;output — 输出增量事件;question — 询问事件;file_changed — 文件变更事件。
12
- */
5
+
13
6
  export type BridgeEventCategory = "status" | "output" | "question" | "file_changed";
14
- /**
15
- * 桥接侧 ring buffer 中存储的事件负载。
16
- *
17
- * 记录从 sendStatus / sendOutput / sendQuestionRequest / sendFileChanged
18
- * 产生的非关键时间线数据,供本地增量查询和调试面板使用。
19
- */
7
+
20
8
  export interface BridgeEventPayload {
21
9
  readonly category: BridgeEventCategory;
22
10
  readonly agentId: string;
@@ -43,14 +31,9 @@ export interface BridgeEventPayload {
43
31
  readonly size?: number;
44
32
  readonly toolCallId?: string;
45
33
  }
46
- /** RingBufferEntry 的便捷导出 */
34
+
47
35
  export type { RingBufferEntry, RingBufferSlice };
48
- /**
49
- * 全局桥接侧事件环状缓冲区。
50
- *
51
- * 容量 2000 条,适用于记录非关键状态/输出事件。
52
- * 通过 sendStatus/sendOutput 自动写入,同时保留原有的 server 回调路径。
53
- */
36
+
54
37
  export declare const bridgeEventBuffer: RingBuffer<BridgeEventPayload>;
55
38
  interface RuntimeStatusActionInfo {
56
39
  actionType?: string;
@@ -59,7 +42,7 @@ interface RuntimeStatusActionInfo {
59
42
  actionInput?: string;
60
43
  actionResult?: string;
61
44
  actionId?: string;
62
- /** 父事件 ID,用于事件父子层级(如压缩子事件关联到父压缩事件) */
45
+
63
46
  parentId?: string;
64
47
  }
65
48
  export interface RuntimeCallbackAuthOptions {
@@ -77,16 +60,9 @@ export interface RuntimeOutputMetadata {
77
60
  commandFilePath?: string;
78
61
  commandLineCount?: number;
79
62
  }
80
- /** 活跃会话存储 */
63
+
81
64
  export declare const sessions: Map<string, Session>;
82
- /**
83
- * 发送状态更新到调度器
84
- *
85
- * @param agentId - Agent ID
86
- * @param sessionId - 会话 ID
87
- * @param status - 状态
88
- * @param actionInfo - 可选的动作详情
89
- */
65
+
90
66
  export declare function sendStatus(agentId: string, sessionId: string | null, status: string, actionInfo?: RuntimeStatusActionInfo, usage?: {
91
67
  inputTokens: number;
92
68
  outputTokens: number;
@@ -95,24 +71,9 @@ export declare function sendStatus(agentId: string, sessionId: string | null, st
95
71
  inputLimit?: number;
96
72
  compactionThreshold?: number;
97
73
  }, authOptions?: RuntimeCallbackAuthOptions, timestamp?: number, sourceEventType?: string): Promise<AxiosResponse<unknown> | undefined>;
98
- /**
99
- * 发送输出到调度器
100
- *
101
- * @param agentId - Agent ID
102
- * @param output - 输出内容
103
- * @param sessionId - 会话 ID
104
- * @param seq - 序列号
105
- */
74
+
106
75
  export declare function sendOutput(agentId: string, output: string, sessionId: string, seq: number, metadata?: RuntimeOutputMetadata, authOptions?: RuntimeCallbackAuthOptions, signal?: AbortSignal): Promise<void>;
107
- /**
108
- * 发送 AskUserQuestion 事件到调度器。
109
- *
110
- * @param agentId - Agent ID
111
- * @param sessionId - SDK 会话 ID
112
- * @param questions - 结构化问题列表
113
- * @param authOptions - 运行时鉴权选项
114
- * @param toolCallId - 提问实例的唯一标识,用于前端区分同一会话内连续多次提问
115
- */
76
+
116
77
  export declare function sendQuestionRequest(agentId: string, sessionId: string, questions: unknown[], authOptions?: RuntimeCallbackAuthOptions, toolCallId?: string): Promise<void>;
117
78
  export interface RuntimeFileChangedPayload {
118
79
  bridgeBaseUrl?: string;
@@ -122,25 +83,11 @@ export interface RuntimeFileChangedPayload {
122
83
  size?: number;
123
84
  mtimeMs?: number;
124
85
  }
125
- /**
126
- * 发送工作区文件变更事件到调度器,由调度器通过 WebSocket 通知前端刷新预览。
127
- */
86
+
128
87
  export declare function sendFileChanged(payload: RuntimeFileChangedPayload): Promise<void>;
129
- /**
130
- * 追加会话输出到有界缓冲区。
131
- *
132
- * 主流程:拼接新输出 -> 超过上限时丢弃最旧终端噪声并保留截断提示 -> 等待 flush pump 批量发送。
133
- */
88
+
134
89
  export declare function appendSessionOutput(sessionId: string, data: string): void;
135
- /**
136
- * 调度输出刷新
137
- *
138
- * @param sessionId - 会话 ID
139
- */
90
+
140
91
  export declare function scheduleOutputFlush(sessionId: string): void;
141
- /**
142
- * 刷新会话输出
143
- *
144
- * @param sessionId - 会话 ID
145
- */
92
+
146
93
  export declare function flushSessionOutput(sessionId: string): Promise<void>;
@@ -10,13 +10,9 @@ interface StartupConfigFile {
10
10
  autoRegisterTargets?: AutoRegisterTargetConfig[];
11
11
  [key: string]: unknown;
12
12
  }
13
- /**
14
- * 最小配置示例模板(占位符,不含任何真实密钥)。
15
- * `awsb config example` 与向导中的「最小配置」选项都会基于它生成示例。
16
- * 注意:模板内的 value 均为 <占位符>,切勿写入真实凭据——真实值应由用户手填。
17
- */
13
+
18
14
  export declare const MINIMAL_CONFIG_TEMPLATE: StartupConfigFile;
19
- /** 将最小配置模板格式化为可读的示例文本(占位符版)。 */
15
+
20
16
  export declare function formatConfigExample(template?: object): string;
21
17
  interface PromptIO {
22
18
  question(prompt: string): Promise<string>;
@@ -32,9 +28,6 @@ interface EnsureStartupConfigOptions {
32
28
  export type StartupConfigWizardResult = "exists" | "created" | "configured" | "skipped" | "non-interactive" | "failed";
33
29
  export declare function ensureStartupConfig(options?: EnsureStartupConfigOptions): Promise<StartupConfigWizardResult>;
34
30
  export declare function configureStartupConfig(options?: EnsureStartupConfigOptions): Promise<StartupConfigWizardResult>;
35
- /**
36
- * `awsb config example`:直接打印最小配置示例(占位符版),
37
- * 并把模板写入 config.json 供用户稍后手动填值。非交互环境也能用。
38
- */
31
+
39
32
  export declare function printConfigExampleCommand(options?: EnsureStartupConfigOptions): Promise<StartupConfigWizardResult>;
40
33
  export {};
@@ -32,8 +32,5 @@ export interface SystemMetricsSnapshot {
32
32
  storage: SystemStorageMetrics;
33
33
  network: SystemNetworkMetrics;
34
34
  }
35
- /**
36
- * 汇总机器关键指标快照。
37
- * 主流程:并行采集内存/存储/网络,CPU 做短采样后合并为前端可展示结构。
38
- */
35
+
39
36
  export declare function collectSystemMetrics(): Promise<SystemMetricsSnapshot>;
@@ -1,71 +1,28 @@
1
- /**
2
- * 终端会话持久化服务
3
- *
4
- * 管理终端会话元数据的持久化存储
5
- */
1
+
6
2
  import type { PersistedSession } from '../types.js';
7
- /**
8
- * 获取持久化会话文件路径
9
- *
10
- * @returns 会话文件路径
11
- */
3
+
12
4
  export declare function getPersistedSessionsFile(): string;
13
- /**
14
- * 加载持久化的终端会话列表
15
- *
16
- * @returns 持久化会话列表
17
- */
5
+
18
6
  export declare function loadPersistedSessions(): Promise<PersistedSession[]>;
19
- /**
20
- * 保存持久化的终端会话列表
21
- *
22
- * @param sessions - 会话列表
23
- */
7
+
24
8
  export declare function savePersistedSessions(sessions: PersistedSession[]): Promise<void>;
25
- /**
26
- * 添加或更新持久化会话
27
- *
28
- * @param session - 会话数据
29
- */
9
+
30
10
  export declare function upsertPersistedSession(session: PersistedSession): Promise<void>;
31
- /**
32
- * 更新指定 Agent 的持久化自动命令配置。
33
- *
34
- * 主流程:加载 running 会话 -> 命中 agentId 时只替换自动命令字段,保留原 command/workspace/pid。
35
- */
11
+
36
12
  export declare function updatePersistedSessionAutoCommands(agentId: string, commands: {
37
13
  idleInputAutoCommand: string;
38
14
  nonInputAutoCommand: string;
39
15
  }): Promise<boolean>;
40
- /**
41
- * 更新指定 SDK 会话的细粒度运行状态。
42
- *
43
- * 主流程:命中 sessionId 后仅替换 runtimeStatus/runtimeAction* 字段,保留会话 PID、命令和工作目录,
44
- * 让 scheduler/server 重启后可以从 /runtime/sessions 恢复 Agent 卡片上的具体状态标签。
45
- */
16
+
46
17
  export declare function updatePersistedSessionRuntimeState(sessionId: string, runtimeState: {
47
18
  runtimeStatus: string;
48
19
  runtimeActionType?: string;
49
20
  runtimeActionLabel?: string;
50
21
  runtimeActionDetail?: string;
51
22
  }): Promise<boolean>;
52
- /**
53
- * 移除持久化会话(从完整文件中删除,包括 stopped 状态的)
54
- *
55
- * @param sessionId - 会话 ID
56
- */
23
+
57
24
  export declare function removePersistedSession(sessionId: string): Promise<void>;
58
- /**
59
- * 根据 agentId 查找持久化会话
60
- *
61
- * @param agentId - Agent ID
62
- * @returns 持久化会话,未找到返回 undefined
63
- */
25
+
64
26
  export declare function findPersistedSessionByAgentId(agentId: string): Promise<PersistedSession | undefined>;
65
- /**
66
- * 根据 agentId 移除持久化会话
67
- * 用于确保停止时能删除正确的持久化会话
68
- *
69
- * @param agentId - Agent ID
70
- */
27
+
71
28
  export declare function removePersistedSessionByAgentId(agentId: string): Promise<void>;
@@ -10,13 +10,9 @@ type ToolCommand = {
10
10
  };
11
11
  export declare const SUPPORTED_INSTALLABLE_TOOLS: readonly string[];
12
12
  export declare const SUPPORTED_UNINSTALLABLE_TOOLS: readonly string[];
13
- /**
14
- * 返回工具对应的全局卸载命令副本,用于诊断与测试卸载覆盖范围。
15
- */
13
+
16
14
  export declare function getToolUninstallCommands(tool: string): string[];
17
- /**
18
- * 返回工具对应的安装/卸载执行参数副本,用于验证 Windows 下不会把路径引号传给 npm。
19
- */
15
+
20
16
  export declare function getToolCommandSpecs(tool: string, phase: "install" | "uninstall"): Array<{
21
17
  command: string;
22
18
  args: string[];
@@ -32,20 +28,12 @@ export declare function buildSdkCliInstallStatus(tool: string, sdkResult: {
32
28
  executable: string | null;
33
29
  error: string | null;
34
30
  }, requiresCli: boolean): ToolInstallStatus;
35
- /**
36
- * 检查单个工具的 CLI 可执行状态,供实例状态展示与初始化前判断使用。
37
- */
31
+
38
32
  export declare function detectToolInstallStatus(tool: string): Promise<ToolInstallStatus>;
39
- /**
40
- * 批量检查工具安装状态,统一返回给前端面板和实例状态持久化。
41
- */
33
+
42
34
  export declare function detectToolStatuses(tools: string[]): Promise<Record<string, ToolInstallStatus>>;
43
- /**
44
- * 根据勾选工具自动安装缺失 CLI,安装后重新检测状态并返回。
45
- */
35
+
46
36
  export declare function ensureToolsInstalled(tools: string[]): Promise<Record<string, ToolInstallStatus>>;
47
- /**
48
- * 按工具定义执行全局卸载命令,随后重新检测并返回最新安装状态。
49
- */
37
+
50
38
  export declare function uninstallTools(tools: string[]): Promise<Record<string, ToolInstallStatus>>;
51
39
  export {};
@@ -1,20 +1,5 @@
1
- /**
2
- * Bridge 反向隧道客户端
3
- *
4
- * 当 bridge 位于 NAT/内网(无公网),server 有公网时:bridge 注册虚拟隧道地址
5
- *(形如 http(s)://server/tunnel/{instanceId}),注册成功后通过本客户端主动连出到
6
- * server 的 /ws/bridge-tunnel,server 对 bridge 的 HTTP/WebSocket 调用均经此隧道转发。
7
- *
8
- * 多 server 支持:autoRegisterTargets 配置多个 server 时,每个 server 注册成功后
9
- * 各自建立一条独立隧道,按归一化 serverUrl 为 key 并存于 tunnels Map,互不干扰;
10
- * 同一 server 重复注册(重试/token 轮换)时先拆旧隧道再以最新 instanceId 重建。
11
- *
12
- * 协议帧格式见 BridgeTunnelService(server 端)。
13
- */
14
- /**
15
- * 启动(或重启)到指定 server 的隧道。
16
- * 同一 serverUrl 已存在隧道时先拆旧重建,不同 serverUrl 的隧道并存。
17
- */
1
+
2
+
18
3
  export declare function startTunnelClient(serverUrl: string, instanceId: string): void;
19
- /** 停止全部隧道(graceful shutdown 用) */
4
+
20
5
  export declare function stopTunnelClient(): void;
@@ -1,16 +1,4 @@
1
- /**
2
- * node-windows 封装模块。
3
- *
4
- * node-windows 内部使用 WinSW(.NET 服务包装器)实现 SCM 协议适配,
5
- * 用户 `npm install -g aws-runtime-bridge` 时自动获得,无需额外安装 nssm。
6
- *
7
- * 关键行为:
8
- * - install 时在 `path.dirname(script)/daemon/` 下创建 winsw.exe + XML 配置;
9
- * - `logpath` 配置项控制日志输出目录(WinSW 生成 `<id>.out.log` / `<id>.err.log`);
10
- * - node-windows 1.0.0-beta.8 硬编码把 `id: this._exe`(即 `name + '.exe'`)写入 WinSW XML 的
11
- * `<id>`,因此注册到 SCM 的服务名是 `awsb.exe`,不是 `awsb`。调用方做 sc.exe 操作时
12
- * 必须用 `awsb.exe`,否则会报 1060(服务未安装)。
13
- */
1
+
14
2
  export interface WindowsServiceConfig {
15
3
  name: string;
16
4
  description: string;
@@ -1,7 +1,4 @@
1
- /**
2
- * 工作区文件服务
3
- * 负责在工作区范围内安全地浏览、读取与保存文件。
4
- */
1
+
5
2
  export interface WorkspaceFileItem {
6
3
  name: string;
7
4
  path: string;
@@ -161,58 +158,37 @@ export interface ChmodWorkspaceEntryResult {
161
158
  recursive: boolean;
162
159
  changedCount: number;
163
160
  }
164
- /**
165
- * 列出工作区目录内容。
166
- */
161
+
167
162
  export declare function listWorkspaceDirectory(params: WorkspacePathParams): Promise<ListWorkspaceDirectoryResult>;
168
- /**
169
- * 读取工作区中的文本文件。
170
- */
163
+
171
164
  export declare function readWorkspaceFile(params: WorkspaceFileParams): Promise<ReadWorkspaceFileResult>;
172
- /**
173
- * 读取工作区条目的属性信息。
174
- * 主流程:解析安全路径 -> 读取 stat/lstat -> 文件额外尝试解析图片尺寸。
175
- * 对于目录,stat.size 只是目录项元数据大小,需要递归统计子文件总和。
176
- */
165
+
177
166
  export declare function getWorkspaceEntryProperties(params: DeleteWorkspaceEntryParams): Promise<WorkspaceEntryPropertiesResult>;
178
- /**
179
- * 修改工作区条目权限。
180
- * 主流程:校验八进制权限 -> 解析安全路径 -> 非递归只改目标,递归目录先收集所有非符号链接子项后逐一 chmod。
181
- */
167
+
182
168
  export declare function chmodWorkspaceEntry(params: ChmodWorkspaceEntryParams): Promise<ChmodWorkspaceEntryResult>;
183
- /**
184
- * 返回工作区内 Word 文档的预览元数据;docx 由前端下载原文件后渲染,旧版 doc 明确提示不支持。
185
- */
169
+
186
170
  export declare function previewWorkspaceDocument(params: WorkspaceFileParams): Promise<WorkspaceDocumentPreviewResult>;
187
- /**
188
- * 将文本内容保存到工作区文件中。
189
- */
171
+
190
172
  export declare function writeWorkspaceFile(params: WriteWorkspaceFileParams): Promise<{
191
173
  ok: true;
192
174
  workspacePath: string;
193
175
  filePath: string;
194
176
  }>;
195
- /**
196
- * 在指定工作区目录下创建文件或目录。
197
- */
177
+
198
178
  export declare function createWorkspaceEntry(params: CreateWorkspaceEntryParams): Promise<{
199
179
  ok: true;
200
180
  workspacePath: string;
201
181
  targetPath: string;
202
182
  isDirectory: boolean;
203
183
  }>;
204
- /**
205
- * 在工作区内重命名文件或目录,保持目标仍位于原父目录中。
206
- */
184
+
207
185
  export declare function renameWorkspaceEntry(params: RenameWorkspaceEntryParams): Promise<{
208
186
  ok: true;
209
187
  workspacePath: string;
210
188
  sourcePath: string;
211
189
  targetPath: string;
212
190
  }>;
213
- /**
214
- * 将工作区内文件或目录移动到另一个工作区目录,保持原文件名不变。
215
- */
191
+
216
192
  export declare function moveWorkspaceEntry(params: MoveWorkspaceEntryParams): Promise<{
217
193
  ok: true;
218
194
  workspacePath: string;
@@ -220,17 +196,13 @@ export declare function moveWorkspaceEntry(params: MoveWorkspaceEntryParams): Pr
220
196
  targetPath: string;
221
197
  destinationPath: string;
222
198
  }>;
223
- /**
224
- * 删除工作区内的文件或目录,并阻止误删工作区根目录。
225
- */
199
+
226
200
  export declare function deleteWorkspaceEntry(params: DeleteWorkspaceEntryParams): Promise<{
227
201
  ok: true;
228
202
  workspacePath: string;
229
203
  targetPath: string;
230
204
  }>;
231
- /**
232
- * 上传文件到工作区指定目录,并可在上传后自动解压常见归档。
233
- */
205
+
234
206
  export declare function uploadWorkspaceFiles(params: UploadWorkspaceFilesParams): Promise<{
235
207
  ok: true;
236
208
  workspacePath: string;
@@ -242,26 +214,14 @@ export declare function uploadWorkspaceFiles(params: UploadWorkspaceFilesParams)
242
214
  extracted?: WorkspaceArchiveExtractResult;
243
215
  }>;
244
216
  }>;
245
- /**
246
- * 解析工作区下载目标;目录由路由层打包为 zip,文件直接流式下载。
247
- */
217
+
248
218
  export declare function resolveWorkspaceDownloadTarget(params: DownloadWorkspaceEntryParams): Promise<WorkspaceDownloadTarget>;
249
- /**
250
- * 将目录内容以 zip 格式写入输出流,避免在磁盘生成临时包。
251
- */
219
+
252
220
  export declare function streamWorkspaceDirectoryZip(directoryPath: string, output: NodeJS.WritableStream): Promise<void>;
253
- /**
254
- * 解压工作区中的归档文件到指定目录,支持 zip、tar、tar.gz/tgz 与单文件 gz。
255
- */
221
+
256
222
  export declare function extractWorkspaceArchive(params: ExtractWorkspaceArchiveParams): Promise<WorkspaceArchiveExtractResult>;
257
- /**
258
- * 在工作区范围内搜索文件内容。
259
- * 主流程:安全解析工作区根 -> 递归遍历目录 -> 按文件掩码过滤 -> 逐行匹配关键词 -> 返回匹配列表。
260
- */
223
+
261
224
  export declare function searchWorkspaceFiles(params: SearchWorkspaceFilesParams): Promise<SearchWorkspaceFilesResult>;
262
- /**
263
- * 在工作区范围内批量替换文件内容。
264
- * 可指定 filePath 只替换单个文件;未指定时递归替换所有匹配掩码的文件。
265
- */
225
+
266
226
  export declare function replaceWorkspaceFiles(params: ReplaceWorkspaceFilesParams): Promise<ReplaceWorkspaceFilesResult>;
267
227
  export {};
@@ -2,17 +2,13 @@ interface WorkspaceFileWatchParams {
2
2
  workspacePath: string;
3
3
  filePath: string;
4
4
  }
5
- /**
6
- * 开始监听工作区内单个文件,重复监听同一文件会复用已有 watcher。
7
- */
5
+
8
6
  export declare function watchWorkspaceFile(params: WorkspaceFileWatchParams): Promise<{
9
7
  ok: true;
10
8
  workspacePath: string;
11
9
  filePath: string;
12
10
  }>;
13
- /**
14
- * 停止监听工作区内单个文件;未监听时保持幂等。
15
- */
11
+
16
12
  export declare function unwatchWorkspaceFile(params: WorkspaceFileWatchParams): Promise<{
17
13
  ok: true;
18
14
  }>;
@@ -1,14 +1,4 @@
1
- /**
2
- * 工作区文件变更精确记录服务
3
- *
4
- * **仅通过 Agent 文件操作工具拦截记录变更**(write_file/edit_file/delete_file),
5
- * 不再使用 fs.watch 全量监听(无法区分 Agent 修改与用户手动修改)。
6
- *
7
- * - recordAgentFileChange() 由工具 execute 成功后直接调用
8
- * - 变更内容(diff/beforeContent)持久化到 bridge 本地 .agentswork/change-cache
9
- * - 变更元数据 + cacheKey 通过 HTTP 上报到 mcp-server
10
- * - 差异回滚时从数据库读取记录、从 bridge 缓存读取 diff
11
- */
1
+
12
2
  export interface TaskContext {
13
3
  agentId: string;
14
4
  taskInstanceId: string;
@@ -27,57 +17,29 @@ export interface FileChangeRecord {
27
17
  afterHash: string | null;
28
18
  timestamp: string;
29
19
  }
30
- /**
31
- * 设置当前活跃任务上下文。
32
- * 调用时机:Agent 通过 startTaskNode 开始处理任务节点时,由 server 回调通知。
33
- */
20
+
34
21
  export declare function setTaskContext(ctx: TaskContext): void;
35
- /**
36
- * 清除当前任务上下文。
37
- * 调用时机:Agent 提交任务结果后,或任务被中断/取消时。
38
- */
22
+
39
23
  export declare function clearTaskContext(): void;
40
- /**
41
- * 获取当前活跃任务上下文。
42
- */
24
+
43
25
  export declare function getTaskContext(): TaskContext | null;
44
- /**
45
- * 检查是否有活跃任务上下文。
46
- */
26
+
47
27
  export declare function hasActiveTask(): boolean;
48
- /**
49
- * 设置工作区路径(不再启动 fs.watch,仅记录路径供工具拦截上报使用)。
50
- * 如果已有活跃的 watcher 则会先关闭。
51
- */
28
+
52
29
  export declare function startWatching(targetWorkspacePath: string): Promise<void>;
53
- /**
54
- * 停止工作区监听(清理状态)。
55
- */
30
+
56
31
  export declare function stopWatching(): Promise<void>;
57
- /**
58
- * 从 bridge 本地缓存读取变更前的文件内容(供 DELETE 回滚使用)。
59
- */
32
+
60
33
  export declare function readBeforeContentFromCache(workspacePath: string, cacheKey: string): Promise<string | null>;
61
- /**
62
- * 从 bridge 本地缓存读取 diff patch(供 UPDATE 精确回滚使用)。
63
- */
34
+
64
35
  export declare function readDiffFromCache(workspacePath: string, cacheKey: string): Promise<string | null>;
65
- /**
66
- * 获取正在监控的文件变更数量(用于测试)。
67
- */
36
+
68
37
  export declare function getPendingChangeCountForTest(): number;
69
- /**
70
- * 判断工作区是否正在被监听。
71
- */
38
+
72
39
  export declare function isWatching(): boolean;
73
- /**
74
- * 获取当前工作区路径。
75
- */
40
+
76
41
  export declare function getWorkspaceRoot(): string;
77
- /**
78
- * 由 Agent 文件操作工具直接调用,精确记录变更并上报。
79
- * 仅在工具 execute 成功后调用,确保记录的都是实际发生的变更。
80
- */
42
+
81
43
  export declare function recordAgentFileChange(record: {
82
44
  filePath: string;
83
45
  operation: 'CREATE' | 'UPDATE' | 'DELETE';
package/dist/types.d.ts CHANGED
@@ -1,20 +1,14 @@
1
1
  import type { AppFlags } from '@cc-switch/sdk';
2
2
  import type { Request, Response, NextFunction } from 'express';
3
3
  export type { McpServerSpec, AppFlags } from '@cc-switch/sdk';
4
- /**
5
- * MCP 服务器创建输入类型
6
- * 用于 createMcpServer 方法的参数
7
- */
4
+
8
5
  export interface CreateMcpServerInput {
9
6
  name: string;
10
7
  server: import('@cc-switch/sdk').McpServerSpec;
11
8
  description?: string;
12
9
  apps?: Partial<AppFlags>;
13
10
  }
14
- /**
15
- * MCP 服务器更新输入类型
16
- * 用于 updateMcpServer 方法的参数
17
- */
11
+
18
12
  export interface UpdateMcpServerInput {
19
13
  name?: string;
20
14
  server?: import('@cc-switch/sdk').McpServerSpec;
@@ -1,9 +1,4 @@
1
- /**
2
- * Instance AI 配置调试日志记录器
3
- *
4
- * 将 AI 配置解析/应用过程写入固定日志文件,
5
- * 供 bridge + 后端共享调试。
6
- */
1
+
7
2
  export interface DebugLogEntry {
8
3
  level: "info" | "warn" | "error";
9
4
  category: string;
@@ -13,24 +8,14 @@ export interface DebugLogEntry {
13
8
  agentId?: string;
14
9
  details?: Record<string, unknown>;
15
10
  }
16
- /**
17
- * 调试日志记录器。
18
- * 所有日志异步追加到固定文件,不阻塞主流程。
19
- */
11
+
20
12
  export declare class InstanceAiConfigDebugLogger {
21
13
  private readonly logPath;
22
14
  constructor(logPath?: string);
23
- /**
24
- * 写入一条调试日志。
25
- * 格式:ISO时间 | level | 消息
26
- */
15
+
27
16
  log(entry: DebugLogEntry): Promise<void>;
28
- /**
29
- * 刷新日志(当前实现为无操作,追加写入天然实时落盘)。
30
- */
17
+
31
18
  flush(): Promise<void>;
32
19
  }
33
- /**
34
- * 获取全局单例的调试日志记录器。
35
- */
20
+
36
21
  export declare function getInstanceAiConfigDebugLogger(): InstanceAiConfigDebugLogger;