aws-runtime-bridge 1.9.172 → 1.9.179

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 (383) hide show
  1. package/CHANGELOG.md +314 -0
  2. package/README.md +61 -2
  3. package/dist/adapter/AcodeSdkAdapter.d.ts +374 -1
  4. package/dist/adapter/AcodeSdkAdapter.js +3 -3
  5. package/dist/adapter/AdapterRegistry.d.ts +28 -0
  6. package/dist/adapter/ClaudeSdkAdapter.d.ts +71 -0
  7. package/dist/adapter/CodexSdkAdapter.d.ts +14 -0
  8. package/dist/adapter/OpencodeSdkAdapter.d.ts +44 -0
  9. package/dist/adapter/acode-tool-names.d.ts +9 -0
  10. package/dist/adapter/idle-poll-loop.d.ts +20 -0
  11. package/dist/adapter/index.d.ts +3 -0
  12. package/dist/adapter/instance-ai-config-resolver.d.ts +20 -0
  13. package/dist/adapter/prompts.d.ts +12 -0
  14. package/dist/adapter/types.d.ts +184 -0
  15. package/dist/browser/browser-bootstrap.d.ts +15 -0
  16. package/dist/browser/browser-connect-token.d.ts +11 -0
  17. package/dist/browser/browser-frame-encode.d.ts +32 -0
  18. package/dist/browser/browser-pool.d.ts +129 -0
  19. package/dist/browser/browser-profile-store.d.ts +41 -0
  20. package/dist/browser/browser-ws-bridge.d.ts +20 -0
  21. package/dist/browser/built-in-browser-tools.d.ts +44 -0
  22. package/dist/browser/element-locator.d.ts +25 -0
  23. package/dist/browser/element-picker.d.ts +30 -0
  24. package/dist/browser/frame-encode.d.ts +19 -0
  25. package/dist/browser/input-dispatcher.d.ts +35 -0
  26. package/dist/browser/listener-store.d.ts +44 -0
  27. package/dist/browser/page-listener-manager.d.ts +88 -0
  28. package/dist/browser/page-listener-types.d.ts +38 -0
  29. package/dist/browser/screencast-differ.d.ts +10 -0
  30. package/dist/browser/screencast-manager.d.ts +94 -0
  31. package/dist/browser/snapshot-serializer.d.ts +56 -0
  32. package/dist/browser/ssrf-guard.d.ts +44 -0
  33. package/dist/browser/stealth.d.ts +21 -0
  34. package/dist/browser/step-archive.d.ts +13 -0
  35. package/dist/browser/types.d.ts +100 -0
  36. package/dist/browser/ws-server.d.ts +54 -0
  37. package/dist/config.d.ts +138 -2
  38. package/dist/config.js +2 -2
  39. package/dist/desktop/built-in-desktop-tools.d.ts +68 -0
  40. package/dist/desktop/built-in-desktop-tools.js +2 -1
  41. package/dist/desktop/desktop-control.d.ts +142 -0
  42. package/dist/desktop/desktop-control.js +2 -0
  43. package/dist/desktop/desktop-mcp-client.d.ts +28 -0
  44. package/dist/desktop/desktop-staleness.d.ts +66 -0
  45. package/dist/desktop/desktop-staleness.js +2 -0
  46. package/dist/index.d.ts +4 -0
  47. package/dist/index.js +1 -1
  48. package/dist/middleware/auth.d.ts +26 -0
  49. package/dist/middleware/auth.js +1 -1
  50. package/dist/remote-desktop/computer-control.d.ts +3 -0
  51. package/dist/remote-desktop/coords.d.ts +6 -0
  52. package/dist/remote-desktop/frame-backpressure.d.ts +10 -0
  53. package/dist/remote-desktop/frame-encode.d.ts +3 -0
  54. package/dist/remote-desktop/index.js +2 -2
  55. package/dist/remote-desktop/input-dispatcher.d.ts +4 -0
  56. package/dist/remote-desktop/permission-manager.d.ts +3 -0
  57. package/dist/remote-desktop/screen-capture.d.ts +91 -0
  58. package/dist/remote-desktop/session-manager.d.ts +47 -0
  59. package/dist/remote-desktop/session-manager.js +1 -1
  60. package/dist/remote-desktop/system-backend.d.ts +64 -0
  61. package/dist/remote-desktop/types.d.ts +25 -0
  62. package/dist/remote-desktop/ui-automation.d.ts +11 -0
  63. package/dist/remote-desktop/win32-api.d.ts +10 -0
  64. package/dist/routes/acode-todos.d.ts +13 -0
  65. package/dist/routes/agent-state.d.ts +15 -0
  66. package/dist/routes/ai-sources.js +1 -1
  67. package/dist/routes/background-tasks.d.ts +18 -0
  68. package/dist/routes/background-tasks.js +2 -2
  69. package/dist/routes/bridge-temp-files.d.ts +1 -0
  70. package/dist/routes/bridge-temp-files.js +2 -0
  71. package/dist/routes/browser-listeners.d.ts +17 -0
  72. package/dist/routes/browser-sessions.d.ts +10 -0
  73. package/dist/routes/capabilities.js +1 -1
  74. package/dist/routes/dashboard-icon.d.ts +9 -0
  75. package/dist/routes/dashboard-icon.js +2 -0
  76. package/dist/routes/dashboard-theme.d.ts +24 -0
  77. package/dist/routes/dashboard-theme.js +157 -0
  78. package/dist/routes/dashboard.d.ts +9 -0
  79. package/dist/routes/dashboard.js +2021 -628
  80. package/dist/routes/debug-mount.d.ts +16 -0
  81. package/dist/routes/desktop-control.d.ts +15 -0
  82. package/dist/routes/desktop-control.js +2 -0
  83. package/dist/routes/events.d.ts +4 -0
  84. package/dist/routes/file-browser.d.ts +15 -10
  85. package/dist/routes/file-browser.js +1 -1
  86. package/dist/routes/file-change-diff.d.ts +25 -0
  87. package/dist/routes/file-diff-rollback.d.ts +28 -0
  88. package/dist/routes/file-snapshot.d.ts +7 -0
  89. package/dist/routes/git.d.ts +185 -0
  90. package/dist/routes/git.js +34 -34
  91. package/dist/routes/instance-tool-status.d.ts +5 -0
  92. package/dist/routes/instance.d.ts +8 -0
  93. package/dist/routes/instance.js +1 -1
  94. package/dist/routes/jdks.d.ts +4 -0
  95. package/dist/routes/launch.d.ts +5 -0
  96. package/dist/routes/lsp-providers.d.ts +11 -0
  97. package/dist/routes/lsp-providers.js +2 -0
  98. package/dist/routes/lsp.d.ts +41 -0
  99. package/dist/routes/lsp.js +4 -2
  100. package/dist/routes/mcp-extra.d.ts +15 -0
  101. package/dist/routes/mcp.d.ts +16 -0
  102. package/dist/routes/mcp.js +1 -1
  103. package/dist/routes/plugins.d.ts +19 -0
  104. package/dist/routes/plugins.js +1 -1
  105. package/dist/routes/processes.d.ts +4 -0
  106. package/dist/routes/properties.d.ts +4 -0
  107. package/dist/routes/pty.d.ts +29 -0
  108. package/dist/routes/runtime-binding.d.ts +3 -0
  109. package/dist/routes/sessions.d.ts +22 -0
  110. package/dist/routes/sessions.js +1 -1
  111. package/dist/routes/skills.d.ts +15 -0
  112. package/dist/routes/skills.js +1 -1
  113. package/dist/routes/sub-agents.d.ts +11 -0
  114. package/dist/routes/sub-agents.js +1 -1
  115. package/dist/routes/task-context.d.ts +5 -0
  116. package/dist/routes/tech-stack.d.ts +6 -0
  117. package/dist/routes/tech-stack.js +2 -0
  118. package/dist/routes/terminal.d.ts +122 -0
  119. package/dist/routes/terminal.js +22 -22
  120. package/dist/routes/workspace-index.d.ts +12 -0
  121. package/dist/routes/workspace-index.js +2 -0
  122. package/dist/routes/yml.d.ts +4 -0
  123. package/dist/scripts/migrate-user-scopes.d.ts +26 -0
  124. package/dist/scripts/migrate-user-scopes.js +2 -0
  125. package/dist/services/access-control.d.ts +21 -0
  126. package/dist/services/acode-bg-manager.d.ts +21 -0
  127. package/dist/services/acode-package.d.ts +10 -0
  128. package/dist/services/acode-package.js +1 -1
  129. package/dist/services/agent-capability-sync.d.ts +26 -0
  130. package/dist/services/agent-capability-sync.js +1 -1
  131. package/dist/services/agent-event-store.d.ts +20 -0
  132. package/dist/services/agent-ownership.d.ts +58 -0
  133. package/dist/services/agent-ownership.js +3 -0
  134. package/dist/services/agent-process-manager.d.ts +154 -0
  135. package/dist/services/agent-pty-manager.d.ts +39 -0
  136. package/dist/services/agent-pty-manager.js +5 -4
  137. package/dist/services/agent-startup-memory.d.ts +34 -0
  138. package/dist/services/agent-startup-memory.js +4 -4
  139. package/dist/services/ai-config-service.d.ts +26 -52
  140. package/dist/services/ai-config-service.js +1 -3
  141. package/dist/services/ai-source-apply.d.ts +7 -15
  142. package/dist/services/ai-source-apply.js +1 -1
  143. package/dist/services/auto-register.d.ts +165 -1
  144. package/dist/services/auto-register.js +1 -1
  145. package/dist/services/aws-client-agent-mcp.d.ts +14 -0
  146. package/dist/services/aws-client-agent-mcp.js +2 -2
  147. package/dist/services/bridge-package-publish-hooks.d.ts +14 -0
  148. package/dist/services/bridge-pairing.d.ts +82 -0
  149. package/dist/services/bridge-pairing.js +2 -0
  150. package/dist/services/bridge-temp-files.d.ts +65 -0
  151. package/dist/services/bridge-temp-files.js +2 -0
  152. package/dist/services/browser-session-manager.d.ts +71 -0
  153. package/dist/services/capability-config.d.ts +60 -15
  154. package/dist/services/capability-config.js +2 -2
  155. package/dist/services/change-cache-retention.d.ts +9 -0
  156. package/dist/services/changelog.d.ts +9 -0
  157. package/dist/services/cli-commands.d.ts +82 -0
  158. package/dist/services/cli-commands.js +6 -6
  159. package/dist/services/connection-key-rotation.d.ts +27 -0
  160. package/dist/services/connection-key-rotation.js +2 -0
  161. package/dist/services/debug-mount.d.ts +49 -0
  162. package/dist/services/desktop-mcp-manager.d.ts +103 -1
  163. package/dist/services/desktop-mcp-manager.js +1 -1
  164. package/dist/services/event-delta-pusher.d.ts +15 -0
  165. package/dist/services/fileSnapshotStore.d.ts +42 -0
  166. package/dist/services/fileSnapshotStore.js +1 -1
  167. package/dist/services/gitignore.d.ts +21 -0
  168. package/dist/services/gitignore.js +2 -0
  169. package/dist/services/instance-ai-config-service.d.ts +9 -0
  170. package/dist/services/instance-ai-config-service.js +1 -1
  171. package/dist/services/instance-features.d.ts +127 -0
  172. package/dist/services/instance-features.js +1 -1
  173. package/dist/services/instance-init-service.d.ts +3 -0
  174. package/dist/services/instance-init-service.js +1 -1
  175. package/dist/services/instance-state.d.ts +23 -0
  176. package/dist/services/jdk-scanner.d.ts +15 -0
  177. package/dist/services/launch-manager.d.ts +138 -0
  178. package/dist/services/launch-metrics.d.ts +42 -0
  179. package/dist/services/launch-streams.d.ts +19 -0
  180. package/dist/services/lifecycle-state.d.ts +5 -0
  181. package/dist/services/log-retention.d.ts +38 -0
  182. package/dist/services/log-retention.js +1 -1
  183. package/dist/services/lsp/install-manager.d.ts +55 -0
  184. package/dist/services/lsp/install-manager.js +2 -0
  185. package/dist/services/lsp/provider-registry.d.ts +108 -0
  186. package/dist/services/lsp/provider-registry.js +2 -0
  187. package/dist/services/lsp/uri-rewrite.d.ts +44 -0
  188. package/dist/services/lsp/uri-rewrite.js +2 -0
  189. package/dist/services/lsp-stdio-bridge.d.ts +41 -4
  190. package/dist/services/lsp-stdio-bridge.js +3 -3
  191. package/dist/services/mcp-deploy.d.ts +45 -4
  192. package/dist/services/mcp-deploy.js +4 -4
  193. package/dist/services/mcp-env-injector.d.ts +52 -0
  194. package/dist/services/mcp-launch-binding-queue.d.ts +12 -0
  195. package/dist/services/mcp-package.d.ts +22 -0
  196. package/dist/services/mcp-package.js +1 -1
  197. package/dist/services/mcp-probe-client.d.ts +19 -0
  198. package/dist/services/mcp-probe-client.js +1 -1
  199. package/dist/services/open-doc-events.d.ts +43 -0
  200. package/dist/services/open-doc-events.js +2 -0
  201. package/dist/services/open-doc-registry.d.ts +59 -0
  202. package/dist/services/open-doc-registry.js +2 -0
  203. package/dist/services/orphan-monitor.d.ts +43 -0
  204. package/dist/services/panel-auth.d.ts +24 -0
  205. package/dist/services/panel-env.d.ts +28 -0
  206. package/dist/services/plugin-deployment.d.ts +34 -1
  207. package/dist/services/plugin-deployment.js +2 -2
  208. package/dist/services/plugin-event-buffer.d.ts +21 -0
  209. package/dist/services/plugin-fs.d.ts +11 -0
  210. package/dist/services/plugin-handler-adapter.d.ts +13 -0
  211. package/dist/services/plugin-listener-runner.d.ts +10 -0
  212. package/dist/services/plugin-loader.d.ts +15 -0
  213. package/dist/services/plugin-manager.d.ts +95 -9
  214. package/dist/services/plugin-manager.js +4 -4
  215. package/dist/services/plugin-manifest.d.ts +14 -0
  216. package/dist/services/plugin-package.d.ts +13 -0
  217. package/dist/services/plugin-runtime.d.ts +15 -0
  218. package/dist/services/port-detector.d.ts +15 -0
  219. package/dist/services/process-detail.d.ts +3 -0
  220. package/dist/services/process-detector.d.ts +132 -0
  221. package/dist/services/process-registry.d.ts +120 -0
  222. package/dist/services/process-top.d.ts +6 -0
  223. package/dist/services/request-identity.d.ts +77 -0
  224. package/dist/services/request-identity.js +2 -0
  225. package/dist/services/request-invalid-dump.d.ts +4 -0
  226. package/dist/services/request-invalid-dump.js +1 -1
  227. package/dist/services/ring-buffer.d.ts +33 -0
  228. package/dist/services/runtime-binding.d.ts +56 -4
  229. package/dist/services/runtime-binding.js +4 -4
  230. package/dist/services/runtime-lifecycle-policy.d.ts +17 -0
  231. package/dist/services/runtime-resources-snapshot.d.ts +26 -0
  232. package/dist/services/runtime-resources-snapshot.js +2 -2
  233. package/dist/services/sdk-tool-file-change-recorder.d.ts +9 -0
  234. package/dist/services/session-output.d.ts +63 -0
  235. package/dist/services/session-output.js +3 -3
  236. package/dist/services/skill-manager.d.ts +42 -5
  237. package/dist/services/skill-manager.js +3 -3
  238. package/dist/services/snapshot-retention.d.ts +30 -0
  239. package/dist/services/snapshot-retention.js +2 -0
  240. package/dist/services/startup-config-wizard.d.ts +7 -1
  241. package/dist/services/startup-config-wizard.js +10 -10
  242. package/dist/services/system-metrics.d.ts +3 -0
  243. package/dist/services/tech-stack-scanner.d.ts +43 -0
  244. package/dist/services/tech-stack-scanner.js +2 -0
  245. package/dist/services/terminal-persistence.d.ts +43 -0
  246. package/dist/services/tool-installer.d.ts +12 -0
  247. package/dist/services/tunnel-client.d.ts +99 -2
  248. package/dist/services/tunnel-client.js +1 -1
  249. package/dist/services/update-log.d.ts +6 -0
  250. package/dist/services/update-notifier.d.ts +17 -0
  251. package/dist/services/update-notifier.js +2 -2
  252. package/dist/services/user-scope.d.ts +115 -0
  253. package/dist/services/user-scope.js +2 -0
  254. package/dist/services/windows-service-manager.d.ts +12 -0
  255. package/dist/services/workspace-files.d.ts +64 -0
  256. package/dist/services/workspace-index/index-manager.d.ts +46 -0
  257. package/dist/services/workspace-index/index-manager.js +2 -0
  258. package/dist/services/workspace-index/indexer.d.ts +15 -0
  259. package/dist/services/workspace-index/indexer.js +2 -0
  260. package/dist/services/workspace-index/query.d.ts +74 -0
  261. package/dist/services/workspace-index/query.js +5 -0
  262. package/dist/services/workspace-index/resolver.d.ts +26 -0
  263. package/dist/services/workspace-index/resolver.js +2 -0
  264. package/dist/services/workspace-index/types.d.ts +89 -0
  265. package/dist/services/workspace-index/types.js +2 -0
  266. package/dist/services/workspace-watch.d.ts +4 -0
  267. package/dist/services/workspaceTaskChangeWatcher.d.ts +49 -0
  268. package/dist/services/workspaceTaskChangeWatcher.js +2 -2
  269. package/dist/types.d.ts +9 -0
  270. package/dist/utils/config-write-queue.d.ts +11 -0
  271. package/dist/utils/env-safety.d.ts +21 -0
  272. package/dist/utils/file-utils.d.ts +15 -0
  273. package/dist/utils/instance-ai-config-debug-logger.d.ts +15 -0
  274. package/dist/utils/lifecycle-log.d.ts +5 -0
  275. package/dist/utils/logger.d.ts +13 -0
  276. package/dist/utils/logger.js +2 -1
  277. package/dist/utils/npm-version.d.ts +10 -0
  278. package/dist/utils/path-utils.d.ts +12 -0
  279. package/dist/utils/scheduler-url.d.ts +18 -0
  280. package/dist/utils/scheduler-url.js +2 -0
  281. package/dist/utils/sdk-package-loader.d.ts +13 -0
  282. package/dist/utils/sdk-package-loader.js +1 -1
  283. package/dist/utils/target-identity.d.ts +31 -0
  284. package/dist/utils/target-identity.js +2 -0
  285. package/dist/utils/validation.d.ts +17 -0
  286. package/dist/utils/yaml-utils.d.ts +48 -0
  287. package/package/acode/dist/__tests__/summary-request-helper.d.ts +12 -0
  288. package/package/acode/dist/__tests__/summary-request-helper.js +2 -0
  289. package/package/acode/dist/ask-user-question-tool.d.ts +17 -0
  290. package/package/acode/dist/await-complete-tool.d.ts +12 -0
  291. package/package/acode/dist/background-command-manager.d.ts +105 -0
  292. package/package/acode/dist/background-command-store.d.ts +27 -0
  293. package/package/acode/dist/background-command-tools.d.ts +8 -0
  294. package/package/acode/dist/background-output-ringbuffer.d.ts +15 -0
  295. package/package/acode/dist/built-in-file-tools.d.ts +65 -0
  296. package/package/acode/dist/built-in-symbols-tool.d.ts +3 -0
  297. package/package/acode/dist/builtins/commandArtifacts.d.ts +3 -0
  298. package/package/acode/dist/builtins/shellCommandPreparation.d.ts +17 -0
  299. package/package/acode/dist/builtins/shellCommandRunner.d.ts +4 -0
  300. package/package/acode/dist/builtins/shellOutputDecoder.d.ts +15 -0
  301. package/package/acode/dist/cache-control.d.ts +71 -0
  302. package/package/acode/dist/cache-control.js +2 -0
  303. package/package/acode/dist/commands/commandLoader.d.ts +3 -0
  304. package/package/acode/dist/commands/commandParser.d.ts +3 -0
  305. package/package/acode/dist/commands/commandRegistry.d.ts +3 -0
  306. package/package/acode/dist/compaction.d.ts +388 -4
  307. package/package/acode/dist/compaction.js +19 -17
  308. package/package/acode/dist/config.d.ts +3 -0
  309. package/package/acode/dist/context-overflow.d.ts +32 -0
  310. package/package/acode/dist/fs-utils.d.ts +18 -0
  311. package/package/acode/dist/hooks/hookBus.d.ts +3 -0
  312. package/package/acode/dist/image-utils.d.ts +35 -0
  313. package/package/acode/dist/index.d.ts +1 -0
  314. package/package/acode/dist/index.js +1 -1
  315. package/package/acode/dist/mcpToolNames.d.ts +32 -0
  316. package/package/acode/dist/microcompact.d.ts +110 -0
  317. package/package/acode/dist/microcompact.js +2 -0
  318. package/package/acode/dist/parsers/ast-cache.d.ts +41 -0
  319. package/package/acode/dist/parsers/file-index.d.ts +83 -0
  320. package/package/acode/dist/parsers/file-index.js +4 -0
  321. package/package/acode/dist/parsers/language-detector.d.ts +4 -0
  322. package/package/acode/dist/parsers/tree-sitter-loader.d.ts +12 -0
  323. package/package/acode/dist/parsers/types.d.ts +11 -0
  324. package/package/acode/dist/paths.d.ts +14 -0
  325. package/package/acode/dist/plugin-types.d.ts +34 -0
  326. package/package/acode/dist/read-file-state.d.ts +15 -0
  327. package/package/acode/dist/runtime-environment.d.ts +16 -0
  328. package/package/acode/dist/runtime.d.ts +828 -9
  329. package/package/acode/dist/runtime.js +40 -33
  330. package/package/acode/dist/skill-tool.d.ts +20 -0
  331. package/package/acode/dist/sub-agent-manager.d.ts +169 -0
  332. package/package/acode/dist/sub-agent-manager.js +1 -1
  333. package/package/acode/dist/sub-agent-store.d.ts +50 -0
  334. package/package/acode/dist/sub-agent-tools.d.ts +15 -0
  335. package/package/acode/dist/sub-agent-types.d.ts +13 -0
  336. package/package/acode/dist/terminal-tool.d.ts +15 -0
  337. package/package/acode/dist/terminal-types.d.ts +10 -0
  338. package/package/acode/dist/todo-store.d.ts +15 -0
  339. package/package/acode/dist/token-estimator.d.ts +32 -0
  340. package/package/acode/dist/token-estimator.js +2 -0
  341. package/package/acode/dist/tool-allocation.d.ts +113 -0
  342. package/package/acode/dist/tool-concurrency/index.d.ts +8 -0
  343. package/package/acode/dist/tool-concurrency/observability.d.ts +32 -0
  344. package/package/acode/dist/tool-concurrency/resource-lock.d.ts +30 -0
  345. package/package/acode/dist/tool-concurrency/scheduler.d.ts +19 -0
  346. package/package/acode/dist/tool-concurrency/types.d.ts +57 -0
  347. package/package/acode/dist/tool-group-manager.d.ts +195 -0
  348. package/package/acode/dist/tool-group-manager.js +4 -4
  349. package/package/acode/dist/types.d.ts +192 -0
  350. package/package/aws-client-agent-mcp/README.md +130 -215
  351. package/package/aws-client-agent-mcp/dist/ability-market-tools.d.ts +57 -0
  352. package/package/aws-client-agent-mcp/dist/ability-market-tools.js +1 -1
  353. package/package/aws-client-agent-mcp/dist/agent-client.d.ts +290 -3
  354. package/package/aws-client-agent-mcp/dist/agent-client.js +1 -1
  355. package/package/aws-client-agent-mcp/dist/config.d.ts +18 -0
  356. package/package/aws-client-agent-mcp/dist/constants.d.ts +2 -0
  357. package/package/aws-client-agent-mcp/dist/context-manager.d.ts +70 -0
  358. package/package/aws-client-agent-mcp/dist/http-client.d.ts +61 -0
  359. package/package/aws-client-agent-mcp/dist/index.d.ts +10 -0
  360. package/package/aws-client-agent-mcp/dist/logger.d.ts +24 -0
  361. package/package/aws-client-agent-mcp/dist/mcp-server.d.ts +610 -0
  362. package/package/aws-client-agent-mcp/dist/mcp-server.js +25 -23
  363. package/package/aws-client-agent-mcp/dist/mcp-tools.d.ts +158 -0
  364. package/package/aws-client-agent-mcp/dist/mcp-tools.js +38 -22
  365. package/package/aws-client-agent-mcp/dist/memory-store.d.ts +102 -2
  366. package/package/aws-client-agent-mcp/dist/memory-store.js +27 -2
  367. package/package/aws-client-agent-mcp/dist/memory-tools.d.ts +18 -0
  368. package/package/aws-client-agent-mcp/dist/memory-tools.js +13 -9
  369. package/package/aws-client-agent-mcp/dist/message-buffer.d.ts +86 -0
  370. package/package/aws-client-agent-mcp/dist/messageContent.d.ts +24 -0
  371. package/package/aws-client-agent-mcp/dist/office/office-equation.d.ts +19 -0
  372. package/package/aws-client-agent-mcp/dist/office/office-image.d.ts +18 -0
  373. package/package/aws-client-agent-mcp/dist/office/office-workspace.d.ts +29 -0
  374. package/package/aws-client-agent-mcp/dist/parent-lifecycle.d.ts +18 -0
  375. package/package/aws-client-agent-mcp/dist/runtime-launch-binding.d.ts +6 -0
  376. package/package/aws-client-agent-mcp/dist/server-memory-store.d.ts +5 -1
  377. package/package/aws-client-agent-mcp/dist/server-memory-store.js +1 -1
  378. package/package/aws-client-agent-mcp/dist/status-reporter.d.ts +41 -0
  379. package/package/aws-client-agent-mcp/dist/tool-groups.d.ts +136 -0
  380. package/package/aws-client-agent-mcp/dist/types.d.ts +174 -0
  381. package/package/aws-client-agent-mcp/dist/watchdog.d.ts +7 -0
  382. package/package/aws-client-agent-mcp/dist/websocket-client.d.ts +108 -0
  383. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ import{cpSync as h,existsSync as d,mkdirSync as I,readdirSync as a,statSync as y}from"node:fs";import o from"node:path";import{getBridgeDataHome as S,getBridgeTemplateDir as k}from"../config.js";import{getUserAiConfigFile as w,getUserCapabilityAgentFile as U,getUserCapabilityDefaultsFile as R,getUserMcpDeployedDir as F,getUserMcpPackagesDir as P,getUserPluginsDeployedDir as x,getUserScopeRoot as C,getUserSkillsDeployedDir as v,getUserSkillsDir as A,isValidScopeId as g}from"../services/user-scope.js";import{createLogger as B}from"../utils/logger.js";const l=B("migrate-user-scopes");function E(e){const t=r=>{const c=e.indexOf(r);return c>=0?String(e[c+1]??"").trim():""},n=t("--tenant"),s=t("--user");if(!n||!s)throw new Error("\u5FC5\u987B\u63D0\u4F9B --tenant <tenantId> \u4E0E --user <userId>");if(!g(n)||!g(s))throw new Error("tenantId/userId \u53EA\u80FD\u5305\u542B\u5B57\u6BCD\u6570\u5B57\u4E0E _ . -");const i=t("--agents");return{tenantId:n,userId:s,dryRun:e.includes("--dry-run"),overwrite:e.includes("--overwrite"),agents:i?i.split(",").map(r=>r.trim()).filter(Boolean):[]}}let m=0,j=0;function W(e){I(o.dirname(e),{recursive:!0})}function u(e,t,n){if(!(!d(e)||!y(e).isFile())){if(d(t)&&!n.overwrite){j+=1;return}if(m+=1,n.dryRun){l.info("[dry-run] file %s \u2192 %s",e,t);return}W(t),h(e,t,{force:!0})}}function p(e,t,n){if(!d(e))return;let s=[];try{s=a(e)}catch{return}for(const i of s){if(i.startsWith("."))continue;const r=o.join(e,i),c=o.join(t,i);let f;try{f=y(r)}catch{continue}f.isDirectory()?p(r,c,n):f.isFile()&&u(r,c,n)}}function b(e){const t={tenantId:e.tenantId,userId:e.userId},n=k();if(!d(n)){l.info("\u9057\u7559\u6A21\u677F\u76EE\u5F55\u4E0D\u5B58\u5728\uFF08%s\uFF09\uFF0C\u65E0\u9700\u8FC1\u79FB",n);return}l.info("\u5F00\u59CB\u8FC1\u79FB\uFF1A%s \u2192 %s%s%s",n,C(t),e.dryRun?"\uFF08dry-run\uFF09":"",e.overwrite?"\uFF08\u8986\u76D6\u5DF2\u5B58\u5728\uFF09":""),u(o.join(n,"config.json"),w(t),e),p(o.join(n,"skills","deployed"),v(t),e);const s=o.join(n,"skills");if(d(s))for(const i of a(s)){if(i==="deployed"||i==="agents"||i==="config.json")continue;const r=o.join(s,i);try{if(!y(r).isDirectory())continue}catch{continue}p(r,o.join(A(t),i),e)}p(o.join(n,"mcp","deployed"),F(t),e),p(o.join(n,"mcp","packages"),P(t),e),p(o.join(n,"plugins","deployed"),x(t),e);for(const i of["skills","mcp","plugins"]){const r=o.join(n,i);u(o.join(r,"config.json"),R(t,i),e);const c=o.join(r,"agents");if(d(c))for(const f of a(c)){if(!f.endsWith(".json")||f.startsWith("."))continue;const D=f.slice(0,-5);u(o.join(c,f),U(t,i,D),e)}}l.info("\u8FC1\u79FB\u5B8C\u6210\uFF1A\u590D\u5236 %d \u4E2A\u6587\u4EF6\uFF0C\u8DF3\u8FC7 %d \u4E2A\u5DF2\u5B58\u5728\u6587\u4EF6\u3002\u9057\u7559\u5C42\u4FDD\u7559\uFF08\u53EA\u8BFB\u56DE\u9000\uFF09\u3002",m,j),e.dryRun&&l.info("dry-run \u7ED3\u675F\uFF1A\u672A\u5199\u5165\u4EFB\u4F55\u6587\u4EF6\u3002"),l.info("\u6570\u636E\u6839\uFF1A%s",S())}try{const e=E(process.argv.slice(2));b(e)}catch(e){l.error("\u8FC1\u79FB\u5931\u8D25\uFF1A%s",e instanceof Error?e.message:String(e)),process.exitCode=1}
