indusagi 0.12.32 → 0.12.34

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 (1144) hide show
  1. package/CHANGELOG.md +340 -0
  2. package/CREDITS.md +22 -0
  3. package/NOTICE +17 -0
  4. package/README.md +47 -388
  5. package/dist/agent.js +27512 -0
  6. package/dist/ai.js +19758 -0
  7. package/dist/capabilities.js +2663 -0
  8. package/dist/cli.js +11653 -0
  9. package/dist/connectors-saas.js +3289 -0
  10. package/dist/index.js +16533 -0
  11. package/dist/interop.js +3181 -0
  12. package/dist/knowledge/guides/authoring-an-agent.md +53 -0
  13. package/dist/knowledge/guides/choosing-tools.md +49 -0
  14. package/dist/knowledge/guides/model-selection.md +51 -0
  15. package/dist/knowledge/guides/writing-system-prompts.md +53 -0
  16. package/dist/knowledge/index.ts +19 -0
  17. package/dist/knowledge/loader.ts +200 -0
  18. package/dist/knowledge/manifest.json +29 -0
  19. package/dist/llmgateway.js +3209 -0
  20. package/dist/mcp.js +1732 -0
  21. package/dist/memory.js +0 -0
  22. package/dist/react-host/index.js +101 -0
  23. package/dist/react-host/ink.js +97 -0
  24. package/dist/react-host/jsx-runtime.js +95 -0
  25. package/dist/react-ink.js +3821 -0
  26. package/dist/runtime.js +4387 -0
  27. package/dist/shell-app.js +12222 -0
  28. package/dist/smithy.js +7932 -0
  29. package/dist/swarm.js +8717 -0
  30. package/dist/tracing.js +724 -0
  31. package/dist/tui.js +2213 -0
  32. package/dist/types/capabilities/backends/index.d.ts +10 -0
  33. package/dist/types/capabilities/backends/node-backends.d.ts +28 -0
  34. package/dist/types/capabilities/capabilities.test.d.ts +14 -0
  35. package/dist/types/capabilities/files/diff.d.ts +49 -0
  36. package/dist/types/capabilities/files/edit.d.ts +21 -0
  37. package/dist/types/capabilities/files/ls.d.ts +16 -0
  38. package/dist/types/capabilities/files/read.d.ts +15 -0
  39. package/dist/types/capabilities/files/write.d.ts +16 -0
  40. package/dist/types/capabilities/index.d.ts +29 -0
  41. package/dist/types/capabilities/kernel/backends.d.ts +119 -0
  42. package/dist/types/capabilities/kernel/context.d.ts +48 -0
  43. package/dist/types/capabilities/kernel/index.d.ts +24 -0
  44. package/dist/types/capabilities/kernel/output.d.ts +40 -0
  45. package/dist/types/capabilities/kernel/registry.d.ts +61 -0
  46. package/dist/types/capabilities/kernel/spec.d.ts +113 -0
  47. package/dist/types/capabilities/planning/todo.d.ts +62 -0
  48. package/dist/types/capabilities/registry.d.ts +44 -0
  49. package/dist/types/capabilities/search/find.d.ts +33 -0
  50. package/dist/types/capabilities/search/grep.d.ts +30 -0
  51. package/dist/types/capabilities/shell/bash.d.ts +18 -0
  52. package/dist/types/capabilities/shell/process.d.ts +33 -0
  53. package/dist/types/capabilities/web/webfetch.d.ts +25 -0
  54. package/dist/types/capabilities/web/websearch.d.ts +23 -0
  55. package/dist/types/connectors-saas/connectors-saas.test.d.ts +12 -0
  56. package/dist/types/connectors-saas/index.d.ts +16 -0
  57. package/dist/types/connectors-saas/saas/adapter/composio-backend.d.ts +60 -0
  58. package/dist/types/connectors-saas/saas/control/connect.d.ts +114 -0
  59. package/dist/types/connectors-saas/saas/control/tools.d.ts +67 -0
  60. package/dist/types/connectors-saas/saas/core/builder.d.ts +86 -0
  61. package/dist/types/connectors-saas/saas/core/cache.d.ts +53 -0
  62. package/dist/types/connectors-saas/saas/core/index.d.ts +14 -0
  63. package/dist/types/connectors-saas/saas/core/port.d.ts +157 -0
  64. package/dist/types/connectors-saas/saas/core/scope-planner.d.ts +74 -0
  65. package/dist/types/connectors-saas/saas/gateway.d.ts +133 -0
  66. package/dist/types/connectors-saas/saas/render/format.d.ts +54 -0
  67. package/dist/types/connectors-saas/saas/render/index.d.ts +19 -0
  68. package/dist/types/connectors-saas/saas/render/summarizers.d.ts +58 -0
  69. package/dist/types/facade/agent.d.ts +1 -0
  70. package/dist/types/facade/ai.d.ts +1 -0
  71. package/dist/types/facade/bot/actions/bash.d.ts +56 -0
  72. package/dist/types/facade/bot/actions/composio/accounts.d.ts +22 -0
  73. package/dist/types/facade/bot/actions/composio/client.d.ts +39 -0
  74. package/dist/types/facade/bot/actions/composio/connect.d.ts +19 -0
  75. package/dist/types/facade/bot/actions/composio/enable.d.ts +25 -0
  76. package/dist/types/facade/bot/actions/composio/execute.d.ts +26 -0
  77. package/dist/types/facade/bot/actions/composio/helpers.d.ts +16 -0
  78. package/dist/types/facade/bot/actions/composio/index.d.ts +9 -0
  79. package/dist/types/facade/bot/actions/composio/provider.d.ts +8 -0
  80. package/dist/types/facade/bot/actions/composio/toolkits.d.ts +22 -0
  81. package/dist/types/facade/bot/actions/composio/tools.d.ts +28 -0
  82. package/dist/types/facade/bot/actions/composio/types.d.ts +137 -0
  83. package/dist/types/facade/bot/actions/crew/activity-tracker.d.ts +65 -0
  84. package/dist/types/facade/bot/actions/crew/cleanup.d.ts +50 -0
  85. package/dist/types/facade/bot/actions/crew/fs-lock.d.ts +11 -0
  86. package/dist/types/facade/bot/actions/crew/index.d.ts +11 -0
  87. package/dist/types/facade/bot/actions/crew/mailbox.d.ts +20 -0
  88. package/dist/types/facade/bot/actions/crew/model-policy.d.ts +22 -0
  89. package/dist/types/facade/bot/actions/crew/names.d.ts +27 -0
  90. package/dist/types/facade/bot/actions/crew/protocol.d.ts +74 -0
  91. package/dist/types/facade/bot/actions/crew/task-store.d.ts +88 -0
  92. package/dist/types/facade/bot/actions/crew/team-attach-claim.d.ts +35 -0
  93. package/dist/types/facade/bot/actions/crew/team-config.d.ts +54 -0
  94. package/dist/types/facade/bot/actions/crew/worktree.d.ts +39 -0
  95. package/dist/types/facade/bot/actions/edit-diff.d.ts +66 -0
  96. package/dist/types/facade/bot/actions/edit.d.ts +41 -0
  97. package/dist/types/facade/bot/actions/find.d.ts +25 -0
  98. package/dist/types/facade/bot/actions/grep.d.ts +43 -0
  99. package/dist/types/facade/bot/actions/index.d.ts +300 -0
  100. package/dist/types/facade/bot/actions/kit/hook-runner.d.ts +12 -0
  101. package/dist/types/facade/bot/actions/kit/image-resize.d.ts +19 -0
  102. package/dist/types/facade/bot/actions/kit/mime.d.ts +1 -0
  103. package/dist/types/facade/bot/actions/kit/shell.d.ts +12 -0
  104. package/dist/types/facade/bot/actions/ls.d.ts +41 -0
  105. package/dist/types/facade/bot/actions/path-utils.d.ts +8 -0
  106. package/dist/types/facade/bot/actions/process-controller.d.ts +14 -0
  107. package/dist/types/facade/bot/actions/process-manager.d.ts +59 -0
  108. package/dist/types/facade/bot/actions/process-types.d.ts +73 -0
  109. package/dist/types/facade/bot/actions/process.d.ts +37 -0
  110. package/dist/types/facade/bot/actions/read.d.ts +36 -0
  111. package/dist/types/facade/bot/actions/registry.d.ts +20 -0
  112. package/dist/types/facade/bot/actions/todo-store.d.ts +76 -0
  113. package/dist/types/facade/bot/actions/todo-types.d.ts +72 -0
  114. package/dist/types/facade/bot/actions/todo.d.ts +76 -0
  115. package/dist/types/facade/bot/actions/truncate.d.ts +78 -0
  116. package/dist/types/facade/bot/actions/webfetch.d.ts +35 -0
  117. package/dist/types/facade/bot/actions/websearch.d.ts +34 -0
  118. package/dist/types/facade/bot/actions/write.d.ts +30 -0
  119. package/dist/types/facade/bot/agent-loop.d.ts +20 -0
  120. package/dist/types/facade/bot/agent.d.ts +132 -0
  121. package/dist/types/facade/bot/error-handler.d.ts +7 -0
  122. package/dist/types/facade/bot/event-bus.d.ts +8 -0
  123. package/dist/types/facade/bot/index.d.ts +7 -0
  124. package/dist/types/facade/bot/messages.d.ts +83 -0
  125. package/dist/types/facade/bot/proxy.d.ts +70 -0
  126. package/dist/types/facade/bot/session-manager.d.ts +409 -0
  127. package/dist/types/facade/bot/state-manager.d.ts +21 -0
  128. package/dist/types/facade/bot/telemetry.d.ts +6 -0
  129. package/dist/types/facade/bot/types.d.ts +207 -0
  130. package/dist/types/facade/mcp-core/client-pool.d.ts +105 -0
  131. package/dist/types/facade/mcp-core/client.d.ts +157 -0
  132. package/dist/types/facade/mcp-core/config.d.ts +60 -0
  133. package/dist/types/facade/mcp-core/errors.d.ts +103 -0
  134. package/dist/types/facade/mcp-core/index.d.ts +55 -0
  135. package/dist/types/facade/mcp-core/schema-converter.d.ts +67 -0
  136. package/dist/types/facade/mcp-core/server.d.ts +110 -0
  137. package/dist/types/facade/mcp-core/tool-factory.d.ts +62 -0
  138. package/dist/types/facade/mcp-core/types.d.ts +288 -0
  139. package/dist/types/facade/mcp.d.ts +1 -0
  140. package/dist/types/facade/memory.d.ts +1 -0
  141. package/dist/types/facade/ml/adapters/amazon-bedrock.d.ts +32 -0
  142. package/dist/types/facade/ml/adapters/anthropic.d.ts +61 -0
  143. package/dist/types/facade/ml/adapters/azure-openai-responses.d.ts +14 -0
  144. package/dist/types/facade/ml/adapters/google-shared.d.ts +99 -0
  145. package/dist/types/facade/ml/adapters/google-vertex.d.ts +14 -0
  146. package/dist/types/facade/ml/adapters/google.d.ts +15 -0
  147. package/dist/types/facade/ml/adapters/kimi.d.ts +21 -0
  148. package/dist/types/facade/ml/adapters/mock.d.ts +9 -0
  149. package/dist/types/facade/ml/adapters/nvidia.d.ts +12 -0
  150. package/dist/types/facade/ml/adapters/openai-codex-responses.d.ts +8 -0
  151. package/dist/types/facade/ml/adapters/openai-completions.d.ts +24 -0
  152. package/dist/types/facade/ml/adapters/openai-responses-shared.d.ts +25 -0
  153. package/dist/types/facade/ml/adapters/openai-responses.d.ts +12 -0
  154. package/dist/types/facade/ml/adapters/openai-scaffold.d.ts +3 -0
  155. package/dist/types/facade/ml/adapters/register-builtins.d.ts +2 -0
  156. package/dist/types/facade/ml/adapters/simple-options.d.ts +26 -0
  157. package/dist/types/facade/ml/adapters/transform-messages.d.ts +23 -0
  158. package/dist/types/facade/ml/api-registry.d.ts +49 -0
  159. package/dist/types/facade/ml/cli.d.ts +2 -0
  160. package/dist/types/facade/ml/env-api-keys.d.ts +19 -0
  161. package/dist/types/facade/ml/index.d.ts +27 -0
  162. package/dist/types/facade/ml/kit/auth/anthropic.d.ts +17 -0
  163. package/dist/types/facade/ml/kit/auth/github-copilot.d.ts +22 -0
  164. package/dist/types/facade/ml/kit/auth/index.d.ts +50 -0
  165. package/dist/types/facade/ml/kit/auth/kimi.d.ts +23 -0
  166. package/dist/types/facade/ml/kit/auth/oauth-page.d.ts +2 -0
  167. package/dist/types/facade/ml/kit/auth/openai-codex.d.ts +36 -0
  168. package/dist/types/facade/ml/kit/auth/pkce.d.ts +12 -0
  169. package/dist/types/facade/ml/kit/auth/types.d.ts +67 -0
  170. package/dist/types/facade/ml/kit/base-stream-handler.d.ts +30 -0
  171. package/dist/types/facade/ml/kit/event-stream.d.ts +63 -0
  172. package/dist/types/facade/ml/kit/index.d.ts +14 -0
  173. package/dist/types/facade/ml/kit/json-parse.d.ts +23 -0
  174. package/dist/types/facade/ml/kit/message-transform.d.ts +32 -0
  175. package/dist/types/facade/ml/kit/output-factory.d.ts +8 -0
  176. package/dist/types/facade/ml/kit/overflow.d.ts +9 -0
  177. package/dist/types/facade/ml/kit/provider-adapter.d.ts +56 -0
  178. package/dist/types/facade/ml/kit/provider-client-builder.d.ts +36 -0
  179. package/dist/types/facade/ml/kit/provider-consolidation.d.ts +3 -0
  180. package/dist/types/facade/ml/kit/provider-constants.d.ts +34 -0
  181. package/dist/types/facade/ml/kit/provider-errors.d.ts +52 -0
  182. package/dist/types/facade/ml/kit/sanitize-unicode.d.ts +2 -0
  183. package/dist/types/facade/ml/kit/stream-event-helper.d.ts +38 -0
  184. package/dist/types/facade/ml/kit/stream-handler-types.d.ts +46 -0
  185. package/dist/types/facade/ml/kit/streaming-state-manager.d.ts +42 -0
  186. package/dist/types/facade/ml/kit/tool-converter.d.ts +49 -0
  187. package/dist/types/facade/ml/kit/typebox-helpers.d.ts +24 -0
  188. package/dist/types/facade/ml/kit/validation.d.ts +26 -0
  189. package/dist/types/facade/ml/models.d.ts +41 -0
  190. package/dist/types/facade/ml/models.generated.d.ts +12261 -0
  191. package/dist/types/facade/ml/stream.d.ts +27 -0
  192. package/dist/types/facade/ml/types.d.ts +269 -0
  193. package/dist/types/index.d.ts +16 -0
  194. package/dist/types/interop/index.d.ts +12 -0
  195. package/dist/types/interop/interop.test.d.ts +19 -0
  196. package/dist/types/interop/protocol-bridge/bridge.d.ts +52 -0
  197. package/dist/types/interop/protocol-bridge/contract.d.ts +249 -0
  198. package/dist/types/interop/protocol-bridge/endpoint.d.ts +124 -0
  199. package/dist/types/interop/protocol-bridge/fleet.d.ts +92 -0
  200. package/dist/types/interop/protocol-bridge/host.d.ts +61 -0
  201. package/dist/types/interop/protocol-bridge/index.d.ts +16 -0
  202. package/dist/types/interop/protocol-bridge/schema.d.ts +29 -0
  203. package/dist/types/llmgateway/catalog/cards.d.ts +18 -0
  204. package/dist/types/llmgateway/catalog/cost.d.ts +15 -0
  205. package/dist/types/llmgateway/catalog/index.d.ts +7 -0
  206. package/dist/types/llmgateway/catalog/query.d.ts +40 -0
  207. package/dist/types/llmgateway/connectors/anthropic.d.ts +35 -0
  208. package/dist/types/llmgateway/connectors/azure-openai.d.ts +33 -0
  209. package/dist/types/llmgateway/connectors/bedrock.d.ts +113 -0
  210. package/dist/types/llmgateway/connectors/google-vertex.d.ts +38 -0
  211. package/dist/types/llmgateway/connectors/google.d.ts +40 -0
  212. package/dist/types/llmgateway/connectors/index.d.ts +26 -0
  213. package/dist/types/llmgateway/connectors/kimi.d.ts +28 -0
  214. package/dist/types/llmgateway/connectors/mock.d.ts +37 -0
  215. package/dist/types/llmgateway/connectors/nvidia.d.ts +27 -0
  216. package/dist/types/llmgateway/connectors/ollama.d.ts +45 -0
  217. package/dist/types/llmgateway/connectors/openai-chat.d.ts +25 -0
  218. package/dist/types/llmgateway/connectors/openai-responses.d.ts +49 -0
  219. package/dist/types/llmgateway/contract/connector.d.ts +32 -0
  220. package/dist/types/llmgateway/contract/conversation.d.ts +86 -0
  221. package/dist/types/llmgateway/contract/emission.d.ts +55 -0
  222. package/dist/types/llmgateway/contract/errors.d.ts +27 -0
  223. package/dist/types/llmgateway/contract/index.d.ts +13 -0
  224. package/dist/types/llmgateway/contract/model-card.d.ts +42 -0
  225. package/dist/types/llmgateway/contract/options.d.ts +31 -0
  226. package/dist/types/llmgateway/contract/reply.d.ts +33 -0
  227. package/dist/types/llmgateway/conversion/index.d.ts +10 -0
  228. package/dist/types/llmgateway/conversion/mappers.d.ts +65 -0
  229. package/dist/types/llmgateway/conversion/openai-compatible.d.ts +46 -0
  230. package/dist/types/llmgateway/conversion/reduce.d.ts +20 -0
  231. package/dist/types/llmgateway/credentials/oauth.d.ts +73 -0
  232. package/dist/types/llmgateway/credentials/pkce.d.ts +52 -0
  233. package/dist/types/llmgateway/credentials/secrets.d.ts +74 -0
  234. package/dist/types/llmgateway/gateway.d.ts +34 -0
  235. package/dist/types/llmgateway/gateway.test.d.ts +14 -0
  236. package/dist/types/llmgateway/index.d.ts +11 -0
  237. package/dist/types/llmgateway/streaming/channel.d.ts +24 -0
  238. package/dist/types/llmgateway/streaming/index.d.ts +10 -0
  239. package/dist/types/llmgateway/streaming/ndjson.d.ts +17 -0
  240. package/dist/types/llmgateway/streaming/sse.d.ts +31 -0
  241. package/dist/types/react-host/index.d.ts +9 -0
  242. package/dist/types/react-host/ink.d.ts +5 -0
  243. package/dist/types/react-host/jsx-runtime.d.ts +4 -0
  244. package/dist/types/react-host/loader.d.ts +3 -0
  245. package/dist/types/react-ink/components/ChangelogBlock.d.ts +8 -0
  246. package/dist/types/react-ink/components/DisplayBlockView.d.ts +8 -0
  247. package/dist/types/react-ink/components/Footer.d.ts +11 -0
  248. package/dist/types/react-ink/components/MessageList.d.ts +14 -0
  249. package/dist/types/react-ink/components/MessageRow.d.ts +13 -0
  250. package/dist/types/react-ink/components/StatusLine.d.ts +9 -0
  251. package/dist/types/react-ink/components/TaskPanel.d.ts +11 -0
  252. package/dist/types/react-ink/components/ToolEventBlock.d.ts +24 -0
  253. package/dist/types/react-ink/components/dialogs/DialogFrame.d.ts +8 -0
  254. package/dist/types/react-ink/components/dialogs/LoginDialog.d.ts +14 -0
  255. package/dist/types/react-ink/components/dialogs/ModelDialog.d.ts +9 -0
  256. package/dist/types/react-ink/components/dialogs/OAuthDialog.d.ts +9 -0
  257. package/dist/types/react-ink/components/dialogs/ScopedModelsDialog.d.ts +9 -0
  258. package/dist/types/react-ink/components/dialogs/SelectableDialog.d.ts +22 -0
  259. package/dist/types/react-ink/components/dialogs/SessionDialog.d.ts +13 -0
  260. package/dist/types/react-ink/components/dialogs/SettingsDialog.d.ts +14 -0
  261. package/dist/types/react-ink/components/dialogs/StartupSessionPicker.d.ts +9 -0
  262. package/dist/types/react-ink/components/dialogs/ThemeDialog.d.ts +26 -0
  263. package/dist/types/react-ink/components/dialogs/TreeDialog.d.ts +8 -0
  264. package/dist/types/react-ink/components/dialogs/UserMessageDialog.d.ts +8 -0
  265. package/dist/types/react-ink/components/messages/AssistantMessage.d.ts +12 -0
  266. package/dist/types/react-ink/components/messages/BashMessage.d.ts +8 -0
  267. package/dist/types/react-ink/components/messages/BranchSummaryMessage.d.ts +8 -0
  268. package/dist/types/react-ink/components/messages/CompactionMessage.d.ts +8 -0
  269. package/dist/types/react-ink/components/messages/CustomMessage.d.ts +9 -0
  270. package/dist/types/react-ink/components/messages/SkillInvocationMessage.d.ts +7 -0
  271. package/dist/types/react-ink/components/messages/ToolCallMessage.d.ts +8 -0
  272. package/dist/types/react-ink/components/messages/ToolResultBlock.d.ts +12 -0
  273. package/dist/types/react-ink/components/messages/UserMessage.d.ts +9 -0
  274. package/dist/types/react-ink/diff/Diff.d.ts +22 -0
  275. package/dist/types/react-ink/diff/diff.test.d.ts +1 -0
  276. package/dist/types/react-ink/diff/structured.d.ts +41 -0
  277. package/dist/types/react-ink/diff/word-diff.d.ts +27 -0
  278. package/dist/types/react-ink/index.d.ts +42 -0
  279. package/dist/types/react-ink/markdown/Markdown.d.ts +23 -0
  280. package/dist/types/react-ink/markdown/MarkdownTable.d.ts +19 -0
  281. package/dist/types/react-ink/markdown/StreamingMarkdown.d.ts +34 -0
  282. package/dist/types/react-ink/markdown/format-token.d.ts +39 -0
  283. package/dist/types/react-ink/markdown/highlight.d.ts +31 -0
  284. package/dist/types/react-ink/theme-adapter.d.ts +66 -0
  285. package/dist/types/react-ink/types.d.ts +133 -0
  286. package/dist/types/react-ink/utils/message-groups.d.ts +25 -0
  287. package/dist/types/react-ink/utils/selection-dialog.d.ts +2 -0
  288. package/dist/types/react-ink/utils/session-browser.d.ts +27 -0
  289. package/dist/types/react-ink/utils/tool-display.d.ts +37 -0
  290. package/dist/types/runtime/cadence/cadence.test.d.ts +6 -0
  291. package/dist/types/runtime/cadence/fold.d.ts +48 -0
  292. package/dist/types/runtime/cadence/index.d.ts +12 -0
  293. package/dist/types/runtime/cadence/reducer.d.ts +44 -0
  294. package/dist/types/runtime/conductor/agent.d.ts +71 -0
  295. package/dist/types/runtime/conductor/index.d.ts +11 -0
  296. package/dist/types/runtime/contract/config.d.ts +44 -0
  297. package/dist/types/runtime/contract/effect.d.ts +41 -0
  298. package/dist/types/runtime/contract/errors.d.ts +22 -0
  299. package/dist/types/runtime/contract/events.d.ts +63 -0
  300. package/dist/types/runtime/contract/index.d.ts +18 -0
  301. package/dist/types/runtime/contract/run-state.d.ts +57 -0
  302. package/dist/types/runtime/contract/session.d.ts +42 -0
  303. package/dist/types/runtime/contract/signal.d.ts +49 -0
  304. package/dist/types/runtime/contract/tools.d.ts +45 -0
  305. package/dist/types/runtime/dispatch/index.d.ts +9 -0
  306. package/dist/types/runtime/dispatch/scheduler.d.ts +53 -0
  307. package/dist/types/runtime/index.d.ts +22 -0
  308. package/dist/types/runtime/ledger/accumulator.d.ts +44 -0
  309. package/dist/types/runtime/ledger/bus.d.ts +50 -0
  310. package/dist/types/runtime/ledger/index.d.ts +11 -0
  311. package/dist/types/runtime/memory/compactor.d.ts +56 -0
  312. package/dist/types/runtime/memory/estimate.d.ts +21 -0
  313. package/dist/types/runtime/memory/index.d.ts +8 -0
  314. package/dist/types/runtime/runtime.test.d.ts +15 -0
  315. package/dist/types/runtime/store/dag.d.ts +72 -0
  316. package/dist/types/runtime/store/hash.d.ts +18 -0
  317. package/dist/types/runtime/store/index.d.ts +12 -0
  318. package/dist/types/runtime/store/persist.d.ts +49 -0
  319. package/dist/types/runtime/turn/driver.d.ts +32 -0
  320. package/dist/types/runtime/turn/index.d.ts +8 -0
  321. package/dist/types/runtime/wire/index.d.ts +10 -0
  322. package/dist/types/runtime/wire/projectors.d.ts +53 -0
  323. package/dist/types/shell-app/auth-cli/index.d.ts +9 -0
  324. package/dist/types/shell-app/auth-cli/oauth-cli.d.ts +73 -0
  325. package/dist/types/shell-app/boot/context.d.ts +108 -0
  326. package/dist/types/shell-app/boot/index.d.ts +13 -0
  327. package/dist/types/shell-app/boot/pipeline.d.ts +66 -0
  328. package/dist/types/shell-app/boot/stages.d.ts +77 -0
  329. package/dist/types/shell-app/cli.d.ts +75 -0
  330. package/dist/types/shell-app/config/index.d.ts +11 -0
  331. package/dist/types/shell-app/config/locator.d.ts +85 -0
  332. package/dist/types/shell-app/config/settings.d.ts +91 -0
  333. package/dist/types/shell-app/index.d.ts +26 -0
  334. package/dist/types/shell-app/invocation/flags.d.ts +89 -0
  335. package/dist/types/shell-app/invocation/parse.d.ts +89 -0
  336. package/dist/types/shell-app/locate/brand.d.ts +71 -0
  337. package/dist/types/shell-app/locate/index.d.ts +12 -0
  338. package/dist/types/shell-app/locate/locator.d.ts +122 -0
  339. package/dist/types/shell-app/runners/contract.d.ts +116 -0
  340. package/dist/types/shell-app/runners/index.d.ts +15 -0
  341. package/dist/types/shell-app/runners/one-shot.d.ts +21 -0
  342. package/dist/types/shell-app/runners/registry.d.ts +34 -0
  343. package/dist/types/shell-app/runners/repl.d.ts +51 -0
  344. package/dist/types/shell-app/runners/wire.d.ts +34 -0
  345. package/dist/types/shell-app/shell-app.test.d.ts +14 -0
  346. package/dist/types/shell-app/upgrade/index.d.ts +9 -0
  347. package/dist/types/shell-app/upgrade/upgrades.d.ts +62 -0
  348. package/dist/types/smithy/config/flag-reader.d.ts +128 -0
  349. package/dist/types/smithy/config/index.d.ts +9 -0
  350. package/dist/types/smithy/forge.d.ts +135 -0
  351. package/dist/types/smithy/index.d.ts +36 -0
  352. package/dist/types/smithy/knowledge/index.d.ts +10 -0
  353. package/dist/types/smithy/knowledge/loader.d.ts +64 -0
  354. package/dist/types/smithy/persona/blueprint.d.ts +75 -0
  355. package/dist/types/smithy/persona/define-agent.d.ts +51 -0
  356. package/dist/types/smithy/persona/index.d.ts +14 -0
  357. package/dist/types/smithy/persona/profiles.d.ts +44 -0
  358. package/dist/types/smithy/runtime/index.d.ts +9 -0
  359. package/dist/types/smithy/runtime/tool-ledger.d.ts +130 -0
  360. package/dist/types/smithy/smithy.test.d.ts +20 -0
  361. package/dist/types/smithy/ui/index.d.ts +11 -0
  362. package/dist/types/smithy/ui/transcript.d.ts +183 -0
  363. package/dist/types/swarm/coordinator.d.ts +192 -0
  364. package/dist/types/swarm/index.d.ts +33 -0
  365. package/dist/types/swarm/isolation/index.d.ts +14 -0
  366. package/dist/types/swarm/isolation/runner.d.ts +61 -0
  367. package/dist/types/swarm/isolation/worktree.d.ts +142 -0
  368. package/dist/types/swarm/kernel/faults.d.ts +52 -0
  369. package/dist/types/swarm/kernel/ids.d.ts +25 -0
  370. package/dist/types/swarm/kernel/index.d.ts +26 -0
  371. package/dist/types/swarm/kernel/json-cell.d.ts +113 -0
  372. package/dist/types/swarm/kernel/jsonl-log.d.ts +81 -0
  373. package/dist/types/swarm/postbox/channel.d.ts +88 -0
  374. package/dist/types/swarm/postbox/codecs.d.ts +253 -0
  375. package/dist/types/swarm/postbox/index.d.ts +16 -0
  376. package/dist/types/swarm/roster/index.d.ts +16 -0
  377. package/dist/types/swarm/roster/manifest.d.ts +185 -0
  378. package/dist/types/swarm/swarm.test.d.ts +24 -0
  379. package/dist/types/swarm/telemetry/activity.d.ts +143 -0
  380. package/dist/types/swarm/workboard/board.d.ts +174 -0
  381. package/dist/types/swarm/workboard/dep-graph.d.ts +77 -0
  382. package/dist/types/swarm/workboard/index.d.ts +12 -0
  383. package/dist/types/tracing/adapter/index.d.ts +12 -0
  384. package/dist/types/tracing/adapter/runtime-trace.d.ts +54 -0
  385. package/dist/types/tracing/channel/index.d.ts +9 -0
  386. package/dist/types/tracing/channel/signal.d.ts +93 -0
  387. package/dist/types/tracing/index.d.ts +25 -0
  388. package/dist/types/tracing/recorder/index.d.ts +12 -0
  389. package/dist/types/tracing/recorder/recorder.d.ts +75 -0
  390. package/dist/types/tracing/recorder/sampling.d.ts +55 -0
  391. package/dist/types/tracing/redaction/index.d.ts +8 -0
  392. package/dist/types/tracing/redaction/secret-scrubber.d.ts +95 -0
  393. package/dist/types/tracing/registry/hub.d.ts +57 -0
  394. package/dist/types/tracing/registry/index.d.ts +7 -0
  395. package/dist/types/tracing/signal/handle.d.ts +73 -0
  396. package/dist/types/tracing/signal/index.d.ts +12 -0
  397. package/dist/types/tracing/signal/segment.d.ts +124 -0
  398. package/dist/types/tracing/sinks/base.d.ts +51 -0
  399. package/dist/types/tracing/sinks/console.d.ts +44 -0
  400. package/dist/types/tracing/sinks/file.d.ts +47 -0
  401. package/dist/types/tracing/sinks/index.d.ts +16 -0
  402. package/dist/types/tracing/sinks/stream.d.ts +46 -0
  403. package/dist/types/tracing/tracing.test.d.ts +7 -0
  404. package/dist/types/ui/autocomplete.d.ts +59 -0
  405. package/dist/types/ui/contracts.d.ts +38 -0
  406. package/dist/types/ui/editor-component.d.ts +100 -0
  407. package/dist/types/ui/fuzzy.d.ts +29 -0
  408. package/dist/types/ui/index.d.ts +8 -0
  409. package/dist/types/ui/keybindings.d.ts +62 -0
  410. package/dist/types/ui/keys.d.ts +171 -0
  411. package/dist/types/ui/theme-types.d.ts +36 -0
  412. package/dist/types/ui/utils.d.ts +101 -0
  413. package/dist/types/ui-bridge/InteractiveApp.d.ts +38 -0
  414. package/dist/types/ui-bridge/adapter.d.ts +90 -0
  415. package/dist/types/ui-bridge/index.d.ts +37 -0
  416. package/package.json +120 -107
  417. package/LICENSE +0 -8
  418. package/LICENSE-THIRD-PARTY.txt +0 -30
  419. package/local-dist-new/IndusForge/examples/research-agent.d.ts +0 -3
  420. package/local-dist-new/IndusForge/examples/research-agent.d.ts.map +0 -1
  421. package/local-dist-new/IndusForge/examples/research-agent.js +0 -18
  422. package/local-dist-new/IndusForge/examples/research-agent.js.map +0 -1
  423. package/local-dist-new/IndusForge/examples/review-agent.d.ts +0 -3
  424. package/local-dist-new/IndusForge/examples/review-agent.d.ts.map +0 -1
  425. package/local-dist-new/IndusForge/examples/review-agent.js +0 -18
  426. package/local-dist-new/IndusForge/examples/review-agent.js.map +0 -1
  427. package/local-dist-new/IndusForge/examples/terminal-builder-agent.d.ts +0 -3
  428. package/local-dist-new/IndusForge/examples/terminal-builder-agent.d.ts.map +0 -1
  429. package/local-dist-new/IndusForge/examples/terminal-builder-agent.js +0 -18
  430. package/local-dist-new/IndusForge/examples/terminal-builder-agent.js.map +0 -1
  431. package/local-dist-new/IndusForge/terminal-chat.d.ts +0 -2
  432. package/local-dist-new/IndusForge/terminal-chat.d.ts.map +0 -1
  433. package/local-dist-new/IndusForge/terminal-chat.js +0 -557
  434. package/local-dist-new/IndusForge/terminal-chat.js.map +0 -1
  435. package/local-dist-new/agent.d.ts +0 -6
  436. package/local-dist-new/agent.d.ts.map +0 -1
  437. package/local-dist-new/agent.js +0 -6
  438. package/local-dist-new/agent.js.map +0 -1
  439. package/local-dist-new/ai.d.ts +0 -6
  440. package/local-dist-new/ai.d.ts.map +0 -1
  441. package/local-dist-new/ai.js +0 -6
  442. package/local-dist-new/ai.js.map +0 -1
  443. package/local-dist-new/bot/actions/bash.d.ts +0 -56
  444. package/local-dist-new/bot/actions/bash.d.ts.map +0 -1
  445. package/local-dist-new/bot/actions/bash.js +0 -275
  446. package/local-dist-new/bot/actions/bash.js.map +0 -1
  447. package/local-dist-new/bot/actions/composio/accounts.d.ts +0 -23
  448. package/local-dist-new/bot/actions/composio/accounts.d.ts.map +0 -1
  449. package/local-dist-new/bot/actions/composio/accounts.js +0 -40
  450. package/local-dist-new/bot/actions/composio/accounts.js.map +0 -1
  451. package/local-dist-new/bot/actions/composio/client.d.ts +0 -40
  452. package/local-dist-new/bot/actions/composio/client.d.ts.map +0 -1
  453. package/local-dist-new/bot/actions/composio/client.js +0 -361
  454. package/local-dist-new/bot/actions/composio/client.js.map +0 -1
  455. package/local-dist-new/bot/actions/composio/connect.d.ts +0 -20
  456. package/local-dist-new/bot/actions/composio/connect.d.ts.map +0 -1
  457. package/local-dist-new/bot/actions/composio/connect.js +0 -41
  458. package/local-dist-new/bot/actions/composio/connect.js.map +0 -1
  459. package/local-dist-new/bot/actions/composio/enable.d.ts +0 -26
  460. package/local-dist-new/bot/actions/composio/enable.d.ts.map +0 -1
  461. package/local-dist-new/bot/actions/composio/enable.js +0 -66
  462. package/local-dist-new/bot/actions/composio/enable.js.map +0 -1
  463. package/local-dist-new/bot/actions/composio/execute.d.ts +0 -27
  464. package/local-dist-new/bot/actions/composio/execute.d.ts.map +0 -1
  465. package/local-dist-new/bot/actions/composio/execute.js +0 -46
  466. package/local-dist-new/bot/actions/composio/execute.js.map +0 -1
  467. package/local-dist-new/bot/actions/composio/helpers.d.ts +0 -17
  468. package/local-dist-new/bot/actions/composio/helpers.d.ts.map +0 -1
  469. package/local-dist-new/bot/actions/composio/helpers.js +0 -533
  470. package/local-dist-new/bot/actions/composio/helpers.js.map +0 -1
  471. package/local-dist-new/bot/actions/composio/index.d.ts +0 -10
  472. package/local-dist-new/bot/actions/composio/index.d.ts.map +0 -1
  473. package/local-dist-new/bot/actions/composio/index.js +0 -9
  474. package/local-dist-new/bot/actions/composio/index.js.map +0 -1
  475. package/local-dist-new/bot/actions/composio/provider.d.ts +0 -9
  476. package/local-dist-new/bot/actions/composio/provider.d.ts.map +0 -1
  477. package/local-dist-new/bot/actions/composio/provider.js +0 -54
  478. package/local-dist-new/bot/actions/composio/provider.js.map +0 -1
  479. package/local-dist-new/bot/actions/composio/toolkits.d.ts +0 -23
  480. package/local-dist-new/bot/actions/composio/toolkits.d.ts.map +0 -1
  481. package/local-dist-new/bot/actions/composio/toolkits.js +0 -40
  482. package/local-dist-new/bot/actions/composio/toolkits.js.map +0 -1
  483. package/local-dist-new/bot/actions/composio/tools.d.ts +0 -29
  484. package/local-dist-new/bot/actions/composio/tools.d.ts.map +0 -1
  485. package/local-dist-new/bot/actions/composio/tools.js +0 -72
  486. package/local-dist-new/bot/actions/composio/tools.js.map +0 -1
  487. package/local-dist-new/bot/actions/composio/types.d.ts +0 -138
  488. package/local-dist-new/bot/actions/composio/types.d.ts.map +0 -1
  489. package/local-dist-new/bot/actions/composio/types.js +0 -2
  490. package/local-dist-new/bot/actions/composio/types.js.map +0 -1
  491. package/local-dist-new/bot/actions/crew/activity-tracker.d.ts +0 -66
  492. package/local-dist-new/bot/actions/crew/activity-tracker.d.ts.map +0 -1
  493. package/local-dist-new/bot/actions/crew/activity-tracker.js +0 -480
  494. package/local-dist-new/bot/actions/crew/activity-tracker.js.map +0 -1
  495. package/local-dist-new/bot/actions/crew/cleanup.d.ts +0 -51
  496. package/local-dist-new/bot/actions/crew/cleanup.d.ts.map +0 -1
  497. package/local-dist-new/bot/actions/crew/cleanup.js +0 -219
  498. package/local-dist-new/bot/actions/crew/cleanup.js.map +0 -1
  499. package/local-dist-new/bot/actions/crew/fs-lock.d.ts +0 -12
  500. package/local-dist-new/bot/actions/crew/fs-lock.d.ts.map +0 -1
  501. package/local-dist-new/bot/actions/crew/fs-lock.js +0 -74
  502. package/local-dist-new/bot/actions/crew/fs-lock.js.map +0 -1
  503. package/local-dist-new/bot/actions/crew/index.d.ts +0 -12
  504. package/local-dist-new/bot/actions/crew/index.d.ts.map +0 -1
  505. package/local-dist-new/bot/actions/crew/index.js +0 -12
  506. package/local-dist-new/bot/actions/crew/index.js.map +0 -1
  507. package/local-dist-new/bot/actions/crew/mailbox.d.ts +0 -21
  508. package/local-dist-new/bot/actions/crew/mailbox.d.ts.map +0 -1
  509. package/local-dist-new/bot/actions/crew/mailbox.js +0 -106
  510. package/local-dist-new/bot/actions/crew/mailbox.js.map +0 -1
  511. package/local-dist-new/bot/actions/crew/model-policy.d.ts +0 -23
  512. package/local-dist-new/bot/actions/crew/model-policy.d.ts.map +0 -1
  513. package/local-dist-new/bot/actions/crew/model-policy.js +0 -113
  514. package/local-dist-new/bot/actions/crew/model-policy.js.map +0 -1
  515. package/local-dist-new/bot/actions/crew/names.d.ts +0 -28
  516. package/local-dist-new/bot/actions/crew/names.d.ts.map +0 -1
  517. package/local-dist-new/bot/actions/crew/names.js +0 -109
  518. package/local-dist-new/bot/actions/crew/names.js.map +0 -1
  519. package/local-dist-new/bot/actions/crew/protocol.d.ts +0 -75
  520. package/local-dist-new/bot/actions/crew/protocol.d.ts.map +0 -1
  521. package/local-dist-new/bot/actions/crew/protocol.js +0 -205
  522. package/local-dist-new/bot/actions/crew/protocol.js.map +0 -1
  523. package/local-dist-new/bot/actions/crew/task-store.d.ts +0 -89
  524. package/local-dist-new/bot/actions/crew/task-store.d.ts.map +0 -1
  525. package/local-dist-new/bot/actions/crew/task-store.js +0 -445
  526. package/local-dist-new/bot/actions/crew/task-store.js.map +0 -1
  527. package/local-dist-new/bot/actions/crew/team-attach-claim.d.ts +0 -36
  528. package/local-dist-new/bot/actions/crew/team-attach-claim.d.ts.map +0 -1
  529. package/local-dist-new/bot/actions/crew/team-attach-claim.js +0 -144
  530. package/local-dist-new/bot/actions/crew/team-attach-claim.js.map +0 -1
  531. package/local-dist-new/bot/actions/crew/team-config.d.ts +0 -55
  532. package/local-dist-new/bot/actions/crew/team-config.d.ts.map +0 -1
  533. package/local-dist-new/bot/actions/crew/team-config.js +0 -252
  534. package/local-dist-new/bot/actions/crew/team-config.js.map +0 -1
  535. package/local-dist-new/bot/actions/crew/worktree.d.ts +0 -40
  536. package/local-dist-new/bot/actions/crew/worktree.d.ts.map +0 -1
  537. package/local-dist-new/bot/actions/crew/worktree.js +0 -213
  538. package/local-dist-new/bot/actions/crew/worktree.js.map +0 -1
  539. package/local-dist-new/bot/actions/edit-diff.d.ts +0 -63
  540. package/local-dist-new/bot/actions/edit-diff.d.ts.map +0 -1
  541. package/local-dist-new/bot/actions/edit-diff.js +0 -255
  542. package/local-dist-new/bot/actions/edit-diff.js.map +0 -1
  543. package/local-dist-new/bot/actions/edit.d.ts +0 -42
  544. package/local-dist-new/bot/actions/edit.d.ts.map +0 -1
  545. package/local-dist-new/bot/actions/edit.js +0 -176
  546. package/local-dist-new/bot/actions/edit.js.map +0 -1
  547. package/local-dist-new/bot/actions/find.d.ts +0 -26
  548. package/local-dist-new/bot/actions/find.d.ts.map +0 -1
  549. package/local-dist-new/bot/actions/find.js +0 -170
  550. package/local-dist-new/bot/actions/find.js.map +0 -1
  551. package/local-dist-new/bot/actions/grep.d.ts +0 -43
  552. package/local-dist-new/bot/actions/grep.d.ts.map +0 -1
  553. package/local-dist-new/bot/actions/grep.js +0 -218
  554. package/local-dist-new/bot/actions/grep.js.map +0 -1
  555. package/local-dist-new/bot/actions/index.d.ts +0 -301
  556. package/local-dist-new/bot/actions/index.d.ts.map +0 -1
  557. package/local-dist-new/bot/actions/index.js +0 -255
  558. package/local-dist-new/bot/actions/index.js.map +0 -1
  559. package/local-dist-new/bot/actions/kit/hook-runner.d.ts +0 -13
  560. package/local-dist-new/bot/actions/kit/hook-runner.d.ts.map +0 -1
  561. package/local-dist-new/bot/actions/kit/hook-runner.js +0 -33
  562. package/local-dist-new/bot/actions/kit/hook-runner.js.map +0 -1
  563. package/local-dist-new/bot/actions/kit/image-resize.d.ts +0 -20
  564. package/local-dist-new/bot/actions/kit/image-resize.d.ts.map +0 -1
  565. package/local-dist-new/bot/actions/kit/image-resize.js +0 -93
  566. package/local-dist-new/bot/actions/kit/image-resize.js.map +0 -1
  567. package/local-dist-new/bot/actions/kit/mime.d.ts +0 -2
  568. package/local-dist-new/bot/actions/kit/mime.d.ts.map +0 -1
  569. package/local-dist-new/bot/actions/kit/mime.js +0 -65
  570. package/local-dist-new/bot/actions/kit/mime.js.map +0 -1
  571. package/local-dist-new/bot/actions/kit/shell.d.ts +0 -13
  572. package/local-dist-new/bot/actions/kit/shell.d.ts.map +0 -1
  573. package/local-dist-new/bot/actions/kit/shell.js +0 -103
  574. package/local-dist-new/bot/actions/kit/shell.js.map +0 -1
  575. package/local-dist-new/bot/actions/ls.d.ts +0 -41
  576. package/local-dist-new/bot/actions/ls.d.ts.map +0 -1
  577. package/local-dist-new/bot/actions/ls.js +0 -174
  578. package/local-dist-new/bot/actions/ls.js.map +0 -1
  579. package/local-dist-new/bot/actions/path-utils.d.ts +0 -8
  580. package/local-dist-new/bot/actions/path-utils.d.ts.map +0 -1
  581. package/local-dist-new/bot/actions/path-utils.js +0 -75
  582. package/local-dist-new/bot/actions/path-utils.js.map +0 -1
  583. package/local-dist-new/bot/actions/process-controller.d.ts +0 -15
  584. package/local-dist-new/bot/actions/process-controller.d.ts.map +0 -1
  585. package/local-dist-new/bot/actions/process-controller.js +0 -39
  586. package/local-dist-new/bot/actions/process-controller.js.map +0 -1
  587. package/local-dist-new/bot/actions/process-manager.d.ts +0 -60
  588. package/local-dist-new/bot/actions/process-manager.d.ts.map +0 -1
  589. package/local-dist-new/bot/actions/process-manager.js +0 -485
  590. package/local-dist-new/bot/actions/process-manager.js.map +0 -1
  591. package/local-dist-new/bot/actions/process-types.d.ts +0 -74
  592. package/local-dist-new/bot/actions/process-types.d.ts.map +0 -1
  593. package/local-dist-new/bot/actions/process-types.js +0 -7
  594. package/local-dist-new/bot/actions/process-types.js.map +0 -1
  595. package/local-dist-new/bot/actions/process.d.ts +0 -38
  596. package/local-dist-new/bot/actions/process.d.ts.map +0 -1
  597. package/local-dist-new/bot/actions/process.js +0 -360
  598. package/local-dist-new/bot/actions/process.js.map +0 -1
  599. package/local-dist-new/bot/actions/read.d.ts +0 -37
  600. package/local-dist-new/bot/actions/read.d.ts.map +0 -1
  601. package/local-dist-new/bot/actions/read.js +0 -190
  602. package/local-dist-new/bot/actions/read.js.map +0 -1
  603. package/local-dist-new/bot/actions/registry.d.ts +0 -21
  604. package/local-dist-new/bot/actions/registry.d.ts.map +0 -1
  605. package/local-dist-new/bot/actions/registry.js +0 -23
  606. package/local-dist-new/bot/actions/registry.js.map +0 -1
  607. package/local-dist-new/bot/actions/todo-store.d.ts +0 -77
  608. package/local-dist-new/bot/actions/todo-store.d.ts.map +0 -1
  609. package/local-dist-new/bot/actions/todo-store.js +0 -137
  610. package/local-dist-new/bot/actions/todo-store.js.map +0 -1
  611. package/local-dist-new/bot/actions/todo-types.d.ts +0 -73
  612. package/local-dist-new/bot/actions/todo-types.d.ts.map +0 -1
  613. package/local-dist-new/bot/actions/todo-types.js +0 -8
  614. package/local-dist-new/bot/actions/todo-types.js.map +0 -1
  615. package/local-dist-new/bot/actions/todo.d.ts +0 -77
  616. package/local-dist-new/bot/actions/todo.d.ts.map +0 -1
  617. package/local-dist-new/bot/actions/todo.js +0 -122
  618. package/local-dist-new/bot/actions/todo.js.map +0 -1
  619. package/local-dist-new/bot/actions/truncate.d.ts +0 -73
  620. package/local-dist-new/bot/actions/truncate.d.ts.map +0 -1
  621. package/local-dist-new/bot/actions/truncate.js +0 -221
  622. package/local-dist-new/bot/actions/truncate.js.map +0 -1
  623. package/local-dist-new/bot/actions/webfetch.d.ts +0 -36
  624. package/local-dist-new/bot/actions/webfetch.d.ts.map +0 -1
  625. package/local-dist-new/bot/actions/webfetch.js +0 -247
  626. package/local-dist-new/bot/actions/webfetch.js.map +0 -1
  627. package/local-dist-new/bot/actions/websearch.d.ts +0 -35
  628. package/local-dist-new/bot/actions/websearch.d.ts.map +0 -1
  629. package/local-dist-new/bot/actions/websearch.js +0 -132
  630. package/local-dist-new/bot/actions/websearch.js.map +0 -1
  631. package/local-dist-new/bot/actions/write.d.ts +0 -31
  632. package/local-dist-new/bot/actions/write.d.ts.map +0 -1
  633. package/local-dist-new/bot/actions/write.js +0 -139
  634. package/local-dist-new/bot/actions/write.js.map +0 -1
  635. package/local-dist-new/bot/agent-loop.d.ts +0 -15
  636. package/local-dist-new/bot/agent-loop.d.ts.map +0 -1
  637. package/local-dist-new/bot/agent-loop.js +0 -293
  638. package/local-dist-new/bot/agent-loop.js.map +0 -1
  639. package/local-dist-new/bot/agent.d.ts +0 -122
  640. package/local-dist-new/bot/agent.d.ts.map +0 -1
  641. package/local-dist-new/bot/agent.js +0 -393
  642. package/local-dist-new/bot/agent.js.map +0 -1
  643. package/local-dist-new/bot/error-handler.d.ts +0 -8
  644. package/local-dist-new/bot/error-handler.d.ts.map +0 -1
  645. package/local-dist-new/bot/error-handler.js +0 -8
  646. package/local-dist-new/bot/error-handler.js.map +0 -1
  647. package/local-dist-new/bot/event-bus.d.ts +0 -9
  648. package/local-dist-new/bot/event-bus.d.ts.map +0 -1
  649. package/local-dist-new/bot/event-bus.js +0 -15
  650. package/local-dist-new/bot/event-bus.js.map +0 -1
  651. package/local-dist-new/bot/index.d.ts +0 -8
  652. package/local-dist-new/bot/index.d.ts.map +0 -1
  653. package/local-dist-new/bot/index.js +0 -8
  654. package/local-dist-new/bot/index.js.map +0 -1
  655. package/local-dist-new/bot/messages.d.ts +0 -77
  656. package/local-dist-new/bot/messages.d.ts.map +0 -1
  657. package/local-dist-new/bot/messages.js +0 -116
  658. package/local-dist-new/bot/messages.js.map +0 -1
  659. package/local-dist-new/bot/proxy.d.ts +0 -66
  660. package/local-dist-new/bot/proxy.d.ts.map +0 -1
  661. package/local-dist-new/bot/proxy.js +0 -228
  662. package/local-dist-new/bot/proxy.js.map +0 -1
  663. package/local-dist-new/bot/session-manager.d.ts +0 -448
  664. package/local-dist-new/bot/session-manager.d.ts.map +0 -1
  665. package/local-dist-new/bot/session-manager.js +0 -1232
  666. package/local-dist-new/bot/session-manager.js.map +0 -1
  667. package/local-dist-new/bot/state-manager.d.ts +0 -22
  668. package/local-dist-new/bot/state-manager.d.ts.map +0 -1
  669. package/local-dist-new/bot/state-manager.js +0 -60
  670. package/local-dist-new/bot/state-manager.js.map +0 -1
  671. package/local-dist-new/bot/telemetry.d.ts +0 -7
  672. package/local-dist-new/bot/telemetry.d.ts.map +0 -1
  673. package/local-dist-new/bot/telemetry.js +0 -18
  674. package/local-dist-new/bot/telemetry.js.map +0 -1
  675. package/local-dist-new/bot/types.d.ts +0 -205
  676. package/local-dist-new/bot/types.d.ts.map +0 -1
  677. package/local-dist-new/bot/types.js +0 -60
  678. package/local-dist-new/bot/types.js.map +0 -1
  679. package/local-dist-new/cli.d.ts +0 -3
  680. package/local-dist-new/cli.d.ts.map +0 -1
  681. package/local-dist-new/cli.js +0 -3
  682. package/local-dist-new/cli.js.map +0 -1
  683. package/local-dist-new/index.d.ts +0 -7
  684. package/local-dist-new/index.d.ts.map +0 -1
  685. package/local-dist-new/index.js +0 -7
  686. package/local-dist-new/index.js.map +0 -1
  687. package/local-dist-new/mcp/client-pool.d.ts +0 -106
  688. package/local-dist-new/mcp/client-pool.d.ts.map +0 -1
  689. package/local-dist-new/mcp/client-pool.js +0 -234
  690. package/local-dist-new/mcp/client-pool.js.map +0 -1
  691. package/local-dist-new/mcp/client.d.ts +0 -158
  692. package/local-dist-new/mcp/client.d.ts.map +0 -1
  693. package/local-dist-new/mcp/client.js +0 -611
  694. package/local-dist-new/mcp/client.js.map +0 -1
  695. package/local-dist-new/mcp/config.d.ts +0 -61
  696. package/local-dist-new/mcp/config.d.ts.map +0 -1
  697. package/local-dist-new/mcp/config.js +0 -250
  698. package/local-dist-new/mcp/config.js.map +0 -1
  699. package/local-dist-new/mcp/errors.d.ts +0 -104
  700. package/local-dist-new/mcp/errors.d.ts.map +0 -1
  701. package/local-dist-new/mcp/errors.js +0 -146
  702. package/local-dist-new/mcp/errors.js.map +0 -1
  703. package/local-dist-new/mcp/index.d.ts +0 -56
  704. package/local-dist-new/mcp/index.d.ts.map +0 -1
  705. package/local-dist-new/mcp/index.js +0 -83
  706. package/local-dist-new/mcp/index.js.map +0 -1
  707. package/local-dist-new/mcp/schema-converter.d.ts +0 -68
  708. package/local-dist-new/mcp/schema-converter.d.ts.map +0 -1
  709. package/local-dist-new/mcp/schema-converter.js +0 -230
  710. package/local-dist-new/mcp/schema-converter.js.map +0 -1
  711. package/local-dist-new/mcp/server.d.ts +0 -111
  712. package/local-dist-new/mcp/server.d.ts.map +0 -1
  713. package/local-dist-new/mcp/server.js +0 -305
  714. package/local-dist-new/mcp/server.js.map +0 -1
  715. package/local-dist-new/mcp/tool-factory.d.ts +0 -63
  716. package/local-dist-new/mcp/tool-factory.d.ts.map +0 -1
  717. package/local-dist-new/mcp/tool-factory.js +0 -228
  718. package/local-dist-new/mcp/tool-factory.js.map +0 -1
  719. package/local-dist-new/mcp/types.d.ts +0 -289
  720. package/local-dist-new/mcp/types.d.ts.map +0 -1
  721. package/local-dist-new/mcp/types.js +0 -8
  722. package/local-dist-new/mcp/types.js.map +0 -1
  723. package/local-dist-new/mcp.d.ts +0 -2
  724. package/local-dist-new/mcp.d.ts.map +0 -1
  725. package/local-dist-new/mcp.js +0 -2
  726. package/local-dist-new/mcp.js.map +0 -1
  727. package/local-dist-new/ml/adapters/amazon-bedrock.d.ts +0 -33
  728. package/local-dist-new/ml/adapters/amazon-bedrock.d.ts.map +0 -1
  729. package/local-dist-new/ml/adapters/amazon-bedrock.js +0 -610
  730. package/local-dist-new/ml/adapters/amazon-bedrock.js.map +0 -1
  731. package/local-dist-new/ml/adapters/anthropic.d.ts +0 -62
  732. package/local-dist-new/ml/adapters/anthropic.d.ts.map +0 -1
  733. package/local-dist-new/ml/adapters/anthropic.js +0 -682
  734. package/local-dist-new/ml/adapters/anthropic.js.map +0 -1
  735. package/local-dist-new/ml/adapters/azure-openai-responses.d.ts +0 -15
  736. package/local-dist-new/ml/adapters/azure-openai-responses.d.ts.map +0 -1
  737. package/local-dist-new/ml/adapters/azure-openai-responses.js +0 -233
  738. package/local-dist-new/ml/adapters/azure-openai-responses.js.map +0 -1
  739. package/local-dist-new/ml/adapters/google-shared.d.ts +0 -60
  740. package/local-dist-new/ml/adapters/google-shared.d.ts.map +0 -1
  741. package/local-dist-new/ml/adapters/google-shared.js +0 -316
  742. package/local-dist-new/ml/adapters/google-shared.js.map +0 -1
  743. package/local-dist-new/ml/adapters/google-vertex.d.ts +0 -15
  744. package/local-dist-new/ml/adapters/google-vertex.d.ts.map +0 -1
  745. package/local-dist-new/ml/adapters/google-vertex.js +0 -396
  746. package/local-dist-new/ml/adapters/google-vertex.js.map +0 -1
  747. package/local-dist-new/ml/adapters/google.d.ts +0 -16
  748. package/local-dist-new/ml/adapters/google.d.ts.map +0 -1
  749. package/local-dist-new/ml/adapters/google.js +0 -381
  750. package/local-dist-new/ml/adapters/google.js.map +0 -1
  751. package/local-dist-new/ml/adapters/kimi.d.ts +0 -22
  752. package/local-dist-new/ml/adapters/kimi.d.ts.map +0 -1
  753. package/local-dist-new/ml/adapters/kimi.js +0 -249
  754. package/local-dist-new/ml/adapters/kimi.js.map +0 -1
  755. package/local-dist-new/ml/adapters/mock.d.ts +0 -10
  756. package/local-dist-new/ml/adapters/mock.d.ts.map +0 -1
  757. package/local-dist-new/ml/adapters/mock.js +0 -64
  758. package/local-dist-new/ml/adapters/mock.js.map +0 -1
  759. package/local-dist-new/ml/adapters/nvidia.d.ts +0 -14
  760. package/local-dist-new/ml/adapters/nvidia.d.ts.map +0 -1
  761. package/local-dist-new/ml/adapters/nvidia.js +0 -377
  762. package/local-dist-new/ml/adapters/nvidia.js.map +0 -1
  763. package/local-dist-new/ml/adapters/openai-codex-responses.d.ts +0 -9
  764. package/local-dist-new/ml/adapters/openai-codex-responses.d.ts.map +0 -1
  765. package/local-dist-new/ml/adapters/openai-codex-responses.js +0 -397
  766. package/local-dist-new/ml/adapters/openai-codex-responses.js.map +0 -1
  767. package/local-dist-new/ml/adapters/openai-completions.d.ts +0 -25
  768. package/local-dist-new/ml/adapters/openai-completions.d.ts.map +0 -1
  769. package/local-dist-new/ml/adapters/openai-completions.js +0 -831
  770. package/local-dist-new/ml/adapters/openai-completions.js.map +0 -1
  771. package/local-dist-new/ml/adapters/openai-responses-shared.d.ts +0 -26
  772. package/local-dist-new/ml/adapters/openai-responses-shared.d.ts.map +0 -1
  773. package/local-dist-new/ml/adapters/openai-responses-shared.js +0 -461
  774. package/local-dist-new/ml/adapters/openai-responses-shared.js.map +0 -1
  775. package/local-dist-new/ml/adapters/openai-responses.d.ts +0 -13
  776. package/local-dist-new/ml/adapters/openai-responses.d.ts.map +0 -1
  777. package/local-dist-new/ml/adapters/openai-responses.js +0 -209
  778. package/local-dist-new/ml/adapters/openai-responses.js.map +0 -1
  779. package/local-dist-new/ml/adapters/openai-scaffold.d.ts +0 -4
  780. package/local-dist-new/ml/adapters/openai-scaffold.d.ts.map +0 -1
  781. package/local-dist-new/ml/adapters/openai-scaffold.js +0 -33
  782. package/local-dist-new/ml/adapters/openai-scaffold.js.map +0 -1
  783. package/local-dist-new/ml/adapters/register-builtins.d.ts +0 -3
  784. package/local-dist-new/ml/adapters/register-builtins.d.ts.map +0 -1
  785. package/local-dist-new/ml/adapters/register-builtins.js +0 -143
  786. package/local-dist-new/ml/adapters/register-builtins.js.map +0 -1
  787. package/local-dist-new/ml/adapters/simple-options.d.ts +0 -27
  788. package/local-dist-new/ml/adapters/simple-options.d.ts.map +0 -1
  789. package/local-dist-new/ml/adapters/simple-options.js +0 -96
  790. package/local-dist-new/ml/adapters/simple-options.js.map +0 -1
  791. package/local-dist-new/ml/adapters/transform-messages.d.ts +0 -22
  792. package/local-dist-new/ml/adapters/transform-messages.d.ts.map +0 -1
  793. package/local-dist-new/ml/adapters/transform-messages.js +0 -147
  794. package/local-dist-new/ml/adapters/transform-messages.js.map +0 -1
  795. package/local-dist-new/ml/api-registry.d.ts +0 -50
  796. package/local-dist-new/ml/api-registry.d.ts.map +0 -1
  797. package/local-dist-new/ml/api-registry.js +0 -121
  798. package/local-dist-new/ml/api-registry.js.map +0 -1
  799. package/local-dist-new/ml/cli.d.ts +0 -3
  800. package/local-dist-new/ml/cli.d.ts.map +0 -1
  801. package/local-dist-new/ml/cli.js +0 -117
  802. package/local-dist-new/ml/cli.js.map +0 -1
  803. package/local-dist-new/ml/env-api-keys.d.ts +0 -18
  804. package/local-dist-new/ml/env-api-keys.d.ts.map +0 -1
  805. package/local-dist-new/ml/env-api-keys.js +0 -122
  806. package/local-dist-new/ml/env-api-keys.js.map +0 -1
  807. package/local-dist-new/ml/index.d.ts +0 -28
  808. package/local-dist-new/ml/index.d.ts.map +0 -1
  809. package/local-dist-new/ml/index.js +0 -28
  810. package/local-dist-new/ml/index.js.map +0 -1
  811. package/local-dist-new/ml/kit/auth/anthropic.d.ts +0 -18
  812. package/local-dist-new/ml/kit/auth/anthropic.d.ts.map +0 -1
  813. package/local-dist-new/ml/kit/auth/anthropic.js +0 -152
  814. package/local-dist-new/ml/kit/auth/anthropic.js.map +0 -1
  815. package/local-dist-new/ml/kit/auth/github-copilot.d.ts +0 -23
  816. package/local-dist-new/ml/kit/auth/github-copilot.d.ts.map +0 -1
  817. package/local-dist-new/ml/kit/auth/github-copilot.js +0 -275
  818. package/local-dist-new/ml/kit/auth/github-copilot.js.map +0 -1
  819. package/local-dist-new/ml/kit/auth/index.d.ts +0 -50
  820. package/local-dist-new/ml/kit/auth/index.d.ts.map +0 -1
  821. package/local-dist-new/ml/kit/auth/index.js +0 -112
  822. package/local-dist-new/ml/kit/auth/index.js.map +0 -1
  823. package/local-dist-new/ml/kit/auth/kimi.d.ts +0 -24
  824. package/local-dist-new/ml/kit/auth/kimi.d.ts.map +0 -1
  825. package/local-dist-new/ml/kit/auth/kimi.js +0 -30
  826. package/local-dist-new/ml/kit/auth/kimi.js.map +0 -1
  827. package/local-dist-new/ml/kit/auth/oauth-page.d.ts +0 -3
  828. package/local-dist-new/ml/kit/auth/oauth-page.d.ts.map +0 -1
  829. package/local-dist-new/ml/kit/auth/oauth-page.js +0 -105
  830. package/local-dist-new/ml/kit/auth/oauth-page.js.map +0 -1
  831. package/local-dist-new/ml/kit/auth/openai-codex.d.ts +0 -34
  832. package/local-dist-new/ml/kit/auth/openai-codex.d.ts.map +0 -1
  833. package/local-dist-new/ml/kit/auth/openai-codex.js +0 -373
  834. package/local-dist-new/ml/kit/auth/openai-codex.js.map +0 -1
  835. package/local-dist-new/ml/kit/auth/pkce.d.ts +0 -13
  836. package/local-dist-new/ml/kit/auth/pkce.d.ts.map +0 -1
  837. package/local-dist-new/ml/kit/auth/pkce.js +0 -31
  838. package/local-dist-new/ml/kit/auth/pkce.js.map +0 -1
  839. package/local-dist-new/ml/kit/auth/types.d.ts +0 -72
  840. package/local-dist-new/ml/kit/auth/types.d.ts.map +0 -1
  841. package/local-dist-new/ml/kit/auth/types.js +0 -11
  842. package/local-dist-new/ml/kit/auth/types.js.map +0 -1
  843. package/local-dist-new/ml/kit/base-stream-handler.d.ts +0 -16
  844. package/local-dist-new/ml/kit/base-stream-handler.d.ts.map +0 -1
  845. package/local-dist-new/ml/kit/base-stream-handler.js +0 -25
  846. package/local-dist-new/ml/kit/base-stream-handler.js.map +0 -1
  847. package/local-dist-new/ml/kit/event-stream.d.ts +0 -45
  848. package/local-dist-new/ml/kit/event-stream.d.ts.map +0 -1
  849. package/local-dist-new/ml/kit/event-stream.js +0 -178
  850. package/local-dist-new/ml/kit/event-stream.js.map +0 -1
  851. package/local-dist-new/ml/kit/index.d.ts +0 -15
  852. package/local-dist-new/ml/kit/index.d.ts.map +0 -1
  853. package/local-dist-new/ml/kit/index.js +0 -15
  854. package/local-dist-new/ml/kit/index.js.map +0 -1
  855. package/local-dist-new/ml/kit/json-parse.d.ts +0 -21
  856. package/local-dist-new/ml/kit/json-parse.d.ts.map +0 -1
  857. package/local-dist-new/ml/kit/json-parse.js +0 -44
  858. package/local-dist-new/ml/kit/json-parse.js.map +0 -1
  859. package/local-dist-new/ml/kit/message-transform.d.ts +0 -29
  860. package/local-dist-new/ml/kit/message-transform.d.ts.map +0 -1
  861. package/local-dist-new/ml/kit/message-transform.js +0 -55
  862. package/local-dist-new/ml/kit/message-transform.js.map +0 -1
  863. package/local-dist-new/ml/kit/output-factory.d.ts +0 -3
  864. package/local-dist-new/ml/kit/output-factory.d.ts.map +0 -1
  865. package/local-dist-new/ml/kit/output-factory.js +0 -23
  866. package/local-dist-new/ml/kit/output-factory.js.map +0 -1
  867. package/local-dist-new/ml/kit/overflow.d.ts +0 -10
  868. package/local-dist-new/ml/kit/overflow.d.ts.map +0 -1
  869. package/local-dist-new/ml/kit/overflow.js +0 -76
  870. package/local-dist-new/ml/kit/overflow.js.map +0 -1
  871. package/local-dist-new/ml/kit/provider-adapter.d.ts +0 -57
  872. package/local-dist-new/ml/kit/provider-adapter.d.ts.map +0 -1
  873. package/local-dist-new/ml/kit/provider-adapter.js +0 -37
  874. package/local-dist-new/ml/kit/provider-adapter.js.map +0 -1
  875. package/local-dist-new/ml/kit/provider-client-builder.d.ts +0 -37
  876. package/local-dist-new/ml/kit/provider-client-builder.d.ts.map +0 -1
  877. package/local-dist-new/ml/kit/provider-client-builder.js +0 -50
  878. package/local-dist-new/ml/kit/provider-client-builder.js.map +0 -1
  879. package/local-dist-new/ml/kit/provider-consolidation.d.ts +0 -4
  880. package/local-dist-new/ml/kit/provider-consolidation.d.ts.map +0 -1
  881. package/local-dist-new/ml/kit/provider-consolidation.js +0 -33
  882. package/local-dist-new/ml/kit/provider-consolidation.js.map +0 -1
  883. package/local-dist-new/ml/kit/provider-constants.d.ts +0 -35
  884. package/local-dist-new/ml/kit/provider-constants.d.ts.map +0 -1
  885. package/local-dist-new/ml/kit/provider-constants.js +0 -35
  886. package/local-dist-new/ml/kit/provider-constants.js.map +0 -1
  887. package/local-dist-new/ml/kit/provider-errors.d.ts +0 -46
  888. package/local-dist-new/ml/kit/provider-errors.d.ts.map +0 -1
  889. package/local-dist-new/ml/kit/provider-errors.js +0 -103
  890. package/local-dist-new/ml/kit/provider-errors.js.map +0 -1
  891. package/local-dist-new/ml/kit/sanitize-unicode.d.ts +0 -3
  892. package/local-dist-new/ml/kit/sanitize-unicode.d.ts.map +0 -1
  893. package/local-dist-new/ml/kit/sanitize-unicode.js +0 -60
  894. package/local-dist-new/ml/kit/sanitize-unicode.js.map +0 -1
  895. package/local-dist-new/ml/kit/stream-event-helper.d.ts +0 -28
  896. package/local-dist-new/ml/kit/stream-event-helper.d.ts.map +0 -1
  897. package/local-dist-new/ml/kit/stream-event-helper.js +0 -52
  898. package/local-dist-new/ml/kit/stream-event-helper.js.map +0 -1
  899. package/local-dist-new/ml/kit/stream-handler-types.d.ts +0 -43
  900. package/local-dist-new/ml/kit/stream-handler-types.d.ts.map +0 -1
  901. package/local-dist-new/ml/kit/stream-handler-types.js +0 -23
  902. package/local-dist-new/ml/kit/stream-handler-types.js.map +0 -1
  903. package/local-dist-new/ml/kit/streaming-state-manager.d.ts +0 -50
  904. package/local-dist-new/ml/kit/streaming-state-manager.d.ts.map +0 -1
  905. package/local-dist-new/ml/kit/streaming-state-manager.js +0 -67
  906. package/local-dist-new/ml/kit/streaming-state-manager.js.map +0 -1
  907. package/local-dist-new/ml/kit/tool-converter.d.ts +0 -50
  908. package/local-dist-new/ml/kit/tool-converter.d.ts.map +0 -1
  909. package/local-dist-new/ml/kit/tool-converter.js +0 -54
  910. package/local-dist-new/ml/kit/tool-converter.js.map +0 -1
  911. package/local-dist-new/ml/kit/typebox-helpers.d.ts +0 -24
  912. package/local-dist-new/ml/kit/typebox-helpers.d.ts.map +0 -1
  913. package/local-dist-new/ml/kit/typebox-helpers.js +0 -46
  914. package/local-dist-new/ml/kit/typebox-helpers.js.map +0 -1
  915. package/local-dist-new/ml/kit/validation.d.ts +0 -24
  916. package/local-dist-new/ml/kit/validation.d.ts.map +0 -1
  917. package/local-dist-new/ml/kit/validation.js +0 -119
  918. package/local-dist-new/ml/kit/validation.js.map +0 -1
  919. package/local-dist-new/ml/models.d.ts +0 -41
  920. package/local-dist-new/ml/models.d.ts.map +0 -1
  921. package/local-dist-new/ml/models.generated.d.ts +0 -12245
  922. package/local-dist-new/ml/models.generated.d.ts.map +0 -1
  923. package/local-dist-new/ml/models.generated.js +0 -12080
  924. package/local-dist-new/ml/models.generated.js.map +0 -1
  925. package/local-dist-new/ml/models.js +0 -126
  926. package/local-dist-new/ml/models.js.map +0 -1
  927. package/local-dist-new/ml/stream.d.ts +0 -12
  928. package/local-dist-new/ml/stream.d.ts.map +0 -1
  929. package/local-dist-new/ml/stream.js +0 -54
  930. package/local-dist-new/ml/stream.js.map +0 -1
  931. package/local-dist-new/ml/types.d.ts +0 -270
  932. package/local-dist-new/ml/types.d.ts.map +0 -1
  933. package/local-dist-new/ml/types.js +0 -169
  934. package/local-dist-new/ml/types.js.map +0 -1
  935. package/local-dist-new/observability.d.ts +0 -2
  936. package/local-dist-new/observability.d.ts.map +0 -1
  937. package/local-dist-new/observability.js +0 -2
  938. package/local-dist-new/observability.js.map +0 -1
  939. package/local-dist-new/react-host/index.d.ts +0 -10
  940. package/local-dist-new/react-host/index.d.ts.map +0 -1
  941. package/local-dist-new/react-host/index.js +0 -9
  942. package/local-dist-new/react-host/index.js.map +0 -1
  943. package/local-dist-new/react-host/ink.d.ts +0 -6
  944. package/local-dist-new/react-host/ink.d.ts.map +0 -1
  945. package/local-dist-new/react-host/ink.js +0 -7
  946. package/local-dist-new/react-host/ink.js.map +0 -1
  947. package/local-dist-new/react-host/jsx-runtime.d.ts +0 -5
  948. package/local-dist-new/react-host/jsx-runtime.d.ts.map +0 -1
  949. package/local-dist-new/react-host/jsx-runtime.js +0 -6
  950. package/local-dist-new/react-host/jsx-runtime.js.map +0 -1
  951. package/local-dist-new/react-host/loader.d.ts +0 -4
  952. package/local-dist-new/react-host/loader.d.ts.map +0 -1
  953. package/local-dist-new/react-host/loader.js +0 -108
  954. package/local-dist-new/react-host/loader.js.map +0 -1
  955. package/local-dist-new/react-ink/components/ChangelogBlock.d.ts +0 -9
  956. package/local-dist-new/react-ink/components/ChangelogBlock.d.ts.map +0 -1
  957. package/local-dist-new/react-ink/components/ChangelogBlock.js +0 -58
  958. package/local-dist-new/react-ink/components/ChangelogBlock.js.map +0 -1
  959. package/local-dist-new/react-ink/components/DisplayBlockView.d.ts +0 -9
  960. package/local-dist-new/react-ink/components/DisplayBlockView.d.ts.map +0 -1
  961. package/local-dist-new/react-ink/components/DisplayBlockView.js +0 -11
  962. package/local-dist-new/react-ink/components/DisplayBlockView.js.map +0 -1
  963. package/local-dist-new/react-ink/components/Footer.d.ts +0 -12
  964. package/local-dist-new/react-ink/components/Footer.d.ts.map +0 -1
  965. package/local-dist-new/react-ink/components/Footer.js +0 -113
  966. package/local-dist-new/react-ink/components/Footer.js.map +0 -1
  967. package/local-dist-new/react-ink/components/MessageList.d.ts +0 -15
  968. package/local-dist-new/react-ink/components/MessageList.d.ts.map +0 -1
  969. package/local-dist-new/react-ink/components/MessageList.js +0 -43
  970. package/local-dist-new/react-ink/components/MessageList.js.map +0 -1
  971. package/local-dist-new/react-ink/components/MessageRow.d.ts +0 -14
  972. package/local-dist-new/react-ink/components/MessageRow.d.ts.map +0 -1
  973. package/local-dist-new/react-ink/components/MessageRow.js +0 -35
  974. package/local-dist-new/react-ink/components/MessageRow.js.map +0 -1
  975. package/local-dist-new/react-ink/components/StatusLine.d.ts +0 -10
  976. package/local-dist-new/react-ink/components/StatusLine.d.ts.map +0 -1
  977. package/local-dist-new/react-ink/components/StatusLine.js +0 -39
  978. package/local-dist-new/react-ink/components/StatusLine.js.map +0 -1
  979. package/local-dist-new/react-ink/components/TaskPanel.d.ts +0 -12
  980. package/local-dist-new/react-ink/components/TaskPanel.d.ts.map +0 -1
  981. package/local-dist-new/react-ink/components/TaskPanel.js +0 -23
  982. package/local-dist-new/react-ink/components/TaskPanel.js.map +0 -1
  983. package/local-dist-new/react-ink/components/ToolEventBlock.d.ts +0 -18
  984. package/local-dist-new/react-ink/components/ToolEventBlock.d.ts.map +0 -1
  985. package/local-dist-new/react-ink/components/ToolEventBlock.js +0 -61
  986. package/local-dist-new/react-ink/components/ToolEventBlock.js.map +0 -1
  987. package/local-dist-new/react-ink/components/dialogs/DialogFrame.d.ts +0 -9
  988. package/local-dist-new/react-ink/components/dialogs/DialogFrame.d.ts.map +0 -1
  989. package/local-dist-new/react-ink/components/dialogs/DialogFrame.js +0 -6
  990. package/local-dist-new/react-ink/components/dialogs/DialogFrame.js.map +0 -1
  991. package/local-dist-new/react-ink/components/dialogs/LoginDialog.d.ts +0 -15
  992. package/local-dist-new/react-ink/components/dialogs/LoginDialog.d.ts.map +0 -1
  993. package/local-dist-new/react-ink/components/dialogs/LoginDialog.js +0 -10
  994. package/local-dist-new/react-ink/components/dialogs/LoginDialog.js.map +0 -1
  995. package/local-dist-new/react-ink/components/dialogs/ModelDialog.d.ts +0 -10
  996. package/local-dist-new/react-ink/components/dialogs/ModelDialog.d.ts.map +0 -1
  997. package/local-dist-new/react-ink/components/dialogs/ModelDialog.js +0 -64
  998. package/local-dist-new/react-ink/components/dialogs/ModelDialog.js.map +0 -1
  999. package/local-dist-new/react-ink/components/dialogs/OAuthDialog.d.ts +0 -10
  1000. package/local-dist-new/react-ink/components/dialogs/OAuthDialog.d.ts.map +0 -1
  1001. package/local-dist-new/react-ink/components/dialogs/OAuthDialog.js +0 -24
  1002. package/local-dist-new/react-ink/components/dialogs/OAuthDialog.js.map +0 -1
  1003. package/local-dist-new/react-ink/components/dialogs/ScopedModelsDialog.d.ts +0 -10
  1004. package/local-dist-new/react-ink/components/dialogs/ScopedModelsDialog.d.ts.map +0 -1
  1005. package/local-dist-new/react-ink/components/dialogs/ScopedModelsDialog.js +0 -95
  1006. package/local-dist-new/react-ink/components/dialogs/ScopedModelsDialog.js.map +0 -1
  1007. package/local-dist-new/react-ink/components/dialogs/SelectableDialog.d.ts +0 -17
  1008. package/local-dist-new/react-ink/components/dialogs/SelectableDialog.d.ts.map +0 -1
  1009. package/local-dist-new/react-ink/components/dialogs/SelectableDialog.js +0 -66
  1010. package/local-dist-new/react-ink/components/dialogs/SelectableDialog.js.map +0 -1
  1011. package/local-dist-new/react-ink/components/dialogs/SessionDialog.d.ts +0 -14
  1012. package/local-dist-new/react-ink/components/dialogs/SessionDialog.d.ts.map +0 -1
  1013. package/local-dist-new/react-ink/components/dialogs/SessionDialog.js +0 -201
  1014. package/local-dist-new/react-ink/components/dialogs/SessionDialog.js.map +0 -1
  1015. package/local-dist-new/react-ink/components/dialogs/SettingsDialog.d.ts +0 -15
  1016. package/local-dist-new/react-ink/components/dialogs/SettingsDialog.d.ts.map +0 -1
  1017. package/local-dist-new/react-ink/components/dialogs/SettingsDialog.js +0 -79
  1018. package/local-dist-new/react-ink/components/dialogs/SettingsDialog.js.map +0 -1
  1019. package/local-dist-new/react-ink/components/dialogs/StartupSessionPicker.d.ts +0 -10
  1020. package/local-dist-new/react-ink/components/dialogs/StartupSessionPicker.d.ts.map +0 -1
  1021. package/local-dist-new/react-ink/components/dialogs/StartupSessionPicker.js +0 -100
  1022. package/local-dist-new/react-ink/components/dialogs/StartupSessionPicker.js.map +0 -1
  1023. package/local-dist-new/react-ink/components/dialogs/ThemeDialog.d.ts +0 -8
  1024. package/local-dist-new/react-ink/components/dialogs/ThemeDialog.d.ts.map +0 -1
  1025. package/local-dist-new/react-ink/components/dialogs/ThemeDialog.js +0 -7
  1026. package/local-dist-new/react-ink/components/dialogs/ThemeDialog.js.map +0 -1
  1027. package/local-dist-new/react-ink/components/dialogs/TreeDialog.d.ts +0 -9
  1028. package/local-dist-new/react-ink/components/dialogs/TreeDialog.d.ts.map +0 -1
  1029. package/local-dist-new/react-ink/components/dialogs/TreeDialog.js +0 -7
  1030. package/local-dist-new/react-ink/components/dialogs/TreeDialog.js.map +0 -1
  1031. package/local-dist-new/react-ink/components/dialogs/UserMessageDialog.d.ts +0 -9
  1032. package/local-dist-new/react-ink/components/dialogs/UserMessageDialog.d.ts.map +0 -1
  1033. package/local-dist-new/react-ink/components/dialogs/UserMessageDialog.js +0 -7
  1034. package/local-dist-new/react-ink/components/dialogs/UserMessageDialog.js.map +0 -1
  1035. package/local-dist-new/react-ink/components/messages/AssistantMessage.d.ts +0 -13
  1036. package/local-dist-new/react-ink/components/messages/AssistantMessage.d.ts.map +0 -1
  1037. package/local-dist-new/react-ink/components/messages/AssistantMessage.js +0 -20
  1038. package/local-dist-new/react-ink/components/messages/AssistantMessage.js.map +0 -1
  1039. package/local-dist-new/react-ink/components/messages/BashMessage.d.ts +0 -9
  1040. package/local-dist-new/react-ink/components/messages/BashMessage.d.ts.map +0 -1
  1041. package/local-dist-new/react-ink/components/messages/BashMessage.js +0 -11
  1042. package/local-dist-new/react-ink/components/messages/BashMessage.js.map +0 -1
  1043. package/local-dist-new/react-ink/components/messages/BranchSummaryMessage.d.ts +0 -9
  1044. package/local-dist-new/react-ink/components/messages/BranchSummaryMessage.d.ts.map +0 -1
  1045. package/local-dist-new/react-ink/components/messages/BranchSummaryMessage.js +0 -6
  1046. package/local-dist-new/react-ink/components/messages/BranchSummaryMessage.js.map +0 -1
  1047. package/local-dist-new/react-ink/components/messages/CompactionMessage.d.ts +0 -9
  1048. package/local-dist-new/react-ink/components/messages/CompactionMessage.d.ts.map +0 -1
  1049. package/local-dist-new/react-ink/components/messages/CompactionMessage.js +0 -6
  1050. package/local-dist-new/react-ink/components/messages/CompactionMessage.js.map +0 -1
  1051. package/local-dist-new/react-ink/components/messages/CustomMessage.d.ts +0 -10
  1052. package/local-dist-new/react-ink/components/messages/CustomMessage.d.ts.map +0 -1
  1053. package/local-dist-new/react-ink/components/messages/CustomMessage.js +0 -9
  1054. package/local-dist-new/react-ink/components/messages/CustomMessage.js.map +0 -1
  1055. package/local-dist-new/react-ink/components/messages/SkillInvocationMessage.d.ts +0 -8
  1056. package/local-dist-new/react-ink/components/messages/SkillInvocationMessage.d.ts.map +0 -1
  1057. package/local-dist-new/react-ink/components/messages/SkillInvocationMessage.js +0 -10
  1058. package/local-dist-new/react-ink/components/messages/SkillInvocationMessage.js.map +0 -1
  1059. package/local-dist-new/react-ink/components/messages/ToolCallMessage.d.ts +0 -9
  1060. package/local-dist-new/react-ink/components/messages/ToolCallMessage.d.ts.map +0 -1
  1061. package/local-dist-new/react-ink/components/messages/ToolCallMessage.js +0 -8
  1062. package/local-dist-new/react-ink/components/messages/ToolCallMessage.js.map +0 -1
  1063. package/local-dist-new/react-ink/components/messages/ToolResultBlock.d.ts +0 -13
  1064. package/local-dist-new/react-ink/components/messages/ToolResultBlock.d.ts.map +0 -1
  1065. package/local-dist-new/react-ink/components/messages/ToolResultBlock.js +0 -8
  1066. package/local-dist-new/react-ink/components/messages/ToolResultBlock.js.map +0 -1
  1067. package/local-dist-new/react-ink/components/messages/UserMessage.d.ts +0 -10
  1068. package/local-dist-new/react-ink/components/messages/UserMessage.d.ts.map +0 -1
  1069. package/local-dist-new/react-ink/components/messages/UserMessage.js +0 -9
  1070. package/local-dist-new/react-ink/components/messages/UserMessage.js.map +0 -1
  1071. package/local-dist-new/react-ink/index.d.ts +0 -35
  1072. package/local-dist-new/react-ink/index.d.ts.map +0 -1
  1073. package/local-dist-new/react-ink/index.js +0 -35
  1074. package/local-dist-new/react-ink/index.js.map +0 -1
  1075. package/local-dist-new/react-ink/theme-adapter.d.ts +0 -10
  1076. package/local-dist-new/react-ink/theme-adapter.d.ts.map +0 -1
  1077. package/local-dist-new/react-ink/theme-adapter.js +0 -44
  1078. package/local-dist-new/react-ink/theme-adapter.js.map +0 -1
  1079. package/local-dist-new/react-ink/types.d.ts +0 -134
  1080. package/local-dist-new/react-ink/types.d.ts.map +0 -1
  1081. package/local-dist-new/react-ink/types.js +0 -2
  1082. package/local-dist-new/react-ink/types.js.map +0 -1
  1083. package/local-dist-new/react-ink/utils/message-groups.d.ts +0 -26
  1084. package/local-dist-new/react-ink/utils/message-groups.d.ts.map +0 -1
  1085. package/local-dist-new/react-ink/utils/message-groups.js +0 -240
  1086. package/local-dist-new/react-ink/utils/message-groups.js.map +0 -1
  1087. package/local-dist-new/react-ink/utils/selection-dialog.d.ts +0 -3
  1088. package/local-dist-new/react-ink/utils/selection-dialog.d.ts.map +0 -1
  1089. package/local-dist-new/react-ink/utils/selection-dialog.js +0 -18
  1090. package/local-dist-new/react-ink/utils/selection-dialog.js.map +0 -1
  1091. package/local-dist-new/react-ink/utils/session-browser.d.ts +0 -28
  1092. package/local-dist-new/react-ink/utils/session-browser.d.ts.map +0 -1
  1093. package/local-dist-new/react-ink/utils/session-browser.js +0 -191
  1094. package/local-dist-new/react-ink/utils/session-browser.js.map +0 -1
  1095. package/local-dist-new/react-ink/utils/tool-display.d.ts +0 -22
  1096. package/local-dist-new/react-ink/utils/tool-display.d.ts.map +0 -1
  1097. package/local-dist-new/react-ink/utils/tool-display.js +0 -349
  1098. package/local-dist-new/react-ink/utils/tool-display.js.map +0 -1
  1099. package/local-dist-new/react-ink.d.ts +0 -3
  1100. package/local-dist-new/react-ink.d.ts.map +0 -1
  1101. package/local-dist-new/react-ink.js +0 -2
  1102. package/local-dist-new/react-ink.js.map +0 -1
  1103. package/local-dist-new/tui.d.ts +0 -9
  1104. package/local-dist-new/tui.d.ts.map +0 -1
  1105. package/local-dist-new/tui.js +0 -8
  1106. package/local-dist-new/tui.js.map +0 -1
  1107. package/local-dist-new/ui/autocomplete.d.ts +0 -60
  1108. package/local-dist-new/ui/autocomplete.d.ts.map +0 -1
  1109. package/local-dist-new/ui/autocomplete.js +0 -393
  1110. package/local-dist-new/ui/autocomplete.js.map +0 -1
  1111. package/local-dist-new/ui/contracts.d.ts +0 -39
  1112. package/local-dist-new/ui/contracts.d.ts.map +0 -1
  1113. package/local-dist-new/ui/contracts.js +0 -2
  1114. package/local-dist-new/ui/contracts.js.map +0 -1
  1115. package/local-dist-new/ui/editor-component.d.ts +0 -101
  1116. package/local-dist-new/ui/editor-component.d.ts.map +0 -1
  1117. package/local-dist-new/ui/editor-component.js +0 -2
  1118. package/local-dist-new/ui/editor-component.js.map +0 -1
  1119. package/local-dist-new/ui/fuzzy.d.ts +0 -26
  1120. package/local-dist-new/ui/fuzzy.d.ts.map +0 -1
  1121. package/local-dist-new/ui/fuzzy.js +0 -177
  1122. package/local-dist-new/ui/fuzzy.js.map +0 -1
  1123. package/local-dist-new/ui/index.d.ts +0 -9
  1124. package/local-dist-new/ui/index.d.ts.map +0 -1
  1125. package/local-dist-new/ui/index.js +0 -6
  1126. package/local-dist-new/ui/index.js.map +0 -1
  1127. package/local-dist-new/ui/keybindings.d.ts +0 -52
  1128. package/local-dist-new/ui/keybindings.d.ts.map +0 -1
  1129. package/local-dist-new/ui/keybindings.js +0 -193
  1130. package/local-dist-new/ui/keybindings.js.map +0 -1
  1131. package/local-dist-new/ui/keys.d.ts +0 -168
  1132. package/local-dist-new/ui/keys.d.ts.map +0 -1
  1133. package/local-dist-new/ui/keys.js +0 -1093
  1134. package/local-dist-new/ui/keys.js.map +0 -1
  1135. package/local-dist-new/ui/theme-types.d.ts +0 -37
  1136. package/local-dist-new/ui/theme-types.d.ts.map +0 -1
  1137. package/local-dist-new/ui/theme-types.js +0 -2
  1138. package/local-dist-new/ui/theme-types.js.map +0 -1
  1139. package/local-dist-new/ui/utils.d.ts +0 -97
  1140. package/local-dist-new/ui/utils.d.ts.map +0 -1
  1141. package/local-dist-new/ui/utils.js +0 -860
  1142. package/local-dist-new/ui/utils.js.map +0 -1
  1143. package/observe.d.ts +0 -1
  1144. package/observe.js +0 -1
