@code-yeongyu/senpi 2026.9.23-2 → 2026.9.23-4

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 (275) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/bundle/chunks/{app-server-command-UO3ODP6D.js → app-server-command-QRBQLEXY.js} +1 -1
  3. package/dist/bundle/chunks/{chunk-UCTYTLP3.js → chunk-3RN6BFG2.js} +2 -2
  4. package/dist/bundle/chunks/{chunk-OLJ7LQJY.js → chunk-BBOQ5H4W.js} +1 -1
  5. package/dist/bundle/chunks/{chunk-XTXBPXZZ.js → chunk-EN6KDFY2.js} +1 -1
  6. package/dist/bundle/chunks/{chunk-2NFHX2FJ.js → chunk-J3QXPP4T.js} +1 -1
  7. package/dist/bundle/chunks/chunk-KBG7BJIL.js +8 -0
  8. package/dist/bundle/chunks/{chunk-LMO3WYKH.js → chunk-N46LNXHU.js} +156 -167
  9. package/dist/bundle/chunks/{chunk-7EH64T6E.js → chunk-ORCF262V.js} +2 -2
  10. package/dist/bundle/chunks/{chunk-67Z5WNA4.js → chunk-PSMTQDII.js} +1 -1
  11. package/dist/bundle/chunks/{chunk-IDJUNOOR.js → chunk-WUYBEF7C.js} +2 -2
  12. package/dist/bundle/chunks/{chunk-IDSOMHWS.js → chunk-WXIRFRXY.js} +1 -1
  13. package/dist/bundle/chunks/{chunk-BPHXJ4N2.js → chunk-XDSQYM4F.js} +1 -1
  14. package/dist/bundle/chunks/{chunk-IBHBWRC4.js → chunk-ZEFQYQOU.js} +3 -3
  15. package/dist/bundle/chunks/{cli-main-LUQZADLN.js → cli-main-ROBDBYAB.js} +1 -1
  16. package/dist/bundle/chunks/cursor-agent.js +1 -1
  17. package/dist/bundle/chunks/{help-fast-path-VXAZDQ3Z.js → help-fast-path-QXVCHTP3.js} +1 -1
  18. package/dist/bundle/chunks/{host-command-5PEFD4N6.js → host-command-3PUZYQOK.js} +1 -1
  19. package/dist/bundle/chunks/{host-lifecycle-BXW5C4JT.js → host-lifecycle-OHPSU5VU.js} +1 -1
  20. package/dist/bundle/chunks/{interactive-host-runtime-A6PM52FT.js → interactive-host-runtime-57LEAJPU.js} +1 -1
  21. package/dist/bundle/chunks/{interactive-mode-VR7QYMAE.js → interactive-mode-SLPAGRHH.js} +1 -1
  22. package/dist/bundle/chunks/{list-tips-VGOIMT6W.js → list-tips-Z62FXPOJ.js} +1 -1
  23. package/dist/bundle/chunks/{multi-session-host-LYOVVA75.js → multi-session-host-3PACMEHC.js} +1 -1
  24. package/dist/bundle/chunks/{package-manager-cli-OMEJACX6.js → package-manager-cli-6UIUSRQO.js} +1 -1
  25. package/dist/bundle/chunks/{pi-messages-B6RSUQKL.js → pi-messages-CAS467IY.js} +1 -1
  26. package/dist/bundle/chunks/{rotation-stream-ZIYWOB2N.js → rotation-stream-CZT4TRPD.js} +1 -1
  27. package/dist/bundle/chunks/{rpc-mode-AKGJA73P.js → rpc-mode-47EVLL6X.js} +1 -1
  28. package/dist/bundle/chunks/{session-picker-UE5LOM6W.js → session-picker-ZIBANFBQ.js} +1 -1
  29. package/dist/bundle/chunks/session-worker.js +235 -246
  30. package/dist/bundle/cli.js +1 -1
  31. package/dist/bundle/index.js +1 -1
  32. package/dist/bundle/rpc-entry.js +1 -1
  33. package/dist/core/extensions/builtin/anthropic-subscription/executable-model-support.d.ts +19 -0
  34. package/dist/core/extensions/builtin/anthropic-subscription/executable-model-support.d.ts.map +1 -0
  35. package/dist/core/extensions/builtin/anthropic-subscription/executable-model-support.js +76 -0
  36. package/dist/core/extensions/builtin/anthropic-subscription/executable-model-support.js.map +1 -0
  37. package/dist/core/extensions/builtin/anthropic-subscription/executable-path-lookup.d.ts +7 -2
  38. package/dist/core/extensions/builtin/anthropic-subscription/executable-path-lookup.d.ts.map +1 -1
  39. package/dist/core/extensions/builtin/anthropic-subscription/executable-path-lookup.js +28 -3
  40. package/dist/core/extensions/builtin/anthropic-subscription/executable-path-lookup.js.map +1 -1
  41. package/dist/core/extensions/builtin/anthropic-subscription/executable.d.ts +11 -0
  42. package/dist/core/extensions/builtin/anthropic-subscription/executable.d.ts.map +1 -1
  43. package/dist/core/extensions/builtin/anthropic-subscription/executable.js +31 -10
  44. package/dist/core/extensions/builtin/anthropic-subscription/executable.js.map +1 -1
  45. package/dist/core/extensions/builtin/anthropic-subscription/guidance.d.ts +2 -1
  46. package/dist/core/extensions/builtin/anthropic-subscription/guidance.d.ts.map +1 -1
  47. package/dist/core/extensions/builtin/anthropic-subscription/guidance.js +18 -2
  48. package/dist/core/extensions/builtin/anthropic-subscription/guidance.js.map +1 -1
  49. package/dist/core/extensions/builtin/anthropic-subscription/stream-guidance.d.ts +2 -1
  50. package/dist/core/extensions/builtin/anthropic-subscription/stream-guidance.d.ts.map +1 -1
  51. package/dist/core/extensions/builtin/anthropic-subscription/stream-guidance.js +2 -2
  52. package/dist/core/extensions/builtin/anthropic-subscription/stream-guidance.js.map +1 -1
  53. package/dist/core/extensions/builtin/anthropic-subscription/stream.d.ts.map +1 -1
  54. package/dist/core/extensions/builtin/anthropic-subscription/stream.js +5 -3
  55. package/dist/core/extensions/builtin/anthropic-subscription/stream.js.map +1 -1
  56. package/dist/core/extensions/builtin/cursor-cli-oauth/models.d.ts.map +1 -1
  57. package/dist/core/extensions/builtin/cursor-cli-oauth/models.js +43 -26
  58. package/dist/core/extensions/builtin/cursor-cli-oauth/models.js.map +1 -1
  59. package/dist/core/extensions/builtin/goal/cache-warm-renderer.d.ts +6 -0
  60. package/dist/core/extensions/builtin/goal/cache-warm-renderer.d.ts.map +1 -1
  61. package/dist/core/extensions/builtin/goal/cache-warm-renderer.js +8 -0
  62. package/dist/core/extensions/builtin/goal/cache-warm-renderer.js.map +1 -1
  63. package/dist/core/extensions/builtin/goal/index.d.ts.map +1 -1
  64. package/dist/core/extensions/builtin/goal/index.js +4 -2
  65. package/dist/core/extensions/builtin/goal/index.js.map +1 -1
  66. package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts +3 -1
  67. package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts.map +1 -1
  68. package/dist/core/extensions/builtin/goal/monitor-continuation.js +32 -10
  69. package/dist/core/extensions/builtin/goal/monitor-continuation.js.map +1 -1
  70. package/dist/core/extensions/builtin/goal/parked-wait.d.ts +16 -0
  71. package/dist/core/extensions/builtin/goal/parked-wait.d.ts.map +1 -0
  72. package/dist/core/extensions/builtin/goal/parked-wait.js +54 -0
  73. package/dist/core/extensions/builtin/goal/parked-wait.js.map +1 -0
  74. package/dist/core/extensions/builtin/mcp/auth/commands-auth-dispatch.d.ts +1 -1
  75. package/dist/core/extensions/builtin/mcp/auth/commands-auth-dispatch.d.ts.map +1 -1
  76. package/dist/core/extensions/builtin/mcp/auth/commands-auth-dispatch.js +8 -2
  77. package/dist/core/extensions/builtin/mcp/auth/commands-auth-dispatch.js.map +1 -1
  78. package/dist/core/extensions/builtin/mcp/auth/commands-auth.d.ts.map +1 -1
  79. package/dist/core/extensions/builtin/mcp/auth/commands-auth.js +15 -4
  80. package/dist/core/extensions/builtin/mcp/auth/commands-auth.js.map +1 -1
  81. package/dist/core/extensions/builtin/mcp/commands.d.ts.map +1 -1
  82. package/dist/core/extensions/builtin/mcp/commands.js +2 -0
  83. package/dist/core/extensions/builtin/mcp/commands.js.map +1 -1
  84. package/dist/core/extensions/builtin/nested-agents-md/index.js +1 -1
  85. package/dist/core/extensions/builtin/nested-agents-md/index.js.map +1 -1
  86. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts +5 -5
  87. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts.map +1 -1
  88. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +16 -11
  89. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
  90. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts +5 -5
  91. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts.map +1 -1
  92. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js +9 -6
  93. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js.map +1 -1
  94. package/dist/core/extensions/builtin/prompt-preset/test-decision.d.ts +2 -0
  95. package/dist/core/extensions/builtin/prompt-preset/test-decision.d.ts.map +1 -0
  96. package/dist/core/extensions/builtin/prompt-preset/test-decision.js +5 -0
  97. package/dist/core/extensions/builtin/prompt-preset/test-decision.js.map +1 -0
  98. package/dist/core/extensions/builtin/rule-activation/types.d.ts +2 -0
  99. package/dist/core/extensions/builtin/rule-activation/types.d.ts.map +1 -1
  100. package/dist/core/extensions/builtin/rule-activation/types.js +7 -1
  101. package/dist/core/extensions/builtin/rule-activation/types.js.map +1 -1
  102. package/dist/core/extensions/builtin/rules/index.d.ts.map +1 -1
  103. package/dist/core/extensions/builtin/rules/index.js +2 -1
  104. package/dist/core/extensions/builtin/rules/index.js.map +1 -1
  105. package/dist/core/extensions/builtin/webfetch/webfetch/tool.d.ts +3 -1
  106. package/dist/core/extensions/builtin/webfetch/webfetch/tool.d.ts.map +1 -1
  107. package/dist/core/extensions/builtin/webfetch/webfetch/tool.js +9 -3
  108. package/dist/core/extensions/builtin/webfetch/webfetch/tool.js.map +1 -1
  109. package/dist/core/extensions/index.d.ts +1 -1
  110. package/dist/core/extensions/index.d.ts.map +1 -1
  111. package/dist/core/extensions/index.js.map +1 -1
  112. package/dist/core/extensions/loader.d.ts.map +1 -1
  113. package/dist/core/extensions/loader.js +6 -1
  114. package/dist/core/extensions/loader.js.map +1 -1
  115. package/dist/core/extensions/runner.d.ts +3 -1
  116. package/dist/core/extensions/runner.d.ts.map +1 -1
  117. package/dist/core/extensions/runner.js +5 -0
  118. package/dist/core/extensions/runner.js.map +1 -1
  119. package/dist/core/extensions/types.d.ts +10 -1
  120. package/dist/core/extensions/types.d.ts.map +1 -1
  121. package/dist/core/extensions/types.js.map +1 -1
  122. package/dist/core/model-config.d.ts +1 -0
  123. package/dist/core/model-config.d.ts.map +1 -1
  124. package/dist/core/model-config.js +26 -20
  125. package/dist/core/model-config.js.map +1 -1
  126. package/dist/core/model-resolver.d.ts.map +1 -1
  127. package/dist/core/model-resolver.js +87 -14
  128. package/dist/core/model-resolver.js.map +1 -1
  129. package/dist/core/models-json-migration.d.ts +30 -0
  130. package/dist/core/models-json-migration.d.ts.map +1 -0
  131. package/dist/core/models-json-migration.js +257 -0
  132. package/dist/core/models-json-migration.js.map +1 -0
  133. package/dist/core/output-guard.d.ts +2 -0
  134. package/dist/core/output-guard.d.ts.map +1 -1
  135. package/dist/core/output-guard.js +31 -0
  136. package/dist/core/output-guard.js.map +1 -1
  137. package/dist/core/settings-manager.d.ts +4 -0
  138. package/dist/core/settings-manager.d.ts.map +1 -1
  139. package/dist/core/settings-manager.js +16 -6
  140. package/dist/core/settings-manager.js.map +1 -1
  141. package/dist/core/settings-overrides.d.ts +8 -0
  142. package/dist/core/settings-overrides.d.ts.map +1 -0
  143. package/dist/core/settings-overrides.js +28 -0
  144. package/dist/core/settings-overrides.js.map +1 -0
  145. package/dist/core/tools/bash.d.ts.map +1 -1
  146. package/dist/core/tools/bash.js +12 -7
  147. package/dist/core/tools/bash.js.map +1 -1
  148. package/dist/core/tools/find.d.ts.map +1 -1
  149. package/dist/core/tools/find.js +9 -6
  150. package/dist/core/tools/find.js.map +1 -1
  151. package/dist/core/tools/grep/format.d.ts +3 -2
  152. package/dist/core/tools/grep/format.d.ts.map +1 -1
  153. package/dist/core/tools/grep/format.js +5 -3
  154. package/dist/core/tools/grep/format.js.map +1 -1
  155. package/dist/core/tools/grep/index.js +2 -2
  156. package/dist/core/tools/grep/index.js.map +1 -1
  157. package/dist/core/tools/ls.d.ts.map +1 -1
  158. package/dist/core/tools/ls.js +5 -3
  159. package/dist/core/tools/ls.js.map +1 -1
  160. package/dist/core/tools/model-only-text.d.ts +4 -0
  161. package/dist/core/tools/model-only-text.d.ts.map +1 -0
  162. package/dist/core/tools/model-only-text.js +12 -0
  163. package/dist/core/tools/model-only-text.js.map +1 -0
  164. package/dist/core/tools/read.d.ts.map +1 -1
  165. package/dist/core/tools/read.js +15 -5
  166. package/dist/core/tools/read.js.map +1 -1
  167. package/dist/core/tools/render-utils.d.ts.map +1 -1
  168. package/dist/core/tools/render-utils.js +2 -1
  169. package/dist/core/tools/render-utils.js.map +1 -1
  170. package/dist/core/tools/renderers/bash.d.ts.map +1 -1
  171. package/dist/core/tools/renderers/bash.js +1 -25
  172. package/dist/core/tools/renderers/bash.js.map +1 -1
  173. package/dist/core/tools/renderers/grep.d.ts.map +1 -1
  174. package/dist/core/tools/renderers/grep.js +0 -25
  175. package/dist/core/tools/renderers/grep.js.map +1 -1
  176. package/dist/core/tools/renderers/read.d.ts +8 -0
  177. package/dist/core/tools/renderers/read.d.ts.map +1 -1
  178. package/dist/core/tools/renderers/read.js +2 -14
  179. package/dist/core/tools/renderers/read.js.map +1 -1
  180. package/dist/index.d.ts +1 -1
  181. package/dist/index.d.ts.map +1 -1
  182. package/dist/index.js.map +1 -1
  183. package/dist/modes/interactive/components/assistant-message.d.ts +2 -0
  184. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  185. package/dist/modes/interactive/components/assistant-message.js +4 -0
  186. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  187. package/dist/modes/interactive/components/custom-entry.d.ts +10 -1
  188. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  189. package/dist/modes/interactive/components/custom-entry.js +22 -0
  190. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  191. package/dist/modes/interactive/components/exploration-call.d.ts +15 -0
  192. package/dist/modes/interactive/components/exploration-call.d.ts.map +1 -0
  193. package/dist/modes/interactive/components/exploration-call.js +56 -0
  194. package/dist/modes/interactive/components/exploration-call.js.map +1 -0
  195. package/dist/modes/interactive/components/exploration-group.d.ts +21 -0
  196. package/dist/modes/interactive/components/exploration-group.d.ts.map +1 -0
  197. package/dist/modes/interactive/components/exploration-group.js +95 -0
  198. package/dist/modes/interactive/components/exploration-group.js.map +1 -0
  199. package/dist/modes/interactive/components/exploration-rules.d.ts +5 -0
  200. package/dist/modes/interactive/components/exploration-rules.d.ts.map +1 -0
  201. package/dist/modes/interactive/components/exploration-rules.js +15 -0
  202. package/dist/modes/interactive/components/exploration-rules.js.map +1 -0
  203. package/dist/modes/interactive/components/exploration-transcript-container.d.ts +18 -0
  204. package/dist/modes/interactive/components/exploration-transcript-container.d.ts.map +1 -0
  205. package/dist/modes/interactive/components/exploration-transcript-container.js +76 -0
  206. package/dist/modes/interactive/components/exploration-transcript-container.js.map +1 -0
  207. package/dist/modes/interactive/components/tool-execution.d.ts +7 -1
  208. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  209. package/dist/modes/interactive/components/tool-execution.js +8 -1
  210. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  211. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  212. package/dist/modes/interactive/interactive-mode.js +24 -35
  213. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  214. package/dist/modes/interactive/replay-assistant-tools.d.ts +14 -0
  215. package/dist/modes/interactive/replay-assistant-tools.d.ts.map +1 -0
  216. package/dist/modes/interactive/replay-assistant-tools.js +33 -0
  217. package/dist/modes/interactive/replay-assistant-tools.js.map +1 -0
  218. package/dist/modes/interactive/tool-progress.d.ts +2 -0
  219. package/dist/modes/interactive/tool-progress.d.ts.map +1 -1
  220. package/dist/modes/interactive/tool-progress.js +5 -2
  221. package/dist/modes/interactive/tool-progress.js.map +1 -1
  222. package/dist/modes/interactive/tui-renderer.d.ts.map +1 -1
  223. package/dist/modes/interactive/tui-renderer.js +6 -1
  224. package/dist/modes/interactive/tui-renderer.js.map +1 -1
  225. package/docs/extensions.md +8 -0
  226. package/docs/mcp.md +9 -6
  227. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +30 -0
  228. package/node_modules/@code-yeongyu/senpi-codemode/README.md +10 -8
  229. package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
  230. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/display-code.ts +145 -0
  231. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-request.ts +7 -12
  232. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +2 -2
  233. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/render.ts +38 -35
  234. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/types.ts +1 -4
  235. package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  236. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts.map +1 -1
  237. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +17 -1
  238. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js.map +1 -1
  239. package/node_modules/@earendil-works/pi-ai/dist/cursor/catalog-grouping.d.ts +18 -1
  240. package/node_modules/@earendil-works/pi-ai/dist/cursor/catalog-grouping.d.ts.map +1 -1
  241. package/node_modules/@earendil-works/pi-ai/dist/cursor/catalog-grouping.js +103 -3
  242. package/node_modules/@earendil-works/pi-ai/dist/cursor/catalog-grouping.js.map +1 -1
  243. package/node_modules/@earendil-works/pi-ai/dist/cursor/selection-descriptor.d.ts +3 -1
  244. package/node_modules/@earendil-works/pi-ai/dist/cursor/selection-descriptor.d.ts.map +1 -1
  245. package/node_modules/@earendil-works/pi-ai/dist/cursor/selection-descriptor.js +15 -3
  246. package/node_modules/@earendil-works/pi-ai/dist/cursor/selection-descriptor.js.map +1 -1
  247. package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.d.ts +7 -2
  248. package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.d.ts.map +1 -1
  249. package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.js +92 -20
  250. package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.js.map +1 -1
  251. package/node_modules/@earendil-works/pi-ai/dist/model.d.ts +9 -1
  252. package/node_modules/@earendil-works/pi-ai/dist/model.d.ts.map +1 -1
  253. package/node_modules/@earendil-works/pi-ai/dist/model.js.map +1 -1
  254. package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.d.ts.map +1 -1
  255. package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js +1 -0
  256. package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js.map +1 -1
  257. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  258. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  259. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +5 -0
  260. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  261. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  262. package/node_modules/@earendil-works/pi-ai/package.json +2 -2
  263. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  264. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  265. package/node_modules/@earendil-works/pi-tui/dist/stderr-observer.d.ts +3 -0
  266. package/node_modules/@earendil-works/pi-tui/dist/stderr-observer.d.ts.map +1 -0
  267. package/node_modules/@earendil-works/pi-tui/dist/stderr-observer.js +14 -0
  268. package/node_modules/@earendil-works/pi-tui/dist/stderr-observer.js.map +1 -0
  269. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +4 -1
  270. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
  271. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +8 -12
  272. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
  273. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  274. package/package.json +7 -7
  275. package/dist/bundle/chunks/chunk-WJ2BGYFK.js +0 -8
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
3
- import{enableStartupCompileCache}from"./chunks/chunk-F73COJ7R.js";import{getLatestPiRelease,hasInheritedInspectorOption,isNewerPackageVersion,releaseInheritedInspectorForChild}from"./chunks/chunk-34HMVB33.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import{APP_NAME,DISPLAY_VERSION,PACKAGE_NAME,VERSION,brandProfile,getAgentDir,getPackageDir,getSelfUpdateCommand,getSelfUpdateUnavailableInstruction,isBundledNode}from"./chunks/chunk-Y65WFI5H.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-IKOFCODM.js";import{spawn as spawn2,spawnSync}from"node:child_process";import{existsSync,realpathSync}from"node:fs";import{join as join2}from"node:path";import{fileURLToPath}from"node:url";import{homedir as osHomedir}from"node:os";import{posix,win32}from"node:path";var RUNTIME_ENV_VAR="SENPI_RUNTIME";function normalize(path){return path.replaceAll("\\","/")}function paths(options){return options.platform==="win32"?win32:posix}function bunRoot(options){let configured=options.env.BUN_INSTALL;return configured!==void 0&&configured.trim()!==""?configured:paths(options).join(options.homedir,".bun")}function resolveOrSelf(path,options){try{return options.realpath(path)}catch{return path}}function isUnderBunGlobalTree(scriptRealPath,options){let globalRoot=paths(options).join(bunRoot(options),"install","global"),script=normalize(scriptRealPath);for(let candidate of new Set([globalRoot,resolveOrSelf(globalRoot,options)]))if(script.startsWith(`${normalize(candidate)}/`))return!0;return!1}function bunExecutableName(options){return options.platform==="win32"?"bun.exe":"bun"}function pathCandidateNames(options){if(options.platform!=="win32")return["bun"];let extensions=(options.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";").map(extension=>extension.trim()).filter(extension=>extension.length>0);return extensions.length>0?extensions.map(extension=>`bun${extension}`):["bun.exe"]}function findBunBinary(options){let path=paths(options),executable=bunExecutableName(options),rootCandidates=[path.join(bunRoot(options),"bin",executable),path.join(options.homedir,".bun","bin",executable)];for(let candidate of rootCandidates)if(options.exists(candidate))return candidate;let pathValue=options.env.PATH??options.env.Path;if(pathValue===void 0||pathValue==="")return;let names=pathCandidateNames(options);for(let directory of pathValue.split(path.delimiter))if(directory!=="")for(let name of names){let candidate=path.join(directory,name);if(options.exists(candidate))return candidate}}function readRuntimePin(options){let value=options.env[RUNTIME_ENV_VAR];if(value==="node"||value==="bun")return value}function resolveBunReexec(input){if(input.versions.bun!==void 0)return{action:"stay",reason:"already-bun"};let pinned=readRuntimePin(input.options);if(pinned==="node")return{action:"stay",reason:"runtime-pinned-node"};if(input.hasInheritedInspectorOption)return{action:"stay",reason:"inspector"};if(!(pinned==="bun"||isUnderBunGlobalTree(input.scriptRealPath,input.options)))return{action:"stay",reason:"not-bun-install"};let bunPath=findBunBinary(input.options);return bunPath===void 0?{action:"stay",reason:"bun-not-found"}:{action:"reexec",bunPath}}function processBunRuntimeOptions(exists,realpath){return{env:process.env,homedir:osHomedir(),platform:process.platform,exists,realpath}}import{spawn}from"node:child_process";import{readFileSync}from"node:fs";import{join}from"node:path";function parseBootstrapSelfUpdateArgs(args2){let[command,...rest]=args2;if(command!=="update")return;let force=!1,selfFlag=!1,extensionsFlag=!1,extensionFlag=!1,source;for(let index=0;index<rest.length;index++){let arg=rest[index];if(arg==="-h"||arg==="--help")return;if(arg==="--force"){force=!0;continue}if(arg==="--self"){selfFlag=!0;continue}if(arg==="--extensions"){extensionsFlag=!0;continue}if(arg==="--extension"){extensionFlag=!0,index++;continue}if(arg.startsWith("-")||source)return;source=arg}if(extensionFlag)return;let sourceIsSelf=source==="self"||source==="pi"||source===APP_NAME;if(!(source&&!sourceIsSelf)&&!(!selfFlag&&!sourceIsSelf&&extensionsFlag))return{force}}function getObjectProperty(value,key){if(!(!value||typeof value!="object"))return Object.getOwnPropertyDescriptor(value,key)?.value}function readConfiguredNpmCommand(){try{let parsed=JSON.parse(readFileSync(join(getAgentDir(),"settings.json"),"utf-8")),npmCommand=getObjectProperty(parsed,"npmCommand");return!Array.isArray(npmCommand)||npmCommand.some(part=>typeof part!="string")?void 0:npmCommand.length>0?npmCommand:void 0}catch{return}}async function runCommand(step){await new Promise((resolve,reject)=>{let child=spawn(step.command,step.args,{stdio:"inherit"});child.on("error",error=>{reject(error)}),child.on("close",(code,signal)=>{code===0?resolve():reject(signal?new Error(`${step.display} terminated by signal ${signal}`):new Error(`${step.display} exited with code ${code??"unknown"}`))})})}async function handleBootstrapSelfUpdate(args2,dependencies={}){let parsed=parseBootstrapSelfUpdateArgs(args2);if(!parsed)return!1;let writeStdout=dependencies.writeStdout??(line=>console.log(line)),writeStderr=dependencies.writeStderr??(line=>console.error(line)),readNpmCommand=dependencies.readNpmCommand??readConfiguredNpmCommand,resolveSelfUpdateCommand=dependencies.getSelfUpdateCommand??getSelfUpdateCommand,resolveUnavailableInstruction=dependencies.getUnavailableInstruction??getSelfUpdateUnavailableInstruction,executeCommand=dependencies.runCommand??runCommand,brandUpdate=brandProfile()?.update;if(brandUpdate)return writeStdout(`${APP_NAME} ships inside ${brandUpdate.packageName}. Update it with: ${brandUpdate.command}`),!0;let loadLatestRelease=dependencies.getLatestRelease??getLatestPiRelease,latestRelease;if(!parsed.force)try{latestRelease=await loadLatestRelease(VERSION)}catch{latestRelease=void 0}let updatePackageName=latestRelease?.packageName??PACKAGE_NAME;if(!(parsed.force||!latestRelease||updatePackageName!==PACKAGE_NAME||isNewerPackageVersion(latestRelease.version,VERSION)))return writeStdout(`${APP_NAME} is already up to date (v${VERSION})`),!0;let npmCommand=readNpmCommand(),selfUpdateCommand=resolveSelfUpdateCommand(PACKAGE_NAME,npmCommand,updatePackageName);if(!selfUpdateCommand)return writeStderr(`error: ${APP_NAME} cannot self-update this installation.`),writeStderr(resolveUnavailableInstruction(PACKAGE_NAME,npmCommand,updatePackageName)),process.argv[1]&&(writeStderr(""),writeStderr(`Location of ${APP_NAME} executable: ${process.argv[1]}`)),process.exitCode=1,!0;latestRelease?.note?.trim()&&(writeStdout(""),writeStdout("Update note"),writeStdout(latestRelease.note.trim()),writeStdout("")),writeStdout(`Updating ${APP_NAME} with ${selfUpdateCommand.display}...`);for(let step of selfUpdateCommand.steps??[selfUpdateCommand])try{await executeCommand(step)}catch(error){let message=error instanceof Error?error.message:"Unknown package command error";return writeStderr(`Error: ${message}`),writeStderr(`If this keeps failing, run this command yourself: ${selfUpdateCommand.display}`),process.exitCode=1,!0}return writeStdout(`Updated ${APP_NAME}`),!0}function reexecUnderBunIfNeeded(){let options=processBunRuntimeOptions(existsSync,realpathSync),scriptRealPath=process.argv[1]??fileURLToPath(import.meta.url);try{scriptRealPath=realpathSync(scriptRealPath)}catch{}let decision=resolveBunReexec({scriptRealPath,versions:process.versions,hasInheritedInspectorOption:hasInheritedInspectorOption(),options});if(decision.action==="stay")return!1;let result=spawnSync(decision.bunPath,[scriptRealPath,...process.argv.slice(2)],{stdio:"inherit",windowsHide:!0});return result.signal?(process.kill(process.pid,result.signal),!0):(process.exitCode=result.status??1,!0)}reexecUnderBunIfNeeded()&&process.exit();enableStartupCompileCache();process.title=APP_NAME;process.env.PI_CODING_AGENT="true";process.env.AI_AGENT=APP_NAME;process.emitWarning=(()=>{});var args=process.argv.slice(2),PACKAGE_COMMANDS=new Set(["install","remove","uninstall","update","list","config"]);function isRootCommand(args2){let firstArg=args2[0];return firstArg===void 0||!PACKAGE_COMMANDS.has(firstArg)}function isPackageManagerInstall(packageDir){return packageDir.replace(/\\/g,"/").includes("/node_modules/@code-yeongyu/senpi")}function isMissingBundledWorkspaceDependencies(packageDir){return isPackageManagerInstall(packageDir)?["pi-agent-core","pi-ai","pi-tui"].some(name=>!existsSync(join2(packageDir,"node_modules","@earendil-works",name,"dist","index.js"))):!1}var ISOLATED_CHILD_ENV="SENPI_CLI_ISOLATED_CHILD";function requiresIsolatedProcess(){return process.env[ISOLATED_CHILD_ENV]==="1"?!1:process.execArgv.length>0||hasInheritedInspectorOption()}async function spawnFullCli(){let extension=import.meta.url.endsWith(".ts")?".ts":".js",fullCliPath=isBundledNode?fileURLToPath(import.meta.url):fileURLToPath(new URL(`./cli-main${extension}`,import.meta.url));releaseInheritedInspectorForChild();let childEnvironment=isBundledNode?{...process.env,[ISOLATED_CHILD_ENV]:"1"}:process.env;return await new Promise((resolve,reject)=>{let child=spawn2(process.execPath,[...process.execArgv,fullCliPath,...args],{env:childEnvironment,stdio:"inherit"});child.on("error",error=>{reject(error)}),child.on("close",(code,signal)=>{if(signal){process.kill(process.pid,signal),resolve(1);return}resolve(code??1)})})}isRootCommand(args)&&(args.includes("--version")||args.includes("-v"))&&(console.log(DISPLAY_VERSION),process.exit());if(isRootCommand(args)&&args.some(arg=>arg==="--help"||arg==="-h")){let{tryPrintHelpWithoutEngine}=await import("./chunks/help-fast-path-VXAZDQ3Z.js");tryPrintHelpWithoutEngine(args)&&process.exit()}isMissingBundledWorkspaceDependencies(getPackageDir())&&await handleBootstrapSelfUpdate(args)&&process.exit();requiresIsolatedProcess()?process.exitCode=await spawnFullCli():await import("./chunks/cli-main-LUQZADLN.js");
3
+ import{enableStartupCompileCache}from"./chunks/chunk-F73COJ7R.js";import{getLatestPiRelease,hasInheritedInspectorOption,isNewerPackageVersion,releaseInheritedInspectorForChild}from"./chunks/chunk-34HMVB33.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import{APP_NAME,DISPLAY_VERSION,PACKAGE_NAME,VERSION,brandProfile,getAgentDir,getPackageDir,getSelfUpdateCommand,getSelfUpdateUnavailableInstruction,isBundledNode}from"./chunks/chunk-Y65WFI5H.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-IKOFCODM.js";import{spawn as spawn2,spawnSync}from"node:child_process";import{existsSync,realpathSync}from"node:fs";import{join as join2}from"node:path";import{fileURLToPath}from"node:url";import{homedir as osHomedir}from"node:os";import{posix,win32}from"node:path";var RUNTIME_ENV_VAR="SENPI_RUNTIME";function normalize(path){return path.replaceAll("\\","/")}function paths(options){return options.platform==="win32"?win32:posix}function bunRoot(options){let configured=options.env.BUN_INSTALL;return configured!==void 0&&configured.trim()!==""?configured:paths(options).join(options.homedir,".bun")}function resolveOrSelf(path,options){try{return options.realpath(path)}catch{return path}}function isUnderBunGlobalTree(scriptRealPath,options){let globalRoot=paths(options).join(bunRoot(options),"install","global"),script=normalize(scriptRealPath);for(let candidate of new Set([globalRoot,resolveOrSelf(globalRoot,options)]))if(script.startsWith(`${normalize(candidate)}/`))return!0;return!1}function bunExecutableName(options){return options.platform==="win32"?"bun.exe":"bun"}function pathCandidateNames(options){if(options.platform!=="win32")return["bun"];let extensions=(options.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";").map(extension=>extension.trim()).filter(extension=>extension.length>0);return extensions.length>0?extensions.map(extension=>`bun${extension}`):["bun.exe"]}function findBunBinary(options){let path=paths(options),executable=bunExecutableName(options),rootCandidates=[path.join(bunRoot(options),"bin",executable),path.join(options.homedir,".bun","bin",executable)];for(let candidate of rootCandidates)if(options.exists(candidate))return candidate;let pathValue=options.env.PATH??options.env.Path;if(pathValue===void 0||pathValue==="")return;let names=pathCandidateNames(options);for(let directory of pathValue.split(path.delimiter))if(directory!=="")for(let name of names){let candidate=path.join(directory,name);if(options.exists(candidate))return candidate}}function readRuntimePin(options){let value=options.env[RUNTIME_ENV_VAR];if(value==="node"||value==="bun")return value}function resolveBunReexec(input){if(input.versions.bun!==void 0)return{action:"stay",reason:"already-bun"};let pinned=readRuntimePin(input.options);if(pinned==="node")return{action:"stay",reason:"runtime-pinned-node"};if(input.hasInheritedInspectorOption)return{action:"stay",reason:"inspector"};if(!(pinned==="bun"||isUnderBunGlobalTree(input.scriptRealPath,input.options)))return{action:"stay",reason:"not-bun-install"};let bunPath=findBunBinary(input.options);return bunPath===void 0?{action:"stay",reason:"bun-not-found"}:{action:"reexec",bunPath}}function processBunRuntimeOptions(exists,realpath){return{env:process.env,homedir:osHomedir(),platform:process.platform,exists,realpath}}import{spawn}from"node:child_process";import{readFileSync}from"node:fs";import{join}from"node:path";function parseBootstrapSelfUpdateArgs(args2){let[command,...rest]=args2;if(command!=="update")return;let force=!1,selfFlag=!1,extensionsFlag=!1,extensionFlag=!1,source;for(let index=0;index<rest.length;index++){let arg=rest[index];if(arg==="-h"||arg==="--help")return;if(arg==="--force"){force=!0;continue}if(arg==="--self"){selfFlag=!0;continue}if(arg==="--extensions"){extensionsFlag=!0;continue}if(arg==="--extension"){extensionFlag=!0,index++;continue}if(arg.startsWith("-")||source)return;source=arg}if(extensionFlag)return;let sourceIsSelf=source==="self"||source==="pi"||source===APP_NAME;if(!(source&&!sourceIsSelf)&&!(!selfFlag&&!sourceIsSelf&&extensionsFlag))return{force}}function getObjectProperty(value,key){if(!(!value||typeof value!="object"))return Object.getOwnPropertyDescriptor(value,key)?.value}function readConfiguredNpmCommand(){try{let parsed=JSON.parse(readFileSync(join(getAgentDir(),"settings.json"),"utf-8")),npmCommand=getObjectProperty(parsed,"npmCommand");return!Array.isArray(npmCommand)||npmCommand.some(part=>typeof part!="string")?void 0:npmCommand.length>0?npmCommand:void 0}catch{return}}async function runCommand(step){await new Promise((resolve,reject)=>{let child=spawn(step.command,step.args,{stdio:"inherit"});child.on("error",error=>{reject(error)}),child.on("close",(code,signal)=>{code===0?resolve():reject(signal?new Error(`${step.display} terminated by signal ${signal}`):new Error(`${step.display} exited with code ${code??"unknown"}`))})})}async function handleBootstrapSelfUpdate(args2,dependencies={}){let parsed=parseBootstrapSelfUpdateArgs(args2);if(!parsed)return!1;let writeStdout=dependencies.writeStdout??(line=>console.log(line)),writeStderr=dependencies.writeStderr??(line=>console.error(line)),readNpmCommand=dependencies.readNpmCommand??readConfiguredNpmCommand,resolveSelfUpdateCommand=dependencies.getSelfUpdateCommand??getSelfUpdateCommand,resolveUnavailableInstruction=dependencies.getUnavailableInstruction??getSelfUpdateUnavailableInstruction,executeCommand=dependencies.runCommand??runCommand,brandUpdate=brandProfile()?.update;if(brandUpdate)return writeStdout(`${APP_NAME} ships inside ${brandUpdate.packageName}. Update it with: ${brandUpdate.command}`),!0;let loadLatestRelease=dependencies.getLatestRelease??getLatestPiRelease,latestRelease;if(!parsed.force)try{latestRelease=await loadLatestRelease(VERSION)}catch{latestRelease=void 0}let updatePackageName=latestRelease?.packageName??PACKAGE_NAME;if(!(parsed.force||!latestRelease||updatePackageName!==PACKAGE_NAME||isNewerPackageVersion(latestRelease.version,VERSION)))return writeStdout(`${APP_NAME} is already up to date (v${VERSION})`),!0;let npmCommand=readNpmCommand(),selfUpdateCommand=resolveSelfUpdateCommand(PACKAGE_NAME,npmCommand,updatePackageName);if(!selfUpdateCommand)return writeStderr(`error: ${APP_NAME} cannot self-update this installation.`),writeStderr(resolveUnavailableInstruction(PACKAGE_NAME,npmCommand,updatePackageName)),process.argv[1]&&(writeStderr(""),writeStderr(`Location of ${APP_NAME} executable: ${process.argv[1]}`)),process.exitCode=1,!0;latestRelease?.note?.trim()&&(writeStdout(""),writeStdout("Update note"),writeStdout(latestRelease.note.trim()),writeStdout("")),writeStdout(`Updating ${APP_NAME} with ${selfUpdateCommand.display}...`);for(let step of selfUpdateCommand.steps??[selfUpdateCommand])try{await executeCommand(step)}catch(error){let message=error instanceof Error?error.message:"Unknown package command error";return writeStderr(`Error: ${message}`),writeStderr(`If this keeps failing, run this command yourself: ${selfUpdateCommand.display}`),process.exitCode=1,!0}return writeStdout(`Updated ${APP_NAME}`),!0}function reexecUnderBunIfNeeded(){let options=processBunRuntimeOptions(existsSync,realpathSync),scriptRealPath=process.argv[1]??fileURLToPath(import.meta.url);try{scriptRealPath=realpathSync(scriptRealPath)}catch{}let decision=resolveBunReexec({scriptRealPath,versions:process.versions,hasInheritedInspectorOption:hasInheritedInspectorOption(),options});if(decision.action==="stay")return!1;let result=spawnSync(decision.bunPath,[scriptRealPath,...process.argv.slice(2)],{stdio:"inherit",windowsHide:!0});return result.signal?(process.kill(process.pid,result.signal),!0):(process.exitCode=result.status??1,!0)}reexecUnderBunIfNeeded()&&process.exit();enableStartupCompileCache();process.title=APP_NAME;process.env.PI_CODING_AGENT="true";process.env.AI_AGENT=APP_NAME;process.emitWarning=(()=>{});var args=process.argv.slice(2),PACKAGE_COMMANDS=new Set(["install","remove","uninstall","update","list","config"]);function isRootCommand(args2){let firstArg=args2[0];return firstArg===void 0||!PACKAGE_COMMANDS.has(firstArg)}function isPackageManagerInstall(packageDir){return packageDir.replace(/\\/g,"/").includes("/node_modules/@code-yeongyu/senpi")}function isMissingBundledWorkspaceDependencies(packageDir){return isPackageManagerInstall(packageDir)?["pi-agent-core","pi-ai","pi-tui"].some(name=>!existsSync(join2(packageDir,"node_modules","@earendil-works",name,"dist","index.js"))):!1}var ISOLATED_CHILD_ENV="SENPI_CLI_ISOLATED_CHILD";function requiresIsolatedProcess(){return process.env[ISOLATED_CHILD_ENV]==="1"?!1:process.execArgv.length>0||hasInheritedInspectorOption()}async function spawnFullCli(){let extension=import.meta.url.endsWith(".ts")?".ts":".js",fullCliPath=isBundledNode?fileURLToPath(import.meta.url):fileURLToPath(new URL(`./cli-main${extension}`,import.meta.url));releaseInheritedInspectorForChild();let childEnvironment=isBundledNode?{...process.env,[ISOLATED_CHILD_ENV]:"1"}:process.env;return await new Promise((resolve,reject)=>{let child=spawn2(process.execPath,[...process.execArgv,fullCliPath,...args],{env:childEnvironment,stdio:"inherit"});child.on("error",error=>{reject(error)}),child.on("close",(code,signal)=>{if(signal){process.kill(process.pid,signal),resolve(1);return}resolve(code??1)})})}isRootCommand(args)&&(args.includes("--version")||args.includes("-v"))&&(console.log(DISPLAY_VERSION),process.exit());if(isRootCommand(args)&&args.some(arg=>arg==="--help"||arg==="-h")){let{tryPrintHelpWithoutEngine}=await import("./chunks/help-fast-path-QXVCHTP3.js");tryPrintHelpWithoutEngine(args)&&process.exit()}isMissingBundledWorkspaceDependencies(getPackageDir())&&await handleBootstrapSelfUpdate(args)&&process.exit();requiresIsolatedProcess()?process.exitCode=await spawnFullCli():await import("./chunks/cli-main-ROBDBYAB.js");
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DefaultResourceLoader,ExtensionEditorComponent,ExtensionRunner,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,buildNoticeBox,calculateContextTokens,classifyRead,collectEntriesForBranchSummary,compact,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLastAssistantUsage,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,kernelToolsStorage,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,noticeEntryRenderer,noticeMessageRenderer,parseFrontmatter,parseSkillBlock,prepareBranchEntries,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,serializeConversation,shouldCompact,stripFrontmatter,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-LMO3WYKH.js";import{DefaultPackageManager,DynamicBorder,ExtensionInputComponent,ExtensionSelectorComponent,SessionSelectorComponent,keyHint,keyText,rawKeyHint}from"./chunks/chunk-BPHXJ4N2.js";import"./chunks/chunk-UYCGOK6M.js";import"./chunks/chunk-OLJ7LQJY.js";import{CURRENT_SESSION_VERSION,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,SessionManager,buildContextEntries,buildSessionContext,convertToLlm,formatSize,getLatestCompactionEntry,isTransportGoneError,migrateSessionEntries,parseSessionEntries,sessionEntryToContextMessages,truncateHead,truncateLine,truncateTail}from"./chunks/chunk-67Z5WNA4.js";import"./chunks/chunk-GFUZPFHN.js";import{runRpcMode}from"./chunks/chunk-WJ2BGYFK.js";import{Theme,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme}from"./chunks/chunk-IDJUNOOR.js";import{sanitizeTerminalLabel}from"./chunks/chunk-7EH64T6E.js";import"./chunks/chunk-XTXBPXZZ.js";import{SettingsManager}from"./chunks/chunk-IBHBWRC4.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-BMX2U22F.js";import{DEFAULT_HOST_LAUNCH_SPEC,HOST_EXIT_ERROR,HOST_EXIT_FALLBACK,HOST_EXIT_OK,HOST_EXIT_REFUSED,HOST_EXIT_USAGE,HostLaunchSpecError,loadHostLaunchSpec,parseHostLaunchSpec,readHostStatus,runHostCommand,runHostRequest}from"./chunks/chunk-DUV3UFKX.js";import{GENERATION_HANDOFF_CAPABILITY,HOST_PROTOCOL_VERSION,HostEnsureRefusedError,PINNED_HOST_CLIENT_CAPABILITIES,REQUIRED_HOST_CAPABILITIES,decideHostAction,ensureHost,handoffHost,parseHostProtocolInfo,probeHost,stopHost}from"./chunks/chunk-3XHWW7SQ.js";import"./chunks/chunk-HH3KJDWA.js";import{createHostDaemonPaths}from"./chunks/chunk-7PANH3NB.js";import{compareEngineOrdinal,engineBuildIdentity,engineBuildIdentityFrom}from"./chunks/chunk-NNHFMZD5.js";import"./chunks/chunk-FIJJKSPL.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-IDSOMHWS.js";import"./chunks/chunk-2NFHX2FJ.js";import{getPowerShellConfig,getShellConfig}from"./chunks/chunk-FHXKBENX.js";import"./chunks/chunk-X3T45623.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-KUPQO7MC.js";import"./chunks/chunk-HKE42SWX.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-SUQDU5KM.js";import{parseArgs}from"./chunks/chunk-VKBY4F76.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-UCTYTLP3.js";import"./chunks/chunk-L6JO4M6J.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-KLDLZHHS.js";import"./chunks/chunk-PRC5XIIH.js";import"./chunks/chunk-34HMVB33.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-Y65WFI5H.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-RBCQOIAD.js";import"./chunks/chunk-X4Q5YSTE.js";import"./chunks/chunk-IXAUDPOK.js";import"./chunks/chunk-XYM54ZWK.js";import"./chunks/chunk-WVGCQOLJ.js";import"./chunks/chunk-BPX6QWPD.js";import"./chunks/chunk-IVYZMSFY.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-BQVVQ2LQ.js";import"./chunks/chunk-IKOFCODM.js";export{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CONFIG_DIR_NAME,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_HOST_LAUNCH_SPEC,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,GENERATION_HANDOFF_CAPABILITY,HOST_EXIT_ERROR,HOST_EXIT_FALLBACK,HOST_EXIT_OK,HOST_EXIT_REFUSED,HOST_EXIT_USAGE,HOST_PROTOCOL_VERSION,HostEnsureRefusedError,HostLaunchSpecError,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,PINNED_HOST_CLIENT_CAPABILITIES,ProjectTrustStore,REQUIRED_HOST_CAPABILITIES,RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,VERSION,buildContextEntries,buildNoticeBox,buildSessionContext,calculateContextTokens,classifyRead,collectEntriesForBranchSummary,compact,compareEngineOrdinal,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createHostDaemonPaths,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,decideHostAction,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,engineBuildIdentity,engineBuildIdentityFrom,ensureHost,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getMarkdownTheme,getPackageDir,getPowerShellConfig,getReadmePath,getSelectListTheme,getSettingsListTheme,getShellConfig,handoffHost,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isTransportGoneError,isWriteToolResult,kernelToolsStorage,keyHint,keyText,loadHostLaunchSpec,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,noticeEntryRenderer,noticeMessageRenderer,parseArgs,parseFrontmatter,parseHostLaunchSpec,parseHostProtocolInfo,parseSessionEntries,parseSkillBlock,prepareBranchEntries,probeHost,rawKeyHint,readHostStatus,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runHostCommand,runHostRequest,runPrintMode,runRpcMode,sanitizeTerminalLabel,serializeConversation,sessionEntryToContextMessages,shouldCompact,stopHost,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
2
+ import{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DefaultResourceLoader,ExtensionEditorComponent,ExtensionRunner,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,buildNoticeBox,calculateContextTokens,classifyRead,collectEntriesForBranchSummary,compact,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLastAssistantUsage,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,kernelToolsStorage,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,noticeEntryRenderer,noticeMessageRenderer,parseFrontmatter,parseSkillBlock,prepareBranchEntries,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,serializeConversation,shouldCompact,stripFrontmatter,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-N46LNXHU.js";import{DefaultPackageManager,DynamicBorder,ExtensionInputComponent,ExtensionSelectorComponent,SessionSelectorComponent,keyHint,keyText,rawKeyHint}from"./chunks/chunk-XDSQYM4F.js";import"./chunks/chunk-UYCGOK6M.js";import"./chunks/chunk-BBOQ5H4W.js";import{CURRENT_SESSION_VERSION,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,SessionManager,buildContextEntries,buildSessionContext,convertToLlm,formatSize,getLatestCompactionEntry,isTransportGoneError,migrateSessionEntries,parseSessionEntries,sessionEntryToContextMessages,truncateHead,truncateLine,truncateTail}from"./chunks/chunk-PSMTQDII.js";import"./chunks/chunk-GFUZPFHN.js";import{runRpcMode}from"./chunks/chunk-KBG7BJIL.js";import{Theme,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme}from"./chunks/chunk-WUYBEF7C.js";import{sanitizeTerminalLabel}from"./chunks/chunk-ORCF262V.js";import"./chunks/chunk-EN6KDFY2.js";import{SettingsManager}from"./chunks/chunk-ZEFQYQOU.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-BMX2U22F.js";import{DEFAULT_HOST_LAUNCH_SPEC,HOST_EXIT_ERROR,HOST_EXIT_FALLBACK,HOST_EXIT_OK,HOST_EXIT_REFUSED,HOST_EXIT_USAGE,HostLaunchSpecError,loadHostLaunchSpec,parseHostLaunchSpec,readHostStatus,runHostCommand,runHostRequest}from"./chunks/chunk-DUV3UFKX.js";import{GENERATION_HANDOFF_CAPABILITY,HOST_PROTOCOL_VERSION,HostEnsureRefusedError,PINNED_HOST_CLIENT_CAPABILITIES,REQUIRED_HOST_CAPABILITIES,decideHostAction,ensureHost,handoffHost,parseHostProtocolInfo,probeHost,stopHost}from"./chunks/chunk-3XHWW7SQ.js";import"./chunks/chunk-HH3KJDWA.js";import{createHostDaemonPaths}from"./chunks/chunk-7PANH3NB.js";import{compareEngineOrdinal,engineBuildIdentity,engineBuildIdentityFrom}from"./chunks/chunk-NNHFMZD5.js";import"./chunks/chunk-FIJJKSPL.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-WXIRFRXY.js";import"./chunks/chunk-J3QXPP4T.js";import{getPowerShellConfig,getShellConfig}from"./chunks/chunk-FHXKBENX.js";import"./chunks/chunk-X3T45623.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-KUPQO7MC.js";import"./chunks/chunk-HKE42SWX.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-SUQDU5KM.js";import{parseArgs}from"./chunks/chunk-VKBY4F76.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-3RN6BFG2.js";import"./chunks/chunk-L6JO4M6J.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-KLDLZHHS.js";import"./chunks/chunk-PRC5XIIH.js";import"./chunks/chunk-34HMVB33.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-Y65WFI5H.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-RBCQOIAD.js";import"./chunks/chunk-X4Q5YSTE.js";import"./chunks/chunk-IXAUDPOK.js";import"./chunks/chunk-XYM54ZWK.js";import"./chunks/chunk-WVGCQOLJ.js";import"./chunks/chunk-BPX6QWPD.js";import"./chunks/chunk-IVYZMSFY.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-BQVVQ2LQ.js";import"./chunks/chunk-IKOFCODM.js";export{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CONFIG_DIR_NAME,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_HOST_LAUNCH_SPEC,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,GENERATION_HANDOFF_CAPABILITY,HOST_EXIT_ERROR,HOST_EXIT_FALLBACK,HOST_EXIT_OK,HOST_EXIT_REFUSED,HOST_EXIT_USAGE,HOST_PROTOCOL_VERSION,HostEnsureRefusedError,HostLaunchSpecError,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,PINNED_HOST_CLIENT_CAPABILITIES,ProjectTrustStore,REQUIRED_HOST_CAPABILITIES,RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,VERSION,buildContextEntries,buildNoticeBox,buildSessionContext,calculateContextTokens,classifyRead,collectEntriesForBranchSummary,compact,compareEngineOrdinal,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createHostDaemonPaths,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,decideHostAction,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,engineBuildIdentity,engineBuildIdentityFrom,ensureHost,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getMarkdownTheme,getPackageDir,getPowerShellConfig,getReadmePath,getSelectListTheme,getSettingsListTheme,getShellConfig,handoffHost,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isTransportGoneError,isWriteToolResult,kernelToolsStorage,keyHint,keyText,loadHostLaunchSpec,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,noticeEntryRenderer,noticeMessageRenderer,parseArgs,parseFrontmatter,parseHostLaunchSpec,parseHostProtocolInfo,parseSessionEntries,parseSkillBlock,prepareBranchEntries,probeHost,rawKeyHint,readHostStatus,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runHostCommand,runHostRequest,runPrintMode,runRpcMode,sanitizeTerminalLabel,serializeConversation,sessionEntryToContextMessages,shouldCompact,stopHost,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
3
- import{main}from"./chunks/chunk-LMO3WYKH.js";import"./chunks/chunk-BPHXJ4N2.js";import"./chunks/chunk-UYCGOK6M.js";import"./chunks/chunk-OLJ7LQJY.js";import"./chunks/chunk-67Z5WNA4.js";import"./chunks/chunk-GFUZPFHN.js";import"./chunks/chunk-WJ2BGYFK.js";import"./chunks/chunk-IDJUNOOR.js";import"./chunks/chunk-7EH64T6E.js";import"./chunks/chunk-XTXBPXZZ.js";import{configureHttpDispatcher}from"./chunks/chunk-IBHBWRC4.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-DUV3UFKX.js";import"./chunks/chunk-3XHWW7SQ.js";import"./chunks/chunk-HH3KJDWA.js";import"./chunks/chunk-7PANH3NB.js";import"./chunks/chunk-NNHFMZD5.js";import"./chunks/chunk-FIJJKSPL.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-IDSOMHWS.js";import"./chunks/chunk-2NFHX2FJ.js";import"./chunks/chunk-FHXKBENX.js";import"./chunks/chunk-X3T45623.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-KUPQO7MC.js";import"./chunks/chunk-HKE42SWX.js";import"./chunks/chunk-SUQDU5KM.js";import"./chunks/chunk-VKBY4F76.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-UCTYTLP3.js";import"./chunks/chunk-L6JO4M6J.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-KLDLZHHS.js";import"./chunks/chunk-PRC5XIIH.js";import"./chunks/chunk-34HMVB33.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import{APP_NAME,scrubBrandFromEnvironment}from"./chunks/chunk-Y65WFI5H.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-RBCQOIAD.js";import"./chunks/chunk-X4Q5YSTE.js";import"./chunks/chunk-IXAUDPOK.js";import"./chunks/chunk-XYM54ZWK.js";import"./chunks/chunk-WVGCQOLJ.js";import"./chunks/chunk-BPX6QWPD.js";import"./chunks/chunk-IVYZMSFY.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-BQVVQ2LQ.js";import"./chunks/chunk-IKOFCODM.js";process.title=`${APP_NAME}-rpc`;scrubBrandFromEnvironment();process.env.PI_CODING_AGENT="true";process.env.AI_AGENT=APP_NAME;process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
3
+ import{main}from"./chunks/chunk-N46LNXHU.js";import"./chunks/chunk-XDSQYM4F.js";import"./chunks/chunk-UYCGOK6M.js";import"./chunks/chunk-BBOQ5H4W.js";import"./chunks/chunk-PSMTQDII.js";import"./chunks/chunk-GFUZPFHN.js";import"./chunks/chunk-KBG7BJIL.js";import"./chunks/chunk-WUYBEF7C.js";import"./chunks/chunk-ORCF262V.js";import"./chunks/chunk-EN6KDFY2.js";import{configureHttpDispatcher}from"./chunks/chunk-ZEFQYQOU.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-DUV3UFKX.js";import"./chunks/chunk-3XHWW7SQ.js";import"./chunks/chunk-HH3KJDWA.js";import"./chunks/chunk-7PANH3NB.js";import"./chunks/chunk-NNHFMZD5.js";import"./chunks/chunk-FIJJKSPL.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-WXIRFRXY.js";import"./chunks/chunk-J3QXPP4T.js";import"./chunks/chunk-FHXKBENX.js";import"./chunks/chunk-X3T45623.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-KUPQO7MC.js";import"./chunks/chunk-HKE42SWX.js";import"./chunks/chunk-SUQDU5KM.js";import"./chunks/chunk-VKBY4F76.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-3RN6BFG2.js";import"./chunks/chunk-L6JO4M6J.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-KLDLZHHS.js";import"./chunks/chunk-PRC5XIIH.js";import"./chunks/chunk-34HMVB33.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import{APP_NAME,scrubBrandFromEnvironment}from"./chunks/chunk-Y65WFI5H.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-RBCQOIAD.js";import"./chunks/chunk-X4Q5YSTE.js";import"./chunks/chunk-IXAUDPOK.js";import"./chunks/chunk-XYM54ZWK.js";import"./chunks/chunk-WVGCQOLJ.js";import"./chunks/chunk-BPX6QWPD.js";import"./chunks/chunk-IVYZMSFY.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-BQVVQ2LQ.js";import"./chunks/chunk-IKOFCODM.js";process.title=`${APP_NAME}-rpc`;scrubBrandFromEnvironment();process.env.PI_CODING_AGENT="true";process.env.AI_AGENT=APP_NAME;process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Minimum Claude Code versions the Anthropic API has been observed to demand for a model, taken
3
+ * from its 400 "Claude Code X does not support this model; version Y or newer is required".
4
+ * Append-only: record a floor only from such an observed rejection, never from a guess.
5
+ */
6
+ export declare const OBSERVED_CLAUDE_CODE_MODEL_FLOORS: Readonly<Record<string, string>>;
7
+ export type BundledClaudeCodeBinary = {
8
+ path: string;
9
+ claudeCodeVersion: string | undefined;
10
+ };
11
+ /** The platform binary the pinned SDK ships for this host - never a `claude` on PATH. */
12
+ export declare function bundledClaudeCodeBinary(): BundledClaudeCodeBinary | undefined;
13
+ /**
14
+ * Which of `tokens` the Claude Code binary at `path` embeds as plain text. The binary is a compiled
15
+ * bundle whose model table is stored verbatim, so a model id it does not contain is one it predates.
16
+ * Read in chunks that overlap by the longest token so a match across a chunk boundary is not lost.
17
+ */
18
+ export declare function binaryEmbedsTokens(path: string, tokens: readonly string[]): Map<string, boolean>;
19
+ //# sourceMappingURL=executable-model-support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executable-model-support.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/anthropic-subscription/executable-model-support.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAG9E,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE9F,yFAAyF;AACzF,wBAAgB,uBAAuB,IAAI,uBAAuB,GAAG,SAAS,CAiB7E;AAiBD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAwBhG"}
@@ -0,0 +1,76 @@
1
+ import { closeSync, openSync, readSync } from "node:fs";
2
+ import { claudeCodeExecutableCandidates, defaultExecutableDeps } from "./executable.js";
3
+ import { bundledClaudeCodeVersion } from "./executable-version.js";
4
+ /**
5
+ * Minimum Claude Code versions the Anthropic API has been observed to demand for a model, taken
6
+ * from its 400 "Claude Code X does not support this model; version Y or newer is required".
7
+ * Append-only: record a floor only from such an observed rejection, never from a guess.
8
+ */
9
+ export const OBSERVED_CLAUDE_CODE_MODEL_FLOORS = {
10
+ "claude-fable-5-1": "2.1.251",
11
+ "claude-opus-5-5": "2.1.280",
12
+ };
13
+ /** The platform binary the pinned SDK ships for this host - never a `claude` on PATH. */
14
+ export function bundledClaudeCodeBinary() {
15
+ const deps = defaultExecutableDeps();
16
+ const candidates = claudeCodeExecutableCandidates(deps.platform, deps.arch, deps.platform === "linux" && deps.isMusl?.() === true);
17
+ for (const candidate of candidates) {
18
+ let path;
19
+ try {
20
+ path = deps.resolve(candidate);
21
+ }
22
+ catch {
23
+ continue; // this platform package is not installed; try the next candidate
24
+ }
25
+ if (deps.isFile(path))
26
+ return { path, claudeCodeVersion: bundledClaudeCodeVersion() };
27
+ }
28
+ return undefined;
29
+ }
30
+ const CHUNK_BYTES = 8 * 1024 * 1024;
31
+ const ID_BYTE = /[A-Za-z0-9._-]/;
32
+ function isIdByte(byte) {
33
+ return byte !== undefined && ID_BYTE.test(String.fromCharCode(byte));
34
+ }
35
+ /** True when `needle` occurs in `chunk` as a whole token, so `claude-opus-5` never matches inside `claude-opus-5-5`. */
36
+ function containsToken(chunk, needle) {
37
+ for (let at = chunk.indexOf(needle); at !== -1; at = chunk.indexOf(needle, at + 1)) {
38
+ if (!isIdByte(chunk[at - 1]) && !isIdByte(chunk[at + needle.length]))
39
+ return true;
40
+ }
41
+ return false;
42
+ }
43
+ /**
44
+ * Which of `tokens` the Claude Code binary at `path` embeds as plain text. The binary is a compiled
45
+ * bundle whose model table is stored verbatim, so a model id it does not contain is one it predates.
46
+ * Read in chunks that overlap by the longest token so a match across a chunk boundary is not lost.
47
+ */
48
+ export function binaryEmbedsTokens(path, tokens) {
49
+ const needles = tokens.map((token) => ({ token, bytes: Buffer.from(token) }));
50
+ const found = new Map(tokens.map((token) => [token, false]));
51
+ const overlap = Math.max(0, ...needles.map(({ bytes }) => bytes.length)) + 1;
52
+ const buffer = Buffer.alloc(CHUNK_BYTES + overlap);
53
+ const fd = openSync(path, "r");
54
+ try {
55
+ let carried = 0;
56
+ let position = 0;
57
+ for (;;) {
58
+ const read = readSync(fd, buffer, carried, CHUNK_BYTES, position);
59
+ if (read === 0)
60
+ break;
61
+ position += read;
62
+ const chunk = buffer.subarray(0, carried + read);
63
+ for (const { token, bytes } of needles) {
64
+ if (!found.get(token) && containsToken(chunk, bytes))
65
+ found.set(token, true);
66
+ }
67
+ carried = Math.min(overlap, chunk.length);
68
+ chunk.copy(buffer, 0, chunk.length - carried);
69
+ }
70
+ }
71
+ finally {
72
+ closeSync(fd);
73
+ }
74
+ return found;
75
+ }
76
+ //# sourceMappingURL=executable-model-support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executable-model-support.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/anthropic-subscription/executable-model-support.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,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S,CAAC;YACT,MAAM,IAAI,GAAG,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;YAClE,IAAI,IAAI,KAAK,CAAC;gBAAE,MAAM;YACtB,QAAQ,IAAI,IAAI,CAAC;YACjB,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,CAAC;YACjD,KAAK,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,OAAO,EAAE,CAAC;gBACxC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC;oBAAE,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAC9E,CAAC;YACD,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YAC1C,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC;QAC/C,CAAC;IACF,CAAC;YAAS,CAAC;QACV,SAAS,CAAC,EAAE,CAAC,CAAC;IACf,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["import { closeSync, openSync, readSync } from \"node:fs\";\nimport { claudeCodeExecutableCandidates, defaultExecutableDeps } from \"./executable.ts\";\nimport { bundledClaudeCodeVersion } from \"./executable-version.ts\";\n\n/**\n * Minimum Claude Code versions the Anthropic API has been observed to demand for a model, taken\n * from its 400 \"Claude Code X does not support this model; version Y or newer is required\".\n * Append-only: record a floor only from such an observed rejection, never from a guess.\n */\nexport const OBSERVED_CLAUDE_CODE_MODEL_FLOORS: Readonly<Record<string, string>> = {\n\t\"claude-fable-5-1\": \"2.1.251\",\n\t\"claude-opus-5-5\": \"2.1.280\",\n};\n\nexport type BundledClaudeCodeBinary = { path: string; claudeCodeVersion: string | undefined };\n\n/** The platform binary the pinned SDK ships for this host - never a `claude` on PATH. */\nexport function bundledClaudeCodeBinary(): BundledClaudeCodeBinary | undefined {\n\tconst deps = defaultExecutableDeps();\n\tconst candidates = claudeCodeExecutableCandidates(\n\t\tdeps.platform,\n\t\tdeps.arch,\n\t\tdeps.platform === \"linux\" && deps.isMusl?.() === true,\n\t);\n\tfor (const candidate of candidates) {\n\t\tlet path: string;\n\t\ttry {\n\t\t\tpath = deps.resolve(candidate);\n\t\t} catch {\n\t\t\tcontinue; // this platform package is not installed; try the next candidate\n\t\t}\n\t\tif (deps.isFile(path)) return { path, claudeCodeVersion: bundledClaudeCodeVersion() };\n\t}\n\treturn undefined;\n}\n\nconst CHUNK_BYTES = 8 * 1024 * 1024;\nconst ID_BYTE = /[A-Za-z0-9._-]/;\n\nfunction isIdByte(byte: number | undefined): boolean {\n\treturn byte !== undefined && ID_BYTE.test(String.fromCharCode(byte));\n}\n\n/** True when `needle` occurs in `chunk` as a whole token, so `claude-opus-5` never matches inside `claude-opus-5-5`. */\nfunction containsToken(chunk: Buffer, needle: Buffer): boolean {\n\tfor (let at = chunk.indexOf(needle); at !== -1; at = chunk.indexOf(needle, at + 1)) {\n\t\tif (!isIdByte(chunk[at - 1]) && !isIdByte(chunk[at + needle.length])) return true;\n\t}\n\treturn false;\n}\n\n/**\n * Which of `tokens` the Claude Code binary at `path` embeds as plain text. The binary is a compiled\n * bundle whose model table is stored verbatim, so a model id it does not contain is one it predates.\n * Read in chunks that overlap by the longest token so a match across a chunk boundary is not lost.\n */\nexport function binaryEmbedsTokens(path: string, tokens: readonly string[]): Map<string, boolean> {\n\tconst needles = tokens.map((token) => ({ token, bytes: Buffer.from(token) }));\n\tconst found = new Map(tokens.map((token) => [token, false]));\n\tconst overlap = Math.max(0, ...needles.map(({ bytes }) => bytes.length)) + 1;\n\tconst buffer = Buffer.alloc(CHUNK_BYTES + overlap);\n\tconst fd = openSync(path, \"r\");\n\ttry {\n\t\tlet carried = 0;\n\t\tlet position = 0;\n\t\tfor (;;) {\n\t\t\tconst read = readSync(fd, buffer, carried, CHUNK_BYTES, position);\n\t\t\tif (read === 0) break;\n\t\t\tposition += read;\n\t\t\tconst chunk = buffer.subarray(0, carried + read);\n\t\t\tfor (const { token, bytes } of needles) {\n\t\t\t\tif (!found.get(token) && containsToken(chunk, bytes)) found.set(token, true);\n\t\t\t}\n\t\t\tcarried = Math.min(overlap, chunk.length);\n\t\t\tchunk.copy(buffer, 0, chunk.length - carried);\n\t\t}\n\t} finally {\n\t\tcloseSync(fd);\n\t}\n\treturn found;\n}\n"]}
@@ -3,12 +3,17 @@ export type PathLookupDeps = {
3
3
  env: (name: string) => string | undefined;
4
4
  /** True when `path` names an existing regular file in THIS process. */
5
5
  isFile: (path: string) => boolean;
6
+ /** Text of a win32 batch file on PATH; without it batch files are skipped, never returned. */
7
+ readText?: (path: string) => string | undefined;
8
+ /** Called for each win32 batch file that was skipped because it wraps no native binary. */
9
+ onSkip?: (path: string) => void;
6
10
  };
7
11
  /**
8
12
  * The first regular file `name` resolves to on PATH - the binary `where claude` (win32) or
9
13
  * `command -v claude` prints - found without a shell. Honours PATHEXT on win32 so the bare `claude`
10
- * finds `claude.exe`. Directories and dangling entries are skipped, so a hit is a file this process
11
- * can stat. Returns `undefined` when PATH is unset or has no match.
14
+ * finds `claude.exe`; a `.cmd`/`.bat` hit resolves to the native binary it wraps or is skipped.
15
+ * Directories and dangling entries are skipped, so a hit is a file this process can stat. Returns
16
+ * `undefined` when PATH is unset or has no match.
12
17
  */
13
18
  export declare function findExecutableOnPath(name: string, deps: PathLookupDeps): string | undefined;
14
19
  //# sourceMappingURL=executable-path-lookup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"executable-path-lookup.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/anthropic-subscription/executable-path-lookup.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC1C,uEAAuE;IACvE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CAClC,CAAC;AAyBF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAU3F"}
1
+ {"version":3,"file":"executable-path-lookup.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/anthropic-subscription/executable-path-lookup.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC1C,uEAAuE;IACvE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAChD,2FAA2F;IAC3F,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC,CAAC;AA6CF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAc3F"}
@@ -1,4 +1,22 @@
1
1
  import { posix, win32 } from "node:path";
2
+ const WIN32_BATCH_EXTENSIONS = new Set([".bat", ".cmd"]);
3
+ /**
4
+ * The target of an npm cmd-shim (`"%dp0%\node_modules\...\claude.exe" %*`, older shims spell
5
+ * `%~dp0`). npm installs Claude Code on Windows as such a shim around its native `bin\claude.exe`.
6
+ */
7
+ const CMD_SHIM_NATIVE_TARGET = /"%~?dp0%?\\([^"%]+?\.exe)"/i;
8
+ /**
9
+ * The native binary a win32 batch file on PATH wraps. The SDK spawns without a shell and Node
10
+ * refuses to exec `.cmd`/`.bat` directly, so a batch file itself is never a usable candidate.
11
+ */
12
+ function nativeTargetOfBatchFile(batchPath, deps) {
13
+ const text = deps.readText?.(batchPath);
14
+ const match = text === undefined ? null : CMD_SHIM_NATIVE_TARGET.exec(text);
15
+ if (!match?.[1])
16
+ return undefined;
17
+ const target = win32.join(win32.dirname(batchPath), match[1]);
18
+ return deps.isFile(target) ? target : undefined;
19
+ }
2
20
  /** What Windows uses when PATHEXT is unset; the executable image types come first, as `where` orders them. */
