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
@@ -0,0 +1,58 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+ import { type UserScope } from "./user-scope.js";
20
+ export interface AgentOwnerRecord {
21
+ tenantId: string;
22
+ userId: string;
23
+
24
+ operatorUserId?: string;
25
+ updatedAt: string;
26
+ }
27
+
28
+ export declare function invalidateAgentOwner(agentId: string): void;
29
+
30
+ export declare function clearAgentOwnerCache(): void;
31
+
32
+
33
+
34
+
35
+ export declare function registerAgentOwner(agentId: string, scope: UserScope, operatorUserId?: string): AgentOwnerRecord;
36
+
37
+
38
+
39
+
40
+ export declare function getAgentOwner(agentId: string): UserScope | null;
41
+
42
+ export declare function getAgentOwnerRecord(agentId: string): AgentOwnerRecord | null;
43
+
44
+
45
+
46
+
47
+
48
+
49
+ export declare function assertAgentOwnership(agentId: string, scope: UserScope | null | undefined): boolean;
50
+
51
+
52
+
53
+
54
+ export declare function listAgentsOwnedBy(scope: UserScope): string[];
55
+
56
+
57
+
58
+ export declare function removeAgentOwner(agentId: string): void;
@@ -0,0 +1,3 @@
1
+ import{existsSync as p,mkdirSync as m,readdirSync as I,readFileSync as h,rmSync as S,writeFileSync as y}from"node:fs";import u from"node:path";import{getBridgeDataHome as O,getBridgeInstanceRuntimeDir as A}from"../config.js";import{createLogger as x}from"../utils/logger.js";import{normalizeUserScope as w,scopeEquals as a,sanitizeScopeId as j,setAgentOwnershipChecker as k}from"./user-scope.js";const D=x("agent-ownership"),o=new Map;function d(e){return u.join(A(e),"owner.json")}function c(e){return j(e)}function U(e){o.delete(c(e))}function J(){o.clear()}function g(e){const n=d(e);try{if(!p(n))return null;const t=JSON.parse(h(n,"utf8")),r=w(t.tenantId,t.userId);return r?{tenantId:r.tenantId,userId:r.userId,...t.operatorUserId?{operatorUserId:String(t.operatorUserId)}:{},updatedAt:String(t.updatedAt??new Date().toISOString())}:null}catch(t){return D.warn("[ownership] owner.json \u8BFB\u53D6\u5931\u8D25 agent=%s: %s",e,t instanceof Error?t.message:String(t)),null}}function N(e,n,t){const r=w(n.tenantId,n.userId);if(!r)throw new Error("registerAgentOwner: (tenantId, userId) \u4E0D\u5B8C\u6574");const s=f(e);if(s&&!a(s,r))throw new Error("agent-ownership-mismatch: agent \u5DF2\u5F52\u5C5E\u5176\u4ED6\u7528\u6237\uFF0C\u4E0D\u80FD\u8986\u76D6");const i={tenantId:r.tenantId,userId:r.userId,...t?{operatorUserId:t}:{},updatedAt:new Date().toISOString()},l=d(e);return m(u.dirname(l),{recursive:!0}),y(l,`${JSON.stringify(i,null,2)}
2
+ `,"utf8"),o.set(c(e),i),i}function f(e){const n=c(e);if(o.has(n)){const r=o.get(n);return r?{tenantId:r.tenantId,userId:r.userId}:null}const t=g(e);return o.set(n,t),t?{tenantId:t.tenantId,userId:t.userId}:null}function R(e){const n=c(e);if(o.has(n))return o.get(n)??null;const t=g(e);return o.set(n,t),t}function E(e,n){if(!n)return!1;const t=f(e);return t?a(t,n):!1}function q(e){const n=u.join(O(),"instance-runtime");let t=[];try{t=I(n)}catch{return[]}const r=[];for(const s of t){if(s.startsWith("."))continue;const i=f(s);i&&a(i,e)&&r.push(s)}return r}function H(e){try{S(d(e),{force:!0})}catch{}o.delete(c(e))}k((e,n)=>E(e,n));export{E as assertAgentOwnership,J as clearAgentOwnerCache,f as getAgentOwner,R as getAgentOwnerRecord,U as invalidateAgentOwner,q as listAgentsOwnedBy,N as registerAgentOwner,H as removeAgentOwner};
3
+
@@ -1,7 +1,15 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
7
+
2
8
  import { type ProcessInfo, type ProcessHealthStatus } from './process-detector.js';
