aws-runtime-bridge 1.9.175 → 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 (357) hide show
  1. package/CHANGELOG.md +188 -0
  2. package/README.md +61 -2
  3. package/dist/adapter/AcodeSdkAdapter.d.ts +369 -0
  4. package/dist/adapter/AcodeSdkAdapter.js +2 -2
  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 +182 -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/browser-listeners.d.ts +17 -0
  70. package/dist/routes/browser-sessions.d.ts +10 -0
  71. package/dist/routes/capabilities.js +1 -1
  72. package/dist/routes/dashboard-icon.d.ts +9 -0
  73. package/dist/routes/dashboard-icon.js +2 -0
  74. package/dist/routes/dashboard-theme.d.ts +24 -0
  75. package/dist/routes/dashboard-theme.js +157 -0
  76. package/dist/routes/dashboard.d.ts +9 -0
  77. package/dist/routes/dashboard.js +1988 -625
  78. package/dist/routes/debug-mount.d.ts +16 -0
  79. package/dist/routes/desktop-control.d.ts +15 -0
  80. package/dist/routes/desktop-control.js +2 -0
  81. package/dist/routes/events.d.ts +4 -0
  82. package/dist/routes/file-browser.d.ts +11 -0
  83. package/dist/routes/file-change-diff.d.ts +25 -0
  84. package/dist/routes/file-diff-rollback.d.ts +28 -0
  85. package/dist/routes/file-snapshot.d.ts +7 -0
  86. package/dist/routes/git.d.ts +143 -0
  87. package/dist/routes/instance-tool-status.d.ts +5 -0
  88. package/dist/routes/instance.d.ts +8 -0
  89. package/dist/routes/instance.js +1 -1
  90. package/dist/routes/jdks.d.ts +4 -0
  91. package/dist/routes/launch.d.ts +5 -0
  92. package/dist/routes/lsp-providers.d.ts +11 -0
  93. package/dist/routes/lsp-providers.js +2 -0
  94. package/dist/routes/lsp.d.ts +41 -0
  95. package/dist/routes/lsp.js +4 -2
  96. package/dist/routes/mcp-extra.d.ts +15 -0
  97. package/dist/routes/mcp.d.ts +16 -0
  98. package/dist/routes/mcp.js +1 -1
  99. package/dist/routes/plugins.d.ts +19 -0
  100. package/dist/routes/plugins.js +1 -1
  101. package/dist/routes/processes.d.ts +4 -0
  102. package/dist/routes/properties.d.ts +4 -0
  103. package/dist/routes/pty.d.ts +29 -0
  104. package/dist/routes/runtime-binding.d.ts +3 -0
  105. package/dist/routes/sessions.d.ts +22 -0
  106. package/dist/routes/skills.d.ts +15 -0
  107. package/dist/routes/skills.js +1 -1
  108. package/dist/routes/sub-agents.d.ts +11 -0
  109. package/dist/routes/sub-agents.js +1 -1
  110. package/dist/routes/task-context.d.ts +5 -0
  111. package/dist/routes/tech-stack.d.ts +4 -0
  112. package/dist/routes/terminal.d.ts +122 -0
  113. package/dist/routes/terminal.js +16 -16
  114. package/dist/routes/workspace-index.d.ts +12 -0
  115. package/dist/routes/workspace-index.js +2 -0
  116. package/dist/routes/yml.d.ts +4 -0
  117. package/dist/scripts/migrate-user-scopes.d.ts +26 -0
  118. package/dist/scripts/migrate-user-scopes.js +2 -0
  119. package/dist/services/access-control.d.ts +21 -0
  120. package/dist/services/acode-bg-manager.d.ts +21 -0
  121. package/dist/services/acode-package.d.ts +10 -0
  122. package/dist/services/acode-package.js +1 -1
  123. package/dist/services/agent-capability-sync.d.ts +26 -0
  124. package/dist/services/agent-capability-sync.js +1 -1
  125. package/dist/services/agent-event-store.d.ts +20 -0
  126. package/dist/services/agent-ownership.d.ts +58 -0
  127. package/dist/services/agent-ownership.js +3 -0
  128. package/dist/services/agent-process-manager.d.ts +154 -0
  129. package/dist/services/agent-pty-manager.d.ts +37 -0
  130. package/dist/services/agent-startup-memory.d.ts +34 -0
  131. package/dist/services/agent-startup-memory.js +1 -1
  132. package/dist/services/ai-config-service.d.ts +26 -52
  133. package/dist/services/ai-config-service.js +1 -3
  134. package/dist/services/ai-source-apply.d.ts +7 -15
  135. package/dist/services/ai-source-apply.js +1 -1
  136. package/dist/services/auto-register.d.ts +165 -1
  137. package/dist/services/auto-register.js +1 -1
  138. package/dist/services/aws-client-agent-mcp.d.ts +14 -0
  139. package/dist/services/aws-client-agent-mcp.js +2 -2
  140. package/dist/services/bridge-package-publish-hooks.d.ts +14 -0
  141. package/dist/services/bridge-pairing.d.ts +82 -0
  142. package/dist/services/bridge-pairing.js +2 -0
  143. package/dist/services/bridge-temp-files.d.ts +29 -0
  144. package/dist/services/browser-session-manager.d.ts +71 -0
  145. package/dist/services/capability-config.d.ts +60 -15
  146. package/dist/services/capability-config.js +2 -2
  147. package/dist/services/change-cache-retention.d.ts +9 -0
  148. package/dist/services/changelog.d.ts +9 -0
  149. package/dist/services/cli-commands.d.ts +82 -0
  150. package/dist/services/cli-commands.js +6 -6
  151. package/dist/services/connection-key-rotation.d.ts +27 -0
  152. package/dist/services/connection-key-rotation.js +2 -0
  153. package/dist/services/debug-mount.d.ts +49 -0
  154. package/dist/services/desktop-mcp-manager.d.ts +103 -1
  155. package/dist/services/desktop-mcp-manager.js +1 -1
  156. package/dist/services/event-delta-pusher.d.ts +15 -0
  157. package/dist/services/fileSnapshotStore.d.ts +33 -0
  158. package/dist/services/gitignore.d.ts +9 -0
  159. package/dist/services/instance-ai-config-service.d.ts +9 -0
  160. package/dist/services/instance-ai-config-service.js +1 -1
  161. package/dist/services/instance-features.d.ts +127 -0
  162. package/dist/services/instance-features.js +1 -1
  163. package/dist/services/instance-init-service.d.ts +3 -0
  164. package/dist/services/instance-init-service.js +1 -1
  165. package/dist/services/instance-state.d.ts +23 -0
  166. package/dist/services/jdk-scanner.d.ts +15 -0
  167. package/dist/services/launch-manager.d.ts +138 -0
  168. package/dist/services/launch-metrics.d.ts +42 -0
  169. package/dist/services/launch-streams.d.ts +19 -0
  170. package/dist/services/lifecycle-state.d.ts +5 -0
  171. package/dist/services/log-retention.d.ts +38 -0
  172. package/dist/services/lsp/install-manager.d.ts +55 -0
  173. package/dist/services/lsp/install-manager.js +2 -0
  174. package/dist/services/lsp/provider-registry.d.ts +108 -0
  175. package/dist/services/lsp/provider-registry.js +2 -0
  176. package/dist/services/lsp/uri-rewrite.d.ts +44 -0
  177. package/dist/services/lsp/uri-rewrite.js +2 -0
  178. package/dist/services/lsp-stdio-bridge.d.ts +41 -4
  179. package/dist/services/lsp-stdio-bridge.js +3 -3
  180. package/dist/services/mcp-deploy.d.ts +45 -4
  181. package/dist/services/mcp-deploy.js +4 -4
  182. package/dist/services/mcp-env-injector.d.ts +52 -0
  183. package/dist/services/mcp-launch-binding-queue.d.ts +12 -0
  184. package/dist/services/mcp-package.d.ts +22 -0
  185. package/dist/services/mcp-package.js +1 -1
  186. package/dist/services/mcp-probe-client.d.ts +19 -0
  187. package/dist/services/mcp-probe-client.js +1 -1
  188. package/dist/services/open-doc-events.d.ts +22 -0
  189. package/dist/services/open-doc-registry.d.ts +35 -0
  190. package/dist/services/orphan-monitor.d.ts +43 -0
  191. package/dist/services/panel-auth.d.ts +24 -0
  192. package/dist/services/panel-env.d.ts +28 -0
  193. package/dist/services/plugin-deployment.d.ts +34 -1
  194. package/dist/services/plugin-deployment.js +2 -2
  195. package/dist/services/plugin-event-buffer.d.ts +21 -0
  196. package/dist/services/plugin-fs.d.ts +11 -0
  197. package/dist/services/plugin-handler-adapter.d.ts +13 -0
  198. package/dist/services/plugin-listener-runner.d.ts +10 -0
  199. package/dist/services/plugin-loader.d.ts +15 -0
  200. package/dist/services/plugin-manager.d.ts +95 -9
  201. package/dist/services/plugin-manager.js +4 -4
  202. package/dist/services/plugin-manifest.d.ts +14 -0
  203. package/dist/services/plugin-package.d.ts +13 -0
  204. package/dist/services/plugin-runtime.d.ts +15 -0
  205. package/dist/services/port-detector.d.ts +15 -0
  206. package/dist/services/process-detail.d.ts +3 -0
  207. package/dist/services/process-detector.d.ts +132 -0
  208. package/dist/services/process-registry.d.ts +120 -0
  209. package/dist/services/process-top.d.ts +6 -0
  210. package/dist/services/request-identity.d.ts +77 -0
  211. package/dist/services/request-identity.js +2 -0
  212. package/dist/services/request-invalid-dump.d.ts +4 -0
  213. package/dist/services/ring-buffer.d.ts +33 -0
  214. package/dist/services/runtime-binding.d.ts +56 -4
  215. package/dist/services/runtime-binding.js +4 -4
  216. package/dist/services/runtime-lifecycle-policy.d.ts +17 -0
  217. package/dist/services/runtime-resources-snapshot.d.ts +26 -0
  218. package/dist/services/sdk-tool-file-change-recorder.d.ts +9 -0
  219. package/dist/services/session-output.d.ts +63 -0
  220. package/dist/services/session-output.js +3 -3
  221. package/dist/services/skill-manager.d.ts +42 -5
  222. package/dist/services/skill-manager.js +3 -3
  223. package/dist/services/snapshot-retention.d.ts +23 -0
  224. package/dist/services/startup-config-wizard.d.ts +7 -1
  225. package/dist/services/startup-config-wizard.js +10 -10
  226. package/dist/services/system-metrics.d.ts +3 -0
  227. package/dist/services/tech-stack-scanner.d.ts +12 -0
  228. package/dist/services/terminal-persistence.d.ts +43 -0
  229. package/dist/services/tool-installer.d.ts +12 -0
  230. package/dist/services/tunnel-client.d.ts +57 -2
  231. package/dist/services/tunnel-client.js +1 -1
  232. package/dist/services/update-log.d.ts +6 -0
  233. package/dist/services/update-notifier.d.ts +17 -0
  234. package/dist/services/update-notifier.js +2 -2
  235. package/dist/services/user-scope.d.ts +115 -0
  236. package/dist/services/user-scope.js +2 -0
  237. package/dist/services/windows-service-manager.d.ts +12 -0
  238. package/dist/services/workspace-files.d.ts +64 -0
  239. package/dist/services/workspace-index/index-manager.d.ts +46 -0
  240. package/dist/services/workspace-index/index-manager.js +2 -0
  241. package/dist/services/workspace-index/indexer.d.ts +15 -0
  242. package/dist/services/workspace-index/indexer.js +2 -0
  243. package/dist/services/workspace-index/query.d.ts +74 -0
  244. package/dist/services/workspace-index/query.js +5 -0
  245. package/dist/services/workspace-index/resolver.d.ts +26 -0
  246. package/dist/services/workspace-index/resolver.js +2 -0
  247. package/dist/services/workspace-index/types.d.ts +89 -0
  248. package/dist/services/workspace-index/types.js +2 -0
  249. package/dist/services/workspace-watch.d.ts +4 -0
  250. package/dist/services/workspaceTaskChangeWatcher.d.ts +49 -0
  251. package/dist/services/workspaceTaskChangeWatcher.js +1 -1
  252. package/dist/types.d.ts +9 -0
  253. package/dist/utils/config-write-queue.d.ts +11 -0
  254. package/dist/utils/env-safety.d.ts +21 -0
  255. package/dist/utils/file-utils.d.ts +15 -0
  256. package/dist/utils/instance-ai-config-debug-logger.d.ts +15 -0
  257. package/dist/utils/lifecycle-log.d.ts +5 -0
  258. package/dist/utils/logger.d.ts +13 -0
  259. package/dist/utils/logger.js +2 -1
  260. package/dist/utils/npm-version.d.ts +10 -0
  261. package/dist/utils/path-utils.d.ts +12 -0
  262. package/dist/utils/scheduler-url.d.ts +18 -0
  263. package/dist/utils/scheduler-url.js +2 -0
  264. package/dist/utils/sdk-package-loader.d.ts +13 -0
  265. package/dist/utils/sdk-package-loader.js +1 -1
  266. package/dist/utils/target-identity.d.ts +31 -0
  267. package/dist/utils/target-identity.js +2 -0
  268. package/dist/utils/validation.d.ts +17 -0
  269. package/dist/utils/yaml-utils.d.ts +48 -0
  270. package/package/acode/dist/__tests__/summary-request-helper.d.ts +10 -0
  271. package/package/acode/dist/ask-user-question-tool.d.ts +17 -0
  272. package/package/acode/dist/await-complete-tool.d.ts +12 -0
  273. package/package/acode/dist/background-command-manager.d.ts +105 -0
  274. package/package/acode/dist/background-command-store.d.ts +27 -0
  275. package/package/acode/dist/background-command-tools.d.ts +8 -0
  276. package/package/acode/dist/background-output-ringbuffer.d.ts +15 -0
  277. package/package/acode/dist/built-in-file-tools.d.ts +65 -0
  278. package/package/acode/dist/built-in-symbols-tool.d.ts +3 -0
  279. package/package/acode/dist/builtins/commandArtifacts.d.ts +3 -0
  280. package/package/acode/dist/builtins/shellCommandPreparation.d.ts +17 -0
  281. package/package/acode/dist/builtins/shellCommandRunner.d.ts +4 -0
  282. package/package/acode/dist/builtins/shellOutputDecoder.d.ts +15 -0
  283. package/package/acode/dist/cache-control.d.ts +45 -0
  284. package/package/acode/dist/commands/commandLoader.d.ts +3 -0
  285. package/package/acode/dist/commands/commandParser.d.ts +3 -0
  286. package/package/acode/dist/commands/commandRegistry.d.ts +3 -0
  287. package/package/acode/dist/compaction.d.ts +354 -0
  288. package/package/acode/dist/config.d.ts +3 -0
  289. package/package/acode/dist/context-overflow.d.ts +32 -0
  290. package/package/acode/dist/fs-utils.d.ts +18 -0
  291. package/package/acode/dist/hooks/hookBus.d.ts +3 -0
  292. package/package/acode/dist/image-utils.d.ts +35 -0
  293. package/package/acode/dist/index.d.ts +1 -0
  294. package/package/acode/dist/index.js +1 -1
  295. package/package/acode/dist/mcpToolNames.d.ts +32 -0
  296. package/package/acode/dist/microcompact.d.ts +53 -0
  297. package/package/acode/dist/parsers/ast-cache.d.ts +41 -0
  298. package/package/acode/dist/parsers/file-index.d.ts +83 -0
  299. package/package/acode/dist/parsers/file-index.js +4 -0
  300. package/package/acode/dist/parsers/language-detector.d.ts +4 -0
  301. package/package/acode/dist/parsers/tree-sitter-loader.d.ts +12 -0
  302. package/package/acode/dist/parsers/types.d.ts +11 -0
  303. package/package/acode/dist/paths.d.ts +14 -0
  304. package/package/acode/dist/plugin-types.d.ts +34 -0
  305. package/package/acode/dist/read-file-state.d.ts +15 -0
  306. package/package/acode/dist/runtime-environment.d.ts +16 -0
  307. package/package/acode/dist/runtime.d.ts +824 -9
  308. package/package/acode/dist/runtime.js +21 -21
  309. package/package/acode/dist/skill-tool.d.ts +20 -0
  310. package/package/acode/dist/sub-agent-manager.d.ts +169 -0
  311. package/package/acode/dist/sub-agent-manager.js +1 -1
  312. package/package/acode/dist/sub-agent-store.d.ts +50 -0
  313. package/package/acode/dist/sub-agent-tools.d.ts +15 -0
  314. package/package/acode/dist/sub-agent-types.d.ts +13 -0
  315. package/package/acode/dist/terminal-tool.d.ts +15 -0
  316. package/package/acode/dist/terminal-types.d.ts +10 -0
  317. package/package/acode/dist/todo-store.d.ts +15 -0
  318. package/package/acode/dist/token-estimator.d.ts +17 -0
  319. package/package/acode/dist/tool-allocation.d.ts +113 -0
  320. package/package/acode/dist/tool-concurrency/index.d.ts +8 -0
  321. package/package/acode/dist/tool-concurrency/observability.d.ts +32 -0
  322. package/package/acode/dist/tool-concurrency/resource-lock.d.ts +30 -0
  323. package/package/acode/dist/tool-concurrency/scheduler.d.ts +19 -0
  324. package/package/acode/dist/tool-concurrency/types.d.ts +57 -0
  325. package/package/acode/dist/tool-group-manager.d.ts +195 -0
  326. package/package/acode/dist/tool-group-manager.js +4 -4
  327. package/package/acode/dist/types.d.ts +179 -0
  328. package/package/aws-client-agent-mcp/README.md +130 -215
  329. package/package/aws-client-agent-mcp/dist/ability-market-tools.d.ts +57 -0
  330. package/package/aws-client-agent-mcp/dist/agent-client.d.ts +277 -3
  331. package/package/aws-client-agent-mcp/dist/agent-client.js +1 -1
  332. package/package/aws-client-agent-mcp/dist/config.d.ts +18 -0
  333. package/package/aws-client-agent-mcp/dist/constants.d.ts +2 -0
  334. package/package/aws-client-agent-mcp/dist/context-manager.d.ts +70 -0
  335. package/package/aws-client-agent-mcp/dist/http-client.d.ts +61 -0
  336. package/package/aws-client-agent-mcp/dist/index.d.ts +10 -0
  337. package/package/aws-client-agent-mcp/dist/logger.d.ts +24 -0
  338. package/package/aws-client-agent-mcp/dist/mcp-server.d.ts +606 -1
  339. package/package/aws-client-agent-mcp/dist/mcp-server.js +4 -4
  340. package/package/aws-client-agent-mcp/dist/mcp-tools.d.ts +158 -0
  341. package/package/aws-client-agent-mcp/dist/mcp-tools.js +38 -22
  342. package/package/aws-client-agent-mcp/dist/memory-store.d.ts +81 -0
  343. package/package/aws-client-agent-mcp/dist/memory-tools.d.ts +18 -0
  344. package/package/aws-client-agent-mcp/dist/message-buffer.d.ts +86 -0
  345. package/package/aws-client-agent-mcp/dist/messageContent.d.ts +24 -0
  346. package/package/aws-client-agent-mcp/dist/office/office-equation.d.ts +19 -0
  347. package/package/aws-client-agent-mcp/dist/office/office-image.d.ts +18 -0
  348. package/package/aws-client-agent-mcp/dist/office/office-workspace.d.ts +29 -0
  349. package/package/aws-client-agent-mcp/dist/parent-lifecycle.d.ts +18 -0
  350. package/package/aws-client-agent-mcp/dist/runtime-launch-binding.d.ts +6 -0
  351. package/package/aws-client-agent-mcp/dist/server-memory-store.d.ts +4 -0
  352. package/package/aws-client-agent-mcp/dist/status-reporter.d.ts +41 -0
  353. package/package/aws-client-agent-mcp/dist/tool-groups.d.ts +136 -0
  354. package/package/aws-client-agent-mcp/dist/types.d.ts +123 -0
  355. package/package/aws-client-agent-mcp/dist/watchdog.d.ts +7 -0
  356. package/package/aws-client-agent-mcp/dist/websocket-client.d.ts +108 -0
  357. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- import{Client as C}from"@modelcontextprotocol/sdk/client/index.js";import{StdioClientTransport as P}from"@modelcontextprotocol/sdk/client/stdio.js";import{SSEClientTransport as k}from"@modelcontextprotocol/sdk/client/sse.js";import{StreamableHTTPClientTransport as _}from"@modelcontextprotocol/sdk/client/streamableHttp.js";import{mcpDeployManager as f}from"./mcp-deploy.js";import{buildAgentMetaEnv as b,expandEnvPlaceholders as u,expandMcpPackagePlaceholders as v,isBuiltinMcpName as y}from"./mcp-env-injector.js";import{sanitizeEnvForChild as g}from"../utils/env-safety.js";import{createLogger as L}from"../utils/logger.js";const $=L("mcp-probe"),O=1e4,D=1e4;async function N(t,n={}){const e=String(t??"").trim();if(!e)return{ok:!1,name:e,tools:[],error:"name is required"};if(!/^[a-zA-Z0-9_.-]+$/.test(e))return{ok:!1,name:e,tools:[],error:`MCP \u540D\u975E\u6CD5: ${e}`};if(y(e))return{ok:!1,name:e,tools:[],error:`\u300C${e}\u300D\u662F\u5185\u7F6E\u901A\u8BAF MCP\uFF0C\u4E0D\u63A5\u53D7\u63A2\u6D4B`};const m=f.getSpec(e);if(!m)return{ok:!1,name:e,tools:[],error:`\u672A\u5728\u90E8\u7F72\u533A\u627E\u5230\u8BE5 MCP: ${e}\uFF08\u8BF7\u5148\u5B89\u88C5/\u90E8\u7F72\uFF09`};const i=n.connectTimeoutMs??O,s=n.listToolsTimeoutMs??D,r=new C({name:"aws-runtime-bridge-probe",version:"1.0.0"});try{const a=U(m,n.effectiveEnv??{},e,n.agentMeta);await M(r.connect(a),i,`MCP initialize timeout after ${i}ms`);const{tools:c}=await M(r.listTools(),s,`MCP listTools timeout after ${s}ms`),l=r.getInstructions();return{ok:!0,name:e,tools:(c??[]).map(o=>({name:o.name,...o.description?{description:o.description}:{},...o.inputSchema?{inputSchema:o.inputSchema}:{}})),...l?{instructions:l}:{}}}catch(a){const c=a instanceof Error?a.message:String(a);return $.warn(`[mcp] \u63A2\u6D4B\u5931\u8D25: ${e}: ${c}`),{ok:!1,name:e,tools:[],error:c}}finally{try{await r.close()}catch{}}}function U(t,n,e,m){const i=String(t.type??"stdio").toLowerCase();if(i==="stdio"||t.command){if(!t.command)throw new Error("stdio MCP server requires command");const l=g(n),o=g(t.env??{}),d={...l,...o,...b(m)},w=e&&f.isPackageHealthy(e)?f.packageDir(e):void 0,p={command:t.command,args:t.args??[]};v(p,w);const S=u(String(p.command),d),E=p.args.map(h=>u(String(h),d)),T=new P({command:S,args:E,env:d,stderr:"pipe"});return T.stderr?.on("data",()=>{}),T}if(!t.url)throw new Error("remote MCP server requires url");const s=g(n),r=u(t.url,s),a=t.headers?Object.fromEntries(Object.entries(t.headers).map(([l,o])=>[l,u(String(o),s)])):void 0,c=a?{headers:a}:void 0;return i==="sse"?new k(new URL(r),{requestInit:c}):new _(new URL(r),{requestInit:c})}function M(t,n,e){return new Promise((m,i)=>{const s=setTimeout(()=>i(new Error(e)),n);t.then(r=>{clearTimeout(s),m(r)},r=>{clearTimeout(s),i(r instanceof Error?r:new Error(String(r)))})})}export{N as probeDeployedMcp};
