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,46 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+ import { type IndexQueryResult } from "./query.js";
12
+ import type { IndexBuildOptions, WorkspaceIndexSnapshot } from "./types.js";
13
+ export interface IndexStatus {
14
+ workspacePath: string;
15
+ ready: boolean;
16
+ building: boolean;
17
+ builtAt: number | null;
18
+ truncated: boolean;
19
+ stats: WorkspaceIndexSnapshot["stats"] | null;
20
+ error: string | null;
21
+ }
22
+
23
+
24
+
25
+
26
+ export declare function ensureIndex(workspacePath: string, options?: IndexBuildOptions): Promise<WorkspaceIndexSnapshot>;
27
+
28
+ export declare function getIndexSnapshot(workspacePath: string): WorkspaceIndexSnapshot | null;
29
+
30
+ export declare function getIndexStatus(workspacePath: string): IndexStatus;
31
+
32
+ export declare function isIndexStale(workspacePath: string): boolean;
33
+
34
+ export declare function refreshIndexInBackground(workspacePath: string): void;
35
+
36
+ export declare function dropIndex(workspacePath: string): void;
37
+
38
+ export declare function runIndexQuery(workspacePath: string, params: {
39
+ kind: "definition" | "references" | "symbols" | "outline";
40
+ filePath?: string;
41
+ line?: number;
42
+ column?: number;
43
+ name?: string;
44
+ includeDeclaration?: boolean;
45
+ limit?: number;
46
+ }): Promise<IndexQueryResult>;
@@ -0,0 +1,2 @@
1
+ import y from"node:crypto";import{existsSync as g,promises as d}from"node:fs";import u from"node:path";import{getBridgeDataHome as k}from"../../config.js";import{createLogger as b}from"../../utils/logger.js";import{buildWorkspaceIndex as x}from"./indexer.js";import{queryDefinition as P,queryOutline as S,queryReferences as C,querySymbols as I}from"./query.js";const c=b("workspace-index"),w=1,A=10*6e4,h=new Map;function N(){return u.join(k(),"workspace-index")}function m(t){const e=y.createHash("sha1").update(t).digest("hex").slice(0,16);return u.join(N(),`${e}.json`)}function l(t){return u.resolve(String(t||"").trim())}function f(t){const e=l(t);let n=h.get(e);return n||(n={workspacePath:e,snapshot:null,building:null,error:null,loadedFromCache:!1},h.set(e,n)),n}function v(t){return{version:w,workspacePath:t.workspacePath,builtAt:t.builtAt,truncated:t.truncated,stats:t.stats,files:[...t.files.values()]}}function $(t){const e=new Map,n=new Map,i=new Map;for(const r of t.files){e.set(r.filePath,r);for(const s of r.symbols){const o=s.name.trim().toLowerCase();if(!o)continue;const a=n.get(o);a?a.push(s):n.set(o,[s])}for(const s of r.identifierNames){const o=s.trim().toLowerCase();if(!o)continue;const a=i.get(o);a?a.add(r.filePath):i.set(o,new Set([r.filePath]))}}return{workspacePath:t.workspacePath,builtAt:t.builtAt,files:e,byName:n,filesByIdentifier:i,truncated:t.truncated,stats:t.stats}}async function F(t){const e=m(t);if(!g(e))return null;try{const n=await d.readFile(e,"utf8"),i=JSON.parse(n);return i.version!==w||l(i.workspacePath)!==l(t)?null:$(i)}catch(n){return c.warn(`[workspace-index] \u8BFB\u53D6\u7F13\u5B58\u5931\u8D25 ${e}: ${n.message}`),null}}async function D(t){const e=m(t.workspacePath);try{await d.mkdir(u.dirname(e),{recursive:!0}),await d.writeFile(e,JSON.stringify(v(t)),"utf8")}catch(n){c.warn(`[workspace-index] \u5199\u5165\u7F13\u5B58\u5931\u8D25 ${e}: ${n.message}`)}}async function p(t,e={}){const n=f(t);if(n.snapshot&&!e.force)return n.snapshot;if(n.building)return n.building;const i=(async()=>{if(!e.force){const r=await F(n.workspacePath);if(r)return c.info(`[workspace-index] \u547D\u4E2D\u78C1\u76D8\u7F13\u5B58 workspace=${n.workspacePath} files=${r.stats.fileCount}`),n.snapshot=r,n.loadedFromCache=!0,n.error=null,r}try{const r=await x(n.workspacePath,e);return n.snapshot=r,n.error=null,n.loadedFromCache=!1,D(r),r}catch(r){throw n.error=r.message,r}finally{n.building=null}})();return n.building=i,i}function M(t){return f(t).snapshot}function B(t){const e=f(t);return{workspacePath:e.workspacePath,ready:e.snapshot!==null,building:e.building!==null,builtAt:e.snapshot?.builtAt??null,truncated:e.snapshot?.truncated??!1,stats:e.snapshot?.stats??null,error:e.error}}function E(t){const e=M(t);return e?Date.now()-e.builtAt>A:!0}function J(t){f(t).building||p(t,{force:!0}).catch(n=>{c.warn(`[workspace-index] \u540E\u53F0\u5237\u65B0\u5931\u8D25: ${n.message}`)})}function R(t){h.delete(l(t))}async function T(t,e){const n=await p(t);return e.kind==="symbols"?I(n,String(e.name||""),e.limit??100):e.kind==="outline"?S(n,{filePath:String(e.filePath||"")}):e.kind==="references"?C(n,{filePath:String(e.filePath||""),line:Number(e.line||1),column:Number(e.column||1),name:e.name,includeDeclaration:e.includeDeclaration!==!1},e.limit??300):P(n,{filePath:String(e.filePath||""),line:Number(e.line||1),column:Number(e.column||1),name:e.name})}export{R as dropIndex,p as ensureIndex,M as getIndexSnapshot,B as getIndexStatus,E as isIndexStale,J as refreshIndexInBackground,T as runIndexQuery};
2
+
@@ -0,0 +1,15 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+ import { type IndexBuildOptions, type WorkspaceIndexSnapshot } from "./types.js";
11
+
12
+
13
+
14
+
15
+ export declare function buildWorkspaceIndex(workspacePath: string, options?: IndexBuildOptions): Promise<WorkspaceIndexSnapshot>;
@@ -0,0 +1,2 @@
1
+ import{promises as k}from"node:fs";import g from"node:path";import{detectLanguage as v,extractFileIndex as C,getParserForLanguage as M}from"@agentswork/acode";import{createLogger as S}from"../../utils/logger.js";import{isIgnoredByGitIgnore as P,loadGitIgnoreRules as T}from"../gitignore.js";import{resolveImports as $}from"./resolver.js";import{DEFAULT_INDEX_OPTIONS as z,INDEX_SKIP_DIRS as L,INDEX_SUPPORTED_EXTENSIONS as _,symbolKey as B,toPosixPath as F}from"./types.js";const D=S("workspace-index"),A=4;async function R(i,n){const s=[];let e=0,r=!1,c=0,t=[];try{t=await T(i)}catch{}const y=[{dir:i,depth:0}];for(;y.length>0;){if(s.length>=n.maxFiles){r=!0;break}const l=y.shift();if(!l)break;if(l.depth>40){e+=1;continue}let h;try{h=await k.readdir(l.dir,{withFileTypes:!0})}catch{e+=1;continue}for(const u of h){const f=g.join(l.dir,u.name);if(u.isDirectory()){if(L.has(u.name))continue;const a=F(g.relative(i,f))+"/";if(P(a,!0,t))continue;y.push({dir:f,depth:l.depth+1});continue}if(!u.isFile())continue;const I=g.extname(u.name).toLowerCase();if(!_.has(I))continue;const d=F(g.relative(i,f));if(P(d,!1,t))continue;let m;try{m=await k.stat(f)}catch{e+=1;continue}if(m.size>n.maxFileBytes){e+=1;continue}if(c+=m.size,c>n.maxTotalBytes){r=!0;break}if(s.push(f),s.length>=n.maxFiles){r=!0;break}}}return{files:s,skipped:e,truncated:r}}async function O(i){const n=v(i);if(!n)return null;let s;try{s=await k.stat(i)}catch{return null}if(!s.isFile())return null;let e;try{e=await k.readFile(i,"utf8")}catch{return null}try{const r=await M(n);if(!r)return null;const c=r.parse(e);if(!c)return null;const t=C(c,n);return c.delete(),{index:t,mtimeMs:s.mtimeMs,size:s.size}}catch(r){return D.debug(`[workspace-index] \u89E3\u6790\u5931\u8D25 ${i}: ${r.message}`),null}}async function X(i,n,s){const e=new Array(i.length);let r=0;const c=Array.from({length:Math.min(n,i.length)},async()=>{for(;;){const t=r;if(r+=1,t>=i.length)return;e[t]=await s(i[t])}});return await Promise.all(c),e}async function H(i,n={}){const s=Date.now(),e=g.resolve(String(i||"").trim()),r={...z,...n.maxFiles!==void 0?{maxFiles:n.maxFiles}:{},...n.maxFileBytes!==void 0?{maxFileBytes:n.maxFileBytes}:{},...n.maxTotalBytes!==void 0?{maxTotalBytes:n.maxTotalBytes}:{}};let c;try{c=await k.stat(e)}catch{throw new Error(`workspace does not exist: ${e}`)}if(!c.isDirectory())throw new Error(`workspace is not a directory: ${e}`);const t=await R(e,r);D.info(`[workspace-index] \u626B\u63CF\u5B8C\u6210 workspace=${e} files=${t.files.length} skipped=${t.skipped} truncated=${t.truncated}`);const y=await X(t.files,A,O),l=new Map,h=new Map,u=new Map,f=new Map;let I=0;for(let d=0;d<t.files.length;d+=1){const m=t.files[d],a=y[d];if(!a)continue;const w=F(g.resolve(m)),E=F(g.relative(e,m)),N=a.index.symbols.map(o=>({name:o.name,kind:o.kind,filePath:w,line:o.line,column:o.column,endLine:o.endLine,endColumn:o.endColumn,signature:o.signature})),b={filePath:w,relativePath:E,language:a.index.language,mtimeMs:a.mtimeMs,size:a.size,symbols:N,imports:[],identifierNames:a.index.identifierNames,packageName:a.index.packageName};l.set(w,b),f.set(w,a.index),I+=N.length;for(const o of N){const p=B(o.name);if(!p)continue;const x=h.get(p);x?x.push(o):h.set(p,[o])}for(const o of a.index.identifierNames){const p=B(o);if(!p)continue;const x=u.get(p);x?x.add(w):u.set(p,new Set([w]))}}for(const[d,m]of l){const a=f.get(d);a&&(m.imports=$({workspaceRoot:F(e),filePath:d,language:a.language,packageName:a.packageName,rawImports:a.imports,files:l}))}return{workspacePath:e,builtAt:Date.now(),files:l,byName:h,filesByIdentifier:u,truncated:t.truncated,stats:{fileCount:l.size,symbolCount:I,skippedCount:t.skipped,durationMs:Date.now()-s}}}export{H as buildWorkspaceIndex};
2
+
@@ -0,0 +1,74 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+ import { type WorkspaceIndexSnapshot } from "./types.js";
17
+ export interface IndexLocation {
18
+
19
+ filePath: string;
20
+
21
+ line: number;
22
+
23
+ column: number;
24
+ endLine: number;
25
+ endColumn: number;
26
+
27
+ name: string;
28
+ kind: string;
29
+
30
+ preview: string;
31
+
32
+ isDeclaration: boolean;
33
+ }
34
+ export interface IndexQueryResult {
35
+ ok: boolean;
36
+ provider: "syntax-index";
37
+ kind: "definition" | "references" | "symbols" | "outline";
38
+
39
+ symbol: string;
40
+ locations: IndexLocation[];
41
+
42
+ truncated: boolean;
43
+
44
+ indexed: boolean;
45
+
46
+ stats?: WorkspaceIndexSnapshot["stats"];
47
+ }
48
+
49
+ export declare function resolveSymbolAtPosition(filePath: string, line: number, column: number): Promise<string | null>;
50
+
51
+ export declare function querySymbols(snapshot: WorkspaceIndexSnapshot, name: string, limit?: number): IndexQueryResult;
52
+
53
+ export declare function queryDefinition(snapshot: WorkspaceIndexSnapshot, params: {
54
+ filePath: string;
55
+ line: number;
56
+ column: number;
57
+ name?: string;
58
+ }): Promise<IndexQueryResult>;
59
+
60
+ export declare function queryReferences(snapshot: WorkspaceIndexSnapshot, params: {
61
+ filePath: string;
62
+ line: number;
63
+ column: number;
64
+ name?: string;
65
+ includeDeclaration?: boolean;
66
+ }, limit?: number): Promise<IndexQueryResult>;
67
+
68
+ export declare function queryOutline(snapshot: WorkspaceIndexSnapshot, params: {
69
+ filePath: string;
70
+ }): Promise<IndexQueryResult>;
71
+
72
+ export declare function readLine(filePath: string, line: number): Promise<string>;
73
+
74
+ export declare function fillPreviews(snapshot: WorkspaceIndexSnapshot, locations: IndexLocation[]): Promise<IndexLocation[]>;
@@ -0,0 +1,5 @@
1
+ import{promises as p}from"node:fs";import m from"node:path";import{detectLanguage as b,findIdentifierOccurrences as I,getParserForLanguage as D,identifierAtPosition as M}from"@agentswork/acode";import{toPosixPath as x}from"./types.js";function C(e,t){if(e.filePath===t.currentFile)return 0;if(t.importedFiles.has(e.filePath))return 1;if(m.dirname(e.filePath)===t.currentDir)return 2;const r=t.files.get(e.filePath);return t.packageName&&r?.packageName===t.packageName?3:4}function N(e,t){return{filePath:x(e.filePath),line:e.line,column:e.column,endLine:e.endLine,endColumn:e.endColumn,name:e.name,kind:e.kind,preview:e.signature,isDeclaration:t}}function S(e,t){return x(m.relative(e.workspacePath,t))}function $(e,t){return{...t,filePath:S(e,t.filePath)}}function O(e,t){return m.resolve(e.workspacePath,t)}async function q(e,t,r){const i=b(e);if(!i)return null;let n;try{n=await p.readFile(e,"utf8")}catch{return null}const a=await D(i);if(!a)return null;const o=a.parse(n);if(!o)return null;try{const d=n.split(`
2
+ `);let f=0;for(let u=0;u<t-1&&u<d.length;u+=1)f+=d[u].length+1;return f+=Math.max(0,r-1),M(o,f,i)}finally{o.delete()}}function j(e,t,r=100){const i=t.trim().toLowerCase(),n=[];let a=!1;if(i)for(const o of e.byName.get(i)??[]){if(n.length>=r){a=!0;break}n.push($(e,N(o,!0)))}return{ok:!0,provider:"syntax-index",kind:"symbols",symbol:t,locations:n,truncated:a,indexed:!0,stats:e.stats}}async function G(e,t){const r=x(m.resolve(e.workspacePath,t.filePath)),i=t.name?.trim()||await q(r,t.line,t.column);if(!i)return{ok:!0,provider:"syntax-index",kind:"definition",symbol:"",locations:[],truncated:!1,indexed:!0,stats:e.stats};const n=e.files.get(r),a=new Set;for(const l of n?.imports??[])l.resolvedFile&&a.add(l.resolvedFile);const o={currentFile:r,currentDir:m.dirname(r),importedFiles:a,packageName:n?.packageName??null,files:e.files},d=e.byName.get(i.trim().toLowerCase())??[],f=[...d].sort((l,y)=>C(l,o)-C(y,o)),u=new Set,s=[];for(const l of f){const y=`${l.filePath}:${l.line}:${l.column}`;if(!u.has(y)&&(u.add(y),s.push($(e,N(l,!0))),s.length>=50))break}return{ok:!0,provider:"syntax-index",kind:"definition",symbol:i,locations:s,truncated:d.length>s.length,indexed:!0,stats:e.stats}}async function H(e,t,r=300){const i=x(m.resolve(e.workspacePath,t.filePath)),n=t.name?.trim()||await q(i,t.line,t.column);if(!n)return{ok:!0,provider:"syntax-index",kind:"references",symbol:"",locations:[],truncated:!1,indexed:!0,stats:e.stats};const a=n.trim().toLowerCase(),o=new Set(e.filesByIdentifier.get(a)??[]);o.add(i);const d=t.includeDeclaration!==!1,f=new Map;for(const c of e.byName.get(a)??[])f.set(`${c.filePath}:${c.line}:${c.column}`,c);const u=e.files.get(i),s=new Set;for(const c of u?.imports??[])c.resolvedFile&&s.add(c.resolvedFile);const l={currentFile:i,currentDir:m.dirname(i),importedFiles:s,packageName:u?.packageName??null,files:e.files},y=[...o].sort((c,k)=>{const h=c===l.currentFile?0:l.importedFiles.has(c)?1:m.dirname(c)===l.currentDir?2:4,v=k===l.currentFile?0:l.importedFiles.has(k)?1:m.dirname(k)===l.currentDir?2:4;return h-v}),w=[];let P=!1;for(const c of y){if(w.length>=r){P=!0;break}const k=b(c);if(!k)continue;let h;try{h=await p.readFile(c,"utf8")}catch{continue}const v=await D(k);if(!v)continue;const L=v.parse(h);if(L)try{const A=I(L,k,n,r);for(const g of A){const B=`${c}:${g.line}:${g.column}`,F=f.get(B);if(!(F&&!d)&&(w.push({filePath:S(e,c),line:g.line,column:g.column,endLine:g.line,endColumn:g.column+n.length,name:F?.name??n,kind:F?.kind??"reference",preview:g.context,isDeclaration:!!F}),w.length>=r)){P=!0;break}}}finally{L.delete()}}return{ok:!0,provider:"syntax-index",kind:"references",symbol:n,locations:w,truncated:P,indexed:!0,stats:e.stats}}async function J(e,t){const r=x(m.resolve(e.workspacePath,t.filePath)),i=e.files.get(r);if(!i){const n=b(r);if(!n)return{ok:!0,provider:"syntax-index",kind:"outline",symbol:"",locations:[],truncated:!1,indexed:!0,stats:e.stats};try{const a=await p.readFile(r,"utf8"),o=await D(n),d=o?.parse(a);if(o&&d){const{extractFileIndex:f}=await import("@agentswork/acode"),u=f(d,n);return d.delete(),{ok:!0,provider:"syntax-index",kind:"outline",symbol:"",locations:u.symbols.map(s=>({filePath:x(t.filePath),line:s.line,column:s.column,endLine:s.endLine,endColumn:s.endColumn,name:s.name,kind:s.kind,preview:s.signature,isDeclaration:!0})),truncated:!1,indexed:!0,stats:e.stats}}}catch{}return{ok:!0,provider:"syntax-index",kind:"outline",symbol:"",locations:[],truncated:!1,indexed:!0,stats:e.stats}}return{ok:!0,provider:"syntax-index",kind:"outline",symbol:"",locations:i.symbols.map(n=>$(e,N(n,!0))),truncated:!1,indexed:!0,stats:e.stats}}async function Q(e,t){try{return((await p.readFile(e,"utf8")).split(`
3
+ `)[t-1]??"").trim().slice(0,200)}catch{return""}}async function T(e,t){const r=new Map,i=[];for(const n of t){if(n.preview){i.push(n);continue}const a=O(e,n.filePath);let o=r.get(a);if(!o){try{o=(await p.readFile(a,"utf8")).split(`
4
+ `)}catch{o=[]}r.set(a,o)}i.push({...n,preview:(o[n.line-1]??"").trim().slice(0,200)})}return i}export{T as fillPreviews,G as queryDefinition,J as queryOutline,H as queryReferences,j as querySymbols,Q as readLine,q as resolveSymbolAtPosition};
5
+
@@ -0,0 +1,26 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+ import { type IndexedFile, type IndexedImport } from "./types.js";
10
+ export interface ResolveImportsInput {
11
+ workspaceRoot: string;
12
+ filePath: string;
13
+ language: string;
14
+ packageName: string | null;
15
+ rawImports: Array<{
16
+ text: string;
17
+ line: number;
18
+ }>;
19
+
20
+ files: Map<string, IndexedFile>;
21
+ }
22
+
23
+
24
+
25
+
26
+ export declare function resolveImports(input: ResolveImportsInput): IndexedImport[];
@@ -0,0 +1,2 @@
1
+ import a from"node:path";import{toPosixPath as k}from"./types.js";const b={typescript:[".ts",".tsx",".mts",".cts",".js",".jsx",".json"],javascript:[".js",".jsx",".mjs",".cjs",".ts",".tsx",".json"],python:[".py",".pyi"],go:[".go"],rust:[".rs"],java:[".java"],c:[".c",".h"],cpp:[".cpp",".cc",".cxx",".hpp",".hxx",".h"],"c-sharp":[".cs"],ruby:[".rb"],php:[".php"],lua:[".lua"]};function $(t){return k(a.resolve(t))}function u(t,s){const i=$(s);if(t.has(i))return i;const r=i.toLowerCase();for(const e of t.keys())if(e.toLowerCase()===r)return e;return null}function j(t,s,i,r){const e=a.dirname(t),o=a.resolve(e,s),c=b[i]??[],l=[o];for(const n of c)l.push(`${o}${n}`);for(const n of c)l.push(a.join(o,`index${n}`));for(const n of c)l.push(a.join(o,`mod${n}`));l.push(a.join(o,"__init__.py"));for(const n of l){const p=u(r,n);if(p)return p}return null}function N(t,s,i){const r=/\bfrom\s+['"]([^'"]+)['"]/.exec(s)??/\bimport\s+['"]([^'"]+)['"]/.exec(s);if(!r)return null;const e=r[1],o=[],c=/\{([^}]*)\}/.exec(s);if(c)for(const p of c[1].split(",")){const f=p.trim().split(/\s+as\s+/)[0]?.trim();f&&o.push(f)}const l=/^import\s+([A-Za-z_$][\w$]*)/.exec(s);l&&o.push(l[1]);const n=/\*\s+as\s+([A-Za-z_$][\w$]*)/.exec(s);return n&&o.push(n[1]),e.startsWith(".")?{text:s,line:0,resolvedFile:j(t,e,"typescript",i),importedNames:o,moduleSpecifier:e}:{text:s,line:0,resolvedFile:null,importedNames:o,moduleSpecifier:e}}function S(t,s,i){const r=/^\s*from\s+([.\w]+)\s+import\s+(.+)$/.exec(s);if(r){const o=r[1],c=r[2].replace(/[()]/g,"").split(",").map(n=>n.trim().split(/\s+as\s+/)[0]?.trim()).filter(Boolean);let l=null;if(o.startsWith(".")){const n=/^\.+/.exec(o)?.[0].length??1,p=o.slice(n).replace(/\./g,"/");let f=a.dirname(t);for(let d=1;d<n;d+=1)f=a.dirname(f);const m=a.join(f,p);l=u(i,`${m}.py`)??u(i,a.join(m,"__init__.py"))}else{const p=o.split(".").join("/");for(const f of i.keys())if(f.endsWith(`/${p}.py`)||f.endsWith(`/${p}/__init__.py`)){l=f;break}}return{text:s,line:0,resolvedFile:l,importedNames:c,moduleSpecifier:o}}const e=/^\s*import\s+(.+)$/.exec(s);if(e){const o=e[1].split(",")[0]?.trim().split(/\s+as\s+/)[0]?.trim();if(!o)return null;const c=o.replace(/\./g,"/");let l=null;for(const n of i.keys())if(n.endsWith(`/${c}.py`)||n.endsWith(`/${c}/__init__.py`)){l=n;break}return{text:s,line:0,resolvedFile:l,importedNames:[o.split(".").pop()??o],moduleSpecifier:o}}return null}function F(t,s,i){const r=/^\s*import\s+(static\s+)?([\w.]+)(?:\.\*)?\s*;/.exec(s);if(!r)return null;const e=!!r[1],o=r[2],c=o.split("."),l=c[c.length-1],n=c.join("/"),p=e?[`${n}.java`,`${c.slice(0,-1).join("/")}.java`]:[`${n}.java`];for(const f of p)for(const m of i.keys())if(m.endsWith(`/${f}`))return{text:s,line:0,resolvedFile:m,importedNames:[l],moduleSpecifier:o};return{text:s,line:0,resolvedFile:null,importedNames:[l],moduleSpecifier:o}}function g(t,s,i){const r=/"([^"]+)"/.exec(s);if(!r)return null;const e=r[1],o=e.split("/").pop()??e;let c=null;for(const l of i.keys())if(!l.endsWith(`/${e}/`)&&(l.includes(`/${e}/`)||l.endsWith(`/${o}/${o}.go`))){c=l;break}return{text:s,line:0,resolvedFile:c,importedNames:o?[o]:[],moduleSpecifier:e}}function x(t,s,i){const r=/^\s*use\s+([^;]+);/.exec(s);if(!r)return null;const e=r[1].trim(),o=e.startsWith("crate::")||e.startsWith("self::")||e.startsWith("super::"),c=[],l=/\{([^}]*)\}/.exec(e);if(l)for(const p of l[1].split(",")){const f=p.trim().split(/\s+as\s+/)[0]?.trim();f&&f!=="self"&&c.push(f.split("::").pop()??f)}else c.push(e.split("::").pop()??e);let n=null;if(o){const p=a.dirname(t),f=e.replace(/^(crate|self|super)::/,"").replace(/\{.*$/,"").split("::").filter(Boolean);for(let m=f.length;m>0;m-=1){const d=f.slice(0,m).join("/"),v=[a.join(p,`${d}.rs`),a.join(p,d,"mod.rs")];for(const y of v){const h=u(i,y);if(h){n=h;break}}if(n)break}}return{text:s,line:0,resolvedFile:n,importedNames:c,moduleSpecifier:e}}function _(t,s,i){const r=/#\s*include\s*[<"]([^>"]+)[>"]/.exec(s);if(!r)return null;const e=r[1],o=a.dirname(t),c=[a.resolve(o,e),a.resolve(o,"..",e)];for(const l of c){const n=u(i,l);if(n)return{text:s,line:0,resolvedFile:n,importedNames:[],moduleSpecifier:e}}for(const l of i.keys())if(l.endsWith(`/${e}`))return{text:s,line:0,resolvedFile:l,importedNames:[],moduleSpecifier:e};return{text:s,line:0,resolvedFile:null,importedNames:[],moduleSpecifier:e}}function P(t){const s=/^\s*using\s+(?:static\s+)?([\w.]+)\s*;/.exec(t);if(!s)return null;const i=s[1],r=[i.split(".").pop()??i];return{text:t,line:0,resolvedFile:null,importedNames:r,moduleSpecifier:i}}function W(t,s,i){const r=/^\s*require(?:_relative)?\s+['"]([^'"]+)['"]/.exec(s);if(!r)return null;const e=r[1],o=a.dirname(t),c=[a.resolve(o,`${e}.rb`),a.resolve(o,e),a.resolve(o,`${e}.rb`)];for(const l of c){const n=u(i,l);if(n)return{text:s,line:0,resolvedFile:n,importedNames:[],moduleSpecifier:e}}for(const l of i.keys())if(l.endsWith(`/${e}.rb`))return{text:s,line:0,resolvedFile:l,importedNames:[],moduleSpecifier:e};return{text:s,line:0,resolvedFile:null,importedNames:[],moduleSpecifier:e}}function I(t,s,i){const r=/^\s*use\s+([\w\\]+)(?:\s+as\s+(\w+))?\s*;/.exec(s);if(!r)return null;const e=r[1].replace(/\\/g,"."),o=e.split("."),c=r[2]||o[o.length-1],l=o.join("/");for(const n of i.keys())if(n.endsWith(`/${l}.php`))return{text:s,line:0,resolvedFile:n,importedNames:[c],moduleSpecifier:e};return{text:s,line:0,resolvedFile:null,importedNames:[c],moduleSpecifier:e}}function w(t,s,i){const r=/require\s*\(?\s*['"]([^'"]+)['"]/.exec(s);if(!r)return null;const e=r[1],o=a.dirname(t),c=e.replace(/\./g,"/"),l=[a.resolve(o,`${c}.lua`),a.resolve(o,`${e}.lua`)];for(const n of l){const p=u(i,n);if(p)return{text:s,line:0,resolvedFile:p,importedNames:[],moduleSpecifier:e}}for(const n of i.keys())if(n.endsWith(`/${c}.lua`))return{text:s,line:0,resolvedFile:n,importedNames:[],moduleSpecifier:e};return{text:s,line:0,resolvedFile:null,importedNames:[],moduleSpecifier:e}}function L(t){const s=[];for(const i of t.rawImports){let r=null;switch(t.language){case"typescript":case"tsx":case"javascript":case"jsx":r=N(t.filePath,i.text,t.files);break;case"python":r=S(t.filePath,i.text,t.files);break;case"java":r=F(t.filePath,i.text,t.files);break;case"go":r=g(t.filePath,i.text,t.files);break;case"rust":r=x(t.filePath,i.text,t.files);break;case"c":case"cpp":r=_(t.filePath,i.text,t.files);break;case"c-sharp":r=P(i.text);break;case"ruby":r=W(t.filePath,i.text,t.files);break;case"php":r=I(t.filePath,i.text,t.files);break;case"lua":r=w(t.filePath,i.text,t.files);break;default:r=null}r&&s.push({...r,line:i.line})}return s}export{L as resolveImports};
2
+
@@ -0,0 +1,89 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+ export interface IndexedSymbol {
14
+ name: string;
15
+ kind: string;
16
+ filePath: string;
17
+
18
+ line: number;
19
+
20
+ column: number;
21
+ endLine: number;
22
+ endColumn: number;
23
+ signature: string;
24
+ }
25
+
26
+ export interface IndexedImport {
27
+
28
+ text: string;
29
+ line: number;
30
+
31
+ resolvedFile: string | null;
32
+
33
+ importedNames: string[];
34
+
35
+ moduleSpecifier: string;
36
+ }
37
+
38
+ export interface IndexedFile {
39
+
40
+ filePath: string;
41
+
42
+ relativePath: string;
43
+ language: string;
44
+ mtimeMs: number;
45
+ size: number;
46
+ symbols: IndexedSymbol[];
47
+ imports: IndexedImport[];
48
+
49
+ identifierNames: string[];
50
+
51
+ packageName: string | null;
52
+ }
53
+ export interface WorkspaceIndexSnapshot {
54
+ workspacePath: string;
55
+
56
+ builtAt: number;
57
+ files: Map<string, IndexedFile>;
58
+
59
+ byName: Map<string, IndexedSymbol[]>;
60
+
61
+ filesByIdentifier: Map<string, Set<string>>;
62
+
63
+ truncated: boolean;
64
+
65
+ stats: {
66
+ fileCount: number;
67
+ symbolCount: number;
68
+ skippedCount: number;
69
+ durationMs: number;
70
+ };
71
+ }
72
+ export interface IndexBuildOptions {
73
+
74
+ maxFiles?: number;
75
+
76
+ maxFileBytes?: number;
77
+
78
+ maxTotalBytes?: number;
79
+
80
+ force?: boolean;
81
+ }
82
+ export declare const DEFAULT_INDEX_OPTIONS: Required<Omit<IndexBuildOptions, "force">>;
83
+
84
+ export declare const INDEX_SKIP_DIRS: Set<string>;
85
+
86
+ export declare const INDEX_SUPPORTED_EXTENSIONS: Set<string>;
87
+ export declare function toPosixPath(value: string): string;
88
+
89
+ export declare function symbolKey(name: string): string;
@@ -0,0 +1,2 @@
1
+ const t={maxFiles:Number(process.env.AWS_WORKSPACE_INDEX_MAX_FILES||2e4),maxFileBytes:Number(process.env.AWS_WORKSPACE_INDEX_MAX_FILE_BYTES||1048576),maxTotalBytes:Number(process.env.AWS_WORKSPACE_INDEX_MAX_TOTAL_BYTES||268435456)},s=new Set([".git",".svn",".hg",".idea",".vscode",".gradle",".next",".nuxt",".turbo",".cache","node_modules","bower_components","vendor","target","dist","build","out","bin","obj","coverage","__pycache__",".venv","venv"]),o=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".py",".go",".rs",".java",".c",".h",".cpp",".cc",".cxx",".hpp",".hxx",".cs",".rb",".php",".lua",".sh",".bash"]);function r(e){return String(e||"").replace(/\\/g,"/")}function _(e){return String(e||"").trim().toLowerCase()}export{t as DEFAULT_INDEX_OPTIONS,s as INDEX_SKIP_DIRS,o as INDEX_SUPPORTED_EXTENSIONS,_ as symbolKey,r as toPosixPath};
2
+
@@ -3,12 +3,16 @@ interface WorkspaceFileWatchParams {
3
3
  filePath: string;
4
4
  }
