orient-cli 0.1.0-alpha.0 → 0.2.0

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 (936) hide show
  1. package/LICENSE +0 -0
  2. package/NOTICE.md +0 -0
  3. package/README.md +0 -0
  4. package/dist/cli.d.ts +0 -0
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/extensions/orient-core.d.ts +0 -0
  8. package/dist/extensions/orient-core.js +0 -0
  9. package/dist/extensions/orient-core.js.map +0 -0
  10. package/dist/extensions/orient-notebooklm.d.ts +0 -0
  11. package/dist/extensions/orient-notebooklm.js +0 -0
  12. package/dist/extensions/orient-notebooklm.js.map +0 -0
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/integrations/notebooklm/bridge.d.ts +0 -0
  17. package/dist/integrations/notebooklm/bridge.js +0 -0
  18. package/dist/integrations/notebooklm/bridge.js.map +0 -0
  19. package/dist/integrations/notebooklm/notebooklm-extension.d.ts +1 -1
  20. package/dist/integrations/notebooklm/notebooklm-extension.js +1 -1
  21. package/dist/integrations/notebooklm/notebooklm-extension.js.map +1 -1
  22. package/dist/orient/artifact-graph.d.ts +0 -0
  23. package/dist/orient/artifact-graph.js +0 -0
  24. package/dist/orient/artifact-graph.js.map +0 -0
  25. package/dist/orient/change-packet.d.ts +2 -1
  26. package/dist/orient/change-packet.js +25 -8
  27. package/dist/orient/change-packet.js.map +1 -1
  28. package/dist/orient/clarify.d.ts +114 -0
  29. package/dist/orient/clarify.js +186 -0
  30. package/dist/orient/clarify.js.map +1 -0
  31. package/dist/orient/clear-command.d.ts +79 -0
  32. package/dist/orient/clear-command.js +117 -0
  33. package/dist/orient/clear-command.js.map +1 -0
  34. package/dist/orient/mode.d.ts +70 -0
  35. package/dist/orient/mode.js +124 -0
  36. package/dist/orient/mode.js.map +1 -0
  37. package/dist/orient/orient-extension.d.ts +1 -1
  38. package/dist/orient/orient-extension.js +306 -17
  39. package/dist/orient/orient-extension.js.map +1 -1
  40. package/dist/orient/phases.d.ts +0 -0
  41. package/dist/orient/phases.js +0 -0
  42. package/dist/orient/phases.js.map +0 -0
  43. package/dist/orient/plan-execute.d.ts +137 -0
  44. package/dist/orient/plan-execute.js +333 -0
  45. package/dist/orient/plan-execute.js.map +1 -0
  46. package/dist/orient/state-machine.d.ts +0 -0
  47. package/dist/orient/state-machine.js +0 -0
  48. package/dist/orient/state-machine.js.map +0 -0
  49. package/dist/orient/tiers.d.ts +109 -0
  50. package/dist/orient/tiers.js +162 -0
  51. package/dist/orient/tiers.js.map +1 -0
  52. package/dist/orient/types.d.ts +0 -0
  53. package/dist/orient/types.js +0 -0
  54. package/dist/orient/types.js.map +0 -0
  55. package/dist/orient/wizard.d.ts +108 -0
  56. package/dist/orient/wizard.js +183 -0
  57. package/dist/orient/wizard.js.map +1 -0
  58. package/dist/package-paths.d.ts +0 -0
  59. package/dist/package-paths.js +0 -0
  60. package/dist/package-paths.js.map +0 -0
  61. package/docs/architecture.md +0 -0
  62. package/docs/artifacts.md +0 -0
  63. package/docs/commands.md +0 -0
  64. package/docs/configuration.md +0 -0
  65. package/docs/getting-started.md +0 -0
  66. package/docs/open-source-resources.md +1 -1
  67. package/docs/phases.md +0 -0
  68. package/docs/research-integration.md +0 -0
  69. package/docs/workflows.md +0 -0
  70. package/node_modules/@orient-cli/agent-core/README.md +456 -0
  71. package/node_modules/@orient-cli/agent-core/dist/agent-loop.d.ts +24 -0
  72. package/node_modules/@orient-cli/agent-core/dist/agent-loop.d.ts.map +1 -0
  73. package/node_modules/@orient-cli/agent-core/dist/agent-loop.js +404 -0
  74. package/node_modules/@orient-cli/agent-core/dist/agent-loop.js.map +1 -0
  75. package/node_modules/@orient-cli/agent-core/dist/agent.d.ts +115 -0
  76. package/node_modules/@orient-cli/agent-core/dist/agent.d.ts.map +1 -0
  77. package/node_modules/@orient-cli/agent-core/dist/agent.js +395 -0
  78. package/node_modules/@orient-cli/agent-core/dist/agent.js.map +1 -0
  79. package/node_modules/@orient-cli/agent-core/dist/index.d.ts +5 -0
  80. package/node_modules/@orient-cli/agent-core/dist/index.d.ts.map +1 -0
  81. package/node_modules/@orient-cli/agent-core/dist/index.js +9 -0
  82. package/node_modules/@orient-cli/agent-core/dist/index.js.map +1 -0
  83. package/node_modules/@orient-cli/agent-core/dist/proxy.d.ts +85 -0
  84. package/node_modules/@orient-cli/agent-core/dist/proxy.d.ts.map +1 -0
  85. package/node_modules/@orient-cli/agent-core/dist/proxy.js +268 -0
  86. package/node_modules/@orient-cli/agent-core/dist/proxy.js.map +1 -0
  87. package/node_modules/@orient-cli/agent-core/dist/types.d.ts +323 -0
  88. package/node_modules/@orient-cli/agent-core/dist/types.d.ts.map +1 -0
  89. package/node_modules/@orient-cli/agent-core/dist/types.js +2 -0
  90. package/node_modules/@orient-cli/agent-core/dist/types.js.map +1 -0
  91. package/node_modules/@orient-cli/agent-core/package.json +44 -0
  92. package/node_modules/@orient-cli/ai/README.md +1315 -0
  93. package/node_modules/@orient-cli/ai/dist/api-registry.d.ts +20 -0
  94. package/node_modules/@orient-cli/ai/dist/api-registry.d.ts.map +1 -0
  95. package/node_modules/@orient-cli/ai/dist/api-registry.js +44 -0
  96. package/node_modules/@orient-cli/ai/dist/api-registry.js.map +1 -0
  97. package/node_modules/@orient-cli/ai/dist/bedrock-provider.d.ts +5 -0
  98. package/node_modules/@orient-cli/ai/dist/bedrock-provider.d.ts.map +1 -0
  99. package/node_modules/@orient-cli/ai/dist/bedrock-provider.js +6 -0
  100. package/node_modules/@orient-cli/ai/dist/bedrock-provider.js.map +1 -0
  101. package/node_modules/@orient-cli/ai/dist/cli.d.ts +3 -0
  102. package/node_modules/@orient-cli/ai/dist/cli.d.ts.map +1 -0
  103. package/node_modules/@orient-cli/ai/dist/cli.js +116 -0
  104. package/node_modules/@orient-cli/ai/dist/cli.js.map +1 -0
  105. package/node_modules/@orient-cli/ai/dist/env-api-keys.d.ts +9 -0
  106. package/node_modules/@orient-cli/ai/dist/env-api-keys.d.ts.map +1 -0
  107. package/node_modules/@orient-cli/ai/dist/env-api-keys.js +107 -0
  108. package/node_modules/@orient-cli/ai/dist/env-api-keys.js.map +1 -0
  109. package/node_modules/@orient-cli/ai/dist/index.d.ts +26 -0
  110. package/node_modules/@orient-cli/ai/dist/index.d.ts.map +1 -0
  111. package/node_modules/@orient-cli/ai/dist/index.js +14 -0
  112. package/node_modules/@orient-cli/ai/dist/index.js.map +1 -0
  113. package/node_modules/@orient-cli/ai/dist/models.d.ts +24 -0
  114. package/node_modules/@orient-cli/ai/dist/models.d.ts.map +1 -0
  115. package/node_modules/@orient-cli/ai/dist/models.generated.d.ts +14473 -0
  116. package/node_modules/@orient-cli/ai/dist/models.generated.d.ts.map +1 -0
  117. package/node_modules/@orient-cli/ai/dist/models.generated.js +14241 -0
  118. package/node_modules/@orient-cli/ai/dist/models.generated.js.map +1 -0
  119. package/node_modules/@orient-cli/ai/dist/models.js +55 -0
  120. package/node_modules/@orient-cli/ai/dist/models.js.map +1 -0
  121. package/node_modules/@orient-cli/ai/dist/oauth.d.ts +2 -0
  122. package/node_modules/@orient-cli/ai/dist/oauth.d.ts.map +1 -0
  123. package/node_modules/@orient-cli/ai/dist/oauth.js +2 -0
  124. package/node_modules/@orient-cli/ai/dist/oauth.js.map +1 -0
  125. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.d.ts +20 -0
  126. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.d.ts.map +1 -0
  127. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.js +651 -0
  128. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.js.map +1 -0
  129. package/node_modules/@orient-cli/ai/dist/providers/anthropic.d.ts +40 -0
  130. package/node_modules/@orient-cli/ai/dist/providers/anthropic.d.ts.map +1 -0
  131. package/node_modules/@orient-cli/ai/dist/providers/anthropic.js +749 -0
  132. package/node_modules/@orient-cli/ai/dist/providers/anthropic.js.map +1 -0
  133. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.d.ts +15 -0
  134. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.d.ts.map +1 -0
  135. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.js +176 -0
  136. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.js.map +1 -0
  137. package/node_modules/@orient-cli/ai/dist/providers/faux.d.ts +56 -0
  138. package/node_modules/@orient-cli/ai/dist/providers/faux.d.ts.map +1 -0
  139. package/node_modules/@orient-cli/ai/dist/providers/faux.js +367 -0
  140. package/node_modules/@orient-cli/ai/dist/providers/faux.js.map +1 -0
  141. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.d.ts +8 -0
  142. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.d.ts.map +1 -0
  143. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.js +29 -0
  144. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.js.map +1 -0
  145. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.d.ts +74 -0
  146. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.d.ts.map +1 -0
  147. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.js +776 -0
  148. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.js.map +1 -0
  149. package/node_modules/@orient-cli/ai/dist/providers/google-shared.d.ts +65 -0
  150. package/node_modules/@orient-cli/ai/dist/providers/google-shared.d.ts.map +1 -0
  151. package/node_modules/@orient-cli/ai/dist/providers/google-shared.js +312 -0
  152. package/node_modules/@orient-cli/ai/dist/providers/google-shared.js.map +1 -0
  153. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.d.ts +15 -0
  154. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.d.ts.map +1 -0
  155. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.js +419 -0
  156. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.js.map +1 -0
  157. package/node_modules/@orient-cli/ai/dist/providers/google.d.ts +13 -0
  158. package/node_modules/@orient-cli/ai/dist/providers/google.d.ts.map +1 -0
  159. package/node_modules/@orient-cli/ai/dist/providers/google.js +399 -0
  160. package/node_modules/@orient-cli/ai/dist/providers/google.js.map +1 -0
  161. package/node_modules/@orient-cli/ai/dist/providers/mistral.d.ts +22 -0
  162. package/node_modules/@orient-cli/ai/dist/providers/mistral.d.ts.map +1 -0
  163. package/node_modules/@orient-cli/ai/dist/providers/mistral.js +501 -0
  164. package/node_modules/@orient-cli/ai/dist/providers/mistral.js.map +1 -0
  165. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.d.ts +9 -0
  166. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.d.ts.map +1 -0
  167. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.js +741 -0
  168. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.js.map +1 -0
  169. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.d.ts +15 -0
  170. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.d.ts.map +1 -0
  171. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.js +753 -0
  172. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.js.map +1 -0
  173. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.d.ts +17 -0
  174. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.d.ts.map +1 -0
  175. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.js +470 -0
  176. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.js.map +1 -0
  177. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.d.ts +13 -0
  178. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.d.ts.map +1 -0
  179. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.js +190 -0
  180. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.js.map +1 -0
  181. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.d.ts +38 -0
  182. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.d.ts.map +1 -0
  183. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.js +261 -0
  184. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.js.map +1 -0
  185. package/node_modules/@orient-cli/ai/dist/providers/simple-options.d.ts +8 -0
  186. package/node_modules/@orient-cli/ai/dist/providers/simple-options.d.ts.map +1 -0
  187. package/node_modules/@orient-cli/ai/dist/providers/simple-options.js +35 -0
  188. package/node_modules/@orient-cli/ai/dist/providers/simple-options.js.map +1 -0
  189. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.d.ts +8 -0
  190. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.d.ts.map +1 -0
  191. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.js +155 -0
  192. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.js.map +1 -0
  193. package/node_modules/@orient-cli/ai/dist/stream.d.ts +8 -0
  194. package/node_modules/@orient-cli/ai/dist/stream.d.ts.map +1 -0
  195. package/node_modules/@orient-cli/ai/dist/stream.js +27 -0
  196. package/node_modules/@orient-cli/ai/dist/stream.js.map +1 -0
  197. package/node_modules/@orient-cli/ai/dist/types.d.ts +353 -0
  198. package/node_modules/@orient-cli/ai/dist/types.d.ts.map +1 -0
  199. package/node_modules/@orient-cli/ai/dist/types.js +2 -0
  200. package/node_modules/@orient-cli/ai/dist/types.js.map +1 -0
  201. package/node_modules/@orient-cli/ai/dist/utils/event-stream.d.ts +21 -0
  202. package/node_modules/@orient-cli/ai/dist/utils/event-stream.d.ts.map +1 -0
  203. package/node_modules/@orient-cli/ai/dist/utils/event-stream.js +81 -0
  204. package/node_modules/@orient-cli/ai/dist/utils/event-stream.js.map +1 -0
  205. package/node_modules/@orient-cli/ai/dist/utils/hash.d.ts +3 -0
  206. package/node_modules/@orient-cli/ai/dist/utils/hash.d.ts.map +1 -0
  207. package/node_modules/@orient-cli/ai/dist/utils/hash.js +14 -0
  208. package/node_modules/@orient-cli/ai/dist/utils/hash.js.map +1 -0
  209. package/node_modules/@orient-cli/ai/dist/utils/json-parse.d.ts +9 -0
  210. package/node_modules/@orient-cli/ai/dist/utils/json-parse.d.ts.map +1 -0
  211. package/node_modules/@orient-cli/ai/dist/utils/json-parse.js +29 -0
  212. package/node_modules/@orient-cli/ai/dist/utils/json-parse.js.map +1 -0
  213. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.d.ts +25 -0
  214. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.d.ts.map +1 -0
  215. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.js +335 -0
  216. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.js.map +1 -0
  217. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.d.ts +30 -0
  218. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.d.ts.map +1 -0
  219. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.js +292 -0
  220. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.js.map +1 -0
  221. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.d.ts +26 -0
  222. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -0
  223. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.js +376 -0
  224. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.js.map +1 -0
  225. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.d.ts +26 -0
  226. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -0
  227. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.js +481 -0
  228. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.js.map +1 -0
  229. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.d.ts +61 -0
  230. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.d.ts.map +1 -0
  231. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.js +131 -0
  232. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.js.map +1 -0
  233. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.d.ts +3 -0
  234. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.d.ts.map +1 -0
  235. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.js +105 -0
  236. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.js.map +1 -0
  237. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.d.ts +34 -0
  238. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.d.ts.map +1 -0
  239. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.js +373 -0
  240. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.js.map +1 -0
  241. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.d.ts +13 -0
  242. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.d.ts.map +1 -0
  243. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.js +31 -0
  244. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.js.map +1 -0
  245. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.d.ts +47 -0
  246. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.d.ts.map +1 -0
  247. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.js +2 -0
  248. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.js.map +1 -0
  249. package/node_modules/@orient-cli/ai/dist/utils/overflow.d.ts +53 -0
  250. package/node_modules/@orient-cli/ai/dist/utils/overflow.d.ts.map +1 -0
  251. package/node_modules/@orient-cli/ai/dist/utils/overflow.js +132 -0
  252. package/node_modules/@orient-cli/ai/dist/utils/overflow.js.map +1 -0
  253. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.d.ts +22 -0
  254. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.d.ts.map +1 -0
  255. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.js +26 -0
  256. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.js.map +1 -0
  257. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.d.ts +17 -0
  258. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.d.ts.map +1 -0
  259. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.js +21 -0
  260. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.js.map +1 -0
  261. package/node_modules/@orient-cli/ai/dist/utils/validation.d.ts +18 -0
  262. package/node_modules/@orient-cli/ai/dist/utils/validation.d.ts.map +1 -0
  263. package/node_modules/@orient-cli/ai/dist/utils/validation.js +80 -0
  264. package/node_modules/@orient-cli/ai/dist/utils/validation.js.map +1 -0
  265. package/node_modules/@orient-cli/ai/package.json +114 -0
  266. package/node_modules/@orient-cli/coding-agent/README.md +618 -0
  267. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.d.ts +3 -0
  268. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.d.ts.map +1 -0
  269. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.js +7 -0
  270. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.js.map +1 -0
  271. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.d.ts +2 -0
  272. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.d.ts.map +1 -0
  273. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.js +4 -0
  274. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.js.map +1 -0
  275. package/node_modules/@orient-cli/coding-agent/dist/cli/args.d.ts +52 -0
  276. package/node_modules/@orient-cli/coding-agent/dist/cli/args.d.ts.map +1 -0
  277. package/node_modules/@orient-cli/coding-agent/dist/cli/args.js +326 -0
  278. package/node_modules/@orient-cli/coding-agent/dist/cli/args.js.map +1 -0
  279. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.d.ts +14 -0
  280. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.d.ts.map +1 -0
  281. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.js +31 -0
  282. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.js.map +1 -0
  283. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.d.ts +15 -0
  284. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.d.ts.map +1 -0
  285. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.js +83 -0
  286. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.js.map +1 -0
  287. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.d.ts +18 -0
  288. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.d.ts.map +1 -0
  289. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.js +22 -0
  290. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.js.map +1 -0
  291. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.d.ts +9 -0
  292. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.d.ts.map +1 -0
  293. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.js +92 -0
  294. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.js.map +1 -0
  295. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.d.ts +9 -0
  296. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.d.ts.map +1 -0
  297. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.js +35 -0
  298. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.js.map +1 -0
  299. package/node_modules/@orient-cli/coding-agent/dist/cli.d.ts +3 -0
  300. package/node_modules/@orient-cli/coding-agent/dist/cli.d.ts.map +1 -0
  301. package/node_modules/@orient-cli/coding-agent/dist/cli.js +15 -0
  302. package/node_modules/@orient-cli/coding-agent/dist/cli.js.map +1 -0
  303. package/node_modules/@orient-cli/coding-agent/dist/config.d.ts +77 -0
  304. package/node_modules/@orient-cli/coding-agent/dist/config.d.ts.map +1 -0
  305. package/node_modules/@orient-cli/coding-agent/dist/config.js +229 -0
  306. package/node_modules/@orient-cli/coding-agent/dist/config.js.map +1 -0
  307. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.d.ts +83 -0
  308. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.d.ts.map +1 -0
  309. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.js +236 -0
  310. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.js.map +1 -0
  311. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.d.ts +86 -0
  312. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.d.ts.map +1 -0
  313. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.js +116 -0
  314. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.js.map +1 -0
  315. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.d.ts +585 -0
  316. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.d.ts.map +1 -0
  317. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.js +2497 -0
  318. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.js.map +1 -0
  319. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.d.ts +132 -0
  320. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.d.ts.map +1 -0
  321. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.js +422 -0
  322. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.js.map +1 -0
  323. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.d.ts +46 -0
  324. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.d.ts.map +1 -0
  325. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.js +125 -0
  326. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.js.map +1 -0
  327. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.d.ts +88 -0
  328. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -0
  329. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.js +243 -0
  330. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.js.map +1 -0
  331. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.d.ts +121 -0
  332. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.d.ts.map +1 -0
  333. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.js +613 -0
  334. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.js.map +1 -0
  335. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.d.ts +7 -0
  336. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.d.ts.map +1 -0
  337. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.js +7 -0
  338. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.js.map +1 -0
  339. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.d.ts +38 -0
  340. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.d.ts.map +1 -0
  341. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.js +153 -0
  342. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.js.map +1 -0
  343. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.d.ts +3 -0
  344. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.d.ts.map +1 -0
  345. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.js +2 -0
  346. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.js.map +1 -0
  347. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.d.ts +15 -0
  348. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.d.ts.map +1 -0
  349. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.js +2 -0
  350. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.js.map +1 -0
  351. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.d.ts +9 -0
  352. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.d.ts.map +1 -0
  353. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.js +25 -0
  354. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.js.map +1 -0
  355. package/node_modules/@orient-cli/coding-agent/dist/core/exec.d.ts +29 -0
  356. package/node_modules/@orient-cli/coding-agent/dist/core/exec.d.ts.map +1 -0
  357. package/node_modules/@orient-cli/coding-agent/dist/core/exec.js +75 -0
  358. package/node_modules/@orient-cli/coding-agent/dist/core/exec.js.map +1 -0
  359. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.d.ts +22 -0
  360. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
  361. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.js +249 -0
  362. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -0
  363. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.d.ts +37 -0
  364. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.d.ts.map +1 -0
  365. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.js +224 -0
  366. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.js.map +1 -0
  367. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/template.css +1001 -0
  368. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/template.html +55 -0
  369. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/template.js +1690 -0
  370. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.d.ts +40 -0
  371. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.d.ts.map +1 -0
  372. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.js +95 -0
  373. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.js.map +1 -0
  374. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/vendor/highlight.min.js +1213 -0
  375. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/vendor/marked.min.js +6 -0
  376. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.d.ts +12 -0
  377. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.d.ts.map +1 -0
  378. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.js +9 -0
  379. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.js.map +1 -0
  380. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.d.ts +25 -0
  381. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.d.ts.map +1 -0
  382. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.js +438 -0
  383. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.js.map +1 -0
  384. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.d.ts +148 -0
  385. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.d.ts.map +1 -0
  386. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.js +700 -0
  387. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.js.map +1 -0
  388. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.d.ts +1073 -0
  389. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.d.ts.map +1 -0
  390. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.js +45 -0
  391. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.js.map +1 -0
  392. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.d.ts +20 -0
  393. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.d.ts.map +1 -0
  394. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.js +22 -0
  395. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.js.map +1 -0
  396. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.d.ts +48 -0
  397. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.d.ts.map +1 -0
  398. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.js +314 -0
  399. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.js.map +1 -0
  400. package/node_modules/@orient-cli/coding-agent/dist/core/index.d.ts +12 -0
  401. package/node_modules/@orient-cli/coding-agent/dist/core/index.d.ts.map +1 -0
  402. package/node_modules/@orient-cli/coding-agent/dist/core/index.js +12 -0
  403. package/node_modules/@orient-cli/coding-agent/dist/core/index.js.map +1 -0
  404. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.d.ts +288 -0
  405. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.d.ts.map +1 -0
  406. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.js +240 -0
  407. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.js.map +1 -0
  408. package/node_modules/@orient-cli/coding-agent/dist/core/messages.d.ts +77 -0
  409. package/node_modules/@orient-cli/coding-agent/dist/core/messages.d.ts.map +1 -0
  410. package/node_modules/@orient-cli/coding-agent/dist/core/messages.js +123 -0
  411. package/node_modules/@orient-cli/coding-agent/dist/core/messages.js.map +1 -0
  412. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.d.ts +132 -0
  413. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.d.ts.map +1 -0
  414. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.js +612 -0
  415. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.js.map +1 -0
  416. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.d.ts +110 -0
  417. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.d.ts.map +1 -0
  418. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.js +486 -0
  419. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.js.map +1 -0
  420. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.d.ts +6 -0
  421. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.d.ts.map +1 -0
  422. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.js +59 -0
  423. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.js.map +1 -0
  424. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.d.ts +192 -0
  425. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.d.ts.map +1 -0
  426. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.js +1829 -0
  427. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.js.map +1 -0
  428. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.d.ts +51 -0
  429. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.d.ts.map +1 -0
  430. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.js +249 -0
  431. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.js.map +1 -0
  432. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.d.ts +23 -0
  433. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.d.ts.map +1 -0
  434. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.js +126 -0
  435. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.js.map +1 -0
  436. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.d.ts +185 -0
  437. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.d.ts.map +1 -0
  438. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.js +720 -0
  439. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.js.map +1 -0
  440. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.d.ts +93 -0
  441. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.d.ts.map +1 -0
  442. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.js +236 -0
  443. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.js.map +1 -0
  444. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.d.ts +19 -0
  445. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.d.ts.map +1 -0
  446. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.js +38 -0
  447. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.js.map +1 -0
  448. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.d.ts +333 -0
  449. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.d.ts.map +1 -0
  450. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.js +1105 -0
  451. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.js.map +1 -0
  452. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.d.ts +237 -0
  453. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.d.ts.map +1 -0
  454. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.js +708 -0
  455. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.js.map +1 -0
  456. package/node_modules/@orient-cli/coding-agent/dist/core/skills.d.ts +60 -0
  457. package/node_modules/@orient-cli/coding-agent/dist/core/skills.d.ts.map +1 -0
  458. package/node_modules/@orient-cli/coding-agent/dist/core/skills.js +409 -0
  459. package/node_modules/@orient-cli/coding-agent/dist/core/skills.js.map +1 -0
  460. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.d.ts +14 -0
  461. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.d.ts.map +1 -0
  462. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.js +23 -0
  463. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.js.map +1 -0
  464. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.d.ts +18 -0
  465. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.d.ts.map +1 -0
  466. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.js +19 -0
  467. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.js.map +1 -0
  468. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.d.ts +28 -0
  469. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.d.ts.map +1 -0
  470. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.js +116 -0
  471. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.js.map +1 -0
  472. package/node_modules/@orient-cli/coding-agent/dist/core/timings.d.ts +8 -0
  473. package/node_modules/@orient-cli/coding-agent/dist/core/timings.d.ts.map +1 -0
  474. package/node_modules/@orient-cli/coding-agent/dist/core/timings.js +31 -0
  475. package/node_modules/@orient-cli/coding-agent/dist/core/timings.js.map +1 -0
  476. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.d.ts +73 -0
  477. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.d.ts.map +1 -0
  478. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.js +352 -0
  479. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.js.map +1 -0
  480. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.d.ts +85 -0
  481. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.d.ts.map +1 -0
  482. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.js +337 -0
  483. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.js.map +1 -0
  484. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.d.ts +53 -0
  485. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.d.ts.map +1 -0
  486. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.js +196 -0
  487. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.js.map +1 -0
  488. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.d.ts +6 -0
  489. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
  490. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.js +37 -0
  491. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.js.map +1 -0
  492. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.d.ts +46 -0
  493. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.d.ts.map +1 -0
  494. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.js +258 -0
  495. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.js.map +1 -0
  496. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.d.ts +56 -0
  497. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.d.ts.map +1 -0
  498. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.js +293 -0
  499. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.js.map +1 -0
  500. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.d.ts +115 -0
  501. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.d.ts.map +1 -0
  502. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.js +86 -0
  503. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.js.map +1 -0
  504. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.d.ts +46 -0
  505. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.d.ts.map +1 -0
  506. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.js +172 -0
  507. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.js.map +1 -0
  508. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.d.ts +8 -0
  509. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.d.ts.map +1 -0
  510. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.js +81 -0
  511. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.js.map +1 -0
  512. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.d.ts +46 -0
  513. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.d.ts.map +1 -0
  514. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.js +225 -0
  515. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.js.map +1 -0
  516. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.d.ts +21 -0
  517. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.d.ts.map +1 -0
  518. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.js +49 -0
  519. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.js.map +1 -0
  520. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
  521. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
  522. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.js +32 -0
  523. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.js.map +1 -0
  524. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.d.ts +70 -0
  525. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.d.ts.map +1 -0
  526. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.js +205 -0
  527. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.js.map +1 -0
  528. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.d.ts +35 -0
  529. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.d.ts.map +1 -0
  530. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.js +216 -0
  531. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.js.map +1 -0
  532. package/node_modules/@orient-cli/coding-agent/dist/index.d.ts +28 -0
  533. package/node_modules/@orient-cli/coding-agent/dist/index.d.ts.map +1 -0
  534. package/node_modules/@orient-cli/coding-agent/dist/index.js +43 -0
  535. package/node_modules/@orient-cli/coding-agent/dist/index.js.map +1 -0
  536. package/node_modules/@orient-cli/coding-agent/dist/main.d.ts +8 -0
  537. package/node_modules/@orient-cli/coding-agent/dist/main.d.ts.map +1 -0
  538. package/node_modules/@orient-cli/coding-agent/dist/main.js +593 -0
  539. package/node_modules/@orient-cli/coding-agent/dist/main.js.map +1 -0
  540. package/node_modules/@orient-cli/coding-agent/dist/migrations.d.ts +33 -0
  541. package/node_modules/@orient-cli/coding-agent/dist/migrations.d.ts.map +1 -0
  542. package/node_modules/@orient-cli/coding-agent/dist/migrations.js +281 -0
  543. package/node_modules/@orient-cli/coding-agent/dist/migrations.js.map +1 -0
  544. package/node_modules/@orient-cli/coding-agent/dist/modes/index.d.ts +9 -0
  545. package/node_modules/@orient-cli/coding-agent/dist/modes/index.d.ts.map +1 -0
  546. package/node_modules/@orient-cli/coding-agent/dist/modes/index.js +8 -0
  547. package/node_modules/@orient-cli/coding-agent/dist/modes/index.js.map +1 -0
  548. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.d.ts +18 -0
  549. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
  550. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.js +107 -0
  551. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -0
  552. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.d.ts +34 -0
  553. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
  554. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.js +175 -0
  555. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -0
  556. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
  557. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
  558. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.js +51 -0
  559. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.js.map +1 -0
  560. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
  561. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
  562. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.js +44 -0
  563. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
  564. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
  565. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
  566. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.js +45 -0
  567. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
  568. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.d.ts +71 -0
  569. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
  570. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.js +479 -0
  571. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.js.map +1 -0
  572. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
  573. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
  574. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.js +33 -0
  575. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.js.map +1 -0
  576. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.d.ts +21 -0
  577. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
  578. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.js +70 -0
  579. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.js.map +1 -0
  580. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.d.ts +20 -0
  581. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
  582. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.js +79 -0
  583. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.js.map +1 -0
  584. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.d.ts +12 -0
  585. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.d.ts.map +1 -0
  586. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.js +133 -0
  587. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.js.map +1 -0
  588. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
  589. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
  590. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.js +21 -0
  591. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -0
  592. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.d.ts +20 -0
  593. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
  594. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.js +111 -0
  595. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.js.map +1 -0
  596. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.d.ts +23 -0
  597. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
  598. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.js +61 -0
  599. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.js.map +1 -0
  600. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.d.ts +24 -0
  601. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
  602. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.js +78 -0
  603. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.js.map +1 -0
  604. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.d.ts +27 -0
  605. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -0
  606. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.js +201 -0
  607. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.js.map +1 -0
  608. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.d.ts +31 -0
  609. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.d.ts.map +1 -0
  610. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.js +34 -0
  611. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.js.map +1 -0
  612. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts +8 -0
  613. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
  614. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.js +22 -0
  615. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
  616. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.d.ts +42 -0
  617. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
  618. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.js +145 -0
  619. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.js.map +1 -0
  620. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.d.ts +47 -0
  621. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
  622. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.js +275 -0
  623. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -0
  624. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.d.ts +19 -0
  625. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
  626. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.js +97 -0
  627. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.js.map +1 -0
  628. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.d.ts +53 -0
  629. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.d.ts.map +1 -0
  630. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.js +204 -0
  631. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.js.map +1 -0
  632. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts +49 -0
  633. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
  634. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.js +275 -0
  635. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
  636. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
  637. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
  638. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.js +155 -0
  639. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -0
  640. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.d.ts +95 -0
  641. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
  642. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.js +848 -0
  643. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -0
  644. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.d.ts +58 -0
  645. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
  646. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.js +301 -0
  647. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -0
  648. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
  649. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
  650. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.js +39 -0
  651. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.js.map +1 -0
  652. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
  653. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
  654. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.js +47 -0
  655. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
  656. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.d.ts +11 -0
  657. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
  658. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.js +50 -0
  659. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.js.map +1 -0
  660. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
  661. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
  662. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.js +51 -0
  663. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.js.map +1 -0
  664. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.d.ts +58 -0
  665. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
  666. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.js +274 -0
  667. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -0
  668. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.d.ts +89 -0
  669. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
  670. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.js +1084 -0
  671. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.js.map +1 -0
  672. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
  673. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
  674. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.js +113 -0
  675. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.js.map +1 -0
  676. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.d.ts +9 -0
  677. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -0
  678. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.js +28 -0
  679. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.js.map +1 -0
  680. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
  681. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
  682. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.js +33 -0
  683. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.js.map +1 -0
  684. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.d.ts +321 -0
  685. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
  686. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js +4000 -0
  687. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -0
  688. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/dark.json +85 -0
  689. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/light.json +84 -0
  690. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme-schema.json +335 -0
  691. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.d.ts +81 -0
  692. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  693. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.js +979 -0
  694. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.js.map +1 -0
  695. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.d.ts +28 -0
  696. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.d.ts.map +1 -0
  697. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.js +112 -0
  698. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.js.map +1 -0
  699. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.d.ts +17 -0
  700. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.d.ts.map +1 -0
  701. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.js +49 -0
  702. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.js.map +1 -0
  703. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.d.ts +217 -0
  704. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.d.ts.map +1 -0
  705. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.js +402 -0
  706. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.js.map +1 -0
  707. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.d.ts +20 -0
  708. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
  709. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.js +550 -0
  710. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -0
  711. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.d.ts +408 -0
  712. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.d.ts.map +1 -0
  713. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.js +8 -0
  714. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.js.map +1 -0
  715. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.d.ts +4 -0
  716. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.d.ts.map +1 -0
  717. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.js +234 -0
  718. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.js.map +1 -0
  719. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.d.ts +21 -0
  720. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.d.ts.map +1 -0
  721. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.js +87 -0
  722. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.js.map +1 -0
  723. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.d.ts +11 -0
  724. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.d.ts.map +1 -0
  725. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.js +78 -0
  726. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.js.map +1 -0
  727. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.d.ts +11 -0
  728. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.d.ts.map +1 -0
  729. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.js +245 -0
  730. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.js.map +1 -0
  731. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.d.ts +8 -0
  732. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.d.ts.map +1 -0
  733. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.js +14 -0
  734. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.js.map +1 -0
  735. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.d.ts +2 -0
  736. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.d.ts.map +1 -0
  737. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.js +78 -0
  738. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.js.map +1 -0
  739. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.d.ts +5 -0
  740. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.d.ts.map +1 -0
  741. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.js +158 -0
  742. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.js.map +1 -0
  743. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.d.ts +8 -0
  744. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.d.ts.map +1 -0
  745. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.js +26 -0
  746. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.js.map +1 -0
  747. package/node_modules/@orient-cli/coding-agent/dist/utils/git.d.ts +26 -0
  748. package/node_modules/@orient-cli/coding-agent/dist/utils/git.d.ts.map +1 -0
  749. package/node_modules/@orient-cli/coding-agent/dist/utils/git.js +163 -0
  750. package/node_modules/@orient-cli/coding-agent/dist/utils/git.js.map +1 -0
  751. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.d.ts +9 -0
  752. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.d.ts.map +1 -0
  753. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.js +39 -0
  754. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.js.map +1 -0
  755. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.d.ts +36 -0
  756. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.d.ts.map +1 -0
  757. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.js +137 -0
  758. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.js.map +1 -0
  759. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.d.ts +2 -0
  760. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.d.ts.map +1 -0
  761. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.js +26 -0
  762. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.js.map +1 -0
  763. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.d.ts +7 -0
  764. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.d.ts.map +1 -0
  765. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.js +19 -0
  766. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.js.map +1 -0
  767. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.d.ts +21 -0
  768. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.d.ts.map +1 -0
  769. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.js +121 -0
  770. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.js.map +1 -0
  771. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.d.ts +26 -0
  772. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.d.ts.map +1 -0
  773. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.js +186 -0
  774. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.js.map +1 -0
  775. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.d.ts +5 -0
  776. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.d.ts.map +1 -0
  777. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.js +17 -0
  778. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.js.map +1 -0
  779. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.d.ts +3 -0
  780. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.d.ts.map +1 -0
  781. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.js +252 -0
  782. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.js.map +1 -0
  783. package/node_modules/@orient-cli/coding-agent/package.json +104 -0
  784. package/node_modules/@orient-cli/tui/README.md +767 -0
  785. package/node_modules/@orient-cli/tui/dist/autocomplete.d.ts +52 -0
  786. package/node_modules/@orient-cli/tui/dist/autocomplete.d.ts.map +1 -0
  787. package/node_modules/@orient-cli/tui/dist/autocomplete.js +623 -0
  788. package/node_modules/@orient-cli/tui/dist/autocomplete.js.map +1 -0
  789. package/node_modules/@orient-cli/tui/dist/components/box.d.ts +22 -0
  790. package/node_modules/@orient-cli/tui/dist/components/box.d.ts.map +1 -0
  791. package/node_modules/@orient-cli/tui/dist/components/box.js +104 -0
  792. package/node_modules/@orient-cli/tui/dist/components/box.js.map +1 -0
  793. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.d.ts +22 -0
  794. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.d.ts.map +1 -0
  795. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.js +35 -0
  796. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.js.map +1 -0
  797. package/node_modules/@orient-cli/tui/dist/components/editor.d.ts +244 -0
  798. package/node_modules/@orient-cli/tui/dist/components/editor.d.ts.map +1 -0
  799. package/node_modules/@orient-cli/tui/dist/components/editor.js +1861 -0
  800. package/node_modules/@orient-cli/tui/dist/components/editor.js.map +1 -0
  801. package/node_modules/@orient-cli/tui/dist/components/image.d.ts +28 -0
  802. package/node_modules/@orient-cli/tui/dist/components/image.d.ts.map +1 -0
  803. package/node_modules/@orient-cli/tui/dist/components/image.js +69 -0
  804. package/node_modules/@orient-cli/tui/dist/components/image.js.map +1 -0
  805. package/node_modules/@orient-cli/tui/dist/components/input.d.ts +37 -0
  806. package/node_modules/@orient-cli/tui/dist/components/input.d.ts.map +1 -0
  807. package/node_modules/@orient-cli/tui/dist/components/input.js +426 -0
  808. package/node_modules/@orient-cli/tui/dist/components/input.js.map +1 -0
  809. package/node_modules/@orient-cli/tui/dist/components/loader.d.ts +21 -0
  810. package/node_modules/@orient-cli/tui/dist/components/loader.d.ts.map +1 -0
  811. package/node_modules/@orient-cli/tui/dist/components/loader.js +49 -0
  812. package/node_modules/@orient-cli/tui/dist/components/loader.js.map +1 -0
  813. package/node_modules/@orient-cli/tui/dist/components/markdown.d.ts +95 -0
  814. package/node_modules/@orient-cli/tui/dist/components/markdown.d.ts.map +1 -0
  815. package/node_modules/@orient-cli/tui/dist/components/markdown.js +663 -0
  816. package/node_modules/@orient-cli/tui/dist/components/markdown.js.map +1 -0
  817. package/node_modules/@orient-cli/tui/dist/components/select-list.d.ts +50 -0
  818. package/node_modules/@orient-cli/tui/dist/components/select-list.d.ts.map +1 -0
  819. package/node_modules/@orient-cli/tui/dist/components/select-list.js +159 -0
  820. package/node_modules/@orient-cli/tui/dist/components/select-list.js.map +1 -0
  821. package/node_modules/@orient-cli/tui/dist/components/settings-list.d.ts +50 -0
  822. package/node_modules/@orient-cli/tui/dist/components/settings-list.d.ts.map +1 -0
  823. package/node_modules/@orient-cli/tui/dist/components/settings-list.js +185 -0
  824. package/node_modules/@orient-cli/tui/dist/components/settings-list.js.map +1 -0
  825. package/node_modules/@orient-cli/tui/dist/components/spacer.d.ts +12 -0
  826. package/node_modules/@orient-cli/tui/dist/components/spacer.d.ts.map +1 -0
  827. package/node_modules/@orient-cli/tui/dist/components/spacer.js +23 -0
  828. package/node_modules/@orient-cli/tui/dist/components/spacer.js.map +1 -0
  829. package/node_modules/@orient-cli/tui/dist/components/text.d.ts +19 -0
  830. package/node_modules/@orient-cli/tui/dist/components/text.d.ts.map +1 -0
  831. package/node_modules/@orient-cli/tui/dist/components/text.js +89 -0
  832. package/node_modules/@orient-cli/tui/dist/components/text.js.map +1 -0
  833. package/node_modules/@orient-cli/tui/dist/components/truncated-text.d.ts +13 -0
  834. package/node_modules/@orient-cli/tui/dist/components/truncated-text.d.ts.map +1 -0
  835. package/node_modules/@orient-cli/tui/dist/components/truncated-text.js +51 -0
  836. package/node_modules/@orient-cli/tui/dist/components/truncated-text.js.map +1 -0
  837. package/node_modules/@orient-cli/tui/dist/editor-component.d.ts +39 -0
  838. package/node_modules/@orient-cli/tui/dist/editor-component.d.ts.map +1 -0
  839. package/node_modules/@orient-cli/tui/dist/editor-component.js +2 -0
  840. package/node_modules/@orient-cli/tui/dist/editor-component.js.map +1 -0
  841. package/node_modules/@orient-cli/tui/dist/fuzzy.d.ts +16 -0
  842. package/node_modules/@orient-cli/tui/dist/fuzzy.d.ts.map +1 -0
  843. package/node_modules/@orient-cli/tui/dist/fuzzy.js +107 -0
  844. package/node_modules/@orient-cli/tui/dist/fuzzy.js.map +1 -0
  845. package/node_modules/@orient-cli/tui/dist/index.d.ts +23 -0
  846. package/node_modules/@orient-cli/tui/dist/index.d.ts.map +1 -0
  847. package/node_modules/@orient-cli/tui/dist/index.js +32 -0
  848. package/node_modules/@orient-cli/tui/dist/index.js.map +1 -0
  849. package/node_modules/@orient-cli/tui/dist/keybindings.d.ts +193 -0
  850. package/node_modules/@orient-cli/tui/dist/keybindings.d.ts.map +1 -0
  851. package/node_modules/@orient-cli/tui/dist/keybindings.js +174 -0
  852. package/node_modules/@orient-cli/tui/dist/keybindings.js.map +1 -0
  853. package/node_modules/@orient-cli/tui/dist/keys.d.ts +170 -0
  854. package/node_modules/@orient-cli/tui/dist/keys.d.ts.map +1 -0
  855. package/node_modules/@orient-cli/tui/dist/keys.js +1124 -0
  856. package/node_modules/@orient-cli/tui/dist/keys.js.map +1 -0
  857. package/node_modules/@orient-cli/tui/dist/kill-ring.d.ts +28 -0
  858. package/node_modules/@orient-cli/tui/dist/kill-ring.d.ts.map +1 -0
  859. package/node_modules/@orient-cli/tui/dist/kill-ring.js +44 -0
  860. package/node_modules/@orient-cli/tui/dist/kill-ring.js.map +1 -0
  861. package/node_modules/@orient-cli/tui/dist/stdin-buffer.d.ts +48 -0
  862. package/node_modules/@orient-cli/tui/dist/stdin-buffer.d.ts.map +1 -0
  863. package/node_modules/@orient-cli/tui/dist/stdin-buffer.js +317 -0
  864. package/node_modules/@orient-cli/tui/dist/stdin-buffer.js.map +1 -0
  865. package/node_modules/@orient-cli/tui/dist/terminal-image.d.ts +68 -0
  866. package/node_modules/@orient-cli/tui/dist/terminal-image.d.ts.map +1 -0
  867. package/node_modules/@orient-cli/tui/dist/terminal-image.js +288 -0
  868. package/node_modules/@orient-cli/tui/dist/terminal-image.js.map +1 -0
  869. package/node_modules/@orient-cli/tui/dist/terminal.d.ts +84 -0
  870. package/node_modules/@orient-cli/tui/dist/terminal.d.ts.map +1 -0
  871. package/node_modules/@orient-cli/tui/dist/terminal.js +285 -0
  872. package/node_modules/@orient-cli/tui/dist/terminal.js.map +1 -0
  873. package/node_modules/@orient-cli/tui/dist/tui.d.ts +222 -0
  874. package/node_modules/@orient-cli/tui/dist/tui.d.ts.map +1 -0
  875. package/node_modules/@orient-cli/tui/dist/tui.js +1008 -0
  876. package/node_modules/@orient-cli/tui/dist/tui.js.map +1 -0
  877. package/node_modules/@orient-cli/tui/dist/undo-stack.d.ts +17 -0
  878. package/node_modules/@orient-cli/tui/dist/undo-stack.d.ts.map +1 -0
  879. package/node_modules/@orient-cli/tui/dist/undo-stack.js +25 -0
  880. package/node_modules/@orient-cli/tui/dist/undo-stack.js.map +1 -0
  881. package/node_modules/@orient-cli/tui/dist/utils.d.ts +78 -0
  882. package/node_modules/@orient-cli/tui/dist/utils.d.ts.map +1 -0
  883. package/node_modules/@orient-cli/tui/dist/utils.js +960 -0
  884. package/node_modules/@orient-cli/tui/dist/utils.js.map +1 -0
  885. package/node_modules/@orient-cli/tui/package.json +52 -0
  886. package/package.json +47 -8
  887. package/prompts/orient-blockers.md +0 -0
  888. package/prompts/orient-handoff.md +0 -0
  889. package/prompts/orient-recap.md +0 -0
  890. package/schemas/orient-full/schema.yaml +0 -0
  891. package/schemas/orient-minimal/schema.yaml +0 -0
  892. package/schemas/orient-standard/schema.yaml +0 -0
  893. package/schemas/orient-standard/templates/archive-summary.md +0 -0
  894. package/schemas/orient-standard/templates/brief.md +0 -0
  895. package/schemas/orient-standard/templates/constitution.md +0 -0
  896. package/schemas/orient-standard/templates/current-system-audit.md +0 -0
  897. package/schemas/orient-standard/templates/current-truth-sync.md +0 -0
  898. package/schemas/orient-standard/templates/decisions.md +0 -0
  899. package/schemas/orient-standard/templates/normalize-checklist.md +0 -0
  900. package/schemas/orient-standard/templates/plan.md +0 -0
  901. package/schemas/orient-standard/templates/qa-checklist.md +0 -0
  902. package/schemas/orient-standard/templates/research.md +0 -0
  903. package/schemas/orient-standard/templates/sources.md +0 -0
  904. package/schemas/orient-standard/templates/spec.md +0 -0
  905. package/schemas/orient-standard/templates/state.md +0 -0
  906. package/schemas/orient-standard/templates/tasks.md +0 -0
  907. package/schemas/orient-standard/templates/traceability-matrix.md +0 -0
  908. package/schemas/orient-standard/templates/verify.md +0 -0
  909. package/schemas/orient-standard/templates/work-log.md +0 -0
  910. package/schemas/orient-standard/templates-tier-1/brief.md +22 -0
  911. package/schemas/orient-standard/templates-tier-1/plan.md +17 -0
  912. package/schemas/orient-standard/templates-tier-1/spec.md +23 -0
  913. package/schemas/orient-standard/templates-tier-1/tasks.md +14 -0
  914. package/schemas/orient-standard/templates-tier-2/brief.md +32 -0
  915. package/schemas/orient-standard/templates-tier-2/plan.md +44 -0
  916. package/schemas/orient-standard/templates-tier-2/spec.md +46 -0
  917. package/schemas/orient-standard/templates-tier-2/tasks.md +34 -0
  918. package/schemas/orient-standard/templates-tier-3/brief.md +54 -0
  919. package/schemas/orient-standard/templates-tier-3/plan.md +67 -0
  920. package/schemas/orient-standard/templates-tier-3/spec.md +65 -0
  921. package/schemas/orient-standard/templates-tier-3/tasks.md +79 -0
  922. package/skills/orient-analyze/SKILL.md +0 -0
  923. package/skills/orient-archive/SKILL.md +0 -0
  924. package/skills/orient-clarify/SKILL.md +0 -0
  925. package/skills/orient-constitution/SKILL.md +0 -0
  926. package/skills/orient-decide/SKILL.md +0 -0
  927. package/skills/orient-execute/SKILL.md +0 -0
  928. package/skills/orient-integrate/SKILL.md +0 -0
  929. package/skills/orient-normalize/SKILL.md +0 -0
  930. package/skills/orient-orient/SKILL.md +0 -0
  931. package/skills/orient-plan/SKILL.md +0 -0
  932. package/skills/orient-research/SKILL.md +0 -0
  933. package/skills/orient-state/SKILL.md +0 -0
  934. package/skills/orient-tasks/SKILL.md +0 -0
  935. package/skills/orient-test/SKILL.md +0 -0
  936. package/skills/orient-verify/SKILL.md +0 -0