1
+ import{Client as k}from"@modelcontextprotocol/sdk/client/index.js";import{SSEClientTransport as _}from"@modelcontextprotocol/sdk/client/sse.js";import{StdioClientTransport as b}from"@modelcontextprotocol/sdk/client/stdio.js";import{StreamableHTTPClientTransport as v}from"@modelcontextprotocol/sdk/client/streamableHttp.js";import{sanitizeEnvForChild as T}from"../utils/env-safety.js";import{createLogger as y}from"../utils/logger.js";import{McpDeployManager as S}from"./mcp-deploy.js";import{buildAgentMetaEnv as $,expandEnvPlaceholders as u,expandMcpPackagePlaceholders as L,isBuiltinMcpName as O}from"./mcp-env-injector.js";const D=y("mcp-probe"),U=1e4,I=1e4;async function B(r,t={}){const e=String(r??"").trim();if(!e)return{ok:!1,name:e,tools:[],error:"name is required"};if(!/^[a-zA-Z0-9_.-]+$/.test(e))return{ok:!1,name:e,tools:[],error:`MCP \u540D\u975E\u6CD5: ${e}`};if(O(e))return{ok:!1,name:e,tools:[],error:`\u300C${e}\u300D\u662F\u5185\u7F6E\u901A\u8BAF MCP\uFF0C\u4E0D\u63A5\u53D7\u63A2\u6D4B`};const c=t.scope?S.forScope(t.scope).getSpec(e):null;if(!c&&!t.scope)return{ok:!1,name:e,tools:[],error:`\u672A\u5728\u90E8\u7F72\u533A\u627E\u5230\u8BE5 MCP: ${e}\uFF08\u7F3A\u7528\u6237\u4F5C\u7528\u57DF\uFF09`};if(!c)return{ok:!1,name:e,tools:[],error:`\u672A\u5728\u90E8\u7F72\u533A\u627E\u5230\u8BE5 MCP: ${e}\uFF08\u8BF7\u5148\u5B89\u88C5/\u90E8\u7F72\uFF09`};const s=t.connectTimeoutMs??U,i=t.listToolsTimeoutMs??I,n=new k({name:"aws-runtime-bridge-probe",version:"1.0.0"});try{const a=q(c,t.effectiveEnv??{},e,t.agentMeta,t.scope);await w(n.connect(a),s,`MCP initialize timeout after ${s}ms`);const{tools:m}=await w(n.listTools(),i,`MCP listTools timeout after ${i}ms`),l=n.getInstructions();return{ok:!0,name:e,tools:(m??[]).map(o=>({name:o.name,...o.description?{description:o.description}:{},...o.inputSchema?{inputSchema:o.inputSchema}:{}})),...l?{instructions:l}:{}}}catch(a){const m=a instanceof Error?a.message:String(a);return D.warn(`[mcp] \u63A2\u6D4B\u5931\u8D25: ${e}: ${m}`),{ok:!1,name:e,tools:[],error:m}}finally{try{await n.close()}catch{}}}function q(r,t,e,c,s){const i=String(r.type??"stdio").toLowerCase();if(i==="stdio"||r.command){if(!r.command)throw new Error("stdio MCP server requires command");const o=T(t),d=T(r.env??{}),f={...o,...d,...$(c)},p=s?S.forScope(s):null,E=p&&e&&p.isPackageHealthy(e)?p.packageDir(e):void 0,g={command:r.command,args:r.args??[]};L(g,E);const h=u(String(g.command),f),C=g.args.map(P=>u(String(P),f)),M=new b({command:h,args:C,env:f,stderr:"pipe"});return M.stderr?.on("data",()=>{}),M}if(!r.url)throw new Error("remote MCP server requires url");const n=T(t),a=u(r.url,n),m=r.headers?Object.fromEntries(Object.entries(r.headers).map(([o,d])=>[o,u(String(d),n)])):void 0,l=m?{headers:m}:void 0;return i==="sse"?new _(new URL(a),{requestInit:l}):new v(new URL(a),{requestInit:l})}function w(r,t,e){return new Promise((c,s)=>{const i=setTimeout(()=>s(new Error(e)),t);r.then(n=>{clearTimeout(i),c(n)},n=>{clearTimeout(i),s(n instanceof Error?n:new Error(String(n)))})})}export{B as probeDeployedMcp};
2
2
 
