orient-cli 0.1.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 (862) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/cli.js.map +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/integrations/notebooklm/notebooklm-extension.d.ts +1 -1
  7. package/dist/integrations/notebooklm/notebooklm-extension.js +1 -1
  8. package/dist/integrations/notebooklm/notebooklm-extension.js.map +1 -1
  9. package/dist/orient/change-packet.d.ts +2 -1
  10. package/dist/orient/change-packet.js +25 -8
  11. package/dist/orient/change-packet.js.map +1 -1
  12. package/dist/orient/clarify.d.ts +114 -0
  13. package/dist/orient/clarify.js +186 -0
  14. package/dist/orient/clarify.js.map +1 -0
  15. package/dist/orient/clear-command.d.ts +79 -0
  16. package/dist/orient/clear-command.js +117 -0
  17. package/dist/orient/clear-command.js.map +1 -0
  18. package/dist/orient/mode.d.ts +70 -0
  19. package/dist/orient/mode.js +124 -0
  20. package/dist/orient/mode.js.map +1 -0
  21. package/dist/orient/orient-extension.d.ts +1 -1
  22. package/dist/orient/orient-extension.js +306 -17
  23. package/dist/orient/orient-extension.js.map +1 -1
  24. package/dist/orient/plan-execute.d.ts +137 -0
  25. package/dist/orient/plan-execute.js +333 -0
  26. package/dist/orient/plan-execute.js.map +1 -0
  27. package/dist/orient/tiers.d.ts +109 -0
  28. package/dist/orient/tiers.js +162 -0
  29. package/dist/orient/tiers.js.map +1 -0
  30. package/dist/orient/wizard.d.ts +108 -0
  31. package/dist/orient/wizard.js +183 -0
  32. package/dist/orient/wizard.js.map +1 -0
  33. package/docs/open-source-resources.md +1 -1
  34. package/node_modules/@orient-cli/agent-core/README.md +456 -0
  35. package/node_modules/@orient-cli/agent-core/dist/agent-loop.d.ts +24 -0
  36. package/node_modules/@orient-cli/agent-core/dist/agent-loop.d.ts.map +1 -0
  37. package/node_modules/@orient-cli/agent-core/dist/agent-loop.js +404 -0
  38. package/node_modules/@orient-cli/agent-core/dist/agent-loop.js.map +1 -0
  39. package/node_modules/@orient-cli/agent-core/dist/agent.d.ts +115 -0
  40. package/node_modules/@orient-cli/agent-core/dist/agent.d.ts.map +1 -0
  41. package/node_modules/@orient-cli/agent-core/dist/agent.js +395 -0
  42. package/node_modules/@orient-cli/agent-core/dist/agent.js.map +1 -0
  43. package/node_modules/@orient-cli/agent-core/dist/index.d.ts +5 -0
  44. package/node_modules/@orient-cli/agent-core/dist/index.d.ts.map +1 -0
  45. package/node_modules/@orient-cli/agent-core/dist/index.js +9 -0
  46. package/node_modules/@orient-cli/agent-core/dist/index.js.map +1 -0
  47. package/node_modules/@orient-cli/agent-core/dist/proxy.d.ts +85 -0
  48. package/node_modules/@orient-cli/agent-core/dist/proxy.d.ts.map +1 -0
  49. package/node_modules/@orient-cli/agent-core/dist/proxy.js +268 -0
  50. package/node_modules/@orient-cli/agent-core/dist/proxy.js.map +1 -0
  51. package/node_modules/@orient-cli/agent-core/dist/types.d.ts +323 -0
  52. package/node_modules/@orient-cli/agent-core/dist/types.d.ts.map +1 -0
  53. package/node_modules/@orient-cli/agent-core/dist/types.js +2 -0
  54. package/node_modules/@orient-cli/agent-core/dist/types.js.map +1 -0
  55. package/node_modules/@orient-cli/agent-core/package.json +44 -0
  56. package/node_modules/@orient-cli/ai/README.md +1315 -0
  57. package/node_modules/@orient-cli/ai/dist/api-registry.d.ts +20 -0
  58. package/node_modules/@orient-cli/ai/dist/api-registry.d.ts.map +1 -0
  59. package/node_modules/@orient-cli/ai/dist/api-registry.js +44 -0
  60. package/node_modules/@orient-cli/ai/dist/api-registry.js.map +1 -0
  61. package/node_modules/@orient-cli/ai/dist/bedrock-provider.d.ts +5 -0
  62. package/node_modules/@orient-cli/ai/dist/bedrock-provider.d.ts.map +1 -0
  63. package/node_modules/@orient-cli/ai/dist/bedrock-provider.js +6 -0
  64. package/node_modules/@orient-cli/ai/dist/bedrock-provider.js.map +1 -0
  65. package/node_modules/@orient-cli/ai/dist/cli.d.ts +3 -0
  66. package/node_modules/@orient-cli/ai/dist/cli.d.ts.map +1 -0
  67. package/node_modules/@orient-cli/ai/dist/cli.js +116 -0
  68. package/node_modules/@orient-cli/ai/dist/cli.js.map +1 -0
  69. package/node_modules/@orient-cli/ai/dist/env-api-keys.d.ts +9 -0
  70. package/node_modules/@orient-cli/ai/dist/env-api-keys.d.ts.map +1 -0
  71. package/node_modules/@orient-cli/ai/dist/env-api-keys.js +107 -0
  72. package/node_modules/@orient-cli/ai/dist/env-api-keys.js.map +1 -0
  73. package/node_modules/@orient-cli/ai/dist/index.d.ts +26 -0
  74. package/node_modules/@orient-cli/ai/dist/index.d.ts.map +1 -0
  75. package/node_modules/@orient-cli/ai/dist/index.js +14 -0
  76. package/node_modules/@orient-cli/ai/dist/index.js.map +1 -0
  77. package/node_modules/@orient-cli/ai/dist/models.d.ts +24 -0
  78. package/node_modules/@orient-cli/ai/dist/models.d.ts.map +1 -0
  79. package/node_modules/@orient-cli/ai/dist/models.generated.d.ts +14473 -0
  80. package/node_modules/@orient-cli/ai/dist/models.generated.d.ts.map +1 -0
  81. package/node_modules/@orient-cli/ai/dist/models.generated.js +14241 -0
  82. package/node_modules/@orient-cli/ai/dist/models.generated.js.map +1 -0
  83. package/node_modules/@orient-cli/ai/dist/models.js +55 -0
  84. package/node_modules/@orient-cli/ai/dist/models.js.map +1 -0
  85. package/node_modules/@orient-cli/ai/dist/oauth.d.ts +2 -0
  86. package/node_modules/@orient-cli/ai/dist/oauth.d.ts.map +1 -0
  87. package/node_modules/@orient-cli/ai/dist/oauth.js +2 -0
  88. package/node_modules/@orient-cli/ai/dist/oauth.js.map +1 -0
  89. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.d.ts +20 -0
  90. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.d.ts.map +1 -0
  91. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.js +651 -0
  92. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.js.map +1 -0
  93. package/node_modules/@orient-cli/ai/dist/providers/anthropic.d.ts +40 -0
  94. package/node_modules/@orient-cli/ai/dist/providers/anthropic.d.ts.map +1 -0
  95. package/node_modules/@orient-cli/ai/dist/providers/anthropic.js +749 -0
  96. package/node_modules/@orient-cli/ai/dist/providers/anthropic.js.map +1 -0
  97. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.d.ts +15 -0
  98. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.d.ts.map +1 -0
  99. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.js +176 -0
  100. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.js.map +1 -0
  101. package/node_modules/@orient-cli/ai/dist/providers/faux.d.ts +56 -0
  102. package/node_modules/@orient-cli/ai/dist/providers/faux.d.ts.map +1 -0
  103. package/node_modules/@orient-cli/ai/dist/providers/faux.js +367 -0
  104. package/node_modules/@orient-cli/ai/dist/providers/faux.js.map +1 -0
  105. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.d.ts +8 -0
  106. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.d.ts.map +1 -0
  107. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.js +29 -0
  108. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.js.map +1 -0
  109. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.d.ts +74 -0
  110. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.d.ts.map +1 -0
  111. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.js +776 -0
  112. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.js.map +1 -0
  113. package/node_modules/@orient-cli/ai/dist/providers/google-shared.d.ts +65 -0
  114. package/node_modules/@orient-cli/ai/dist/providers/google-shared.d.ts.map +1 -0
  115. package/node_modules/@orient-cli/ai/dist/providers/google-shared.js +312 -0
  116. package/node_modules/@orient-cli/ai/dist/providers/google-shared.js.map +1 -0
  117. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.d.ts +15 -0
  118. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.d.ts.map +1 -0
  119. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.js +419 -0
  120. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.js.map +1 -0
  121. package/node_modules/@orient-cli/ai/dist/providers/google.d.ts +13 -0
  122. package/node_modules/@orient-cli/ai/dist/providers/google.d.ts.map +1 -0
  123. package/node_modules/@orient-cli/ai/dist/providers/google.js +399 -0
  124. package/node_modules/@orient-cli/ai/dist/providers/google.js.map +1 -0
  125. package/node_modules/@orient-cli/ai/dist/providers/mistral.d.ts +22 -0
  126. package/node_modules/@orient-cli/ai/dist/providers/mistral.d.ts.map +1 -0
  127. package/node_modules/@orient-cli/ai/dist/providers/mistral.js +501 -0
  128. package/node_modules/@orient-cli/ai/dist/providers/mistral.js.map +1 -0
  129. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.d.ts +9 -0
  130. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.d.ts.map +1 -0
  131. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.js +741 -0
  132. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.js.map +1 -0
  133. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.d.ts +15 -0
  134. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.d.ts.map +1 -0
  135. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.js +753 -0
  136. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.js.map +1 -0
  137. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.d.ts +17 -0
  138. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.d.ts.map +1 -0
  139. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.js +470 -0
  140. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.js.map +1 -0
  141. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.d.ts +13 -0
  142. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.d.ts.map +1 -0
  143. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.js +190 -0
  144. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.js.map +1 -0
  145. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.d.ts +38 -0
  146. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.d.ts.map +1 -0
  147. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.js +261 -0
  148. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.js.map +1 -0
  149. package/node_modules/@orient-cli/ai/dist/providers/simple-options.d.ts +8 -0
  150. package/node_modules/@orient-cli/ai/dist/providers/simple-options.d.ts.map +1 -0
  151. package/node_modules/@orient-cli/ai/dist/providers/simple-options.js +35 -0
  152. package/node_modules/@orient-cli/ai/dist/providers/simple-options.js.map +1 -0
  153. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.d.ts +8 -0
  154. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.d.ts.map +1 -0
  155. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.js +155 -0
  156. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.js.map +1 -0
  157. package/node_modules/@orient-cli/ai/dist/stream.d.ts +8 -0
  158. package/node_modules/@orient-cli/ai/dist/stream.d.ts.map +1 -0
  159. package/node_modules/@orient-cli/ai/dist/stream.js +27 -0
  160. package/node_modules/@orient-cli/ai/dist/stream.js.map +1 -0
  161. package/node_modules/@orient-cli/ai/dist/types.d.ts +353 -0
  162. package/node_modules/@orient-cli/ai/dist/types.d.ts.map +1 -0
  163. package/node_modules/@orient-cli/ai/dist/types.js +2 -0
  164. package/node_modules/@orient-cli/ai/dist/types.js.map +1 -0
  165. package/node_modules/@orient-cli/ai/dist/utils/event-stream.d.ts +21 -0
  166. package/node_modules/@orient-cli/ai/dist/utils/event-stream.d.ts.map +1 -0
  167. package/node_modules/@orient-cli/ai/dist/utils/event-stream.js +81 -0
  168. package/node_modules/@orient-cli/ai/dist/utils/event-stream.js.map +1 -0
  169. package/node_modules/@orient-cli/ai/dist/utils/hash.d.ts +3 -0
  170. package/node_modules/@orient-cli/ai/dist/utils/hash.d.ts.map +1 -0
  171. package/node_modules/@orient-cli/ai/dist/utils/hash.js +14 -0
  172. package/node_modules/@orient-cli/ai/dist/utils/hash.js.map +1 -0
  173. package/node_modules/@orient-cli/ai/dist/utils/json-parse.d.ts +9 -0
  174. package/node_modules/@orient-cli/ai/dist/utils/json-parse.d.ts.map +1 -0
  175. package/node_modules/@orient-cli/ai/dist/utils/json-parse.js +29 -0
  176. package/node_modules/@orient-cli/ai/dist/utils/json-parse.js.map +1 -0
  177. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.d.ts +25 -0
  178. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.d.ts.map +1 -0
  179. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.js +335 -0
  180. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.js.map +1 -0
  181. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.d.ts +30 -0
  182. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.d.ts.map +1 -0
  183. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.js +292 -0
  184. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.js.map +1 -0
  185. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.d.ts +26 -0
  186. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -0
  187. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.js +376 -0
  188. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.js.map +1 -0
  189. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.d.ts +26 -0
  190. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -0
  191. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.js +481 -0
  192. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.js.map +1 -0
  193. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.d.ts +61 -0
  194. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.d.ts.map +1 -0
  195. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.js +131 -0
  196. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.js.map +1 -0
  197. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.d.ts +3 -0
  198. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.d.ts.map +1 -0
  199. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.js +105 -0
  200. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.js.map +1 -0
  201. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.d.ts +34 -0
  202. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.d.ts.map +1 -0
  203. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.js +373 -0
  204. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.js.map +1 -0
  205. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.d.ts +13 -0
  206. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.d.ts.map +1 -0
  207. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.js +31 -0
  208. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.js.map +1 -0
  209. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.d.ts +47 -0
  210. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.d.ts.map +1 -0
  211. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.js +2 -0
  212. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.js.map +1 -0
  213. package/node_modules/@orient-cli/ai/dist/utils/overflow.d.ts +53 -0
  214. package/node_modules/@orient-cli/ai/dist/utils/overflow.d.ts.map +1 -0
  215. package/node_modules/@orient-cli/ai/dist/utils/overflow.js +132 -0
  216. package/node_modules/@orient-cli/ai/dist/utils/overflow.js.map +1 -0
  217. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.d.ts +22 -0
  218. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.d.ts.map +1 -0
  219. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.js +26 -0
  220. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.js.map +1 -0
  221. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.d.ts +17 -0
  222. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.d.ts.map +1 -0
  223. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.js +21 -0
  224. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.js.map +1 -0
  225. package/node_modules/@orient-cli/ai/dist/utils/validation.d.ts +18 -0
  226. package/node_modules/@orient-cli/ai/dist/utils/validation.d.ts.map +1 -0
  227. package/node_modules/@orient-cli/ai/dist/utils/validation.js +80 -0
  228. package/node_modules/@orient-cli/ai/dist/utils/validation.js.map +1 -0
  229. package/node_modules/@orient-cli/ai/package.json +114 -0
  230. package/node_modules/@orient-cli/coding-agent/README.md +618 -0
  231. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.d.ts +3 -0
  232. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.d.ts.map +1 -0
  233. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.js +7 -0
  234. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.js.map +1 -0
  235. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.d.ts +2 -0
  236. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.d.ts.map +1 -0
  237. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.js +4 -0
  238. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.js.map +1 -0
  239. package/node_modules/@orient-cli/coding-agent/dist/cli/args.d.ts +52 -0
  240. package/node_modules/@orient-cli/coding-agent/dist/cli/args.d.ts.map +1 -0
  241. package/node_modules/@orient-cli/coding-agent/dist/cli/args.js +326 -0
  242. package/node_modules/@orient-cli/coding-agent/dist/cli/args.js.map +1 -0
  243. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.d.ts +14 -0
  244. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.d.ts.map +1 -0
  245. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.js +31 -0
  246. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.js.map +1 -0
  247. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.d.ts +15 -0
  248. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.d.ts.map +1 -0
  249. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.js +83 -0
  250. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.js.map +1 -0
  251. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.d.ts +18 -0
  252. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.d.ts.map +1 -0
  253. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.js +22 -0
  254. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.js.map +1 -0
  255. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.d.ts +9 -0
  256. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.d.ts.map +1 -0
  257. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.js +92 -0
  258. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.js.map +1 -0
  259. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.d.ts +9 -0
  260. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.d.ts.map +1 -0
  261. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.js +35 -0
  262. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.js.map +1 -0
  263. package/node_modules/@orient-cli/coding-agent/dist/cli.d.ts +3 -0
  264. package/node_modules/@orient-cli/coding-agent/dist/cli.d.ts.map +1 -0
  265. package/node_modules/@orient-cli/coding-agent/dist/cli.js +15 -0
  266. package/node_modules/@orient-cli/coding-agent/dist/cli.js.map +1 -0
  267. package/node_modules/@orient-cli/coding-agent/dist/config.d.ts +77 -0
  268. package/node_modules/@orient-cli/coding-agent/dist/config.d.ts.map +1 -0
  269. package/node_modules/@orient-cli/coding-agent/dist/config.js +229 -0
  270. package/node_modules/@orient-cli/coding-agent/dist/config.js.map +1 -0
  271. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.d.ts +83 -0
  272. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.d.ts.map +1 -0
  273. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.js +236 -0
  274. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.js.map +1 -0
  275. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.d.ts +86 -0
  276. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.d.ts.map +1 -0
  277. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.js +116 -0
  278. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.js.map +1 -0
  279. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.d.ts +585 -0
  280. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.d.ts.map +1 -0
  281. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.js +2497 -0
  282. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.js.map +1 -0
  283. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.d.ts +132 -0
  284. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.d.ts.map +1 -0
  285. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.js +422 -0
  286. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.js.map +1 -0
  287. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.d.ts +46 -0
  288. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.d.ts.map +1 -0
  289. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.js +125 -0
  290. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.js.map +1 -0
  291. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.d.ts +88 -0
  292. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -0
  293. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.js +243 -0
  294. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.js.map +1 -0
  295. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.d.ts +121 -0
  296. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.d.ts.map +1 -0
  297. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.js +613 -0
  298. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.js.map +1 -0
  299. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.d.ts +7 -0
  300. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.d.ts.map +1 -0
  301. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.js +7 -0
  302. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.js.map +1 -0
  303. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.d.ts +38 -0
  304. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.d.ts.map +1 -0
  305. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.js +153 -0
  306. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.js.map +1 -0
  307. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.d.ts +3 -0
  308. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.d.ts.map +1 -0
  309. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.js +2 -0
  310. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.js.map +1 -0
  311. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.d.ts +15 -0
  312. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.d.ts.map +1 -0
  313. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.js +2 -0
  314. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.js.map +1 -0
  315. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.d.ts +9 -0
  316. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.d.ts.map +1 -0
  317. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.js +25 -0
  318. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.js.map +1 -0
  319. package/node_modules/@orient-cli/coding-agent/dist/core/exec.d.ts +29 -0
  320. package/node_modules/@orient-cli/coding-agent/dist/core/exec.d.ts.map +1 -0
  321. package/node_modules/@orient-cli/coding-agent/dist/core/exec.js +75 -0
  322. package/node_modules/@orient-cli/coding-agent/dist/core/exec.js.map +1 -0
  323. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.d.ts +22 -0
  324. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
  325. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.js +249 -0
  326. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -0
  327. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.d.ts +37 -0
  328. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.d.ts.map +1 -0
  329. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.js +224 -0
  330. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.js.map +1 -0
  331. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/template.css +1001 -0
  332. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/template.html +55 -0
  333. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/template.js +1690 -0
  334. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.d.ts +40 -0
  335. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.d.ts.map +1 -0
  336. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.js +95 -0
  337. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.js.map +1 -0
  338. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/vendor/highlight.min.js +1213 -0
  339. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/vendor/marked.min.js +6 -0
  340. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.d.ts +12 -0
  341. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.d.ts.map +1 -0
  342. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.js +9 -0
  343. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.js.map +1 -0
  344. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.d.ts +25 -0
  345. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.d.ts.map +1 -0
  346. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.js +438 -0
  347. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.js.map +1 -0
  348. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.d.ts +148 -0
  349. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.d.ts.map +1 -0
  350. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.js +700 -0
  351. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.js.map +1 -0
  352. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.d.ts +1073 -0
  353. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.d.ts.map +1 -0
  354. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.js +45 -0
  355. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.js.map +1 -0
  356. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.d.ts +20 -0
  357. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.d.ts.map +1 -0
  358. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.js +22 -0
  359. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.js.map +1 -0
  360. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.d.ts +48 -0
  361. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.d.ts.map +1 -0
  362. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.js +314 -0
  363. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.js.map +1 -0
  364. package/node_modules/@orient-cli/coding-agent/dist/core/index.d.ts +12 -0
  365. package/node_modules/@orient-cli/coding-agent/dist/core/index.d.ts.map +1 -0
  366. package/node_modules/@orient-cli/coding-agent/dist/core/index.js +12 -0
  367. package/node_modules/@orient-cli/coding-agent/dist/core/index.js.map +1 -0
  368. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.d.ts +288 -0
  369. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.d.ts.map +1 -0
  370. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.js +240 -0
  371. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.js.map +1 -0
  372. package/node_modules/@orient-cli/coding-agent/dist/core/messages.d.ts +77 -0
  373. package/node_modules/@orient-cli/coding-agent/dist/core/messages.d.ts.map +1 -0
  374. package/node_modules/@orient-cli/coding-agent/dist/core/messages.js +123 -0
  375. package/node_modules/@orient-cli/coding-agent/dist/core/messages.js.map +1 -0
  376. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.d.ts +132 -0
  377. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.d.ts.map +1 -0
  378. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.js +612 -0
  379. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.js.map +1 -0
  380. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.d.ts +110 -0
  381. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.d.ts.map +1 -0
  382. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.js +486 -0
  383. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.js.map +1 -0
  384. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.d.ts +6 -0
  385. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.d.ts.map +1 -0
  386. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.js +59 -0
  387. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.js.map +1 -0
  388. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.d.ts +192 -0
  389. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.d.ts.map +1 -0
  390. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.js +1829 -0
  391. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.js.map +1 -0
  392. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.d.ts +51 -0
  393. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.d.ts.map +1 -0
  394. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.js +249 -0
  395. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.js.map +1 -0
  396. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.d.ts +23 -0
  397. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.d.ts.map +1 -0
  398. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.js +126 -0
  399. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.js.map +1 -0
  400. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.d.ts +185 -0
  401. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.d.ts.map +1 -0
  402. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.js +720 -0
  403. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.js.map +1 -0
  404. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.d.ts +93 -0
  405. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.d.ts.map +1 -0
  406. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.js +236 -0
  407. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.js.map +1 -0
  408. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.d.ts +19 -0
  409. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.d.ts.map +1 -0
  410. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.js +38 -0
  411. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.js.map +1 -0
  412. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.d.ts +333 -0
  413. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.d.ts.map +1 -0
  414. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.js +1105 -0
  415. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.js.map +1 -0
  416. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.d.ts +237 -0
  417. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.d.ts.map +1 -0
  418. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.js +708 -0
  419. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.js.map +1 -0
  420. package/node_modules/@orient-cli/coding-agent/dist/core/skills.d.ts +60 -0
  421. package/node_modules/@orient-cli/coding-agent/dist/core/skills.d.ts.map +1 -0
  422. package/node_modules/@orient-cli/coding-agent/dist/core/skills.js +409 -0
  423. package/node_modules/@orient-cli/coding-agent/dist/core/skills.js.map +1 -0
  424. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.d.ts +14 -0
  425. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.d.ts.map +1 -0
  426. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.js +23 -0
  427. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.js.map +1 -0
  428. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.d.ts +18 -0
  429. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.d.ts.map +1 -0
  430. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.js +19 -0
  431. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.js.map +1 -0
  432. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.d.ts +28 -0
  433. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.d.ts.map +1 -0
  434. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.js +116 -0
  435. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.js.map +1 -0
  436. package/node_modules/@orient-cli/coding-agent/dist/core/timings.d.ts +8 -0
  437. package/node_modules/@orient-cli/coding-agent/dist/core/timings.d.ts.map +1 -0
  438. package/node_modules/@orient-cli/coding-agent/dist/core/timings.js +31 -0
  439. package/node_modules/@orient-cli/coding-agent/dist/core/timings.js.map +1 -0
  440. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.d.ts +73 -0
  441. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.d.ts.map +1 -0
  442. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.js +352 -0
  443. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.js.map +1 -0
  444. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.d.ts +85 -0
  445. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.d.ts.map +1 -0
  446. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.js +337 -0
  447. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.js.map +1 -0
  448. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.d.ts +53 -0
  449. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.d.ts.map +1 -0
  450. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.js +196 -0
  451. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.js.map +1 -0
  452. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.d.ts +6 -0
  453. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
  454. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.js +37 -0
  455. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.js.map +1 -0
  456. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.d.ts +46 -0
  457. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.d.ts.map +1 -0
  458. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.js +258 -0
  459. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.js.map +1 -0
  460. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.d.ts +56 -0
  461. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.d.ts.map +1 -0
  462. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.js +293 -0
  463. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.js.map +1 -0
  464. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.d.ts +115 -0
  465. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.d.ts.map +1 -0
  466. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.js +86 -0
  467. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.js.map +1 -0
  468. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.d.ts +46 -0
  469. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.d.ts.map +1 -0
  470. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.js +172 -0
  471. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.js.map +1 -0
  472. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.d.ts +8 -0
  473. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.d.ts.map +1 -0
  474. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.js +81 -0
  475. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.js.map +1 -0
  476. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.d.ts +46 -0
  477. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.d.ts.map +1 -0
  478. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.js +225 -0
  479. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.js.map +1 -0
  480. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.d.ts +21 -0
  481. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.d.ts.map +1 -0
  482. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.js +49 -0
  483. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.js.map +1 -0
  484. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
  485. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
  486. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.js +32 -0
  487. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.js.map +1 -0
  488. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.d.ts +70 -0
  489. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.d.ts.map +1 -0
  490. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.js +205 -0
  491. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.js.map +1 -0
  492. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.d.ts +35 -0
  493. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.d.ts.map +1 -0
  494. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.js +216 -0
  495. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.js.map +1 -0
  496. package/node_modules/@orient-cli/coding-agent/dist/index.d.ts +28 -0
  497. package/node_modules/@orient-cli/coding-agent/dist/index.d.ts.map +1 -0
  498. package/node_modules/@orient-cli/coding-agent/dist/index.js +43 -0
  499. package/node_modules/@orient-cli/coding-agent/dist/index.js.map +1 -0
  500. package/node_modules/@orient-cli/coding-agent/dist/main.d.ts +8 -0
  501. package/node_modules/@orient-cli/coding-agent/dist/main.d.ts.map +1 -0
  502. package/node_modules/@orient-cli/coding-agent/dist/main.js +593 -0
  503. package/node_modules/@orient-cli/coding-agent/dist/main.js.map +1 -0
  504. package/node_modules/@orient-cli/coding-agent/dist/migrations.d.ts +33 -0
  505. package/node_modules/@orient-cli/coding-agent/dist/migrations.d.ts.map +1 -0
  506. package/node_modules/@orient-cli/coding-agent/dist/migrations.js +281 -0
  507. package/node_modules/@orient-cli/coding-agent/dist/migrations.js.map +1 -0
  508. package/node_modules/@orient-cli/coding-agent/dist/modes/index.d.ts +9 -0
  509. package/node_modules/@orient-cli/coding-agent/dist/modes/index.d.ts.map +1 -0
  510. package/node_modules/@orient-cli/coding-agent/dist/modes/index.js +8 -0
  511. package/node_modules/@orient-cli/coding-agent/dist/modes/index.js.map +1 -0
  512. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.d.ts +18 -0
  513. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
  514. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.js +107 -0
  515. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -0
  516. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.d.ts +34 -0
  517. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
  518. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.js +175 -0
  519. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -0
  520. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
  521. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
  522. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.js +51 -0
  523. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.js.map +1 -0
  524. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
  525. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
  526. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.js +44 -0
  527. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
  528. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
  529. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
  530. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.js +45 -0
  531. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
  532. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.d.ts +71 -0
  533. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
  534. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.js +479 -0
  535. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.js.map +1 -0
  536. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
  537. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
  538. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.js +33 -0
  539. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.js.map +1 -0
  540. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.d.ts +21 -0
  541. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
  542. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.js +70 -0
  543. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.js.map +1 -0
  544. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.d.ts +20 -0
  545. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
  546. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.js +79 -0
  547. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.js.map +1 -0
  548. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.d.ts +12 -0
  549. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.d.ts.map +1 -0
  550. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.js +133 -0
  551. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.js.map +1 -0
  552. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
  553. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
  554. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.js +21 -0
  555. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -0
  556. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.d.ts +20 -0
  557. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
  558. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.js +111 -0
  559. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.js.map +1 -0
  560. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.d.ts +23 -0
  561. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
  562. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.js +61 -0
  563. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.js.map +1 -0
  564. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.d.ts +24 -0
  565. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
  566. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.js +78 -0
  567. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.js.map +1 -0
  568. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.d.ts +27 -0
  569. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -0
  570. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.js +201 -0
  571. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.js.map +1 -0
  572. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.d.ts +31 -0
  573. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.d.ts.map +1 -0
  574. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.js +34 -0
  575. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.js.map +1 -0
  576. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts +8 -0
  577. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
  578. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.js +22 -0
  579. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
  580. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.d.ts +42 -0
  581. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
  582. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.js +145 -0
  583. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.js.map +1 -0
  584. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.d.ts +47 -0
  585. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
  586. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.js +275 -0
  587. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -0
  588. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.d.ts +19 -0
  589. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
  590. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.js +97 -0
  591. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.js.map +1 -0
  592. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.d.ts +53 -0
  593. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.d.ts.map +1 -0
  594. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.js +204 -0
  595. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.js.map +1 -0
  596. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts +49 -0
  597. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
  598. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.js +275 -0
  599. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
  600. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
  601. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
  602. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.js +155 -0
  603. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -0
  604. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.d.ts +95 -0
  605. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
  606. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.js +848 -0
  607. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -0
  608. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.d.ts +58 -0
  609. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
  610. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.js +301 -0
  611. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -0
  612. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
  613. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
  614. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.js +39 -0
  615. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.js.map +1 -0
  616. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
  617. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
  618. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.js +47 -0
  619. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
  620. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.d.ts +11 -0
  621. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
  622. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.js +50 -0
  623. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.js.map +1 -0
  624. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
  625. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
  626. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.js +51 -0
  627. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.js.map +1 -0
  628. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.d.ts +58 -0
  629. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
  630. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.js +274 -0
  631. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -0
  632. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.d.ts +89 -0
  633. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
  634. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.js +1084 -0
  635. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.js.map +1 -0
  636. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
  637. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
  638. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.js +113 -0
  639. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.js.map +1 -0
  640. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.d.ts +9 -0
  641. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -0
  642. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.js +28 -0
  643. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.js.map +1 -0
  644. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
  645. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
  646. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.js +33 -0
  647. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.js.map +1 -0
  648. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.d.ts +321 -0
  649. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
  650. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js +4000 -0
  651. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -0
  652. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/dark.json +85 -0
  653. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/light.json +84 -0
  654. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme-schema.json +335 -0
  655. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.d.ts +81 -0
  656. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  657. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.js +979 -0
  658. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.js.map +1 -0
  659. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.d.ts +28 -0
  660. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.d.ts.map +1 -0
  661. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.js +112 -0
  662. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.js.map +1 -0
  663. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.d.ts +17 -0
  664. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.d.ts.map +1 -0
  665. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.js +49 -0
  666. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.js.map +1 -0
  667. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.d.ts +217 -0
  668. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.d.ts.map +1 -0
  669. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.js +402 -0
  670. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.js.map +1 -0
  671. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.d.ts +20 -0
  672. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
  673. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.js +550 -0
  674. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -0
  675. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.d.ts +408 -0
  676. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.d.ts.map +1 -0
  677. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.js +8 -0
  678. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.js.map +1 -0
  679. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.d.ts +4 -0
  680. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.d.ts.map +1 -0
  681. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.js +234 -0
  682. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.js.map +1 -0
  683. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.d.ts +21 -0
  684. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.d.ts.map +1 -0
  685. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.js +87 -0
  686. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.js.map +1 -0
  687. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.d.ts +11 -0
  688. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.d.ts.map +1 -0
  689. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.js +78 -0
  690. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.js.map +1 -0
  691. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.d.ts +11 -0
  692. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.d.ts.map +1 -0
  693. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.js +245 -0
  694. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.js.map +1 -0
  695. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.d.ts +8 -0
  696. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.d.ts.map +1 -0
  697. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.js +14 -0
  698. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.js.map +1 -0
  699. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.d.ts +2 -0
  700. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.d.ts.map +1 -0
  701. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.js +78 -0
  702. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.js.map +1 -0
  703. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.d.ts +5 -0
  704. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.d.ts.map +1 -0
  705. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.js +158 -0
  706. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.js.map +1 -0
  707. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.d.ts +8 -0
  708. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.d.ts.map +1 -0
  709. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.js +26 -0
  710. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.js.map +1 -0
  711. package/node_modules/@orient-cli/coding-agent/dist/utils/git.d.ts +26 -0
  712. package/node_modules/@orient-cli/coding-agent/dist/utils/git.d.ts.map +1 -0
  713. package/node_modules/@orient-cli/coding-agent/dist/utils/git.js +163 -0
  714. package/node_modules/@orient-cli/coding-agent/dist/utils/git.js.map +1 -0
  715. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.d.ts +9 -0
  716. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.d.ts.map +1 -0
  717. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.js +39 -0
  718. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.js.map +1 -0
  719. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.d.ts +36 -0
  720. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.d.ts.map +1 -0
  721. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.js +137 -0
  722. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.js.map +1 -0
  723. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.d.ts +2 -0
  724. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.d.ts.map +1 -0
  725. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.js +26 -0
  726. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.js.map +1 -0
  727. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.d.ts +7 -0
  728. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.d.ts.map +1 -0
  729. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.js +19 -0
  730. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.js.map +1 -0
  731. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.d.ts +21 -0
  732. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.d.ts.map +1 -0
  733. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.js +121 -0
  734. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.js.map +1 -0
  735. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.d.ts +26 -0
  736. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.d.ts.map +1 -0
  737. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.js +186 -0
  738. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.js.map +1 -0
  739. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.d.ts +5 -0
  740. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.d.ts.map +1 -0
  741. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.js +17 -0
  742. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.js.map +1 -0
  743. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.d.ts +3 -0
  744. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.d.ts.map +1 -0
  745. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.js +252 -0
  746. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.js.map +1 -0
  747. package/node_modules/@orient-cli/coding-agent/package.json +104 -0
  748. package/node_modules/@orient-cli/tui/README.md +767 -0
  749. package/node_modules/@orient-cli/tui/dist/autocomplete.d.ts +52 -0
  750. package/node_modules/@orient-cli/tui/dist/autocomplete.d.ts.map +1 -0
  751. package/node_modules/@orient-cli/tui/dist/autocomplete.js +623 -0
  752. package/node_modules/@orient-cli/tui/dist/autocomplete.js.map +1 -0
  753. package/node_modules/@orient-cli/tui/dist/components/box.d.ts +22 -0
  754. package/node_modules/@orient-cli/tui/dist/components/box.d.ts.map +1 -0
  755. package/node_modules/@orient-cli/tui/dist/components/box.js +104 -0
  756. package/node_modules/@orient-cli/tui/dist/components/box.js.map +1 -0
  757. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.d.ts +22 -0
  758. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.d.ts.map +1 -0
  759. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.js +35 -0
  760. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.js.map +1 -0
  761. package/node_modules/@orient-cli/tui/dist/components/editor.d.ts +244 -0
  762. package/node_modules/@orient-cli/tui/dist/components/editor.d.ts.map +1 -0
  763. package/node_modules/@orient-cli/tui/dist/components/editor.js +1861 -0
  764. package/node_modules/@orient-cli/tui/dist/components/editor.js.map +1 -0
  765. package/node_modules/@orient-cli/tui/dist/components/image.d.ts +28 -0
  766. package/node_modules/@orient-cli/tui/dist/components/image.d.ts.map +1 -0
  767. package/node_modules/@orient-cli/tui/dist/components/image.js +69 -0
  768. package/node_modules/@orient-cli/tui/dist/components/image.js.map +1 -0
  769. package/node_modules/@orient-cli/tui/dist/components/input.d.ts +37 -0
  770. package/node_modules/@orient-cli/tui/dist/components/input.d.ts.map +1 -0
  771. package/node_modules/@orient-cli/tui/dist/components/input.js +426 -0
  772. package/node_modules/@orient-cli/tui/dist/components/input.js.map +1 -0
  773. package/node_modules/@orient-cli/tui/dist/components/loader.d.ts +21 -0
  774. package/node_modules/@orient-cli/tui/dist/components/loader.d.ts.map +1 -0
  775. package/node_modules/@orient-cli/tui/dist/components/loader.js +49 -0
  776. package/node_modules/@orient-cli/tui/dist/components/loader.js.map +1 -0
  777. package/node_modules/@orient-cli/tui/dist/components/markdown.d.ts +95 -0
  778. package/node_modules/@orient-cli/tui/dist/components/markdown.d.ts.map +1 -0
  779. package/node_modules/@orient-cli/tui/dist/components/markdown.js +663 -0
  780. package/node_modules/@orient-cli/tui/dist/components/markdown.js.map +1 -0
  781. package/node_modules/@orient-cli/tui/dist/components/select-list.d.ts +50 -0
  782. package/node_modules/@orient-cli/tui/dist/components/select-list.d.ts.map +1 -0
  783. package/node_modules/@orient-cli/tui/dist/components/select-list.js +159 -0
  784. package/node_modules/@orient-cli/tui/dist/components/select-list.js.map +1 -0
  785. package/node_modules/@orient-cli/tui/dist/components/settings-list.d.ts +50 -0
  786. package/node_modules/@orient-cli/tui/dist/components/settings-list.d.ts.map +1 -0
  787. package/node_modules/@orient-cli/tui/dist/components/settings-list.js +185 -0
  788. package/node_modules/@orient-cli/tui/dist/components/settings-list.js.map +1 -0
  789. package/node_modules/@orient-cli/tui/dist/components/spacer.d.ts +12 -0
  790. package/node_modules/@orient-cli/tui/dist/components/spacer.d.ts.map +1 -0
  791. package/node_modules/@orient-cli/tui/dist/components/spacer.js +23 -0
  792. package/node_modules/@orient-cli/tui/dist/components/spacer.js.map +1 -0
  793. package/node_modules/@orient-cli/tui/dist/components/text.d.ts +19 -0
  794. package/node_modules/@orient-cli/tui/dist/components/text.d.ts.map +1 -0
  795. package/node_modules/@orient-cli/tui/dist/components/text.js +89 -0
  796. package/node_modules/@orient-cli/tui/dist/components/text.js.map +1 -0
  797. package/node_modules/@orient-cli/tui/dist/components/truncated-text.d.ts +13 -0
  798. package/node_modules/@orient-cli/tui/dist/components/truncated-text.d.ts.map +1 -0
  799. package/node_modules/@orient-cli/tui/dist/components/truncated-text.js +51 -0
  800. package/node_modules/@orient-cli/tui/dist/components/truncated-text.js.map +1 -0
  801. package/node_modules/@orient-cli/tui/dist/editor-component.d.ts +39 -0
  802. package/node_modules/@orient-cli/tui/dist/editor-component.d.ts.map +1 -0
  803. package/node_modules/@orient-cli/tui/dist/editor-component.js +2 -0
  804. package/node_modules/@orient-cli/tui/dist/editor-component.js.map +1 -0
  805. package/node_modules/@orient-cli/tui/dist/fuzzy.d.ts +16 -0
  806. package/node_modules/@orient-cli/tui/dist/fuzzy.d.ts.map +1 -0
  807. package/node_modules/@orient-cli/tui/dist/fuzzy.js +107 -0
  808. package/node_modules/@orient-cli/tui/dist/fuzzy.js.map +1 -0
  809. package/node_modules/@orient-cli/tui/dist/index.d.ts +23 -0
  810. package/node_modules/@orient-cli/tui/dist/index.d.ts.map +1 -0
  811. package/node_modules/@orient-cli/tui/dist/index.js +32 -0
  812. package/node_modules/@orient-cli/tui/dist/index.js.map +1 -0
  813. package/node_modules/@orient-cli/tui/dist/keybindings.d.ts +193 -0
  814. package/node_modules/@orient-cli/tui/dist/keybindings.d.ts.map +1 -0
  815. package/node_modules/@orient-cli/tui/dist/keybindings.js +174 -0
  816. package/node_modules/@orient-cli/tui/dist/keybindings.js.map +1 -0
  817. package/node_modules/@orient-cli/tui/dist/keys.d.ts +170 -0
  818. package/node_modules/@orient-cli/tui/dist/keys.d.ts.map +1 -0
  819. package/node_modules/@orient-cli/tui/dist/keys.js +1124 -0
  820. package/node_modules/@orient-cli/tui/dist/keys.js.map +1 -0
  821. package/node_modules/@orient-cli/tui/dist/kill-ring.d.ts +28 -0
  822. package/node_modules/@orient-cli/tui/dist/kill-ring.d.ts.map +1 -0
  823. package/node_modules/@orient-cli/tui/dist/kill-ring.js +44 -0
  824. package/node_modules/@orient-cli/tui/dist/kill-ring.js.map +1 -0
  825. package/node_modules/@orient-cli/tui/dist/stdin-buffer.d.ts +48 -0
  826. package/node_modules/@orient-cli/tui/dist/stdin-buffer.d.ts.map +1 -0
  827. package/node_modules/@orient-cli/tui/dist/stdin-buffer.js +317 -0
  828. package/node_modules/@orient-cli/tui/dist/stdin-buffer.js.map +1 -0
  829. package/node_modules/@orient-cli/tui/dist/terminal-image.d.ts +68 -0
  830. package/node_modules/@orient-cli/tui/dist/terminal-image.d.ts.map +1 -0
  831. package/node_modules/@orient-cli/tui/dist/terminal-image.js +288 -0
  832. package/node_modules/@orient-cli/tui/dist/terminal-image.js.map +1 -0
  833. package/node_modules/@orient-cli/tui/dist/terminal.d.ts +84 -0
  834. package/node_modules/@orient-cli/tui/dist/terminal.d.ts.map +1 -0
  835. package/node_modules/@orient-cli/tui/dist/terminal.js +285 -0
  836. package/node_modules/@orient-cli/tui/dist/terminal.js.map +1 -0
  837. package/node_modules/@orient-cli/tui/dist/tui.d.ts +222 -0
  838. package/node_modules/@orient-cli/tui/dist/tui.d.ts.map +1 -0
  839. package/node_modules/@orient-cli/tui/dist/tui.js +1008 -0
  840. package/node_modules/@orient-cli/tui/dist/tui.js.map +1 -0
  841. package/node_modules/@orient-cli/tui/dist/undo-stack.d.ts +17 -0
  842. package/node_modules/@orient-cli/tui/dist/undo-stack.d.ts.map +1 -0
  843. package/node_modules/@orient-cli/tui/dist/undo-stack.js +25 -0
  844. package/node_modules/@orient-cli/tui/dist/undo-stack.js.map +1 -0
  845. package/node_modules/@orient-cli/tui/dist/utils.d.ts +78 -0
  846. package/node_modules/@orient-cli/tui/dist/utils.d.ts.map +1 -0
  847. package/node_modules/@orient-cli/tui/dist/utils.js +960 -0
  848. package/node_modules/@orient-cli/tui/dist/utils.js.map +1 -0
  849. package/node_modules/@orient-cli/tui/package.json +52 -0
  850. package/package.json +47 -8
  851. package/schemas/orient-standard/templates-tier-1/brief.md +22 -0
  852. package/schemas/orient-standard/templates-tier-1/plan.md +17 -0
  853. package/schemas/orient-standard/templates-tier-1/spec.md +23 -0
  854. package/schemas/orient-standard/templates-tier-1/tasks.md +14 -0
  855. package/schemas/orient-standard/templates-tier-2/brief.md +32 -0
  856. package/schemas/orient-standard/templates-tier-2/plan.md +44 -0
  857. package/schemas/orient-standard/templates-tier-2/spec.md +46 -0
  858. package/schemas/orient-standard/templates-tier-2/tasks.md +34 -0
  859. package/schemas/orient-standard/templates-tier-3/brief.md +54 -0
  860. package/schemas/orient-standard/templates-tier-3/plan.md +67 -0
  861. package/schemas/orient-standard/templates-tier-3/spec.md +65 -0
  862. package/schemas/orient-standard/templates-tier-3/tasks.md +79 -0