@@ -0,0 +1,395 @@
1
+ import { streamSimple, } from "@orient-cli/ai";
2
+ import { runAgentLoop, runAgentLoopContinue } from "./agent-loop.js";
3
+ function defaultConvertToLlm(messages) {
4
+ return messages.filter((message) => message.role === "user" || message.role === "assistant" || message.role === "toolResult");
5
+ }
6
+ const EMPTY_USAGE = {
7
+ input: 0,
8
+ output: 0,
9
+ cacheRead: 0,
10
+ cacheWrite: 0,
11
+ totalTokens: 0,
12
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
13
+ };
14
+ const DEFAULT_MODEL = {
15
+ id: "unknown",
16
+ name: "unknown",
17
+ api: "unknown",
18
+ provider: "unknown",
19
+ baseUrl: "",
20
+ reasoning: false,
21
+ input: [],
22
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
23
+ contextWindow: 0,
24
+ maxTokens: 0,
25
+ };
26
+ function createMutableAgentState(initialState) {
27
+ let tools = initialState?.tools?.slice() ?? [];
28
+ let messages = initialState?.messages?.slice() ?? [];
29
+ return {
30
+ systemPrompt: initialState?.systemPrompt ?? "",
31
+ model: initialState?.model ?? DEFAULT_MODEL,
32
+ thinkingLevel: initialState?.thinkingLevel ?? "off",
33
+ get tools() {
34
+ return tools;
35
+ },
36
+ set tools(nextTools) {
37
+ tools = nextTools.slice();
38
+ },
39
+ get messages() {
40
+ return messages;
41
+ },
42
+ set messages(nextMessages) {
43
+ messages = nextMessages.slice();
44
+ },
45
+ isStreaming: false,
46
+ streamingMessage: undefined,
47
+ pendingToolCalls: new Set(),
48
+ errorMessage: undefined,
49
+ };
50
+ }
51
+ class PendingMessageQueue {
52
+ mode;
53
+ messages = [];
54
+ constructor(mode) {
55
+ this.mode = mode;
56
+ }
57
+ enqueue(message) {
58
+ this.messages.push(message);
59
+ }
60
+ hasItems() {
61
+ return this.messages.length > 0;
62
+ }
63
+ drain() {
64
+ if (this.mode === "all") {
65
+ const drained = this.messages.slice();
66
+ this.messages = [];
67
+ return drained;
68
+ }
69
+ const first = this.messages[0];
70
+ if (!first) {
71
+ return [];
72
+ }
73
+ this.messages = this.messages.slice(1);
74
+ return [first];
75
+ }
76
+ clear() {
77
+ this.messages = [];
78
+ }
79
+ }
80
+ /**
81
+ * Stateful wrapper around the low-level agent loop.
82
+ *
83
+ * `Agent` owns the current transcript, emits lifecycle events, executes tools,
84
+ * and exposes queueing APIs for steering and follow-up messages.
85
+ */
86
+ export class Agent {
87
+ _state;
88
+ listeners = new Set();
89
+ steeringQueue;
90
+ followUpQueue;
91
+ convertToLlm;
92
+ transformContext;
93
+ streamFn;
94
+ getApiKey;
95
+ onPayload;
96
+ beforeToolCall;
97
+ afterToolCall;
98
+ activeRun;
99
+ /** Session identifier forwarded to providers for cache-aware backends. */
100
+ sessionId;
101
+ /** Optional per-level thinking token budgets forwarded to the stream function. */
102
+ thinkingBudgets;
103
+ /** Preferred transport forwarded to the stream function. */
104
+ transport;
105
+ /** Optional cap for provider-requested retry delays. */
106
+ maxRetryDelayMs;
107
+ /** Tool execution strategy for assistant messages that contain multiple tool calls. */
108
+ toolExecution;
109
+ constructor(options = {}) {
110
+ this._state = createMutableAgentState(options.initialState);
111
+ this.convertToLlm = options.convertToLlm ?? defaultConvertToLlm;
112
+ this.transformContext = options.transformContext;
113
+ this.streamFn = options.streamFn ?? streamSimple;
114
+ this.getApiKey = options.getApiKey;
115
+ this.onPayload = options.onPayload;
116
+ this.beforeToolCall = options.beforeToolCall;
117
+ this.afterToolCall = options.afterToolCall;
118
+ this.steeringQueue = new PendingMessageQueue(options.steeringMode ?? "one-at-a-time");
119
+ this.followUpQueue = new PendingMessageQueue(options.followUpMode ?? "one-at-a-time");
120
+ this.sessionId = options.sessionId;
121
+ this.thinkingBudgets = options.thinkingBudgets;
122
+ this.transport = options.transport ?? "sse";
123
+ this.maxRetryDelayMs = options.maxRetryDelayMs;
124
+ this.toolExecution = options.toolExecution ?? "parallel";
125
+ }
126
+ /**
127
+ * Subscribe to agent lifecycle events.
128
+ *
129
+ * Listener promises are awaited in subscription order and are included in
130
+ * the current run's settlement. Listeners also receive the active abort
131
+ * signal for the current run.
132
+ *
133
+ * `agent_end` is the final emitted event for a run, but the agent does not
134
+ * become idle until all awaited listeners for that event have settled.
135
+ */
136
+ subscribe(listener) {
137
+ this.listeners.add(listener);
138
+ return () => this.listeners.delete(listener);
139
+ }
140
+ /**
141
+ * Current agent state.
142
+ *
143
+ * Assigning `state.tools` or `state.messages` copies the provided top-level array.
144
+ */
145
+ get state() {
146
+ return this._state;
147
+ }
148
+ /** Controls how queued steering messages are drained. */
149
+ set steeringMode(mode) {
150
+ this.steeringQueue.mode = mode;
151
+ }
152
+ get steeringMode() {
153
+ return this.steeringQueue.mode;
154
+ }
155
+ /** Controls how queued follow-up messages are drained. */
156
+ set followUpMode(mode) {
157
+ this.followUpQueue.mode = mode;
158
+ }
159
+ get followUpMode() {
160
+ return this.followUpQueue.mode;
161
+ }
162
+ /** Queue a message to be injected after the current assistant turn finishes. */
163
+ steer(message) {
164
+ this.steeringQueue.enqueue(message);
165
+ }
166
+ /** Queue a message to run only after the agent would otherwise stop. */
167
+ followUp(message) {
168
+ this.followUpQueue.enqueue(message);
169
+ }
170
+ /** Remove all queued steering messages. */
171
+ clearSteeringQueue() {
172
+ this.steeringQueue.clear();
173
+ }
174
+ /** Remove all queued follow-up messages. */
175
+ clearFollowUpQueue() {
176
+ this.followUpQueue.clear();
177
+ }
178
+ /** Remove all queued steering and follow-up messages. */
179
+ clearAllQueues() {
180
+ this.clearSteeringQueue();
181
+ this.clearFollowUpQueue();
182
+ }
183
+ /** Returns true when either queue still contains pending messages. */
184
+ hasQueuedMessages() {
185
+ return this.steeringQueue.hasItems() || this.followUpQueue.hasItems();
186
+ }
187
+ /** Active abort signal for the current run, if any. */
188
+ get signal() {
189
+ return this.activeRun?.abortController.signal;
190
+ }
191
+ /** Abort the current run, if one is active. */
192
+ abort() {
193
+ this.activeRun?.abortController.abort();
194
+ }
195
+ /**
196
+ * Resolve when the current run and all awaited event listeners have finished.
197
+ *
198
+ * This resolves after `agent_end` listeners settle.
199
+ */
200
+ waitForIdle() {
201
+ return this.activeRun?.promise ?? Promise.resolve();
202
+ }
203
+ /** Clear transcript state, runtime state, and queued messages. */
204
+ reset() {
205
+ this._state.messages = [];
206
+ this._state.isStreaming = false;
207
+ this._state.streamingMessage = undefined;
208
+ this._state.pendingToolCalls = new Set();
209
+ this._state.errorMessage = undefined;
210
+ this.clearFollowUpQueue();
211
+ this.clearSteeringQueue();
212
+ }
213
+ async prompt(input, images) {
214
+ if (this.activeRun) {
215
+ throw new Error("Agent is already processing a prompt. Use steer() or followUp() to queue messages, or wait for completion.");
216
+ }
217
+ const messages = this.normalizePromptInput(input, images);
218
+ await this.runPromptMessages(messages);
219
+ }
220
+ /** Continue from the current transcript. The last message must be a user or tool-result message. */
221
+ async continue() {
222
+ if (this.activeRun) {
223
+ throw new Error("Agent is already processing. Wait for completion before continuing.");
224
+ }
225
+ const lastMessage = this._state.messages[this._state.messages.length - 1];
226
+ if (!lastMessage) {
227
+ throw new Error("No messages to continue from");
228
+ }
229
+ if (lastMessage.role === "assistant") {
230
+ const queuedSteering = this.steeringQueue.drain();
231
+ if (queuedSteering.length > 0) {
232
+ await this.runPromptMessages(queuedSteering, { skipInitialSteeringPoll: true });
233
+ return;
234
+ }
235
+ const queuedFollowUps = this.followUpQueue.drain();
236
+ if (queuedFollowUps.length > 0) {
237
+ await this.runPromptMessages(queuedFollowUps);
238
+ return;
239
+ }
240
+ throw new Error("Cannot continue from message role: assistant");
241
+ }
242
+ await this.runContinuation();
243
+ }
244
+ normalizePromptInput(input, images) {
245
+ if (Array.isArray(input)) {
246
+ return input;
247
+ }
248
+ if (typeof input !== "string") {
249
+ return [input];
250
+ }
251
+ const content = [{ type: "text", text: input }];
252
+ if (images && images.length > 0) {
253
+ content.push(...images);
254
+ }
255
+ return [{ role: "user", content, timestamp: Date.now() }];
256
+ }
257
+ async runPromptMessages(messages, options = {}) {
258
+ await this.runWithLifecycle(async (signal) => {
259
+ await runAgentLoop(messages, this.createContextSnapshot(), this.createLoopConfig(options), (event) => this.processEvents(event), signal, this.streamFn);
260
+ });
261
+ }
262
+ async runContinuation() {
263
+ await this.runWithLifecycle(async (signal) => {
264
+ await runAgentLoopContinue(this.createContextSnapshot(), this.createLoopConfig(), (event) => this.processEvents(event), signal, this.streamFn);
265
+ });
266
+ }
267
+ createContextSnapshot() {
268
+ return {
269
+ systemPrompt: this._state.systemPrompt,
270
+ messages: this._state.messages.slice(),
271
+ tools: this._state.tools.slice(),
272
+ };
273
+ }
274
+ createLoopConfig(options = {}) {
275
+ let skipInitialSteeringPoll = options.skipInitialSteeringPoll === true;
276
+ return {
277
+ model: this._state.model,
278
+ reasoning: this._state.thinkingLevel === "off" ? undefined : this._state.thinkingLevel,
279
+ sessionId: this.sessionId,
280
+ onPayload: this.onPayload,
281
+ transport: this.transport,
282
+ thinkingBudgets: this.thinkingBudgets,
283
+ maxRetryDelayMs: this.maxRetryDelayMs,
284
+ toolExecution: this.toolExecution,
285
+ beforeToolCall: this.beforeToolCall,
286
+ afterToolCall: this.afterToolCall,
287
+ convertToLlm: this.convertToLlm,
288
+ transformContext: this.transformContext,
289
+ getApiKey: this.getApiKey,
290
+ getSteeringMessages: async () => {
291
+ if (skipInitialSteeringPoll) {
292
+ skipInitialSteeringPoll = false;
293
+ return [];
294
+ }
295
+ return this.steeringQueue.drain();
296
+ },
297
+ getFollowUpMessages: async () => this.followUpQueue.drain(),
298
+ };
299
+ }
300
+ async runWithLifecycle(executor) {
301
+ if (this.activeRun) {
302
+ throw new Error("Agent is already processing.");
303
+ }
304
+ const abortController = new AbortController();
305
+ let resolvePromise = () => { };
306
+ const promise = new Promise((resolve) => {
307
+ resolvePromise = resolve;
308
+ });
309
+ this.activeRun = { promise, resolve: resolvePromise, abortController };
310
+ this._state.isStreaming = true;
311
+ this._state.streamingMessage = undefined;
312
+ this._state.errorMessage = undefined;
313
+ try {
314
+ await executor(abortController.signal);
315
+ }
316
+ catch (error) {
317
+ await this.handleRunFailure(error, abortController.signal.aborted);
318
+ }
319
+ finally {
320
+ this.finishRun();
321
+ }
322
+ }
323
+ async handleRunFailure(error, aborted) {
324
+ const failureMessage = {
325
+ role: "assistant",
326
+ content: [{ type: "text", text: "" }],
327
+ api: this._state.model.api,
328
+ provider: this._state.model.provider,
329
+ model: this._state.model.id,
330
+ usage: EMPTY_USAGE,
331
+ stopReason: aborted ? "aborted" : "error",
332
+ errorMessage: error instanceof Error ? error.message : String(error),
333
+ timestamp: Date.now(),
334
+ };
335
+ this._state.messages.push(failureMessage);
336
+ this._state.errorMessage = failureMessage.errorMessage;
337
+ await this.processEvents({ type: "agent_end", messages: [failureMessage] });
338
+ }
339
+ finishRun() {
340
+ this._state.isStreaming = false;
341
+ this._state.streamingMessage = undefined;
342
+ this._state.pendingToolCalls = new Set();
343
+ this.activeRun?.resolve();
344
+ this.activeRun = undefined;
345
+ }
346
+ /**
347
+ * Reduce internal state for a loop event, then await listeners.
348
+ *
349
+ * `agent_end` only means no further loop events will be emitted. The run is
350
+ * considered idle later, after all awaited listeners for `agent_end` finish
351
+ * and `finishRun()` clears runtime-owned state.
352
+ */
353
+ async processEvents(event) {
354
+ switch (event.type) {
355
+ case "message_start":
356
+ this._state.streamingMessage = event.message;
357
+ break;
358
+ case "message_update":
359
+ this._state.streamingMessage = event.message;
360
+ break;
361
+ case "message_end":
362
+ this._state.streamingMessage = undefined;
363
+ this._state.messages.push(event.message);
364
+ break;
365
+ case "tool_execution_start": {
366
+ const pendingToolCalls = new Set(this._state.pendingToolCalls);
367
+ pendingToolCalls.add(event.toolCallId);
368
+ this._state.pendingToolCalls = pendingToolCalls;
369
+ break;
370
+ }
371
+ case "tool_execution_end": {
372
+ const pendingToolCalls = new Set(this._state.pendingToolCalls);
373
+ pendingToolCalls.delete(event.toolCallId);
374
+ this._state.pendingToolCalls = pendingToolCalls;
375
+ break;
376
+ }
377
+ case "turn_end":
378
+ if (event.message.role === "assistant" && event.message.errorMessage) {
379
+ this._state.errorMessage = event.message.errorMessage;
380
+ }
381
+ break;
382
+ case "agent_end":
383
+ this._state.streamingMessage = undefined;
384
+ break;
385
+ }
386
+ const signal = this.activeRun?.abortController.signal;
387
+ if (!signal) {
388
+ throw new Error("Agent listener invoked outside active run");
389
+ }
390
+ for (const listener of this.listeners) {
391
+ await listener(event, signal);
392
+ }
393
+ }
394
+ }
395
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,YAAY,GAIZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAA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YAAY,CAAC;gBACvD,CAAC;gBACD,MAAM;YAEP,KAAK,WAAW;gBACf,IAAI,CAAC,MAAM,CAAC,gBAAgB,GAAG,SAAS,CAAC;gBACzC,MAAM;QACR,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC;QACtD,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC9D,CAAC;QACD,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACvC,MAAM,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC/B,CAAC;IAAA,CACD;CACD","sourcesContent":["import {\n\ttype ImageContent,\n\ttype Message,\n\ttype Model,\n\ttype SimpleStreamOptions,\n\tstreamSimple,\n\ttype TextContent,\n\ttype ThinkingBudgets,\n\ttype Transport,\n} from \"@orient-cli/ai\";\nimport { runAgentLoop, runAgentLoopContinue } from \"./agent-loop.js\";\nimport type {\n\tAfterToolCallContext,\n\tAfterToolCallResult,\n\tAgentContext,\n\tAgentEvent,\n\tAgentLoopConfig,\n\tAgentMessage,\n\tAgentState,\n\tAgentTool,\n\tBeforeToolCallContext,\n\tBeforeToolCallResult,\n\tStreamFn,\n\tToolExecutionMode,\n} from \"./types.js\";\n\nfunction defaultConvertToLlm(messages: AgentMessage[]): Message[] {\n\treturn messages.filter(\n\t\t(message) => message.role === \"user\" || message.role === \"assistant\" || message.role === \"toolResult\",\n\t);\n}\n\nconst EMPTY_USAGE = {\n\tinput: 0,\n\toutput: 0,\n\tcacheRead: 0,\n\tcacheWrite: 0,\n\ttotalTokens: 0,\n\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n};\n\nconst DEFAULT_MODEL = {\n\tid: \"unknown\",\n\tname: \"unknown\",\n\tapi: \"unknown\",\n\tprovider: \"unknown\",\n\tbaseUrl: \"\",\n\treasoning: false,\n\tinput: [],\n\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\tcontextWindow: 0,\n\tmaxTokens: 0,\n} satisfies Model<any>;\n\ntype QueueMode = \"all\" | \"one-at-a-time\";\n\ntype MutableAgentState = Omit<AgentState, \"isStreaming\" | \"streamingMessage\" | \"pendingToolCalls\" | \"errorMessage\"> & {\n\tisStreaming: boolean;\n\tstreamingMessage?: AgentMessage;\n\tpendingToolCalls: Set<string>;\n\terrorMessage?: string;\n};\n\nfunction createMutableAgentState(\n\tinitialState?: Partial<Omit<AgentState, \"pendingToolCalls\" | \"isStreaming\" | \"streamingMessage\" | \"errorMessage\">>,\n): MutableAgentState {\n\tlet tools = initialState?.tools?.slice() ?? [];\n\tlet messages = initialState?.messages?.slice() ?? [];\n\n\treturn {\n\t\tsystemPrompt: initialState?.systemPrompt ?? \"\",\n\t\tmodel: initialState?.model ?? DEFAULT_MODEL,\n\t\tthinkingLevel: initialState?.thinkingLevel ?? \"off\",\n\t\tget tools() {\n\t\t\treturn tools;\n\t\t},\n\t\tset tools(nextTools: AgentTool<any>[]) {\n\t\t\ttools = nextTools.slice();\n\t\t},\n\t\tget messages() {\n\t\t\treturn messages;\n\t\t},\n\t\tset messages(nextMessages: AgentMessage[]) {\n\t\t\tmessages = nextMessages.slice();\n\t\t},\n\t\tisStreaming: false,\n\t\tstreamingMessage: undefined,\n\t\tpendingToolCalls: new Set<string>(),\n\t\terrorMessage: undefined,\n\t};\n}\n\n/** Options for constructing an {@link Agent}. */\nexport interface AgentOptions {\n\tinitialState?: Partial<Omit<AgentState, \"pendingToolCalls\" | \"isStreaming\" | \"streamingMessage\" | \"errorMessage\">>;\n\tconvertToLlm?: (messages: AgentMessage[]) => Message[] | Promise<Message[]>;\n\ttransformContext?: (messages: AgentMessage[], signal?: AbortSignal) => Promise<AgentMessage[]>;\n\tstreamFn?: StreamFn;\n\tgetApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;\n\tonPayload?: SimpleStreamOptions[\"onPayload\"];\n\tbeforeToolCall?: (context: BeforeToolCallContext, signal?: AbortSignal) => Promise<BeforeToolCallResult | undefined>;\n\tafterToolCall?: (context: AfterToolCallContext, signal?: AbortSignal) => Promise<AfterToolCallResult | undefined>;\n\tsteeringMode?: QueueMode;\n\tfollowUpMode?: QueueMode;\n\tsessionId?: string;\n\tthinkingBudgets?: ThinkingBudgets;\n\ttransport?: Transport;\n\tmaxRetryDelayMs?: number;\n\ttoolExecution?: ToolExecutionMode;\n}\n\nclass PendingMessageQueue {\n\tprivate messages: AgentMessage[] = [];\n\n\tconstructor(public mode: QueueMode) {}\n\n\tenqueue(message: AgentMessage): void {\n\t\tthis.messages.push(message);\n\t}\n\n\thasItems(): boolean {\n\t\treturn this.messages.length > 0;\n\t}\n\n\tdrain(): AgentMessage[] {\n\t\tif (this.mode === \"all\") {\n\t\t\tconst drained = this.messages.slice();\n\t\t\tthis.messages = [];\n\t\t\treturn drained;\n\t\t}\n\n\t\tconst first = this.messages[0];\n\t\tif (!first) {\n\t\t\treturn [];\n\t\t}\n\t\tthis.messages = this.messages.slice(1);\n\t\treturn [first];\n\t}\n\n\tclear(): void {\n\t\tthis.messages = [];\n\t}\n}\n\ntype ActiveRun = {\n\tpromise: Promise<void>;\n\tresolve: () => void;\n\tabortController: AbortController;\n};\n\n/**\n * Stateful wrapper around the low-level agent loop.\n *\n * `Agent` owns the current transcript, emits lifecycle events, executes tools,\n * and exposes queueing APIs for steering and follow-up messages.\n */\nexport class Agent {\n\tprivate _state: MutableAgentState;\n\tprivate readonly listeners = new Set<(event: AgentEvent, signal: AbortSignal) => Promise<void> | void>();\n\tprivate readonly steeringQueue: PendingMessageQueue;\n\tprivate readonly followUpQueue: PendingMessageQueue;\n\n\tpublic convertToLlm: (messages: AgentMessage[]) => Message[] | Promise<Message[]>;\n\tpublic transformContext?: (messages: AgentMessage[], signal?: AbortSignal) => Promise<AgentMessage[]>;\n\tpublic streamFn: StreamFn;\n\tpublic getApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;\n\tpublic onPayload?: SimpleStreamOptions[\"onPayload\"];\n\tpublic beforeToolCall?: (\n\t\tcontext: BeforeToolCallContext,\n\t\tsignal?: AbortSignal,\n\t) => Promise<BeforeToolCallResult | undefined>;\n\tpublic afterToolCall?: (\n\t\tcontext: AfterToolCallContext,\n\t\tsignal?: AbortSignal,\n\t) => Promise<AfterToolCallResult | undefined>;\n\tprivate activeRun?: ActiveRun;\n\t/** Session identifier forwarded to providers for cache-aware backends. */\n\tpublic sessionId?: string;\n\t/** Optional per-level thinking token budgets forwarded to the stream function. */\n\tpublic thinkingBudgets?: ThinkingBudgets;\n\t/** Preferred transport forwarded to the stream function. */\n\tpublic transport: Transport;\n\t/** Optional cap for provider-requested retry delays. */\n\tpublic maxRetryDelayMs?: number;\n\t/** Tool execution strategy for assistant messages that contain multiple tool calls. */\n\tpublic toolExecution: ToolExecutionMode;\n\n\tconstructor(options: AgentOptions = {}) {\n\t\tthis._state = createMutableAgentState(options.initialState);\n\t\tthis.convertToLlm = options.convertToLlm ?? defaultConvertToLlm;\n\t\tthis.transformContext = options.transformContext;\n\t\tthis.streamFn = options.streamFn ?? streamSimple;\n\t\tthis.getApiKey = options.getApiKey;\n\t\tthis.onPayload = options.onPayload;\n\t\tthis.beforeToolCall = options.beforeToolCall;\n\t\tthis.afterToolCall = options.afterToolCall;\n\t\tthis.steeringQueue = new PendingMessageQueue(options.steeringMode ?? \"one-at-a-time\");\n\t\tthis.followUpQueue = new PendingMessageQueue(options.followUpMode ?? \"one-at-a-time\");\n\t\tthis.sessionId = options.sessionId;\n\t\tthis.thinkingBudgets = options.thinkingBudgets;\n\t\tthis.transport = options.transport ?? \"sse\";\n\t\tthis.maxRetryDelayMs = options.maxRetryDelayMs;\n\t\tthis.toolExecution = options.toolExecution ?? \"parallel\";\n\t}\n\n\t/**\n\t * Subscribe to agent lifecycle events.\n\t *\n\t * Listener promises are awaited in subscription order and are included in\n\t * the current run's settlement. Listeners also receive the active abort\n\t * signal for the current run.\n\t *\n\t * `agent_end` is the final emitted event for a run, but the agent does not\n\t * become idle until all awaited listeners for that event have settled.\n\t */\n\tsubscribe(listener: (event: AgentEvent, signal: AbortSignal) => Promise<void> | void): () => void {\n\t\tthis.listeners.add(listener);\n\t\treturn () => this.listeners.delete(listener);\n\t}\n\n\t/**\n\t * Current agent state.\n\t *\n\t * Assigning `state.tools` or `state.messages` copies the provided top-level array.\n\t */\n\tget state(): AgentState {\n\t\treturn this._state;\n\t}\n\n\t/** Controls how queued steering messages are drained. */\n\tset steeringMode(mode: QueueMode) {\n\t\tthis.steeringQueue.mode = mode;\n\t}\n\n\tget steeringMode(): QueueMode {\n\t\treturn this.steeringQueue.mode;\n\t}\n\n\t/** Controls how queued follow-up messages are drained. */\n\tset followUpMode(mode: QueueMode) {\n\t\tthis.followUpQueue.mode = mode;\n\t}\n\n\tget followUpMode(): QueueMode {\n\t\treturn this.followUpQueue.mode;\n\t}\n\n\t/** Queue a message to be injected after the current assistant turn finishes. */\n\tsteer(message: AgentMessage): void {\n\t\tthis.steeringQueue.enqueue(message);\n\t}\n\n\t/** Queue a message to run only after the agent would otherwise stop. */\n\tfollowUp(message: AgentMessage): void {\n\t\tthis.followUpQueue.enqueue(message);\n\t}\n\n\t/** Remove all queued steering messages. */\n\tclearSteeringQueue(): void {\n\t\tthis.steeringQueue.clear();\n\t}\n\n\t/** Remove all queued follow-up messages. */\n\tclearFollowUpQueue(): void {\n\t\tthis.followUpQueue.clear();\n\t}\n\n\t/** Remove all queued steering and follow-up messages. */\n\tclearAllQueues(): void {\n\t\tthis.clearSteeringQueue();\n\t\tthis.clearFollowUpQueue();\n\t}\n\n\t/** Returns true when either queue still contains pending messages. */\n\thasQueuedMessages(): boolean {\n\t\treturn this.steeringQueue.hasItems() || this.followUpQueue.hasItems();\n\t}\n\n\t/** Active abort signal for the current run, if any. */\n\tget signal(): AbortSignal | undefined {\n\t\treturn this.activeRun?.abortController.signal;\n\t}\n\n\t/** Abort the current run, if one is active. */\n\tabort(): void {\n\t\tthis.activeRun?.abortController.abort();\n\t}\n\n\t/**\n\t * Resolve when the current run and all awaited event listeners have finished.\n\t *\n\t * This resolves after `agent_end` listeners settle.\n\t */\n\twaitForIdle(): Promise<void> {\n\t\treturn this.activeRun?.promise ?? Promise.resolve();\n\t}\n\n\t/** Clear transcript state, runtime state, and queued messages. */\n\treset(): void {\n\t\tthis._state.messages = [];\n\t\tthis._state.isStreaming = false;\n\t\tthis._state.streamingMessage = undefined;\n\t\tthis._state.pendingToolCalls = new Set<string>();\n\t\tthis._state.errorMessage = undefined;\n\t\tthis.clearFollowUpQueue();\n\t\tthis.clearSteeringQueue();\n\t}\n\n\t/** Start a new prompt from text, a single message, or a batch of messages. */\n\tasync prompt(message: AgentMessage | AgentMessage[]): Promise<void>;\n\tasync prompt(input: string, images?: ImageContent[]): Promise<void>;\n\tasync prompt(input: string | AgentMessage | AgentMessage[], images?: ImageContent[]): Promise<void> {\n\t\tif (this.activeRun) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Agent is already processing a prompt. Use steer() or followUp() to queue messages, or wait for completion.\",\n\t\t\t);\n\t\t}\n\t\tconst messages = this.normalizePromptInput(input, images);\n\t\tawait this.runPromptMessages(messages);\n\t}\n\n\t/** Continue from the current transcript. The last message must be a user or tool-result message. */\n\tasync continue(): Promise<void> {\n\t\tif (this.activeRun) {\n\t\t\tthrow new Error(\"Agent is already processing. Wait for completion before continuing.\");\n\t\t}\n\n\t\tconst lastMessage = this._state.messages[this._state.messages.length - 1];\n\t\tif (!lastMessage) {\n\t\t\tthrow new Error(\"No messages to continue from\");\n\t\t}\n\n\t\tif (lastMessage.role === \"assistant\") {\n\t\t\tconst queuedSteering = this.steeringQueue.drain();\n\t\t\tif (queuedSteering.length > 0) {\n\t\t\t\tawait this.runPromptMessages(queuedSteering, { skipInitialSteeringPoll: true });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst queuedFollowUps = this.followUpQueue.drain();\n\t\t\tif (queuedFollowUps.length > 0) {\n\t\t\t\tawait this.runPromptMessages(queuedFollowUps);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthrow new Error(\"Cannot continue from message role: assistant\");\n\t\t}\n\n\t\tawait this.runContinuation();\n\t}\n\n\tprivate normalizePromptInput(\n\t\tinput: string | AgentMessage | AgentMessage[],\n\t\timages?: ImageContent[],\n\t): AgentMessage[] {\n\t\tif (Array.isArray(input)) {\n\t\t\treturn input;\n\t\t}\n\n\t\tif (typeof input !== \"string\") {\n\t\t\treturn [input];\n\t\t}\n\n\t\tconst content: Array<TextContent | ImageContent> = [{ type: \"text\", text: input }];\n\t\tif (images && images.length > 0) {\n\t\t\tcontent.push(...images);\n\t\t}\n\t\treturn [{ role: \"user\", content, timestamp: Date.now() }];\n\t}\n\n\tprivate async runPromptMessages(\n\t\tmessages: AgentMessage[],\n\t\toptions: { skipInitialSteeringPoll?: boolean } = {},\n\t): Promise<void> {\n\t\tawait this.runWithLifecycle(async (signal) => {\n\t\t\tawait runAgentLoop(\n\t\t\t\tmessages,\n\t\t\t\tthis.createContextSnapshot(),\n\t\t\t\tthis.createLoopConfig(options),\n\t\t\t\t(event) => this.processEvents(event),\n\t\t\t\tsignal,\n\t\t\t\tthis.streamFn,\n\t\t\t);\n\t\t});\n\t}\n\n\tprivate async runContinuation(): Promise<void> {\n\t\tawait this.runWithLifecycle(async (signal) => {\n\t\t\tawait runAgentLoopContinue(\n\t\t\t\tthis.createContextSnapshot(),\n\t\t\t\tthis.createLoopConfig(),\n\t\t\t\t(event) => this.processEvents(event),\n\t\t\t\tsignal,\n\t\t\t\tthis.streamFn,\n\t\t\t);\n\t\t});\n\t}\n\n\tprivate createContextSnapshot(): AgentContext {\n\t\treturn {\n\t\t\tsystemPrompt: this._state.systemPrompt,\n\t\t\tmessages: this._state.messages.slice(),\n\t\t\ttools: this._state.tools.slice(),\n\t\t};\n\t}\n\n\tprivate createLoopConfig(options: { skipInitialSteeringPoll?: boolean } = {}): AgentLoopConfig {\n\t\tlet skipInitialSteeringPoll = options.skipInitialSteeringPoll === true;\n\t\treturn {\n\t\t\tmodel: this._state.model,\n\t\t\treasoning: this._state.thinkingLevel === \"off\" ? undefined : this._state.thinkingLevel,\n\t\t\tsessionId: this.sessionId,\n\t\t\tonPayload: this.onPayload,\n\t\t\ttransport: this.transport,\n\t\t\tthinkingBudgets: this.thinkingBudgets,\n\t\t\tmaxRetryDelayMs: this.maxRetryDelayMs,\n\t\t\ttoolExecution: this.toolExecution,\n\t\t\tbeforeToolCall: this.beforeToolCall,\n\t\t\tafterToolCall: this.afterToolCall,\n\t\t\tconvertToLlm: this.convertToLlm,\n\t\t\ttransformContext: this.transformContext,\n\t\t\tgetApiKey: this.getApiKey,\n\t\t\tgetSteeringMessages: async () => {\n\t\t\t\tif (skipInitialSteeringPoll) {\n\t\t\t\t\tskipInitialSteeringPoll = false;\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\treturn this.steeringQueue.drain();\n\t\t\t},\n\t\t\tgetFollowUpMessages: async () => this.followUpQueue.drain(),\n\t\t};\n\t}\n\n\tprivate async runWithLifecycle(executor: (signal: AbortSignal) => Promise<void>): Promise<void> {\n\t\tif (this.activeRun) {\n\t\t\tthrow new Error(\"Agent is already processing.\");\n\t\t}\n\n\t\tconst abortController = new AbortController();\n\t\tlet resolvePromise = () => {};\n\t\tconst promise = new Promise<void>((resolve) => {\n\t\t\tresolvePromise = resolve;\n\t\t});\n\t\tthis.activeRun = { promise, resolve: resolvePromise, abortController };\n\n\t\tthis._state.isStreaming = true;\n\t\tthis._state.streamingMessage = undefined;\n\t\tthis._state.errorMessage = undefined;\n\n\t\ttry {\n\t\t\tawait executor(abortController.signal);\n\t\t} catch (error) {\n\t\t\tawait this.handleRunFailure(error, abortController.signal.aborted);\n\t\t} finally {\n\t\t\tthis.finishRun();\n\t\t}\n\t}\n\n\tprivate async handleRunFailure(error: unknown, aborted: boolean): Promise<void> {\n\t\tconst failureMessage = {\n\t\t\trole: \"assistant\",\n\t\t\tcontent: [{ type: \"text\", text: \"\" }],\n\t\t\tapi: this._state.model.api,\n\t\t\tprovider: this._state.model.provider,\n\t\t\tmodel: this._state.model.id,\n\t\t\tusage: EMPTY_USAGE,\n\t\t\tstopReason: aborted ? \"aborted\" : \"error\",\n\t\t\terrorMessage: error instanceof Error ? error.message : String(error),\n\t\t\ttimestamp: Date.now(),\n\t\t} satisfies AgentMessage;\n\t\tthis._state.messages.push(failureMessage);\n\t\tthis._state.errorMessage = failureMessage.errorMessage;\n\t\tawait this.processEvents({ type: \"agent_end\", messages: [failureMessage] });\n\t}\n\n\tprivate finishRun(): void {\n\t\tthis._state.isStreaming = false;\n\t\tthis._state.streamingMessage = undefined;\n\t\tthis._state.pendingToolCalls = new Set<string>();\n\t\tthis.activeRun?.resolve();\n\t\tthis.activeRun = undefined;\n\t}\n\n\t/**\n\t * Reduce internal state for a loop event, then await listeners.\n\t *\n\t * `agent_end` only means no further loop events will be emitted. The run is\n\t * considered idle later, after all awaited listeners for `agent_end` finish\n\t * and `finishRun()` clears runtime-owned state.\n\t */\n\tprivate async processEvents(event: AgentEvent): Promise<void> {\n\t\tswitch (event.type) {\n\t\t\tcase \"message_start\":\n\t\t\t\tthis._state.streamingMessage = event.message;\n\t\t\t\tbreak;\n\n\t\t\tcase \"message_update\":\n\t\t\t\tthis._state.streamingMessage = event.message;\n\t\t\t\tbreak;\n\n\t\t\tcase \"message_end\":\n\t\t\t\tthis._state.streamingMessage = undefined;\n\t\t\t\tthis._state.messages.push(event.message);\n\t\t\t\tbreak;\n\n\t\t\tcase \"tool_execution_start\": {\n\t\t\t\tconst pendingToolCalls = new Set(this._state.pendingToolCalls);\n\t\t\t\tpendingToolCalls.add(event.toolCallId);\n\t\t\t\tthis._state.pendingToolCalls = pendingToolCalls;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase \"tool_execution_end\": {\n\t\t\t\tconst pendingToolCalls = new Set(this._state.pendingToolCalls);\n\t\t\t\tpendingToolCalls.delete(event.toolCallId);\n\t\t\t\tthis._state.pendingToolCalls = pendingToolCalls;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase \"turn_end\":\n\t\t\t\tif (event.message.role === \"assistant\" && event.message.errorMessage) {\n\t\t\t\t\tthis._state.errorMessage = event.message.errorMessage;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase \"agent_end\":\n\t\t\t\tthis._state.streamingMessage = undefined;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tconst signal = this.activeRun?.abortController.signal;\n\t\tif (!signal) {\n\t\t\tthrow new Error(\"Agent listener invoked outside active run\");\n\t\t}\n\t\tfor (const listener of this.listeners) {\n\t\t\tawait listener(event, signal);\n\t\t}\n\t}\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export * from "./agent.js";
2
+ export * from "./agent-loop.js";
3
+ export * from "./proxy.js";
4
+ export * from "./types.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAE3B,cAAc,iBAAiB,CAAC;AAEhC,cAAc,YAAY,CAAC;AAE3B,cAAc,YAAY,CAAC","sourcesContent":["// Core Agent\nexport * from \"./agent.js\";\n// Loop functions\nexport * from \"./agent-loop.js\";\n// Proxy utilities\nexport * from \"./proxy.js\";\n// Types\nexport * from \"./types.js\";\n"]}
@@ -0,0 +1,9 @@
1
+ // Core Agent
2
+ export * from "./agent.js";
3
+ // Loop functions
4
+ export * from "./agent-loop.js";
5
+ // Proxy utilities
6
+ export * from "./proxy.js";
7
+ // Types
8
+ export * from "./types.js";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,YAAY,CAAC;AAC3B,iBAAiB;AACjB,cAAc,iBAAiB,CAAC;AAChC,kBAAkB;AAClB,cAAc,YAAY,CAAC;AAC3B,QAAQ;AACR,cAAc,YAAY,CAAC","sourcesContent":["// Core Agent\nexport * from \"./agent.js\";\n// Loop functions\nexport * from \"./agent-loop.js\";\n// Proxy utilities\nexport * from \"./proxy.js\";\n// Types\nexport * from \"./types.js\";\n"]}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Proxy stream function for apps that route LLM calls through a server.
3
+ * The server manages auth and proxies requests to LLM providers.
4
+ */
5
+ import { type AssistantMessage, type AssistantMessageEvent, type Context, EventStream, type Model, type SimpleStreamOptions, type StopReason } from "@orient-cli/ai";
6
+ declare class ProxyMessageEventStream extends EventStream<AssistantMessageEvent, AssistantMessage> {
7
+ constructor();
8
+ }
9
+ /**
10
+ * Proxy event types - server sends these with partial field stripped to reduce bandwidth.
11
+ */
12
+ export type ProxyAssistantMessageEvent = {
13
+ type: "start";
14
+ } | {
15
+ type: "text_start";
16
+ contentIndex: number;
17
+ } | {
18
+ type: "text_delta";
19
+ contentIndex: number;
20
+ delta: string;
21
+ } | {
22
+ type: "text_end";
23
+ contentIndex: number;
24
+ contentSignature?: string;
25
+ } | {
26
+ type: "thinking_start";
27
+ contentIndex: number;
28
+ } | {
29
+ type: "thinking_delta";
30
+ contentIndex: number;
31
+ delta: string;
32
+ } | {
33
+ type: "thinking_end";
34
+ contentIndex: number;
35
+ contentSignature?: string;
36
+ } | {
37
+ type: "toolcall_start";
38
+ contentIndex: number;
39
+ id: string;
40
+ toolName: string;
41
+ } | {
42
+ type: "toolcall_delta";
43
+ contentIndex: number;
44
+ delta: string;
45
+ } | {
46
+ type: "toolcall_end";
47
+ contentIndex: number;
48
+ } | {
49
+ type: "done";
50
+ reason: Extract<StopReason, "stop" | "length" | "toolUse">;
51
+ usage: AssistantMessage["usage"];
52
+ } | {
53
+ type: "error";
54
+ reason: Extract<StopReason, "aborted" | "error">;
55
+ errorMessage?: string;
56
+ usage: AssistantMessage["usage"];
57
+ };
58
+ export interface ProxyStreamOptions extends SimpleStreamOptions {
59
+ /** Auth token for the proxy server */
60
+ authToken: string;
61
+ /** Proxy server URL (e.g., "https://genai.example.com") */
62
+ proxyUrl: string;
63
+ }
64
+ /**
65
+ * Stream function that proxies through a server instead of calling LLM providers directly.
66
+ * The server strips the partial field from delta events to reduce bandwidth.
67
+ * We reconstruct the partial message client-side.
68
+ *
69
+ * Use this as the `streamFn` option when creating an Agent that needs to go through a proxy.
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * const agent = new Agent({
74
+ * streamFn: (model, context, options) =>
75
+ * streamProxy(model, context, {
76
+ * ...options,
77
+ * authToken: await getAuthToken(),
78
+ * proxyUrl: "https://genai.example.com",
79
+ * }),
80
+ * });
81
+ * ```
82
+ */
83
+ export declare function streamProxy(model: Model<any>, context: Context, options: ProxyStreamOptions): ProxyMessageEventStream;
84
+ export {};
85
+ //# sourceMappingURL=proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,OAAO,EACZ,WAAW,EACX,KAAK,KAAK,EAEV,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAEf,MAAM,gBAAgB,CAAC;AAGxB,cAAM,uBAAwB,SAAQ,WAAW,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;IACzF,cASC;CACD;AAED;;GAEG;AACH,MAAM,MAAM,0BAA0B,GACnC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;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AAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,GAAG,uBAAuB,CAyHrH","sourcesContent":["/**\n * Proxy stream function for apps that route LLM calls through a server.\n * The server manages auth and proxies requests to LLM providers.\n */\n\n// Internal import for JSON parsing utility\nimport {\n\ttype AssistantMessage,\n\ttype AssistantMessageEvent,\n\ttype Context,\n\tEventStream,\n\ttype Model,\n\tparseStreamingJson,\n\ttype SimpleStreamOptions,\n\ttype StopReason,\n\ttype ToolCall,\n} from \"@orient-cli/ai\";\n\n// Create stream class matching ProxyMessageEventStream\nclass ProxyMessageEventStream extends EventStream<AssistantMessageEvent, AssistantMessage> {\n\tconstructor() {\n\t\tsuper(\n\t\t\t(event) => event.type === \"done\" || event.type === \"error\",\n\t\t\t(event) => {\n\t\t\t\tif (event.type === \"done\") return event.message;\n\t\t\t\tif (event.type === \"error\") return event.error;\n\t\t\t\tthrow new Error(\"Unexpected event type\");\n\t\t\t},\n\t\t);\n\t}\n}\n\n/**\n * Proxy event types - server sends these with partial field stripped to reduce bandwidth.\n */\nexport type ProxyAssistantMessageEvent =\n\t| { type: \"start\" }\n\t| { type: \"text_start\"; contentIndex: number }\n\t| { type: \"text_delta\"; contentIndex: number; delta: string }\n\t| { type: \"text_end\"; contentIndex: number; contentSignature?: string }\n\t| { type: \"thinking_start\"; contentIndex: number }\n\t| { type: \"thinking_delta\"; contentIndex: number; delta: string }\n\t| { type: \"thinking_end\"; contentIndex: number; contentSignature?: string }\n\t| { type: \"toolcall_start\"; contentIndex: number; id: string; toolName: string }\n\t| { type: \"toolcall_delta\"; contentIndex: number; delta: string }\n\t| { type: \"toolcall_end\"; contentIndex: number }\n\t| {\n\t\t\ttype: \"done\";\n\t\t\treason: Extract<StopReason, \"stop\" | \"length\" | \"toolUse\">;\n\t\t\tusage: AssistantMessage[\"usage\"];\n\t }\n\t| {\n\t\t\ttype: \"error\";\n\t\t\treason: Extract<StopReason, \"aborted\" | \"error\">;\n\t\t\terrorMessage?: string;\n\t\t\tusage: AssistantMessage[\"usage\"];\n\t };\n\nexport interface ProxyStreamOptions extends SimpleStreamOptions {\n\t/** Auth token for the proxy server */\n\tauthToken: string;\n\t/** Proxy server URL (e.g., \"https://genai.example.com\") */\n\tproxyUrl: string;\n}\n\n/**\n * Stream function that proxies through a server instead of calling LLM providers directly.\n * The server strips the partial field from delta events to reduce bandwidth.\n * We reconstruct the partial message client-side.\n *\n * Use this as the `streamFn` option when creating an Agent that needs to go through a proxy.\n *\n * @example\n * ```typescript\n * const agent = new Agent({\n * streamFn: (model, context, options) =>\n * streamProxy(model, context, {\n * ...options,\n * authToken: await getAuthToken(),\n * proxyUrl: \"https://genai.example.com\",\n * }),\n * });\n * ```\n */\nexport function streamProxy(model: Model<any>, context: Context, options: ProxyStreamOptions): ProxyMessageEventStream {\n\tconst stream = new ProxyMessageEventStream();\n\n\t(async () => {\n\t\t// Initialize the partial message that we'll build up from events\n\t\tconst partial: AssistantMessage = {\n\t\t\trole: \"assistant\",\n\t\t\tstopReason: \"stop\",\n\t\t\tcontent: [],\n\t\t\tapi: model.api,\n\t\t\tprovider: model.provider,\n\t\t\tmodel: model.id,\n\t\t\tusage: {\n\t\t\t\tinput: 0,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t\ttotalTokens: 0,\n\t\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n\t\t\t},\n\t\t\ttimestamp: Date.now(),\n\t\t};\n\n\t\tlet reader: ReadableStreamDefaultReader<Uint8Array> | undefined;\n\n\t\tconst abortHandler = () => {\n\t\t\tif (reader) {\n\t\t\t\treader.cancel(\"Request aborted by user\").catch(() => {});\n\t\t\t}\n\t\t};\n\n\t\tif (options.signal) {\n\t\t\toptions.signal.addEventListener(\"abort\", abortHandler);\n\t\t}\n\n\t\ttry {\n\t\t\tconst response = await fetch(`${options.proxyUrl}/api/stream`, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: {\n\t\t\t\t\tAuthorization: `Bearer ${options.authToken}`,\n\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t},\n\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\tmodel,\n\t\t\t\t\tcontext,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\ttemperature: options.temperature,\n\t\t\t\t\t\tmaxTokens: options.maxTokens,\n\t\t\t\t\t\treasoning: options.reasoning,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t\tsignal: options.signal,\n\t\t\t});\n\n\t\t\tif (!response.ok) {\n\t\t\t\tlet errorMessage = `Proxy error: ${response.status} ${response.statusText}`;\n\t\t\t\ttry {\n\t\t\t\t\tconst errorData = (await response.json()) as { error?: string };\n\t\t\t\t\tif (errorData.error) {\n\t\t\t\t\t\terrorMessage = `Proxy error: ${errorData.error}`;\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// Couldn't parse error response\n\t\t\t\t}\n\t\t\t\tthrow new Error(errorMessage);\n\t\t\t}\n\n\t\t\treader = response.body!.getReader();\n\t\t\tconst decoder = new TextDecoder();\n\t\t\tlet buffer = \"\";\n\n\t\t\twhile (true) {\n\t\t\t\tconst { done, value } = await reader.read();\n\t\t\t\tif (done) break;\n\n\t\t\t\tif (options.signal?.aborted) {\n\t\t\t\t\tthrow new Error(\"Request aborted by user\");\n\t\t\t\t}\n\n\t\t\t\tbuffer += decoder.decode(value, { stream: true });\n\t\t\t\tconst lines = buffer.split(\"\\n\");\n\t\t\t\tbuffer = lines.pop() || \"\";\n\n\t\t\t\tfor (const line of lines) {\n\t\t\t\t\tif (line.startsWith(\"data: \")) {\n\t\t\t\t\t\tconst data = line.slice(6).trim();\n\t\t\t\t\t\tif (data) {\n\t\t\t\t\t\t\tconst proxyEvent = JSON.parse(data) as ProxyAssistantMessageEvent;\n\t\t\t\t\t\t\tconst event = processProxyEvent(proxyEvent, partial);\n\t\t\t\t\t\t\tif (event) {\n\t\t\t\t\t\t\t\tstream.push(event);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.signal?.aborted) {\n\t\t\t\tthrow new Error(\"Request aborted by user\");\n\t\t\t}\n\n\t\t\tstream.end();\n\t\t} catch (error) {\n\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\tconst reason = options.signal?.aborted ? \"aborted\" : \"error\";\n\t\t\tpartial.stopReason = reason;\n\t\t\tpartial.errorMessage = errorMessage;\n\t\t\tstream.push({\n\t\t\t\ttype: \"error\",\n\t\t\t\treason,\n\t\t\t\terror: partial,\n\t\t\t});\n\t\t\tstream.end();\n\t\t} finally {\n\t\t\tif (options.signal) {\n\t\t\t\toptions.signal.removeEventListener(\"abort\", abortHandler);\n\t\t\t}\n\t\t}\n\t})();\n\n\treturn stream;\n}\n\n/**\n * Process a proxy event and update the partial message.\n */\nfunction processProxyEvent(\n\tproxyEvent: ProxyAssistantMessageEvent,\n\tpartial: AssistantMessage,\n): AssistantMessageEvent | undefined {\n\tswitch (proxyEvent.type) {\n\t\tcase \"start\":\n\t\t\treturn { type: \"start\", partial };\n\n\t\tcase \"text_start\":\n\t\t\tpartial.content[proxyEvent.contentIndex] = { type: \"text\", text: \"\" };\n\t\t\treturn { type: \"text_start\", contentIndex: proxyEvent.contentIndex, partial };\n\n\t\tcase \"text_delta\": {\n\t\t\tconst content = partial.content[proxyEvent.contentIndex];\n\t\t\tif (content?.type === \"text\") {\n\t\t\t\tcontent.text += proxyEvent.delta;\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"text_delta\",\n\t\t\t\t\tcontentIndex: proxyEvent.contentIndex,\n\t\t\t\t\tdelta: proxyEvent.delta,\n\t\t\t\t\tpartial,\n\t\t\t\t};\n\t\t\t}\n\t\t\tthrow new Error(\"Received text_delta for non-text content\");\n\t\t}\n\n\t\tcase \"text_end\": {\n\t\t\tconst content = partial.content[proxyEvent.contentIndex];\n\t\t\tif (content?.type === \"text\") {\n\t\t\t\tcontent.textSignature = proxyEvent.contentSignature;\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"text_end\",\n\t\t\t\t\tcontentIndex: proxyEvent.contentIndex,\n\t\t\t\t\tcontent: content.text,\n\t\t\t\t\tpartial,\n\t\t\t\t};\n\t\t\t}\n\t\t\tthrow new Error(\"Received text_end for non-text content\");\n\t\t}\n\n\t\tcase \"thinking_start\":\n\t\t\tpartial.content[proxyEvent.contentIndex] = { type: \"thinking\", thinking: \"\" };\n\t\t\treturn { type: \"thinking_start\", contentIndex: proxyEvent.contentIndex, partial };\n\n\t\tcase \"thinking_delta\": {\n\t\t\tconst content = partial.content[proxyEvent.contentIndex];\n\t\t\tif (content?.type === \"thinking\") {\n\t\t\t\tcontent.thinking += proxyEvent.delta;\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"thinking_delta\",\n\t\t\t\t\tcontentIndex: proxyEvent.contentIndex,\n\t\t\t\t\tdelta: proxyEvent.delta,\n\t\t\t\t\tpartial,\n\t\t\t\t};\n\t\t\t}\n\t\t\tthrow new Error(\"Received thinking_delta for non-thinking content\");\n\t\t}\n\n\t\tcase \"thinking_end\": {\n\t\t\tconst content = partial.content[proxyEvent.contentIndex];\n\t\t\tif (content?.type === \"thinking\") {\n\t\t\t\tcontent.thinkingSignature = proxyEvent.contentSignature;\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"thinking_end\",\n\t\t\t\t\tcontentIndex: proxyEvent.contentIndex,\n\t\t\t\t\tcontent: content.thinking,\n\t\t\t\t\tpartial,\n\t\t\t\t};\n\t\t\t}\n\t\t\tthrow new Error(\"Received thinking_end for non-thinking content\");\n\t\t}\n\n\t\tcase \"toolcall_start\":\n\t\t\tpartial.content[proxyEvent.contentIndex] = {\n\t\t\t\ttype: \"toolCall\",\n\t\t\t\tid: proxyEvent.id,\n\t\t\t\tname: proxyEvent.toolName,\n\t\t\t\targuments: {},\n\t\t\t\tpartialJson: \"\",\n\t\t\t} satisfies ToolCall & { partialJson: string } as ToolCall;\n\t\t\treturn { type: \"toolcall_start\", contentIndex: proxyEvent.contentIndex, partial };\n\n\t\tcase \"toolcall_delta\": {\n\t\t\tconst content = partial.content[proxyEvent.contentIndex];\n\t\t\tif (content?.type === \"toolCall\") {\n\t\t\t\t(content as any).partialJson += proxyEvent.delta;\n\t\t\t\tcontent.arguments = parseStreamingJson((content as any).partialJson) || {};\n\t\t\t\tpartial.content[proxyEvent.contentIndex] = { ...content }; // Trigger reactivity\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"toolcall_delta\",\n\t\t\t\t\tcontentIndex: proxyEvent.contentIndex,\n\t\t\t\t\tdelta: proxyEvent.delta,\n\t\t\t\t\tpartial,\n\t\t\t\t};\n\t\t\t}\n\t\t\tthrow new Error(\"Received toolcall_delta for non-toolCall content\");\n\t\t}\n\n\t\tcase \"toolcall_end\": {\n\t\t\tconst content = partial.content[proxyEvent.contentIndex];\n\t\t\tif (content?.type === \"toolCall\") {\n\t\t\t\tdelete (content as any).partialJson;\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"toolcall_end\",\n\t\t\t\t\tcontentIndex: proxyEvent.contentIndex,\n\t\t\t\t\ttoolCall: content,\n\t\t\t\t\tpartial,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\n\t\tcase \"done\":\n\t\t\tpartial.stopReason = proxyEvent.reason;\n\t\t\tpartial.usage = proxyEvent.usage;\n\t\t\treturn { type: \"done\", reason: proxyEvent.reason, message: partial };\n\n\t\tcase \"error\":\n\t\t\tpartial.stopReason = proxyEvent.reason;\n\t\t\tpartial.errorMessage = proxyEvent.errorMessage;\n\t\t\tpartial.usage = proxyEvent.usage;\n\t\t\treturn { type: \"error\", reason: proxyEvent.reason, error: partial };\n\n\t\tdefault: {\n\t\t\tconst _exhaustiveCheck: never = proxyEvent;\n\t\t\tconsole.warn(`Unhandled proxy event type: ${(proxyEvent as any).type}`);\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n"]}