2
+
@@ -1,12 +1,30 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
2
12
  import type { IncomingMessage } from "node:http";
3
13
  import type { Socket } from "node:net";
4
14
  import type { NextFunction, Request, Response } from "express";
5
15
 
16
+
17
+
18
+
6
19
  export declare function parseAllowIps(raw: unknown): string[];
7
20
 
8
21
  export declare function isValidIpEntry(entry: string): boolean;
9
22
 
23
+
24
+
25
+
26
+
27
+
10
28
  export declare function isIpAllowed(clientIp: string, entries: string[]): boolean;
11
29
 
12
30
  export declare function getAccessControlEntries(): string[];
@@ -15,4 +33,7 @@ export declare function refreshAccessControlCache(): void;
15
33
 
16
34
  export declare function accessControlMiddleware(req: Request, res: Response, next: NextFunction): void;
17
35
 
36
+
37
+
38
+
18
39
  export declare function isUpgradeAllowed(request: IncomingMessage, socket: Socket): boolean;
@@ -1,5 +1,16 @@
1
1
 
2
2
 
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
3
14
  export interface BgTaskOutputSubscriber {
4
15
  onLine: (event: {
5
16
  stream: "stdout" | "stderr";
@@ -47,9 +58,19 @@ export interface BgManagerLike {
47
58
  getTaskOutputSnapshot(agentId: string, taskId: string, tailLines?: number): BgTaskOutputSnapshot | null;
48
59
  subscribeTaskOutput(agentId: string, taskId: string, subscriber: BgTaskOutputSubscriber): (() => void) | null;
49
60
 
61
+
62
+
63
+
50
64
  listTasksWithReconcile?(agentId: string, statusFilter?: string): Promise<BgTaskSummary[]>;
51
65
 
66
+
67
+
68
+
52
69
  killTask?(agentId: string, taskId: string): Promise<unknown>;
53
70
  }
54
71
 
72
+
73
+
74
+
75
+
55
76
  export declare function getAcodeBgManager(): Promise<BgManagerLike | null>;
@@ -1,4 +1,14 @@
1
1
 
2
+
3
+
4
+
5
+
2
6
  export declare function getReleasedAcodeEntryPath(): string;
3
7
 
8
+
9
+
10
+
11
+
12
+
13
+
4
14
  export declare function ensureAcodePackageReleased(): string | null;
@@ -1,2 +1,2 @@
1
- import{existsSync as i,mkdirSync as b,rmSync as m,cpSync as g,symlinkSync as k,lstatSync as A,realpathSync as j}from"node:fs";import o from"node:path";import{fileURLToPath as x}from"node:url";import{getRuntimeHomeDir as E}from"../config.js";import{logger as d}from"../utils/logger.js";function u(){const e=x(import.meta.url);return o.resolve(o.dirname(e),"..","..")}function p(e=u()){return o.join(e,"package","acode")}function R(e=u()){return i(o.join(e,"src"))}function y(){return o.join(E(),".aws-bridge","acode")}function S(e){if(!i(e))return!0;const n=A(e);return n.isSymbolicLink()||n.isDirectory()}function M(e,n){if(!i(e))return!1;try{return j(e)===j(n)}catch{return!1}}function v(e,n){const t=o.join(e,"node_modules"),r=o.join(n,"node_modules");if(!i(t)){d.warn(`[runtime-bridge] ACode \u672A\u627E\u5230 bridge node_modules\uFF0C\u4F9D\u8D56\u89E3\u6790\u53EF\u80FD\u5931\u8D25: ${t}`);return}if(!M(r,t)){if(!S(r)){d.warn(`[runtime-bridge] ACode node_modules \u8DEF\u5F84\u5DF2\u5B58\u5728\u4F46\u4E0D\u662F\u76EE\u5F55\u6216\u94FE\u63A5\uFF0C\u5DF2\u4FDD\u7559: ${r}`);return}m(r,{recursive:!0,force:!0}),k(t,r,process.platform==="win32"?"junction":"dir")}}function $(){const e=u();return R(e)?o.join(p(e),"dist","index.js"):o.join(y(),"dist","index.js")}function h(){const e=u(),n=p(e),t=o.join(n,"dist"),r=o.join(t,"index.js");if(!i(r))return d.warn(`[runtime-bridge] \u672A\u627E\u5230 bundled ACode dist\uFF0CACode \u542F\u52A8\u53EF\u80FD\u5931\u8D25: ${r}`),null;if(R(e))return d.info(`[runtime-bridge] ACode \u672C\u5730\u5F00\u53D1\u6A21\u5F0F\uFF0C\u76F4\u63A5\u4F7F\u7528\u9879\u76EE dist: ${r}`),r;const s=y(),c=o.join(s,"dist");b(s,{recursive:!0}),m(c,{recursive:!0,force:!0}),g(t,c,{recursive:!0,force:!0,errorOnExist:!1});for(const a of["package.json","README.md"]){const f=o.join(n,a);i(f)&&g(f,o.join(s,a),{force:!0,errorOnExist:!1})}v(e,s);const l=o.join(c,"index.js");return d.info(`[runtime-bridge] ACode \u5DF2\u51C6\u5907: ${l}`),l}export{h as ensureAcodePackageReleased,$ as getReleasedAcodeEntryPath};
1
+ import{existsSync as i,mkdirSync as A,rmSync as m,cpSync as g,symlinkSync as b,lstatSync as k,realpathSync as j}from"node:fs";import o from"node:path";import{getRuntimeHomeDir as x}from"../config.js";import{logger as d}from"../utils/logger.js";import{BRIDGE_PACKAGE_ROOT as E}from"../utils/sdk-package-loader.js";function u(){return E}function p(e=u()){return o.join(e,"package","acode")}function R(e=u()){return i(o.join(e,"src"))}function y(){return o.join(x(),".aws-bridge","acode")}function S(e){if(!i(e))return!0;const n=k(e);return n.isSymbolicLink()||n.isDirectory()}function C(e,n){if(!i(e))return!1;try{return j(e)===j(n)}catch{return!1}}function D(e,n){const t=o.join(e,"node_modules"),r=o.join(n,"node_modules");if(!i(t)){d.warn(`[runtime-bridge] ACode \u672A\u627E\u5230 bridge node_modules\uFF0C\u4F9D\u8D56\u89E3\u6790\u53EF\u80FD\u5931\u8D25: ${t}`);return}if(!C(r,t)){if(!S(r)){d.warn(`[runtime-bridge] ACode node_modules \u8DEF\u5F84\u5DF2\u5B58\u5728\u4F46\u4E0D\u662F\u76EE\u5F55\u6216\u94FE\u63A5\uFF0C\u5DF2\u4FDD\u7559: ${r}`);return}m(r,{recursive:!0,force:!0}),b(t,r,process.platform==="win32"?"junction":"dir")}}function $(){const e=u();return R(e)?o.join(p(e),"dist","index.js"):o.join(y(),"dist","index.js")}function L(){const e=u(),n=p(e),t=o.join(n,"dist"),r=o.join(t,"index.js");if(!i(r))return d.warn(`[runtime-bridge] \u672A\u627E\u5230 bundled ACode dist\uFF0CACode \u542F\u52A8\u53EF\u80FD\u5931\u8D25: ${r}`),null;if(R(e))return d.info(`[runtime-bridge] ACode \u672C\u5730\u5F00\u53D1\u6A21\u5F0F\uFF0C\u76F4\u63A5\u4F7F\u7528\u9879\u76EE dist: ${r}`),r;const s=y(),c=o.join(s,"dist");A(s,{recursive:!0}),m(c,{recursive:!0,force:!0}),g(t,c,{recursive:!0,force:!0,errorOnExist:!1});for(const a of["package.json","README.md"]){const f=o.join(n,a);i(f)&&g(f,o.join(s,a),{force:!0,errorOnExist:!1})}D(e,s);const l=o.join(c,"index.js");return d.info(`[runtime-bridge] ACode \u5DF2\u51C6\u5907: ${l}`),l}export{L as ensureAcodePackageReleased,$ as getReleasedAcodeEntryPath};
2
2
 
@@ -1,7 +1,33 @@
1
1
 
2
2
 
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
3
25
  export declare function getSkillFarmRoot(): string;
4
26
 
5
27
  export declare function getAgentSkillsFarmDir(agentId: string): string;
6
28
 
29
+
30
+
31
+
32
+
7
33
  export declare function syncAgentSkillFarm(agentId: string): string | null;
@@ -1,2 +1,2 @@
1
- import{cpSync as k,existsSync as y,lstatSync as g,mkdirSync as b,readdirSync as d,realpathSync as p,rmSync as S,symlinkSync as v}from"node:fs";import s from"node:path";import{getBridgeDataHome as L,getBridgeInstancePrivateSkillsDir as E,getBridgeInstanceSkillsDir as w,getBridgeTemplateSkillsDir as h}from"../config.js";import{createLogger as x}from"../utils/logger.js";import{isCapabilityEnabled as B}from"./instance-features.js";const f=x("agent-capability-sync"),D=process.platform==="win32"?"junction":"dir";function G(){return s.join(L(),"instance-runtime")}function T(e){return w(e)}function F(){return s.join(h(),"deployed")}function K(){return h()}function N(e){return E(e)}function A(e){const r=new Map,i=[K(),F()].filter(n=>n&&n.length>0);for(const n of i){if(!y(n))continue;let o=[];try{o=d(n)}catch{continue}for(const a of o){if(a.startsWith("."))continue;const c=s.join(n,a);try{if(!y(s.join(c,"SKILL.md")))continue;r.set(a,c)}catch{continue}}}const u=new Set,t=e?N(e):"";if(t&&y(t)){let n=[];try{n=d(t)}catch{n=[]}for(const o of n){if(o.startsWith("."))continue;const a=s.join(t,o);try{if(!y(s.join(a,"SKILL.md")))continue;r.set(o,a),u.add(o)}catch{continue}}}return{sources:r,privateNames:u}}function j(e,r){try{v(e,r,D)}catch(i){if(i.code==="EEXIST")try{if(g(r).isSymbolicLink()){S(r,{recursive:!0,force:!0}),v(e,r,D);return}f.warn("[farm] \u6280\u80FD\u540D %s \u4E0E\u519C\u573A\u4E2D\u771F\u5B9E\u76EE\u5F55\u51B2\u7A81\uFF0C\u8DF3\u8FC7\uFF08\u4FDD\u7559\u7528\u6237\u76EE\u5F55\uFF09: %s",s.basename(r),r);return}catch{}f.warn("[farm] junction \u5931\u8D25\uFF0C\u56DE\u9000\u590D\u5236 %s \u2192 %s: %s",e,r,i instanceof Error?i.message:String(i));try{let t=!1;try{t=g(r).isSymbolicLink()}catch{t=!1}const n=y(r);if(n&&!t){f.warn("[farm] \u56DE\u9000\u590D\u5236\u76EE\u6807\u4E3A\u771F\u5B9E\u76EE\u5F55\uFF0C\u8DF3\u8FC7\uFF08\u4FDD\u7559\u7528\u6237\u76EE\u5F55\uFF09: %s",r);return}n&&t&&S(r,{recursive:!0,force:!0}),k(e,r,{recursive:!0})}catch(t){f.error("[farm] \u590D\u5236\u56DE\u9000\u4E5F\u5931\u8D25 %s: %s",r,t instanceof Error?t.message:String(t))}}}function C(e,r){try{return s.resolve(p(e))===s.resolve(p(r))}catch{return!1}}function H(e){if(!e)return null;const r=T(e);try{const{sources:i,privateNames:u}=A(e);b(r,{recursive:!0});const t=new Set;let n=[];try{n=d(r)}catch{n=[]}for(const c of n){const l=s.join(r,c);try{g(l).isSymbolicLink()&&t.add(c)}catch{continue}}let o=0,a=0;for(const[c,l]of i){const m=s.join(r,c);if(u.has(c)||B(e,"skills",c))t.has(c)?C(m,l)||(S(m,{recursive:!0,force:!0}),j(l,m),o++):(j(l,m),o++);else if(t.has(c))try{S(m,{recursive:!0,force:!0}),a++}catch{}}for(const c of t)if(!i.has(c))try{S(s.join(r,c),{recursive:!0,force:!0}),a++}catch{}return(o>0||a>0)&&f.info("[farm] agent=%s \u6280\u80FD\u519C\u573A\u5DF2\u540C\u6B65: +%d \u94FE\u63A5, -%d \u53D6\u6D88\u94FE\u63A5 (\u5171 %d \u9879)",e,o,a,i.size),r}catch(i){return f.warn("[farm] agent=%s \u6280\u80FD\u519C\u573A\u540C\u6B65\u5931\u8D25\uFF08\u56DE\u9000\u5168\u5C40\u6280\u80FD\u76EE\u5F55\uFF09: %s",e,i instanceof Error?i.message:String(i)),null}}export{T as getAgentSkillsFarmDir,G as getSkillFarmRoot,H as syncAgentSkillFarm};
1
+ import{cpSync as h,existsSync as y,lstatSync as p,mkdirSync as j,readdirSync as d,realpathSync as D,rmSync as S,symlinkSync as k}from"node:fs";import i from"node:path";import{getBridgeDataHome as w,getBridgeInstancePrivateSkillsDir as E,getBridgeInstanceSkillsDir as x,getBridgeTemplateSkillsDir as v}from"../config.js";import{createLogger as F}from"../utils/logger.js";import{getAgentOwner as B}from"./agent-ownership.js";import{isCapabilityEnabled as T}from"./instance-features.js";import{isLegacyFallbackDisabled as A,getUserSkillsDir as K,getUserSkillsDeployedDir as N}from"./user-scope.js";const l=F("agent-capability-sync"),L=process.platform==="win32"?"junction":"dir";function J(){return i.join(w(),"instance-runtime")}function C(e){return x(e)}function M(){return i.join(v(),"deployed")}function R(){return v()}function U(e){return E(e)}function g(e,r){if(!e||!y(e))return;let n=[];try{n=d(e)}catch{return}for(const s of n){if(s.startsWith("."))continue;const t=i.join(e,s);try{if(!y(i.join(t,"SKILL.md")))continue;r.set(s,t)}catch{continue}}}function W(e){const r=new Map,n=B(e);A()||(g(R(),r),g(M(),r)),n&&(g(K(n),r),g(N(n),r));const s=new Set,t=e?U(e):"";if(t&&y(t)){let o=[];try{o=d(t)}catch{o=[]}for(const a of o){if(a.startsWith("."))continue;const f=i.join(t,a);try{if(!y(i.join(f,"SKILL.md")))continue;r.set(a,f),s.add(a)}catch{continue}}}return{sources:r,privateNames:s}}function b(e,r){try{k(e,r,L)}catch(n){if(n.code==="EEXIST")try{if(p(r).isSymbolicLink()){S(r,{recursive:!0,force:!0}),k(e,r,L);return}l.warn("[farm] \u6280\u80FD\u540D %s \u4E0E\u519C\u573A\u4E2D\u771F\u5B9E\u76EE\u5F55\u51B2\u7A81\uFF0C\u8DF3\u8FC7\uFF08\u4FDD\u7559\u7528\u6237\u76EE\u5F55\uFF09: %s",i.basename(r),r);return}catch{}l.warn("[farm] junction \u5931\u8D25\uFF0C\u56DE\u9000\u590D\u5236 %s \u2192 %s: %s",e,r,n instanceof Error?n.message:String(n));try{let t=!1;try{t=p(r).isSymbolicLink()}catch{t=!1}const o=y(r);if(o&&!t){l.warn("[farm] \u56DE\u9000\u590D\u5236\u76EE\u6807\u4E3A\u771F\u5B9E\u76EE\u5F55\uFF0C\u8DF3\u8FC7\uFF08\u4FDD\u7559\u7528\u6237\u76EE\u5F55\uFF09: %s",r);return}o&&t&&S(r,{recursive:!0,force:!0}),h(e,r,{recursive:!0})}catch(t){l.error("[farm] \u590D\u5236\u56DE\u9000\u4E5F\u5931\u8D25 %s: %s",r,t instanceof Error?t.message:String(t))}}}function Y(e,r){try{return i.resolve(D(e))===i.resolve(D(r))}catch{return!1}}function Q(e){if(!e)return null;const r=C(e);try{const{sources:n,privateNames:s}=W(e);j(r,{recursive:!0});const t=new Set;let o=[];try{o=d(r)}catch{o=[]}for(const c of o){const u=i.join(r,c);try{p(u).isSymbolicLink()&&t.add(c)}catch{continue}}let a=0,f=0;for(const[c,u]of n){const m=i.join(r,c);if(s.has(c)||T(e,"skills",c))t.has(c)?Y(m,u)||(S(m,{recursive:!0,force:!0}),b(u,m),a++):(b(u,m),a++);else if(t.has(c))try{S(m,{recursive:!0,force:!0}),f++}catch{}}for(const c of t)if(!n.has(c))try{S(i.join(r,c),{recursive:!0,force:!0}),f++}catch{}return(a>0||f>0)&&l.info("[farm] agent=%s \u6280\u80FD\u519C\u573A\u5DF2\u540C\u6B65: +%d \u94FE\u63A5, -%d \u53D6\u6D88\u94FE\u63A5 (\u5171 %d \u9879)",e,a,f,n.size),r}catch(n){return l.warn("[farm] agent=%s \u6280\u80FD\u519C\u573A\u540C\u6B65\u5931\u8D25\uFF08\u56DE\u9000\u5168\u5C40\u6280\u80FD\u76EE\u5F55\uFF09: %s",e,n instanceof Error?n.message:String(n)),null}}export{C as getAgentSkillsFarmDir,J as getSkillFarmRoot,Q as syncAgentSkillFarm};
2
2
 
@@ -1,4 +1,9 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
2
7
  import { type RingBufferEntry } from "./ring-buffer.js";
3
8
  export interface BridgeEventPayload {
4
9
  readonly category: "status" | "output" | "question" | "file_changed";
@@ -29,14 +34,29 @@ export interface BridgeEventPayload {
29
34
  readonly size?: number;
30
35
  }
31
36
 
37
+
38
+
39
+
40
+
32
41
  declare class AgentEventStore {
33
42
  private readonly agents;
34
43
  private ensureBuffer;
35
44
 
45
+
46
+
47
+
36
48
  append(agentId: string, payload: BridgeEventPayload): RingBufferEntry<BridgeEventPayload>;
37
49
 
50
+
51
+
52
+
53
+
54
+
55
+
38
56
  appendOrMergeOutput(agentId: string, payload: BridgeEventPayload): RingBufferEntry<BridgeEventPayload>;
39
57
 
58
+
59
+
40
60
  size(agentId: string): number;
41
61
  }
42
62
 
@@ -0,0 +1,58 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+ import { type UserScope } from "./user-scope.js";
20
+ export interface AgentOwnerRecord {
21
+ tenantId: string;
22
+ userId: string;
23
+
24
+ operatorUserId?: string;
25
+ updatedAt: string;
26
+ }
27
+
28
+ export declare function invalidateAgentOwner(agentId: string): void;
29
+
30
+ export declare function clearAgentOwnerCache(): void;
31
+
32
+
33
+
34
+
35
+ export declare function registerAgentOwner(agentId: string, scope: UserScope, operatorUserId?: string): AgentOwnerRecord;
36
+
37
+
38
+
39
+
40
+ export declare function getAgentOwner(agentId: string): UserScope | null;
41
+
42
+ export declare function getAgentOwnerRecord(agentId: string): AgentOwnerRecord | null;
43
+
44
+
45
+
46
+
47
+
48
+
49
+ export declare function assertAgentOwnership(agentId: string, scope: UserScope | null | undefined): boolean;
50
+
51
+
52
+
53
+
54
+ export declare function listAgentsOwnedBy(scope: UserScope): string[];
55
+
56
+
57
+
58
+ export declare function removeAgentOwner(agentId: string): void;
@@ -0,0 +1,3 @@
1
+ import{existsSync as p,mkdirSync as m,readdirSync as I,readFileSync as h,rmSync as S,writeFileSync as y}from"node:fs";import u from"node:path";import{getBridgeDataHome as O,getBridgeInstanceRuntimeDir as A}from"../config.js";import{createLogger as x}from"../utils/logger.js";import{normalizeUserScope as w,scopeEquals as a,sanitizeScopeId as j,setAgentOwnershipChecker as k}from"./user-scope.js";const D=x("agent-ownership"),o=new Map;function d(e){return u.join(A(e),"owner.json")}function c(e){return j(e)}function U(e){o.delete(c(e))}function J(){o.clear()}function g(e){const n=d(e);try{if(!p(n))return null;const t=JSON.parse(h(n,"utf8")),r=w(t.tenantId,t.userId);return r?{tenantId:r.tenantId,userId:r.userId,...t.operatorUserId?{operatorUserId:String(t.operatorUserId)}:{},updatedAt:String(t.updatedAt??new Date().toISOString())}:null}catch(t){return D.warn("[ownership] owner.json \u8BFB\u53D6\u5931\u8D25 agent=%s: %s",e,t instanceof Error?t.message:String(t)),null}}function N(e,n,t){const r=w(n.tenantId,n.userId);if(!r)throw new Error("registerAgentOwner: (tenantId, userId) \u4E0D\u5B8C\u6574");const s=f(e);if(s&&!a(s,r))throw new Error("agent-ownership-mismatch: agent \u5DF2\u5F52\u5C5E\u5176\u4ED6\u7528\u6237\uFF0C\u4E0D\u80FD\u8986\u76D6");const i={tenantId:r.tenantId,userId:r.userId,...t?{operatorUserId:t}:{},updatedAt:new Date().toISOString()},l=d(e);return m(u.dirname(l),{recursive:!0}),y(l,`${JSON.stringify(i,null,2)}
2
+ `,"utf8"),o.set(c(e),i),i}function f(e){const n=c(e);if(o.has(n)){const r=o.get(n);return r?{tenantId:r.tenantId,userId:r.userId}:null}const t=g(e);return o.set(n,t),t?{tenantId:t.tenantId,userId:t.userId}:null}function R(e){const n=c(e);if(o.has(n))return o.get(n)??null;const t=g(e);return o.set(n,t),t}function E(e,n){if(!n)return!1;const t=f(e);return t?a(t,n):!1}function q(e){const n=u.join(O(),"instance-runtime");let t=[];try{t=I(n)}catch{return[]}const r=[];for(const s of t){if(s.startsWith("."))continue;const i=f(s);i&&a(i,e)&&r.push(s)}return r}function H(e){try{S(d(e),{force:!0})}catch{}o.delete(c(e))}k((e,n)=>E(e,n));export{E as assertAgentOwnership,J as clearAgentOwnerCache,f as getAgentOwner,R as getAgentOwnerRecord,U as invalidateAgentOwner,q as listAgentsOwnedBy,N as registerAgentOwner,H as removeAgentOwner};
3
+
@@ -1,7 +1,15 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
7
+
2
8
  import { type ProcessInfo, type ProcessHealthStatus } from './process-detector.js';
3
9
  import { type ProcessRecord, type ProcessState, type HealthStatus } from './process-registry.js';
4
10
 
11
+
12
+
5
13
  export interface ProcessConfig {
6
14
  agentId: string;
7
15
  sessionId: string;
@@ -11,11 +19,15 @@ export interface ProcessConfig {
11
19
  command: string;
12
20
  }
13
21
 
22
+
23
+
14
24
  export interface DiscoveredProcess extends ProcessInfo {
15
25
  managementStatus: 'managed' | 'orphan' | 'unknown';
16
26
  sessionId?: string;
17
27
  }
18
28
 
29
+
30
+
19
31
  export interface TerminationResult {
20
32
  success: boolean;
21
33
  agentId: string;
@@ -26,54 +38,163 @@ export interface TerminationResult {
26
38
  message: string;
27
39
  }
28
40
 
41
+
42
+
29
43
  export interface ReclamationResult {
30
44
  success: boolean;
31
45
  pid: number;
32
46
  action: 'adopted' | 'terminated' | 'failed';
33
47
  }
34
48
 
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
35
58
  export declare class AgentProcessManager {
36
59
  private static instance;
37
60
  private readonly registry;
38
61
 
62
+
63
+
39
64
  private constructor();
40
65
 
66
+
67
+
41
68
  static getInstance(): AgentProcessManager;
42
69
 
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
43
80
  startProcess(config: ProcessConfig): Promise<void>;
44
81
 
82
+
83
+
84
+
85
+
86
+
87
+
88
+
45
89
  discoverAllProcesses(): Promise<DiscoveredProcess[]>;
46
90
 
91
+
92
+
93
+
94
+
95
+
96
+
47
97
  healthCheckAll(): Promise<Map<string, ProcessHealthStatus>>;
48
98
 
99
+
100
+
101
+
102
+
103
+
49
104
  healthCheck(agentId: string): Promise<ProcessHealthStatus>;
50
105
 
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
51
117
  stopProcess(agentId: string): Promise<TerminationResult>;
52
118
 
119
+
120
+
53
121
  private sendSigterm;
54
122
 
123
+
124
+
55
125
  private sendForceKill;
56
126
 
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
57
135
  forceKill(agentId: string): Promise<TerminationResult>;
58
136
 
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
59
146
  reclaimOrphan(agentId: string): Promise<ReclamationResult>;
60
147
 
148
+
149
+
150
+
151
+
61
152
  scanAndReclaimAll(): Promise<Array<{
62
153
  agentId: string;
63
154
  pid: number;
64
155
  action: string;
65
156
  }>>;
66
157
 
158
+
159
+
160
+
161
+
162
+
67
163
  markOrphaned(agentId: string): Promise<boolean>;
68
164
 
165
+
166
+
167
+
168
+
169
+
69
170
  isManaged(agentId: string): boolean;
70
171
 
172
+
173
+
174
+
175
+
71
176
  getAllManagedProcesses(): ProcessRecord[];
72
177
 
178
+
179
+
180
+
181
+
182
+
73
183
  getManagedProcessesByState(state: ProcessState): ProcessRecord[];
74
184
 
185
+
186
+
187
+
188
+
75
189
  getUnmanagedProcesses(): Promise<ProcessInfo[]>;
76
190
 
191
+
192
+
193
+
194
+
195
+
196
+
197
+
77
198
  rebuildRegistry(sessions: Array<{
78
199
  agentId: string;
79
200
  sessionId: string;
@@ -83,16 +204,49 @@ export declare class AgentProcessManager {
83
204
  mode?: 'sdk';
84
205
  }>): Promise<void>;
85
206
 
207
+
208
+
209
+
210
+
86
211
  getStats(): Record<ProcessState | 'total', number>;
87
212
 
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
88
223
  cleanupStaleRegistry(): Promise<number>;
89
224
 
225
+
226
+
227
+
228
+
229
+
90
230
  removeProcess(agentId: string): Promise<boolean>;
91
231
 
232
+
233
+
234
+
235
+
236
+
92
237
  getProcess(agentId: string): ProcessRecord | undefined;
93
238
 
239
+
240
+
241
+
242
+
243
+
94
244
  getProcessByPid(pid: number): ProcessRecord | undefined;
95
245
  }
96
246
 
247
+
248
+
249
+
250
+
97
251
  export declare function getAgentProcessManager(): AgentProcessManager;
98
252
  export type { ProcessRecord, ProcessState, HealthStatus, ProcessInfo, ProcessHealthStatus };
@@ -1,6 +1,24 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
2
16
  import type { TerminalManager, TerminalCreateOpts, TerminalReadOpts, TerminalReadResult } from "@agentswork/acode";
3
17
 
18
+
19
+
20
+
21
+
4
22
  export declare function detectNeedsInput(text: string): boolean;
5
23
  export declare class AgentPtyManager implements TerminalManager {
6
24
  private cursors;
@@ -13,7 +31,28 @@ export declare class AgentPtyManager implements TerminalManager {
13
31
  read(id: string, opts: TerminalReadOpts): TerminalReadResult;
14
32
  kill(id: string): void;
15
33
 
34
+
35
+
36
+
37
+
38
+
39
+
40
+
16
41
  killByAgent(agentId: string): void;
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+ listWaitingForInput(agentId: string): string[];
17
56
  resize(id: string, cols: number, rows: number): void;
18
57
 
19
58
  private touch;
@@ -1,5 +1,6 @@
1
- import{ptySessions as c,createPtySession as p,closePtySession as l,readPtyOutputBuffer as y}from"../routes/pty.js";const g=30*60*1e3,T=2e3,u=500;function M(a){const e=a.trimEnd();if(!e)return!1;const t=e.split(`
2
- `).pop()??"";return!!(/[:?]\s*$/.test(t)||/\((?:yes\/no|Y\/N|y\/n)\)/i.test(t)||/\b[Yy]\/?[Nn]\b/.test(t)||/\(press RETURN\)/i.test(t)||/\(press ENTER\)/i.test(t)||/press ENTER[^]*continue/i.test(t))}class w{constructor(){this.cursors=new Map,this.idleTimers=new Map}create(e){const t=e.shell&&e.shell.trim()?e.shell.trim():"auto",s=typeof e.cols=="number"&&e.cols>0?Math.min(e.cols,u):120,r=typeof e.rows=="number"&&e.rows>0?Math.min(e.rows,u):30,i=e.preCommand&&e.preCommand.trim()?e.preCommand:void 0,n=p({workspacePath:e.cwd,shell:t,cols:s,rows:r,preCommand:i,persistent:!0,ownerUserId:e.agentId}),o=c.get(n.id);return this.cursors.set(n.id,0),this.touch(n.id),{id:n.id,pid:o?.ptyProcess.pid}}write(e,t){const s=c.get(e);!s||s.status==="exited"||(s.ptyProcess.write(t.replace(/\n/g,"\r")),this.touch(e))}read(e,t){const s=c.get(e);if(!s)return{status:"closed",exit_code:null,output:"",needs_input:!1,truncated:!1};this.touch(e);const r=y(s),i=this.cursors.get(e)??0,n=i>=r.length?"":r.slice(i);this.cursors.set(e,r.length);const o=n.split(`
3
- `),m=Math.min(Math.max(1,t.lines??200),T);let h=o,d=!1;o.length>m&&(h=o.slice(o.length-m),d=!0);const f=s.status==="running"&&M(n);return{status:s.status,exit_code:s.exitCode??null,output:h.join(`
4
- `),needs_input:f,truncated:d}}kill(e){l(e,"agent-kill"),this.cursors.delete(e),this.clearIdle(e)}killByAgent(e){if(!e)return;const t=[];for(const[s,r]of c.entries())r.ownerUserId===e&&t.push(s);for(const s of t){try{l(s,`agent-stop:${e}`)}catch{}this.cursors.delete(s),this.clearIdle(s)}}resize(e,t,s){const r=c.get(e);if(!r)return;const i=typeof t=="number"&&t>0?Math.min(t,u):120,n=typeof s=="number"&&s>0?Math.min(s,u):30;r.ptyProcess.resize(i,n)}touch(e){const t=this.idleTimers.get(e);t&&clearTimeout(t);const s=setTimeout(()=>{l(e,"agent-idle-timeout"),this.cursors.delete(e),this.idleTimers.delete(e)},g);s.unref?.(),this.idleTimers.set(e,s)}clearIdle(e){const t=this.idleTimers.get(e);t&&clearTimeout(t),this.idleTimers.delete(e)}}const _=new w;export{w as AgentPtyManager,_ as agentPtyManager,M as detectNeedsInput};
1
+ import{ptySessions as u,createPtySession as y,closePtySession as a,readPtyOutputBuffer as d}from"../routes/pty.js";const T=30*60*1e3,M=2e3,l=500;function p(c){const t=c.trimEnd();if(!t)return!1;const s=t.split(`
2
+ `).pop()??"";return!!(/[:?]\s*$/.test(s)||/\((?:yes\/no|Y\/N|y\/n)\)/i.test(s)||/\b[Yy]\/?[Nn]\b/.test(s)||/\(press RETURN\)/i.test(s)||/\(press ENTER\)/i.test(s)||/press ENTER[^]*continue/i.test(s))}function w(c){const t=d(c);if(!t)return"";const s=t.split(`
3
+ `);for(let e=s.length-1;e>=0;e-=1){const n=s[e]??"";if(n.trim())return n}return""}class I{constructor(){this.cursors=new Map,this.idleTimers=new Map}create(t){const s=t.shell&&t.shell.trim()?t.shell.trim():"auto",e=typeof t.cols=="number"&&t.cols>0?Math.min(t.cols,l):120,n=typeof t.rows=="number"&&t.rows>0?Math.min(t.rows,l):30,i=t.preCommand&&t.preCommand.trim()?t.preCommand:void 0,r=y({workspacePath:t.cwd,shell:s,cols:e,rows:n,preCommand:i,persistent:!0,ownerUserId:t.agentId}),o=u.get(r.id);return this.cursors.set(r.id,0),this.touch(r.id),{id:r.id,pid:o?.ptyProcess.pid}}write(t,s){const e=u.get(t);!e||e.status==="exited"||(e.ptyProcess.write(s.replace(/\n/g,"\r")),this.touch(t))}read(t,s){const e=u.get(t);if(!e)return{status:"closed",exit_code:null,output:"",needs_input:!1,truncated:!1};this.touch(t);const n=d(e),i=this.cursors.get(t)??0,r=i>=n.length?"":n.slice(i);this.cursors.set(t,n.length);const o=r.split(`
4
+ `),f=Math.min(Math.max(1,s.lines??200),M);let h=o,m=!1;o.length>f&&(h=o.slice(o.length-f),m=!0);const g=e.status==="running"&&p(r);return{status:e.status,exit_code:e.exitCode??null,output:h.join(`
5
+ `),needs_input:g,truncated:m}}kill(t){a(t,"agent-kill"),this.cursors.delete(t),this.clearIdle(t)}killByAgent(t){if(!t)return;const s=[];for(const[e,n]of u.entries())n.ownerUserId===t&&s.push(e);for(const e of s){try{a(e,`agent-stop:${t}`)}catch{}this.cursors.delete(e),this.clearIdle(e)}}listWaitingForInput(t){const s=[];for(const e of u.values())e.ownerUserId===t&&e.status==="running"&&p(w(e))&&s.push(e.id);return s}resize(t,s,e){const n=u.get(t);if(!n)return;const i=typeof s=="number"&&s>0?Math.min(s,l):120,r=typeof e=="number"&&e>0?Math.min(e,l):30;n.ptyProcess.resize(i,r)}touch(t){const s=this.idleTimers.get(t);s&&clearTimeout(s);const e=setTimeout(()=>{a(t,"agent-idle-timeout"),this.cursors.delete(t),this.idleTimers.delete(t)},T);e.unref?.(),this.idleTimers.set(t,e)}clearIdle(t){const s=this.idleTimers.get(t);s&&clearTimeout(s),this.idleTimers.delete(t)}}const _=new I;export{I as AgentPtyManager,_ as agentPtyManager,p as detectNeedsInput};
5
6
 
@@ -1,11 +1,45 @@
1
1
 
2
2
 
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
3
19
  export interface AgentStartupMemoryOptions {
4
20
  schedulerBaseUrl?: string;
5
21
  runtimeAccessToken?: string;
6
22
  agentId?: string;
7
23
  }
8
24
 
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
9
34
  export declare function loadAgentStartupMemories(workspacePath: string, options?: AgentStartupMemoryOptions): Promise<string | undefined>;
10
35
 
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
11
45
  export declare function buildAgentStartupMemorySnapshot(workspacePath: string, agentId: string | undefined): () => Promise<string | null>;