5
5
 
6
+
7
+
6
8
  export declare function watchWorkspaceFile(params: WorkspaceFileWatchParams): Promise<{
7
9
  ok: true;
8
10
  workspacePath: string;
9
11
  filePath: string;
10
12
  }>;
11
13
 
14
+
15
+
12
16
  export declare function unwatchWorkspaceFile(params: WorkspaceFileWatchParams): Promise<{
13
17
  ok: true;
14
18
  }>;
@@ -1,4 +1,16 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
2
14
  export interface TaskContext {
3
15
  agentId: string;
4
16
  taskInstanceId: string;
@@ -20,30 +32,67 @@ export interface FileChangeRecord {
20
32
  reason: string;
21
33
  }
22
34
 
35
+
36
+
37
+
23
38
  export declare function setTaskContext(ctx: TaskContext): void;
24
39
 
40
+
41
+
42
+
25
43
  export declare function clearTaskContext(): void;
26
44
 
45
+
46
+
27
47
  export declare function getTaskContext(): TaskContext | null;
28
48
 
49
+
50
+
29
51
  export declare function hasActiveTask(): boolean;
30
52
 
53
+
54
+
55
+
31
56
  export declare function startWatching(targetWorkspacePath: string): Promise<void>;
32
57
 
58
+
59
+
33
60
  export declare function stopWatching(): Promise<void>;
34
61
 
62
+
63
+
35
64
  export declare function readBeforeContentFromCache(workspacePath: string, cacheKey: string): Promise<string | null>;
36
65
 
66
+
67
+
37
68
  export declare function readDiffFromCache(workspacePath: string, cacheKey: string): Promise<string | null>;
38
69
 
70
+
71
+
72
+
73
+
74
+
75
+
76
+
39
77
  export declare function sweepExpiredChangeCache(): Promise<void>;
40
78
 
79
+
80
+
41
81
  export declare function getPendingChangeCountForTest(): number;
42
82
 
83
+
84
+
43
85
  export declare function isWatching(): boolean;
44
86
 
87
+
88
+
45
89
  export declare function getWorkspaceRoot(): string;
46
90
 
91
+
92
+
93
+
94
+
95
+
47
96
  export declare function recordAgentFileChange(record: {
48
97
  filePath: string;
49
98
  operation: 'CREATE' | 'UPDATE' | 'DELETE';
@@ -1,4 +1,4 @@
1
- import{createHash as $}from"node:crypto";import{promises as r}from"node:fs";import s from"node:path";import G from"axios";import*as X from"diff";import{resolveSchedulerBaseUrl as J,getRuntimeHomeDir as C}from"../config.js";import{createLogger as V}from"../utils/logger.js";import{getChangeCacheRetentionDays as D,setChangeCacheRetentionDays as Z}from"./change-cache-retention.js";import{getRuntimeAccessToken as H}from"./runtime-binding.js";const h=V("workspace-task-change-watcher"),q=10*1024*1024,Q=".agentswork/change-cache",m="change-cache",Y=60*60*1e3,ee=24*60*60*1e3;let l=null,T=!1,k="",u=null;const g=new Map,d=new Map;let b=!1;function de(e){l&&l.taskNodeId!==e.taskNodeId&&K().catch(()=>{}),l=e,h.info(`Task context set: agent=${e.agentId}, taskInstance=${e.taskInstanceId}, node=${e.taskNodeId}`)}function pe(){l&&(h.info(`Task context cleared: agent=${l.agentId}`),K().catch(()=>{})),l=null}function ge(){return l}function we(){return l!==null}async function Ce(e){const t=s.resolve(e.trim());try{if(!(await r.stat(t)).isDirectory())throw new Error(`Not a directory: ${t}`)}catch{throw new Error(`Workspace path does not exist or inaccessible: ${t}`)}if(u){try{u.close()}catch{}u=null}k=t,T=!0,h.info(`Workspace path set (fs.watch disabled, using tool interception only): ${k}`)}async function me(){if(T=!1,u){try{u.close()}catch{}u=null}g.clear(),d.clear(),k="",h.info("Workspace watch stopped")}function L(e,t,a){return $("sha256").update(`${e||"no-task"}:${t}:${a}`,"utf-8").digest("hex").slice(0,32)}function F(e){return $("sha256").update(s.resolve(e),"utf-8").digest("hex").slice(0,16)}function y(e){return s.join(C(),".aws-bridge",m,F(e))}function te(e){return s.join(C(),m,F(e))}function N(e){return s.join(e,Q)}const W=new Set;async function j(e){if(!W.has(e)){W.add(e);try{const t=N(e),a=y(e);await r.access(t),await r.mkdir(s.dirname(a),{recursive:!0}),await r.rename(t,a),h.info(`Migrated legacy change-cache: ${t} -> ${a}`)}catch{}}}async function v(e,t,a){if(a===null)return;await j(e);const o=y(e);await r.mkdir(o,{recursive:!0});const n=s.join(o,`${t}.before`);await r.writeFile(n,a,"utf-8"),U(),h.debug(`Saved beforeContent cache: ${n}`)}async function _(e,t,a,o){const n=X.createPatch("file",a,o);await j(e);const i=y(e);await r.mkdir(i,{recursive:!0});const c=s.join(i,`${t}.diff`);await r.writeFile(c,n,"utf-8"),U(),h.debug(`Saved diff cache: ${c}`)}async function M(e,t){const a=[s.join(y(e),t),s.join(te(e),t),s.join(N(e),t)];for(const o of a)try{return await r.readFile(o,"utf-8")}catch{}return null}async function ke(e,t){return M(e,`${t}.before`)}async function ye(e,t){return M(e,`${t}.diff`)}let x=0,A=null,P=Promise.resolve();function R(){return P=P.then(()=>ne()),P}async function ne(){const e=D();if(!(e===null||e<=0))try{const t=[s.join(C(),".aws-bridge",m),s.join(C(),m)],a=Date.now()-e*24*60*60*1e3;let o=0;for(const n of t){let i=[];try{i=(await r.readdir(n)).filter(c=>!c.startsWith("."))}catch{continue}for(const c of i){const f=s.join(n,c);try{const p=await r.readdir(f);let w=!0;for(const E of p){if(!E.endsWith(".diff")&&!E.endsWith(".before")){w=!1;continue}const S=s.join(f,E);try{(await r.stat(S)).mtimeMs<a?(await r.unlink(S),o++):w=!1}catch{w=!1}}w&&await r.rmdir(f).catch(()=>{})}catch{}}}o>0&&h.info(`Change-cache TTL sweep: removed ${o} expired file(s), retentionDays=${e}`)}catch(t){h.warn(`Change-cache TTL sweep failed: ${t.message}`)}}function U(){const e=Date.now();e-x>=Y&&(x=e,R().catch(()=>{})),A||(A=setInterval(()=>{R().catch(()=>{})},ee),A.unref?.())}async function B(e){try{return(await r.stat(e)).size>q?null:await r.readFile(e,"utf-8")}catch{return null}}function I(e){return e===null?null:$("sha256").update(e,"utf-8").digest("hex").slice(0,16)}async function ae(e){const t=g.get(e);if(!t)return;g.delete(e),t.timer&&clearTimeout(t.timer);const a=l;if(!a){if(t.operation==="DELETE")d.delete(e);else{const p=await B(e);p!==null&&d.set(e,p)}return}const o=s.relative(a.workspacePath,e).replace(/\\/g,"/");if(o.startsWith(".."))return;let n=t.beforeContent,i=null;t.operation==="DELETE"?(n=n??d.get(e)??null,i=null):(i=await B(e),t.operation==="UPDATE"&&n===null&&(n=d.get(e)??null)),t.operation==="DELETE"?d.delete(e):d.set(e,i);const c=new Date().toISOString(),f=L(a.taskInstanceId,o,c);t.operation==="UPDATE"&&n!==null&&i!==null?await _(a.workspacePath,f,n,i):t.operation==="DELETE"&&await v(a.workspacePath,f,n),await O(a,{workspacePath:a.workspacePath,filePath:o,operation:t.operation,beforeContent:n,afterContent:i,beforeHash:I(n),afterHash:I(i),timestamp:c,reason:z(t.operation,n,i)},f)}async function O(e,t,a){try{const o=J().url,n=H(o)||H();if(!n){h.warn("Cannot send change record: no auth token");return}const i=JSON.stringify({toolRecorded:!0,cacheKey:a,timestamp:t.timestamp}),f=(await G.post(`${o}/api/runtime/callback/task-file-changed`,{agentId:e.agentId,taskInstanceId:e.taskInstanceId,taskNodeId:e.taskNodeId,tenantId:e.tenantId,operation:t.operation,targetType:"FILE",targetPath:t.filePath,beforeHash:t.beforeHash,afterHash:t.afterHash,metadata:i,reason:t.reason,workspacePath:e.workspacePath},{headers:{"X-Runtime-Token":n},timeout:1e4})).data;if(f?.ignored===!0?h.warn(`Change record ignored by server: ${t.filePath} (${t.operation}), reason: ${String(f.reason??"unknown")}`):h.info(`Change record sent: ${t.filePath} (${t.operation})`),f&&f.changeCacheRetentionDays!==void 0){const p=D();Z(f.changeCacheRetentionDays),p!==D()&&(x=0,R().catch(()=>{}))}}catch(o){h.warn(`Failed to send change record: ${o.message}`)}}async function K(){if(b)return;b=!0;const e=Array.from(g.keys());for(const t of e)try{await ae(t)}catch{}b=!1}function Ie(){return g.size}function Ee(){return T&&u!==null}function $e(){return k}function z(e,t,a){const o=t?t.split(`
1
+ import{createHash as E}from"node:crypto";import{promises as r}from"node:fs";import c from"node:path";import X from"axios";import*as J from"diff";import{resolveSchedulerBaseUrl as V,getRuntimeHomeDir as C}from"../config.js";import{createLogger as Z}from"../utils/logger.js";import{getChangeCacheRetentionDays as $,setChangeCacheRetentionDays as q}from"./change-cache-retention.js";import{sweepExpiredSnapshots as Q}from"./fileSnapshotStore.js";import{getRuntimeAccessToken as L}from"./runtime-binding.js";import{getSnapshotRetentionDays as T,setSnapshotRetentionDays as Y}from"./snapshot-retention.js";const h=Z("workspace-task-change-watcher"),ee=10*1024*1024,te=".agentswork/change-cache",m="change-cache",ne=60*60*1e3,ae=24*60*60*1e3;let l=null,b=!1,y="",p=null;const g=new Map,d=new Map;let R=!1;function me(e){l&&l.taskNodeId!==e.taskNodeId&&z().catch(()=>{}),l=e,h.info(`Task context set: agent=${e.agentId}, taskInstance=${e.taskInstanceId}, node=${e.taskNodeId}`)}function ye(){l&&(h.info(`Task context cleared: agent=${l.agentId}`),z().catch(()=>{})),l=null}function ke(){return l}function De(){return l!==null}async function Ie(e){const t=c.resolve(e.trim());try{if(!(await r.stat(t)).isDirectory())throw new Error(`Not a directory: ${t}`)}catch{throw new Error(`Workspace path does not exist or inaccessible: ${t}`)}if(p){try{p.close()}catch{}p=null}y=t,b=!0,h.info(`Workspace path set (fs.watch disabled, using tool interception only): ${y}`)}async function Ee(){if(b=!1,p){try{p.close()}catch{}p=null}g.clear(),d.clear(),y="",h.info("Workspace watch stopped")}function F(e,t,a){return E("sha256").update(`${e||"no-task"}:${t}:${a}`,"utf-8").digest("hex").slice(0,32)}function N(e){return E("sha256").update(c.resolve(e),"utf-8").digest("hex").slice(0,16)}function k(e){return c.join(C(),".aws-bridge",m,N(e))}function oe(e){return c.join(C(),m,N(e))}function W(e){return c.join(e,te)}const j=new Set;async function _(e){if(!j.has(e)){j.add(e);try{const t=W(e),a=k(e);await r.access(t),await r.mkdir(c.dirname(a),{recursive:!0}),await r.rename(t,a),h.info(`Migrated legacy change-cache: ${t} -> ${a}`)}catch{}}}async function v(e,t,a){if(a===null)return;await _(e);const o=k(e);await r.mkdir(o,{recursive:!0});const n=c.join(o,`${t}.before`);await r.writeFile(n,a,"utf-8"),B(),h.debug(`Saved beforeContent cache: ${n}`)}async function M(e,t,a,o){const n=J.createPatch("file",a,o);await _(e);const i=k(e);await r.mkdir(i,{recursive:!0});const f=c.join(i,`${t}.diff`);await r.writeFile(f,n,"utf-8"),B(),h.debug(`Saved diff cache: ${f}`)}async function U(e,t){const a=[c.join(k(e),t),c.join(oe(e),t),c.join(W(e),t)];for(const o of a)try{return await r.readFile(o,"utf-8")}catch{}return null}async function $e(e,t){return U(e,`${t}.before`)}async function Te(e,t){return U(e,`${t}.diff`)}let x=0,S=null,A=Promise.resolve();function P(){return A=A.then(()=>ie()),A}async function ie(){const e=$();if(!(e===null||e<=0))try{const t=[c.join(C(),".aws-bridge",m),c.join(C(),m)],a=Date.now()-e*24*60*60*1e3;let o=0;for(const n of t){let i=[];try{i=(await r.readdir(n)).filter(f=>!f.startsWith("."))}catch{continue}for(const f of i){const s=c.join(n,f);try{const u=await r.readdir(s);let w=!0;for(const I of u){if(!I.endsWith(".diff")&&!I.endsWith(".before")){w=!1;continue}const H=c.join(s,I);try{(await r.stat(H)).mtimeMs<a?(await r.unlink(H),o++):w=!1}catch{w=!1}}w&&await r.rmdir(s).catch(()=>{})}catch{}}}o>0&&h.info(`Change-cache TTL sweep: removed ${o} expired file(s), retentionDays=${e}`)}catch(t){h.warn(`Change-cache TTL sweep failed: ${t.message}`)}}function B(){const e=Date.now();e-x>=ne&&(x=e,P().catch(()=>{})),S||(S=setInterval(()=>{P().catch(()=>{})},ae),S.unref?.())}async function O(e){try{return(await r.stat(e)).size>ee?null:await r.readFile(e,"utf-8")}catch{return null}}function D(e){return e===null?null:E("sha256").update(e,"utf-8").digest("hex").slice(0,16)}async function se(e){const t=g.get(e);if(!t)return;g.delete(e),t.timer&&clearTimeout(t.timer);const a=l;if(!a){if(t.operation==="DELETE")d.delete(e);else{const u=await O(e);u!==null&&d.set(e,u)}return}const o=c.relative(a.workspacePath,e).replace(/\\/g,"/");if(o.startsWith(".."))return;let n=t.beforeContent,i=null;t.operation==="DELETE"?(n=n??d.get(e)??null,i=null):(i=await O(e),t.operation==="UPDATE"&&n===null&&(n=d.get(e)??null)),t.operation==="DELETE"?d.delete(e):d.set(e,i);const f=new Date().toISOString(),s=F(a.taskInstanceId,o,f);t.operation==="UPDATE"&&n!==null&&i!==null?await M(a.workspacePath,s,n,i):t.operation==="DELETE"&&await v(a.workspacePath,s,n),await K(a,{workspacePath:a.workspacePath,filePath:o,operation:t.operation,beforeContent:n,afterContent:i,beforeHash:D(n),afterHash:D(i),timestamp:f,reason:G(t.operation,n,i)},s)}async function K(e,t,a){try{const o=V().url,n=L(o)||L();if(!n){h.warn("Cannot send change record: no auth token");return}const i=JSON.stringify({toolRecorded:!0,cacheKey:a,timestamp:t.timestamp}),s=(await X.post(`${o}/api/runtime/callback/task-file-changed`,{agentId:e.agentId,taskInstanceId:e.taskInstanceId,taskNodeId:e.taskNodeId,tenantId:e.tenantId,operation:t.operation,targetType:"FILE",targetPath:t.filePath,beforeHash:t.beforeHash,afterHash:t.afterHash,metadata:i,reason:t.reason,workspacePath:e.workspacePath},{headers:{"X-Runtime-Token":n},timeout:1e4})).data;if(s?.ignored===!0?h.warn(`Change record ignored by server: ${t.filePath} (${t.operation}), reason: ${String(s.reason??"unknown")}`):h.info(`Change record sent: ${t.filePath} (${t.operation})`),s&&s.changeCacheRetentionDays!==void 0){const u=$();q(s.changeCacheRetentionDays),u!==$()&&(x=0,P().catch(()=>{}))}if(s&&s.snapshotRetentionDays!==void 0){const u=T();Y(s.snapshotRetentionDays),u!==T()&&Q(T()).catch(()=>{})}}catch(o){h.warn(`Failed to send change record: ${o.message}`)}}async function z(){if(R)return;R=!0;const e=Array.from(g.keys());for(const t of e)try{await se(t)}catch{}R=!1}function be(){return g.size}function Re(){return b&&p!==null}function ve(){return y}function G(e,t,a){const o=t?t.split(`
2
2
  `).length:0,n=a?a.split(`
3
- `).length:0;if(e==="CREATE")return`\u521B\u5EFA\u6587\u4EF6\uFF0C\u5171 ${n} \u884C`;if(e==="DELETE")return`\u5220\u9664\u6587\u4EF6\uFF0C\u539F ${o} \u884C`;if(o===n)return`\u4FEE\u6539\u6587\u4EF6\uFF08\u884C\u6570\u4E0D\u53D8\uFF0C${n} \u884C\uFF09`;const i=n-o;return`\u4FEE\u6539\u6587\u4EF6\uFF1A${o} \u884C -> ${n} \u884C\uFF08${i>0?"+":""}${i} \u884C\uFF09`}async function De(e){const t=l,a=e.agentId||t?.agentId,o=e.workspacePath||t?.workspacePath;if(!a||!o){h.warn(`Agent file change skipped (no identity): ${e.filePath} (${e.operation})`);return}h.info(`Recording agent file change: ${e.filePath} (${e.operation}), taskNode=${t?.taskNodeId??"(no task)"}`);const n=t??{agentId:a,taskInstanceId:"",taskNodeId:"",tenantId:"",workspacePath:o,projectId:""},i=new Date().toISOString(),c=L(n.taskInstanceId,e.filePath,i);e.operation==="UPDATE"&&e.beforeContent!==null&&e.afterContent!==null?(await _(n.workspacePath,c,e.beforeContent,e.afterContent),await v(n.workspacePath,c,e.beforeContent)):e.operation==="DELETE"&&await v(n.workspacePath,c,e.beforeContent);const f=e.reason?.trim()||z(e.operation,e.beforeContent,e.afterContent);await O(n,{workspacePath:n.workspacePath,filePath:e.filePath,operation:e.operation,beforeContent:e.beforeContent,afterContent:e.afterContent,beforeHash:I(e.beforeContent),afterHash:I(e.afterContent),timestamp:i,reason:f},c)}export{pe as clearTaskContext,Ie as getPendingChangeCountForTest,ge as getTaskContext,$e as getWorkspaceRoot,we as hasActiveTask,Ee as isWatching,ke as readBeforeContentFromCache,ye as readDiffFromCache,De as recordAgentFileChange,de as setTaskContext,Ce as startWatching,me as stopWatching,R as sweepExpiredChangeCache};
3
+ `).length:0;if(e==="CREATE")return`\u521B\u5EFA\u6587\u4EF6\uFF0C\u5171 ${n} \u884C`;if(e==="DELETE")return`\u5220\u9664\u6587\u4EF6\uFF0C\u539F ${o} \u884C`;if(o===n)return`\u4FEE\u6539\u6587\u4EF6\uFF08\u884C\u6570\u4E0D\u53D8\uFF0C${n} \u884C\uFF09`;const i=n-o;return`\u4FEE\u6539\u6587\u4EF6\uFF1A${o} \u884C -> ${n} \u884C\uFF08${i>0?"+":""}${i} \u884C\uFF09`}async function xe(e){const t=l,a=e.agentId||t?.agentId,o=e.workspacePath||t?.workspacePath;if(!a||!o){h.warn(`Agent file change skipped (no identity): ${e.filePath} (${e.operation})`);return}h.info(`Recording agent file change: ${e.filePath} (${e.operation}), taskNode=${t?.taskNodeId??"(no task)"}`);const n=t??{agentId:a,taskInstanceId:"",taskNodeId:"",tenantId:"",workspacePath:o,projectId:""},i=new Date().toISOString(),f=F(n.taskInstanceId,e.filePath,i);e.operation==="UPDATE"&&e.beforeContent!==null&&e.afterContent!==null?(await M(n.workspacePath,f,e.beforeContent,e.afterContent),await v(n.workspacePath,f,e.beforeContent)):e.operation==="DELETE"&&await v(n.workspacePath,f,e.beforeContent);const s=e.reason?.trim()||G(e.operation,e.beforeContent,e.afterContent);await K(n,{workspacePath:n.workspacePath,filePath:e.filePath,operation:e.operation,beforeContent:e.beforeContent,afterContent:e.afterContent,beforeHash:D(e.beforeContent),afterHash:D(e.afterContent),timestamp:i,reason:s},f)}export{ye as clearTaskContext,be as getPendingChangeCountForTest,ke as getTaskContext,ve as getWorkspaceRoot,De as hasActiveTask,Re as isWatching,$e as readBeforeContentFromCache,Te as readDiffFromCache,xe as recordAgentFileChange,me as setTaskContext,Ie as startWatching,Ee as stopWatching,P as sweepExpiredChangeCache};
4
4
 
package/dist/types.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import type { Request, Response, NextFunction } from 'express';
2
2
 
3
+
4
+
5
+
3
6
  export interface CreateMcpServerInput {
4
7
  name: string;
5
8
  server: McpServerConfig;
@@ -7,6 +10,9 @@ export interface CreateMcpServerInput {
7
10
  apps?: Partial<SdkApps>;
8
11
  }
9
12
 
13
+
14
+
15
+
10
16
  export interface UpdateMcpServerInput {
11
17
  name?: string;
12
18
  server?: McpServerConfig;
@@ -50,6 +56,9 @@ export interface McpPayload {
50
56
 
51
57
  description?: string;
52
58
 
59
+
60
+
61
+
53
62
  packageUrl?: string;
54
63
 
55
64
  packageSha256?: string;
@@ -1,3 +1,14 @@
1
1
 
2
2
 
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
3
14
  export declare function runExclusiveConfigWrite<T>(filePath: string, task: () => T | Promise<T>): Promise<T>;
@@ -1,8 +1,20 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
2
10
  export declare const BLOCKED_ENV_KEYS: ReadonlySet<string>;
3
11
 
4
12
  export declare const ENV_KEY_PATTERN: RegExp;
5
13
 
14
+
15
+
16
+
17
+
6
18
  export declare const SPAWN_ENV_KEY_PATTERN: RegExp;
7
19
 
8
20
  export interface RejectedEnvKey {
@@ -10,6 +22,15 @@ export interface RejectedEnvKey {
10
22
  reason: "blocked" | "invalid-name" | "empty-value";
11
23
  }
12
24
 
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
13
34
  export declare function sanitizeEnvForChild(env: unknown, options?: {
14
35
  onReject?: (item: RejectedEnvKey) => void;
15
36
  }): Record<string, string>;
@@ -3,11 +3,23 @@ export declare function ensureDir(targetDir: string): Promise<string>;
3
3
  export declare function withFileLock<T>(targetPath: string, operation: () => Promise<T>): Promise<T>;
4
4
  export declare function stringifyStableJson(value: unknown): string;
5
5
 
6
+
7
+
8
+
9
+
10
+
11
+
6
12
  export declare function sanitizeAgentId(agentId: string): string;
7
13
 
14
+
15
+
16
+
8
17
  export declare function sanitizeArchiveFileName(fileName: string, fallback: string): string;
9
18
  export declare function atomicWriteFile(targetPath: string, content: string): Promise<void>;
10
19
 
20
+
21
+
22
+
11
23
  export declare function renameFileWithRetry(fromPath: string, toPath: string, attempts?: number): Promise<void>;
12
24
 
13
25
  export declare function atomicWriteFileSync(targetPath: string, content: string): void;
@@ -16,6 +28,9 @@ export declare function downloadSkillZip(skillPackage: SkillPackage, targetDir:
16
28
  export declare function runCommand(command: string, args: string[]): Promise<void>;
17
29
  export declare function escapePowerShellLiteral(text: string): string;
18
30
 
31
+
32
+
33
+
19
34
  export declare function extractSkillZip(zipFilePath: string, extractRootDir: string): Promise<void>;
20
35
  export declare function resolveSkillSourceDirFromExtractRoot(extractRootDir: string): Promise<string>;
21
36
  export declare function downloadPluginZip(pluginPackage: PluginPackage, targetDir: string): Promise<DownloadResult | null>;
@@ -1,4 +1,9 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
2
7
  export interface DebugLogEntry {
3
8
  level: "info" | "warn" | "error";
4
9
  category: string;
@@ -9,13 +14,23 @@ export interface DebugLogEntry {
9
14
  details?: Record<string, unknown>;
10
15
  }
11
16
 
17
+
18
+
19
+
12
20
  export declare class InstanceAiConfigDebugLogger {
13
21
  private readonly logPath;
14
22
  constructor(logPath?: string);
15
23
 
24
+
25
+
26
+
16
27
  log(entry: DebugLogEntry): Promise<void>;
17
28
 
29
+
30
+
18
31
  flush(): Promise<void>;
19
32
  }
20
33
 
34
+
35
+
21
36
  export declare function getInstanceAiConfigDebugLogger(): InstanceAiConfigDebugLogger;
@@ -1,4 +1,9 @@
1
1
 
2
2
  export declare function flushLifecycleLogForTest(): Promise<void>;
3
3
 
4
+
5
+
6
+
7
+
8
+
4
9
  export declare function recordLifecycleEvent(event: string, fields: Record<string, unknown>): void;
@@ -1,8 +1,17 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
2
7
  export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
3
8
 
4
9
  export declare function pushLog(level: LogLevel, prefix: string, message: string): void;
5
10
 
11
+
12
+
13
+
14
+
6
15
  export declare function getRecentLogs(maxCount?: number, filterLevel?: LogLevel): Array<{
7
16
  level: LogLevel;
8
17
  timestamp: string;
@@ -19,6 +28,8 @@ export interface LogConfig {
19
28
  timestamp?: boolean;
20
29
  }
21
30
 
31
+
32
+
22
33
  export declare class Logger {
23
34
  private readonly level;
24
35
  private readonly prefix;
@@ -31,6 +42,8 @@ export declare class Logger {
31
42
  warn(...args: unknown[]): void;
32
43
  error(...args: unknown[]): void;
33
44
 
45
+
46
+
34
47
  child(prefix: string): Logger;
35
48
  }
36
49
  export declare const logger: {