3
9
  import { type ProcessRecord, type ProcessState, type HealthStatus } from './process-registry.js';
4
10
 
11
+
12
+
5
13
  export interface ProcessConfig {
6
14
  agentId: string;
7
15
  sessionId: string;
@@ -11,11 +19,15 @@ export interface ProcessConfig {
11
19
  command: string;
12
20
  }
13
21
 
22
+
23
+
14
24
  export interface DiscoveredProcess extends ProcessInfo {
15
25
  managementStatus: 'managed' | 'orphan' | 'unknown';
16
26
  sessionId?: string;
17
27
  }
18
28
 
29
+
30
+
19
31
  export interface TerminationResult {
20
32
  success: boolean;
21
33
  agentId: string;
@@ -26,54 +38,163 @@ export interface TerminationResult {
26
38
  message: string;
27
39
  }
28
40
 
41
+
42
+
29
43
  export interface ReclamationResult {
30
44
  success: boolean;
31
45
  pid: number;
32
46
  action: 'adopted' | 'terminated' | 'failed';
33
47
  }
34
48
 
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
35
58
  export declare class AgentProcessManager {
36
59
  private static instance;
37
60
  private readonly registry;
38
61
 
62
+
63
+
39
64
  private constructor();
40
65
 
66
+
67
+
41
68
  static getInstance(): AgentProcessManager;
42
69
 
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
43
80
  startProcess(config: ProcessConfig): Promise<void>;
44
81
 
82
+
83
+
84
+
85
+
86
+
87
+
88
+
45
89
  discoverAllProcesses(): Promise<DiscoveredProcess[]>;
46
90
 
91
+
92
+
93
+
94
+
95
+
96
+
47
97
  healthCheckAll(): Promise<Map<string, ProcessHealthStatus>>;
48
98
 
99
+
100
+
101
+
102
+
103
+
49
104
  healthCheck(agentId: string): Promise<ProcessHealthStatus>;
50
105
 
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
51
117
  stopProcess(agentId: string): Promise<TerminationResult>;
52
118
 
119
+
120
+
53
121
  private sendSigterm;
54
122
 
123
+
124
+
55
125
  private sendForceKill;
56
126
 
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
57
135
  forceKill(agentId: string): Promise<TerminationResult>;
58
136
 
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
59
146
  reclaimOrphan(agentId: string): Promise<ReclamationResult>;
60
147
 
148
+
149
+
150
+
151
+
61
152
  scanAndReclaimAll(): Promise<Array<{
62
153
  agentId: string;
63
154
  pid: number;
64
155
  action: string;
65
156
  }>>;
66
157
 
158
+
159
+
160
+
161
+
162
+
67
163
  markOrphaned(agentId: string): Promise<boolean>;
68
164
 
165
+
166
+
167
+
168
+
169
+
69
170
  isManaged(agentId: string): boolean;
70
171
 
172
+
173
+
174
+
175
+
71
176
  getAllManagedProcesses(): ProcessRecord[];
72
177
 
178
+
179
+
180
+
181
+
182
+
73
183
  getManagedProcessesByState(state: ProcessState): ProcessRecord[];
74
184
 
185
+
186
+
187
+
188
+
75
189
  getUnmanagedProcesses(): Promise<ProcessInfo[]>;
76
190
 
191
+
192
+
193
+
194
+
195
+
196
+
197
+
77
198
  rebuildRegistry(sessions: Array<{
78
199
  agentId: string;
79
200
  sessionId: string;
@@ -83,16 +204,49 @@ export declare class AgentProcessManager {
83
204
  mode?: 'sdk';
84
205
  }>): Promise<void>;
85
206
 
207
+
208
+
209
+
210
+
86
211
  getStats(): Record<ProcessState | 'total', number>;
87
212
 
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
88
223
  cleanupStaleRegistry(): Promise<number>;
89
224
 
225
+
226
+
227
+
228
+
229
+
90
230
  removeProcess(agentId: string): Promise<boolean>;
91
231
 
232
+
233
+
234
+
235
+
236
+
92
237
  getProcess(agentId: string): ProcessRecord | undefined;
93
238
 
239
+
240
+
241
+
242
+
243
+
94
244
  getProcessByPid(pid: number): ProcessRecord | undefined;
95
245
  }
96
246
 
247
+
248
+
249
+
250
+
97
251
  export declare function getAgentProcessManager(): AgentProcessManager;
98
252
  export type { ProcessRecord, ProcessState, HealthStatus, ProcessInfo, ProcessHealthStatus };
@@ -1,6 +1,24 @@
1
1
 
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
2
16
  import type { TerminalManager, TerminalCreateOpts, TerminalReadOpts, TerminalReadResult } from "@agentswork/acode";
3
17
 
18
+
19
+
20
+
21
+
4
22
  export declare function detectNeedsInput(text: string): boolean;
5
23
  export declare class AgentPtyManager implements TerminalManager {
6
24
  private cursors;
@@ -13,8 +31,27 @@ export declare class AgentPtyManager implements TerminalManager {
13
31
  read(id: string, opts: TerminalReadOpts): TerminalReadResult;
14
32
  kill(id: string): void;
15
33
 
34
+
35
+
36
+
37
+
38
+
39
+
40
+
16
41
  killByAgent(agentId: string): void;
17
42
 
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
18
55
  listWaitingForInput(agentId: string): string[];
19
56
  resize(id: string, cols: number, rows: number): void;
20
57
 
@@ -1,11 +1,45 @@
1
1
 
2
2
 
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
3
19
  export interface AgentStartupMemoryOptions {
4
20
  schedulerBaseUrl?: string;
5
21
  runtimeAccessToken?: string;
6
22
  agentId?: string;
7
23
  }
8
24
 
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
9
34
  export declare function loadAgentStartupMemories(workspacePath: string, options?: AgentStartupMemoryOptions): Promise<string | undefined>;
10
35
 
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
11
45
  export declare function buildAgentStartupMemorySnapshot(workspacePath: string, agentId: string | undefined): () => Promise<string | null>;
@@ -1,4 +1,4 @@
1
- import{promises as g}from"node:fs";import p from"node:path";import{resolveSchedulerBaseUrl as y}from"../config.js";import{getRuntimeAccessToken as f}from"./runtime-binding.js";import{createLogger as A}from"../utils/logger.js";const m=A("agent-startup-memory"),d=10;async function S(u,n){const e=[],i=p.join(u,".agentswork","memory");try{const s=(await g.readdir(i)).filter(r=>r.endsWith(".json")),t=await Promise.all(s.map(async r=>{try{const o=await g.readFile(p.join(i,r),"utf-8");return JSON.parse(o)}catch{return m.warn("[loadAgentStartupMemories] Failed to parse memory file: %s",p.join(i,r)),null}}));for(const r of t)if(r?.by_uri)for(const o of Object.values(r.by_uri)){const l=o.memory_type||"memory",h=(o.content||"").trim();h&&l==="instance_hotspot_memory"&&e.push({title:o.title,content:h,uri:o.uri||""})}}catch{m.debug("[loadAgentStartupMemories] \u65E0\u6CD5\u8BFB\u53D6\u8BB0\u5FC6\u76EE\u5F55: %s",i)}if(e.length===0&&n?.schedulerBaseUrl&&n?.runtimeAccessToken&&n?.agentId){const c=`${n.schedulerBaseUrl.replace(/\/+$/,"")}/mcp/call`,s={"Content-Type":"application/json","X-Runtime-Token":n.runtimeAccessToken,Authorization:`Bearer ${n.runtimeAccessToken}`};try{const t=await fetch(c,{method:"POST",headers:s,body:JSON.stringify({tool:"list_memories",arguments:{agentId:n.agentId,memory_type:"instance_hotspot_memory"}})});if(!t.ok)throw new Error(`Server returned ${t.status}`);const r=await t.json();if(Array.isArray(r))for(const o of r){const l=(o.content||"").trim();l&&e.push({title:o.title,content:l,uri:o.uri||""})}e.length>0&&m.info(`[loadAgentStartupMemories] Loaded ${e.length} instance memory(s) from server for ${n.agentId}`)}catch(t){m.warn("[loadAgentStartupMemories] \u4ECE server \u52A0\u8F7D instance_hotspot_memory \u5931\u8D25: %s",t instanceof Error?t.message:String(t))}}e.sort((c,s)=>s.uri.localeCompare(c.uri));const a=[];if(e.length>0){const s=e.slice(0,d).map((t,r)=>`${t.title?`\u3010${t.title}\u3011`:`\u6761\u76EE ${r+1}`}
1
+ import{promises as g}from"node:fs";import p from"node:path";import{resolveSchedulerBaseUrl as y}from"../config.js";import{createLogger as A}from"../utils/logger.js";import{getRuntimeAccessToken as f}from"./runtime-binding.js";const m=A("agent-startup-memory"),d=10;async function S(u,n){const e=[],i=p.join(u,".agentswork","memory");try{const s=(await g.readdir(i)).filter(r=>r.endsWith(".json")),t=await Promise.all(s.map(async r=>{try{const o=await g.readFile(p.join(i,r),"utf-8");return JSON.parse(o)}catch{return m.warn("[loadAgentStartupMemories] Failed to parse memory file: %s",p.join(i,r)),null}}));for(const r of t)if(r?.by_uri)for(const o of Object.values(r.by_uri)){const l=o.memory_type||"memory",h=(o.content||"").trim();h&&l==="instance_hotspot_memory"&&e.push({title:o.title,content:h,uri:o.uri||""})}}catch{m.debug("[loadAgentStartupMemories] \u65E0\u6CD5\u8BFB\u53D6\u8BB0\u5FC6\u76EE\u5F55: %s",i)}if(e.length===0&&n?.schedulerBaseUrl&&n?.runtimeAccessToken&&n?.agentId){const c=`${n.schedulerBaseUrl.replace(/\/+$/,"")}/mcp/call`,s={"Content-Type":"application/json","X-Runtime-Token":n.runtimeAccessToken,Authorization:`Bearer ${n.runtimeAccessToken}`};try{const t=await fetch(c,{method:"POST",headers:s,body:JSON.stringify({tool:"list_memories",arguments:{agentId:n.agentId,memory_type:"instance_hotspot_memory"}})});if(!t.ok)throw new Error(`Server returned ${t.status}`);const r=await t.json();if(Array.isArray(r))for(const o of r){const l=(o.content||"").trim();l&&e.push({title:o.title,content:l,uri:o.uri||""})}e.length>0&&m.info(`[loadAgentStartupMemories] Loaded ${e.length} instance memory(s) from server for ${n.agentId}`)}catch(t){m.warn("[loadAgentStartupMemories] \u4ECE server \u52A0\u8F7D instance_hotspot_memory \u5931\u8D25: %s",t instanceof Error?t.message:String(t))}}e.sort((c,s)=>s.uri.localeCompare(c.uri));const a=[];if(e.length>0){const s=e.slice(0,d).map((t,r)=>`${t.title?`\u3010${t.title}\u3011`:`\u6761\u76EE ${r+1}`}
2
2
  ${t.content}`);a.push(`\u3010\u5B9E\u4F8B\u70ED\u70B9\u8BB0\u5FC6\u3011
3
3
  ${s.join(`
4
4
 
@@ -1,20 +1,25 @@
1
1
 
2
2
 
3
- export declare function createAiConfigService(): AiConfigService;
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+ import { type UserScope } from "./user-scope.js";
14
+
15
+ export declare function createAiConfigService(scope: UserScope): AiConfigService;
4
16
  export interface AiConfigTemplate {
5
17
  baseUrl: string;
6
18
  apiKey: string;
7
19
  model: string;
8
20
  models?: string[];
9
21
  }
10
- export interface ClaudeCodeConfig {
11
- env?: {
12
- ANTHROPIC_BASE_URL?: string;
13
- ANTHROPIC_AUTH_TOKEN?: string;
14
- ANTHROPIC_MODEL?: string;
15
- };
16
- }
17
- export interface OpenCodeProviderConfig {
22
+ export interface AcodeProviderConfig {
18
23
  npm?: string;
19
24
  model?: string;
20
25
  options?: {
@@ -29,56 +34,25 @@ export interface OpenCodeProviderConfig {
29
34
  };
30
35
  }>;
31
36
  }
32
- export interface OpenCodeConfig {
37
+ export interface AcodeConfig {
33
38
  provider?: {
34
- default?: OpenCodeProviderConfig;
39
+ default?: AcodeProviderConfig;
35
40
  };
36
41
  }
37
- export interface CodexModelProviderConfig {
38
- name?: string;
39
- base_url?: string;
40
- wire_api?: "responses" | "chat" | string;
41
- env_key?: string;
42
- env_key_instructions?: string;
43
- requires_openai_auth?: boolean;
44
- }
45
- export interface CodexConfig {
46
- model?: string;
47
- model_provider?: string;
48
- openai_base_url?: string;
49
- model_providers?: Record<string, CodexModelProviderConfig>;
50
- }
51
42
  export interface AiConfigPaths {
52
43
  acodeConfigFile: string;
53
- claudecodeConfigFile: string;
54
- codexConfigFile: string;
55
- opencodeConfigFile: string;
56
44
  }
57
- export declare function buildToolSpecificAiConfig(template: AiConfigTemplate): {
58
- acode: OpenCodeConfig;
59
- claudecode: ClaudeCodeConfig;
60
- codex: CodexConfig;
61
- opencode: OpenCodeConfig;
62
- } | null;
45
+
46
+
47
+
48
+
49
+ export declare function buildAcodeAiConfig(template: AiConfigTemplate): AcodeConfig | null;
63
50
  export declare class AiConfigService {
64
51
  private readonly paths;
65
52
  constructor(paths: AiConfigPaths);
66
- readClaudeCodeConfig(): Promise<ClaudeCodeConfig>;
67
- readAcodeConfig(): Promise<OpenCodeConfig>;
68
- readOpenCodeConfig(): Promise<OpenCodeConfig>;
69
- readCodexConfig(): Promise<CodexConfig>;
70
- writeClaudeCodeConfig(config: ClaudeCodeConfig): Promise<void>;
71
- writeAcodeConfig(config: OpenCodeConfig): Promise<void>;
72
- writeOpenCodeConfig(config: OpenCodeConfig): Promise<void>;
73
- writeCodexConfig(config: CodexConfig): Promise<void>;
74
- applyClaudeCodeConfig(patch: ClaudeCodeConfig): Promise<ClaudeCodeConfig>;
75
- applyOpenCodeConfig(patch: OpenCodeConfig): Promise<OpenCodeConfig>;
76
- applyAcodeConfig(patch: OpenCodeConfig): Promise<OpenCodeConfig>;
77
- applyCodexConfig(patch: CodexConfig): Promise<CodexConfig>;
78
- applyAiConfigTemplate(template: AiConfigTemplate): Promise<{
79
- acode: OpenCodeConfig;
80
- claudecode: ClaudeCodeConfig;
81
- codex: CodexConfig;
82
- opencode: OpenCodeConfig;
83
- } | null>;
53
+ readAcodeConfig(): Promise<AcodeConfig>;
54
+ writeAcodeConfig(config: AcodeConfig): Promise<void>;
55
+ applyAcodeConfig(patch: AcodeConfig): Promise<AcodeConfig>;
56
+
57
+ applyAiConfigTemplate(template: AiConfigTemplate): Promise<AcodeConfig | null>;
84
58
  }
@@ -1,4 +1,2 @@
1
- import{promises as u}from"node:fs";import d from"node:path";import{getBridgeTemplateConfigFile as y,getClaudeConfigFile as v,getCodexConfigFile as w,getOpencodeConfigFile as A,getUserHomeDir as b}from"../config.js";function z(){const o=d.resolve(b());return new T({acodeConfigFile:d.resolve(y()),claudecodeConfigFile:d.resolve(v(o)),codexConfigFile:d.resolve(w(o)),opencodeConfigFile:d.resolve(A(o))})}function x(o){const e=new Set,i=n=>{const r=String(n||"").trim();r&&e.add(r)};return Array.isArray(o.models)&&o.models.forEach(i),i(o.model),[...e]}async function m(o,e){try{const i=await u.readFile(o,"utf-8"),n=JSON.parse(i);return n&&typeof n=="object"&&!Array.isArray(n)?n:{...e}}catch{return{...e}}}async function C(o,e){const i=d.dirname(o);await u.mkdir(i,{recursive:!0}),await u.writeFile(o,JSON.stringify(e,null,2),"utf-8")}function p(o,e){if(!e||typeof e!="object"||Array.isArray(e))return o;const i={...o};for(const[n,r]of Object.entries(e))r!==void 0&&(r!==null&&typeof r=="object"&&!Array.isArray(r)&&i[n]!==null&&typeof i[n]=="object"&&!Array.isArray(i[n])?i[n]=p(i[n],r):i[n]=r);return i}function F(o){return h(o)}function a(o){return String(o||"").replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function _(o){const e=String(o||"").trim();return e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"):e}function O(o){const e=String(o||"").trim().toLowerCase();if(e==="true")return!0;if(e==="false")return!1}function S(o){const e={model_providers:{}};let i=null;for(const n of o.split(/\r?\n/)){const r=n.trim();if(!r||r.startsWith("#"))continue;const s=r.match(/^\[model_providers\.([^\]]+)\]$/);if(s){i=s[1],e.model_providers=e.model_providers||{},e.model_providers[i]=e.model_providers[i]||{};continue}if(r.startsWith("[")){i=null;continue}const c=r.match(/^([A-Za-z0-9_-]+)\s*=\s*(.+)$/);if(!c)continue;const[,t,l]=c;if(i){const f=e.model_providers?.[i]||{};if(t==="requires_openai_auth"){const g=O(l);g!==void 0&&(f.requires_openai_auth=g)}else["name","base_url","wire_api","env_key","env_key_instructions"].includes(t)&&(f[t]=_(l));e.model_providers={...e.model_providers||{},[i]:f};continue}["model","model_provider","openai_base_url"].includes(t)&&(e[t]=_(l))}return e}function $(o){const e=[];o.model&&e.push(`model = "${a(o.model)}"`),o.model_provider&&e.push(`model_provider = "${a(o.model_provider)}"`),o.openai_base_url&&e.push(`openai_base_url = "${a(o.openai_base_url)}"`);const i=o.model_providers||{};for(const[n,r]of Object.entries(i))e.push(""),e.push(`[model_providers.${n}]`),r.name&&e.push(`name = "${a(r.name)}"`),r.base_url&&e.push(`base_url = "${a(r.base_url)}"`),r.wire_api&&e.push(`wire_api = "${a(r.wire_api)}"`),r.env_key&&e.push(`env_key = "${a(r.env_key)}"`),r.env_key_instructions&&e.push(`env_key_instructions = "${a(r.env_key_instructions)}"`),r.requires_openai_auth!==void 0&&e.push(`requires_openai_auth = ${r.requires_openai_auth?"true":"false"}`);return`${e.join(`
2
- `)}
3
- `}function k(o){let e=String(o.baseUrl||"").trim();const i=String(o.apiKey||"").trim(),n=x(o),r=String(o.model||"").trim()||n[0];if(!e||!i||!r)return null;e&&!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`https://${e}`),e=e.replace(/\/+$/,"");const s=h(e),c=F(e),t=Object.fromEntries(n.map(l=>[l,{name:l,modalities:{input:["text","image"],output:["text"]}}]));return{acode:{provider:{default:{npm:"@ai-sdk/openai-compatible",model:r,options:{baseURL:s,apiKey:i},models:t}}},claudecode:{env:{ANTHROPIC_BASE_URL:e,ANTHROPIC_AUTH_TOKEN:i,ANTHROPIC_MODEL:r}},codex:{model:r,model_provider:"default",model_providers:{default:{name:"Default",base_url:c,wire_api:"responses",env_key:"OPENAI_API_KEY",env_key_instructions:"Set OPENAI_API_KEY in your environment"}}},opencode:{provider:{default:{npm:"@ai-sdk/openai-compatible",model:r,options:{baseURL:s,apiKey:i},models:t}}}}}function h(o){const e=String(o||"").trim().replace(/\/+$/,"");return e&&(e.endsWith("/v1")?e:`${e}/v1`)}class T{constructor(e){this.paths=e}async readClaudeCodeConfig(){return m(this.paths.claudecodeConfigFile,{})}async readAcodeConfig(){return m(this.paths.acodeConfigFile,{})}async readOpenCodeConfig(){return m(this.paths.opencodeConfigFile,{})}async readCodexConfig(){try{const e=await u.readFile(this.paths.codexConfigFile,"utf-8");return S(e)}catch{return{}}}async writeClaudeCodeConfig(e){await C(this.paths.claudecodeConfigFile,e)}async writeAcodeConfig(e){await C(this.paths.acodeConfigFile,e)}async writeOpenCodeConfig(e){await C(this.paths.opencodeConfigFile,e)}async writeCodexConfig(e){const i=d.dirname(this.paths.codexConfigFile);await u.mkdir(i,{recursive:!0}),await u.writeFile(this.paths.codexConfigFile,$(e),"utf-8")}async applyClaudeCodeConfig(e){const i=await this.readClaudeCodeConfig(),n=p(i,e);return await this.writeClaudeCodeConfig(n),n}async applyOpenCodeConfig(e){const i=await this.readOpenCodeConfig(),n=p(i,e);return await this.writeOpenCodeConfig(n),n}async applyAcodeConfig(e){const i=await this.readAcodeConfig(),n=p(i,e);return await this.writeAcodeConfig(n),n}async applyCodexConfig(e){const i=await this.readCodexConfig(),n=p(i,e);return await this.writeCodexConfig(n),n}async applyAiConfigTemplate(e){const i=k(e);if(!i)return null;const n=await this.applyAcodeConfig(i.acode),r=await this.applyClaudeCodeConfig(i.claudecode),s=await this.applyCodexConfig(i.codex),c=await this.applyOpenCodeConfig(i.opencode);return{acode:n,claudecode:r,codex:s,opencode:c}}}export{T as AiConfigService,k as buildToolSpecificAiConfig,z as createAiConfigService};
1
+ import{promises as o}from"node:fs";import a from"node:path";import{getUserAiConfigFile as l}from"./user-scope.js";function b(t){return new A({acodeConfigFile:a.resolve(l(t))})}function p(t){const e=new Set,r=i=>{const n=String(i||"").trim();n&&e.add(n)};return Array.isArray(t.models)&&t.models.forEach(r),r(t.model),[...e]}async function u(t,e){try{const r=await o.readFile(t,"utf-8"),i=JSON.parse(r);return i&&typeof i=="object"&&!Array.isArray(i)?i:{...e}}catch{return{...e}}}async function m(t,e){const r=a.dirname(t);await o.mkdir(r,{recursive:!0}),await o.writeFile(t,JSON.stringify(e,null,2),"utf-8")}function c(t,e){if(!e||typeof e!="object"||Array.isArray(e))return t;const r={...t};for(const[i,n]of Object.entries(e))n!==void 0&&(n!==null&&typeof n=="object"&&!Array.isArray(n)&&r[i]!==null&&typeof r[i]=="object"&&!Array.isArray(r[i])?r[i]=c(r[i],n):r[i]=n);return r}function y(t){let e=String(t.baseUrl||"").trim();const r=String(t.apiKey||"").trim(),i=p(t),n=String(t.model||"").trim()||i[0];if(!e||!r||!n)return null;e&&!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`https://${e}`),e=e.replace(/\/+$/,"");const f=g(e),d=Object.fromEntries(i.map(s=>[s,{name:s,modalities:{input:["text","image"],output:["text"]}}]));return{provider:{default:{npm:"@ai-sdk/openai-compatible",model:n,options:{baseURL:f,apiKey:r},models:d}}}}function g(t){const e=String(t||"").trim().replace(/\/+$/,"");return e&&(e.endsWith("/v1")?e:`${e}/v1`)}class A{constructor(e){this.paths=e}async readAcodeConfig(){return u(this.paths.acodeConfigFile,{})}async writeAcodeConfig(e){await m(this.paths.acodeConfigFile,e)}async applyAcodeConfig(e){const r=await this.readAcodeConfig(),i=c(r,e);return await this.writeAcodeConfig(i),i}async applyAiConfigTemplate(e){const r=y(e);return r?this.applyAcodeConfig(r):null}}export{A as AiConfigService,y as buildAcodeAiConfig,b as createAiConfigService};
4
2
 
@@ -1,5 +1,5 @@
1
1
  import type { ToolInstallStatus } from '../types.js';
2
- import { type ClaudeCodeConfig, type CodexConfig, type OpenCodeConfig } from './ai-config-service.js';
2
+ import { type AcodeConfig } from './ai-config-service.js';
3
3
  export interface AiSourceTemplateInput {
4
4
  baseUrl?: unknown;
5
5
  apiKey?: unknown;
@@ -8,18 +8,13 @@ export interface AiSourceTemplateInput {
8
8
  }
9
9
  export interface RequestedAiSources {
10
10
  acode?: unknown;
11
- claudecode?: unknown;
12
- codex?: unknown;
13
- opencode?: unknown;
14
11
  }
15
12
  export interface AiConfigApplier {
16
- applyAcodeConfig(config: OpenCodeConfig): Promise<OpenCodeConfig>;
17
- applyClaudeCodeConfig(config: ClaudeCodeConfig): Promise<ClaudeCodeConfig>;
18
- applyCodexConfig(config: CodexConfig): Promise<CodexConfig>;
19
- applyOpenCodeConfig(config: OpenCodeConfig): Promise<OpenCodeConfig>;
13
+ applyAcodeConfig(config: AcodeConfig): Promise<AcodeConfig>;
20
14
  }
21
15
  export interface ApplyCurrentAiConfigOptions {
22
16
  template: AiSourceTemplateInput | null | undefined;
17
+
23
18
  requestedSources?: RequestedAiSources;
24
19
  toolStatus: Record<string, ToolInstallStatus>;
25
20
  aiConfigService: AiConfigApplier;
@@ -28,17 +23,14 @@ export interface AppliedAiConfigSummary {
28
23
  generatedFromUnifiedTemplate: boolean;
29
24
  applied: {
30
25
  acode: string[];
31
- claudecode: string[];
32
- codex: string[];
33
- opencode: string[];
34
26
  };
35
27
  skippedTools: string[];
36
28
  merged: {
37
- acode: OpenCodeConfig | null;
38
- claudecode: ClaudeCodeConfig | null;
39
- codex: CodexConfig | null;
40
- opencode: OpenCodeConfig | null;
29
+ acode: AcodeConfig | null;
41
30
  };
42
31
  }
43
32
 
33
+
34
+
35
+
44
36
  export declare function applyCurrentAiConfigToInstalledTools(options: ApplyCurrentAiConfigOptions): Promise<AppliedAiConfigSummary>;
@@ -1,2 +1,2 @@
1
- import{buildToolSpecificAiConfig as S}from"./ai-config-service.js";function b(e){return{baseUrl:String(e?.baseUrl||""),apiKey:String(e?.apiKey||""),model:String(e?.model||""),models:Array.isArray(e?.models)?e.models.map(o=>String(o||"").trim()).filter(Boolean):void 0}}function n(e,o){return!!e[o]?.installed}function x(e){return n(e,"claude")||n(e,"claudecode")}function q(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function A(e){return Object.keys(e).length>0}function r(e){return!q(e)||!A(e)?null:e}async function j(e){const o=e.template?S(b(e.template)):null,C=r(e.requestedSources?.acode),g=r(e.requestedSources?.claudecode),m=r(e.requestedSources?.codex),y=r(e.requestedSources?.opencode),d=o?.acode||C,c=o?.claudecode||g,t=o?.codex||m,l=o?.opencode||y,p=Object.values(e.toolStatus).filter(s=>!s.installed).map(s=>s.tool);let a=null,i=null,u=null,f=null;return d&&n(e.toolStatus,"acode")&&(a=await e.aiConfigService.applyAcodeConfig(d)),c&&x(e.toolStatus)&&(i=await e.aiConfigService.applyClaudeCodeConfig(c)),t&&n(e.toolStatus,"codex")&&(u=await e.aiConfigService.applyCodexConfig(t)),l&&n(e.toolStatus,"opencode")&&(f=await e.aiConfigService.applyOpenCodeConfig(l)),{generatedFromUnifiedTemplate:!!o,applied:{acode:d&&a?Object.keys(d):[],claudecode:c&&i?Object.keys(c):[],codex:t&&u?Object.keys(t):[],opencode:l&&f?Object.keys(l):[]},skippedTools:p,merged:{acode:a,claudecode:i,codex:u,opencode:f}}}export{j as applyCurrentAiConfigToInstalledTools};
1
+ import{buildAcodeAiConfig as a}from"./ai-config-service.js";function d(e){return{baseUrl:String(e?.baseUrl||""),apiKey:String(e?.apiKey||""),model:String(e?.model||""),models:Array.isArray(e?.models)?e.models.map(n=>String(n||"").trim()).filter(Boolean):void 0}}function c(e,n){return!!e[n]?.installed}function s(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function f(e){return Object.keys(e).length>0}function u(e){return!s(e)||!f(e)?null:e}async function m(e){const n=e.template?a(d(e.template)):null,i=u(e.requestedSources?.acode),o=n||i,l=Object.values(e.toolStatus).filter(t=>!t.installed).map(t=>t.tool);let r=null;return o&&c(e.toolStatus,"acode")&&(r=await e.aiConfigService.applyAcodeConfig(o)),{generatedFromUnifiedTemplate:!!n,applied:{acode:o&&r?Object.keys(o):[]},skippedTools:l,merged:{acode:r}}}export{m as applyCurrentAiConfigToInstalledTools};
2
2