@maxmo74/pi-coding-agent 1.6.0-max.16 → 1.7.0-max.17

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 (297) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/LICENSE +1 -1
  3. package/dist/bundle/chunks/anthropic-messages-VOAE66ME.js +3 -0
  4. package/dist/bundle/chunks/azure-openai-responses-FWQRNMCY.js +2 -0
  5. package/dist/bundle/chunks/bedrock-converse-stream.js +6 -6
  6. package/dist/bundle/chunks/chunk-2BKJ4UF2.js +6 -0
  7. package/dist/bundle/chunks/{chunk-YOWSKVK7.js → chunk-2HV66XRA.js} +1 -1
  8. package/dist/bundle/chunks/chunk-7TLS4DNZ.js +30 -0
  9. package/dist/bundle/chunks/{chunk-E6LJTZYC.js → chunk-AIIDHDL2.js} +1 -1
  10. package/dist/bundle/chunks/chunk-ARDROFM7.js +20 -0
  11. package/dist/bundle/chunks/{chunk-36QC74V4.js → chunk-D5E4JUBX.js} +1 -1
  12. package/dist/bundle/chunks/{chunk-EVSO24NP.js → chunk-D5U74ZAG.js} +1 -1
  13. package/dist/bundle/chunks/{chunk-ILDLA2JW.js → chunk-E3GEPN3H.js} +1 -1
  14. package/dist/bundle/chunks/{chunk-XGGZYFNG.js → chunk-G5K7SYL7.js} +2 -2
  15. package/dist/bundle/chunks/chunk-GBB3EUD7.js +16 -0
  16. package/dist/bundle/chunks/chunk-GMDZZCKH.js +2 -0
  17. package/dist/bundle/chunks/{chunk-NRY4NBZW.js → chunk-HFTJRRFR.js} +2 -2
  18. package/dist/bundle/chunks/{chunk-NRLRGOCX.js → chunk-IOF7AZCL.js} +1 -1
  19. package/dist/bundle/chunks/chunk-J35HXFD7.js +2 -0
  20. package/dist/bundle/chunks/{chunk-KREOSXD7.js → chunk-KPWXWGGJ.js} +1 -1
  21. package/dist/bundle/chunks/chunk-MDJ5LWZA.js +44 -0
  22. package/dist/bundle/chunks/{chunk-I6HYYNH6.js → chunk-O5MXS5TI.js} +1 -1
  23. package/dist/bundle/chunks/chunk-OVXT2WQH.js +2 -0
  24. package/dist/bundle/chunks/{chunk-EXXWEFU5.js → chunk-PADKDPJN.js} +99 -104
  25. package/dist/bundle/chunks/chunk-PST3NXKM.js +2 -0
  26. package/dist/bundle/chunks/chunk-S2GRKWHT.js +14 -0
  27. package/dist/bundle/chunks/{chunk-X26YOAEH.js → chunk-V7D5E4XS.js} +13 -12
  28. package/dist/bundle/chunks/chunk-Z2XZSUHM.js +2 -0
  29. package/dist/bundle/chunks/{cli-QMJEURSM.js → cli-OH5BEVHD.js} +1 -1
  30. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-Z73UPEZ7.js +2 -0
  31. package/dist/bundle/chunks/{easter-egg-3d-7CBVPJQ3.js → easter-egg-3d-BOWYTYMI.js} +1 -1
  32. package/dist/bundle/chunks/{execute-XDNPBEMU.js → execute-UXTJZEKY.js} +3 -3
  33. package/dist/bundle/chunks/github-copilot.js +1 -1
  34. package/dist/bundle/chunks/google-generative-ai-VI7CGXA2.js +2 -0
  35. package/dist/bundle/chunks/google-vertex-UGCMSJWH.js +2 -0
  36. package/dist/bundle/chunks/{llama-cpp-classify-XXZYF3RR.js → llama-cpp-classify-SKDW7RUG.js} +2 -2
  37. package/dist/bundle/chunks/mistral-conversations-F2GKIAZI.js +4 -0
  38. package/dist/bundle/chunks/openai-codex-responses-B54DADY4.js +2 -0
  39. package/dist/bundle/chunks/openai-completions-5UNXROMA.js +7 -0
  40. package/dist/bundle/chunks/{openai-decisions-LZ2RLVRX.js → openai-decisions-IN2F5D4R.js} +1 -1
  41. package/dist/bundle/chunks/openai-responses-2567WJBU.js +4 -0
  42. package/dist/bundle/chunks/openrouter-images-MPCL4RTO.js +2 -0
  43. package/dist/bundle/chunks/pi-decision-GZ2BG2JB.js +2 -0
  44. package/dist/bundle/chunks/pi-image-CXEQM6AW.js +2 -0
  45. package/dist/bundle/chunks/pi-messages-PDCTBGXV.js +2 -0
  46. package/dist/bundle/chunks/{runtime-F3SXQONS.js → runtime-JESTW74H.js} +1 -1
  47. package/dist/bundle/chunks/typesafe-system-one-6M47QHZX.js +2 -0
  48. package/dist/bundle/chunks/virtual-modules-QBVXFHBM.js +2 -0
  49. package/dist/bundle/cli-runtime.js +1 -1
  50. package/dist/bundle/index.js +1 -1
  51. package/dist/bundle/rpc-entry.js +1 -1
  52. package/dist/cli/agent-dir-arg.d.ts +20 -0
  53. package/dist/cli/agent-dir-arg.d.ts.map +1 -0
  54. package/dist/cli/agent-dir-arg.js +38 -0
  55. package/dist/cli/agent-dir-arg.js.map +1 -0
  56. package/dist/cli/args.d.ts +6 -0
  57. package/dist/cli/args.d.ts.map +1 -1
  58. package/dist/cli/args.js +45 -3
  59. package/dist/cli/args.js.map +1 -1
  60. package/dist/cli/list-models.d.ts.map +1 -1
  61. package/dist/cli/list-models.js +0 -5
  62. package/dist/cli/list-models.js.map +1 -1
  63. package/dist/cli/project-trust.d.ts.map +1 -1
  64. package/dist/cli/project-trust.js +6 -6
  65. package/dist/cli/project-trust.js.map +1 -1
  66. package/dist/cli/startup-ui.d.ts +3 -2
  67. package/dist/cli/startup-ui.d.ts.map +1 -1
  68. package/dist/cli/startup-ui.js +17 -23
  69. package/dist/cli/startup-ui.js.map +1 -1
  70. package/dist/config.d.ts +6 -1
  71. package/dist/config.d.ts.map +1 -1
  72. package/dist/config.js +16 -2
  73. package/dist/config.js.map +1 -1
  74. package/dist/core/agent-session-services.d.ts.map +1 -1
  75. package/dist/core/agent-session-services.js +6 -0
  76. package/dist/core/agent-session-services.js.map +1 -1
  77. package/dist/core/agent-session.d.ts.map +1 -1
  78. package/dist/core/agent-session.js +1 -0
  79. package/dist/core/agent-session.js.map +1 -1
  80. package/dist/core/auth-storage.d.ts.map +1 -1
  81. package/dist/core/auth-storage.js +7 -1
  82. package/dist/core/auth-storage.js.map +1 -1
  83. package/dist/core/bash-executor.d.ts +3 -1
  84. package/dist/core/bash-executor.d.ts.map +1 -1
  85. package/dist/core/bash-executor.js +24 -13
  86. package/dist/core/bash-executor.js.map +1 -1
  87. package/dist/core/client-identity.d.ts +2 -3
  88. package/dist/core/client-identity.d.ts.map +1 -1
  89. package/dist/core/client-identity.js +3 -4
  90. package/dist/core/client-identity.js.map +1 -1
  91. package/dist/core/compaction/compaction.d.ts.map +1 -1
  92. package/dist/core/compaction/compaction.js +3 -0
  93. package/dist/core/compaction/compaction.js.map +1 -1
  94. package/dist/core/extensions/runner.d.ts.map +1 -1
  95. package/dist/core/extensions/runner.js +2 -1
  96. package/dist/core/extensions/runner.js.map +1 -1
  97. package/dist/core/extensions/types.d.ts +9 -1
  98. package/dist/core/extensions/types.d.ts.map +1 -1
  99. package/dist/core/extensions/types.js.map +1 -1
  100. package/dist/core/messages.d.ts +4 -0
  101. package/dist/core/messages.d.ts.map +1 -1
  102. package/dist/core/messages.js +10 -2
  103. package/dist/core/messages.js.map +1 -1
  104. package/dist/core/model-config.d.ts +36 -0
  105. package/dist/core/model-config.d.ts.map +1 -1
  106. package/dist/core/model-resolver.js +4 -4
  107. package/dist/core/model-resolver.js.map +1 -1
  108. package/dist/core/model-runtime.d.ts.map +1 -1
  109. package/dist/core/model-runtime.js +6 -2
  110. package/dist/core/model-runtime.js.map +1 -1
  111. package/dist/core/pi-ai-schemas.d.ts +4 -0
  112. package/dist/core/pi-ai-schemas.d.ts.map +1 -1
  113. package/dist/core/project-trust.d.ts.map +1 -1
  114. package/dist/core/project-trust.js +1 -1
  115. package/dist/core/project-trust.js.map +1 -1
  116. package/dist/core/provider-composer.d.ts +1 -0
  117. package/dist/core/provider-composer.d.ts.map +1 -1
  118. package/dist/core/provider-composer.js +1 -0
  119. package/dist/core/provider-composer.js.map +1 -1
  120. package/dist/core/resolve-config-value.d.ts +2 -0
  121. package/dist/core/resolve-config-value.d.ts.map +1 -1
  122. package/dist/core/resolve-config-value.js +4 -0
  123. package/dist/core/resolve-config-value.js.map +1 -1
  124. package/dist/core/sdk.js +2 -2
  125. package/dist/core/sdk.js.map +1 -1
  126. package/dist/core/session-manager.d.ts.map +1 -1
  127. package/dist/core/session-manager.js +10 -6
  128. package/dist/core/session-manager.js.map +1 -1
  129. package/dist/core/settings-defaults.d.ts +6 -2
  130. package/dist/core/settings-defaults.d.ts.map +1 -1
  131. package/dist/core/settings-defaults.js +6 -2
  132. package/dist/core/settings-defaults.js.map +1 -1
  133. package/dist/core/settings-manager.d.ts +6 -6
  134. package/dist/core/settings-manager.d.ts.map +1 -1
  135. package/dist/core/settings-manager.js +23 -16
  136. package/dist/core/settings-manager.js.map +1 -1
  137. package/dist/core/settings-schema.d.ts +16 -3
  138. package/dist/core/settings-schema.d.ts.map +1 -1
  139. package/dist/core/settings-schema.js +23 -8
  140. package/dist/core/settings-schema.js.map +1 -1
  141. package/dist/core/tools/bash.d.ts +3 -0
  142. package/dist/core/tools/bash.d.ts.map +1 -1
  143. package/dist/core/tools/bash.js +24 -9
  144. package/dist/core/tools/bash.js.map +1 -1
  145. package/dist/core/tools/output-accumulator.d.ts +16 -4
  146. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  147. package/dist/core/tools/output-accumulator.js +47 -41
  148. package/dist/core/tools/output-accumulator.js.map +1 -1
  149. package/dist/core/tools/renderers/bash.d.ts.map +1 -1
  150. package/dist/core/tools/renderers/bash.js +9 -3
  151. package/dist/core/tools/renderers/bash.js.map +1 -1
  152. package/dist/core/tools/truncate.d.ts +1 -1
  153. package/dist/core/tools/truncate.d.ts.map +1 -1
  154. package/dist/core/tools/truncate.js +11 -5
  155. package/dist/core/tools/truncate.js.map +1 -1
  156. package/dist/core/usage-totals.d.ts.map +1 -1
  157. package/dist/core/usage-totals.js +3 -0
  158. package/dist/core/usage-totals.js.map +1 -1
  159. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  160. package/dist/extensions/codemode/execute.js +36 -5
  161. package/dist/extensions/codemode/execute.js.map +1 -1
  162. package/dist/extensions/llama/client.d.ts.map +1 -1
  163. package/dist/extensions/llama/client.js +3 -13
  164. package/dist/extensions/llama/client.js.map +1 -1
  165. package/dist/extensions/llama/ui.d.ts.map +1 -1
  166. package/dist/extensions/llama/ui.js +2 -1
  167. package/dist/extensions/llama/ui.js.map +1 -1
  168. package/dist/extensions/mcp/resources.d.ts.map +1 -1
  169. package/dist/extensions/mcp/resources.js +3 -3
  170. package/dist/extensions/mcp/resources.js.map +1 -1
  171. package/dist/extensions/mcp/tools.d.ts +1 -9
  172. package/dist/extensions/mcp/tools.d.ts.map +1 -1
  173. package/dist/extensions/mcp/tools.js +8 -124
  174. package/dist/extensions/mcp/tools.js.map +1 -1
  175. package/dist/main.d.ts +1 -1
  176. package/dist/main.d.ts.map +1 -1
  177. package/dist/main.js +18 -3
  178. package/dist/main.js.map +1 -1
  179. package/dist/modes/interactive/components/bash-execution.d.ts +2 -1
  180. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  181. package/dist/modes/interactive/components/bash-execution.js +7 -4
  182. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  183. package/dist/modes/interactive/components/config-selector.js +1 -1
  184. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  185. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  186. package/dist/modes/interactive/components/custom-editor.js +13 -1
  187. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  188. package/dist/modes/interactive/components/extension-editor.d.ts +1 -1
  189. package/dist/modes/interactive/components/extension-editor.js +2 -2
  190. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  191. package/dist/modes/interactive/components/first-time-setup.d.ts +3 -5
  192. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
  193. package/dist/modes/interactive/components/first-time-setup.js +15 -45
  194. package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
  195. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
  196. package/dist/modes/interactive/components/mermaid.js +13 -4
  197. package/dist/modes/interactive/components/mermaid.js.map +1 -1
  198. package/dist/modes/interactive/components/oauth-selector.d.ts +13 -1
  199. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  200. package/dist/modes/interactive/components/oauth-selector.js +10 -9
  201. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  202. package/dist/modes/interactive/components/session-selector.js +3 -3
  203. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  204. package/dist/modes/interactive/components/settings-selector.d.ts +3 -5
  205. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  206. package/dist/modes/interactive/components/settings-selector.js +57 -46
  207. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  208. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
  209. package/dist/modes/interactive/components/settings-submenu.js +3 -3
  210. package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
  211. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  212. package/dist/modes/interactive/external-editor.js +13 -3
  213. package/dist/modes/interactive/external-editor.js.map +1 -1
  214. package/dist/modes/interactive/interactive-mode.d.ts +18 -1
  215. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  216. package/dist/modes/interactive/interactive-mode.js +105 -75
  217. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  218. package/dist/modes/interactive/program-resume-reporter.d.ts +32 -0
  219. package/dist/modes/interactive/program-resume-reporter.d.ts.map +1 -0
  220. package/dist/modes/interactive/program-resume-reporter.js +56 -0
  221. package/dist/modes/interactive/program-resume-reporter.js.map +1 -0
  222. package/dist/modes/interactive/program-status-reporter.d.ts +2 -0
  223. package/dist/modes/interactive/program-status-reporter.d.ts.map +1 -1
  224. package/dist/modes/interactive/program-status-reporter.js +4 -0
  225. package/dist/modes/interactive/program-status-reporter.js.map +1 -1
  226. package/dist/modes/interactive/session-share.d.ts.map +1 -1
  227. package/dist/modes/interactive/session-share.js +9 -1
  228. package/dist/modes/interactive/session-share.js.map +1 -1
  229. package/dist/modes/print-mode.d.ts.map +1 -1
  230. package/dist/modes/print-mode.js +1 -4
  231. package/dist/modes/print-mode.js.map +1 -1
  232. package/dist/modes/rpc/jsonl.d.ts.map +1 -1
  233. package/dist/modes/rpc/jsonl.js +13 -13
  234. package/dist/modes/rpc/jsonl.js.map +1 -1
  235. package/dist/modes/rpc/rpc-mode.js +4 -4
  236. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  237. package/dist/package-manager-cli.d.ts.map +1 -1
  238. package/dist/package-manager-cli.js +10 -1
  239. package/dist/package-manager-cli.js.map +1 -1
  240. package/dist/utils/clipboard.js +1 -1
  241. package/dist/utils/clipboard.js.map +1 -1
  242. package/dist/utils/output-files.d.ts +20 -4
  243. package/dist/utils/output-files.d.ts.map +1 -1
  244. package/dist/utils/output-files.js +37 -2
  245. package/dist/utils/output-files.js.map +1 -1
  246. package/dist/utils/shell.d.ts +2 -1
  247. package/dist/utils/shell.d.ts.map +1 -1
  248. package/dist/utils/shell.js +56 -7
  249. package/dist/utils/shell.js.map +1 -1
  250. package/dist/utils/tools-manager.d.ts +1 -0
  251. package/dist/utils/tools-manager.d.ts.map +1 -1
  252. package/dist/utils/tools-manager.js +9 -8
  253. package/dist/utils/tools-manager.js.map +1 -1
  254. package/docs/cli.md +3 -1
  255. package/docs/codemode.md +16 -5
  256. package/docs/environment-variables.md +4 -4
  257. package/docs/extensions.md +14 -4
  258. package/docs/llama-cpp.md +3 -3
  259. package/docs/message-types.md +1 -0
  260. package/docs/models-configuration.md +14 -3
  261. package/docs/models.md +34 -14
  262. package/docs/providers.md +3 -3
  263. package/docs/rpc-commands.md +1 -1
  264. package/docs/settings.md +5 -3
  265. package/docs/shell-aliases.md +1 -1
  266. package/docs/terminal-setup.md +53 -0
  267. package/docs/windows.md +2 -1
  268. package/examples/extensions/subagent/index.ts +3 -2
  269. package/examples/rpc-extension-ui.ts +8 -7
  270. package/package.json +9 -9
  271. package/schemas/models.schema.json +20 -7
  272. package/schemas/settings.schema.json +30 -10
  273. package/dist/bundle/chunks/anthropic-messages-WAFIHSF7.js +0 -6
  274. package/dist/bundle/chunks/azure-openai-responses-EB4MRIM4.js +0 -2
  275. package/dist/bundle/chunks/chunk-EEBRZED2.js +0 -44
  276. package/dist/bundle/chunks/chunk-F7LEMV2T.js +0 -2
  277. package/dist/bundle/chunks/chunk-NV3NPOPF.js +0 -20
  278. package/dist/bundle/chunks/chunk-PMRZO46Y.js +0 -2
  279. package/dist/bundle/chunks/chunk-RCNEHRMW.js +0 -2
  280. package/dist/bundle/chunks/chunk-X6RQRO3L.js +0 -16
  281. package/dist/bundle/chunks/chunk-XJ2YV77J.js +0 -30
  282. package/dist/bundle/chunks/chunk-Y55SJART.js +0 -13
  283. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-AMCR7QEI.js +0 -2
  284. package/dist/bundle/chunks/google-generative-ai-43M4N5LK.js +0 -2
  285. package/dist/bundle/chunks/google-vertex-2B3PASK2.js +0 -2
  286. package/dist/bundle/chunks/mistral-conversations-E3D5ZQKB.js +0 -5
  287. package/dist/bundle/chunks/openai-codex-responses-MSQDSDUR.js +0 -10
  288. package/dist/bundle/chunks/openai-completions-4IC6AGTR.js +0 -7
  289. package/dist/bundle/chunks/openai-responses-MCO3BHCC.js +0 -4
  290. package/dist/bundle/chunks/openrouter-images-SHUJ3VSG.js +0 -2
  291. package/dist/bundle/chunks/pi-messages-NIKOQ4O7.js +0 -8
  292. package/dist/bundle/chunks/typesafe-system-one-R2CDUWNO.js +0 -2
  293. package/dist/bundle/chunks/virtual-modules-2WYTGPJ3.js +0 -2
  294. package/dist/core/telemetry.d.ts +0 -3
  295. package/dist/core/telemetry.d.ts.map +0 -1
  296. package/dist/core/telemetry.js +0 -9
  297. package/dist/core/telemetry.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