3
21
  const WIN32_DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
4
22
  /** Spellings `where`/`command -v` would test for `name` inside one PATH directory. */
@@ -24,8 +42,9 @@ function pathDirectories(platform, path) {
24
42
  /**
25
43
  * The first regular file `name` resolves to on PATH - the binary `where claude` (win32) or
26
44
  * `command -v claude` prints - found without a shell. Honours PATHEXT on win32 so the bare `claude`
27
- * finds `claude.exe`. Directories and dangling entries are skipped, so a hit is a file this process
28
- * can stat. Returns `undefined` when PATH is unset or has no match.
45
+ * finds `claude.exe`; a `.cmd`/`.bat` hit resolves to the native binary it wraps or is skipped.
46
+ * Directories and dangling entries are skipped, so a hit is a file this process can stat. Returns
47
+ * `undefined` when PATH is unset or has no match.
29
48
  */
30
49
  export function findExecutableOnPath(name, deps) {
31
50
  const join = deps.platform === "win32" ? win32.join : posix.join;
@@ -33,8 +52,14 @@ export function findExecutableOnPath(name, deps) {
33
52
  for (const directory of pathDirectories(deps.platform, deps.env("PATH"))) {
34
53
  for (const candidate of names) {
35
54
  const path = join(directory, candidate);
36
- if (deps.isFile(path))
55
+ if (!deps.isFile(path))
56
+ continue;
57
+ if (deps.platform !== "win32" || !WIN32_BATCH_EXTENSIONS.has(win32.extname(path).toLowerCase()))
37
58
  return path;
59
+ const target = nativeTargetOfBatchFile(path, deps);
60
+ if (target !== undefined)
61
+ return target;
62
+ deps.onSkip?.(path);
38
63
  }
39
64
  }
40
65
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"executable-path-lookup.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/anthropic-subscription/executable-path-lookup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AASzC,8GAA8G;AAC9G,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAEpD,sFAAsF;AACtF,SAAS,YAAY,CAAC,IAAY,EAAE,QAAgB,EAAE,OAA2B;IAChF,IAAI,QAAQ,KAAK,OAAO;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,UAAU,GAAG,CAAC,OAAO,IAAI,qBAAqB,CAAC;SACnD,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;SAC3C,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9C,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED,+GAA+G;AAC/G,SAAS,eAAe,CAAC,QAAgB,EAAE,IAAwB;IAClE,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAClC,MAAM,SAAS,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACnD,OAAO,IAAI;SACT,KAAK,CAAC,SAAS,CAAC;SAChB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;SAChF,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY,EAAE,IAAoB;IACtE,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;IACjE,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;IACrE,KAAK,MAAM,SAAS,IAAI,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QAC1E,KAAK,MAAM,SAAS,IAAI,KAAK,EAAE,CAAC;YAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YACxC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;QACpC,CAAC;IACF,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["import { posix, win32 } from \"node:path\";\n\nexport type PathLookupDeps = {\n\tplatform: string;\n\tenv: (name: string) => string | undefined;\n\t/** True when `path` names an existing regular file in THIS process. */\n\tisFile: (path: string) => boolean;\n};\n\n/** What Windows uses when PATHEXT is unset; the executable image types come first, as `where` orders them. */\nconst WIN32_DEFAULT_PATHEXT = \".COM;.EXE;.BAT;.CMD\";\n\n/** Spellings `where`/`command -v` would test for `name` inside one PATH directory. */\nfunction namesToProbe(name: string, platform: string, pathext: string | undefined): string[] {\n\tif (platform !== \"win32\") return [name];\n\tconst extensions = (pathext ?? WIN32_DEFAULT_PATHEXT)\n\t\t.split(\";\")\n\t\t.filter((extension) => extension.length > 0)\n\t\t.map((extension) => extension.toLowerCase());\n\treturn extensions.map((extension) => `${name}${extension}`);\n}\n\n/** Entries of PATH in order, dropping empties; `cmd.exe` accepts quoted entries, so they are unquoted here. */\nfunction pathDirectories(platform: string, path: string | undefined): string[] {\n\tif (path === undefined) return [];\n\tconst delimiter = platform === \"win32\" ? \";\" : \":\";\n\treturn path\n\t\t.split(delimiter)\n\t\t.map((entry) => (platform === \"win32\" ? entry.replace(/^\"(.*)\"$/, \"$1\") : entry))\n\t\t.filter((entry) => entry.length > 0);\n}\n\n/**\n * The first regular file `name` resolves to on PATH - the binary `where claude` (win32) or\n * `command -v claude` prints - found without a shell. Honours PATHEXT on win32 so the bare `claude`\n * finds `claude.exe`. Directories and dangling entries are skipped, so a hit is a file this process\n * can stat. Returns `undefined` when PATH is unset or has no match.\n */\nexport function findExecutableOnPath(name: string, deps: PathLookupDeps): string | undefined {\n\tconst join = deps.platform === \"win32\" ? win32.join : posix.join;\n\tconst names = namesToProbe(name, deps.platform, deps.env(\"PATHEXT\"));\n\tfor (const directory of pathDirectories(deps.platform, deps.env(\"PATH\"))) {\n\t\tfor (const candidate of names) {\n\t\t\tconst path = join(directory, candidate);\n\t\t\tif (deps.isFile(path)) return path;\n\t\t}\n\t}\n\treturn undefined;\n}\n"]}
1
+ {"version":3,"file":"executable-path-lookup.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/anthropic-subscription/executable-path-lookup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAazC,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAAM,sBAAsB,GAAG,6BAA6B,CAAC;AAE7D;;;GAGG;AACH,SAAS,uBAAuB,CAAC,SAAiB,EAAE,IAAoB;IACvE,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,IAAI,KAAK,S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,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;IACF,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["import { posix, win32 } from \"node:path\";\n\nexport type PathLookupDeps = {\n\tplatform: string;\n\tenv: (name: string) => string | undefined;\n\t/** True when `path` names an existing regular file in THIS process. */\n\tisFile: (path: string) => boolean;\n\t/** Text of a win32 batch file on PATH; without it batch files are skipped, never returned. */\n\treadText?: (path: string) => string | undefined;\n\t/** Called for each win32 batch file that was skipped because it wraps no native binary. */\n\tonSkip?: (path: string) => void;\n};\n\nconst WIN32_BATCH_EXTENSIONS = new Set([\".bat\", \".cmd\"]);\n\n/**\n * The target of an npm cmd-shim (`\"%dp0%\\node_modules\\...\\claude.exe\" %*`, older shims spell\n * `%~dp0`). npm installs Claude Code on Windows as such a shim around its native `bin\\claude.exe`.\n */\nconst CMD_SHIM_NATIVE_TARGET = /\"%~?dp0%?\\\\([^\"%]+?\\.exe)\"/i;\n\n/**\n * The native binary a win32 batch file on PATH wraps. The SDK spawns without a shell and Node\n * refuses to exec `.cmd`/`.bat` directly, so a batch file itself is never a usable candidate.\n */\nfunction nativeTargetOfBatchFile(batchPath: string, deps: PathLookupDeps): string | undefined {\n\tconst text = deps.readText?.(batchPath);\n\tconst match = text === undefined ? null : CMD_SHIM_NATIVE_TARGET.exec(text);\n\tif (!match?.[1]) return undefined;\n\tconst target = win32.join(win32.dirname(batchPath), match[1]);\n\treturn deps.isFile(target) ? target : undefined;\n}\n\n/** What Windows uses when PATHEXT is unset; the executable image types come first, as `where` orders them. */\nconst WIN32_DEFAULT_PATHEXT = \".COM;.EXE;.BAT;.CMD\";\n\n/** Spellings `where`/`command -v` would test for `name` inside one PATH directory. */\nfunction namesToProbe(name: string, platform: string, pathext: string | undefined): string[] {\n\tif (platform !== \"win32\") return [name];\n\tconst extensions = (pathext ?? WIN32_DEFAULT_PATHEXT)\n\t\t.split(\";\")\n\t\t.filter((extension) => extension.length > 0)\n\t\t.map((extension) => extension.toLowerCase());\n\treturn extensions.map((extension) => `${name}${extension}`);\n}\n\n/** Entries of PATH in order, dropping empties; `cmd.exe` accepts quoted entries, so they are unquoted here. */\nfunction pathDirectories(platform: string, path: string | undefined): string[] {\n\tif (path === undefined) return [];\n\tconst delimiter = platform === \"win32\" ? \";\" : \":\";\n\treturn path\n\t\t.split(delimiter)\n\t\t.map((entry) => (platform === \"win32\" ? entry.replace(/^\"(.*)\"$/, \"$1\") : entry))\n\t\t.filter((entry) => entry.length > 0);\n}\n\n/**\n * The first regular file `name` resolves to on PATH - the binary `where claude` (win32) or\n * `command -v claude` prints - found without a shell. Honours PATHEXT on win32 so the bare `claude`\n * finds `claude.exe`; a `.cmd`/`.bat` hit resolves to the native binary it wraps or is skipped.\n * Directories and dangling entries are skipped, so a hit is a file this process can stat. Returns\n * `undefined` when PATH is unset or has no match.\n */\nexport function findExecutableOnPath(name: string, deps: PathLookupDeps): string | undefined {\n\tconst join = deps.platform === \"win32\" ? win32.join : posix.join;\n\tconst names = namesToProbe(name, deps.platform, deps.env(\"PATHEXT\"));\n\tfor (const directory of pathDirectories(deps.platform, deps.env(\"PATH\"))) {\n\t\tfor (const candidate of names) {\n\t\t\tconst path = join(directory, candidate);\n\t\t\tif (!deps.isFile(path)) continue;\n\t\t\tif (deps.platform !== \"win32\" || !WIN32_BATCH_EXTENSIONS.has(win32.extname(path).toLowerCase())) return path;\n\t\t\tconst target = nativeTargetOfBatchFile(path, deps);\n\t\t\tif (target !== undefined) return target;\n\t\t\tdeps.onSkip?.(path);\n\t\t}\n\t}\n\treturn undefined;\n}\n"]}
@@ -5,6 +5,8 @@ export type ExecutableDeps = {
5
5
  resolve: (spec: string) => string;
6
6
  /** True when `path` names an existing regular file in THIS process - what the SDK's spawn will see. */
7
7
  isFile: (path: string) => boolean;
8
+ /** Text of a win32 batch file found on PATH, so an npm `claude.cmd` shim resolves to its native binary. */
9
+ readText?: (path: string) => string | undefined;
8
10
  isMusl?: () => boolean;
9
11
  isCompiledBun?: () => boolean;
10
12
  extractFromBunfs?: (embeddedPath: string) => string;
@@ -13,9 +15,16 @@ export type ExecutableDeps = {
13
15
  /** Reported version of a Claude Code binary. Without it the bundled binary is never compared against PATH. */
14
16
  versionOf?: (executable: string) => string | undefined;
15
17
  };
18
+ /** Where the spawned Claude Code came from; decides which remedy a version-floor error can offer. */
19
+ export type ClaudeCodeExecutableSource = "override" | "bundled" | "path";
20
+ export type ClaudeCodeRun = {
21
+ executable: string;
22
+ source: ClaudeCodeExecutableSource;
23
+ };
16
24
  export type ExecutableResolution = {
17
25
  /** The spawnable spelling, or `undefined` when every candidate was rejected. */
18
26
  executable: string | undefined;
27
+ source: ClaudeCodeExecutableSource | undefined;
19
28
  /** Every spelling checked, in order; the last entry is the winner when `executable` is set. */
20
29
  tried: string[];
21
30
  };
@@ -31,6 +40,8 @@ export declare function claudeCodeExecutableCandidates(platform: string, arch: s
31
40
  export declare function describeClaudeCodeExecutable(deps: ExecutableDeps): ExecutableResolution;
32
41
  /** The validated executable, or senpi's own error naming every candidate - the SDK never sees a miss. */
33
42
  export declare function resolveClaudeCodeExecutable(deps: ExecutableDeps): string;
43
+ /** {@link resolveClaudeCodeExecutable} plus where the binary came from. */
44
+ export declare function resolveClaudeCodeRun(deps: ExecutableDeps): ClaudeCodeRun;
34
45
  export declare function defaultExecutableDeps(): ExecutableDeps;
35
46
  export declare function overrideExecutableDeps(override: Partial<ExecutableDeps>): void;
36
47
  export declare function resetExecutableDeps(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"executable.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/anthropic-subscription/executable.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC1C,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAClC,uGAAuG;IACvG,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC;IAC9B,gBAAgB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD,sGAAsG;IACtG,cAAc,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAC1C,8GAA8G;IAC9G,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CACvD,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAClC,gFAAgF;IAChF,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,+FAA+F;IAC/F,KAAK,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,UAAQ,GAAG,MAAM,EAAE,CAQ3G;AAYD;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,cAAc,GAAG,oBAAoB,CAsCvF;AAiDD,yGAAyG;AACzG,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAWxE;AA6CD,wBAAgB,qBAAqB,IAAI,cAAc,CAEtD;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAE9E;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
1
+ {"version":3,"file":"executable.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/anthropic-subscription/executable.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,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AACzG,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAExE;AAED,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,aAAa,CAaxE;AAsDD,wBAAgB,qBAAqB,IAAI,cAAc,CAEtD;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAE9E;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
@@ -1,4 +1,4 @@
1
- import { statSync } from "node:fs";
1
+ import { readFileSync, statSync } from "node:fs";
2
2
  import { createRequire } from "node:module";
3
3
  import { posix, win32 } from "node:path";
4
4
  import { extractFromBunfs } from "@anthropic-ai/claude-agent-sdk/extract";
@@ -37,32 +37,39 @@ export function describeClaudeCodeExecutable(deps) {
37
37
  tried.push(spelled);
38
38
  return deps.isFile(spelled) ? spelled : undefined;
39
39
  };
40
- const done = (executable) => ({ executable, tried });
40
+ const done = (executable, source) => ({
41
+ executable,
42
+ source,
43
+ tried,
44
+ });
41
45
  const override = deps.env("CLAUDE_CODE_EXECUTABLE");
42
46
  if (override) {
43
47
  const accepted = accept(override);
44
48
  if (accepted !== undefined)
45
- return done(accepted);
49
+ return done(accepted, "override");
46
50
  }
47
51
  const candidates = claudeCodeExecutableCandidates(deps.platform, deps.arch, deps.platform === "linux" && deps.isMusl?.() === true);
48
52
  const bundled = acceptBundled(deps, candidates, accept, tried);
49
53
  if (bundled !== undefined) {
50
54
  const newer = newerClaudeOnPath(deps, bundled);
51
55
  if (newer === undefined)
52
- return done(bundled);
56
+ return done(bundled, "bundled");
53
57
  tried.push(newer);
54
- return done(newer);
58
+ return done(newer, "path");
55
59
  }
56
- const onPath = findExecutableOnPath("claude", deps);
60
+ const onPath = findExecutableOnPath("claude", {
61
+ ...deps,
62
+ onSkip: (batchFile) => tried.push(`${batchFile} (batch file wrapping no native binary)`),
63
+ });
57
64
  if (onPath !== undefined) {
58
65
  const accepted = accept(onPath);
59
66
  if (accepted !== undefined)
60
- return done(accepted);
67
+ return done(accepted, "path");
61
68
  }
62
69
  else {
63
70
  tried.push(deps.env("PATH") ? "claude on PATH" : "claude on PATH (PATH is unset)");
64
71
  }
65
- return { executable: undefined, tried };
72
+ return { executable: undefined, source: undefined, tried };
66
73
  }
67
74
  function acceptBundled(deps, candidates, accept, tried) {
68
75
  if (deps.isCompiledBun?.() && deps.extractFromBunfs) {
@@ -113,9 +120,14 @@ function newerClaudeOnPath(deps, bundled) {
113
120
  }
114
121
  /** The validated executable, or senpi's own error naming every candidate - the SDK never sees a miss. */
115
122
  export function resolveClaudeCodeExecutable(deps) {
123
+ return resolveClaudeCodeRun(deps).executable;
124
+ }
125
+ /** {@link resolveClaudeCodeExecutable} plus where the binary came from. */
126
+ export function resolveClaudeCodeRun(deps) {
116
127
  const resolution = describeClaudeCodeExecutable(deps);
117
- if (resolution.executable !== undefined)
118
- return resolution.executable;
128
+ if (resolution.executable !== undefined && resolution.source !== undefined) {
129
+ return { executable: resolution.executable, source: resolution.source };
130
+ }
119
131
  throw new Error([
120
132
  `Claude Code executable not found for ${deps.platform}-${deps.arch}. Tried:`,
121
133
  ...resolution.tried.map((candidate) => ` - ${candidate}`),
@@ -134,6 +146,14 @@ function isMuslLinuxRuntime() {
134
146
  }
135
147
  return !("glibcVersionRuntime" in report.header) || report.header.glibcVersionRuntime === undefined;
136
148
  }
149
+ function readBatchFileText(path) {
150
+ try {
151
+ return readFileSync(path, "utf8");
152
+ }
153
+ catch {
154
+ return undefined; // unreadable: the batch file is skipped like any other non-native candidate
155
+ }
156
+ }
137
157
  function isRegularFile(path) {
138
158
  try {
139
159
  return statSync(path).isFile();
@@ -147,6 +167,7 @@ const defaultDeps = {
147
167
  arch: process.arch,
148
168
  env: (name) => process.env[name],
149
169
  isFile: isRegularFile,
170
+ readText: readBatchFileText,
150
171
  isMusl: isMuslLinuxRuntime,
151
172
  isCompiledBun: () => isCompiledBunBinary,
152
173
  extractFromBunfs,
@@ -1 +1 @@
1
- {"version":3,"file":"executable.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/anthropic-subscription/executable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAyBrH,MAAM,UAAU,8BAA8B,CAAC,QAAgB,EAAE,IAAY,EAAE,UAAU,GAAG,KAAK;IAChG,MAAM,GAAG,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/C,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,wCAAwC,IAAI,UAAU,GAAG,EAAE,CAAC;QAC1E,MAAM,IAAI,GAAG,wCAAwC,IAAI,eAAe,GAAG,EAAE,CAAC;QAC9E,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,CAAC,kCAAkC,QAAQ,IAAI,IAAI,UAAU,GAAG,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED;;;;;GAKG;AACH,SAAS,iBAAiB,CAAC,QAAgB,EAAE,SAAiB;IAC7D,OAAO,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,K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,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC,CAAC,uEAAuE;IACtF,CAAC;AACF,CAAC;AAED,MAAM,WAAW,GAAmB;IACnC,QAAQ,EAAE,OAAO,CAAC,QAAQ;IAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;IAChC,MAAM,EAAE,aAAa;IACrB,MAAM,EAAE,kBAAkB;IAC1B,aAAa,EAAE,GAAG,EAAE,CAAC,mBAAmB;IACxC,gBAAgB;IAChB,cAAc,EAAE,wBAAwB;IACxC,SAAS,EAAE,sBAAsB;IACjC,+FAA+F;IAC/F,wFAAwF;IACxF,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QACjB,IAAI,CAAC,cAAc,EAAE,CAAC;YACrB,cAAc,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC,CAAC;QACvF,CAAC;QACD,OAAO,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACD,CAAC;AACF,IAAI,UAAU,GAAG,WAAW,CAAC;AAE7B,MAAM,UAAU,qBAAqB;IACpC,OAAO,UAAU,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,QAAiC;IACvE,UAAU,GAAG,EAAE,GAAG,UAAU,EAAE,GAAG,QAAQ,EAAE,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,mBAAmB;IAClC,UAAU,GAAG,WAAW,CAAC;AAC1B,CAAC","sourcesContent":["import { statSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { posix, win32 } from \"node:path\";\nimport { extractFromBunfs } from \"@anthropic-ai/claude-agent-sdk/extract\";\nimport { findExecutableOnPath } from \"./executable-path-lookup.ts\";\nimport { bundledClaudeCodeVersion, isNewerClaudeCodeVersion, probeClaudeCodeVersion } from \"./executable-version.ts\";\n\nexport type ExecutableDeps = {\n\tplatform: string;\n\tarch: string;\n\tenv: (name: string) => string | undefined;\n\tresolve: (spec: string) => string;\n\t/** True when `path` names an existing regular file in THIS process - what the SDK's spawn will see. */\n\tisFile: (path: string) => boolean;\n\tisMusl?: () => boolean;\n\tisCompiledBun?: () => boolean;\n\textractFromBunfs?: (embeddedPath: string) => string;\n\t/** The Claude Code version the SDK bundles; `undefined` makes the resolver ask the bundled binary. */\n\tbundledVersion?: () => string | undefined;\n\t/** Reported version of a Claude Code binary. Without it the bundled binary is never compared against PATH. */\n\tversionOf?: (executable: string) => string | undefined;\n};\n\nexport type ExecutableResolution = {\n\t/** The spawnable spelling, or `undefined` when every candidate was rejected. */\n\texecutable: string | undefined;\n\t/** Every spelling checked, in order; the last entry is the winner when `executable` is set. */\n\ttried: string[];\n};\n\nexport function claudeCodeExecutableCandidates(platform: string, arch: string, preferMusl = false): string[] {\n\tconst ext = platform === \"win32\" ? \".exe\" : \"\";\n\tif (platform === \"linux\") {\n\t\tconst glibc = `@anthropic-ai/claude-agent-sdk-linux-${arch}/claude${ext}`;\n\t\tconst musl = `@anthropic-ai/claude-agent-sdk-linux-${arch}-musl/claude${ext}`;\n\t\treturn preferMusl ? [musl, glibc] : [glibc, musl];\n\t}\n\treturn [`@anthropic-ai/claude-agent-sdk-${platform}-${arch}/claude${ext}`];\n}\n\n/**\n * The spelling handed to the SDK, which spawns it verbatim: absolute, and on win32 in the `\\\\?\\`\n * namespaced form so a path Explorer can see but `uv_fs_stat`/`CreateProcess` reject (MAX_PATH, the\n * npm-global layout in #1541) still launches. The same spelling is what {@link ExecutableDeps.isFile}\n * validates, so the check and the spawn see one string.\n */\nfunction spawnableSpelling(platform: string, candidate: string): string {\n\treturn platform === \"win32\" ? win32.toNamespacedPath(win32.resolve(candidate)) : posix.resolve(candidate);\n}\n\n/**\n * Walks every source of a Claude Code binary and records each spelling it checked. Nothing is\n * accepted on resolution alone: `require.resolve` can name a file this process cannot stat (#1541),\n * so a candidate counts only once `isFile` agrees. Order: `CLAUDE_CODE_EXECUTABLE`, the embedded\n * binary of a compiled Bun build, the platform sidecar package(s), then `claude` on PATH. A bundled\n * binary still yields to `claude` on PATH when that one reports a strictly newer version (#2033): a\n * user who updated Claude Code must not keep getting the older copy the SDK happens to ship.\n */\nexport function describeClaudeCodeExecutable(deps: ExecutableDeps): ExecutableResolution {\n\tconst tried: string[] = [];\n\tconst accept = (candidate: string): string | undefined => {\n\t\tconst spelled = spawnableSpelling(deps.platform, candidate);\n\t\ttried.push(spelled);\n\t\treturn deps.isFile(spelled) ? spelled : undefined;\n\t};\n\tconst done = (executable: string): ExecutableResolution => ({ executable, tried });\n\n\tconst override = deps.env(\"CLAUDE_CODE_EXECUTABLE\");\n\tif (override) {\n\t\tconst accepted = accept(override);\n\t\tif (accepted !== undefined) return done(accepted);\n\t}\n\n\tconst candidates = claudeCodeExecutableCandidates(\n\t\tdeps.platform,\n\t\tdeps.arch,\n\t\tdeps.platform === \"linux\" && deps.isMusl?.() === true,\n\t);\n\n\tconst bundled = acceptBundled(deps, candidates, accept, tried);\n\tif (bundled !== undefined) {\n\t\tconst newer = newerClaudeOnPath(deps, bundled);\n\t\tif (newer === undefined) return done(bundled);\n\t\ttried.push(newer);\n\t\treturn done(newer);\n\t}\n\n\tconst onPath = findExecutableOnPath(\"claude\", deps);\n\tif (onPath !== undefined) {\n\t\tconst accepted = accept(onPath);\n\t\tif (accepted !== undefined) return done(accepted);\n\t} else {\n\t\ttried.push(deps.env(\"PATH\") ? \"claude on PATH\" : \"claude on PATH (PATH is unset)\");\n\t}\n\n\treturn { executable: undefined, tried };\n}\n\nfunction acceptBundled(\n\tdeps: ExecutableDeps,\n\tcandidates: string[],\n\taccept: (candidate: string) => string | undefined,\n\ttried: string[],\n): string | undefined {\n\tif (deps.isCompiledBun?.() && deps.extractFromBunfs) {\n\t\tfor (const candidate of candidates) {\n\t\t\tlet extracted: string;\n\t\t\ttry {\n\t\t\t\textracted = deps.extractFromBunfs(deps.resolve(candidate));\n\t\t\t} catch {\n\t\t\t\tcontinue; // not embedded in this bundle - the on-disk probe below still runs\n\t\t\t}\n\t\t\tconst accepted = accept(extracted);\n\t\t\tif (accepted !== undefined) return accepted;\n\t\t}\n\t}\n\n\tfor (const candidate of candidates) {\n\t\tlet resolved: string;\n\t\ttry {\n\t\t\tresolved = deps.resolve(candidate);\n\t\t} catch {\n\t\t\ttried.push(candidate); // the package is not installed; name it by specifier\n\t\t\tcontinue;\n\t\t}\n\t\tconst accepted = accept(resolved);\n\t\tif (accepted !== undefined) return accepted;\n\t}\n\treturn undefined;\n}\n\n/** `claude` on PATH when it is a different, stat-able binary reporting a strictly newer version than `bundled`. */\nfunction newerClaudeOnPath(deps: ExecutableDeps, bundled: string): string | undefined {\n\tconst versionOf = deps.versionOf;\n\tif (versionOf === undefined) return undefined;\n\tconst onPath = findExecutableOnPath(\"claude\", deps);\n\tif (onPath === undefined) return undefined;\n\tconst spelled = spawnableSpelling(deps.platform, onPath);\n\tif (spelled === bundled || !deps.isFile(spelled)) return undefined;\n\tconst pathVersion = versionOf(spelled);\n\tif (pathVersion === undefined) return undefined;\n\tconst bundledVersion = deps.bundledVersion?.() ?? versionOf(bundled);\n\treturn isNewerClaudeCodeVersion(pathVersion, bundledVersion) ? spelled : undefined;\n}\n\n/** The validated executable, or senpi's own error naming every candidate - the SDK never sees a miss. */\nexport function resolveClaudeCodeExecutable(deps: ExecutableDeps): string {\n\tconst resolution = describeClaudeCodeExecutable(deps);\n\tif (resolution.executable !== undefined) return resolution.executable;\n\tthrow new Error(\n\t\t[\n\t\t\t`Claude Code executable not found for ${deps.platform}-${deps.arch}. Tried:`,\n\t\t\t...resolution.tried.map((candidate) => ` - ${candidate}`),\n\t\t\t\"Reinstall @anthropic-ai/claude-agent-sdk without --omit=optional, install Claude Code so `claude` is on PATH, \" +\n\t\t\t\t\"or set CLAUDE_CODE_EXECUTABLE to the binary.\",\n\t\t].join(\"\\n\"),\n\t);\n}\n\nlet defaultRequire: ReturnType<typeof createRequire> | null = null;\n\nconst isCompiledBunBinary =\n\timport.meta.url.includes(\"$bunfs\") || import.meta.url.includes(\"~BUN\") || import.meta.url.includes(\"%7EBUN\");\n\nfunction isMuslLinuxRuntime(): boolean {\n\tif (process.platform !== \"linux\" || typeof process.report?.getReport !== \"function\") return false;\n\tconst report = process.report.getReport();\n\tif (report === null || !(\"header\" in report) || typeof report.header !== \"object\" || report.header === null) {\n\t\treturn false;\n\t}\n\treturn !(\"glibcVersionRuntime\" in report.header) || report.header.glibcVersionRuntime === undefined;\n}\n\nfunction isRegularFile(path: string): boolean {\n\ttry {\n\t\treturn statSync(path).isFile();\n\t} catch {\n\t\treturn false; // ENOENT, EACCES, ENAMETOOLONG, ...: the spawn would fail the same way\n\t}\n}\n\nconst defaultDeps: ExecutableDeps = {\n\tplatform: process.platform,\n\tarch: process.arch,\n\tenv: (name) => process.env[name],\n\tisFile: isRegularFile,\n\tisMusl: isMuslLinuxRuntime,\n\tisCompiledBun: () => isCompiledBunBinary,\n\textractFromBunfs,\n\tbundledVersion: bundledClaudeCodeVersion,\n\tversionOf: probeClaudeCodeVersion,\n\t// Rooted at the SDK instance this extension imports, so `require.resolve` walks the parents of\n\t// THAT package and a sidecar hoisted above it (omo-ai/node_modules/...) is still found.\n\tresolve: (spec) => {\n\t\tif (!defaultRequire) {\n\t\t\tdefaultRequire = createRequire(import.meta.resolve(\"@anthropic-ai/claude-agent-sdk\"));\n\t\t}\n\t\treturn defaultRequire.resolve(spec);\n\t},\n};\nlet activeDeps = defaultDeps;\n\nexport function defaultExecutableDeps(): ExecutableDeps {\n\treturn activeDeps;\n}\n\nexport function overrideExecutableDeps(override: Partial<ExecutableDeps>): void {\n\tactiveDeps = { ...activeDeps, ...override };\n}\n\nexport function resetExecutableDeps(): void {\n\tactiveDeps = defaultDeps;\n}\n"]}
1
+ {"version":3,"file":"executable.js","sourceRoot":"","sources":["../../../../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,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC,CAAC;QACvF,CAAC;QACD,OAAO,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACD,CAAC;AACF,IAAI,UAAU,GAAG,WAAW,CAAC;AAE7B,MAAM,UAAU,qBAAqB;IACpC,OAAO,UAAU,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,QAAiC;IACvE,UAAU,GAAG,EAAE,GAAG,UAAU,EAAE,GAAG,QAAQ,EAAE,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,mBAAmB;IAClC,UAAU,GAAG,WAAW,CAAC;AAC1B,CAAC","sourcesContent":["import { readFileSync, statSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { posix, win32 } from \"node:path\";\nimport { extractFromBunfs } from \"@anthropic-ai/claude-agent-sdk/extract\";\nimport { findExecutableOnPath } from \"./executable-path-lookup.ts\";\nimport { bundledClaudeCodeVersion, isNewerClaudeCodeVersion, probeClaudeCodeVersion } from \"./executable-version.ts\";\n\nexport type ExecutableDeps = {\n\tplatform: string;\n\tarch: string;\n\tenv: (name: string) => string | undefined;\n\tresolve: (spec: string) => string;\n\t/** True when `path` names an existing regular file in THIS process - what the SDK's spawn will see. */\n\tisFile: (path: string) => boolean;\n\t/** Text of a win32 batch file found on PATH, so an npm `claude.cmd` shim resolves to its native binary. */\n\treadText?: (path: string) => string | undefined;\n\tisMusl?: () => boolean;\n\tisCompiledBun?: () => boolean;\n\textractFromBunfs?: (embeddedPath: string) => string;\n\t/** The Claude Code version the SDK bundles; `undefined` makes the resolver ask the bundled binary. */\n\tbundledVersion?: () => string | undefined;\n\t/** Reported version of a Claude Code binary. Without it the bundled binary is never compared against PATH. */\n\tversionOf?: (executable: string) => string | undefined;\n};\n\n/** Where the spawned Claude Code came from; decides which remedy a version-floor error can offer. */\nexport type ClaudeCodeExecutableSource = \"override\" | \"bundled\" | \"path\";\n\nexport type ClaudeCodeRun = { executable: string; source: ClaudeCodeExecutableSource };\n\nexport type ExecutableResolution = {\n\t/** The spawnable spelling, or `undefined` when every candidate was rejected. */\n\texecutable: string | undefined;\n\tsource: ClaudeCodeExecutableSource | undefined;\n\t/** Every spelling checked, in order; the last entry is the winner when `executable` is set. */\n\ttried: string[];\n};\n\nexport function claudeCodeExecutableCandidates(platform: string, arch: string, preferMusl = false): string[] {\n\tconst ext = platform === \"win32\" ? \".exe\" : \"\";\n\tif (platform === \"linux\") {\n\t\tconst glibc = `@anthropic-ai/claude-agent-sdk-linux-${arch}/claude${ext}`;\n\t\tconst musl = `@anthropic-ai/claude-agent-sdk-linux-${arch}-musl/claude${ext}`;\n\t\treturn preferMusl ? [musl, glibc] : [glibc, musl];\n\t}\n\treturn [`@anthropic-ai/claude-agent-sdk-${platform}-${arch}/claude${ext}`];\n}\n\n/**\n * The spelling handed to the SDK, which spawns it verbatim: absolute, and on win32 in the `\\\\?\\`\n * namespaced form so a path Explorer can see but `uv_fs_stat`/`CreateProcess` reject (MAX_PATH, the\n * npm-global layout in #1541) still launches. The same spelling is what {@link ExecutableDeps.isFile}\n * validates, so the check and the spawn see one string.\n */\nfunction spawnableSpelling(platform: string, candidate: string): string {\n\treturn platform === \"win32\" ? win32.toNamespacedPath(win32.resolve(candidate)) : posix.resolve(candidate);\n}\n\n/**\n * Walks every source of a Claude Code binary and records each spelling it checked. Nothing is\n * accepted on resolution alone: `require.resolve` can name a file this process cannot stat (#1541),\n * so a candidate counts only once `isFile` agrees. Order: `CLAUDE_CODE_EXECUTABLE`, the embedded\n * binary of a compiled Bun build, the platform sidecar package(s), then `claude` on PATH. A bundled\n * binary still yields to `claude` on PATH when that one reports a strictly newer version (#2033): a\n * user who updated Claude Code must not keep getting the older copy the SDK happens to ship.\n */\nexport function describeClaudeCodeExecutable(deps: ExecutableDeps): ExecutableResolution {\n\tconst tried: string[] = [];\n\tconst accept = (candidate: string): string | undefined => {\n\t\tconst spelled = spawnableSpelling(deps.platform, candidate);\n\t\ttried.push(spelled);\n\t\treturn deps.isFile(spelled) ? spelled : undefined;\n\t};\n\tconst done = (executable: string, source: ClaudeCodeExecutableSource): ExecutableResolution => ({\n\t\texecutable,\n\t\tsource,\n\t\ttried,\n\t});\n\n\tconst override = deps.env(\"CLAUDE_CODE_EXECUTABLE\");\n\tif (override) {\n\t\tconst accepted = accept(override);\n\t\tif (accepted !== undefined) return done(accepted, \"override\");\n\t}\n\n\tconst candidates = claudeCodeExecutableCandidates(\n\t\tdeps.platform,\n\t\tdeps.arch,\n\t\tdeps.platform === \"linux\" && deps.isMusl?.() === true,\n\t);\n\n\tconst bundled = acceptBundled(deps, candidates, accept, tried);\n\tif (bundled !== undefined) {\n\t\tconst newer = newerClaudeOnPath(deps, bundled);\n\t\tif (newer === undefined) return done(bundled, \"bundled\");\n\t\ttried.push(newer);\n\t\treturn done(newer, \"path\");\n\t}\n\n\tconst onPath = findExecutableOnPath(\"claude\", {\n\t\t...deps,\n\t\tonSkip: (batchFile) => tried.push(`${batchFile} (batch file wrapping no native binary)`),\n\t});\n\tif (onPath !== undefined) {\n\t\tconst accepted = accept(onPath);\n\t\tif (accepted !== undefined) return done(accepted, \"path\");\n\t} else {\n\t\ttried.push(deps.env(\"PATH\") ? \"claude on PATH\" : \"claude on PATH (PATH is unset)\");\n\t}\n\n\treturn { executable: undefined, source: undefined, tried };\n}\n\nfunction acceptBundled(\n\tdeps: ExecutableDeps,\n\tcandidates: string[],\n\taccept: (candidate: string) => string | undefined,\n\ttried: string[],\n): string | undefined {\n\tif (deps.isCompiledBun?.() && deps.extractFromBunfs) {\n\t\tfor (const candidate of candidates) {\n\t\t\tlet extracted: string;\n\t\t\ttry {\n\t\t\t\textracted = deps.extractFromBunfs(deps.resolve(candidate));\n\t\t\t} catch {\n\t\t\t\tcontinue; // not embedded in this bundle - the on-disk probe below still runs\n\t\t\t}\n\t\t\tconst accepted = accept(extracted);\n\t\t\tif (accepted !== undefined) return accepted;\n\t\t}\n\t}\n\n\tfor (const candidate of candidates) {\n\t\tlet resolved: string;\n\t\ttry {\n\t\t\tresolved = deps.resolve(candidate);\n\t\t} catch {\n\t\t\ttried.push(candidate); // the package is not installed; name it by specifier\n\t\t\tcontinue;\n\t\t}\n\t\tconst accepted = accept(resolved);\n\t\tif (accepted !== undefined) return accepted;\n\t}\n\treturn undefined;\n}\n\n/** `claude` on PATH when it is a different, stat-able binary reporting a strictly newer version than `bundled`. */\nfunction newerClaudeOnPath(deps: ExecutableDeps, bundled: string): string | undefined {\n\tconst versionOf = deps.versionOf;\n\tif (versionOf === undefined) return undefined;\n\tconst onPath = findExecutableOnPath(\"claude\", deps);\n\tif (onPath === undefined) return undefined;\n\tconst spelled = spawnableSpelling(deps.platform, onPath);\n\tif (spelled === bundled || !deps.isFile(spelled)) return undefined;\n\tconst pathVersion = versionOf(spelled);\n\tif (pathVersion === undefined) return undefined;\n\tconst bundledVersion = deps.bundledVersion?.() ?? versionOf(bundled);\n\treturn isNewerClaudeCodeVersion(pathVersion, bundledVersion) ? spelled : undefined;\n}\n\n/** The validated executable, or senpi's own error naming every candidate - the SDK never sees a miss. */\nexport function resolveClaudeCodeExecutable(deps: ExecutableDeps): string {\n\treturn resolveClaudeCodeRun(deps).executable;\n}\n\n/** {@link resolveClaudeCodeExecutable} plus where the binary came from. */\nexport function resolveClaudeCodeRun(deps: ExecutableDeps): ClaudeCodeRun {\n\tconst resolution = describeClaudeCodeExecutable(deps);\n\tif (resolution.executable !== undefined && resolution.source !== undefined) {\n\t\treturn { executable: resolution.executable, source: resolution.source };\n\t}\n\tthrow new Error(\n\t\t[\n\t\t\t`Claude Code executable not found for ${deps.platform}-${deps.arch}. Tried:`,\n\t\t\t...resolution.tried.map((candidate) => ` - ${candidate}`),\n\t\t\t\"Reinstall @anthropic-ai/claude-agent-sdk without --omit=optional, install Claude Code so `claude` is on PATH, \" +\n\t\t\t\t\"or set CLAUDE_CODE_EXECUTABLE to the binary.\",\n\t\t].join(\"\\n\"),\n\t);\n}\n\nlet defaultRequire: ReturnType<typeof createRequire> | null = null;\n\nconst isCompiledBunBinary =\n\timport.meta.url.includes(\"$bunfs\") || import.meta.url.includes(\"~BUN\") || import.meta.url.includes(\"%7EBUN\");\n\nfunction isMuslLinuxRuntime(): boolean {\n\tif (process.platform !== \"linux\" || typeof process.report?.getReport !== \"function\") return false;\n\tconst report = process.report.getReport();\n\tif (report === null || !(\"header\" in report) || typeof report.header !== \"object\" || report.header === null) {\n\t\treturn false;\n\t}\n\treturn !(\"glibcVersionRuntime\" in report.header) || report.header.glibcVersionRuntime === undefined;\n}\n\nfunction readBatchFileText(path: string): string | undefined {\n\ttry {\n\t\treturn readFileSync(path, \"utf8\");\n\t} catch {\n\t\treturn undefined; // unreadable: the batch file is skipped like any other non-native candidate\n\t}\n}\n\nfunction isRegularFile(path: string): boolean {\n\ttry {\n\t\treturn statSync(path).isFile();\n\t} catch {\n\t\treturn false; // ENOENT, EACCES, ENAMETOOLONG, ...: the spawn would fail the same way\n\t}\n}\n\nconst defaultDeps: ExecutableDeps = {\n\tplatform: process.platform,\n\tarch: process.arch,\n\tenv: (name) => process.env[name],\n\tisFile: isRegularFile,\n\treadText: readBatchFileText,\n\tisMusl: isMuslLinuxRuntime,\n\tisCompiledBun: () => isCompiledBunBinary,\n\textractFromBunfs,\n\tbundledVersion: bundledClaudeCodeVersion,\n\tversionOf: probeClaudeCodeVersion,\n\t// Rooted at the SDK instance this extension imports, so `require.resolve` walks the parents of\n\t// THAT package and a sidecar hoisted above it (omo-ai/node_modules/...) is still found.\n\tresolve: (spec) => {\n\t\tif (!defaultRequire) {\n\t\t\tdefaultRequire = createRequire(import.meta.resolve(\"@anthropic-ai/claude-agent-sdk\"));\n\t\t}\n\t\treturn defaultRequire.resolve(spec);\n\t},\n};\nlet activeDeps = defaultDeps;\n\nexport function defaultExecutableDeps(): ExecutableDeps {\n\treturn activeDeps;\n}\n\nexport function overrideExecutableDeps(override: Partial<ExecutableDeps>): void {\n\tactiveDeps = { ...activeDeps, ...override };\n}\n\nexport function resetExecutableDeps(): void {\n\tactiveDeps = defaultDeps;\n}\n"]}
@@ -1,7 +1,8 @@
1
1
  import type { SdkErrorKind } from "./errors.ts";
2
+ import type { ClaudeCodeRun } from "./executable.ts";
2
3
  export declare function noAccountGuidance(hasAnthropicCredential: boolean): string;
3
4
  export declare function allAccountsBlockedGuidance(soonestUnblockAt: number | undefined, blockReason?: "auth_error"): string;
4
- export declare function claudeCodeVersionFloorGuidance(text: string): string | undefined;
5
+ export declare function claudeCodeVersionFloorGuidance(text: string, ran?: ClaudeCodeRun): string | undefined;
5
6
  export declare function sdkErrorGuidance(kind: SdkErrorKind): string | undefined;
6
7
  export declare function missingBinaryGuidance(platform: string, arch: string): string;
7
8
  export type SystemPromptMode = "full" | "override" | "preset-append";
@@ -1 +1 @@
1
- {"version":3,"file":"guidance.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/anthropic-subscription/guidance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,wBAAgB,iBAAiB,CAAC,sBAAsB,EAAE,OAAO,GAAG,MAAM,CAazE;AAED,wBAAgB,0BAA0B,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,CAAC,EAAE,YAAY,GAAG,MAAM,CAqBnH;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAa/E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAavE;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAK5E;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,UAAU,GAAG,eAAe,CAAC;AAErE,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAM7F;AAID,wBAAgB,4BAA4B,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAMrE;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE;IACxD,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,GAAG,SAAS,CAqBrB"}
1
+ {"version":3,"file":"guidance.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/anthropic-subscription/guidance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD,wBAAgB,iBAAiB,CAAC,sBAAsB,EAAE,OAAO,GAAG,MAAM,CAazE;AAED,wBAAgB,0BAA0B,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,CAAC,EAAE,YAAY,GAAG,MAAM,CAqBnH;AAmBD,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAapG;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAavE;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAK5E;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,UAAU,GAAG,eAAe,CAAC;AAErE,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAM7F;AAID,wBAAgB,4BAA4B,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAMrE;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE;IACxD,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,GAAG,SAAS,CAqBrB"}