@@ -0,0 +1,373 @@
1
+ /**
2
+ * OpenAI Codex (ChatGPT OAuth) flow
3
+ *
4
+ * NOTE: This module uses Node.js crypto and http for the OAuth callback.
5
+ * It is only intended for CLI use, not browser environments.
6
+ */
7
+ // NEVER convert to top-level imports - breaks browser/Vite builds (web-ui)
8
+ let _randomBytes = null;
9
+ let _http = null;
10
+ if (typeof process !== "undefined" && (process.versions?.node || process.versions?.bun)) {
11
+ import("node:crypto").then((m) => {
12
+ _randomBytes = m.randomBytes;
13
+ });
14
+ import("node:http").then((m) => {
15
+ _http = m;
16
+ });
17
+ }
18
+ import { oauthErrorHtml, oauthSuccessHtml } from "./oauth-page.js";
19
+ import { generatePKCE } from "./pkce.js";
20
+ const CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
21
+ const AUTHORIZE_URL = "https://auth.openai.com/oauth/authorize";
22
+ const TOKEN_URL = "https://auth.openai.com/oauth/token";
23
+ const REDIRECT_URI = "http://localhost:1455/auth/callback";
24
+ const SCOPE = "openid profile email offline_access";
25
+ const JWT_CLAIM_PATH = "https://api.openai.com/auth";
26
+ function createState() {
27
+ if (!_randomBytes) {
28
+ throw new Error("OpenAI Codex OAuth is only available in Node.js environments");
29
+ }
30
+ return _randomBytes(16).toString("hex");
31
+ }
32
+ function parseAuthorizationInput(input) {
33
+ const value = input.trim();
34
+ if (!value)
35
+ return {};
36
+ try {
37
+ const url = new URL(value);
38
+ return {
39
+ code: url.searchParams.get("code") ?? undefined,
40
+ state: url.searchParams.get("state") ?? undefined,
41
+ };
42
+ }
43
+ catch {
44
+ // not a URL
45
+ }
46
+ if (value.includes("#")) {
47
+ const [code, state] = value.split("#", 2);
48
+ return { code, state };
49
+ }
50
+ if (value.includes("code=")) {
51
+ const params = new URLSearchParams(value);
52
+ return {
53
+ code: params.get("code") ?? undefined,
54
+ state: params.get("state") ?? undefined,
55
+ };
56
+ }
57
+ return { code: value };
58
+ }
59
+ function decodeJwt(token) {
60
+ try {
61
+ const parts = token.split(".");
62
+ if (parts.length !== 3)
63
+ return null;
64
+ const payload = parts[1] ?? "";
65
+ const decoded = atob(payload);
66
+ return JSON.parse(decoded);
67
+ }
68
+ catch {
69
+ return null;
70
+ }
71
+ }
72
+ async function exchangeAuthorizationCode(code, verifier, redirectUri = REDIRECT_URI) {
73
+ const response = await fetch(TOKEN_URL, {
74
+ method: "POST",
75
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
76
+ body: new URLSearchParams({
77
+ grant_type: "authorization_code",
78
+ client_id: CLIENT_ID,
79
+ code,
80
+ code_verifier: verifier,
81
+ redirect_uri: redirectUri,
82
+ }),
83
+ });
84
+ if (!response.ok) {
85
+ const text = await response.text().catch(() => "");
86
+ console.error("[openai-codex] code->token failed:", response.status, text);
87
+ return { type: "failed" };
88
+ }
89
+ const json = (await response.json());
90
+ if (!json.access_token || !json.refresh_token || typeof json.expires_in !== "number") {
91
+ console.error("[openai-codex] token response missing fields:", json);
92
+ return { type: "failed" };
93
+ }
94
+ return {
95
+ type: "success",
96
+ access: json.access_token,
97
+ refresh: json.refresh_token,
98
+ expires: Date.now() + json.expires_in * 1000,
99
+ };
100
+ }
101
+ async function refreshAccessToken(refreshToken) {
102
+ try {
103
+ const response = await fetch(TOKEN_URL, {
104
+ method: "POST",
105
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
106
+ body: new URLSearchParams({
107
+ grant_type: "refresh_token",
108
+ refresh_token: refreshToken,
109
+ client_id: CLIENT_ID,
110
+ }),
111
+ });
112
+ if (!response.ok) {
113
+ const text = await response.text().catch(() => "");
114
+ console.error("[openai-codex] Token refresh failed:", response.status, text);
115
+ return { type: "failed" };
116
+ }
117
+ const json = (await response.json());
118
+ if (!json.access_token || !json.refresh_token || typeof json.expires_in !== "number") {
119
+ console.error("[openai-codex] Token refresh response missing fields:", json);
120
+ return { type: "failed" };
121
+ }
122
+ return {
123
+ type: "success",
124
+ access: json.access_token,
125
+ refresh: json.refresh_token,
126
+ expires: Date.now() + json.expires_in * 1000,
127
+ };
128
+ }
129
+ catch (error) {
130
+ console.error("[openai-codex] Token refresh error:", error);
131
+ return { type: "failed" };
132
+ }
133
+ }
134
+ async function createAuthorizationFlow(originator = "pi") {
135
+ const { verifier, challenge } = await generatePKCE();
136
+ const state = createState();
137
+ const url = new URL(AUTHORIZE_URL);
138
+ url.searchParams.set("response_type", "code");
139
+ url.searchParams.set("client_id", CLIENT_ID);
140
+ url.searchParams.set("redirect_uri", REDIRECT_URI);
141
+ url.searchParams.set("scope", SCOPE);
142
+ url.searchParams.set("code_challenge", challenge);
143
+ url.searchParams.set("code_challenge_method", "S256");
144
+ url.searchParams.set("state", state);
145
+ url.searchParams.set("id_token_add_organizations", "true");
146
+ url.searchParams.set("codex_cli_simplified_flow", "true");
147
+ url.searchParams.set("originator", originator);
148
+ return { verifier, state, url: url.toString() };
149
+ }
150
+ function startLocalOAuthServer(state) {
151
+ if (!_http) {
152
+ throw new Error("OpenAI Codex OAuth is only available in Node.js environments");
153
+ }
154
+ let settleWait;
155
+ const waitForCodePromise = new Promise((resolve) => {
156
+ let settled = false;
157
+ settleWait = (value) => {
158
+ if (settled)
159
+ return;
160
+ settled = true;
161
+ resolve(value);
162
+ };
163
+ });
164
+ const server = _http.createServer((req, res) => {
165
+ try {
166
+ const url = new URL(req.url || "", "http://localhost");
167
+ if (url.pathname !== "/auth/callback") {
168
+ res.statusCode = 404;
169
+ res.setHeader("Content-Type", "text/html; charset=utf-8");
170
+ res.end(oauthErrorHtml("Callback route not found."));
171
+ return;
172
+ }
173
+ if (url.searchParams.get("state") !== state) {
174
+ res.statusCode = 400;
175
+ res.setHeader("Content-Type", "text/html; charset=utf-8");
176
+ res.end(oauthErrorHtml("State mismatch."));
177
+ return;
178
+ }
179
+ const code = url.searchParams.get("code");
180
+ if (!code) {
181
+ res.statusCode = 400;
182
+ res.setHeader("Content-Type", "text/html; charset=utf-8");
183
+ res.end(oauthErrorHtml("Missing authorization code."));
184
+ return;
185
+ }
186
+ res.statusCode = 200;
187
+ res.setHeader("Content-Type", "text/html; charset=utf-8");
188
+ res.end(oauthSuccessHtml("OpenAI authentication completed. You can close this window."));
189
+ settleWait?.({ code });
190
+ }
191
+ catch {
192
+ res.statusCode = 500;
193
+ res.setHeader("Content-Type", "text/html; charset=utf-8");
194
+ res.end(oauthErrorHtml("Internal error while processing OAuth callback."));
195
+ }
196
+ });
197
+ return new Promise((resolve) => {
198
+ server
199
+ .listen(1455, "127.0.0.1", () => {
200
+ resolve({
201
+ close: () => server.close(),
202
+ cancelWait: () => {
203
+ settleWait?.(null);
204
+ },
205
+ waitForCode: () => waitForCodePromise,
206
+ });
207
+ })
208
+ .on("error", (err) => {
209
+ console.error("[openai-codex] Failed to bind http://127.0.0.1:1455 (", err.code, ") Falling back to manual paste.");
210
+ settleWait?.(null);
211
+ resolve({
212
+ close: () => {
213
+ try {
214
+ server.close();
215
+ }
216
+ catch {
217
+ // ignore
218
+ }
219
+ },
220
+ cancelWait: () => { },
221
+ waitForCode: async () => null,
222
+ });
223
+ });
224
+ });
225
+ }
226
+ function getAccountId(accessToken) {
227
+ const payload = decodeJwt(accessToken);
228
+ const auth = payload?.[JWT_CLAIM_PATH];
229
+ const accountId = auth?.chatgpt_account_id;
230
+ return typeof accountId === "string" && accountId.length > 0 ? accountId : null;
231
+ }
232
+ /**
233
+ * Login with OpenAI Codex OAuth
234
+ *
235
+ * @param options.onAuth - Called with URL and instructions when auth starts
236
+ * @param options.onPrompt - Called to prompt user for manual code paste (fallback if no onManualCodeInput)
237
+ * @param options.onProgress - Optional progress messages
238
+ * @param options.onManualCodeInput - Optional promise that resolves with user-pasted code.
239
+ * Races with browser callback - whichever completes first wins.
240
+ * Useful for showing paste input immediately alongside browser flow.
241
+ * @param options.originator - OAuth originator parameter (defaults to "pi")
242
+ */
243
+ export async function loginOpenAICodex(options) {
244
+ const { verifier, state, url } = await createAuthorizationFlow(options.originator);
245
+ const server = await startLocalOAuthServer(state);
246
+ options.onAuth({ url, instructions: "A browser window should open. Complete login to finish." });
247
+ let code;
248
+ try {
249
+ if (options.onManualCodeInput) {
250
+ // Race between browser callback and manual input
251
+ let manualCode;
252
+ let manualError;
253
+ const manualPromise = options
254
+ .onManualCodeInput()
255
+ .then((input) => {
256
+ manualCode = input;
257
+ server.cancelWait();
258
+ })
259
+ .catch((err) => {
260
+ manualError = err instanceof Error ? err : new Error(String(err));
261
+ server.cancelWait();
262
+ });
263
+ const result = await server.waitForCode();
264
+ // If manual input was cancelled, throw that error
265
+ if (manualError) {
266
+ throw manualError;
267
+ }
268
+ if (result?.code) {
269
+ // Browser callback won
270
+ code = result.code;
271
+ }
272
+ else if (manualCode) {
273
+ // Manual input won (or callback timed out and user had entered code)
274
+ const parsed = parseAuthorizationInput(manualCode);
275
+ if (parsed.state && parsed.state !== state) {
276
+ throw new Error("State mismatch");
277
+ }
278
+ code = parsed.code;
279
+ }
280
+ // If still no code, wait for manual promise to complete and try that
281
+ if (!code) {
282
+ await manualPromise;
283
+ if (manualError) {
284
+ throw manualError;
285
+ }
286
+ if (manualCode) {
287
+ const parsed = parseAuthorizationInput(manualCode);
288
+ if (parsed.state && parsed.state !== state) {
289
+ throw new Error("State mismatch");
290
+ }
291
+ code = parsed.code;
292
+ }
293
+ }
294
+ }
295
+ else {
296
+ // Original flow: wait for callback, then prompt if needed
297
+ const result = await server.waitForCode();
298
+ if (result?.code) {
299
+ code = result.code;
300
+ }
301
+ }
302
+ // Fallback to onPrompt if still no code
303
+ if (!code) {
304
+ const input = await options.onPrompt({
305
+ message: "Paste the authorization code (or full redirect URL):",
306
+ });
307
+ const parsed = parseAuthorizationInput(input);
308
+ if (parsed.state && parsed.state !== state) {
309
+ throw new Error("State mismatch");
310
+ }
311
+ code = parsed.code;
312
+ }
313
+ if (!code) {
314
+ throw new Error("Missing authorization code");
315
+ }
316
+ const tokenResult = await exchangeAuthorizationCode(code, verifier);
317
+ if (tokenResult.type !== "success") {
318
+ throw new Error("Token exchange failed");
319
+ }
320
+ const accountId = getAccountId(tokenResult.access);
321
+ if (!accountId) {
322
+ throw new Error("Failed to extract accountId from token");
323
+ }
324
+ return {
325
+ access: tokenResult.access,
326
+ refresh: tokenResult.refresh,
327
+ expires: tokenResult.expires,
328
+ accountId,
329
+ };
330
+ }
331
+ finally {
332
+ server.close();
333
+ }
334
+ }
335
+ /**
336
+ * Refresh OpenAI Codex OAuth token
337
+ */
338
+ export async function refreshOpenAICodexToken(refreshToken) {
339
+ const result = await refreshAccessToken(refreshToken);
340
+ if (result.type !== "success") {
341
+ throw new Error("Failed to refresh OpenAI Codex token");
342
+ }
343
+ const accountId = getAccountId(result.access);
344
+ if (!accountId) {
345
+ throw new Error("Failed to extract accountId from token");
346
+ }
347
+ return {
348
+ access: result.access,
349
+ refresh: result.refresh,
350
+ expires: result.expires,
351
+ accountId,
352
+ };
353
+ }
354
+ export const openaiCodexOAuthProvider = {
355
+ id: "openai-codex",
356
+ name: "ChatGPT Plus/Pro (Codex Subscription)",
357
+ usesCallbackServer: true,
358
+ async login(callbacks) {
359
+ return loginOpenAICodex({
360
+ onAuth: callbacks.onAuth,
361
+ onPrompt: callbacks.onPrompt,
362
+ onProgress: callbacks.onProgress,
363
+ onManualCodeInput: callbacks.onManualCodeInput,
364
+ });
365
+ },
366
+ async refreshToken(credentials) {
367
+ return refreshOpenAICodexToken(credentials.refresh);
368
+ },
369
+ getApiKey(credentials) {
370
+ return credentials.access;
371
+ },
372
+ };
373
+ //# sourceMappingURL=openai-codex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-codex.js","sourceRoot":"","sources":["../../../src/utils/oauth/openai-codex.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,2EAA2E;AAC3E,IAAI,YAAY,GAAoD,IAAI,CAAC;AACzE,IAAI,KAAK,GAAsC,IAAI,CAAC;AACpD,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;IACzF,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACjC,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC;IAAA,CAC7B,CAAC,CAAC;IACH,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QAC/B,KAAK,GAAG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YAAY,CAAC,CAAC;IACtD,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9C,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO;QACN,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,SAAS;KACT,CAAC;AAAA,CACF;AAED,MAAM,CAAC,MAAM,wBAAwB,GAA2B;IAC/D,EAAE,EAAE,cAAc;IAClB,IAAI,EAAE,uCAAuC;IAC7C,kBAAkB,EAAE,IAAI;IAExB,KAAK,CAAC,KAAK,CAAC,SAA8B,EAA6B;QACtE,OAAO,gBAAgB,CAAC;YACvB,MAAM,EAAE,SAAS,CAAC,MAAM;YACxB,QAAQ,EAAE,SAAS,CAAC,QAAQ;YAC5B,UAAU,EAAE,SAAS,CAAC,UAAU;YAChC,iBAAiB,EAAE,SAAS,CAAC,iBAAiB;SAC9C,CAAC,CAAC;IAAA,CACH;IAED,KAAK,CAAC,YAAY,CAAC,WAA6B,EAA6B;QAC5E,OAAO,uBAAuB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAAA,CACpD;IAED,SAAS,CAAC,WAA6B,EAAU;QAChD,OAAO,WAAW,CAAC,MAAM,CAAC;IAAA,CAC1B;CACD,CAAC","sourcesContent":["/**\n * OpenAI Codex (ChatGPT OAuth) flow\n *\n * NOTE: This module uses Node.js crypto and http for the OAuth callback.\n * It is only intended for CLI use, not browser environments.\n */\n\n// NEVER convert to top-level imports - breaks browser/Vite builds (web-ui)\nlet _randomBytes: typeof import(\"node:crypto\").randomBytes | null = null;\nlet _http: typeof import(\"node:http\") | null = null;\nif (typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun)) {\n\timport(\"node:crypto\").then((m) => {\n\t\t_randomBytes = m.randomBytes;\n\t});\n\timport(\"node:http\").then((m) => {\n\t\t_http = m;\n\t});\n}\n\nimport { oauthErrorHtml, oauthSuccessHtml } from \"./oauth-page.js\";\nimport { generatePKCE } from \"./pkce.js\";\nimport type { OAuthCredentials, OAuthLoginCallbacks, OAuthPrompt, OAuthProviderInterface } from \"./types.js\";\n\nconst CLIENT_ID = \"app_EMoamEEZ73f0CkXaXp7hrann\";\nconst AUTHORIZE_URL = \"https://auth.openai.com/oauth/authorize\";\nconst TOKEN_URL = \"https://auth.openai.com/oauth/token\";\nconst REDIRECT_URI = \"http://localhost:1455/auth/callback\";\nconst SCOPE = \"openid profile email offline_access\";\nconst JWT_CLAIM_PATH = \"https://api.openai.com/auth\";\n\ntype TokenSuccess = { type: \"success\"; access: string; refresh: string; expires: number };\ntype TokenFailure = { type: \"failed\" };\ntype TokenResult = TokenSuccess | TokenFailure;\n\ntype JwtPayload = {\n\t[JWT_CLAIM_PATH]?: {\n\t\tchatgpt_account_id?: string;\n\t};\n\t[key: string]: unknown;\n};\n\nfunction createState(): string {\n\tif (!_randomBytes) {\n\t\tthrow new Error(\"OpenAI Codex OAuth is only available in Node.js environments\");\n\t}\n\treturn _randomBytes(16).toString(\"hex\");\n}\n\nfunction parseAuthorizationInput(input: string): { code?: string; state?: string } {\n\tconst value = input.trim();\n\tif (!value) return {};\n\n\ttry {\n\t\tconst url = new URL(value);\n\t\treturn {\n\t\t\tcode: url.searchParams.get(\"code\") ?? undefined,\n\t\t\tstate: url.searchParams.get(\"state\") ?? undefined,\n\t\t};\n\t} catch {\n\t\t// not a URL\n\t}\n\n\tif (value.includes(\"#\")) {\n\t\tconst [code, state] = value.split(\"#\", 2);\n\t\treturn { code, state };\n\t}\n\n\tif (value.includes(\"code=\")) {\n\t\tconst params = new URLSearchParams(value);\n\t\treturn {\n\t\t\tcode: params.get(\"code\") ?? undefined,\n\t\t\tstate: params.get(\"state\") ?? undefined,\n\t\t};\n\t}\n\n\treturn { code: value };\n}\n\nfunction decodeJwt(token: string): JwtPayload | null {\n\ttry {\n\t\tconst parts = token.split(\".\");\n\t\tif (parts.length !== 3) return null;\n\t\tconst payload = parts[1] ?? \"\";\n\t\tconst decoded = atob(payload);\n\t\treturn JSON.parse(decoded) as JwtPayload;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nasync function exchangeAuthorizationCode(\n\tcode: string,\n\tverifier: string,\n\tredirectUri: string = REDIRECT_URI,\n): Promise<TokenResult> {\n\tconst response = await fetch(TOKEN_URL, {\n\t\tmethod: \"POST\",\n\t\theaders: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n\t\tbody: new URLSearchParams({\n\t\t\tgrant_type: \"authorization_code\",\n\t\t\tclient_id: CLIENT_ID,\n\t\t\tcode,\n\t\t\tcode_verifier: verifier,\n\t\t\tredirect_uri: redirectUri,\n\t\t}),\n\t});\n\n\tif (!response.ok) {\n\t\tconst text = await response.text().catch(() => \"\");\n\t\tconsole.error(\"[openai-codex] code->token failed:\", response.status, text);\n\t\treturn { type: \"failed\" };\n\t}\n\n\tconst json = (await response.json()) as {\n\t\taccess_token?: string;\n\t\trefresh_token?: string;\n\t\texpires_in?: number;\n\t};\n\n\tif (!json.access_token || !json.refresh_token || typeof json.expires_in !== \"number\") {\n\t\tconsole.error(\"[openai-codex] token response missing fields:\", json);\n\t\treturn { type: \"failed\" };\n\t}\n\n\treturn {\n\t\ttype: \"success\",\n\t\taccess: json.access_token,\n\t\trefresh: json.refresh_token,\n\t\texpires: Date.now() + json.expires_in * 1000,\n\t};\n}\n\nasync function refreshAccessToken(refreshToken: string): Promise<TokenResult> {\n\ttry {\n\t\tconst response = await fetch(TOKEN_URL, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n\t\t\tbody: new URLSearchParams({\n\t\t\t\tgrant_type: \"refresh_token\",\n\t\t\t\trefresh_token: refreshToken,\n\t\t\t\tclient_id: CLIENT_ID,\n\t\t\t}),\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tconst text = await response.text().catch(() => \"\");\n\t\t\tconsole.error(\"[openai-codex] Token refresh failed:\", response.status, text);\n\t\t\treturn { type: \"failed\" };\n\t\t}\n\n\t\tconst json = (await response.json()) as {\n\t\t\taccess_token?: string;\n\t\t\trefresh_token?: string;\n\t\t\texpires_in?: number;\n\t\t};\n\n\t\tif (!json.access_token || !json.refresh_token || typeof json.expires_in !== \"number\") {\n\t\t\tconsole.error(\"[openai-codex] Token refresh response missing fields:\", json);\n\t\t\treturn { type: \"failed\" };\n\t\t}\n\n\t\treturn {\n\t\t\ttype: \"success\",\n\t\t\taccess: json.access_token,\n\t\t\trefresh: json.refresh_token,\n\t\t\texpires: Date.now() + json.expires_in * 1000,\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"[openai-codex] Token refresh error:\", error);\n\t\treturn { type: \"failed\" };\n\t}\n}\n\nasync function createAuthorizationFlow(\n\toriginator: string = \"pi\",\n): Promise<{ verifier: string; state: string; url: string }> {\n\tconst { verifier, challenge } = await generatePKCE();\n\tconst state = createState();\n\n\tconst url = new URL(AUTHORIZE_URL);\n\turl.searchParams.set(\"response_type\", \"code\");\n\turl.searchParams.set(\"client_id\", CLIENT_ID);\n\turl.searchParams.set(\"redirect_uri\", REDIRECT_URI);\n\turl.searchParams.set(\"scope\", SCOPE);\n\turl.searchParams.set(\"code_challenge\", challenge);\n\turl.searchParams.set(\"code_challenge_method\", \"S256\");\n\turl.searchParams.set(\"state\", state);\n\turl.searchParams.set(\"id_token_add_organizations\", \"true\");\n\turl.searchParams.set(\"codex_cli_simplified_flow\", \"true\");\n\turl.searchParams.set(\"originator\", originator);\n\n\treturn { verifier, state, url: url.toString() };\n}\n\ntype OAuthServerInfo = {\n\tclose: () => void;\n\tcancelWait: () => void;\n\twaitForCode: () => Promise<{ code: string } | null>;\n};\n\nfunction startLocalOAuthServer(state: string): Promise<OAuthServerInfo> {\n\tif (!_http) {\n\t\tthrow new Error(\"OpenAI Codex OAuth is only available in Node.js environments\");\n\t}\n\n\tlet settleWait: ((value: { code: string } | null) => void) | undefined;\n\tconst waitForCodePromise = new Promise<{ code: string } | null>((resolve) => {\n\t\tlet settled = false;\n\t\tsettleWait = (value) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tresolve(value);\n\t\t};\n\t});\n\n\tconst server = _http.createServer((req, res) => {\n\t\ttry {\n\t\t\tconst url = new URL(req.url || \"\", \"http://localhost\");\n\t\t\tif (url.pathname !== \"/auth/callback\") {\n\t\t\t\tres.statusCode = 404;\n\t\t\t\tres.setHeader(\"Content-Type\", \"text/html; charset=utf-8\");\n\t\t\t\tres.end(oauthErrorHtml(\"Callback route not found.\"));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (url.searchParams.get(\"state\") !== state) {\n\t\t\t\tres.statusCode = 400;\n\t\t\t\tres.setHeader(\"Content-Type\", \"text/html; charset=utf-8\");\n\t\t\t\tres.end(oauthErrorHtml(\"State mismatch.\"));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst code = url.searchParams.get(\"code\");\n\t\t\tif (!code) {\n\t\t\t\tres.statusCode = 400;\n\t\t\t\tres.setHeader(\"Content-Type\", \"text/html; charset=utf-8\");\n\t\t\t\tres.end(oauthErrorHtml(\"Missing authorization code.\"));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tres.statusCode = 200;\n\t\t\tres.setHeader(\"Content-Type\", \"text/html; charset=utf-8\");\n\t\t\tres.end(oauthSuccessHtml(\"OpenAI authentication completed. You can close this window.\"));\n\t\t\tsettleWait?.({ code });\n\t\t} catch {\n\t\t\tres.statusCode = 500;\n\t\t\tres.setHeader(\"Content-Type\", \"text/html; charset=utf-8\");\n\t\t\tres.end(oauthErrorHtml(\"Internal error while processing OAuth callback.\"));\n\t\t}\n\t});\n\n\treturn new Promise((resolve) => {\n\t\tserver\n\t\t\t.listen(1455, \"127.0.0.1\", () => {\n\t\t\t\tresolve({\n\t\t\t\t\tclose: () => server.close(),\n\t\t\t\t\tcancelWait: () => {\n\t\t\t\t\t\tsettleWait?.(null);\n\t\t\t\t\t},\n\t\t\t\t\twaitForCode: () => waitForCodePromise,\n\t\t\t\t});\n\t\t\t})\n\t\t\t.on(\"error\", (err: NodeJS.ErrnoException) => {\n\t\t\t\tconsole.error(\n\t\t\t\t\t\"[openai-codex] Failed to bind http://127.0.0.1:1455 (\",\n\t\t\t\t\terr.code,\n\t\t\t\t\t\") Falling back to manual paste.\",\n\t\t\t\t);\n\t\t\t\tsettleWait?.(null);\n\t\t\t\tresolve({\n\t\t\t\t\tclose: () => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tserver.close();\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// ignore\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tcancelWait: () => {},\n\t\t\t\t\twaitForCode: async () => null,\n\t\t\t\t});\n\t\t\t});\n\t});\n}\n\nfunction getAccountId(accessToken: string): string | null {\n\tconst payload = decodeJwt(accessToken);\n\tconst auth = payload?.[JWT_CLAIM_PATH];\n\tconst accountId = auth?.chatgpt_account_id;\n\treturn typeof accountId === \"string\" && accountId.length > 0 ? accountId : null;\n}\n\n/**\n * Login with OpenAI Codex OAuth\n *\n * @param options.onAuth - Called with URL and instructions when auth starts\n * @param options.onPrompt - Called to prompt user for manual code paste (fallback if no onManualCodeInput)\n * @param options.onProgress - Optional progress messages\n * @param options.onManualCodeInput - Optional promise that resolves with user-pasted code.\n * Races with browser callback - whichever completes first wins.\n * Useful for showing paste input immediately alongside browser flow.\n * @param options.originator - OAuth originator parameter (defaults to \"pi\")\n */\nexport async function loginOpenAICodex(options: {\n\tonAuth: (info: { url: string; instructions?: string }) => void;\n\tonPrompt: (prompt: OAuthPrompt) => Promise<string>;\n\tonProgress?: (message: string) => void;\n\tonManualCodeInput?: () => Promise<string>;\n\toriginator?: string;\n}): Promise<OAuthCredentials> {\n\tconst { verifier, state, url } = await createAuthorizationFlow(options.originator);\n\tconst server = await startLocalOAuthServer(state);\n\n\toptions.onAuth({ url, instructions: \"A browser window should open. Complete login to finish.\" });\n\n\tlet code: string | undefined;\n\ttry {\n\t\tif (options.onManualCodeInput) {\n\t\t\t// Race between browser callback and manual input\n\t\t\tlet manualCode: string | undefined;\n\t\t\tlet manualError: Error | undefined;\n\t\t\tconst manualPromise = options\n\t\t\t\t.onManualCodeInput()\n\t\t\t\t.then((input) => {\n\t\t\t\t\tmanualCode = input;\n\t\t\t\t\tserver.cancelWait();\n\t\t\t\t})\n\t\t\t\t.catch((err) => {\n\t\t\t\t\tmanualError = err instanceof Error ? err : new Error(String(err));\n\t\t\t\t\tserver.cancelWait();\n\t\t\t\t});\n\n\t\t\tconst result = await server.waitForCode();\n\n\t\t\t// If manual input was cancelled, throw that error\n\t\t\tif (manualError) {\n\t\t\t\tthrow manualError;\n\t\t\t}\n\n\t\t\tif (result?.code) {\n\t\t\t\t// Browser callback won\n\t\t\t\tcode = result.code;\n\t\t\t} else if (manualCode) {\n\t\t\t\t// Manual input won (or callback timed out and user had entered code)\n\t\t\t\tconst parsed = parseAuthorizationInput(manualCode);\n\t\t\t\tif (parsed.state && parsed.state !== state) {\n\t\t\t\t\tthrow new Error(\"State mismatch\");\n\t\t\t\t}\n\t\t\t\tcode = parsed.code;\n\t\t\t}\n\n\t\t\t// If still no code, wait for manual promise to complete and try that\n\t\t\tif (!code) {\n\t\t\t\tawait manualPromise;\n\t\t\t\tif (manualError) {\n\t\t\t\t\tthrow manualError;\n\t\t\t\t}\n\t\t\t\tif (manualCode) {\n\t\t\t\t\tconst parsed = parseAuthorizationInput(manualCode);\n\t\t\t\t\tif (parsed.state && parsed.state !== state) {\n\t\t\t\t\t\tthrow new Error(\"State mismatch\");\n\t\t\t\t\t}\n\t\t\t\t\tcode = parsed.code;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Original flow: wait for callback, then prompt if needed\n\t\t\tconst result = await server.waitForCode();\n\t\t\tif (result?.code) {\n\t\t\t\tcode = result.code;\n\t\t\t}\n\t\t}\n\n\t\t// Fallback to onPrompt if still no code\n\t\tif (!code) {\n\t\t\tconst input = await options.onPrompt({\n\t\t\t\tmessage: \"Paste the authorization code (or full redirect URL):\",\n\t\t\t});\n\t\t\tconst parsed = parseAuthorizationInput(input);\n\t\t\tif (parsed.state && parsed.state !== state) {\n\t\t\t\tthrow new Error(\"State mismatch\");\n\t\t\t}\n\t\t\tcode = parsed.code;\n\t\t}\n\n\t\tif (!code) {\n\t\t\tthrow new Error(\"Missing authorization code\");\n\t\t}\n\n\t\tconst tokenResult = await exchangeAuthorizationCode(code, verifier);\n\t\tif (tokenResult.type !== \"success\") {\n\t\t\tthrow new Error(\"Token exchange failed\");\n\t\t}\n\n\t\tconst accountId = getAccountId(tokenResult.access);\n\t\tif (!accountId) {\n\t\t\tthrow new Error(\"Failed to extract accountId from token\");\n\t\t}\n\n\t\treturn {\n\t\t\taccess: tokenResult.access,\n\t\t\trefresh: tokenResult.refresh,\n\t\t\texpires: tokenResult.expires,\n\t\t\taccountId,\n\t\t};\n\t} finally {\n\t\tserver.close();\n\t}\n}\n\n/**\n * Refresh OpenAI Codex OAuth token\n */\nexport async function refreshOpenAICodexToken(refreshToken: string): Promise<OAuthCredentials> {\n\tconst result = await refreshAccessToken(refreshToken);\n\tif (result.type !== \"success\") {\n\t\tthrow new Error(\"Failed to refresh OpenAI Codex token\");\n\t}\n\n\tconst accountId = getAccountId(result.access);\n\tif (!accountId) {\n\t\tthrow new Error(\"Failed to extract accountId from token\");\n\t}\n\n\treturn {\n\t\taccess: result.access,\n\t\trefresh: result.refresh,\n\t\texpires: result.expires,\n\t\taccountId,\n\t};\n}\n\nexport const openaiCodexOAuthProvider: OAuthProviderInterface = {\n\tid: \"openai-codex\",\n\tname: \"ChatGPT Plus/Pro (Codex Subscription)\",\n\tusesCallbackServer: true,\n\n\tasync login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials> {\n\t\treturn loginOpenAICodex({\n\t\t\tonAuth: callbacks.onAuth,\n\t\t\tonPrompt: callbacks.onPrompt,\n\t\t\tonProgress: callbacks.onProgress,\n\t\t\tonManualCodeInput: callbacks.onManualCodeInput,\n\t\t});\n\t},\n\n\tasync refreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials> {\n\t\treturn refreshOpenAICodexToken(credentials.refresh);\n\t},\n\n\tgetApiKey(credentials: OAuthCredentials): string {\n\t\treturn credentials.access;\n\t},\n};\n"]}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * PKCE utilities using Web Crypto API.
3
+ * Works in both Node.js 20+ and browsers.
4
+ */
5
+ /**
6
+ * Generate PKCE code verifier and challenge.
7
+ * Uses Web Crypto API for cross-platform compatibility.
8
+ */
9
+ export declare function generatePKCE(): Promise<{
10
+ verifier: string;
11
+ challenge: string;
12
+ }>;
13
+ //# sourceMappingURL=pkce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pkce.d.ts","sourceRoot":"","sources":["../../../src/utils/oauth/pkce.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH;;;GAGG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAarF","sourcesContent":["/**\n * PKCE utilities using Web Crypto API.\n * Works in both Node.js 20+ and browsers.\n */\n\n/**\n * Encode bytes as base64url string.\n */\nfunction base64urlEncode(bytes: Uint8Array): string {\n\tlet binary = \"\";\n\tfor (const byte of bytes) {\n\t\tbinary += String.fromCharCode(byte);\n\t}\n\treturn btoa(binary).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=/g, \"\");\n}\n\n/**\n * Generate PKCE code verifier and challenge.\n * Uses Web Crypto API for cross-platform compatibility.\n */\nexport async function generatePKCE(): Promise<{ verifier: string; challenge: string }> {\n\t// Generate random verifier\n\tconst verifierBytes = new Uint8Array(32);\n\tcrypto.getRandomValues(verifierBytes);\n\tconst verifier = base64urlEncode(verifierBytes);\n\n\t// Compute SHA-256 challenge\n\tconst encoder = new TextEncoder();\n\tconst data = encoder.encode(verifier);\n\tconst hashBuffer = await crypto.subtle.digest(\"SHA-256\", data);\n\tconst challenge = base64urlEncode(new Uint8Array(hashBuffer));\n\n\treturn { verifier, challenge };\n}\n"]}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * PKCE utilities using Web Crypto API.
3
+ * Works in both Node.js 20+ and browsers.
4
+ */
5
+ /**
6
+ * Encode bytes as base64url string.
7
+ */
8
+ function base64urlEncode(bytes) {
9
+ let binary = "";
10
+ for (const byte of bytes) {
11
+ binary += String.fromCharCode(byte);
12
+ }
13
+ return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
14
+ }
15
+ /**
16
+ * Generate PKCE code verifier and challenge.
17
+ * Uses Web Crypto API for cross-platform compatibility.
18
+ */
19
+ export async function generatePKCE() {
20
+ // Generate random verifier
21
+ const verifierBytes = new Uint8Array(32);
22
+ crypto.getRandomValues(verifierBytes);
23
+ const verifier = base64urlEncode(verifierBytes);
24
+ // Compute SHA-256 challenge
25
+ const encoder = new TextEncoder();
26
+ const data = encoder.encode(verifier);
27
+ const hashBuffer = await crypto.subtle.digest("SHA-256", data);
28
+ const challenge = base64urlEncode(new Uint8Array(hashBuffer));
29
+ return { verifier, challenge };
30
+ }
31
+ //# sourceMappingURL=pkce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pkce.js","sourceRoot":"","sources":["../../../src/utils/oauth/pkce.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,SAAS,eAAe,CAAC,KAAiB,EAAU;IACnD,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAAA,CAC9E;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,GAAqD;IACtF,2BAA2B;IAC3B,MAAM,aAAa,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;IAEhD,4BAA4B;IAC5B,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,eAAe,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IAE9D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AAAA,CAC/B","sourcesContent":["/**\n * PKCE utilities using Web Crypto API.\n * Works in both Node.js 20+ and browsers.\n */\n\n/**\n * Encode bytes as base64url string.\n */\nfunction base64urlEncode(bytes: Uint8Array): string {\n\tlet binary = \"\";\n\tfor (const byte of bytes) {\n\t\tbinary += String.fromCharCode(byte);\n\t}\n\treturn btoa(binary).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=/g, \"\");\n}\n\n/**\n * Generate PKCE code verifier and challenge.\n * Uses Web Crypto API for cross-platform compatibility.\n */\nexport async function generatePKCE(): Promise<{ verifier: string; challenge: string }> {\n\t// Generate random verifier\n\tconst verifierBytes = new Uint8Array(32);\n\tcrypto.getRandomValues(verifierBytes);\n\tconst verifier = base64urlEncode(verifierBytes);\n\n\t// Compute SHA-256 challenge\n\tconst encoder = new TextEncoder();\n\tconst data = encoder.encode(verifier);\n\tconst hashBuffer = await crypto.subtle.digest(\"SHA-256\", data);\n\tconst challenge = base64urlEncode(new Uint8Array(hashBuffer));\n\n\treturn { verifier, challenge };\n}\n"]}
@@ -0,0 +1,47 @@
1
+ import type { Api, Model } from "../../types.js";
2
+ export type OAuthCredentials = {
3
+ refresh: string;
4
+ access: string;
5
+ expires: number;
6
+ [key: string]: unknown;
7
+ };
8
+ export type OAuthProviderId = string;
9
+ /** @deprecated Use OAuthProviderId instead */
10
+ export type OAuthProvider = OAuthProviderId;
11
+ export type OAuthPrompt = {
12
+ message: string;
13
+ placeholder?: string;
14
+ allowEmpty?: boolean;
15
+ };
16
+ export type OAuthAuthInfo = {
17
+ url: string;
18
+ instructions?: string;
19
+ };
20
+ export interface OAuthLoginCallbacks {
21
+ onAuth: (info: OAuthAuthInfo) => void;
22
+ onPrompt: (prompt: OAuthPrompt) => Promise<string>;
23
+ onProgress?: (message: string) => void;
24
+ onManualCodeInput?: () => Promise<string>;
25
+ signal?: AbortSignal;
26
+ }
27
+ export interface OAuthProviderInterface {
28
+ readonly id: OAuthProviderId;
29
+ readonly name: string;
30
+ /** Run the login flow, return credentials to persist */
31
+ login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials>;
32
+ /** Whether login uses a local callback server and supports manual code input. */
33
+ usesCallbackServer?: boolean;
34
+ /** Refresh expired credentials, return updated credentials to persist */
35
+ refreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials>;
36
+ /** Convert credentials to API key string for the provider */
37
+ getApiKey(credentials: OAuthCredentials): string;
38
+ /** Optional: modify models for this provider (e.g., update baseUrl) */
39
+ modifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];
40
+ }
41
+ /** @deprecated Use OAuthProviderInterface instead */
42
+ export interface OAuthProviderInfo {
43
+ id: OAuthProviderId;
44
+ name: string;
45
+ available: boolean;
46
+ }
47
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/oauth/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,MAAM,gBAAgB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC,8CAA8C;AAC9C,MAAM,MAAM,aAAa,GAAG,eAAe,CAAC;AAE5C,MAAM,MAAM,WAAW,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,mBAAmB;IACnC,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACtC,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,EAAE,EAAE,eAAe,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,wDAAwD;IACxD,KAAK,CAAC,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEjE,iFAAiF;IACjF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,yEAAyE;IACzE,YAAY,CAAC,WAAW,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEvE,6DAA6D;IAC7D,SAAS,CAAC,WAAW,EAAE,gBAAgB,GAAG,MAAM,CAAC;IAEjD,uEAAuE;IACvE,YAAY,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,WAAW,EAAE,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;CACjF;AAED,qDAAqD;AACrD,MAAM,WAAW,iBAAiB;IACjC,EAAE,EAAE,eAAe,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;CACnB","sourcesContent":["import type { Api, Model } from \"../../types.js\";\n\nexport type OAuthCredentials = {\n\trefresh: string;\n\taccess: string;\n\texpires: number;\n\t[key: string]: unknown;\n};\n\nexport type OAuthProviderId = string;\n\n/** @deprecated Use OAuthProviderId instead */\nexport type OAuthProvider = OAuthProviderId;\n\nexport type OAuthPrompt = {\n\tmessage: string;\n\tplaceholder?: string;\n\tallowEmpty?: boolean;\n};\n\nexport type OAuthAuthInfo = {\n\turl: string;\n\tinstructions?: string;\n};\n\nexport interface OAuthLoginCallbacks {\n\tonAuth: (info: OAuthAuthInfo) => void;\n\tonPrompt: (prompt: OAuthPrompt) => Promise<string>;\n\tonProgress?: (message: string) => void;\n\tonManualCodeInput?: () => Promise<string>;\n\tsignal?: AbortSignal;\n}\n\nexport interface OAuthProviderInterface {\n\treadonly id: OAuthProviderId;\n\treadonly name: string;\n\n\t/** Run the login flow, return credentials to persist */\n\tlogin(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials>;\n\n\t/** Whether login uses a local callback server and supports manual code input. */\n\tusesCallbackServer?: boolean;\n\n\t/** Refresh expired credentials, return updated credentials to persist */\n\trefreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials>;\n\n\t/** Convert credentials to API key string for the provider */\n\tgetApiKey(credentials: OAuthCredentials): string;\n\n\t/** Optional: modify models for this provider (e.g., update baseUrl) */\n\tmodifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];\n}\n\n/** @deprecated Use OAuthProviderInterface instead */\nexport interface OAuthProviderInfo {\n\tid: OAuthProviderId;\n\tname: string;\n\tavailable: boolean;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/oauth/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Api, Model } from \"../../types.js\";\n\nexport type OAuthCredentials = {\n\trefresh: string;\n\taccess: string;\n\texpires: number;\n\t[key: string]: unknown;\n};\n\nexport type OAuthProviderId = string;\n\n/** @deprecated Use OAuthProviderId instead */\nexport type OAuthProvider = OAuthProviderId;\n\nexport type OAuthPrompt = {\n\tmessage: string;\n\tplaceholder?: string;\n\tallowEmpty?: boolean;\n};\n\nexport type OAuthAuthInfo = {\n\turl: string;\n\tinstructions?: string;\n};\n\nexport interface OAuthLoginCallbacks {\n\tonAuth: (info: OAuthAuthInfo) => void;\n\tonPrompt: (prompt: OAuthPrompt) => Promise<string>;\n\tonProgress?: (message: string) => void;\n\tonManualCodeInput?: () => Promise<string>;\n\tsignal?: AbortSignal;\n}\n\nexport interface OAuthProviderInterface {\n\treadonly id: OAuthProviderId;\n\treadonly name: string;\n\n\t/** Run the login flow, return credentials to persist */\n\tlogin(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials>;\n\n\t/** Whether login uses a local callback server and supports manual code input. */\n\tusesCallbackServer?: boolean;\n\n\t/** Refresh expired credentials, return updated credentials to persist */\n\trefreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials>;\n\n\t/** Convert credentials to API key string for the provider */\n\tgetApiKey(credentials: OAuthCredentials): string;\n\n\t/** Optional: modify models for this provider (e.g., update baseUrl) */\n\tmodifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];\n}\n\n/** @deprecated Use OAuthProviderInterface instead */\nexport interface OAuthProviderInfo {\n\tid: OAuthProviderId;\n\tname: string;\n\tavailable: boolean;\n}\n"]}
@@ -0,0 +1,53 @@
1
+ import type { AssistantMessage } from "../types.js";
2
+ /**
3
+ * Check if an assistant message represents a context overflow error.
4
+ *
5
+ * This handles two cases:
6
+ * 1. Error-based overflow: Most providers return stopReason "error" with a
7
+ * specific error message pattern.
8
+ * 2. Silent overflow: Some providers accept overflow requests and return
9
+ * successfully. For these, we check if usage.input exceeds the context window.
10
+ *
11
+ * ## Reliability by Provider
12
+ *
13
+ * **Reliable detection (returns error with detectable message):**
14
+ * - Anthropic: "prompt is too long: X tokens > Y maximum" or "request_too_large"
15
+ * - OpenAI (Completions & Responses): "exceeds the context window"
16
+ * - Google Gemini: "input token count exceeds the maximum"
17
+ * - xAI (Grok): "maximum prompt length is X but request contains Y"
18
+ * - Groq: "reduce the length of the messages"
19
+ * - Cerebras: 400/413 status code (no body)
20
+ * - Mistral: "Prompt contains X tokens ... too large for model with Y maximum context length"
21
+ * - OpenRouter (all backends): "maximum context length is X tokens"
22
+ * - llama.cpp: "exceeds the available context size"
23
+ * - LM Studio: "greater than the context length"
24
+ * - Kimi For Coding: "exceeded model token limit: X (requested: Y)"
25
+ *
26
+ * **Unreliable detection:**
27
+ * - z.ai: Sometimes accepts overflow silently (detectable via usage.input > contextWindow),
28
+ * sometimes returns rate limit errors. Pass contextWindow param to detect silent overflow.
29
+ * - Ollama: May truncate input silently for some setups, but may also return explicit
30
+ * overflow errors that match the patterns above. Silent truncation still cannot be
31
+ * detected here because we do not know the expected token count.
32
+ *
33
+ * ## Custom Providers
34
+ *
35
+ * If you've added custom models via settings.json, this function may not detect
36
+ * overflow errors from those providers. To add support:
37
+ *
38
+ * 1. Send a request that exceeds the model's context window
39
+ * 2. Check the errorMessage in the response
40
+ * 3. Create a regex pattern that matches the error
41
+ * 4. The pattern should be added to OVERFLOW_PATTERNS in this file, or
42
+ * check the errorMessage yourself before calling this function
43
+ *
44
+ * @param message - The assistant message to check
45
+ * @param contextWindow - Optional context window size for detecting silent overflow (z.ai)
46
+ * @returns true if the message indicates a context overflow
47
+ */
48
+ export declare function isContextOverflow(message: AssistantMessage, contextWindow?: number): boolean;
49
+ /**
50
+ * Get the overflow patterns for testing purposes.
51
+ */
52
+ export declare function getOverflowPatterns(): RegExp[];
53
+ //# sourceMappingURL=overflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overflow.d.ts","sourceRoot":"","sources":["../../src/utils/overflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAiEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAmB5F;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C","sourcesContent":["import type { AssistantMessage } from \"../types.js\";\n\n/**\n * Regex patterns to detect context overflow errors from different providers.\n *\n * These patterns match error messages returned when the input exceeds\n * the model's context window.\n *\n * Provider-specific patterns (with example error messages):\n *\n * - Anthropic: \"prompt is too long: 213462 tokens > 200000 maximum\"\n * - Anthropic: \"413 {\\\"error\\\":{\\\"type\\\":\\\"request_too_large\\\",\\\"message\\\":\\\"Request exceeds the maximum size\\\"}}\"\n * - OpenAI: \"Your input exceeds the context window of this model\"\n * - Google: \"The input token count (1196265) exceeds the maximum number of tokens allowed (1048575)\"\n * - xAI: \"This model's maximum prompt length is 131072 but the request contains 537812 tokens\"\n * - Groq: \"Please reduce the length of the messages or completion\"\n * - OpenRouter: \"This endpoint's maximum context length is X tokens. However, you requested about Y tokens\"\n * - llama.cpp: \"the request exceeds the available context size, try increasing it\"\n * - LM Studio: \"tokens to keep from the initial prompt is greater than the context length\"\n * - GitHub Copilot: \"prompt token count of X exceeds the limit of Y\"\n * - MiniMax: \"invalid params, context window exceeds limit\"\n * - Kimi For Coding: \"Your request exceeded model token limit: X (requested: Y)\"\n * - Cerebras: \"400/413 status code (no body)\"\n * - Mistral: \"Prompt contains X tokens ... too large for model with Y maximum context length\"\n * - z.ai: Does NOT error, accepts overflow silently - handled via usage.input > contextWindow\n * - Ollama: Some deployments truncate silently, others return errors like \"prompt too long; exceeded max context length by X tokens\"\n */\nconst OVERFLOW_PATTERNS = [\n\t/prompt is too long/i, // Anthropic token overflow\n\t/request_too_large/i, // Anthropic request byte-size overflow (HTTP 413)\n\t/input is too long for requested model/i, // Amazon Bedrock\n\t/exceeds the context window/i, // OpenAI (Completions & Responses API)\n\t/input token count.*exceeds the maximum/i, // Google (Gemini)\n\t/maximum prompt length is \\d+/i, // xAI (Grok)\n\t/reduce the length of the messages/i, // Groq\n\t/maximum context length is \\d+ tokens/i, // OpenRouter (all backends)\n\t/exceeds the limit of \\d+/i, // GitHub Copilot\n\t/exceeds the available context size/i, // llama.cpp server\n\t/greater than the context length/i, // LM Studio\n\t/context window exceeds limit/i, // MiniMax\n\t/exceeded model token limit/i, // Kimi For Coding\n\t/too large for model with \\d+ maximum context length/i, // Mistral\n\t/model_context_window_exceeded/i, // z.ai non-standard finish_reason surfaced as error text\n\t/prompt too long; exceeded (?:max )?context length/i, // Ollama explicit overflow error\n\t/context[_ ]length[_ ]exceeded/i, // Generic fallback\n\t/too many tokens/i, // Generic fallback\n\t/token limit exceeded/i, // Generic fallback\n\t/^4(?:00|13)\\s*(?:status code)?\\s*\\(no body\\)/i, // Cerebras: 400/413 with no body\n];\n\n/**\n * Patterns that indicate non-overflow errors (e.g. rate limiting, server errors).\n * Error messages matching any of these are excluded from overflow detection\n * even if they also match an OVERFLOW_PATTERN.\n *\n * Example: Bedrock formats throttling errors as \"ThrottlingException: Too many tokens,\n * please wait before trying again.\" which would match the /too many tokens/i overflow\n * pattern without this exclusion.\n */\nconst NON_OVERFLOW_PATTERNS = [\n\t/^(Throttling error|Service unavailable):/i, // AWS Bedrock non-overflow errors (human-readable prefixes from formatBedrockError)\n\t/rate limit/i, // Generic rate limiting\n\t/too many requests/i, // Generic HTTP 429 style\n];\n\n/**\n * Check if an assistant message represents a context overflow error.\n *\n * This handles two cases:\n * 1. Error-based overflow: Most providers return stopReason \"error\" with a\n * specific error message pattern.\n * 2. Silent overflow: Some providers accept overflow requests and return\n * successfully. For these, we check if usage.input exceeds the context window.\n *\n * ## Reliability by Provider\n *\n * **Reliable detection (returns error with detectable message):**\n * - Anthropic: \"prompt is too long: X tokens > Y maximum\" or \"request_too_large\"\n * - OpenAI (Completions & Responses): \"exceeds the context window\"\n * - Google Gemini: \"input token count exceeds the maximum\"\n * - xAI (Grok): \"maximum prompt length is X but request contains Y\"\n * - Groq: \"reduce the length of the messages\"\n * - Cerebras: 400/413 status code (no body)\n * - Mistral: \"Prompt contains X tokens ... too large for model with Y maximum context length\"\n * - OpenRouter (all backends): \"maximum context length is X tokens\"\n * - llama.cpp: \"exceeds the available context size\"\n * - LM Studio: \"greater than the context length\"\n * - Kimi For Coding: \"exceeded model token limit: X (requested: Y)\"\n *\n * **Unreliable detection:**\n * - z.ai: Sometimes accepts overflow silently (detectable via usage.input > contextWindow),\n * sometimes returns rate limit errors. Pass contextWindow param to detect silent overflow.\n * - Ollama: May truncate input silently for some setups, but may also return explicit\n * overflow errors that match the patterns above. Silent truncation still cannot be\n * detected here because we do not know the expected token count.\n *\n * ## Custom Providers\n *\n * If you've added custom models via settings.json, this function may not detect\n * overflow errors from those providers. To add support:\n *\n * 1. Send a request that exceeds the model's context window\n * 2. Check the errorMessage in the response\n * 3. Create a regex pattern that matches the error\n * 4. The pattern should be added to OVERFLOW_PATTERNS in this file, or\n * check the errorMessage yourself before calling this function\n *\n * @param message - The assistant message to check\n * @param contextWindow - Optional context window size for detecting silent overflow (z.ai)\n * @returns true if the message indicates a context overflow\n */\nexport function isContextOverflow(message: AssistantMessage, contextWindow?: number): boolean {\n\t// Case 1: Check error message patterns\n\tif (message.stopReason === \"error\" && message.errorMessage) {\n\t\t// Skip messages matching known non-overflow patterns (e.g. throttling / rate-limit)\n\t\tconst isNonOverflow = NON_OVERFLOW_PATTERNS.some((p) => p.test(message.errorMessage!));\n\t\tif (!isNonOverflow && OVERFLOW_PATTERNS.some((p) => p.test(message.errorMessage!))) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t// Case 2: Silent overflow (z.ai style) - successful but usage exceeds context\n\tif (contextWindow && message.stopReason === \"stop\") {\n\t\tconst inputTokens = message.usage.input + message.usage.cacheRead;\n\t\tif (inputTokens > contextWindow) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Get the overflow patterns for testing purposes.\n */\nexport function getOverflowPatterns(): RegExp[] {\n\treturn [...OVERFLOW_PATTERNS];\n}\n"]}