@@ -1,4 +1,14 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
2
12
  import type { OpenDocKind } from "./open-doc-registry.js";
3
13
 
4
14
  export type OpenDocEvent = {
@@ -16,6 +26,18 @@ export type OpenDocEvent = {
16
26
  docId: string;
17
27
  };
18
28
 
29
+
30
+
31
+
32
+
33
+
19
34
  export declare function normalizeSemanticToolName(raw: string | undefined): string;
20
35
 
36
+
37
+
38
+
39
+
40
+
41
+
42
+
21
43
  export declare function resolveOpenDocEvent(toolName: string | undefined, args: Record<string, unknown> | undefined, result: unknown): OpenDocEvent | null;
@@ -1,5 +1,27 @@
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 type OpenDocKind = "pencil" | "draw" | "office";
4
26
 
5
27
  export interface OpenDocEntry {
@@ -13,10 +35,23 @@ export interface OpenDocEntry {
13
35
  detail?: string;
14
36
  }
15
37
 
38
+
39
+
40
+
41
+
42
+
16
43
  export declare function recordOpenDocument(agentId: string | undefined, entry: OpenDocEntry): void;
17
44
 
45
+
46
+
47
+
18
48
  export declare function closeOpenDocument(agentId: string | undefined, kind: OpenDocKind): void;
19
49
 
50
+
51
+
52
+
53
+
54
+
20
55
  export declare function removeOpenDocument(agentId: string | undefined, kind: OpenDocKind, docId: string): void;
21
56
 
22
57
  export declare function listOpenDocuments(agentId: string | undefined): OpenDocEntry[];
@@ -1,7 +1,15 @@
1
1
 
2
2
 
3
+
4
+
5
+
6
+
7
+
8
+
3
9
  export type OrphanEventType = 'orphan_detected' | 'orphan_cleaned' | 'process_unresponsive' | 'process_high_cpu' | 'process_high_memory' | 'health_check';
4
10
 
11
+
12
+
5
13
  export interface OrphanEvent {
6
14
  type: OrphanEventType;
7
15
  agentId: string;
@@ -11,36 +19,65 @@ export interface OrphanEvent {
11
19
  details?: Record<string, unknown>;
12
20
  }
13
21
 
22
+
23
+
14
24
  export declare class OrphanMonitor {
15
25
  private intervalId;
16
26
  private lastScanTime;
17
27
  private eventListeners;
18
28
  private stopped;
19
29
 
30
+
31
+
20
32
  start(): Promise<void>;
21
33
 
34
+
35
+
22
36
  stop(): void;
23
37
 
38
+
39
+
24
40
  scan(): Promise<void>;
25
41
 
42
+
43
+
26
44
  private handleOrphanDetected;
27
45
 
46
+
47
+
28
48
  private handleHealthIssue;
29
49
 
50
+
51
+
30
52
  private autoCleanOrphan;
31
53
 
54
+
55
+
32
56
  private cleanupDeadSessions;
33
57
 
58
+
59
+
60
+
34
61
  private checkAgentExistsOnServer;
35
62
 
63
+
64
+
36
65
  private reportToScheduler;
37
66
 
67
+
68
+
38
69
  onEvent(listener: (event: OrphanEvent) => void): void;
39
70
 
71
+
72
+
40
73
  offEvent(listener: (event: OrphanEvent) => void): void;
41
74
 
75
+
76
+
42
77
  private emit;
43
78
 
79
+
80
+
44
81
  getStatus(): {
45
82
  running: boolean;
46
83
  lastScanTime: Date | null;
@@ -48,8 +85,14 @@ export declare class OrphanMonitor {
48
85
  };
49
86
  }
50
87
 
88
+
89
+
51
90
  export declare function getOrphanMonitor(): OrphanMonitor;
52
91
 
92
+
93
+
53
94
  export declare function startOrphanMonitor(): Promise<void>;
54
95
 
96
+
97
+
55
98
  export declare function stopOrphanMonitor(): void;
@@ -1,5 +1,12 @@
1
1
 
2
2
 
3
+
4
+
5
+
6
+
7
+
8
+
9
+
3
10
  export declare function createSession(): string;
4
11
 
5
12
  export declare function validateSession(token: string | undefined | null): boolean;
@@ -34,11 +41,28 @@ export declare function validateCredentials(username: string, password: string):
34
41
 
35
42
  export declare function clearCredentialsCache(): void;
36
43
 
44
+
45
+
46
+
47
+
37
48
  export declare function hasConfiguredCredentials(): boolean;
38
49
 
50
+
51
+
39
52
  export declare function isDefaultCredentials(): boolean;
40
53
 
54
+
55
+
56
+
57
+
58
+
41
59
  export declare function setPanelCredentials(username: string, password: string): Promise<void>;
42
60
 
61
+
62
+
63
+
64
+
65
+
66
+
43
67
  export declare function migrateLegacyPanelCredentials(): Promise<boolean>;
44
68
  export {};
@@ -1,12 +1,40 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
2
21
  import type { AgentMetaEnvInput } from "./mcp-env-injector.js";
3
22
 
23
+
24
+
25
+
4
26
  export declare function setPanelEnvVars(agentId: string | undefined, env: unknown): void;
5
27
 
6
28
  export declare function getPanelEnvVars(agentId?: string): Record<string, string>;
7
29
 
30
+
31
+
32
+
8
33
  export declare function setAgentMeta(agentId: string | undefined, meta: unknown): void;
9
34
 
35
+
36
+
37
+
10
38
  export declare function getAgentMeta(agentId?: string): AgentMetaEnvInput | undefined;
11
39
 
12
40
  export declare function clearPanelEnvVars(agentId: string | undefined): void;
@@ -1,19 +1,46 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
2
11
  import type { PluginLoader } from "./plugin-loader.js";
3
12
  import type { SharedPluginEntry } from "./plugin-runtime.js";
4
13
  export declare class PluginDeploymentStore {
5
14
  private readonly rootDir;
6
15
  private readonly runtimeRootDir;
7
16
  private readonly loader;
8
- constructor(rootDir: string, runtimeRootDir: string | undefined, loader: PluginLoader);
17
+
18
+ private readonly legacyRootDir?;
19
+ constructor(rootDir: string, runtimeRootDir: string | undefined, loader: PluginLoader,
20
+
21
+ legacyRootDir?: string | undefined);
9
22
  deployedDir(): string;
10
23
  deployedManifestFile(): string;
11
24
 
25
+ private legacyDeployedDir;
26
+ private legacyDeployedManifestFile;
27
+
28
+
29
+
30
+
31
+
12
32
  deployedPluginDir(name: string): string;
13
33
 
14
34
  private legacySharedDir;
15
35
 
16
36
  deployedPluginHealthy(name: string): boolean;
37
+
38
+ private legacyPluginHealthy;
39
+
40
+
41
+
42
+
43
+ resolveDeployedSourceDir(name: string): string | null;
17
44
  readSharedManifest(): SharedPluginEntry[];
18
45
  writeSharedManifest(entries: SharedPluginEntry[]): void;
19
46
 
@@ -21,12 +48,18 @@ export declare class PluginDeploymentStore {
21
48
 
22
49
  deployPluginZipToPersistentDir(zipBuffer: Buffer, expectedName?: string): Promise<SharedPluginEntry | null>;
23
50
 
51
+
52
+
53
+
24
54
  replaceDeployedDir(pluginName: string, sourceDir: string): void;
25
55
 
26
56
  removeDeployedDir(pluginName: string): void;
27
57
 
28
58
  updateSharedManifest(mutator: (entries: SharedPluginEntry[]) => SharedPluginEntry[]): Promise<void>;
29
59
 
60
+
61
+
62
+
30
63
  runtimeDirFor(agentId: string): string;
31
64
  runtimeLinkPath(agentId: string, name: string): string;
32
65
 
@@ -1,3 +1,3 @@
1
- import{cpSync as S,existsSync as a,lstatSync as P,mkdirSync as h,readFileSync as f,readdirSync as w,renameSync as g,rmSync as u,symlinkSync as M,writeFileSync as v}from"node:fs";import{join as s,resolve as m}from"node:path";import{getBridgeInstancePluginsDir as N}from"../config.js";import{sanitizeAgentId as F,sanitizeArchiveFileName as k,withFileLock as $}from"../utils/file-utils.js";import{createLogger as L}from"../utils/logger.js";import{extractPluginZip as E}from"./plugin-package.js";import{isValidPluginName as D,PLUGIN_NAME_PATTERN as R}from"./plugin-manifest.js";const l=L("plugin-manager"),A=process.platform==="win32"?"junction":"dir";class Z{constructor(r,e,i){this.rootDir=r,this.runtimeRootDir=e,this.loader=i}deployedDir(){return s(this.rootDir,"deployed")}deployedManifestFile(){return s(this.deployedDir(),"manifest.json")}deployedPluginDir(r){if(!D(r))throw new Error(`\u975E\u6CD5\u63D2\u4EF6\u540D\uFF08\u4EC5\u5141\u8BB8 ${R}\uFF09: ${JSON.stringify(r)}`);const e=s(this.deployedDir(),r),i=m(this.deployedDir());if(m(e)!==s(i,r))throw new Error(`\u63D2\u4EF6\u76EE\u5F55\u8D8A\u51FA\u90E8\u7F72\u533A: ${r}`);return e}legacySharedDir(){return s(this.rootDir,"shared")}deployedPluginHealthy(r){return a(s(this.deployedPluginDir(r),"plugin.json"))}readSharedManifest(){try{const r=JSON.parse(f(this.deployedManifestFile(),"utf8"));return Array.isArray(r.plugins)?r.plugins.filter(e=>e&&D(e.pluginName)):[]}catch{return[]}}writeSharedManifest(r){h(this.deployedDir(),{recursive:!0}),v(this.deployedManifestFile(),`${JSON.stringify({version:2,plugins:r},null,2)}
2
- `,"utf8")}async migrateLegacySharedIfNeeded(){try{if(a(this.deployedManifestFile()))return;const r=s(this.legacySharedDir(),"manifest.json");if(!a(r))return;const e=JSON.parse(f(r,"utf8")),i=Array.isArray(e.plugins)?e.plugins:[];if(i.length===0)return;const t=[];let n=0,o=0;for(const d of i){const y=k(d.zipFile,"");if(!d.pluginName||!y)continue;const p=s(this.legacySharedDir(),y);if(a(p)){n+=1;try{const c=await this.deployPluginZipToPersistentDir(f(p),d.pluginName);if(!c){o+=1;continue}t.push(c),l.info("[shared] \u65E7\u5171\u4EAB\u63D2\u4EF6\u8FC1\u79FB\u5230\u90E8\u7F72\u533A: %s",d.pluginName)}catch(c){o+=1,l.warn("[shared] \u65E7\u5171\u4EAB\u63D2\u4EF6 %s \u8FC1\u79FB\u5931\u8D25: %s",d.pluginName,c instanceof Error?c.message:String(c))}}}t.length>0&&this.writeSharedManifest(t),o===0?u(this.legacySharedDir(),{recursive:!0,force:!0}):l.warn("[shared] \u65E7\u5171\u4EAB\u63D2\u4EF6\u8FC1\u79FB\u90E8\u5206\u5931\u8D25\uFF08%d/%d\uFF09\uFF0C\u4FDD\u7559 shared/ \u76EE\u5F55\u4EE5\u514D\u6570\u636E\u4E22\u5931",o,n)}catch(r){l.warn("[shared] \u65E7\u5171\u4EAB\u63D2\u4EF6\u8FC1\u79FB\u672A\u6267\u884C\uFF08\u4E0B\u6B21\u91CD\u8BD5\uFF09: %s",r instanceof Error?r.message:String(r))}}async deployPluginZipToPersistentDir(r,e){if(!r||r.length===0)return null;const i=s(this.rootDir,"tmp",`migrate-${Date.now()}-${Math.random().toString(36).slice(2,8)}`);try{const t=await E(r,i),n=this.loader.loadManifestOnly(t.pluginDir);if(!n.ok)return null;const o=n.manifest.name;return e&&o!==e?null:(this.replaceDeployedDir(o,t.pluginDir),{pluginName:o,zipFile:`${o}.zip`,fileName:`${o}.zip`,defaultEnabled:!0})}finally{u(i,{recursive:!0,force:!0})}}replaceDeployedDir(r,e){h(this.deployedDir(),{recursive:!0});const i=this.deployedPluginDir(r),t=s(this.deployedDir(),`.old-${r}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`);a(i)&&g(i,t);try{S(e,i,{recursive:!0,filter:n=>!/[\\/]\.git([\\/]|$)/.test(n)&&!/[\\/]node_modules([\\/]|$)/.test(n)})}catch(n){throw a(t)&&(u(i,{recursive:!0,force:!0}),g(t,i)),n}a(t)&&u(t,{recursive:!0,force:!0})}removeDeployedDir(r){u(this.deployedPluginDir(r),{recursive:!0,force:!0})}async updateSharedManifest(r){await $(this.deployedManifestFile(),async()=>{this.writeSharedManifest(r(this.readSharedManifest()))})}runtimeDirFor(r){return this.runtimeRootDir?s(this.runtimeRootDir,F(r)):N(r)}runtimeLinkPath(r,e){return s(this.runtimeDirFor(r),e)}ensureRuntimeLink(r,e){const i=this.runtimeLinkPath(r,e),t=this.deployedPluginDir(e);if(!a(s(t,"plugin.json")))return!1;h(this.runtimeDirFor(r),{recursive:!0});try{if(a(i)){let n=!1;try{n=P(i).isSymbolicLink()}catch{n=!1}if(n)try{return w(i),!0}catch{}u(i,{recursive:!0,force:!0})}return M(t,i,A),l.info("[agent:%s] \u63D2\u4EF6\u8FD0\u884C\u65F6\u94FE\u63A5\u5DF2\u5EFA\u7ACB: %s \u2192 %s",r,i,t),!0}catch(n){return l.warn("[agent:%s] \u63D2\u4EF6\u8FD0\u884C\u65F6\u94FE\u63A5\u5931\u8D25\uFF08%s \u2192 %s\uFF09: %s",r,e,t,n instanceof Error?n.message:String(n)),!1}}removeRuntimeLink(r,e){const i=this.runtimeLinkPath(r,e);try{a(i)&&(u(i,{recursive:!0,force:!0}),l.info("[agent:%s] \u63D2\u4EF6\u8FD0\u884C\u65F6\u94FE\u63A5\u5DF2\u79FB\u9664: %s",r,e))}catch(t){l.warn("[agent:%s] \u63D2\u4EF6\u8FD0\u884C\u65F6\u94FE\u63A5\u79FB\u9664\u5931\u8D25\uFF08%s\uFF09: %s",r,e,t instanceof Error?t.message:String(t))}}}export{Z as PluginDeploymentStore};
1
+ import{cpSync as S,existsSync as o,lstatSync as P,mkdirSync as h,readFileSync as d,readdirSync as w,renameSync as D,rmSync as u,symlinkSync as M,writeFileSync as N}from"node:fs";import{join as s,resolve as m}from"node:path";import{getBridgeInstancePluginsDir as v}from"../config.js";import{sanitizeAgentId as F,sanitizeArchiveFileName as k,withFileLock as $}from"../utils/file-utils.js";import{createLogger as L}from"../utils/logger.js";import{isValidPluginName as f,PLUGIN_NAME_PATTERN as R}from"./plugin-manifest.js";import{extractPluginZip as A}from"./plugin-package.js";const a=L("plugin-manager"),E=process.platform==="win32"?"junction":"dir";class x{constructor(e,i,r,t){this.rootDir=e,this.runtimeRootDir=i,this.loader=r,this.legacyRootDir=t}deployedDir(){return s(this.rootDir,"deployed")}deployedManifestFile(){return s(this.deployedDir(),"manifest.json")}legacyDeployedDir(){return this.legacyRootDir?s(this.legacyRootDir,"deployed"):""}legacyDeployedManifestFile(){return this.legacyDeployedDir()?s(this.legacyDeployedDir(),"manifest.json"):""}deployedPluginDir(e){if(!f(e))throw new Error(`\u975E\u6CD5\u63D2\u4EF6\u540D\uFF08\u4EC5\u5141\u8BB8 ${R}\uFF09: ${JSON.stringify(e)}`);const i=s(this.deployedDir(),e),r=m(this.deployedDir());if(m(i)!==s(r,e))throw new Error(`\u63D2\u4EF6\u76EE\u5F55\u8D8A\u51FA\u90E8\u7F72\u533A: ${e}`);return i}legacySharedDir(){return s(this.rootDir,"shared")}deployedPluginHealthy(e){return o(s(this.deployedPluginDir(e),"plugin.json"))||this.legacyPluginHealthy(e)}legacyPluginHealthy(e){if(!this.legacyDeployedDir())return!1;try{const i=s(this.legacyDeployedDir(),e);return o(s(i,"plugin.json"))}catch{return!1}}resolveDeployedSourceDir(e){return o(s(this.deployedPluginDir(e),"plugin.json"))?this.deployedPluginDir(e):this.legacyPluginHealthy(e)?s(this.legacyDeployedDir(),e):null}readSharedManifest(){const e=new Map;if(this.legacyDeployedManifestFile())try{const i=JSON.parse(d(this.legacyDeployedManifestFile(),"utf8"));for(const r of Array.isArray(i.plugins)?i.plugins:[])r&&f(r.pluginName)&&e.set(r.pluginName,r)}catch{}try{const i=JSON.parse(d(this.deployedManifestFile(),"utf8"));for(const r of Array.isArray(i.plugins)?i.plugins:[])r&&f(r.pluginName)&&e.set(r.pluginName,r)}catch{}return[...e.values()]}writeSharedManifest(e){h(this.deployedDir(),{recursive:!0}),N(this.deployedManifestFile(),`${JSON.stringify({version:2,plugins:e},null,2)}
2
+ `,"utf8")}async migrateLegacySharedIfNeeded(){try{if(o(this.deployedManifestFile()))return;const e=s(this.legacySharedDir(),"manifest.json");if(!o(e))return;const i=JSON.parse(d(e,"utf8")),r=Array.isArray(i.plugins)?i.plugins:[];if(r.length===0)return;const t=[];let n=0,l=0;for(const y of r){const g=k(y.zipFile,"");if(!y.pluginName||!g)continue;const p=s(this.legacySharedDir(),g);if(o(p)){n+=1;try{const c=await this.deployPluginZipToPersistentDir(d(p),y.pluginName);if(!c){l+=1;continue}t.push(c),a.info("[shared] \u65E7\u5171\u4EAB\u63D2\u4EF6\u8FC1\u79FB\u5230\u90E8\u7F72\u533A: %s",y.pluginName)}catch(c){l+=1,a.warn("[shared] \u65E7\u5171\u4EAB\u63D2\u4EF6 %s \u8FC1\u79FB\u5931\u8D25: %s",y.pluginName,c instanceof Error?c.message:String(c))}}}t.length>0&&this.writeSharedManifest(t),l===0?u(this.legacySharedDir(),{recursive:!0,force:!0}):a.warn("[shared] \u65E7\u5171\u4EAB\u63D2\u4EF6\u8FC1\u79FB\u90E8\u5206\u5931\u8D25\uFF08%d/%d\uFF09\uFF0C\u4FDD\u7559 shared/ \u76EE\u5F55\u4EE5\u514D\u6570\u636E\u4E22\u5931",l,n)}catch(e){a.warn("[shared] \u65E7\u5171\u4EAB\u63D2\u4EF6\u8FC1\u79FB\u672A\u6267\u884C\uFF08\u4E0B\u6B21\u91CD\u8BD5\uFF09: %s",e instanceof Error?e.message:String(e))}}async deployPluginZipToPersistentDir(e,i){if(!e||e.length===0)return null;const r=s(this.rootDir,"tmp",`migrate-${Date.now()}-${Math.random().toString(36).slice(2,8)}`);try{const t=await A(e,r),n=this.loader.loadManifestOnly(t.pluginDir);if(!n.ok)return null;const l=n.manifest.name;return i&&l!==i?null:(this.replaceDeployedDir(l,t.pluginDir),{pluginName:l,zipFile:`${l}.zip`,fileName:`${l}.zip`,defaultEnabled:!0})}finally{u(r,{recursive:!0,force:!0})}}replaceDeployedDir(e,i){h(this.deployedDir(),{recursive:!0});const r=this.deployedPluginDir(e),t=s(this.deployedDir(),`.old-${e}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`);o(r)&&D(r,t);try{S(i,r,{recursive:!0,filter:n=>!/[\\/]\.git([\\/]|$)/.test(n)&&!/[\\/]node_modules([\\/]|$)/.test(n)})}catch(n){throw o(t)&&(u(r,{recursive:!0,force:!0}),D(t,r)),n}o(t)&&u(t,{recursive:!0,force:!0})}removeDeployedDir(e){u(this.deployedPluginDir(e),{recursive:!0,force:!0})}async updateSharedManifest(e){await $(this.deployedManifestFile(),async()=>{this.writeSharedManifest(e(this.readSharedManifest()))})}runtimeDirFor(e){return this.runtimeRootDir?s(this.runtimeRootDir,F(e)):v(e)}runtimeLinkPath(e,i){return s(this.runtimeDirFor(e),i)}ensureRuntimeLink(e,i){const r=this.runtimeLinkPath(e,i),t=this.resolveDeployedSourceDir(i);if(!t)return!1;h(this.runtimeDirFor(e),{recursive:!0});try{if(o(r)){let n=!1;try{n=P(r).isSymbolicLink()}catch{n=!1}if(n)try{return w(r),!0}catch{}u(r,{recursive:!0,force:!0})}return M(t,r,E),a.info("[agent:%s] \u63D2\u4EF6\u8FD0\u884C\u65F6\u94FE\u63A5\u5DF2\u5EFA\u7ACB: %s \u2192 %s",e,r,t),!0}catch(n){return a.warn("[agent:%s] \u63D2\u4EF6\u8FD0\u884C\u65F6\u94FE\u63A5\u5931\u8D25\uFF08%s \u2192 %s\uFF09: %s",e,i,t,n instanceof Error?n.message:String(n)),!1}}removeRuntimeLink(e,i){const r=this.runtimeLinkPath(e,i);try{o(r)&&(u(r,{recursive:!0,force:!0}),a.info("[agent:%s] \u63D2\u4EF6\u8FD0\u884C\u65F6\u94FE\u63A5\u5DF2\u79FB\u9664: %s",e,i))}catch(t){a.warn("[agent:%s] \u63D2\u4EF6\u8FD0\u884C\u65F6\u94FE\u63A5\u79FB\u9664\u5931\u8D25\uFF08%s\uFF09: %s",e,i,t instanceof Error?t.message:String(t))}}}export{x as PluginDeploymentStore};
3
3
 
@@ -1,4 +1,15 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
2
13
  export type PluginEventPriority = "urgent" | "normal" | "low";
3
14
 
4
15
  export interface PluginEventMessage {
@@ -39,11 +50,21 @@ export declare class PluginEventBuffer {
39
50
  constructor(agentId: string);
40
51
  get currentRevision(): number;
41
52
 
53
+
54
+
55
+
42
56
  push(record: PluginEventRecord): boolean;
43
57
 
58
+
59
+
60
+
44
61
  drain(opts?: PluginEventDrainOptions): PluginEventDrainResult;
45
62
 
46
63
  private dropOldestLowestPriority;
47
64
 
65
+
66
+
67
+
68
+
48
69
  private pruneDedup;
49
70
  }
@@ -1,5 +1,16 @@
1
1
 
2
2
 
3
+
4
+
5
+
6
+
7
+
8
+
3
9
  export declare function rmWithRetry(dir: string, attempts?: number, delayMs?: number): Promise<void>;
4
10
 
11
+
12
+
13
+
14
+
15
+
5
16
  export declare function movePluginDir(sourceDir: string, targetDir: string): Promise<void>;
@@ -1,7 +1,20 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
2
12
  import type { PluginInvokeContext, PluginToolInvocationResult, JsonObject } from "@agentswork/acode";
3
13
  import type { PluginToolDef } from "./plugin-manifest.js";
4
14
  import type { LoadedPlugin } from "./plugin-runtime.js";
5
15
  export declare function executeHandler(agentId: string, plugin: LoadedPlugin, tool: PluginToolDef, params: JsonObject, ctx?: PluginInvokeContext): Promise<PluginToolInvocationResult>;
6
16
 
17
+
18
+
19
+
7
20
  export declare function buildPluginEnv(plugin: LoadedPlugin, agentId: string): NodeJS.ProcessEnv;
@@ -1,4 +1,14 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
2
12
  import type { PluginListenerDef } from "./plugin-manifest.js";
3
13
  import type { AgentState, LoadedPlugin } from "./plugin-runtime.js";
4
14
  export declare class ListenerRunner {
@@ -1,4 +1,16 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
2
14
  import type { PluginSummary } from "@agentswork/acode";
3
15
  import { type PluginManifest, type PluginToolDef } from "./plugin-manifest.js";
4
16
  import type { LoadedPlugin } from "./plugin-runtime.js";
@@ -16,6 +28,9 @@ export declare class PluginLoader {
16
28
 
17
29
  loadManifestOnly(dir: string): ManifestReadResult;
18
30
 
31
+
32
+
33
+
19
34
  validateUserConfigValues(manifest: PluginManifest, configValues: Record<string, string>): string | null;
20
35
 
21
36
  loadPluginFromDir(dir: string, source: string, installedAt: string, configValues: Record<string, string>): {