@@ -0,0 +1,2663 @@
1
+ // src/capabilities/kernel/spec.ts
2
+ function coerceInput(raw) {
3
+ if (typeof raw === "string") {
4
+ const trimmed = raw.trim();
5
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
6
+ try {
7
+ return JSON.parse(trimmed);
8
+ } catch {
9
+ }
10
+ }
11
+ return raw;
12
+ }
13
+ if (raw === null || raw === void 0) {
14
+ return {};
15
+ }
16
+ return raw;
17
+ }
18
+ function describeThrow(err) {
19
+ if (err instanceof Error) return err.message;
20
+ if (typeof err === "string") return err;
21
+ try {
22
+ return JSON.stringify(err);
23
+ } catch {
24
+ return String(err);
25
+ }
26
+ }
27
+ function projectOutcome(id, result) {
28
+ const blocks = result.content;
29
+ let output;
30
+ if (blocks.length === 1) {
31
+ const only = blocks[0];
32
+ output = only.kind === "text" ? only.text : only.value;
33
+ } else {
34
+ output = blocks;
35
+ }
36
+ return { id, output, isError: result.isError === true };
37
+ }
38
+ function defineTool(spec) {
39
+ return {
40
+ name: spec.name,
41
+ // Facade `AgentTool` surface: top-level schema fields + an `execute` adapter
42
+ // so the tool is usable by the high-level `Agent` as well as the kernel.
43
+ label: spec.name,
44
+ description: spec.description,
45
+ parameters: spec.parameters,
46
+ async execute(_toolCallId, params, signal) {
47
+ const ctx = {
48
+ cwd: process.cwd(),
49
+ signal: signal ?? new AbortController().signal
50
+ };
51
+ try {
52
+ const result = await spec.run(coerceInput(params), ctx);
53
+ return {
54
+ content: result.content.map(
55
+ (block) => block.kind === "text" ? { type: "text", text: block.text } : { type: "text", text: JSON.stringify(block.value) }
56
+ ),
57
+ details: {},
58
+ isError: result.isError ?? false
59
+ };
60
+ } catch (err) {
61
+ return {
62
+ content: [{ type: "text", text: `${spec.name} did not finish: ${describeThrow(err)}` }],
63
+ details: {},
64
+ isError: true
65
+ };
66
+ }
67
+ },
68
+ descriptor() {
69
+ return {
70
+ name: spec.name,
71
+ description: spec.description,
72
+ parameters: spec.parameters
73
+ };
74
+ },
75
+ async invoke(call, ctx) {
76
+ if (ctx.signal.aborted) {
77
+ return {
78
+ id: call.id,
79
+ output: `Cancelled before ${spec.name} could begin.`,
80
+ isError: true
81
+ };
82
+ }
83
+ try {
84
+ const input = coerceInput(call.input);
85
+ const result = await spec.run(input, ctx);
86
+ return projectOutcome(call.id, result);
87
+ } catch (err) {
88
+ return {
89
+ id: call.id,
90
+ output: `${spec.name} did not finish: ${describeThrow(err)}`,
91
+ isError: true
92
+ };
93
+ }
94
+ }
95
+ };
96
+ }
97
+
98
+ // src/capabilities/kernel/output.ts
99
+ function defaultNotice(omitted) {
100
+ return `
101
+ \u2026 trimmed ${omitted} byte${omitted === 1 ? "" : "s"} to fit the window \u2026
102
+ `;
103
+ }
104
+ function boundaryFromStart(text, byteTarget) {
105
+ let bytes = 0;
106
+ let i = 0;
107
+ while (i < text.length) {
108
+ const cp = text.codePointAt(i);
109
+ const width = utf8Width(cp);
110
+ if (bytes + width > byteTarget) break;
111
+ bytes += width;
112
+ i += cp > 65535 ? 2 : 1;
113
+ }
114
+ return i;
115
+ }
116
+ function boundaryFromEnd(text, byteTarget) {
117
+ let bytes = 0;
118
+ let i = text.length;
119
+ while (i > 0) {
120
+ let prev = i - 1;
121
+ if (prev > 0 && isLowSurrogate(text.charCodeAt(prev)) && isHighSurrogate(text.charCodeAt(prev - 1))) {
122
+ prev -= 1;
123
+ }
124
+ const cp = text.codePointAt(prev);
125
+ const width = utf8Width(cp);
126
+ if (bytes + width > byteTarget) break;
127
+ bytes += width;
128
+ i = prev;
129
+ }
130
+ return i;
131
+ }
132
+ function utf8Width(cp) {
133
+ if (cp <= 127) return 1;
134
+ if (cp <= 2047) return 2;
135
+ if (cp <= 65535) return 3;
136
+ return 4;
137
+ }
138
+ function isHighSurrogate(unit) {
139
+ return unit >= 55296 && unit <= 56319;
140
+ }
141
+ function isLowSurrogate(unit) {
142
+ return unit >= 56320 && unit <= 57343;
143
+ }
144
+ function clamp(text, policy) {
145
+ const total = Buffer.byteLength(text, "utf8");
146
+ if (total <= policy.maxBytes) return text;
147
+ const mark = policy.notice ?? defaultNotice;
148
+ if (policy.kind === "head") {
149
+ const cut = boundaryFromStart(text, policy.maxBytes);
150
+ const kept = text.slice(0, cut);
151
+ const omitted2 = total - Buffer.byteLength(kept, "utf8");
152
+ return kept + mark(omitted2);
153
+ }
154
+ if (policy.kind === "tail") {
155
+ const cut = boundaryFromEnd(text, policy.maxBytes);
156
+ const kept = text.slice(cut);
157
+ const omitted2 = total - Buffer.byteLength(kept, "utf8");
158
+ return mark(omitted2) + kept;
159
+ }
160
+ const headShare = Math.floor(policy.maxBytes / 2);
161
+ const tailShare = policy.maxBytes - headShare;
162
+ const headCut = boundaryFromStart(text, headShare);
163
+ const tailCut = boundaryFromEnd(text, tailShare);
164
+ if (tailCut <= headCut) return text;
165
+ const headKept = text.slice(0, headCut);
166
+ const tailKept = text.slice(tailCut);
167
+ const omitted = total - Buffer.byteLength(headKept, "utf8") - Buffer.byteLength(tailKept, "utf8");
168
+ return headKept + mark(omitted) + tailKept;
169
+ }
170
+
171
+ // src/capabilities/kernel/registry.ts
172
+ var UnknownToolError = class extends Error {
173
+ /** The offending tool or collection name. */
174
+ missing;
175
+ constructor(kind, missing) {
176
+ super(`No ${kind} named "${missing}" is registered.`);
177
+ this.name = "UnknownToolError";
178
+ this.missing = missing;
179
+ }
180
+ };
181
+ var ToolRegistry = class {
182
+ tools = /* @__PURE__ */ new Map();
183
+ collections = /* @__PURE__ */ new Map();
184
+ /** Add a defined tool. A later registration under the same name replaces it. */
185
+ register(tool) {
186
+ this.tools.set(tool.name, tool);
187
+ return this;
188
+ }
189
+ /** Register several tools in one call. */
190
+ registerAll(tools) {
191
+ for (const tool of tools) this.register(tool);
192
+ return this;
193
+ }
194
+ /** True when a tool with this name has been registered. */
195
+ has(name) {
196
+ return this.tools.has(name);
197
+ }
198
+ /** Fetch a registered tool, or throw {@link UnknownToolError} if absent. */
199
+ get(name) {
200
+ const tool = this.tools.get(name);
201
+ if (!tool) throw new UnknownToolError("tool", name);
202
+ return tool;
203
+ }
204
+ /** The names of every registered tool, in registration order. */
205
+ names() {
206
+ return [...this.tools.keys()];
207
+ }
208
+ /**
209
+ * Define (or redefine) a named collection as the given list of tool names.
210
+ * Every listed tool must already be registered.
211
+ */
212
+ collection(name, toolNames) {
213
+ for (const toolName of toolNames) {
214
+ if (!this.tools.has(toolName)) throw new UnknownToolError("tool", toolName);
215
+ }
216
+ this.collections.set(name, [...toolNames]);
217
+ return this;
218
+ }
219
+ /** The tool names belonging to a collection, or throw if it is undefined. */
220
+ membersOf(collectionName) {
221
+ const members = this.collections.get(collectionName);
222
+ if (!members) throw new UnknownToolError("collection", collectionName);
223
+ return [...members];
224
+ }
225
+ /** The names of every defined collection. */
226
+ collectionNames() {
227
+ return [...this.collections.keys()];
228
+ }
229
+ /**
230
+ * Build a runtime {@link ToolBox} from a set of tools.
231
+ *
232
+ * Pass a collection name to box that collection, or omit it to box every
233
+ * registered tool. `ctxFactory` is invoked once per dispatched call to mint
234
+ * the {@link ToolContext} the chosen tool runs under.
235
+ */
236
+ toToolBox(ctxFactory, collectionName) {
237
+ const selected = collectionName === void 0 ? [...this.tools.values()] : this.membersOf(collectionName).map((n) => this.get(n));
238
+ const byName = new Map(selected.map((t) => [t.name, t]));
239
+ const runner = {
240
+ async run(call, signal) {
241
+ const tool = byName.get(call.name);
242
+ if (!tool) {
243
+ return {
244
+ id: call.id,
245
+ output: `This session exposes no tool called "${call.name}".`,
246
+ isError: true
247
+ };
248
+ }
249
+ const base = ctxFactory();
250
+ const ctx = { ...base, signal };
251
+ return tool.invoke(call, ctx);
252
+ }
253
+ };
254
+ return {
255
+ descriptors() {
256
+ return selected.map((t) => t.descriptor());
257
+ },
258
+ runner
259
+ };
260
+ }
261
+ };
262
+
263
+ // src/capabilities/backends/node-backends.ts
264
+ import { promises as fsp } from "node:fs";
265
+ import { spawn as childSpawn } from "node:child_process";
266
+ var NodeFs = class {
267
+ async readFile(path, encoding) {
268
+ if (encoding === void 0) {
269
+ const buf = await fsp.readFile(path);
270
+ return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
271
+ }
272
+ return fsp.readFile(path, { encoding });
273
+ }
274
+ async writeFile(path, data, encoding) {
275
+ if (typeof data === "string") {
276
+ await fsp.writeFile(path, data, { encoding: encoding ?? "utf8" });
277
+ return;
278
+ }
279
+ await fsp.writeFile(path, data);
280
+ }
281
+ async stat(path) {
282
+ const link = await fsp.lstat(path);
283
+ const isSymlink = link.isSymbolicLink();
284
+ const resolved = isSymlink ? await fsp.stat(path) : link;
285
+ return {
286
+ isFile: resolved.isFile(),
287
+ isDirectory: resolved.isDirectory(),
288
+ isSymlink,
289
+ size: resolved.size,
290
+ modifiedMs: resolved.mtimeMs
291
+ };
292
+ }
293
+ async readdir(path) {
294
+ const entries = await fsp.readdir(path, { withFileTypes: true });
295
+ return entries.map((entry) => ({
296
+ name: entry.name,
297
+ isDirectory: entry.isDirectory()
298
+ }));
299
+ }
300
+ async mkdir(path, options) {
301
+ await fsp.mkdir(path, { recursive: options?.recursive ?? false });
302
+ }
303
+ async rm(path, options) {
304
+ await fsp.rm(path, {
305
+ recursive: options?.recursive ?? false,
306
+ force: options?.ignoreMissing ?? false
307
+ });
308
+ }
309
+ async exists(path) {
310
+ try {
311
+ await fsp.stat(path);
312
+ return true;
313
+ } catch {
314
+ return false;
315
+ }
316
+ }
317
+ };
318
+ var nodeFs = new NodeFs();
319
+ function joinChunks(chunks) {
320
+ return Buffer.concat(chunks).toString("utf8");
321
+ }
322
+ function asSignal(signal) {
323
+ return signal;
324
+ }
325
+ var NodeShell = class {
326
+ exec(command, options) {
327
+ if (typeof command !== "string" || command.length === 0) {
328
+ return Promise.reject(
329
+ new Error("A shell command must be a non-empty string.")
330
+ );
331
+ }
332
+ return new Promise((resolve, reject) => {
333
+ const child = childSpawn(command, {
334
+ shell: true,
335
+ cwd: options?.cwd,
336
+ env: options?.env ? { ...process.env, ...options.env } : process.env,
337
+ signal: options?.signal
338
+ });
339
+ const out = [];
340
+ const err = [];
341
+ let settled = false;
342
+ let timedOut = false;
343
+ let timer;
344
+ const finish = (fn) => {
345
+ if (settled) return;
346
+ settled = true;
347
+ if (timer !== void 0) clearTimeout(timer);
348
+ fn();
349
+ };
350
+ child.stdout?.on("data", (chunk) => out.push(chunk));
351
+ child.stderr?.on("data", (chunk) => err.push(chunk));
352
+ if (options?.input !== void 0 && child.stdin) {
353
+ child.stdin.write(options.input);
354
+ child.stdin.end();
355
+ } else {
356
+ child.stdin?.end();
357
+ }
358
+ const limit = options?.timeoutMs;
359
+ if (limit !== void 0 && limit > 0) {
360
+ timer = setTimeout(() => {
361
+ timedOut = true;
362
+ child.kill("SIGTERM");
363
+ }, limit);
364
+ }
365
+ child.on("error", (cause) => {
366
+ finish(() => reject(cause));
367
+ });
368
+ child.on("close", (code, signal) => {
369
+ finish(() => {
370
+ if (timedOut) {
371
+ reject(
372
+ new Error(
373
+ `The command exceeded its ${limit}ms deadline and was stopped.`
374
+ )
375
+ );
376
+ return;
377
+ }
378
+ resolve({
379
+ stdout: joinChunks(out),
380
+ stderr: joinChunks(err),
381
+ // On a signalled exit Node reports a null code; preserve that so the
382
+ // caller can tell "killed" apart from "exited 0".
383
+ code: signal !== null ? null : code
384
+ });
385
+ });
386
+ });
387
+ });
388
+ }
389
+ spawn(command, options) {
390
+ if (typeof command !== "string" || command.length === 0) {
391
+ throw new Error("A shell command must be a non-empty string.");
392
+ }
393
+ const child = childSpawn(command, {
394
+ shell: true,
395
+ cwd: options?.cwd,
396
+ env: options?.env ? { ...process.env, ...options.env } : process.env,
397
+ signal: options?.signal
398
+ });
399
+ return new NodeShellHandle(child);
400
+ }
401
+ };
402
+ var NodeShellHandle = class {
403
+ child;
404
+ listeners = /* @__PURE__ */ new Set();
405
+ exited = false;
406
+ exitCode = null;
407
+ exitSignal = null;
408
+ constructor(child) {
409
+ this.child = child;
410
+ child.once(
411
+ "close",
412
+ (code, signal) => {
413
+ this.exited = true;
414
+ this.exitCode = code;
415
+ this.exitSignal = asSignal(signal);
416
+ for (const listener of [...this.listeners]) {
417
+ listener(this.exitCode, this.exitSignal);
418
+ }
419
+ this.listeners.clear();
420
+ }
421
+ );
422
+ }
423
+ get pid() {
424
+ return this.child.pid;
425
+ }
426
+ kill(signal) {
427
+ if (this.exited) return;
428
+ this.child.kill(signal ?? "SIGTERM");
429
+ }
430
+ onExit(listener) {
431
+ if (this.exited) {
432
+ const code = this.exitCode;
433
+ const signal = this.exitSignal;
434
+ queueMicrotask(() => listener(code, signal));
435
+ return () => {
436
+ };
437
+ }
438
+ this.listeners.add(listener);
439
+ return () => {
440
+ this.listeners.delete(listener);
441
+ };
442
+ }
443
+ };
444
+ var nodeShell = new NodeShell();
445
+ function neverAborts() {
446
+ return new AbortController().signal;
447
+ }
448
+ var standardBudget = {
449
+ kind: "middle",
450
+ maxBytes: 64 * 1024,
451
+ notice: (omitted) => `
452
+ [${omitted} bytes elided to stay within the output ceiling]
453
+ `
454
+ };
455
+ function makeNodeContext(cwd, signal, budget) {
456
+ if (typeof cwd !== "string" || cwd.length === 0) {
457
+ throw new Error("makeNodeContext requires a non-empty working directory.");
458
+ }
459
+ return {
460
+ cwd,
461
+ fs: nodeFs,
462
+ shell: nodeShell,
463
+ signal: signal ?? neverAborts(),
464
+ budget: budget ?? standardBudget
465
+ };
466
+ }
467
+
468
+ // src/capabilities/files/read.ts
469
+ var GUTTER_WIDTH = 6;
470
+ var DESCRIPTION = [
471
+ "Return the contents of a UTF-8 text file, with each line preceded by its",
472
+ "1-based line number. Pass `offset` to begin partway down a large file and",
473
+ "`limit` to cap how many lines come back; together they let you page through",
474
+ "a file in chunks. Output is automatically bounded to fit the model context \u2014",
475
+ "if the selected text is still too large it is shortened and a marker is left",
476
+ "in place of the removed portion."
477
+ ].join(" ");
478
+ function readPositiveInt(value, label) {
479
+ if (value === void 0 || value === null) {
480
+ return { ok: true, value: void 0 };
481
+ }
482
+ if (typeof value !== "number" || !Number.isFinite(value)) {
483
+ return { ok: false, reason: `${label} must be a number when provided.` };
484
+ }
485
+ if (!Number.isInteger(value)) {
486
+ return { ok: false, reason: `${label} must be a whole number, not ${value}.` };
487
+ }
488
+ if (value < 1) {
489
+ return { ok: false, reason: `${label} must be at least 1; got ${value}.` };
490
+ }
491
+ return { ok: true, value };
492
+ }
493
+ function failure(message) {
494
+ return { content: [{ kind: "text", text: message }], isError: true };
495
+ }
496
+ function withGutter(slice, firstLineNumber) {
497
+ const rendered = [];
498
+ for (let i = 0; i < slice.length; i += 1) {
499
+ const lineNo = firstLineNumber + i;
500
+ const label = String(lineNo).padStart(GUTTER_WIDTH, " ");
501
+ rendered.push(`${label} ${slice[i]}`);
502
+ }
503
+ return rendered.join("\n");
504
+ }
505
+ function toLines(text) {
506
+ if (text.length === 0) return [];
507
+ const lines = text.split("\n");
508
+ if (lines.length > 0 && lines[lines.length - 1] === "") {
509
+ lines.pop();
510
+ }
511
+ return lines;
512
+ }
513
+ var readTool = defineTool({
514
+ name: "read",
515
+ description: DESCRIPTION,
516
+ parameters: {
517
+ type: "object",
518
+ properties: {
519
+ path: {
520
+ type: "string",
521
+ description: "Filesystem path of the text file to open."
522
+ },
523
+ offset: {
524
+ type: "integer",
525
+ minimum: 1,
526
+ description: "1-based line number to start reading at. Defaults to the first line."
527
+ },
528
+ limit: {
529
+ type: "integer",
530
+ minimum: 1,
531
+ description: "Greatest number of lines to return, counting from the start line."
532
+ }
533
+ },
534
+ required: ["path"],
535
+ additionalProperties: false
536
+ },
537
+ async run(input, ctx) {
538
+ const raw = input;
539
+ const bag = raw !== null && typeof raw === "object" ? raw : {};
540
+ const rawPath = bag.path;
541
+ if (typeof rawPath !== "string" || rawPath.trim().length === 0) {
542
+ return failure("A non-empty `path` string is required to read a file.");
543
+ }
544
+ const path = rawPath;
545
+ const offsetParse = readPositiveInt(bag.offset, "offset");
546
+ if (!offsetParse.ok) return failure(offsetParse.reason);
547
+ const offset = offsetParse.value;
548
+ const limitParse = readPositiveInt(bag.limit, "limit");
549
+ if (!limitParse.ok) return failure(limitParse.reason);
550
+ const limit = limitParse.value;
551
+ let info;
552
+ try {
553
+ info = await ctx.fs.stat(path);
554
+ } catch {
555
+ return failure(`Nothing readable was found at ${path}.`);
556
+ }
557
+ if (info.isDirectory) {
558
+ return failure(`${path} is a directory, so there is no file text to show.`);
559
+ }
560
+ if (!info.isFile) {
561
+ return failure(`${path} is not a regular file and cannot be read as text.`);
562
+ }
563
+ let text;
564
+ try {
565
+ text = await ctx.fs.readFile(path, "utf8");
566
+ } catch (err) {
567
+ const detail = err instanceof Error ? err.message : String(err);
568
+ return failure(`Could not read ${path}: ${detail}`);
569
+ }
570
+ const allLines = toLines(text);
571
+ const totalLines = allLines.length;
572
+ if (totalLines === 0) {
573
+ return {
574
+ content: [{ kind: "text", text: `${path} is empty (no lines to show).` }]
575
+ };
576
+ }
577
+ const startIndex = offset === void 0 ? 0 : offset - 1;
578
+ if (startIndex >= totalLines) {
579
+ return failure(
580
+ `Start line ${offset} is past the end of ${path}, which has ${totalLines} line${totalLines === 1 ? "" : "s"}.`
581
+ );
582
+ }
583
+ const endIndex = limit === void 0 ? totalLines : Math.min(totalLines, startIndex + limit);
584
+ const windowLines = allLines.slice(startIndex, endIndex);
585
+ const firstLineNumber = startIndex + 1;
586
+ const lastLineNumber = endIndex;
587
+ const windowed = startIndex > 0 || endIndex < totalLines;
588
+ const gutterText = withGutter(windowLines, firstLineNumber);
589
+ const clamped = clamp(gutterText, {
590
+ kind: ctx.budget.kind,
591
+ maxBytes: ctx.budget.maxBytes,
592
+ notice: (omitted) => `
593
+ [read: ${omitted} more byte${omitted === 1 ? "" : "s"} of this file were left out to stay within the response budget]
594
+ `
595
+ });
596
+ const byteTrimmed = clamped !== gutterText;
597
+ const headerParts = [];
598
+ if (windowed) {
599
+ headerParts.push(
600
+ `Showing lines ${firstLineNumber}\u2013${lastLineNumber} of ${totalLines} in ${path}.`
601
+ );
602
+ } else {
603
+ headerParts.push(
604
+ `Showing all ${totalLines} line${totalLines === 1 ? "" : "s"} of ${path}.`
605
+ );
606
+ }
607
+ if (windowed && lastLineNumber < totalLines) {
608
+ const remaining = totalLines - lastLineNumber;
609
+ headerParts.push(
610
+ `${remaining} further line${remaining === 1 ? "" : "s"} follow; raise the start line to keep reading.`
611
+ );
612
+ }
613
+ if (byteTrimmed) {
614
+ headerParts.push(
615
+ "This slice was additionally shortened to fit the response budget (see the inline marker)."
616
+ );
617
+ }
618
+ const body = `${headerParts.join(" ")}
619
+
620
+ ${clamped}`;
621
+ return { content: [{ kind: "text", text: body }] };
622
+ }
623
+ });
624
+
625
+ // src/capabilities/files/write.ts
626
+ var writeParameters = {
627
+ type: "object",
628
+ additionalProperties: false,
629
+ required: ["path", "content"],
630
+ properties: {
631
+ path: {
632
+ type: "string",
633
+ description: "Where the file should be written. A relative path is taken against the session's working directory. Any missing parent folders are created automatically."
634
+ },
635
+ content: {
636
+ type: "string",
637
+ description: "The full text to store. An existing file at this path is replaced wholesale, not appended to."
638
+ }
639
+ }
640
+ };
641
+ function asText(text, failed = false) {
642
+ return { content: [{ kind: "text", text }], isError: failed };
643
+ }
644
+ function readPath(raw) {
645
+ if (typeof raw !== "string") {
646
+ throw new Error("the 'path' argument must be a string naming the file to write");
647
+ }
648
+ if (raw.trim().length === 0) {
649
+ throw new Error("the 'path' argument cannot be empty or whitespace-only");
650
+ }
651
+ return raw;
652
+ }
653
+ function readContent(raw) {
654
+ if (raw === void 0 || raw === null) {
655
+ return "";
656
+ }
657
+ if (typeof raw !== "string") {
658
+ throw new Error("the 'content' argument must be a string of text to write");
659
+ }
660
+ return raw;
661
+ }
662
+ function parentDir(path) {
663
+ const normalized = path.replace(/\\/g, "/");
664
+ const cut = normalized.lastIndexOf("/");
665
+ if (cut <= 0) {
666
+ return "";
667
+ }
668
+ return normalized.slice(0, cut);
669
+ }
670
+ var writeTool = defineTool({
671
+ name: "write",
672
+ description: "Save a UTF-8 text file at the given path, overwriting any file already there. Missing parent directories are created first. Returns a short confirmation including the byte count that was written. Use this to produce or replace whole-file contents; it does not merge or patch.",
673
+ parameters: writeParameters,
674
+ async run(input, ctx) {
675
+ const path = readPath(input?.path);
676
+ const content = readContent(input?.content);
677
+ const folder = parentDir(path);
678
+ if (folder.length > 0) {
679
+ await ctx.fs.mkdir(folder, { recursive: true });
680
+ }
681
+ await ctx.fs.writeFile(path, content, "utf8");
682
+ const bytes = Buffer.byteLength(content, "utf8");
683
+ const unit = bytes === 1 ? "byte" : "bytes";
684
+ return asText(`Saved ${bytes} ${unit} to ${path}.`);
685
+ }
686
+ });
687
+
688
+ // src/capabilities/files/diff.ts
689
+ function splitLines(text) {
690
+ if (text.length === 0) return [""];
691
+ const normalized = text.replace(/\r\n/g, "\n");
692
+ const parts = normalized.split("\n");
693
+ if (parts.length > 1 && parts[parts.length - 1] === "") {
694
+ parts.pop();
695
+ }
696
+ return parts;
697
+ }
698
+ function computeTrace(a, b) {
699
+ const n = a.length;
700
+ const m = b.length;
701
+ const max = n + m;
702
+ const offset = max;
703
+ const v = new Array(2 * max + 1).fill(0);
704
+ const trace = [];
705
+ for (let d = 0; d <= max; d++) {
706
+ trace.push(v.slice());
707
+ for (let k = -d; k <= d; k += 2) {
708
+ let x;
709
+ if (k === -d || k !== d && v[offset + k - 1] < v[offset + k + 1]) {
710
+ x = v[offset + k + 1];
711
+ } else {
712
+ x = v[offset + k - 1] + 1;
713
+ }
714
+ let y = x - k;
715
+ while (x < n && y < m && a[x] === b[y]) {
716
+ x++;
717
+ y++;
718
+ }
719
+ v[offset + k] = x;
720
+ if (x >= n && y >= m) {
721
+ return trace;
722
+ }
723
+ }
724
+ }
725
+ return trace;
726
+ }
727
+ function backtrack(a, b, trace) {
728
+ const n = a.length;
729
+ const m = b.length;
730
+ const offset = n + m;
731
+ const ops = [];
732
+ let x = n;
733
+ let y = m;
734
+ for (let d = trace.length - 1; d >= 0; d--) {
735
+ const v = trace[d];
736
+ const k = x - y;
737
+ let prevK;
738
+ if (k === -d || k !== d && v[offset + k - 1] < v[offset + k + 1]) {
739
+ prevK = k + 1;
740
+ } else {
741
+ prevK = k - 1;
742
+ }
743
+ const prevX = v[offset + prevK];
744
+ const prevY = prevX - prevK;
745
+ while (x > prevX && y > prevY) {
746
+ ops.push({
747
+ kind: "keep",
748
+ text: a[x - 1],
749
+ beforeLine: x,
750
+ afterLine: y
751
+ });
752
+ x--;
753
+ y--;
754
+ }
755
+ if (d > 0) {
756
+ if (x === prevX) {
757
+ ops.push({ kind: "add", text: b[prevY], afterLine: prevY + 1 });
758
+ } else {
759
+ ops.push({ kind: "remove", text: a[prevX], beforeLine: prevX + 1 });
760
+ }
761
+ }
762
+ x = prevX;
763
+ y = prevY;
764
+ }
765
+ ops.reverse();
766
+ return ops;
767
+ }
768
+ function diffLines(before, after) {
769
+ const a = splitLines(before);
770
+ const b = splitLines(after);
771
+ const trace = computeTrace(a, b);
772
+ const ops = backtrack(a, b, trace);
773
+ let added = 0;
774
+ let removed = 0;
775
+ for (const op of ops) {
776
+ if (op.kind === "add") added++;
777
+ else if (op.kind === "remove") removed++;
778
+ }
779
+ return { ops, added, removed };
780
+ }
781
+ function buildHunks(ops, context) {
782
+ const hunks = [];
783
+ let current = null;
784
+ let trailingKeeps = 0;
785
+ const openHunk = (atIndex) => {
786
+ const lead = [];
787
+ for (let i = atIndex - 1; i >= 0 && lead.length < context && ops[i].kind === "keep"; i--) {
788
+ lead.unshift(ops[i]);
789
+ }
790
+ const first = lead[0] ?? ops[atIndex];
791
+ const hunk = {
792
+ beforeStart: first.beforeLine ?? 1,
793
+ beforeCount: 0,
794
+ afterStart: first.afterLine ?? 1,
795
+ afterCount: 0,
796
+ ops: [...lead]
797
+ };
798
+ return hunk;
799
+ };
800
+ for (let i = 0; i < ops.length; i++) {
801
+ const op = ops[i];
802
+ if (op.kind === "keep") {
803
+ if (current) {
804
+ if (trailingKeeps < context) {
805
+ current.ops.push(op);
806
+ trailingKeeps++;
807
+ } else {
808
+ hunks.push(current);
809
+ current = null;
810
+ trailingKeeps = 0;
811
+ }
812
+ }
813
+ continue;
814
+ }
815
+ if (!current) {
816
+ current = openHunk(i);
817
+ }
818
+ current.ops.push(op);
819
+ trailingKeeps = 0;
820
+ }
821
+ if (current) hunks.push(current);
822
+ for (const hunk of hunks) {
823
+ let beforeCount = 0;
824
+ let afterCount = 0;
825
+ let beforeStart = 0;
826
+ let afterStart = 0;
827
+ for (const op of hunk.ops) {
828
+ if (op.kind !== "add") {
829
+ if (beforeStart === 0 && op.beforeLine) beforeStart = op.beforeLine;
830
+ beforeCount++;
831
+ }
832
+ if (op.kind !== "remove") {
833
+ if (afterStart === 0 && op.afterLine) afterStart = op.afterLine;
834
+ afterCount++;
835
+ }
836
+ }
837
+ hunk.beforeStart = beforeStart || (beforeCount === 0 ? 0 : 1);
838
+ hunk.afterStart = afterStart || (afterCount === 0 ? 0 : 1);
839
+ hunk.beforeCount = beforeCount;
840
+ hunk.afterCount = afterCount;
841
+ }
842
+ return hunks;
843
+ }
844
+ function prefixFor(kind) {
845
+ if (kind === "add") return "+";
846
+ if (kind === "remove") return "-";
847
+ return " ";
848
+ }
849
+ function renderUnifiedDiff(before, after, context = 3) {
850
+ const { ops } = diffLines(before, after);
851
+ const hasChange = ops.some((op) => op.kind !== "keep");
852
+ if (!hasChange) return "";
853
+ const hunks = buildHunks(ops, context);
854
+ const lines = [];
855
+ for (const hunk of hunks) {
856
+ lines.push(
857
+ `@@ -${hunk.beforeStart},${hunk.beforeCount} +${hunk.afterStart},${hunk.afterCount} @@`
858
+ );
859
+ for (const op of hunk.ops) {
860
+ lines.push(prefixFor(op.kind) + op.text);
861
+ }
862
+ }
863
+ return lines.join("\n");
864
+ }
865
+
866
+ // src/capabilities/files/edit.ts
867
+ var DIFF_BYTE_CEILING = 16e3;
868
+ function canonicalizeWhitespace(text) {
869
+ return text.replace(/\s+/g, " ").trim();
870
+ }
871
+ function countLiteral(haystack, needle) {
872
+ if (needle.length === 0) return 0;
873
+ let count = 0;
874
+ let from = 0;
875
+ for (; ; ) {
876
+ const at = haystack.indexOf(needle, from);
877
+ if (at === -1) break;
878
+ count++;
879
+ from = at + needle.length;
880
+ }
881
+ return count;
882
+ }
883
+ function replaceAllLiteral(haystack, needle, value) {
884
+ const pieces = [];
885
+ let from = 0;
886
+ for (; ; ) {
887
+ const at = haystack.indexOf(needle, from);
888
+ if (at === -1) {
889
+ pieces.push(haystack.slice(from));
890
+ break;
891
+ }
892
+ pieces.push(haystack.slice(from, at), value);
893
+ from = at + needle.length;
894
+ }
895
+ return pieces.join("");
896
+ }
897
+ function findFuzzySpans(source, target) {
898
+ const wantCanonical = canonicalizeWhitespace(target);
899
+ if (wantCanonical.length === 0) return [];
900
+ const isSpace = (ch) => /\s/.test(ch);
901
+ const spans = [];
902
+ for (let start = 0; start < source.length; start++) {
903
+ if (isSpace(source[start])) continue;
904
+ for (let end = start + 1; end <= source.length; end++) {
905
+ const windowCanonical = canonicalizeWhitespace(source.slice(start, end));
906
+ if (windowCanonical.length > wantCanonical.length) {
907
+ break;
908
+ }
909
+ if (windowCanonical === wantCanonical) {
910
+ let trimmedEnd = end;
911
+ while (trimmedEnd > start && isSpace(source[trimmedEnd - 1])) {
912
+ trimmedEnd--;
913
+ }
914
+ spans.push({ start, end: trimmedEnd });
915
+ start = trimmedEnd - 1;
916
+ break;
917
+ }
918
+ }
919
+ }
920
+ return spans;
921
+ }
922
+ function failure2(message) {
923
+ return { content: [{ kind: "text", text: message }], isError: true };
924
+ }
925
+ function success(path, before, after, replacements) {
926
+ const rawDiff = renderUnifiedDiff(before, after);
927
+ const diff = clamp(rawDiff, {
928
+ kind: "middle",
929
+ maxBytes: DIFF_BYTE_CEILING,
930
+ notice: (omitted) => `
931
+ \u2026 diff shortened, ${omitted} byte(s) of the middle omitted \u2026
932
+ `
933
+ });
934
+ const plural = replacements === 1 ? "" : "s";
935
+ const summary = `Updated ${path} \u2014 applied ${replacements} replacement${plural}.`;
936
+ const json = {
937
+ kind: "json",
938
+ value: { path, replacements, diff }
939
+ };
940
+ return { content: [{ kind: "text", text: summary }, json] };
941
+ }
942
+ async function runEdit(input, ctx) {
943
+ if (typeof input !== "object" || input === null) {
944
+ return failure2("The edit tool expects an object with path, oldText, and newText.");
945
+ }
946
+ const { path, oldText, newText } = input;
947
+ if (typeof path !== "string" || path.trim().length === 0) {
948
+ return failure2("Provide a non-empty `path` string naming the file to edit.");
949
+ }
950
+ if (typeof oldText !== "string") {
951
+ return failure2("`oldText` must be a string holding the snippet to replace.");
952
+ }
953
+ if (typeof newText !== "string") {
954
+ return failure2("`newText` must be a string holding the replacement snippet.");
955
+ }
956
+ if (oldText.length === 0) {
957
+ return failure2("`oldText` cannot be empty \u2014 give the exact text you want replaced.");
958
+ }
959
+ if (oldText === newText) {
960
+ return failure2("`oldText` and `newText` are identical, so there is nothing to change.");
961
+ }
962
+ const replaceAll = input.replaceAll === true;
963
+ const present = await ctx.fs.exists(path);
964
+ if (!present) {
965
+ return failure2(`No file exists at ${path}; nothing to edit.`);
966
+ }
967
+ const info = await ctx.fs.stat(path);
968
+ if (!info.isFile) {
969
+ return failure2(`${path} is not a regular file, so it cannot be edited.`);
970
+ }
971
+ const before = await ctx.fs.readFile(path, "utf8");
972
+ const literalHits = countLiteral(before, oldText);
973
+ if (literalHits > 0) {
974
+ if (!replaceAll && literalHits > 1) {
975
+ return failure2(
976
+ `Found ${literalHits} exact matches for the snippet in ${path}. Pass replaceAll: true to change them all, or widen \`oldText\` so it pinpoints a single location.`
977
+ );
978
+ }
979
+ const after2 = replaceAll ? replaceAllLiteral(before, oldText, newText) : before.replace(oldText, newText);
980
+ if (after2 === before) {
981
+ return failure2(`The replacement left ${path} unchanged.`);
982
+ }
983
+ await ctx.fs.writeFile(path, after2, "utf8");
984
+ return success(path, before, after2, replaceAll ? literalHits : 1);
985
+ }
986
+ const spans = findFuzzySpans(before, oldText);
987
+ if (spans.length === 0) {
988
+ return failure2(
989
+ `Could not locate the snippet in ${path}, even after ignoring whitespace differences. Re-check \`oldText\` against the file's current contents.`
990
+ );
991
+ }
992
+ if (!replaceAll && spans.length > 1) {
993
+ return failure2(
994
+ `The snippet matches ${spans.length} regions of ${path} once whitespace is ignored. Pass replaceAll: true, or extend \`oldText\` to target one region.`
995
+ );
996
+ }
997
+ const targets = replaceAll ? spans : [spans[0]];
998
+ let after = before;
999
+ for (let i = targets.length - 1; i >= 0; i--) {
1000
+ const { start, end } = targets[i];
1001
+ after = after.slice(0, start) + newText + after.slice(end);
1002
+ }
1003
+ if (after === before) {
1004
+ return failure2(`The fuzzy replacement left ${path} unchanged.`);
1005
+ }
1006
+ await ctx.fs.writeFile(path, after, "utf8");
1007
+ return success(path, before, after, targets.length);
1008
+ }
1009
+ var editTool = defineTool({
1010
+ name: "edit",
1011
+ description: "Replace a snippet of text inside one file. By default the snippet (`oldText`) must appear exactly once; if no exact match is found, a single whitespace-tolerant match is attempted. Set `replaceAll` to change every occurrence. Returns a unified-style diff of what changed. The edit is refused when the snippet is missing or matches ambiguously.",
1012
+ parameters: {
1013
+ type: "object",
1014
+ additionalProperties: false,
1015
+ required: ["path", "oldText", "newText"],
1016
+ properties: {
1017
+ path: {
1018
+ type: "string",
1019
+ description: "Path to the file to edit, relative to the working directory or absolute."
1020
+ },
1021
+ oldText: {
1022
+ type: "string",
1023
+ description: "The exact text to find and replace. Must be non-empty."
1024
+ },
1025
+ newText: {
1026
+ type: "string",
1027
+ description: "The text to put in place of `oldText`."
1028
+ },
1029
+ replaceAll: {
1030
+ type: "boolean",
1031
+ description: "Replace every occurrence instead of requiring a single unique match. Defaults to false."
1032
+ }
1033
+ }
1034
+ },
1035
+ run: runEdit
1036
+ });
1037
+
1038
+ // src/capabilities/files/ls.ts
1039
+ var lsParameters = {
1040
+ type: "object",
1041
+ additionalProperties: false,
1042
+ properties: {
1043
+ path: {
1044
+ type: "string",
1045
+ description: "Directory whose immediate contents should be listed. Leave this out to enumerate the session's current working directory."
1046
+ },
1047
+ showHidden: {
1048
+ type: "boolean",
1049
+ description: "Set to true to also surface dot-prefixed entries (such as `.git` or `.env`), which are omitted otherwise."
1050
+ }
1051
+ },
1052
+ required: []
1053
+ };
1054
+ var DESCRIPTION2 = [
1055
+ "List the direct children of a directory, reporting each entry's name, its",
1056
+ "kind (file, directory, symlink, or other), and its size in bytes. Only the",
1057
+ "immediate level is shown \u2014 this does not descend into subdirectories. Pass",
1058
+ "`path` to point at a specific folder, or omit it to read the working",
1059
+ "directory; set `showHidden` to true to include dot-prefixed entries. Long",
1060
+ "listings are trimmed to stay within the response budget."
1061
+ ].join(" ");
1062
+ function failure3(message) {
1063
+ return { content: [{ kind: "text", text: message }], isError: true };
1064
+ }
1065
+ function isHiddenName(name) {
1066
+ return name.startsWith(".");
1067
+ }
1068
+ function compareEntries(a, b) {
1069
+ const aDir = a.kind === "directory";
1070
+ const bDir = b.kind === "directory";
1071
+ if (aDir !== bDir) return aDir ? -1 : 1;
1072
+ const aKey = a.name.toLowerCase();
1073
+ const bKey = b.name.toLowerCase();
1074
+ if (aKey < bKey) return -1;
1075
+ if (aKey > bKey) return 1;
1076
+ if (a.name < b.name) return -1;
1077
+ if (a.name > b.name) return 1;
1078
+ return 0;
1079
+ }
1080
+ function renderRow(entry, kindWidth, sizeWidth) {
1081
+ const kindCell = entry.kind.padEnd(kindWidth, " ");
1082
+ const sizeCell = String(entry.size).padStart(sizeWidth, " ");
1083
+ const display = entry.kind === "directory" ? `${entry.name}/` : entry.name;
1084
+ return `${kindCell} ${sizeCell} ${display}`;
1085
+ }
1086
+ var lsTool = defineTool({
1087
+ name: "ls",
1088
+ description: DESCRIPTION2,
1089
+ parameters: lsParameters,
1090
+ async run(input, ctx) {
1091
+ const raw = input;
1092
+ const bag = raw !== null && typeof raw === "object" ? raw : {};
1093
+ const rawPath = bag.path;
1094
+ let path;
1095
+ if (rawPath === void 0 || rawPath === null) {
1096
+ path = ctx.cwd;
1097
+ } else if (typeof rawPath === "string") {
1098
+ const trimmed = rawPath.trim();
1099
+ path = trimmed.length === 0 ? ctx.cwd : rawPath;
1100
+ } else {
1101
+ return failure3("`path` must be a string when provided.");
1102
+ }
1103
+ const rawShowHidden = bag.showHidden;
1104
+ let showHidden = false;
1105
+ if (rawShowHidden !== void 0 && rawShowHidden !== null) {
1106
+ if (typeof rawShowHidden !== "boolean") {
1107
+ return failure3("`showHidden` must be a boolean when provided.");
1108
+ }
1109
+ showHidden = rawShowHidden;
1110
+ }
1111
+ let info;
1112
+ try {
1113
+ info = await ctx.fs.stat(path);
1114
+ } catch {
1115
+ return failure3(`No directory was found at ${path}.`);
1116
+ }
1117
+ if (!info.isDirectory) {
1118
+ return failure3(`${path} is not a directory, so it cannot be listed.`);
1119
+ }
1120
+ let children;
1121
+ try {
1122
+ children = await ctx.fs.readdir(path);
1123
+ } catch (err) {
1124
+ const detail = err instanceof Error ? err.message : String(err);
1125
+ return failure3(`Could not read the contents of ${path}: ${detail}`);
1126
+ }
1127
+ const entries = [];
1128
+ let hiddenSkipped = 0;
1129
+ for (const child of children) {
1130
+ if (!showHidden && isHiddenName(child.name)) {
1131
+ hiddenSkipped += 1;
1132
+ continue;
1133
+ }
1134
+ const childPath = joinPath(path, child.name);
1135
+ let kind;
1136
+ let size = 0;
1137
+ try {
1138
+ const childInfo = await ctx.fs.stat(childPath);
1139
+ if (childInfo.isSymlink) {
1140
+ kind = "symlink";
1141
+ } else if (childInfo.isDirectory) {
1142
+ kind = "directory";
1143
+ } else if (childInfo.isFile) {
1144
+ kind = "file";
1145
+ } else {
1146
+ kind = "other";
1147
+ }
1148
+ size = childInfo.isDirectory ? 0 : childInfo.size;
1149
+ } catch {
1150
+ kind = child.isDirectory ? "directory" : "other";
1151
+ size = 0;
1152
+ }
1153
+ entries.push({ name: child.name, kind, size });
1154
+ }
1155
+ if (entries.length === 0) {
1156
+ const note = hiddenSkipped > 0 ? ` (${hiddenSkipped} hidden entr${hiddenSkipped === 1 ? "y was" : "ies were"} omitted; pass showHidden to reveal them)` : "";
1157
+ return {
1158
+ content: [
1159
+ { kind: "text", text: `${path} contains no listable entries${note}.` }
1160
+ ]
1161
+ };
1162
+ }
1163
+ entries.sort(compareEntries);
1164
+ let kindWidth = 0;
1165
+ let sizeWidth = 0;
1166
+ for (const entry of entries) {
1167
+ if (entry.kind.length > kindWidth) kindWidth = entry.kind.length;
1168
+ const sizeLen = String(entry.size).length;
1169
+ if (sizeLen > sizeWidth) sizeWidth = sizeLen;
1170
+ }
1171
+ const rows = entries.map((entry) => renderRow(entry, kindWidth, sizeWidth));
1172
+ const table2 = rows.join("\n");
1173
+ const clamped = clamp(table2, {
1174
+ kind: ctx.budget.kind,
1175
+ maxBytes: ctx.budget.maxBytes,
1176
+ notice: (omitted) => `
1177
+ [ls: ${omitted} more byte${omitted === 1 ? "" : "s"} of this listing were withheld to fit the response budget]
1178
+ `
1179
+ });
1180
+ const byteTrimmed = clamped !== table2;
1181
+ const headerParts = [];
1182
+ headerParts.push(
1183
+ `${entries.length} entr${entries.length === 1 ? "y" : "ies"} in ${path}:`
1184
+ );
1185
+ if (!showHidden && hiddenSkipped > 0) {
1186
+ headerParts.push(
1187
+ `(${hiddenSkipped} hidden entr${hiddenSkipped === 1 ? "y" : "ies"} not shown; pass showHidden to include them.)`
1188
+ );
1189
+ }
1190
+ if (byteTrimmed) {
1191
+ headerParts.push(
1192
+ "This listing was shortened to fit the response budget (see the inline marker)."
1193
+ );
1194
+ }
1195
+ const body = `${headerParts.join(" ")}
1196
+
1197
+ ${clamped}`;
1198
+ return { content: [{ kind: "text", text: body }] };
1199
+ }
1200
+ });
1201
+ function joinPath(dir, name) {
1202
+ if (dir.length === 0) return name;
1203
+ const last = dir[dir.length - 1];
1204
+ if (last === "/" || last === "\\") {
1205
+ return `${dir}${name}`;
1206
+ }
1207
+ return `${dir}/${name}`;
1208
+ }
1209
+
1210
+ // src/capabilities/search/grep.ts
1211
+ var PRUNED_DIRS = /* @__PURE__ */ new Set([".git", "node_modules"]);
1212
+ var DEFAULT_HIT_CAP = 200;
1213
+ var ABSOLUTE_HIT_CAP = 5e3;
1214
+ var MAX_FILE_BYTES = 2 * 1024 * 1024;
1215
+ var BadRequest = class extends Error {
1216
+ };
1217
+ function asPositiveInt(value) {
1218
+ if (typeof value !== "number" || !Number.isFinite(value)) return null;
1219
+ const floored = Math.floor(value);
1220
+ return floored > 0 ? floored : null;
1221
+ }
1222
+ function sanitizeFlags(flags) {
1223
+ if (flags === void 0 || flags === null) return "";
1224
+ if (typeof flags !== "string") {
1225
+ throw new BadRequest(
1226
+ 'The `flags` argument, when present, must be a string of letters such as "i" or "m".'
1227
+ );
1228
+ }
1229
+ if (!/^[gimsuy]*$/.test(flags)) {
1230
+ throw new BadRequest(
1231
+ `Unrecognized regex flag in "${flags}"; only the letters g, i, m, s, u and y are accepted.`
1232
+ );
1233
+ }
1234
+ return flags;
1235
+ }
1236
+ function compile(pattern, flags) {
1237
+ try {
1238
+ return new RegExp(pattern, flags);
1239
+ } catch (err) {
1240
+ const why = err instanceof Error ? err.message : String(err);
1241
+ throw new BadRequest(`Could not compile the search pattern: ${why}`);
1242
+ }
1243
+ }
1244
+ function looksBinary(text) {
1245
+ const limit = Math.min(text.length, 4096);
1246
+ for (let i = 0; i < limit; i++) {
1247
+ if (text.charCodeAt(i) === 0) return true;
1248
+ }
1249
+ return false;
1250
+ }
1251
+ function relativize(root, full) {
1252
+ if (full === root) return full;
1253
+ const prefix = root.endsWith("/") ? root : root + "/";
1254
+ return full.startsWith(prefix) ? full.slice(prefix.length) : full;
1255
+ }
1256
+ function joinPath2(parent, child) {
1257
+ return parent.endsWith("/") ? parent + child : parent + "/" + child;
1258
+ }
1259
+ async function scanFile(ctx, root, full, matcher, cap, sink) {
1260
+ let body;
1261
+ try {
1262
+ body = await ctx.fs.readFile(full, "utf8");
1263
+ } catch {
1264
+ return false;
1265
+ }
1266
+ if (looksBinary(body)) return false;
1267
+ const lines = body.split("\n");
1268
+ const shown = relativize(root, full);
1269
+ for (let i = 0; i < lines.length; i++) {
1270
+ if (ctx.signal.aborted) return true;
1271
+ matcher.lastIndex = 0;
1272
+ if (matcher.test(lines[i])) {
1273
+ sink.push({ path: shown, line: i + 1, text: lines[i] });
1274
+ if (sink.length >= cap) return true;
1275
+ }
1276
+ }
1277
+ return false;
1278
+ }
1279
+ async function walk(ctx, root, dir, matcher, cap, sink) {
1280
+ if (ctx.signal.aborted) return true;
1281
+ let children;
1282
+ try {
1283
+ children = await ctx.fs.readdir(dir);
1284
+ } catch {
1285
+ return false;
1286
+ }
1287
+ children.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
1288
+ for (const child of children) {
1289
+ if (ctx.signal.aborted) return true;
1290
+ const full = joinPath2(dir, child.name);
1291
+ if (child.isDirectory) {
1292
+ if (PRUNED_DIRS.has(child.name)) continue;
1293
+ if (await walk(ctx, root, full, matcher, cap, sink)) return true;
1294
+ continue;
1295
+ }
1296
+ try {
1297
+ const info = await ctx.fs.stat(full);
1298
+ if (info.size > MAX_FILE_BYTES) continue;
1299
+ } catch {
1300
+ }
1301
+ if (await scanFile(ctx, root, full, matcher, cap, sink)) return true;
1302
+ }
1303
+ return false;
1304
+ }
1305
+ function renderReport(hits, pattern, cap) {
1306
+ if (hits.length === 0) {
1307
+ return `No lines matched /${pattern}/.`;
1308
+ }
1309
+ const lines = hits.map((h) => `${h.path}:${h.line}: ${h.text}`);
1310
+ const header = hits.length >= cap ? `Reached the ${cap}-hit limit; showing the first ${hits.length} matches:` : `Found ${hits.length} matching line${hits.length === 1 ? "" : "s"}:`;
1311
+ return `${header}
1312
+ ${lines.join("\n")}`;
1313
+ }
1314
+ var grepTool = defineTool({
1315
+ name: "grep",
1316
+ description: 'Search the contents of files for a regular expression. Walks the given path recursively (skipping node_modules and .git), tests each line of every readable text file, and returns matches as `path:line` plus the matching line. Provide `pattern` (a JS regex), and optionally `path` to root the search, `flags` (e.g. "i" for case-insensitive), and `maxMatches` to cap the number of hits. Use this to find where a symbol, string, or phrase appears across a codebase.',
1317
+ parameters: {
1318
+ type: "object",
1319
+ additionalProperties: false,
1320
+ required: ["pattern"],
1321
+ properties: {
1322
+ pattern: {
1323
+ type: "string",
1324
+ description: "The regular expression matched against each line of file content."
1325
+ },
1326
+ path: {
1327
+ type: "string",
1328
+ description: "File or directory to search beneath; defaults to the working directory."
1329
+ },
1330
+ flags: {
1331
+ type: "string",
1332
+ description: "JS regex flag letters (g, i, m, s, u, y); omit for none."
1333
+ },
1334
+ maxMatches: {
1335
+ type: "integer",
1336
+ minimum: 1,
1337
+ description: "Upper bound on reported matches. Defaults to a sensible cap."
1338
+ }
1339
+ }
1340
+ },
1341
+ async run(input, ctx) {
1342
+ try {
1343
+ if (input === null || typeof input !== "object") {
1344
+ throw new BadRequest(
1345
+ "Expected an object of arguments with at least a `pattern` field."
1346
+ );
1347
+ }
1348
+ const pattern = input.pattern;
1349
+ if (typeof pattern !== "string" || pattern.length === 0) {
1350
+ throw new BadRequest(
1351
+ "The `pattern` argument is required and must be a non-empty string."
1352
+ );
1353
+ }
1354
+ const flags = sanitizeFlags(input.flags);
1355
+ const matcher = compile(pattern, flags);
1356
+ const requested = asPositiveInt(input.maxMatches);
1357
+ const cap = Math.min(requested ?? DEFAULT_HIT_CAP, ABSOLUTE_HIT_CAP);
1358
+ let rawPath = ctx.cwd;
1359
+ if (input.path !== void 0 && input.path !== null) {
1360
+ if (typeof input.path !== "string") {
1361
+ throw new BadRequest("The `path` argument, when present, must be a string.");
1362
+ }
1363
+ if (input.path.length > 0) rawPath = input.path;
1364
+ }
1365
+ let rootInfo;
1366
+ try {
1367
+ rootInfo = await ctx.fs.stat(rawPath);
1368
+ } catch {
1369
+ return {
1370
+ content: [
1371
+ {
1372
+ kind: "text",
1373
+ text: `Nothing to search: the path "${rawPath}" does not exist or is unreadable.`
1374
+ }
1375
+ ],
1376
+ isError: true
1377
+ };
1378
+ }
1379
+ const hits = [];
1380
+ if (rootInfo.isDirectory) {
1381
+ await walk(ctx, rawPath, rawPath, matcher, cap, hits);
1382
+ } else if (rootInfo.isFile) {
1383
+ await scanFile(ctx, rawPath, rawPath, matcher, cap, hits);
1384
+ } else {
1385
+ return {
1386
+ content: [
1387
+ {
1388
+ kind: "text",
1389
+ text: `The path "${rawPath}" is neither a file nor a directory; nothing was searched.`
1390
+ }
1391
+ ],
1392
+ isError: true
1393
+ };
1394
+ }
1395
+ if (ctx.signal.aborted) {
1396
+ return {
1397
+ content: [{ kind: "text", text: "Search was cancelled before it finished." }],
1398
+ isError: true
1399
+ };
1400
+ }
1401
+ const report = renderReport(hits, pattern, cap);
1402
+ return { content: [{ kind: "text", text: clamp(report, ctx.budget) }] };
1403
+ } catch (err) {
1404
+ if (err instanceof BadRequest) {
1405
+ return { content: [{ kind: "text", text: err.message }], isError: true };
1406
+ }
1407
+ throw err;
1408
+ }
1409
+ }
1410
+ });
1411
+
1412
+ // src/capabilities/search/find.ts
1413
+ var PRUNED_DIRS2 = /* @__PURE__ */ new Set([".git", "node_modules"]);
1414
+ var DEFAULT_RESULT_CAP = 500;
1415
+ var ABSOLUTE_RESULT_CAP = 1e4;
1416
+ var BadRequest2 = class extends Error {
1417
+ };
1418
+ function escapeRegex(literal) {
1419
+ return literal.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1420
+ }
1421
+ function looksGlob(query) {
1422
+ return query.includes("*") || query.includes("?");
1423
+ }
1424
+ function compileGlob(query) {
1425
+ let body = "";
1426
+ for (const ch of query) {
1427
+ if (ch === "*") {
1428
+ body += ".*";
1429
+ } else if (ch === "?") {
1430
+ body += ".";
1431
+ } else {
1432
+ body += escapeRegex(ch);
1433
+ }
1434
+ }
1435
+ try {
1436
+ return new RegExp(`^${body}$`, "i");
1437
+ } catch (err) {
1438
+ const why = err instanceof Error ? err.message : String(err);
1439
+ throw new BadRequest2(`The glob "${query}" could not be turned into a matcher: ${why}`);
1440
+ }
1441
+ }
1442
+ function buildMatcher(query) {
1443
+ if (looksGlob(query)) {
1444
+ const re = compileGlob(query);
1445
+ return (name) => re.test(name);
1446
+ }
1447
+ const needle = query.toLowerCase();
1448
+ return (name) => name.toLowerCase().includes(needle);
1449
+ }
1450
+ function readKind(value) {
1451
+ if (value === void 0 || value === null) return void 0;
1452
+ if (value !== "file" && value !== "dir") {
1453
+ throw new BadRequest2('The `type` argument, when present, must be exactly "file" or "dir".');
1454
+ }
1455
+ return value;
1456
+ }
1457
+ function relativize2(root, full) {
1458
+ if (full === root) return ".";
1459
+ const prefix = root.endsWith("/") ? root : root + "/";
1460
+ return full.startsWith(prefix) ? full.slice(prefix.length) : full;
1461
+ }
1462
+ function joinPath3(parent, child) {
1463
+ return parent.endsWith("/") ? parent + child : parent + "/" + child;
1464
+ }
1465
+ async function walk2(ctx, root, dir, matcher, wanted, cap, sink) {
1466
+ if (ctx.signal.aborted) return true;
1467
+ let children;
1468
+ try {
1469
+ children = await ctx.fs.readdir(dir);
1470
+ } catch {
1471
+ return false;
1472
+ }
1473
+ children.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
1474
+ for (const child of children) {
1475
+ if (ctx.signal.aborted) return true;
1476
+ const full = joinPath3(dir, child.name);
1477
+ const kindMatches = wanted === void 0 || (wanted === "dir" ? child.isDirectory : !child.isDirectory);
1478
+ if (kindMatches && matcher(child.name)) {
1479
+ sink.push(relativize2(root, full));
1480
+ if (sink.length >= cap) return true;
1481
+ }
1482
+ if (child.isDirectory) {
1483
+ if (PRUNED_DIRS2.has(child.name)) continue;
1484
+ if (await walk2(ctx, root, full, matcher, wanted, cap, sink)) return true;
1485
+ }
1486
+ }
1487
+ return false;
1488
+ }
1489
+ function renderReport2(hits, query, cap) {
1490
+ if (hits.length === 0) {
1491
+ return `Nothing matched "${query}".`;
1492
+ }
1493
+ const header = hits.length >= cap ? `Hit the ${cap}-entry limit; listing the first ${hits.length} matches:` : `Matched ${hits.length} entr${hits.length === 1 ? "y" : "ies"}:`;
1494
+ return `${header}
1495
+ ${hits.join("\n")}`;
1496
+ }
1497
+ var findTool = defineTool({
1498
+ name: "find",
1499
+ description: 'Locate files and folders by name beneath a path. Walks the given directory recursively (skipping node_modules and .git) and reports every entry whose name matches `query`. The query is treated as a glob when it contains `*` or `?` (anchored to the whole name, case-insensitive), and otherwise as a case-insensitive substring. Optionally pass `path` to root the search and `type` ("file" or "dir") to keep only one kind of entry. Returns matching paths relative to the search root. Use this to find where a file lives when you know part of its name rather than its contents.',
1500
+ parameters: {
1501
+ type: "object",
1502
+ additionalProperties: false,
1503
+ required: ["query"],
1504
+ properties: {
1505
+ query: {
1506
+ type: "string",
1507
+ description: "Glob (with `*`/`?`, matched against the whole name) or plain substring to match entry names against."
1508
+ },
1509
+ path: {
1510
+ type: "string",
1511
+ description: "Directory to search beneath; defaults to the working directory."
1512
+ },
1513
+ type: {
1514
+ type: "string",
1515
+ enum: ["file", "dir"],
1516
+ description: 'Restrict results to regular files ("file") or directories ("dir"); omit for both.'
1517
+ }
1518
+ }
1519
+ },
1520
+ async run(input, ctx) {
1521
+ try {
1522
+ if (input === null || typeof input !== "object") {
1523
+ throw new BadRequest2("Expected an object of arguments with at least a `query` field.");
1524
+ }
1525
+ const query = input.query;
1526
+ if (typeof query !== "string" || query.length === 0) {
1527
+ throw new BadRequest2("The `query` argument is required and must be a non-empty string.");
1528
+ }
1529
+ const wanted = readKind(input.type);
1530
+ const matcher = buildMatcher(query);
1531
+ let rawPath = ctx.cwd;
1532
+ if (input.path !== void 0 && input.path !== null) {
1533
+ if (typeof input.path !== "string") {
1534
+ throw new BadRequest2("The `path` argument, when present, must be a string.");
1535
+ }
1536
+ if (input.path.length > 0) rawPath = input.path;
1537
+ }
1538
+ let rootInfo;
1539
+ try {
1540
+ rootInfo = await ctx.fs.stat(rawPath);
1541
+ } catch {
1542
+ return {
1543
+ content: [
1544
+ {
1545
+ kind: "text",
1546
+ text: `Cannot search: the path "${rawPath}" does not exist or is unreadable.`
1547
+ }
1548
+ ],
1549
+ isError: true
1550
+ };
1551
+ }
1552
+ if (!rootInfo.isDirectory) {
1553
+ return {
1554
+ content: [
1555
+ {
1556
+ kind: "text",
1557
+ text: `The path "${rawPath}" is not a directory, so there is nothing to walk.`
1558
+ }
1559
+ ],
1560
+ isError: true
1561
+ };
1562
+ }
1563
+ const cap = Math.min(DEFAULT_RESULT_CAP, ABSOLUTE_RESULT_CAP);
1564
+ const hits = [];
1565
+ await walk2(ctx, rawPath, rawPath, matcher, wanted, cap, hits);
1566
+ if (ctx.signal.aborted) {
1567
+ return {
1568
+ content: [{ kind: "text", text: "The search was cancelled before it finished." }],
1569
+ isError: true
1570
+ };
1571
+ }
1572
+ const report = renderReport2(hits, query, cap);
1573
+ return { content: [{ kind: "text", text: clamp(report, ctx.budget) }] };
1574
+ } catch (err) {
1575
+ if (err instanceof BadRequest2) {
1576
+ return { content: [{ kind: "text", text: err.message }], isError: true };
1577
+ }
1578
+ throw err;
1579
+ }
1580
+ }
1581
+ });
1582
+
1583
+ // src/capabilities/shell/bash.ts
1584
+ var DEADLINE_CEILING_MS = 10 * 60 * 1e3;
1585
+ var DEFAULT_DEADLINE_MS = 2 * 60 * 1e3;
1586
+ var PARAMETERS = {
1587
+ type: "object",
1588
+ additionalProperties: false,
1589
+ required: ["command"],
1590
+ properties: {
1591
+ command: {
1592
+ type: "string",
1593
+ description: "The shell command line to run, exactly as you would type it at a prompt."
1594
+ },
1595
+ timeoutMs: {
1596
+ type: "number",
1597
+ description: "Optional time limit in milliseconds. The command is terminated once it elapses; omit it to use the default window."
1598
+ },
1599
+ cwd: {
1600
+ type: "string",
1601
+ description: "Optional directory to run the command in. Defaults to the session's current working directory when left out."
1602
+ }
1603
+ }
1604
+ };
1605
+ var DESCRIPTION3 = [
1606
+ "Run one shell command and get back its combined output and exit status.",
1607
+ "The command runs to completion (subject to an optional time limit), and you receive its standard output, standard error, and the numeric exit code.",
1608
+ "Use this for build steps, test runs, version-control queries, and other one-off shell work; it is not a persistent session, so each call starts fresh."
1609
+ ].join(" ");
1610
+ function readInput(raw) {
1611
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
1612
+ throw new Error("Expected an arguments object carrying at least a `command` string.");
1613
+ }
1614
+ const bag = raw;
1615
+ const command = bag.command;
1616
+ if (typeof command !== "string") {
1617
+ throw new Error("The `command` argument is required and must be a string.");
1618
+ }
1619
+ if (command.trim().length === 0) {
1620
+ throw new Error("The `command` argument cannot be empty or whitespace only.");
1621
+ }
1622
+ let timeoutMs;
1623
+ if (bag.timeoutMs !== void 0) {
1624
+ const raw2 = bag.timeoutMs;
1625
+ if (typeof raw2 !== "number" || !Number.isFinite(raw2) || raw2 <= 0) {
1626
+ throw new Error("When given, `timeoutMs` must be a positive, finite number of milliseconds.");
1627
+ }
1628
+ timeoutMs = Math.min(Math.floor(raw2), DEADLINE_CEILING_MS);
1629
+ }
1630
+ let cwd;
1631
+ if (bag.cwd !== void 0) {
1632
+ if (typeof bag.cwd !== "string" || bag.cwd.trim().length === 0) {
1633
+ throw new Error("When given, `cwd` must be a non-empty directory path.");
1634
+ }
1635
+ cwd = bag.cwd;
1636
+ }
1637
+ return { command, timeoutMs, cwd };
1638
+ }
1639
+ function renderReport3(stdout, stderr, code) {
1640
+ const sections = [];
1641
+ if (stdout.length > 0) {
1642
+ sections.push(`stdout:
1643
+ ${stdout}`);
1644
+ }
1645
+ if (stderr.length > 0) {
1646
+ sections.push(`stderr:
1647
+ ${stderr}`);
1648
+ }
1649
+ if (sections.length === 0) {
1650
+ sections.push("(the command produced no output)");
1651
+ }
1652
+ const status = code === null ? "status: the command was halted by a signal before it could return an exit code" : `status: exited with code ${code}`;
1653
+ sections.push(status);
1654
+ return sections.join("\n\n");
1655
+ }
1656
+ async function run(input, ctx) {
1657
+ const deadline = input.timeoutMs ?? DEFAULT_DEADLINE_MS;
1658
+ const result = await ctx.shell.exec(input.command, {
1659
+ cwd: input.cwd ?? ctx.cwd,
1660
+ signal: ctx.signal,
1661
+ timeoutMs: deadline
1662
+ });
1663
+ const report = renderReport3(result.stdout, result.stderr, result.code);
1664
+ const windowed = clamp(report, ctx.budget);
1665
+ const failed = result.code === null || result.code !== 0;
1666
+ return {
1667
+ content: [{ kind: "text", text: windowed }],
1668
+ isError: failed
1669
+ };
1670
+ }
1671
+ var bashTool = defineTool({
1672
+ name: "bash",
1673
+ description: DESCRIPTION3,
1674
+ parameters: PARAMETERS,
1675
+ async run(input, ctx) {
1676
+ const parsed = readInput(input);
1677
+ return run(parsed, ctx);
1678
+ }
1679
+ });
1680
+
1681
+ // src/capabilities/shell/process.ts
1682
+ var ProcessTable = class {
1683
+ jobs = /* @__PURE__ */ new Map();
1684
+ counter = 0;
1685
+ /** Mint a fresh, collision-free job id. */
1686
+ nextId() {
1687
+ this.counter += 1;
1688
+ return `job-${this.counter}`;
1689
+ }
1690
+ add(entry) {
1691
+ this.jobs.set(entry.id, entry);
1692
+ }
1693
+ get(id) {
1694
+ return this.jobs.get(id);
1695
+ }
1696
+ remove(id) {
1697
+ const entry = this.jobs.get(id);
1698
+ if (entry !== void 0) {
1699
+ this.jobs.delete(id);
1700
+ }
1701
+ return entry;
1702
+ }
1703
+ all() {
1704
+ return [...this.jobs.values()];
1705
+ }
1706
+ /**
1707
+ * Empty the table. Any job still running is killed and its exit listener
1708
+ * dropped, so a test (or a host shutting down) leaves nothing dangling.
1709
+ */
1710
+ reset() {
1711
+ for (const entry of this.jobs.values()) {
1712
+ entry.unsubscribe();
1713
+ if (entry.state === "running") {
1714
+ try {
1715
+ entry.handle.kill();
1716
+ } catch {
1717
+ }
1718
+ }
1719
+ }
1720
+ this.jobs.clear();
1721
+ this.counter = 0;
1722
+ }
1723
+ };
1724
+ var table = new ProcessTable();
1725
+ function resetProcessTable() {
1726
+ table.reset();
1727
+ }
1728
+ var POLL_WINDOW_BYTES = 32 * 1024;
1729
+ var SCRATCH_DIR = ".indus-process";
1730
+ function joinPath4(base, tail) {
1731
+ if (base.length === 0) return tail;
1732
+ const last = base[base.length - 1];
1733
+ if (last === "/" || last === "\\") return `${base}${tail}`;
1734
+ return `${base}/${tail}`;
1735
+ }
1736
+ var processParameters = {
1737
+ type: "object",
1738
+ additionalProperties: false,
1739
+ required: ["action"],
1740
+ properties: {
1741
+ action: {
1742
+ type: "string",
1743
+ enum: ["start", "list", "poll", "stop"],
1744
+ description: "Which operation to run: 'start' a new background command, 'list' all tracked jobs, 'poll' a job for output it has printed since you last looked, or 'stop' a job and discard it."
1745
+ },
1746
+ command: {
1747
+ type: "string",
1748
+ description: "The shell command line to launch in the background. Required for 'start' and ignored by the other actions."
1749
+ },
1750
+ id: {
1751
+ type: "string",
1752
+ description: "The identifier of the job to act on, as returned by 'start'. Required for 'poll' and 'stop'."
1753
+ }
1754
+ }
1755
+ };
1756
+ var DESCRIPTION4 = [
1757
+ "Manage commands that keep running in the background across turns.",
1758
+ "Unlike a one-shot shell call, a started job stays alive so you can launch a server, watcher, or long task and check on it later.",
1759
+ "Use action='start' with a command to launch one and get a job id back; 'list' to see every job and its status; 'poll' with the id to read whatever output has accumulated since your last poll; and 'stop' with the id to terminate it."
1760
+ ].join(" ");
1761
+ function asText2(text, failed = false) {
1762
+ return { content: [{ kind: "text", text }], isError: failed };
1763
+ }
1764
+ function asJson(value) {
1765
+ return { content: [{ kind: "json", value }] };
1766
+ }
1767
+ function readInput2(raw) {
1768
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
1769
+ throw new Error(
1770
+ "Expected an arguments object with an 'action' of start, list, poll, or stop."
1771
+ );
1772
+ }
1773
+ const bag = raw;
1774
+ const action = bag.action;
1775
+ if (action !== "start" && action !== "list" && action !== "poll" && action !== "stop") {
1776
+ throw new Error(
1777
+ "The 'action' argument must be one of: start, list, poll, stop."
1778
+ );
1779
+ }
1780
+ let command;
1781
+ if (bag.command !== void 0) {
1782
+ if (typeof bag.command !== "string") {
1783
+ throw new Error("When given, 'command' must be a string command line.");
1784
+ }
1785
+ command = bag.command;
1786
+ }
1787
+ let id;
1788
+ if (bag.id !== void 0) {
1789
+ if (typeof bag.id !== "string") {
1790
+ throw new Error("When given, 'id' must be a string job identifier.");
1791
+ }
1792
+ id = bag.id;
1793
+ }
1794
+ return { action, command, id };
1795
+ }
1796
+ function shellQuote(value) {
1797
+ return `'${value.replace(/'/g, `'\\''`)}'`;
1798
+ }
1799
+ async function drainCapture(ctx, path, alreadyRead) {
1800
+ let full;
1801
+ try {
1802
+ full = await ctx.fs.readFile(path, "utf8");
1803
+ } catch {
1804
+ return { fresh: "", total: alreadyRead };
1805
+ }
1806
+ const total = Buffer.byteLength(full, "utf8");
1807
+ if (total <= alreadyRead) {
1808
+ return { fresh: "", total };
1809
+ }
1810
+ const fresh = Buffer.from(full, "utf8").subarray(alreadyRead).toString("utf8");
1811
+ return { fresh, total };
1812
+ }
1813
+ function describeStatus(entry) {
1814
+ if (entry.state === "running") {
1815
+ const pid = entry.pid === void 0 ? "unknown pid" : `pid ${entry.pid}`;
1816
+ return `running (${pid})`;
1817
+ }
1818
+ if (entry.exitSignal !== null) {
1819
+ return `stopped by signal ${entry.exitSignal}`;
1820
+ }
1821
+ if (entry.exitCode === null) {
1822
+ return "finished (no exit code reported)";
1823
+ }
1824
+ return `exited with code ${entry.exitCode}`;
1825
+ }
1826
+ async function startJob(ctx, command) {
1827
+ const id = table.nextId();
1828
+ const scratchDir = joinPath4(ctx.cwd, SCRATCH_DIR);
1829
+ const outPath = joinPath4(scratchDir, `${id}.out`);
1830
+ const errPath = joinPath4(scratchDir, `${id}.err`);
1831
+ await ctx.fs.mkdir(scratchDir, { recursive: true });
1832
+ await ctx.fs.writeFile(outPath, "", "utf8");
1833
+ await ctx.fs.writeFile(errPath, "", "utf8");
1834
+ const wrapped = `( ${command} ) >${shellQuote(outPath)} 2>${shellQuote(errPath)}`;
1835
+ const handle = ctx.shell.spawn(wrapped, { cwd: ctx.cwd });
1836
+ const entry = {
1837
+ id,
1838
+ command,
1839
+ handle,
1840
+ pid: handle.pid,
1841
+ outPath,
1842
+ errPath,
1843
+ startedMs: Date.now(),
1844
+ state: "running",
1845
+ exitCode: null,
1846
+ exitSignal: null,
1847
+ readOut: 0,
1848
+ readErr: 0,
1849
+ unsubscribe: () => {
1850
+ }
1851
+ };
1852
+ const unsubscribe = handle.onExit((code, signal) => {
1853
+ entry.state = "finished";
1854
+ entry.exitCode = code;
1855
+ entry.exitSignal = signal;
1856
+ });
1857
+ entry.unsubscribe = unsubscribe;
1858
+ table.add(entry);
1859
+ return asJson({
1860
+ action: "start",
1861
+ id,
1862
+ pid: entry.pid ?? null,
1863
+ command,
1864
+ status: describeStatus(entry),
1865
+ note: `Started job ${id}. Use action='poll' with this id to read its output.`
1866
+ });
1867
+ }
1868
+ function listJobs() {
1869
+ const entries = table.all();
1870
+ if (entries.length === 0) {
1871
+ return asJson({
1872
+ action: "list",
1873
+ jobs: [],
1874
+ note: "No background jobs are currently tracked."
1875
+ });
1876
+ }
1877
+ const jobs = entries.map((entry) => ({
1878
+ id: entry.id,
1879
+ command: entry.command,
1880
+ pid: entry.pid ?? null,
1881
+ state: entry.state,
1882
+ status: describeStatus(entry),
1883
+ ageMs: Date.now() - entry.startedMs
1884
+ }));
1885
+ return asJson({ action: "list", jobs });
1886
+ }
1887
+ async function pollJob(ctx, id) {
1888
+ const entry = table.get(id);
1889
+ if (entry === void 0) {
1890
+ return asText2(
1891
+ `No background job is tracked under id '${id}'. Use action='list' to see active jobs.`,
1892
+ true
1893
+ );
1894
+ }
1895
+ const out = await drainCapture(ctx, entry.outPath, entry.readOut);
1896
+ const err = await drainCapture(ctx, entry.errPath, entry.readErr);
1897
+ entry.readOut = out.total;
1898
+ entry.readErr = err.total;
1899
+ const window = { kind: "tail", maxBytes: POLL_WINDOW_BYTES };
1900
+ const stdout = clamp(out.fresh, window);
1901
+ const stderr = clamp(err.fresh, window);
1902
+ return asJson({
1903
+ action: "poll",
1904
+ id: entry.id,
1905
+ state: entry.state,
1906
+ status: describeStatus(entry),
1907
+ exitCode: entry.exitCode,
1908
+ exitSignal: entry.exitSignal,
1909
+ stdout,
1910
+ stderr,
1911
+ hadNewOutput: out.fresh.length > 0 || err.fresh.length > 0
1912
+ });
1913
+ }
1914
+ function stopJob(id) {
1915
+ const entry = table.remove(id);
1916
+ if (entry === void 0) {
1917
+ return asText2(
1918
+ `No background job is tracked under id '${id}'. It may have already been stopped.`,
1919
+ true
1920
+ );
1921
+ }
1922
+ entry.unsubscribe();
1923
+ const wasRunning = entry.state === "running";
1924
+ if (wasRunning) {
1925
+ try {
1926
+ entry.handle.kill();
1927
+ } catch {
1928
+ }
1929
+ }
1930
+ return asJson({
1931
+ action: "stop",
1932
+ id: entry.id,
1933
+ wasRunning,
1934
+ finalStatus: wasRunning ? "signalled to terminate and removed" : describeStatus(entry)
1935
+ });
1936
+ }
1937
+ var processTool = defineTool({
1938
+ name: "process",
1939
+ description: DESCRIPTION4,
1940
+ parameters: processParameters,
1941
+ async run(input, ctx) {
1942
+ const parsed = readInput2(input);
1943
+ switch (parsed.action) {
1944
+ case "start": {
1945
+ const command = parsed.command;
1946
+ if (typeof command !== "string" || command.trim().length === 0) {
1947
+ return asText2(
1948
+ "Starting a job needs a non-empty 'command' to run.",
1949
+ true
1950
+ );
1951
+ }
1952
+ return startJob(ctx, command);
1953
+ }
1954
+ case "list":
1955
+ return listJobs();
1956
+ case "poll": {
1957
+ const id = parsed.id;
1958
+ if (typeof id !== "string" || id.trim().length === 0) {
1959
+ return asText2("Polling a job needs the 'id' it was given at start.", true);
1960
+ }
1961
+ return pollJob(ctx, id);
1962
+ }
1963
+ case "stop": {
1964
+ const id = parsed.id;
1965
+ if (typeof id !== "string" || id.trim().length === 0) {
1966
+ return asText2("Stopping a job needs the 'id' it was given at start.", true);
1967
+ }
1968
+ return stopJob(id);
1969
+ }
1970
+ default:
1971
+ return asText2("Unsupported action.", true);
1972
+ }
1973
+ }
1974
+ });
1975
+
1976
+ // src/capabilities/planning/todo.ts
1977
+ var VALID_STATUSES = /* @__PURE__ */ new Set([
1978
+ "pending",
1979
+ "active",
1980
+ "done"
1981
+ ]);
1982
+ var TodoStore = class {
1983
+ lists = /* @__PURE__ */ new Map();
1984
+ /** Return the list recorded for `ctx`, or an empty array if none was set yet. */
1985
+ read(ctx) {
1986
+ return this.lists.get(ctx) ?? [];
1987
+ }
1988
+ /** Replace the entire list recorded for `ctx` with `items`. */
1989
+ replace(ctx, items) {
1990
+ this.lists.set(ctx, items);
1991
+ }
1992
+ /** Discard every stored list. Intended for test isolation only. */
1993
+ reset() {
1994
+ this.lists.clear();
1995
+ }
1996
+ };
1997
+ var todoStore = new TodoStore();
1998
+ function reset() {
1999
+ todoStore.reset();
2000
+ }
2001
+ function failure4(message) {
2002
+ return { content: [{ kind: "text", text: message }], isError: true };
2003
+ }
2004
+ function asBag(input) {
2005
+ if (input !== null && typeof input === "object" && !Array.isArray(input)) {
2006
+ return input;
2007
+ }
2008
+ return {};
2009
+ }
2010
+ function parseItem(raw, position) {
2011
+ const where = `item ${position + 1}`;
2012
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
2013
+ return { ok: false, reason: `${where} must be an object describing a task.` };
2014
+ }
2015
+ const bag = raw;
2016
+ const id = bag.id;
2017
+ if (typeof id !== "string" || id.trim().length === 0) {
2018
+ return { ok: false, reason: `${where} needs a non-empty string \`id\`.` };
2019
+ }
2020
+ const text = bag.text;
2021
+ if (typeof text !== "string" || text.trim().length === 0) {
2022
+ return { ok: false, reason: `${where} needs a non-empty string \`text\`.` };
2023
+ }
2024
+ const status = bag.status;
2025
+ if (typeof status !== "string" || !VALID_STATUSES.has(status)) {
2026
+ return {
2027
+ ok: false,
2028
+ reason: `${where} has an unrecognised \`status\`; use one of pending, active, or done.`
2029
+ };
2030
+ }
2031
+ return { ok: true, item: { id, text, status } };
2032
+ }
2033
+ function parseItems(raw) {
2034
+ if (!Array.isArray(raw)) {
2035
+ return { ok: false, reason: "`items` must be an array of task objects (send [] to clear the list)." };
2036
+ }
2037
+ const items = [];
2038
+ const seen = /* @__PURE__ */ new Set();
2039
+ for (let i = 0; i < raw.length; i += 1) {
2040
+ const parsed = parseItem(raw[i], i);
2041
+ if (!parsed.ok) return parsed;
2042
+ if (seen.has(parsed.item.id)) {
2043
+ return { ok: false, reason: `Duplicate id "${parsed.item.id}"; each task id must be unique.` };
2044
+ }
2045
+ seen.add(parsed.item.id);
2046
+ items.push(parsed.item);
2047
+ }
2048
+ return { ok: true, items };
2049
+ }
2050
+ function renderList(items) {
2051
+ if (items.length === 0) {
2052
+ return "The task list is currently empty.";
2053
+ }
2054
+ const glyph = {
2055
+ pending: "[ ]",
2056
+ active: "[~]",
2057
+ done: "[x]"
2058
+ };
2059
+ const lines = items.map(
2060
+ (item) => `${glyph[item.status]} (${item.id}) ${item.text}`
2061
+ );
2062
+ const counts = summarise(items);
2063
+ return `${counts}
2064
+ ${lines.join("\n")}`;
2065
+ }
2066
+ function summarise(items) {
2067
+ let pending = 0;
2068
+ let active = 0;
2069
+ let done = 0;
2070
+ for (const item of items) {
2071
+ if (item.status === "pending") pending += 1;
2072
+ else if (item.status === "active") active += 1;
2073
+ else done += 1;
2074
+ }
2075
+ return `${items.length} task${items.length === 1 ? "" : "s"}: ${active} active, ${pending} pending, ${done} done.`;
2076
+ }
2077
+ var setParameters = {
2078
+ type: "object",
2079
+ additionalProperties: false,
2080
+ required: ["items"],
2081
+ properties: {
2082
+ items: {
2083
+ type: "array",
2084
+ description: "The complete task list to store, replacing whatever was tracked before. Send an empty array to clear the list entirely.",
2085
+ items: {
2086
+ type: "object",
2087
+ additionalProperties: false,
2088
+ required: ["id", "text", "status"],
2089
+ properties: {
2090
+ id: {
2091
+ type: "string",
2092
+ description: "Stable identifier for the task; must be unique within the list."
2093
+ },
2094
+ text: {
2095
+ type: "string",
2096
+ description: "Short description of what the task involves."
2097
+ },
2098
+ status: {
2099
+ type: "string",
2100
+ enum: ["pending", "active", "done"],
2101
+ description: "Lifecycle stage: pending (not started), active (in progress), or done (finished)."
2102
+ }
2103
+ }
2104
+ }
2105
+ }
2106
+ }
2107
+ };
2108
+ var SET_DESCRIPTION = [
2109
+ "Record the full task checklist for the current session, overwriting any list",
2110
+ "stored earlier. Pass the entire desired list every time \u2014 this is a replace,",
2111
+ "not a merge \u2014 so keep finished tasks in the array (with status done) until you",
2112
+ "no longer want them shown. Use this to plan multi-step work and to mark progress",
2113
+ "as each step starts and completes."
2114
+ ].join(" ");
2115
+ var todoSetTool = defineTool({
2116
+ name: "todo_set",
2117
+ description: SET_DESCRIPTION,
2118
+ parameters: setParameters,
2119
+ async run(input, ctx) {
2120
+ const bag = asBag(input);
2121
+ if (!("items" in bag)) {
2122
+ return failure4("An `items` array is required; send [] to empty the list.");
2123
+ }
2124
+ const parsed = parseItems(bag.items);
2125
+ if (!parsed.ok) return failure4(parsed.reason);
2126
+ todoStore.replace(ctx, parsed.items);
2127
+ const body = `Task list updated. ${renderList(parsed.items)}`;
2128
+ return { content: [{ kind: "text", text: body }] };
2129
+ }
2130
+ });
2131
+ var READ_DESCRIPTION = [
2132
+ "Show the task checklist currently stored for this session, including each",
2133
+ "task's id, description, and status. Use it to remind yourself of the plan and",
2134
+ "of what is still outstanding before deciding what to do next. This is read-only",
2135
+ "and changes nothing."
2136
+ ].join(" ");
2137
+ var todoReadTool = defineTool({
2138
+ name: "todo_read",
2139
+ description: READ_DESCRIPTION,
2140
+ parameters: {
2141
+ type: "object",
2142
+ additionalProperties: false,
2143
+ properties: {}
2144
+ },
2145
+ async run(_input, ctx) {
2146
+ const items = todoStore.read(ctx);
2147
+ return { content: [{ kind: "text", text: renderList(items) }] };
2148
+ }
2149
+ });
2150
+
2151
+ // src/capabilities/web/websearch.ts
2152
+ var DEFAULT_RESULTS = 5;
2153
+ var MAX_RESULTS = 25;
2154
+ var REQUEST_TIMEOUT_MS = 1e4;
2155
+ var SEARCH_ENDPOINT = "https://html.duckduckgo.com/html/";
2156
+ var USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0 Safari/537.36";
2157
+ var DESCRIPTION5 = [
2158
+ "Search the public web for a query and return the leading results as a list of",
2159
+ "{ title, url, snippet } entries. Useful for finding current information,",
2160
+ "documentation, or sources that are not already in the workspace. Use",
2161
+ "`maxResults` to ask for more or fewer hits; the count is capped to keep the",
2162
+ "response compact. If the network is unreachable the tool reports a failure",
2163
+ "instead of throwing."
2164
+ ].join(" ");
2165
+ function failure5(message) {
2166
+ return { content: [{ kind: "text", text: message }], isError: true };
2167
+ }
2168
+ function resolveMaxResults(value) {
2169
+ if (value === void 0 || value === null) {
2170
+ return { ok: true, value: DEFAULT_RESULTS };
2171
+ }
2172
+ if (typeof value !== "number" || !Number.isFinite(value)) {
2173
+ return { ok: false, reason: "`maxResults` must be a number when provided." };
2174
+ }
2175
+ if (!Number.isInteger(value)) {
2176
+ return { ok: false, reason: `\`maxResults\` must be a whole number, not ${value}.` };
2177
+ }
2178
+ if (value < 1) {
2179
+ return { ok: false, reason: `\`maxResults\` must be at least 1; got ${value}.` };
2180
+ }
2181
+ return { ok: true, value: Math.min(value, MAX_RESULTS) };
2182
+ }
2183
+ function toPlainText(html) {
2184
+ const withoutTags = html.replace(/<[^>]*>/g, "");
2185
+ const decoded = withoutTags.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&#x27;/g, "'").replace(/&nbsp;/g, " ");
2186
+ return decoded.replace(/\s+/g, " ").trim();
2187
+ }
2188
+ function unwrapTarget(href) {
2189
+ let candidate = href;
2190
+ const redirectMatch = /[?&]uddg=([^&]+)/.exec(candidate);
2191
+ if (redirectMatch) {
2192
+ try {
2193
+ candidate = decodeURIComponent(redirectMatch[1]);
2194
+ } catch {
2195
+ }
2196
+ }
2197
+ if (candidate.startsWith("//")) {
2198
+ candidate = `https:${candidate}`;
2199
+ }
2200
+ return candidate;
2201
+ }
2202
+ function extractHits(body, limit) {
2203
+ const hits = [];
2204
+ const seen = /* @__PURE__ */ new Set();
2205
+ const titleAnchor = /<a\b[^>]*\bclass="[^"]*\bresult__a\b[^"]*"[^>]*\bhref="([^"]*)"[^>]*>([\s\S]*?)<\/a>/gi;
2206
+ const snippetBlock = /\bclass="[^"]*\bresult__snippet\b[^"]*"[^>]*>([\s\S]*?)<\/[a-z]+>/i;
2207
+ let match;
2208
+ while ((match = titleAnchor.exec(body)) !== null) {
2209
+ if (hits.length >= limit) break;
2210
+ const url = unwrapTarget(match[1]);
2211
+ const title = toPlainText(match[2]);
2212
+ if (url.length === 0 || title.length === 0) continue;
2213
+ if (seen.has(url)) continue;
2214
+ const tail = body.slice(titleAnchor.lastIndex);
2215
+ const snippetMatch = snippetBlock.exec(tail);
2216
+ const snippet = snippetMatch ? toPlainText(snippetMatch[1]) : "";
2217
+ seen.add(url);
2218
+ hits.push({ title, url, snippet });
2219
+ }
2220
+ return hits;
2221
+ }
2222
+ function renderHits(query, hits) {
2223
+ const lines = [
2224
+ `${hits.length} result${hits.length === 1 ? "" : "s"} for "${query}":`,
2225
+ ""
2226
+ ];
2227
+ hits.forEach((hit, index) => {
2228
+ lines.push(`${index + 1}. ${hit.title}`);
2229
+ lines.push(` ${hit.url}`);
2230
+ if (hit.snippet.length > 0) {
2231
+ lines.push(` ${hit.snippet}`);
2232
+ }
2233
+ lines.push("");
2234
+ });
2235
+ return lines.join("\n").trimEnd();
2236
+ }
2237
+ var webSearchTool = defineTool({
2238
+ name: "websearch",
2239
+ description: DESCRIPTION5,
2240
+ parameters: {
2241
+ type: "object",
2242
+ properties: {
2243
+ query: {
2244
+ type: "string",
2245
+ description: "The words to search the web for."
2246
+ },
2247
+ maxResults: {
2248
+ type: "integer",
2249
+ minimum: 1,
2250
+ maximum: MAX_RESULTS,
2251
+ description: `How many hits to return at most. Defaults to ${DEFAULT_RESULTS}; values above ${MAX_RESULTS} are pulled down to that ceiling.`
2252
+ }
2253
+ },
2254
+ required: ["query"],
2255
+ additionalProperties: false
2256
+ },
2257
+ async run(input, ctx) {
2258
+ const raw = input;
2259
+ const bag = raw !== null && typeof raw === "object" ? raw : {};
2260
+ const rawQuery = bag.query;
2261
+ if (typeof rawQuery !== "string" || rawQuery.trim().length === 0) {
2262
+ return failure5("A non-empty `query` string is required to run a web search.");
2263
+ }
2264
+ const query = rawQuery.trim();
2265
+ const limitParse = resolveMaxResults(bag.maxResults);
2266
+ if (!limitParse.ok) return failure5(limitParse.reason);
2267
+ const limit = limitParse.value;
2268
+ const timeout = new AbortController();
2269
+ const onOuterAbort = () => timeout.abort();
2270
+ if (ctx.signal.aborted) {
2271
+ return failure5("The search was cancelled before the request went out.");
2272
+ }
2273
+ ctx.signal.addEventListener("abort", onOuterAbort, { once: true });
2274
+ const timer = setTimeout(() => timeout.abort(), REQUEST_TIMEOUT_MS);
2275
+ let body;
2276
+ try {
2277
+ const form = new URLSearchParams({ q: query });
2278
+ const response = await fetch(SEARCH_ENDPOINT, {
2279
+ method: "POST",
2280
+ signal: timeout.signal,
2281
+ headers: {
2282
+ "Content-Type": "application/x-www-form-urlencoded",
2283
+ "User-Agent": USER_AGENT,
2284
+ Accept: "text/html"
2285
+ },
2286
+ body: form.toString()
2287
+ });
2288
+ if (!response.ok) {
2289
+ return failure5(
2290
+ `The search service answered with status ${response.status} (${response.statusText || "no reason given"}).`
2291
+ );
2292
+ }
2293
+ body = await response.text();
2294
+ } catch (err) {
2295
+ if (ctx.signal.aborted) {
2296
+ return failure5("The search was cancelled before it finished.");
2297
+ }
2298
+ if (timeout.signal.aborted) {
2299
+ return failure5(
2300
+ `The search timed out after ${REQUEST_TIMEOUT_MS / 1e3}s with no response.`
2301
+ );
2302
+ }
2303
+ const detail = err instanceof Error ? err.message : String(err);
2304
+ return failure5(`The web search could not reach the network: ${detail}`);
2305
+ } finally {
2306
+ clearTimeout(timer);
2307
+ ctx.signal.removeEventListener("abort", onOuterAbort);
2308
+ }
2309
+ const hits = extractHits(body, limit);
2310
+ if (hits.length === 0) {
2311
+ return failure5(
2312
+ `The search for "${query}" came back with no results that could be read.`
2313
+ );
2314
+ }
2315
+ const rendered = renderHits(query, hits);
2316
+ const clamped = clamp(rendered, {
2317
+ kind: ctx.budget.kind,
2318
+ maxBytes: ctx.budget.maxBytes,
2319
+ notice: (omitted) => `
2320
+ [websearch: ${omitted} byte${omitted === 1 ? "" : "s"} of results were left out to stay within the response budget]
2321
+ `
2322
+ });
2323
+ return {
2324
+ content: [
2325
+ { kind: "text", text: clamped },
2326
+ { kind: "json", value: hits }
2327
+ ]
2328
+ };
2329
+ }
2330
+ });
2331
+
2332
+ // src/capabilities/web/webfetch.ts
2333
+ var ABSOLUTE_BODY_CEILING = 5 * 1024 * 1024;
2334
+ var DEFAULT_BODY_CEILING = 1024 * 1024;
2335
+ var REQUEST_TIMEOUT_MS2 = 3e4;
2336
+ var DESCRIPTION6 = [
2337
+ "Download a single web page over HTTP or HTTPS and return its text in a",
2338
+ "stripped-down, reading-friendly form. The page's HTML is reduced to plain",
2339
+ "text: headings, paragraphs, list items and links are kept in a simple layout,",
2340
+ "while scripts, styles, markup tags and boilerplate are removed. Supply an",
2341
+ "absolute `url`; optionally cap the amount of page data considered with",
2342
+ "`maxBytes`. The reply is always trimmed to fit the model's context, so very",
2343
+ "large pages come back partial with a marker showing where text was cut."
2344
+ ].join(" ");
2345
+ function failure6(message) {
2346
+ return { content: [{ kind: "text", text: message }], isError: true };
2347
+ }
2348
+ function readByteCap(value) {
2349
+ if (value === void 0 || value === null) {
2350
+ return { ok: true, value: void 0 };
2351
+ }
2352
+ if (typeof value !== "number" || !Number.isFinite(value)) {
2353
+ return { ok: false, reason: "`maxBytes` must be a number when you include it." };
2354
+ }
2355
+ if (!Number.isInteger(value)) {
2356
+ return { ok: false, reason: `\`maxBytes\` must be a whole number, not ${value}.` };
2357
+ }
2358
+ if (value < 1) {
2359
+ return { ok: false, reason: `\`maxBytes\` must be at least 1; got ${value}.` };
2360
+ }
2361
+ return { ok: true, value };
2362
+ }
2363
+ function parseTarget(raw) {
2364
+ let url;
2365
+ try {
2366
+ url = new URL(raw);
2367
+ } catch {
2368
+ return {
2369
+ ok: false,
2370
+ reason: `That does not look like a valid absolute URL: ${raw}`
2371
+ };
2372
+ }
2373
+ if (url.protocol !== "http:" && url.protocol !== "https:") {
2374
+ return {
2375
+ ok: false,
2376
+ reason: `Only http and https addresses are supported; received "${url.protocol}".`
2377
+ };
2378
+ }
2379
+ return { ok: true, url };
2380
+ }
2381
+ var NAMED_ENTITIES = {
2382
+ amp: "&",
2383
+ lt: "<",
2384
+ gt: ">",
2385
+ quot: '"',
2386
+ apos: "'",
2387
+ nbsp: " ",
2388
+ hellip: "\u2026",
2389
+ mdash: "\u2014",
2390
+ ndash: "\u2013",
2391
+ copy: "\xA9",
2392
+ reg: "\xAE",
2393
+ trade: "\u2122"
2394
+ };
2395
+ function decodeEntities(text) {
2396
+ return text.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]*);/g, (whole, body) => {
2397
+ if (body[0] === "#") {
2398
+ const isHex = body[1] === "x" || body[1] === "X";
2399
+ const digits = isHex ? body.slice(2) : body.slice(1);
2400
+ const code = Number.parseInt(digits, isHex ? 16 : 10);
2401
+ if (!Number.isFinite(code) || code < 0 || code > 1114111) return whole;
2402
+ try {
2403
+ return String.fromCodePoint(code);
2404
+ } catch {
2405
+ return whole;
2406
+ }
2407
+ }
2408
+ const named = NAMED_ENTITIES[body.toLowerCase()];
2409
+ return named ?? whole;
2410
+ });
2411
+ }
2412
+ function dropRegion(html, tag) {
2413
+ const pattern = new RegExp(`<${tag}\\b[^>]*>[\\s\\S]*?<\\/${tag}\\s*>`, "gi");
2414
+ return html.replace(pattern, " ");
2415
+ }
2416
+ function htmlToText(html) {
2417
+ let s = html;
2418
+ s = s.replace(/<!--[\s\S]*?-->/g, " ");
2419
+ for (const tag of ["script", "style", "noscript", "template", "head", "svg", "iframe"]) {
2420
+ s = dropRegion(s, tag);
2421
+ }
2422
+ s = s.replace(
2423
+ /<a\b[^>]*\bhref\s*=\s*("([^"]*)"|'([^']*)'|([^\s">]+))[^>]*>([\s\S]*?)<\/a\s*>/gi,
2424
+ (_whole, _q, dq, sq, bare, label) => {
2425
+ const href = (dq ?? sq ?? bare ?? "").trim();
2426
+ const text = label.trim();
2427
+ if (!href) return text;
2428
+ if (!text) return href;
2429
+ return `${text} (${href})`;
2430
+ }
2431
+ );
2432
+ s = s.replace(/<h([1-6])\b[^>]*>([\s\S]*?)<\/h\1\s*>/gi, (_whole, level, inner) => {
2433
+ const hashes = "#".repeat(Number.parseInt(level, 10));
2434
+ return `
2435
+
2436
+ ${hashes} ${inner.trim()}
2437
+
2438
+ `;
2439
+ });
2440
+ s = s.replace(/<li\b[^>]*>/gi, "\n- ");
2441
+ s = s.replace(/<br\s*\/?>/gi, "\n");
2442
+ s = s.replace(
2443
+ /<\/?(p|div|section|article|header|footer|main|ul|ol|table|tr|h[1-6]|blockquote|pre)\b[^>]*>/gi,
2444
+ "\n\n"
2445
+ );
2446
+ s = s.replace(/<[^>]+>/g, " ");
2447
+ s = decodeEntities(s);
2448
+ const lines = s.split("\n").map((line) => line.replace(/[ \t\f\v ]+/g, " ").trim());
2449
+ const out = [];
2450
+ let blankRun = 0;
2451
+ for (const line of lines) {
2452
+ if (line === "") {
2453
+ blankRun += 1;
2454
+ if (blankRun <= 1) out.push("");
2455
+ } else {
2456
+ blankRun = 0;
2457
+ out.push(line);
2458
+ }
2459
+ }
2460
+ return out.join("\n").trim();
2461
+ }
2462
+ var webFetchTool = defineTool({
2463
+ name: "webfetch",
2464
+ description: DESCRIPTION6,
2465
+ parameters: {
2466
+ type: "object",
2467
+ properties: {
2468
+ url: {
2469
+ type: "string",
2470
+ description: "Absolute http or https address of the page to download."
2471
+ },
2472
+ maxBytes: {
2473
+ type: "integer",
2474
+ minimum: 1,
2475
+ description: "Optional ceiling on how many bytes of the page body to process before conversion."
2476
+ }
2477
+ },
2478
+ required: ["url"],
2479
+ additionalProperties: false
2480
+ },
2481
+ async run(input, ctx) {
2482
+ const raw = input;
2483
+ const bag = raw !== null && typeof raw === "object" ? raw : {};
2484
+ const rawUrl = bag.url;
2485
+ if (typeof rawUrl !== "string" || rawUrl.trim().length === 0) {
2486
+ return failure6("A non-empty `url` string is required to fetch a page.");
2487
+ }
2488
+ const target = parseTarget(rawUrl.trim());
2489
+ if (!target.ok) return failure6(target.reason);
2490
+ const capParse = readByteCap(bag.maxBytes);
2491
+ if (!capParse.ok) return failure6(capParse.reason);
2492
+ const requested = capParse.value ?? DEFAULT_BODY_CEILING;
2493
+ const bodyCeiling = Math.min(requested, ABSOLUTE_BODY_CEILING);
2494
+ const timeout = new AbortController();
2495
+ const timer = setTimeout(() => {
2496
+ timeout.abort();
2497
+ }, REQUEST_TIMEOUT_MS2);
2498
+ const onOuterAbort = () => {
2499
+ timeout.abort();
2500
+ };
2501
+ ctx.signal.addEventListener("abort", onOuterAbort, { once: true });
2502
+ let response;
2503
+ try {
2504
+ response = await fetch(target.url.toString(), {
2505
+ method: "GET",
2506
+ redirect: "follow",
2507
+ signal: timeout.signal,
2508
+ headers: {
2509
+ // A neutral, honest accept header; many servers vary on it.
2510
+ accept: "text/html,application/xhtml+xml,text/plain;q=0.9,*/*;q=0.8"
2511
+ }
2512
+ });
2513
+ } catch (err) {
2514
+ clearTimeout(timer);
2515
+ ctx.signal.removeEventListener("abort", onOuterAbort);
2516
+ if (ctx.signal.aborted) {
2517
+ return failure6(`The fetch of ${target.url.toString()} was cancelled before it completed.`);
2518
+ }
2519
+ const detail = err instanceof Error ? err.message : String(err);
2520
+ return failure6(`Could not reach ${target.url.toString()}: ${detail}`);
2521
+ }
2522
+ if (!response.ok) {
2523
+ clearTimeout(timer);
2524
+ ctx.signal.removeEventListener("abort", onOuterAbort);
2525
+ return failure6(
2526
+ `The server answered ${response.status} (${response.statusText || "no status text"}) for ${target.url.toString()}.`
2527
+ );
2528
+ }
2529
+ let body;
2530
+ try {
2531
+ body = await response.text();
2532
+ } catch (err) {
2533
+ const detail = err instanceof Error ? err.message : String(err);
2534
+ return failure6(`Downloaded ${target.url.toString()} but its body could not be decoded: ${detail}`);
2535
+ } finally {
2536
+ clearTimeout(timer);
2537
+ ctx.signal.removeEventListener("abort", onOuterAbort);
2538
+ }
2539
+ let rawTrimmed = false;
2540
+ if (Buffer.byteLength(body, "utf8") > bodyCeiling) {
2541
+ const clipped = clamp(body, { kind: "head", maxBytes: bodyCeiling });
2542
+ body = clipped;
2543
+ rawTrimmed = true;
2544
+ }
2545
+ const contentType = (response.headers.get("content-type") ?? "").toLowerCase();
2546
+ const looksHtml = contentType.includes("html") || contentType.includes("xml") || contentType === "" && /<\s*\/?[a-z][\s\S]*>/i.test(body);
2547
+ const rendered = looksHtml ? htmlToText(body) : body.trim();
2548
+ if (rendered.length === 0) {
2549
+ return {
2550
+ content: [
2551
+ {
2552
+ kind: "text",
2553
+ text: `Fetched ${target.url.toString()} successfully, but no readable text remained after stripping the page.`
2554
+ }
2555
+ ]
2556
+ };
2557
+ }
2558
+ const clamped = clamp(rendered, {
2559
+ kind: ctx.budget.kind,
2560
+ maxBytes: ctx.budget.maxBytes,
2561
+ notice: (omitted) => `
2562
+ [webfetch: dropped ${omitted} byte${omitted === 1 ? "" : "s"} of page text to stay inside the response budget]
2563
+ `
2564
+ });
2565
+ const budgetTrimmed = clamped !== rendered;
2566
+ const headerParts = [];
2567
+ headerParts.push(`Fetched ${target.url.toString()}.`);
2568
+ if (contentType) {
2569
+ headerParts.push(`Content type: ${contentType}.`);
2570
+ }
2571
+ if (rawTrimmed) {
2572
+ headerParts.push(
2573
+ "The downloaded page exceeded the byte ceiling, so only its opening portion was processed."
2574
+ );
2575
+ }
2576
+ if (budgetTrimmed) {
2577
+ headerParts.push(
2578
+ "The rendered text was further shortened to fit the response budget (see the inline marker)."
2579
+ );
2580
+ }
2581
+ const documentBody = `${headerParts.join(" ")}
2582
+
2583
+ ${clamped}`;
2584
+ return { content: [{ kind: "text", text: documentBody }] };
2585
+ }
2586
+ });
2587
+
2588
+ // src/capabilities/registry.ts
2589
+ var READ_ONLY_NAMES = [
2590
+ "read",
2591
+ "ls",
2592
+ "grep",
2593
+ "find",
2594
+ "websearch",
2595
+ "webfetch"
2596
+ ];
2597
+ var MUTATING_NAMES = [
2598
+ "write",
2599
+ "edit",
2600
+ "bash",
2601
+ "todo_set",
2602
+ "todo_read",
2603
+ "process"
2604
+ ];
2605
+ function allTools() {
2606
+ return [
2607
+ // read-only
2608
+ readTool,
2609
+ lsTool,
2610
+ grepTool,
2611
+ findTool,
2612
+ webSearchTool,
2613
+ webFetchTool,
2614
+ // mutating / stateful
2615
+ writeTool,
2616
+ editTool,
2617
+ bashTool,
2618
+ todoSetTool,
2619
+ todoReadTool,
2620
+ processTool
2621
+ ];
2622
+ }
2623
+ function builtinRegistry() {
2624
+ const registry = new ToolRegistry();
2625
+ registry.registerAll(allTools());
2626
+ registry.collection("read-only", READ_ONLY_NAMES);
2627
+ registry.collection("coding", [...READ_ONLY_NAMES, ...MUTATING_NAMES]);
2628
+ registry.collection("all", registry.names());
2629
+ return registry;
2630
+ }
2631
+ function toolBox(collection, cwd) {
2632
+ const root = cwd ?? process.cwd();
2633
+ const registry = builtinRegistry();
2634
+ const ctxFactory = () => makeNodeContext(root);
2635
+ return registry.toToolBox(ctxFactory, collection);
2636
+ }
2637
+ export {
2638
+ TodoStore,
2639
+ ToolRegistry,
2640
+ UnknownToolError,
2641
+ bashTool,
2642
+ builtinRegistry,
2643
+ clamp,
2644
+ defineTool,
2645
+ editTool,
2646
+ findTool,
2647
+ grepTool,
2648
+ lsTool,
2649
+ makeNodeContext,
2650
+ nodeFs,
2651
+ nodeShell,
2652
+ processTool,
2653
+ readTool,
2654
+ resetProcessTable,
2655
+ reset as resetTodos,
2656
+ todoReadTool,
2657
+ todoSetTool,
2658
+ todoStore,
2659
+ toolBox,
2660
+ webFetchTool,
2661
+ webSearchTool,
2662
+ writeTool
2663
+ };