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
@@ -1,1232 +0,0 @@
1
- /**
2
- * Session Manager - Persistent session storage and retrieval
3
- *
4
- * Purpose:
5
- * Manages agent session persistence using JSONL (JSON Lines) format for append-only,
6
- * transaction-safe storage. Handles session loading, saving, branching, and compaction.
7
- *
8
- * Based on conversation persistence patterns from Anthropic's Claude API
9
- * and JSONL formats from common chat applications (ChatGPT, Claude.ai).
10
- * Refactored for agent session branching and compaction.
11
- *
12
- * Architecture:
13
- * - Session File Format: JSONL (one JSON object per line)
14
- * - Storage Location: ~/.indusvx/sessions/ (or INDUSAGI_DIR/sessions/)
15
- * - Entry Types: Messages, model changes, thinking level changes, compaction markers
16
- * - Concurrency: Append-only prevents write conflicts
17
- * - Recovery: Can rebuild state from session entry log
18
- *
19
- * Key Features:
20
- * - Append-only session files for safe concurrent access
21
- * - Session branching (fork a session at any point)
22
- * - Entry types for different session events
23
- * - Compaction metadata tracking
24
- * - Custom entry support for extensions
25
- * - Session validation and recovery
26
- * - Efficient file operations (streaming read for large sessions)
27
- *
28
- * Session File Format:
29
- * ```
30
- * {"type":"session","version":3,"id":"abc123","timestamp":"2025-02-21T...","cwd":"/path","parentSession":"parent-id"}
31
- * {"type":"message","id":"msg1","parentId":null,"timestamp":"2025-02-21T...","message":{...}}
32
- * {"type":"message","id":"msg2","parentId":"msg1","timestamp":"2025-02-21T...","message":{...}}
33
- * {"type":"model_change","id":"mc1","parentId":"msg2","timestamp":"2025-02-21T...","provider":"openai","modelId":"gpt-4"}
34
- * {"type":"thinking_level_change","id":"tlc1","parentId":"mc1","timestamp":"2025-02-21T...","thinkingLevel":"high"}
35
- * {"type":"compaction","id":"comp1","parentId":"tlc1","timestamp":"2025-02-21T...","summary":"...","firstKeptEntryId":"msg2","tokensBefore":5000}
36
- * ```
37
- *
38
- * Entry Types:
39
- * - "message" - Agent or user message
40
- * - "model_change" - Model was switched
41
- * - "thinking_level_change" - Thinking level was adjusted
42
- * - "compaction" - Session was compacted with summary
43
- * - "branch_summary" - Branch point summary
44
- * - "custom" - Extension-specific data
45
- *
46
- * Session State Reconstruction:
47
- * 1. Load session header (first line)
48
- * 2. Read all entries sequentially
49
- * 3. Build message list from "message" entries
50
- * 4. Track latest "model_change" for current model
51
- * 5. Track latest "thinking_level_change" for current level
52
- * 6. Use "compaction" markers to know what was summarized
53
- * 7. Ignore "branch_summary" and "custom" entries from context
54
- *
55
- * Session Branching:
56
- * ```typescript
57
- * // Load existing session
58
- * const session = await loadSession("original-id");
59
- *
60
- * // Create branch at current point
61
- * const branchId = randomUUID();
62
- * const newSession = createNewSession(branchId, { parentSession: "original-id" });
63
- *
64
- * // Messages after branch are separate from original
65
- * ```
66
- *
67
- * Compaction Process:
68
- * - Summarize old messages into summary text
69
- * - Write CompactionEntry with summary and metadata
70
- * - Keep all entries for recovery
71
- * - LLM context uses summary instead of original messages
72
- *
73
- * Large File Handling:
74
- * - Sessions can be > 1GB
75
- * - Use streaming/chunked reads for file access
76
- * - Append operations are efficient (seek to EOF + write)
77
- * - Supports pagination for large message lists
78
- *
79
- * Error Handling:
80
- * - Malformed entries: Logged and skipped
81
- * - Incomplete files: Recovery via last valid entry
82
- * - Missing sessions: Returns undefined
83
- * - File permission errors: Throws with context
84
- *
85
- * Usage Examples:
86
- * ```typescript
87
- * // Create new session
88
- * const sessionId = randomUUID();
89
- * const header = createSessionHeader(sessionId, process.cwd());
90
- * await saveSessionEntry(sessionId, header);
91
- *
92
- * // Add messages
93
- * const message: AgentMessage = { role: "user", content: "..." };
94
- * await saveSessionEntry(sessionId, {
95
- * type: "message",
96
- * id: randomUUID(),
97
- * parentId: null,
98
- * timestamp: new Date().toISOString(),
99
- * message
100
- * });
101
- *
102
- * // Load session
103
- * const loaded = await loadSession(sessionId);
104
- * console.log(loaded.messages.length);
105
- *
106
- * // List all sessions
107
- * const all = await listSessions();
108
- * ```
109
- *
110
- * File Locations:
111
- * - Session directory: ~/.indusvx/sessions/
112
- * - Session file: ~/.indusvx/sessions/{sessionId}.jsonl
113
- * - Can override with INDUSAGI_DIR environment variable
114
- *
115
- * Thread Safety:
116
- * - JSONL format allows append-only writes
117
- * - No explicit locking needed
118
- * - Multiple processes can append safely
119
- * - Reads may see partial entries (handle gracefully)
120
- *
121
- * Based on session manager from indusvx-agent
122
- * Original: https://github.com/varunisrani/indusvx-ts/vendor/indusvx-agent/src/session-manager.ts
123
- */
124
- import { randomUUID } from "crypto";
125
- import { homedir } from "os";
126
- import { appendFileSync, closeSync, existsSync, mkdirSync, openSync, readdirSync, readFileSync, readSync, statSync, writeFileSync, } from "fs";
127
- import { readdir, readFile, stat } from "fs/promises";
128
- import { join, resolve } from "path";
129
- import { createBranchSummaryMessage, createCompactionSummaryMessage, createCustomMessage, } from "./messages.js";
130
- export const CURRENT_SESSION_VERSION = 3;
131
- /** Generate a unique short ID (8 hex chars, collision-checked) */
132
- function generateId(byId) {
133
- for (let i = 0; i < 100; i++) {
134
- const id = randomUUID().slice(0, 8);
135
- if (!byId.has(id))
136
- return id;
137
- }
138
- // Fallback to full UUID if somehow we have collisions
139
- return randomUUID();
140
- }
141
- /** Migrate v1 → v2: add id/parentId tree structure. Mutates in place. */
142
- function migrateV1ToV2(entries) {
143
- const ids = new Set();
144
- let prevId = null;
145
- for (const entry of entries) {
146
- if (entry.type === "session") {
147
- entry.version = 2;
148
- continue;
149
- }
150
- entry.id = generateId(ids);
151
- entry.parentId = prevId;
152
- prevId = entry.id;
153
- // Convert firstKeptEntryIndex to firstKeptEntryId for compaction
154
- if (entry.type === "compaction") {
155
- const comp = entry;
156
- if (typeof comp.firstKeptEntryIndex === "number") {
157
- const targetEntry = entries[comp.firstKeptEntryIndex];
158
- if (targetEntry && targetEntry.type !== "session") {
159
- comp.firstKeptEntryId = targetEntry.id;
160
- }
161
- delete comp.firstKeptEntryIndex;
162
- }
163
- }
164
- }
165
- }
166
- /** Migrate v2 → v3: rename hookMessage role to custom. Mutates in place. */
167
- function migrateV2ToV3(entries) {
168
- for (const entry of entries) {
169
- if (entry.type === "session") {
170
- entry.version = 3;
171
- continue;
172
- }
173
- // Update message entries with hookMessage role
174
- if (entry.type === "message") {
175
- const msgEntry = entry;
176
- if (msgEntry.message && msgEntry.message.role === "hookMessage") {
177
- msgEntry.message.role = "custom";
178
- }
179
- }
180
- }
181
- }
182
- /**
183
- * Run all necessary migrations to bring entries to current version.
184
- * Mutates entries in place. Returns true if any migration was applied.
185
- */
186
- function migrateToCurrentVersion(entries) {
187
- const header = entries.find((e) => e.type === "session");
188
- const version = header?.version ?? 1;
189
- if (version >= CURRENT_SESSION_VERSION)
190
- return false;
191
- if (version < 2)
192
- migrateV1ToV2(entries);
193
- if (version < 3)
194
- migrateV2ToV3(entries);
195
- return true;
196
- }
197
- /** Exported for testing */
198
- export function migrateSessionEntries(entries) {
199
- migrateToCurrentVersion(entries);
200
- }
201
- /** Exported for compaction.test.ts */
202
- export function parseSessionEntries(content) {
203
- const entries = [];
204
- const lines = content.trim().split("\n");
205
- for (const line of lines) {
206
- if (!line.trim())
207
- continue;
208
- try {
209
- const entry = JSON.parse(line);
210
- entries.push(entry);
211
- }
212
- catch {
213
- // Skip malformed lines
214
- }
215
- }
216
- return entries;
217
- }
218
- export function getLatestCompactionEntry(entries) {
219
- for (let i = entries.length - 1; i >= 0; i--) {
220
- if (entries[i].type === "compaction") {
221
- return entries[i];
222
- }
223
- }
224
- return null;
225
- }
226
- /**
227
- * Build the session context from entries using tree traversal.
228
- * If leafId is provided, walks from that entry to root.
229
- * Handles compaction and branch summaries along the path.
230
- */
231
- export function buildSessionContext(entries, leafId, byId) {
232
- // Build uuid index if not available
233
- if (!byId) {
234
- byId = new Map();
235
- for (const entry of entries) {
236
- byId.set(entry.id, entry);
237
- }
238
- }
239
- // Find leaf
240
- let leaf;
241
- if (leafId === null) {
242
- // Explicitly null - return no messages (navigated to before first entry)
243
- return { messages: [], thinkingLevel: "off", model: null };
244
- }
245
- if (leafId) {
246
- leaf = byId.get(leafId);
247
- }
248
- if (!leaf) {
249
- // Fallback to last entry (when leafId is undefined)
250
- leaf = entries[entries.length - 1];
251
- }
252
- if (!leaf) {
253
- return { messages: [], thinkingLevel: "off", model: null };
254
- }
255
- // Walk from leaf to root, collecting path
256
- const path = [];
257
- let current = leaf;
258
- while (current) {
259
- path.unshift(current);
260
- current = current.parentId ? byId.get(current.parentId) : undefined;
261
- }
262
- // Extract settings and find compaction
263
- let thinkingLevel = "off";
264
- let model = null;
265
- let compaction = null;
266
- for (const entry of path) {
267
- if (entry.type === "thinking_level_change") {
268
- thinkingLevel = entry.thinkingLevel;
269
- }
270
- else if (entry.type === "model_change") {
271
- model = { provider: entry.provider, modelId: entry.modelId };
272
- }
273
- else if (entry.type === "message" && entry.message.role === "assistant") {
274
- model = { provider: entry.message.provider, modelId: entry.message.model };
275
- }
276
- else if (entry.type === "compaction") {
277
- compaction = entry;
278
- }
279
- }
280
- // Build messages and collect corresponding entries
281
- // When there's a compaction, we need to:
282
- // 1. Emit summary first (entry = compaction)
283
- // 2. Emit kept messages (from firstKeptEntryId up to compaction)
284
- // 3. Emit messages after compaction
285
- const messages = [];
286
- const appendMessage = (entry) => {
287
- if (entry.type === "message") {
288
- messages.push(entry.message);
289
- }
290
- else if (entry.type === "custom_message") {
291
- messages.push(createCustomMessage(entry.customType, entry.content, entry.display, entry.details, entry.timestamp));
292
- }
293
- else if (entry.type === "branch_summary" && entry.summary) {
294
- messages.push(createBranchSummaryMessage(entry.summary, entry.fromId, entry.timestamp));
295
- }
296
- };
297
- if (compaction) {
298
- // Emit summary first
299
- messages.push(createCompactionSummaryMessage(compaction.summary, compaction.tokensBefore, compaction.timestamp));
300
- // Find compaction index in path
301
- const compactionIdx = path.findIndex((e) => e.type === "compaction" && e.id === compaction.id);
302
- // Emit kept messages (before compaction, starting from firstKeptEntryId)
303
- let foundFirstKept = false;
304
- for (let i = 0; i < compactionIdx; i++) {
305
- const entry = path[i];
306
- if (entry.id === compaction.firstKeptEntryId) {
307
- foundFirstKept = true;
308
- }
309
- if (foundFirstKept) {
310
- appendMessage(entry);
311
- }
312
- }
313
- // Emit messages after compaction
314
- for (let i = compactionIdx + 1; i < path.length; i++) {
315
- const entry = path[i];
316
- appendMessage(entry);
317
- }
318
- }
319
- else {
320
- // No compaction - emit all messages, handle branch summaries and custom messages
321
- for (const entry of path) {
322
- appendMessage(entry);
323
- }
324
- }
325
- return { messages, thinkingLevel, model };
326
- }
327
- const DEFAULT_CONFIG_DIR = ".indusvx";
328
- const ENV_AGENT_DIR = "INDUSAGI_AGENT_DIR";
329
- const ENV_CODING_AGENT_DIR = "INDUSAGI_CODING_AGENT_DIR";
330
- const ENV_BASE_DIR = "INDUSAGI_DIR";
331
- function expandHomePath(value) {
332
- if (value === "~")
333
- return homedir();
334
- if (value.startsWith("~/"))
335
- return homedir() + value.slice(1);
336
- return value;
337
- }
338
- function getDefaultAgentDir() {
339
- const envDir = process.env[ENV_AGENT_DIR] ?? process.env[ENV_CODING_AGENT_DIR];
340
- if (envDir) {
341
- return expandHomePath(envDir);
342
- }
343
- const baseDir = process.env[ENV_BASE_DIR]
344
- ? expandHomePath(process.env[ENV_BASE_DIR])
345
- : join(homedir(), DEFAULT_CONFIG_DIR);
346
- return join(baseDir, "agent");
347
- }
348
- function getSessionsDir() {
349
- return join(getDefaultAgentDir(), "sessions");
350
- }
351
- /**
352
- * Compute the default session directory for a cwd.
353
- * Encodes cwd into a safe directory name under ~/.indusvx/agent/sessions/.
354
- */
355
- function getDefaultSessionDir(cwd) {
356
- const safePath = `--${cwd.replace(/^[/\\]/, "").replace(/[/\\:]/g, "-")}--`;
357
- const sessionDir = join(getDefaultAgentDir(), "sessions", safePath);
358
- if (!existsSync(sessionDir)) {
359
- mkdirSync(sessionDir, { recursive: true });
360
- }
361
- return sessionDir;
362
- }
363
- /** Exported for testing */
364
- export function loadEntriesFromFile(filePath) {
365
- if (!existsSync(filePath))
366
- return [];
367
- const content = readFileSync(filePath, "utf8");
368
- const entries = [];
369
- const lines = content.trim().split("\n");
370
- for (const line of lines) {
371
- if (!line.trim())
372
- continue;
373
- try {
374
- const entry = JSON.parse(line);
375
- entries.push(entry);
376
- }
377
- catch {
378
- // Skip malformed lines
379
- }
380
- }
381
- // Validate session header
382
- if (entries.length === 0)
383
- return entries;
384
- const header = entries[0];
385
- if (header.type !== "session" || typeof header.id !== "string") {
386
- return [];
387
- }
388
- return entries;
389
- }
390
- function isValidSessionFile(filePath) {
391
- try {
392
- const fd = openSync(filePath, "r");
393
- const buffer = Buffer.alloc(512);
394
- const bytesRead = readSync(fd, buffer, 0, 512, 0);
395
- closeSync(fd);
396
- const firstLine = buffer.toString("utf8", 0, bytesRead).split("\n")[0];
397
- if (!firstLine)
398
- return false;
399
- const header = JSON.parse(firstLine);
400
- return header.type === "session" && typeof header.id === "string";
401
- }
402
- catch {
403
- return false;
404
- }
405
- }
406
- /** Exported for testing */
407
- export function findMostRecentSession(sessionDir) {
408
- try {
409
- const files = readdirSync(sessionDir)
410
- .filter((f) => f.endsWith(".jsonl"))
411
- .map((f) => join(sessionDir, f))
412
- .filter(isValidSessionFile)
413
- .map((path) => ({ path, mtime: statSync(path).mtime }))
414
- .sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
415
- return files[0]?.path || null;
416
- }
417
- catch {
418
- return null;
419
- }
420
- }
421
- function isMessageWithContent(message) {
422
- return typeof message.role === "string" && "content" in message;
423
- }
424
- function extractTextContent(message) {
425
- const content = message.content;
426
- if (typeof content === "string") {
427
- return content;
428
- }
429
- return content
430
- .filter((block) => block.type === "text")
431
- .map((block) => block.text)
432
- .join(" ");
433
- }
434
- function getLastActivityTime(entries) {
435
- let lastActivityTime;
436
- for (const entry of entries) {
437
- if (entry.type !== "message")
438
- continue;
439
- const message = entry.message;
440
- if (!isMessageWithContent(message))
441
- continue;
442
- if (message.role !== "user" && message.role !== "assistant")
443
- continue;
444
- const msgTimestamp = message.timestamp;
445
- if (typeof msgTimestamp === "number") {
446
- lastActivityTime = Math.max(lastActivityTime ?? 0, msgTimestamp);
447
- continue;
448
- }
449
- const entryTimestamp = entry.timestamp;
450
- if (typeof entryTimestamp === "string") {
451
- const t = new Date(entryTimestamp).getTime();
452
- if (!Number.isNaN(t)) {
453
- lastActivityTime = Math.max(lastActivityTime ?? 0, t);
454
- }
455
- }
456
- }
457
- return lastActivityTime;
458
- }
459
- function getSessionModifiedDate(entries, header, statsMtime) {
460
- const lastActivityTime = getLastActivityTime(entries);
461
- if (typeof lastActivityTime === "number" && lastActivityTime > 0) {
462
- return new Date(lastActivityTime);
463
- }
464
- const headerTime = typeof header.timestamp === "string" ? new Date(header.timestamp).getTime() : NaN;
465
- return !Number.isNaN(headerTime) ? new Date(headerTime) : statsMtime;
466
- }
467
- async function buildSessionInfo(filePath) {
468
- try {
469
- const content = await readFile(filePath, "utf8");
470
- const entries = [];
471
- const lines = content.trim().split("\n");
472
- for (const line of lines) {
473
- if (!line.trim())
474
- continue;
475
- try {
476
- entries.push(JSON.parse(line));
477
- }
478
- catch {
479
- // Skip malformed lines
480
- }
481
- }
482
- if (entries.length === 0)
483
- return null;
484
- const header = entries[0];
485
- if (header.type !== "session")
486
- return null;
487
- const stats = await stat(filePath);
488
- let messageCount = 0;
489
- let firstMessage = "";
490
- const allMessages = [];
491
- let name;
492
- for (const entry of entries) {
493
- // Extract session name (use latest)
494
- if (entry.type === "session_info") {
495
- const infoEntry = entry;
496
- if (infoEntry.name) {
497
- name = infoEntry.name.trim();
498
- }
499
- }
500
- if (entry.type !== "message")
501
- continue;
502
- messageCount++;
503
- const message = entry.message;
504
- if (!isMessageWithContent(message))
505
- continue;
506
- if (message.role !== "user" && message.role !== "assistant")
507
- continue;
508
- const textContent = extractTextContent(message);
509
- if (!textContent)
510
- continue;
511
- allMessages.push(textContent);
512
- if (!firstMessage && message.role === "user") {
513
- firstMessage = textContent;
514
- }
515
- }
516
- const cwd = typeof header.cwd === "string" ? header.cwd : "";
517
- const modified = getSessionModifiedDate(entries, header, stats.mtime);
518
- return {
519
- path: filePath,
520
- id: header.id,
521
- cwd,
522
- name,
523
- created: new Date(header.timestamp),
524
- modified,
525
- lastModified: modified.getTime(),
526
- messageCount,
527
- firstMessage: firstMessage || "(no messages)",
528
- allMessagesText: allMessages.join(" "),
529
- size: stats.size,
530
- };
531
- }
532
- catch {
533
- return null;
534
- }
535
- }
536
- async function listSessionsFromDir(dir, onProgress, progressOffset = 0, progressTotal) {
537
- const sessions = [];
538
- if (!existsSync(dir)) {
539
- return sessions;
540
- }
541
- try {
542
- const dirEntries = await readdir(dir);
543
- const files = dirEntries.filter((f) => f.endsWith(".jsonl")).map((f) => join(dir, f));
544
- const total = progressTotal ?? files.length;
545
- let loaded = 0;
546
- const results = await Promise.all(files.map(async (file) => {
547
- const info = await buildSessionInfo(file);
548
- loaded++;
549
- onProgress?.(progressOffset + loaded, total);
550
- return info;
551
- }));
552
- for (const info of results) {
553
- if (info) {
554
- sessions.push(info);
555
- }
556
- }
557
- }
558
- catch {
559
- // Return empty list on error
560
- }
561
- return sessions;
562
- }
563
- /**
564
- * Manages conversation sessions as append-only trees stored in JSONL files.
565
- *
566
- * Each session entry has an id and parentId forming a tree structure. The "leaf"
567
- * pointer tracks the current position. Appending creates a child of the current leaf.
568
- * Branching moves the leaf to an earlier entry, allowing new branches without
569
- * modifying history.
570
- *
571
- * Use buildSessionContext() to get the resolved message list for the LLM, which
572
- * handles compaction summaries and follows the path from root to current leaf.
573
- */
574
- export class SessionManager {
575
- sessionId = "";
576
- sessionFile;
577
- sessionDir;
578
- cwd;
579
- persist;
580
- flushed = false;
581
- fileEntries = [];
582
- byId = new Map();
583
- labelsById = new Map();
584
- leafId = null;
585
- constructor(cwd, sessionDir, sessionFile, persist) {
586
- this.cwd = cwd;
587
- this.sessionDir = sessionDir;
588
- this.persist = persist;
589
- if (persist && sessionDir && !existsSync(sessionDir)) {
590
- mkdirSync(sessionDir, { recursive: true });
591
- }
592
- if (sessionFile) {
593
- this.setSessionFile(sessionFile);
594
- }
595
- else {
596
- this.newSession();
597
- }
598
- }
599
- /** Switch to a different session file (used for resume and branching) */
600
- setSessionFile(sessionFile) {
601
- this.sessionFile = resolve(sessionFile);
602
- if (existsSync(this.sessionFile)) {
603
- this.fileEntries = loadEntriesFromFile(this.sessionFile);
604
- // If file was empty or corrupted (no valid header), truncate and start fresh
605
- // to avoid appending messages without a session header (which breaks the session)
606
- if (this.fileEntries.length === 0) {
607
- const explicitPath = this.sessionFile;
608
- this.newSession();
609
- this.sessionFile = explicitPath;
610
- this._rewriteFile();
611
- this.flushed = true;
612
- return;
613
- }
614
- const header = this.fileEntries.find((e) => e.type === "session");
615
- this.sessionId = header?.id ?? randomUUID();
616
- if (migrateToCurrentVersion(this.fileEntries)) {
617
- this._rewriteFile();
618
- }
619
- this._buildIndex();
620
- this.flushed = true;
621
- }
622
- else {
623
- const explicitPath = this.sessionFile;
624
- this.newSession();
625
- this.sessionFile = explicitPath; // preserve explicit path from --session flag
626
- }
627
- }
628
- newSession(options) {
629
- this.sessionId = randomUUID();
630
- const timestamp = new Date().toISOString();
631
- const header = {
632
- type: "session",
633
- version: CURRENT_SESSION_VERSION,
634
- id: this.sessionId,
635
- timestamp,
636
- cwd: this.cwd,
637
- parentSession: options?.parentSession,
638
- };
639
- this.fileEntries = [header];
640
- this.byId.clear();
641
- this.labelsById.clear();
642
- this.leafId = null;
643
- this.flushed = false;
644
- if (this.persist) {
645
- const fileTimestamp = timestamp.replace(/[:.]/g, "-");
646
- this.sessionFile = join(this.getSessionDir(), `${fileTimestamp}_${this.sessionId}.jsonl`);
647
- }
648
- return this.sessionFile;
649
- }
650
- _buildIndex() {
651
- this.byId.clear();
652
- this.labelsById.clear();
653
- this.leafId = null;
654
- for (const entry of this.fileEntries) {
655
- if (entry.type === "session")
656
- continue;
657
- this.byId.set(entry.id, entry);
658
- this.leafId = entry.id;
659
- if (entry.type === "label") {
660
- if (entry.label) {
661
- this.labelsById.set(entry.targetId, entry.label);
662
- }
663
- else {
664
- this.labelsById.delete(entry.targetId);
665
- }
666
- }
667
- }
668
- }
669
- _rewriteFile() {
670
- if (!this.persist || !this.sessionFile)
671
- return;
672
- const content = `${this.fileEntries.map((e) => JSON.stringify(e)).join("\n")}\n`;
673
- writeFileSync(this.sessionFile, content);
674
- }
675
- isPersisted() {
676
- return this.persist;
677
- }
678
- getCwd() {
679
- return this.cwd;
680
- }
681
- getSessionDir() {
682
- return this.sessionDir;
683
- }
684
- getSessionId() {
685
- return this.sessionId;
686
- }
687
- getSessionFile() {
688
- return this.sessionFile;
689
- }
690
- _persist(entry) {
691
- if (!this.persist || !this.sessionFile)
692
- return;
693
- const hasAssistant = this.fileEntries.some((e) => e.type === "message" && e.message.role === "assistant");
694
- if (!hasAssistant)
695
- return;
696
- if (!this.flushed) {
697
- for (const e of this.fileEntries) {
698
- appendFileSync(this.sessionFile, `${JSON.stringify(e)}\n`);
699
- }
700
- this.flushed = true;
701
- }
702
- else {
703
- appendFileSync(this.sessionFile, `${JSON.stringify(entry)}\n`);
704
- }
705
- }
706
- _appendEntry(entry) {
707
- this.fileEntries.push(entry);
708
- this.byId.set(entry.id, entry);
709
- this.leafId = entry.id;
710
- this._persist(entry);
711
- }
712
- /** Append a message as child of current leaf, then advance leaf. Returns entry id.
713
- * Does not allow writing CompactionSummaryMessage and BranchSummaryMessage directly.
714
- * Reason: we want these to be top-level entries in the session, not message session entries,
715
- * so it is easier to find them.
716
- * These need to be appended via appendCompaction() and appendBranchSummary() methods.
717
- */
718
- appendMessage(message) {
719
- const entry = {
720
- type: "message",
721
- id: generateId(this.byId),
722
- parentId: this.leafId,
723
- timestamp: new Date().toISOString(),
724
- message,
725
- };
726
- this._appendEntry(entry);
727
- return entry.id;
728
- }
729
- /** Append a thinking level change as child of current leaf, then advance leaf. Returns entry id. */
730
- appendThinkingLevelChange(thinkingLevel) {
731
- const entry = {
732
- type: "thinking_level_change",
733
- id: generateId(this.byId),
734
- parentId: this.leafId,
735
- timestamp: new Date().toISOString(),
736
- thinkingLevel,
737
- };
738
- this._appendEntry(entry);
739
- return entry.id;
740
- }
741
- /** Append a model change as child of current leaf, then advance leaf. Returns entry id. */
742
- appendModelChange(provider, modelId) {
743
- const entry = {
744
- type: "model_change",
745
- id: generateId(this.byId),
746
- parentId: this.leafId,
747
- timestamp: new Date().toISOString(),
748
- provider,
749
- modelId,
750
- };
751
- this._appendEntry(entry);
752
- return entry.id;
753
- }
754
- /** Append a compaction summary as child of current leaf, then advance leaf. Returns entry id. */
755
- appendCompaction(summary, firstKeptEntryId, tokensBefore, details, fromHook) {
756
- const entry = {
757
- type: "compaction",
758
- id: generateId(this.byId),
759
- parentId: this.leafId,
760
- timestamp: new Date().toISOString(),
761
- summary,
762
- firstKeptEntryId,
763
- tokensBefore,
764
- details,
765
- fromHook,
766
- };
767
- this._appendEntry(entry);
768
- return entry.id;
769
- }
770
- /** Append a custom entry (for extensions) as child of current leaf, then advance leaf. Returns entry id. */
771
- appendCustomEntry(customType, data) {
772
- const entry = {
773
- type: "custom",
774
- customType,
775
- data,
776
- id: generateId(this.byId),
777
- parentId: this.leafId,
778
- timestamp: new Date().toISOString(),
779
- };
780
- this._appendEntry(entry);
781
- return entry.id;
782
- }
783
- /** Append a session info entry (e.g., display name). Returns entry id. */
784
- appendSessionInfo(name) {
785
- const entry = {
786
- type: "session_info",
787
- id: generateId(this.byId),
788
- parentId: this.leafId,
789
- timestamp: new Date().toISOString(),
790
- name: name.trim(),
791
- };
792
- this._appendEntry(entry);
793
- return entry.id;
794
- }
795
- /** Get the current session name from the latest session_info entry, if any. */
796
- getSessionName() {
797
- // Walk entries in reverse to find the latest session_info with a name
798
- const entries = this.getEntries();
799
- for (let i = entries.length - 1; i >= 0; i--) {
800
- const entry = entries[i];
801
- if (entry.type === "session_info" && entry.name) {
802
- return entry.name;
803
- }
804
- }
805
- return undefined;
806
- }
807
- /**
808
- * Append a custom message entry (for extensions) that participates in LLM context.
809
- * @param customType Extension identifier for filtering on reload
810
- * @param content Message content (string or TextContent/ImageContent array)
811
- * @param display Whether to show in TUI (true = styled display, false = hidden)
812
- * @param details Optional extension-specific metadata (not sent to LLM)
813
- * @returns Entry id
814
- */
815
- appendCustomMessageEntry(customType, content, display, details) {
816
- const entry = {
817
- type: "custom_message",
818
- customType,
819
- content,
820
- display,
821
- details,
822
- id: generateId(this.byId),
823
- parentId: this.leafId,
824
- timestamp: new Date().toISOString(),
825
- };
826
- this._appendEntry(entry);
827
- return entry.id;
828
- }
829
- // =========================================================================
830
- // Tree Traversal
831
- // =========================================================================
832
- getLeafId() {
833
- return this.leafId;
834
- }
835
- getLeafEntry() {
836
- return this.leafId ? this.byId.get(this.leafId) : undefined;
837
- }
838
- getEntry(id) {
839
- return this.byId.get(id);
840
- }
841
- /**
842
- * Get all direct children of an entry.
843
- */
844
- getChildren(parentId) {
845
- const children = [];
846
- for (const entry of this.byId.values()) {
847
- if (entry.parentId === parentId) {
848
- children.push(entry);
849
- }
850
- }
851
- return children;
852
- }
853
- /**
854
- * Get the label for an entry, if any.
855
- */
856
- getLabel(id) {
857
- return this.labelsById.get(id);
858
- }
859
- /**
860
- * Set or clear a label on an entry.
861
- * Labels are user-defined markers for bookmarking/navigation.
862
- * Pass undefined or empty string to clear the label.
863
- */
864
- appendLabelChange(targetId, label) {
865
- if (!this.byId.has(targetId)) {
866
- throw new Error(`Entry ${targetId} not found`);
867
- }
868
- const entry = {
869
- type: "label",
870
- id: generateId(this.byId),
871
- parentId: this.leafId,
872
- timestamp: new Date().toISOString(),
873
- targetId,
874
- label,
875
- };
876
- this._appendEntry(entry);
877
- if (label) {
878
- this.labelsById.set(targetId, label);
879
- }
880
- else {
881
- this.labelsById.delete(targetId);
882
- }
883
- return entry.id;
884
- }
885
- /**
886
- * Walk from entry to root, returning all entries in path order.
887
- * Includes all entry types (messages, compaction, model changes, etc.).
888
- * Use buildSessionContext() to get the resolved messages for the LLM.
889
- */
890
- getBranch(fromId) {
891
- const path = [];
892
- const startId = fromId ?? this.leafId;
893
- let current = startId ? this.byId.get(startId) : undefined;
894
- while (current) {
895
- path.unshift(current);
896
- current = current.parentId ? this.byId.get(current.parentId) : undefined;
897
- }
898
- return path;
899
- }
900
- /**
901
- * Build the session context (what gets sent to the LLM).
902
- * Uses tree traversal from current leaf.
903
- */
904
- buildSessionContext() {
905
- return buildSessionContext(this.getEntries(), this.leafId, this.byId);
906
- }
907
- /**
908
- * Get session header.
909
- */
910
- getHeader() {
911
- const h = this.fileEntries.find((e) => e.type === "session");
912
- return h ? h : null;
913
- }
914
- /**
915
- * Get all session entries (excludes header). Returns a shallow copy.
916
- * The session is append-only: use appendXXX() to add entries, branch() to
917
- * change the leaf pointer. Entries cannot be modified or deleted.
918
- */
919
- getEntries() {
920
- return this.fileEntries.filter((e) => e.type !== "session");
921
- }
922
- /**
923
- * Get the session as a tree structure. Returns a shallow defensive copy of all entries.
924
- * A well-formed session has exactly one root (first entry with parentId === null).
925
- * Orphaned entries (broken parent chain) are also returned as roots.
926
- */
927
- getTree() {
928
- const entries = this.getEntries();
929
- const nodeMap = new Map();
930
- const roots = [];
931
- // Create nodes with resolved labels
932
- for (const entry of entries) {
933
- const label = this.labelsById.get(entry.id);
934
- nodeMap.set(entry.id, { entry, children: [], label });
935
- }
936
- // Build tree
937
- for (const entry of entries) {
938
- const node = nodeMap.get(entry.id);
939
- if (entry.parentId === null || entry.parentId === entry.id) {
940
- roots.push(node);
941
- }
942
- else {
943
- const parent = nodeMap.get(entry.parentId);
944
- if (parent) {
945
- parent.children.push(node);
946
- }
947
- else {
948
- // Orphan - treat as root
949
- roots.push(node);
950
- }
951
- }
952
- }
953
- // Sort children by timestamp (oldest first, newest at bottom)
954
- // Use iterative approach to avoid stack overflow on deep trees
955
- const stack = [...roots];
956
- while (stack.length > 0) {
957
- const node = stack.pop();
958
- node.children.sort((a, b) => new Date(a.entry.timestamp).getTime() - new Date(b.entry.timestamp).getTime());
959
- stack.push(...node.children);
960
- }
961
- return roots;
962
- }
963
- // =========================================================================
964
- // Branching
965
- // =========================================================================
966
- /**
967
- * Start a new branch from an earlier entry.
968
- * Moves the leaf pointer to the specified entry. The next appendXXX() call
969
- * will create a child of that entry, forming a new branch. Existing entries
970
- * are not modified or deleted.
971
- */
972
- branch(branchFromId) {
973
- if (!this.byId.has(branchFromId)) {
974
- throw new Error(`Entry ${branchFromId} not found`);
975
- }
976
- this.leafId = branchFromId;
977
- }
978
- /**
979
- * Reset the leaf pointer to null (before any entries).
980
- * The next appendXXX() call will create a new root entry (parentId = null).
981
- * Use this when navigating to re-edit the first user message.
982
- */
983
- resetLeaf() {
984
- this.leafId = null;
985
- }
986
- /**
987
- * Start a new branch with a summary of the abandoned path.
988
- * Same as branch(), but also appends a branch_summary entry that captures
989
- * context from the abandoned conversation path.
990
- */
991
- branchWithSummary(branchFromId, summary, details, fromHook) {
992
- if (branchFromId !== null && !this.byId.has(branchFromId)) {
993
- throw new Error(`Entry ${branchFromId} not found`);
994
- }
995
- this.leafId = branchFromId;
996
- const entry = {
997
- type: "branch_summary",
998
- id: generateId(this.byId),
999
- parentId: branchFromId,
1000
- timestamp: new Date().toISOString(),
1001
- fromId: branchFromId ?? "root",
1002
- summary,
1003
- details,
1004
- fromHook,
1005
- };
1006
- this._appendEntry(entry);
1007
- return entry.id;
1008
- }
1009
- /**
1010
- * Create a new session file containing only the path from root to the specified leaf.
1011
- * Useful for extracting a single conversation path from a branched session.
1012
- * Returns the new session file path, or undefined if not persisting.
1013
- */
1014
- createBranchedSession(leafId) {
1015
- const path = this.getBranch(leafId);
1016
- if (path.length === 0) {
1017
- throw new Error(`Entry ${leafId} not found`);
1018
- }
1019
- // Filter out LabelEntry from path - we'll recreate them from the resolved map
1020
- const pathWithoutLabels = path.filter((e) => e.type !== "label");
1021
- const newSessionId = randomUUID();
1022
- const timestamp = new Date().toISOString();
1023
- const fileTimestamp = timestamp.replace(/[:.]/g, "-");
1024
- const newSessionFile = join(this.getSessionDir(), `${fileTimestamp}_${newSessionId}.jsonl`);
1025
- const header = {
1026
- type: "session",
1027
- version: CURRENT_SESSION_VERSION,
1028
- id: newSessionId,
1029
- timestamp,
1030
- cwd: this.cwd,
1031
- parentSession: this.persist ? this.sessionFile : undefined,
1032
- };
1033
- // Collect labels for entries in the path
1034
- const pathEntryIds = new Set(pathWithoutLabels.map((e) => e.id));
1035
- const labelsToWrite = [];
1036
- for (const [targetId, label] of this.labelsById) {
1037
- if (pathEntryIds.has(targetId)) {
1038
- labelsToWrite.push({ targetId, label });
1039
- }
1040
- }
1041
- if (this.persist) {
1042
- appendFileSync(newSessionFile, `${JSON.stringify(header)}\n`);
1043
- for (const entry of pathWithoutLabels) {
1044
- appendFileSync(newSessionFile, `${JSON.stringify(entry)}\n`);
1045
- }
1046
- // Write fresh label entries at the end
1047
- const lastEntryId = pathWithoutLabels[pathWithoutLabels.length - 1]?.id || null;
1048
- let parentId = lastEntryId;
1049
- const labelEntries = [];
1050
- for (const { targetId, label } of labelsToWrite) {
1051
- const labelEntry = {
1052
- type: "label",
1053
- id: generateId(new Set(pathEntryIds)),
1054
- parentId,
1055
- timestamp: new Date().toISOString(),
1056
- targetId,
1057
- label,
1058
- };
1059
- appendFileSync(newSessionFile, `${JSON.stringify(labelEntry)}\n`);
1060
- pathEntryIds.add(labelEntry.id);
1061
- labelEntries.push(labelEntry);
1062
- parentId = labelEntry.id;
1063
- }
1064
- this.fileEntries = [header, ...pathWithoutLabels, ...labelEntries];
1065
- this.sessionId = newSessionId;
1066
- this._buildIndex();
1067
- return newSessionFile;
1068
- }
1069
- // In-memory mode: replace current session with the path + labels
1070
- const labelEntries = [];
1071
- let parentId = pathWithoutLabels[pathWithoutLabels.length - 1]?.id || null;
1072
- for (const { targetId, label } of labelsToWrite) {
1073
- const labelEntry = {
1074
- type: "label",
1075
- id: generateId(new Set([...pathEntryIds, ...labelEntries.map((e) => e.id)])),
1076
- parentId,
1077
- timestamp: new Date().toISOString(),
1078
- targetId,
1079
- label,
1080
- };
1081
- labelEntries.push(labelEntry);
1082
- parentId = labelEntry.id;
1083
- }
1084
- this.fileEntries = [header, ...pathWithoutLabels, ...labelEntries];
1085
- this.sessionId = newSessionId;
1086
- this._buildIndex();
1087
- return undefined;
1088
- }
1089
- /**
1090
- * Create a new session.
1091
- * @param cwd Working directory (stored in session header)
1092
- * @param sessionDir Optional session directory. If omitted, uses default (~/.indusvx/agent/sessions/<encoded-cwd>/).
1093
- */
1094
- static create(cwd, sessionDir) {
1095
- const dir = sessionDir ?? getDefaultSessionDir(cwd);
1096
- return new SessionManager(cwd, dir, undefined, true);
1097
- }
1098
- /**
1099
- * Open a specific session file.
1100
- * @param path Path to session file
1101
- * @param sessionDir Optional session directory for /new or /branch. If omitted, derives from file's parent.
1102
- */
1103
- static open(path, sessionDir) {
1104
- // Extract cwd from session header if possible, otherwise use process.cwd()
1105
- const entries = loadEntriesFromFile(path);
1106
- const header = entries.find((e) => e.type === "session");
1107
- const cwd = header?.cwd ?? process.cwd();
1108
- // If no sessionDir provided, derive from file's parent directory
1109
- const dir = sessionDir ?? resolve(path, "..");
1110
- return new SessionManager(cwd, dir, path, true);
1111
- }
1112
- /**
1113
- * Continue the most recent session, or create new if none.
1114
- * @param cwd Working directory
1115
- * @param sessionDir Optional session directory. If omitted, uses default (~/.indusvx/agent/sessions/<encoded-cwd>/).
1116
- */
1117
- static continueRecent(cwd, sessionDir) {
1118
- const dir = sessionDir ?? getDefaultSessionDir(cwd);
1119
- const mostRecent = findMostRecentSession(dir);
1120
- if (mostRecent) {
1121
- return new SessionManager(cwd, dir, mostRecent, true);
1122
- }
1123
- return new SessionManager(cwd, dir, undefined, true);
1124
- }
1125
- /** Create an in-memory session (no file persistence) */
1126
- static inMemory(cwd = process.cwd()) {
1127
- return new SessionManager(cwd, "", undefined, false);
1128
- }
1129
- /**
1130
- * Fork a session from another project directory into the current project.
1131
- * Creates a new session in the target cwd with the full history from the source session.
1132
- * @param sourcePath Path to the source session file
1133
- * @param targetCwd Target working directory (where the new session will be stored)
1134
- * @param sessionDir Optional session directory. If omitted, uses default for targetCwd.
1135
- */
1136
- static forkFrom(sourcePath, targetCwd, sessionDir) {
1137
- const sourceEntries = loadEntriesFromFile(sourcePath);
1138
- if (sourceEntries.length === 0) {
1139
- throw new Error(`Cannot fork: source session file is empty or invalid: ${sourcePath}`);
1140
- }
1141
- const sourceHeader = sourceEntries.find((e) => e.type === "session");
1142
- if (!sourceHeader) {
1143
- throw new Error(`Cannot fork: source session has no header: ${sourcePath}`);
1144
- }
1145
- const dir = sessionDir ?? getDefaultSessionDir(targetCwd);
1146
- if (!existsSync(dir)) {
1147
- mkdirSync(dir, { recursive: true });
1148
- }
1149
- // Create new session file with new ID but forked content
1150
- const newSessionId = randomUUID();
1151
- const timestamp = new Date().toISOString();
1152
- const fileTimestamp = timestamp.replace(/[:.]/g, "-");
1153
- const newSessionFile = join(dir, `${fileTimestamp}_${newSessionId}.jsonl`);
1154
- // Write new header pointing to source as parent, with updated cwd
1155
- const newHeader = {
1156
- type: "session",
1157
- version: CURRENT_SESSION_VERSION,
1158
- id: newSessionId,
1159
- timestamp,
1160
- cwd: targetCwd,
1161
- parentSession: sourcePath,
1162
- };
1163
- appendFileSync(newSessionFile, `${JSON.stringify(newHeader)}\n`);
1164
- // Copy all non-header entries from source
1165
- for (const entry of sourceEntries) {
1166
- if (entry.type !== "session") {
1167
- appendFileSync(newSessionFile, `${JSON.stringify(entry)}\n`);
1168
- }
1169
- }
1170
- return new SessionManager(targetCwd, dir, newSessionFile, true);
1171
- }
1172
- /**
1173
- * List all sessions for a directory.
1174
- * @param cwd Working directory (used to compute default session directory)
1175
- * @param sessionDir Optional session directory. If omitted, uses default (~/.indusvx/agent/sessions/<encoded-cwd>/).
1176
- * @param onProgress Optional callback for progress updates (loaded, total)
1177
- */
1178
- static async list(cwd, sessionDir, onProgress) {
1179
- const dir = sessionDir ?? getDefaultSessionDir(cwd);
1180
- const sessions = await listSessionsFromDir(dir, onProgress);
1181
- sessions.sort((a, b) => b.modified.getTime() - a.modified.getTime());
1182
- return sessions;
1183
- }
1184
- /**
1185
- * List all sessions across all project directories.
1186
- * @param onProgress Optional callback for progress updates (loaded, total)
1187
- */
1188
- static async listAll(onProgress) {
1189
- const sessionsDir = getSessionsDir();
1190
- try {
1191
- if (!existsSync(sessionsDir)) {
1192
- return [];
1193
- }
1194
- const entries = await readdir(sessionsDir, { withFileTypes: true });
1195
- const dirs = entries.filter((e) => e.isDirectory()).map((e) => join(sessionsDir, e.name));
1196
- // Count total files first for accurate progress
1197
- let totalFiles = 0;
1198
- const dirFiles = [];
1199
- for (const dir of dirs) {
1200
- try {
1201
- const files = (await readdir(dir)).filter((f) => f.endsWith(".jsonl"));
1202
- dirFiles.push(files.map((f) => join(dir, f)));
1203
- totalFiles += files.length;
1204
- }
1205
- catch {
1206
- dirFiles.push([]);
1207
- }
1208
- }
1209
- // Process all files with progress tracking
1210
- let loaded = 0;
1211
- const sessions = [];
1212
- const allFiles = dirFiles.flat();
1213
- const results = await Promise.all(allFiles.map(async (file) => {
1214
- const info = await buildSessionInfo(file);
1215
- loaded++;
1216
- onProgress?.(loaded, totalFiles);
1217
- return info;
1218
- }));
1219
- for (const info of results) {
1220
- if (info) {
1221
- sessions.push(info);
1222
- }
1223
- }
1224
- sessions.sort((a, b) => b.modified.getTime() - a.modified.getTime());
1225
- return sessions;
1226
- }
1227
- catch {
1228
- return [];
1229
- }
1230
- }
1231
- }
1232
- //# sourceMappingURL=session-manager.js.map