+ import{parseClassifierUsage,postClassifierRequest,requiredNumber}from"./chunk-GMDZZCKH.js";import{isRecord}from"./chunk-J35HXFD7.js";import{applyOpenRouterReportedCost,isOpenRouterModel}from"./chunk-P7FPUEYA.js";import{formatProviderError,normalizeProviderError}from"./chunk-2HV66XRA.js";var IMAGE_OPT_IN_HEADERS={"TypeSafe-Danger-Zone-Images":"true"};function probabilities(label,value,id){if(!isRecord(value))throw new Error(`${label} returned invalid probabilities for ${id}`);return Object.fromEntries(Object.entries(value).map(([key,probability])=>[key,requiredNumber(label,probability,`probability for ${id}.${key}`)]))}function parseAnswers(label,value,context){if(!isRecord(value))throw new Error(`${label} returned an unexpected response`);let answers=[];for(let[id,question]of Object.entries(context.questions)){let answer=value[id];if(!isRecord(answer))throw new Error(`${label} did not return an answer for ${id}`);if(question.type==="choice"){if(answer.type!=="choice"||typeof answer.choice!="string")throw new Error(`${label} did not return a choice answer for ${id}`);answers.push([id,{type:"choice",choice:answer.choice,probabilities:probabilities(label,answer.probabilities,id),confidence:requiredNumber(label,answer.confidence,`confidence for ${id}`)}])}else if(question.type==="score"){if(answer.type!=="score")throw new Error(`${label} did not return a score answer for ${id}`);answers.push([id,{type:"score",score:requiredNumber(label,answer.score,`score for ${id}`),confidence:requiredNumber(label,answer.confidence,`confidence for ${id}`)}])}else{if(answer.type!=="noul")throw new Error(`${label} did not return a bool answer for ${id}`);answers.push([id,{type:"bool",probability:requiredNumber(label,answer.noul,`probability for ${id}`)}])}}return Object.fromEntries(answers)}var ASSET_FORMATS={"image/png":"png","image/jpeg":"jpeg"},DATA_URL_TYPES=new Set(["image/png","image/jpeg","image/webp"]),MAX_DATA_URL_IMAGES=4;function addImages(label,model,input,images,request){if(input==="images"){if(images.length>MAX_DATA_URL_IMAGES)throw new Error(`${label} accepts at most ${MAX_DATA_URL_IMAGES} images for ${model.id}, got ${images.length}`);request.images=images.map(image=>{if(!DATA_URL_TYPES.has(image.mimeType))throw new Error(`${label} accepts PNG, JPEG, and WebP images for ${model.id}, got ${image.mimeType}`);return`data:${image.mimeType};base64,${image.data}`});return}if(input==="state-image-urls"){let parts=images.map(image=>({type:"image_url",image_url:{url:`data:${image.mimeType};base64,${image.data}`}}));request.state=[...parts,request.state];return}let assets={};images.forEach((image,index)=>{let format=ASSET_FORMATS[image.mimeType];if(!format)throw new Error(`${label} accepts PNG and JPEG images for ${model.id}, got ${image.mimeType}`);assets[`<image-${index+1}>`]={type:"image",format,data_base64:image.data}}),request.assets=assets,request.state=[...Object.keys(assets),request.state]}function wireRequest(context){return{state:context.state,questions:Object.fromEntries(Object.entries(context.questions).map(([id,question])=>[id,question.type==="bool"?{...question,type:"noul"}:question]))}}async function classifySystemOne(transport,model,context,options){let output={api:model.api,provider:model.provider,model:model.id,answers:{},stopReason:"stop",timestamp:Date.now()};try{if(model.api!==transport.api)throw new Error(`Unsupported classifier API: ${model.api}`);let request=wireRequest(context),requestOptions=options;if(context.images?.length){if(!model.input.includes("image"))throw new Error(`${transport.label} does not support image input for ${model.id}`);let detected=transport.detectCompat(model),imageInput=model.compat?.imageInput??detected.imageInput;addImages(transport.label,model,imageInput,context.images,request),(model.compat?.sendImageOptInHeader??detected.sendImageOptInHeader)&&(requestOptions={...options,headers:{...IMAGE_OPT_IN_HEADERS,...options?.headers}})}let body=await postClassifierRequest(transport.label,transport.url(model),model,transport.payload(model,request),requestOptions),result=transport.output(body);typeof result.id=="string"&&result.id&&(output.responseId=result.id);let usage=parseClassifierUsage(result.usage,model);return usage&&(isOpenRouterModel(model)&&applyOpenRouterReportedCost(usage,result.usage),output.usage=usage),output.answers=parseAnswers(transport.label,result.answers,context),output}catch(error){return output.stopReason=options?.signal?.aborted?"aborted":"error",output.errorMessage=formatProviderError(normalizeProviderError(error),`${transport.label} error`),output}}export{classifySystemOne};
@@ -0,0 +1,14 @@
1
+ import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
+ import{getBinDir}from"./chunk-D5E4JUBX.js";import{accessSync,constants}from"node:fs";import{delimiter,join,win32}from"node:path";import{spawn,spawnSync}from"child_process";function isLegacyWslBashPath(path){let normalized=win32.normalize(path).toLowerCase(),systemRoot=process.env.SystemRoot;return systemRoot?/^[a-z]:[\\/]/i.test(systemRoot)?["System32","Sysnative"].some(directory=>normalized===win32.join(systemRoot,directory,"bash.exe").toLowerCase()):!1:/^[a-z]:\\windows\\(?:system32|sysnative)\\bash\.exe$/.test(normalized)}function getBashShellConfig(shell){return isLegacyWslBashPath(shell)?{shell,args:["-s"],commandTransport:"stdin"}:{shell,args:["-c"]}}function shellPathExists(path){try{return accessSync(path,constants.F_OK),!0}catch{return!1}}function findExecutableOnPath(executable){if(process.platform==="win32"){try{let result=spawnSync("where",[executable],{encoding:"utf-8",timeout:5e3,windowsHide:!0});if(result.status===0&&result.stdout){let firstMatch=result.stdout.trim().split(/\r?\n/)[0];if(firstMatch&&shellPathExists(firstMatch))return firstMatch}}catch{}return null}try{let result=spawnSync("which",[executable],{encoding:"utf-8",timeout:5e3});if(result.status===0&&result.stdout){let firstMatch=result.stdout.trim().split(/\r?\n/)[0];if(firstMatch)return firstMatch}}catch{}return null}var GIT_FOR_WINDOWS_SHELL_SUFFIX=win32.join("usr","bin","sh.exe");function findGitBashOfGitOnPath(){let git=findExecutableOnPath("git.exe");if(!git)return null;let result=spawnSync(git,["var","GIT_SHELL_PATH"],{encoding:"utf-8",timeout:5e3,windowsHide:!0});if(result.status!==0)return null;let gitShell=win32.normalize(result.stdout.trim());if(!gitShell.toLowerCase().endsWith(`\\${GIT_FOR_WINDOWS_SHELL_SUFFIX}`))return null;let bash=win32.join(gitShell.slice(0,-GIT_FOR_WINDOWS_SHELL_SUFFIX.length),"bin","bash.exe");return shellPathExists(bash)?bash:null}function getShellConfig(customShellPath){if(customShellPath){if(shellPathExists(customShellPath))return getBashShellConfig(customShellPath);throw new Error(`Custom shell path not found: ${customShellPath}`)}if(process.platform==="win32"){let paths=[],programFiles=process.env.ProgramFiles;programFiles&&paths.push(`${programFiles}\\Git\\bin\\bash.exe`);let programFilesX86=process.env["ProgramFiles(x86)"];programFilesX86&&paths.push(`${programFilesX86}\\Git\\bin\\bash.exe`);for(let path of paths)if(shellPathExists(path))return getBashShellConfig(path);let gitBash=findGitBashOfGitOnPath();if(gitBash)return getBashShellConfig(gitBash);let bashOnPath2=findExecutableOnPath("bash.exe");if(bashOnPath2)return getBashShellConfig(bashOnPath2);throw new Error(`No bash shell found. Options:
3
+ 1. Install Git for Windows: https://git-scm.com/download/win
4
+ 2. Add your bash to PATH (Cygwin, MSYS2, etc.)
5
+ 3. Set shellPath in settings.json
6
+
7
+ Searched Git Bash in:
8
+ ${paths.map(p=>` ${p}`).join(`
9
+ `)}
10
+ the Git for Windows installation of git.exe on PATH`)}if(shellPathExists("/bin/bash"))return getBashShellConfig("/bin/bash");let bashOnPath=findExecutableOnPath("bash");return bashOnPath?getBashShellConfig(bashOnPath):{shell:"sh",args:["-c"]}}var POWERSHELL_ARGS=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command"];function getPowerShellConfig(){if(process.platform!=="win32")throw new Error("The powershell tool is only available on Windows.");let shell=findExecutableOnPath("pwsh.exe"),programFiles=process.env.ProgramFiles;if(!shell&&programFiles){let pwsh7=win32.join(programFiles,"PowerShell","7","pwsh.exe");shellPathExists(pwsh7)&&(shell=pwsh7)}shell??=findExecutableOnPath("powershell.exe");let systemRoot=process.env.SystemRoot;if(!shell&&systemRoot){let windowsPowerShell=win32.join(systemRoot,"System32","WindowsPowerShell","v1.0","powershell.exe");shellPathExists(windowsPowerShell)&&(shell=windowsPowerShell)}if(!shell)throw new Error("No PowerShell executable found. Install PowerShell or add powershell.exe/pwsh.exe to PATH.");return{shell,args:[...POWERSHELL_ARGS]}}function getShellEnv(){let binDir=getBinDir(),pathKey=Object.keys(process.env).find(key=>key.toLowerCase()==="path")??"PATH",currentPath=process.env[pathKey]??"",updatedPath=currentPath.split(delimiter).filter(Boolean).includes(binDir)?currentPath:[binDir,currentPath].filter(Boolean).join(delimiter);return{...process.env,[pathKey]:updatedPath}}function sanitizeBinaryOutput(str){return str.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFF9-\uFFFB]/g,"")}var trackedDetachedChildPids=new Set;function trackDetachedChildPid(pid){trackedDetachedChildPids.add(pid)}function untrackDetachedChildPid(pid){trackedDetachedChildPids.delete(pid)}function killTrackedDetachedChildren(){if(trackedDetachedChildPids.size!==0){if(process.platform==="win32"){let pidArgs=[...trackedDetachedChildPids].flatMap(pid=>["/PID",String(pid)]);spawnSync(getTaskkillPath(),["/F","/T",...pidArgs],{stdio:"ignore",timeout:2e3,windowsHide:!0})}else for(let pid of trackedDetachedChildPids)killProcessTree(pid);trackedDetachedChildPids.clear()}}function getTaskkillPath(){return join(process.env.SystemRoot||"C:\\Windows","System32","taskkill.exe")}function killProcessTree(pid){if(process.platform==="win32")try{spawn(getTaskkillPath(),["/F","/T","/PID",String(pid)],{stdio:"ignore",detached:!0,windowsHide:!0}).once("error",()=>{})}catch{}else{if(process.platform==="darwin")try{process.kill(-pid,"SIGSTOP")}catch{}try{process.kill(-pid,"SIGKILL")}catch{try{process.kill(pid,"SIGKILL")}catch{}}}}var DEFAULT_MAX_LINES=2e3,DEFAULT_MAX_BYTES=51200;function splitLinesForCounting(content){if(content.length===0)return[];let lines=content.split(`
11
+ `);return content.endsWith(`
12
+ `)&&lines.pop(),lines}function isBlankLine(line){return line.trim().length===0}function formatSize(bytes){return bytes<1024?`${bytes}B`:bytes<1024*1024?`${(bytes/1024).toFixed(1)}KB`:`${(bytes/(1024*1024)).toFixed(1)}MB`}function truncateHead(content,options={}){let maxLines=options.maxLines??2e3,maxBytes=options.maxBytes??51200,totalBytes=Buffer.byteLength(content,"utf-8"),lines=splitLinesForCounting(content),totalLines=lines.length;if(totalLines<=maxLines&&totalBytes<=maxBytes)return{content,truncated:!1,truncatedBy:null,totalLines,totalBytes,outputLines:totalLines,outputBytes:totalBytes,lastLinePartial:!1,firstLineExceedsLimit:!1,maxLines,maxBytes};if(Buffer.byteLength(lines[0],"utf-8")>maxBytes)return{content:"",truncated:!0,truncatedBy:"bytes",totalLines,totalBytes,outputLines:0,outputBytes:0,lastLinePartial:!1,firstLineExceedsLimit:!0,maxLines,maxBytes};let outputLinesArr=[],outputBytesCount=0,truncatedBy="lines";for(let i=0;i<lines.length&&i<maxLines;i++){let line=lines[i],lineBytes=Buffer.byteLength(line,"utf-8")+(i>0?1:0);if(outputBytesCount+lineBytes>maxBytes){truncatedBy="bytes";break}outputLinesArr.push(line),outputBytesCount+=lineBytes}outputLinesArr.length>=maxLines&&outputBytesCount<=maxBytes&&(truncatedBy="lines");let outputContent=outputLinesArr.join(`
13
+ `),finalOutputBytes=Buffer.byteLength(outputContent,"utf-8");return{content:outputContent,truncated:!0,truncatedBy,totalLines,totalBytes,outputLines:outputLinesArr.length,outputBytes:finalOutputBytes,lastLinePartial:!1,firstLineExceedsLimit:!1,maxLines,maxBytes}}function truncateTail(content,options={}){let maxLines=options.maxLines??2e3,maxBytes=options.maxBytes??51200,totalBytes=Buffer.byteLength(content,"utf-8"),lines=splitLinesForCounting(content),totalLines=lines.length;if(totalLines<=maxLines&&totalBytes<=maxBytes)return{content,truncated:!1,truncatedBy:null,totalLines,totalBytes,outputLines:totalLines,outputBytes:totalBytes,lastLinePartial:!1,firstLineExceedsLimit:!1,maxLines,maxBytes};let outputLinesArr=[],outputBytesCount=0,truncatedBy="lines",lastLinePartial=!1;for(let i=lines.length-1;i>=0&&outputLinesArr.length<maxLines;i--){let line=lines[i],lineBytes=Buffer.byteLength(line,"utf-8")+(outputLinesArr.length>0?1:0);if(outputBytesCount+lineBytes>maxBytes){truncatedBy="bytes";let remainingBytes=maxBytes-outputBytesCount-(outputLinesArr.length>0?1:0);if(outputLinesArr.length===0||!isBlankLine(line)&&outputLinesArr.every(isBlankLine)&&remainingBytes>0){let truncatedLine=truncateStringToBytesFromEnd(line,remainingBytes);outputLinesArr.unshift(truncatedLine),outputBytesCount+=lineBytes-Buffer.byteLength(line,"utf-8")+Buffer.byteLength(truncatedLine,"utf-8"),lastLinePartial=!0}break}outputLinesArr.unshift(line),outputBytesCount+=lineBytes}outputLinesArr.length>=maxLines&&outputBytesCount<=maxBytes&&(truncatedBy="lines");let outputContent=outputLinesArr.join(`
14
+ `),finalOutputBytes=Buffer.byteLength(outputContent,"utf-8");return{content:outputContent,truncated:!0,truncatedBy,totalLines,totalBytes,outputLines:outputLinesArr.length,outputBytes:finalOutputBytes,lastLinePartial,firstLineExceedsLimit:!1,maxLines,maxBytes}}function truncateStringToBytesFromEnd(str,maxBytes){let buf=Buffer.from(str,"utf-8");if(buf.length<=maxBytes)return str;let start=buf.length-maxBytes;for(;start<buf.length&&(buf[start]&192)===128;)start++;return buf.slice(start).toString("utf-8")}function truncateLine(line,maxChars=500){return line.length<=maxChars?{text:line,wasTruncated:!1}:{text:`${sliceHead(line,maxChars)}... [truncated]`,wasTruncated:!0}}function sliceHead(text,maxUnits){let end=Math.max(0,maxUnits);return isHighSurrogate(text.charCodeAt(end-1))&&isLowSurrogate(text.charCodeAt(end))?text.slice(0,end-1):text.slice(0,end)}function sliceTail(text,maxUnits){if(maxUnits<=0)return"";let start=Math.max(0,text.length-maxUnits);return isLowSurrogate(text.charCodeAt(start))&&isHighSurrogate(text.charCodeAt(start-1))?text.slice(start+1):text.slice(start)}function isHighSurrogate(code){return code>=55296&&code<=56319}function isLowSurrogate(code){return code>=56320&&code<=57343}export{getShellConfig,getPowerShellConfig,getShellEnv,sanitizeBinaryOutput,trackDetachedChildPid,untrackDetachedChildPid,killTrackedDetachedChildren,killProcessTree,DEFAULT_MAX_LINES,DEFAULT_MAX_BYTES,formatSize,truncateHead,truncateTail,truncateLine,sliceHead,sliceTail};