@humain/humain-code 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (792) hide show
  1. package/CHANGELOG.md +119 -0
  2. package/README.md +23 -6
  3. package/dist/agent-monitor/entry.lazy.d.ts +3 -0
  4. package/dist/agent-monitor/entry.lazy.d.ts.map +1 -0
  5. package/dist/agent-monitor/entry.lazy.js +3 -0
  6. package/dist/agent-monitor/entry.lazy.js.map +1 -0
  7. package/dist/bundle/agent-monitor.js +1 -1
  8. package/dist/bundle/chunks/adaptive-peer-worker-X2ZNZE3S.js +8 -0
  9. package/dist/bundle/chunks/adaptive-session-host-7KDSQV5I.js +162 -0
  10. package/dist/bundle/chunks/anthropic-messages-TQK3FUV3.js +68 -0
  11. package/dist/bundle/chunks/anthropic.js +13 -10
  12. package/dist/bundle/chunks/{azure-openai-responses-IV74M5OR.js → azure-openai-responses-JY7OSLH2.js} +6 -6
  13. package/dist/bundle/chunks/bedrock-converse-stream.js +79 -74
  14. package/dist/bundle/chunks/chunk-2FYYW6FY.js +2 -0
  15. package/dist/bundle/chunks/{chunk-A2VPLMF2.js → chunk-2G7YVAVF.js} +1 -1
  16. package/dist/bundle/chunks/chunk-32QLLD2P.js +1114 -0
  17. package/dist/bundle/chunks/{chunk-3LP543EX.js → chunk-3EDMWQ35.js} +17 -16
  18. package/dist/bundle/chunks/chunk-3HVHETMU.js +18 -0
  19. package/dist/bundle/chunks/{chunk-XMZGB3H4.js → chunk-4HTVBBJD.js} +11 -6
  20. package/dist/bundle/chunks/chunk-4JRER4XK.js +175 -0
  21. package/dist/bundle/chunks/{chunk-FHLLDO7U.js → chunk-4PRNKB6V.js} +5 -5
  22. package/dist/bundle/chunks/chunk-4QAXV5T6.js +49 -0
  23. package/dist/bundle/chunks/{chunk-JCTQQ3DX.js → chunk-4V5VL2BO.js} +1 -1
  24. package/dist/bundle/chunks/chunk-5B25YXF7.js +24 -0
  25. package/dist/bundle/chunks/chunk-5L4PBYC7.js +11 -0
  26. package/dist/bundle/chunks/chunk-66FZJO75.js +5146 -0
  27. package/dist/bundle/chunks/chunk-6P6GJPYB.js +4 -0
  28. package/dist/bundle/chunks/chunk-6PNQYO6A.js +10 -0
  29. package/dist/bundle/chunks/chunk-7NKUVTBL.js +76 -0
  30. package/dist/bundle/chunks/chunk-AEWYICBL.js +89 -0
  31. package/dist/bundle/chunks/chunk-AQ4EXORZ.js +14 -0
  32. package/dist/bundle/chunks/chunk-AZXVJN6E.js +19 -0
  33. package/dist/bundle/chunks/chunk-CRN54O4D.js +24 -0
  34. package/dist/bundle/chunks/chunk-CTU2ECLD.js +7 -0
  35. package/dist/bundle/chunks/{chunk-BQ3TMEWD.js → chunk-EIC7CQX3.js} +4 -3
  36. package/dist/bundle/chunks/chunk-F6ZAYLU2.js +59 -0
  37. package/dist/bundle/chunks/chunk-G4QPSFBF.js +493 -0
  38. package/dist/bundle/chunks/chunk-GME4AWDG.js +23 -0
  39. package/dist/bundle/chunks/{chunk-SFMDIVZ4.js → chunk-GRJUKEE3.js} +43 -30
  40. package/dist/bundle/chunks/chunk-GTILMMUF.js +12 -0
  41. package/dist/bundle/chunks/chunk-GUHNFZ2Q.js +51 -0
  42. package/dist/bundle/chunks/chunk-GY663MNP.js +11 -0
  43. package/dist/bundle/chunks/chunk-HTA325LJ.js +56 -0
  44. package/dist/bundle/chunks/{chunk-5L4JG6PO.js → chunk-I3NDOUHE.js} +8 -7
  45. package/dist/bundle/chunks/chunk-I5E7RQ5V.js +21 -0
  46. package/dist/bundle/chunks/chunk-IWZQ25I3.js +5 -0
  47. package/dist/bundle/chunks/chunk-IYGHKVUG.js +2 -0
  48. package/dist/bundle/chunks/chunk-J57HOSWD.js +21 -0
  49. package/dist/bundle/chunks/chunk-JF7FYXAI.js +288 -0
  50. package/dist/bundle/chunks/chunk-JSZBTGI6.js +10 -0
  51. package/dist/bundle/chunks/chunk-JYWUOKOI.js +1061 -0
  52. package/dist/bundle/chunks/{chunk-DLCBSLHW.js → chunk-KRCX3ZBA.js} +1 -1
  53. package/dist/bundle/chunks/chunk-KTSJYIYC.js +30 -0
  54. package/dist/bundle/chunks/{chunk-K7SDY3VJ.js → chunk-LB4CIS4F.js} +40 -165
  55. package/dist/bundle/chunks/{chunk-NN53K2QQ.js → chunk-LYZ37DJP.js} +2 -14
  56. package/dist/bundle/chunks/chunk-MD7K7RPN.js +20 -0
  57. package/dist/bundle/chunks/chunk-MX4Q4W6H.js +214 -0
  58. package/dist/bundle/chunks/{chunk-6PD3T2EF.js → chunk-N2SNMUD3.js} +1 -1
  59. package/dist/bundle/chunks/chunk-NXA6NEHE.js +54 -0
  60. package/dist/bundle/chunks/chunk-OB332KMV.js +300 -0
  61. package/dist/bundle/chunks/chunk-P6AXBESH.js +1883 -0
  62. package/dist/bundle/chunks/chunk-PPBDDQHP.js +11 -0
  63. package/dist/bundle/chunks/chunk-PWUDFU5V.js +51 -0
  64. package/dist/bundle/chunks/chunk-Q5RKNQ2T.js +73 -0
  65. package/dist/bundle/chunks/chunk-QT6ZHDMP.js +12 -0
  66. package/dist/bundle/chunks/chunk-R5OOX7RW.js +16 -0
  67. package/dist/bundle/chunks/chunk-R6YQR7TZ.js +25 -0
  68. package/dist/bundle/chunks/{chunk-4ZBGTJJM.js → chunk-RNBZBCH2.js} +1 -1
  69. package/dist/bundle/chunks/chunk-RQU722SY.js +1 -0
  70. package/dist/bundle/chunks/{chunk-RGUZULEE.js → chunk-RS6PZK35.js} +71 -72
  71. package/dist/bundle/chunks/{jiti-loader-6P33XTLC.js → chunk-RW7GT7L3.js} +1 -1
  72. package/dist/bundle/chunks/{chunk-PCTLFSQG.js → chunk-SCINMV4X.js} +1 -1
  73. package/dist/bundle/chunks/{chunk-NCC2FAJN.js → chunk-SSRCVJZK.js} +28 -28
  74. package/dist/bundle/chunks/chunk-T5A6T24H.js +93 -0
  75. package/dist/bundle/chunks/chunk-T7BXP46S.js +3367 -0
  76. package/dist/bundle/chunks/chunk-TGDPZCSW.js +9 -0
  77. package/dist/bundle/chunks/{chunk-4J6BGNX2.js → chunk-TWAHPPXN.js} +434 -429
  78. package/dist/bundle/chunks/chunk-UEW6TUSP.js +36 -0
  79. package/dist/bundle/chunks/chunk-UZNIPOGS.js +323 -0
  80. package/dist/bundle/chunks/{chunk-KM4GQ2BU.js → chunk-VFLVWPLZ.js} +5 -6
  81. package/dist/bundle/chunks/chunk-WAPZN4KP.js +74 -0
  82. package/dist/bundle/chunks/chunk-WCFHG6NO.js +16 -0
  83. package/dist/bundle/chunks/chunk-WQ7EJQIT.js +839 -0
  84. package/dist/bundle/chunks/chunk-WQOOJP7U.js +4 -0
  85. package/dist/bundle/chunks/chunk-XHDVDJM7.js +17 -0
  86. package/dist/bundle/chunks/chunk-YPZPCHNV.js +3 -0
  87. package/dist/bundle/chunks/chunk-Z5YLKK3S.js +41 -0
  88. package/dist/bundle/chunks/chunk-ZJUU6WOV.js +2052 -0
  89. package/dist/bundle/chunks/{cli-N7KOVPLB.js → cli-H4LJNE2V.js} +2 -2
  90. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-KRMHG2L3.js → cloudflare-workers-ai-system-one-T5R2RVFQ.js} +1 -1
  91. package/dist/bundle/chunks/codemode-worker.js +2 -0
  92. package/dist/bundle/chunks/compat-ZK2DIW3P.js +15 -0
  93. package/dist/bundle/chunks/dist-EY7YKQHB.js +11 -0
  94. package/dist/bundle/chunks/dist-FMWWM4H7.js +268 -0
  95. package/dist/bundle/chunks/dist-NHQTBDHT.js +1107 -0
  96. package/dist/bundle/chunks/{easter-egg-3d-O2GG2XIG.js → easter-egg-3d-BUEOC3NO.js} +1 -1
  97. package/dist/bundle/chunks/entry-A2CSLKHC.js +323 -0
  98. package/dist/bundle/chunks/entry-AL54ZGYO.js +2 -0
  99. package/dist/bundle/chunks/{execute-LMBACTKA.js → execute-MY5JSEPV.js} +18 -15
  100. package/dist/bundle/chunks/{extract-CXXLVFC5.js → extract-PTGACPGP.js} +3 -3
  101. package/dist/bundle/chunks/flow-implementer-APJFY4YI.js +21 -0
  102. package/dist/bundle/chunks/github-copilot.js +66 -62
  103. package/dist/bundle/chunks/{google-generative-ai-SBL77OXO.js → google-generative-ai-UL7YEQ6J.js} +2 -3
  104. package/dist/bundle/chunks/{google-vertex-NZBNNXMK.js → google-vertex-OTMSPUYH.js} +3 -3
  105. package/dist/bundle/chunks/host-75YAHLDR.js +3 -0
  106. package/dist/bundle/chunks/index.bundle-THL4EUSU.js +390 -0
  107. package/dist/bundle/chunks/inprocess-5NP5VJHZ.js +32 -0
  108. package/dist/bundle/chunks/interactive-mode-IW4PIVAQ.js +5 -0
  109. package/dist/bundle/chunks/jiti-bun-loader-VSLLRCSD.js +3459 -0
  110. package/dist/bundle/chunks/jiti-loader-TMJL6S2D.js +2 -0
  111. package/dist/bundle/chunks/{llama-cpp-classify-PP63BYDF.js → llama-cpp-classify-GJAXULWL.js} +1 -1
  112. package/dist/bundle/chunks/{mistral-conversations-DX4YKJSO.js → mistral-conversations-E72Y6OC3.js} +2 -2
  113. package/dist/bundle/chunks/{node-UGQUSQE6.js → node-ZFIIS5IM.js} +32 -32
  114. package/dist/bundle/chunks/openai-codex-responses-S7CMCAOY.js +101 -0
  115. package/dist/bundle/chunks/openai-completions-2Z57N7PC.js +87 -0
  116. package/dist/bundle/chunks/{openai-decisions-ALJROWBE.js → openai-decisions-JIOJDB4C.js} +1 -1
  117. package/dist/bundle/chunks/openai-responses-5VBZSTHL.js +27 -0
  118. package/dist/bundle/chunks/{openrouter-images-FCJT7C7I.js → openrouter-images-S6O7DBEJ.js} +1 -1
  119. package/dist/bundle/chunks/{pi-messages-NHTQQOPW.js → pi-messages-SMLN5J2W.js} +10 -7
  120. package/dist/bundle/chunks/runtime-OYTWXIUM.js +2 -0
  121. package/dist/bundle/chunks/session-picker-DM6S37IF.js +4 -0
  122. package/dist/bundle/chunks/startup-ui-4GGLWNSU.js +3 -0
  123. package/dist/bundle/chunks/trace-command-YLDYCL55.js +254 -0
  124. package/dist/bundle/chunks/typesafe-system-one-7BEL3H5N.js +3 -0
  125. package/dist/bundle/chunks/virtual-modules-TI3W24YL.js +28 -0
  126. package/dist/bundle/cli-runtime.js +5 -3
  127. package/dist/bundle/flow/agents/orch-implementation-fast.md +4 -4
  128. package/dist/bundle/flow/agents/orch-implementation-strong.md +5 -5
  129. package/dist/bundle/flow/package.json +35 -3
  130. package/dist/bundle/index.js +20 -17
  131. package/dist/bundle/orchestrate/README.md +37 -0
  132. package/dist/bundle/{flow → orchestrate}/agents/orch-qa-agent.md +1 -1
  133. package/dist/bundle/{flow → orchestrate}/agents/orch-worker.md +1 -1
  134. package/dist/bundle/{flow → orchestrate}/agents/orchestrator-lead.md +1 -1
  135. package/dist/bundle/orchestrate/package.json +29 -0
  136. package/dist/bundle/rpc-entry.js +5 -3
  137. package/dist/cli/args.d.ts +6 -0
  138. package/dist/cli/args.d.ts.map +1 -1
  139. package/dist/cli/args.js +69 -2
  140. package/dist/cli/args.js.map +1 -1
  141. package/dist/cli/auth-check.d.ts +3 -2
  142. package/dist/cli/auth-check.d.ts.map +1 -1
  143. package/dist/cli/auth-check.js +4 -3
  144. package/dist/cli/auth-check.js.map +1 -1
  145. package/dist/cli/config-selector.d.ts.map +1 -1
  146. package/dist/cli/config-selector.js +3 -1
  147. package/dist/cli/config-selector.js.map +1 -1
  148. package/dist/cli/file-processor.d.ts +2 -0
  149. package/dist/cli/file-processor.d.ts.map +1 -1
  150. package/dist/cli/file-processor.js +6 -6
  151. package/dist/cli/file-processor.js.map +1 -1
  152. package/dist/cli/metadata-disclosure.d.ts +4 -0
  153. package/dist/cli/metadata-disclosure.d.ts.map +1 -0
  154. package/dist/cli/metadata-disclosure.js +23 -0
  155. package/dist/cli/metadata-disclosure.js.map +1 -0
  156. package/dist/cli/project-trust.d.ts.map +1 -1
  157. package/dist/cli/project-trust.js +4 -1
  158. package/dist/cli/project-trust.js.map +1 -1
  159. package/dist/cli/session-picker.lazy.d.ts +3 -0
  160. package/dist/cli/session-picker.lazy.d.ts.map +1 -0
  161. package/dist/cli/session-picker.lazy.js +3 -0
  162. package/dist/cli/session-picker.lazy.js.map +1 -0
  163. package/dist/cli/startup-ui.d.ts +4 -4
  164. package/dist/cli/startup-ui.d.ts.map +1 -1
  165. package/dist/cli/startup-ui.js +38 -14
  166. package/dist/cli/startup-ui.js.map +1 -1
  167. package/dist/cli/startup-ui.lazy.d.ts +3 -0
  168. package/dist/cli/startup-ui.lazy.d.ts.map +1 -0
  169. package/dist/cli/startup-ui.lazy.js +3 -0
  170. package/dist/cli/startup-ui.lazy.js.map +1 -0
  171. package/dist/cli/trace-command.lazy.d.ts +3 -0
  172. package/dist/cli/trace-command.lazy.d.ts.map +1 -0
  173. package/dist/cli/trace-command.lazy.js +3 -0
  174. package/dist/cli/trace-command.lazy.js.map +1 -0
  175. package/dist/cli.js.map +1 -1
  176. package/dist/coordination/broker/entry.lazy.d.ts +3 -0
  177. package/dist/coordination/broker/entry.lazy.d.ts.map +1 -0
  178. package/dist/coordination/broker/entry.lazy.js +3 -0
  179. package/dist/coordination/broker/entry.lazy.js.map +1 -0
  180. package/dist/core/acceptance-command.d.ts +15 -0
  181. package/dist/core/acceptance-command.d.ts.map +1 -0
  182. package/dist/core/acceptance-command.js +150 -0
  183. package/dist/core/acceptance-command.js.map +1 -0
  184. package/dist/core/acceptance-ledger.d.ts +52 -0
  185. package/dist/core/acceptance-ledger.d.ts.map +1 -0
  186. package/dist/core/acceptance-ledger.js +341 -0
  187. package/dist/core/acceptance-ledger.js.map +1 -0
  188. package/dist/core/admission-types.d.ts +69 -0
  189. package/dist/core/admission-types.js +2 -0
  190. package/dist/core/admission-types.js.map +1 -0
  191. package/dist/core/agent-session-runtime.d.ts +7 -0
  192. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  193. package/dist/core/agent-session-runtime.js +43 -9
  194. package/dist/core/agent-session-runtime.js.map +1 -1
  195. package/dist/core/agent-session-services.d.ts +8 -0
  196. package/dist/core/agent-session-services.d.ts.map +1 -1
  197. package/dist/core/agent-session-services.js +13 -1
  198. package/dist/core/agent-session-services.js.map +1 -1
  199. package/dist/core/agent-session.d.ts +127 -10
  200. package/dist/core/agent-session.d.ts.map +1 -1
  201. package/dist/core/agent-session.js +1390 -145
  202. package/dist/core/agent-session.js.map +1 -1
  203. package/dist/core/anthropic-subscription-usage.d.ts +1 -1
  204. package/dist/core/anthropic-subscription-usage.d.ts.map +1 -1
  205. package/dist/core/anthropic-subscription-usage.js +31 -3
  206. package/dist/core/anthropic-subscription-usage.js.map +1 -1
  207. package/dist/core/auth-storage.d.ts +2 -1
  208. package/dist/core/auth-storage.d.ts.map +1 -1
  209. package/dist/core/auth-storage.js +13 -10
  210. package/dist/core/auth-storage.js.map +1 -1
  211. package/dist/core/auto-session-namer.d.ts.map +1 -1
  212. package/dist/core/auto-session-namer.js +3 -1
  213. package/dist/core/auto-session-namer.js.map +1 -1
  214. package/dist/core/bash-executor.d.ts.map +1 -1
  215. package/dist/core/bash-executor.js +3 -1
  216. package/dist/core/bash-executor.js.map +1 -1
  217. package/dist/core/bug-report-redaction.d.ts +4 -0
  218. package/dist/core/bug-report-redaction.d.ts.map +1 -0
  219. package/dist/core/bug-report-redaction.js +209 -0
  220. package/dist/core/bug-report-redaction.js.map +1 -0
  221. package/dist/core/bug-report.d.ts +26 -6
  222. package/dist/core/bug-report.d.ts.map +1 -1
  223. package/dist/core/bug-report.js +82 -9
  224. package/dist/core/bug-report.js.map +1 -1
  225. package/dist/core/cache-warmer.d.ts.map +1 -1
  226. package/dist/core/cache-warmer.js +5 -0
  227. package/dist/core/cache-warmer.js.map +1 -1
  228. package/dist/core/compaction/compaction.d.ts +6 -0
  229. package/dist/core/compaction/compaction.d.ts.map +1 -1
  230. package/dist/core/compaction/compaction.js +103 -71
  231. package/dist/core/compaction/compaction.js.map +1 -1
  232. package/dist/core/compaction/utils.d.ts.map +1 -1
  233. package/dist/core/compaction/utils.js +2 -1
  234. package/dist/core/compaction/utils.js.map +1 -1
  235. package/dist/core/extensions/jiti-bun-babel.d.ts +4 -0
  236. package/dist/core/extensions/jiti-bun-babel.d.ts.map +1 -0
  237. package/dist/core/extensions/jiti-bun-babel.js +4 -0
  238. package/dist/core/extensions/jiti-bun-babel.js.map +1 -0
  239. package/dist/core/extensions/jiti-bun-loader.d.ts +4 -0
  240. package/dist/core/extensions/jiti-bun-loader.d.ts.map +1 -0
  241. package/dist/core/extensions/jiti-bun-loader.js +13 -0
  242. package/dist/core/extensions/jiti-bun-loader.js.map +1 -0
  243. package/dist/core/extensions/jiti-bun-loader.lazy.d.ts +3 -0
  244. package/dist/core/extensions/jiti-bun-loader.lazy.d.ts.map +1 -0
  245. package/dist/core/extensions/jiti-bun-loader.lazy.js +3 -0
  246. package/dist/core/extensions/jiti-bun-loader.lazy.js.map +1 -0
  247. package/dist/core/extensions/loader.d.ts.map +1 -1
  248. package/dist/core/extensions/loader.js +9 -3
  249. package/dist/core/extensions/loader.js.map +1 -1
  250. package/dist/core/extensions/runner.d.ts.map +1 -1
  251. package/dist/core/extensions/runner.js +4 -0
  252. package/dist/core/extensions/runner.js.map +1 -1
  253. package/dist/core/extensions/types.d.ts +3 -0
  254. package/dist/core/extensions/types.d.ts.map +1 -1
  255. package/dist/core/extensions/types.js.map +1 -1
  256. package/dist/core/flow-implementer.d.ts +25 -0
  257. package/dist/core/flow-implementer.d.ts.map +1 -0
  258. package/dist/core/flow-implementer.js +301 -0
  259. package/dist/core/flow-implementer.js.map +1 -0
  260. package/dist/core/internal-process.d.ts +23 -0
  261. package/dist/core/internal-process.d.ts.map +1 -0
  262. package/dist/core/internal-process.js +88 -0
  263. package/dist/core/internal-process.js.map +1 -0
  264. package/dist/core/keybindings.d.ts +2 -2
  265. package/dist/core/keybindings.js +1 -1
  266. package/dist/core/keybindings.js.map +1 -1
  267. package/dist/core/model-config.d.ts +52 -0
  268. package/dist/core/model-config.d.ts.map +1 -1
  269. package/dist/core/model-config.js +4 -4
  270. package/dist/core/model-config.js.map +1 -1
  271. package/dist/core/model-registry.d.ts +4 -0
  272. package/dist/core/model-registry.d.ts.map +1 -1
  273. package/dist/core/model-registry.js +8 -0
  274. package/dist/core/model-registry.js.map +1 -1
  275. package/dist/core/model-request-admission.d.ts +51 -0
  276. package/dist/core/model-request-admission.d.ts.map +1 -0
  277. package/dist/core/model-request-admission.js +103 -0
  278. package/dist/core/model-request-admission.js.map +1 -0
  279. package/dist/core/model-resolver.d.ts +4 -0
  280. package/dist/core/model-resolver.d.ts.map +1 -1
  281. package/dist/core/model-resolver.js +109 -2
  282. package/dist/core/model-resolver.js.map +1 -1
  283. package/dist/core/model-runtime.d.ts +56 -1
  284. package/dist/core/model-runtime.d.ts.map +1 -1
  285. package/dist/core/model-runtime.js +482 -40
  286. package/dist/core/model-runtime.js.map +1 -1
  287. package/dist/core/model-selection-intent.d.ts +14 -0
  288. package/dist/core/model-selection-intent.d.ts.map +1 -0
  289. package/dist/core/model-selection-intent.js +15 -0
  290. package/dist/core/model-selection-intent.js.map +1 -0
  291. package/dist/core/oauth-account-pool.d.ts +4 -1
  292. package/dist/core/oauth-account-pool.d.ts.map +1 -1
  293. package/dist/core/oauth-account-pool.js +251 -228
  294. package/dist/core/oauth-account-pool.js.map +1 -1
  295. package/dist/core/os-secret-store.d.ts +25 -0
  296. package/dist/core/os-secret-store.d.ts.map +1 -0
  297. package/dist/core/os-secret-store.js +290 -0
  298. package/dist/core/os-secret-store.js.map +1 -0
  299. package/dist/core/output-guard.d.ts.map +1 -1
  300. package/dist/core/output-guard.js +62 -2
  301. package/dist/core/output-guard.js.map +1 -1
  302. package/dist/core/pi-ai-schemas.d.ts +4 -0
  303. package/dist/core/pi-ai-schemas.d.ts.map +1 -1
  304. package/dist/core/private-windows-path.d.ts +4 -0
  305. package/dist/core/private-windows-path.d.ts.map +1 -0
  306. package/dist/core/private-windows-path.js +44 -0
  307. package/dist/core/private-windows-path.js.map +1 -0
  308. package/dist/core/prompt-templates.d.ts.map +1 -1
  309. package/dist/core/prompt-templates.js +18 -2
  310. package/dist/core/prompt-templates.js.map +1 -1
  311. package/dist/core/provider-composer.d.ts.map +1 -1
  312. package/dist/core/provider-composer.js +1 -1
  313. package/dist/core/provider-composer.js.map +1 -1
  314. package/dist/core/resource-loader.d.ts.map +1 -1
  315. package/dist/core/resource-loader.js +6 -2
  316. package/dist/core/resource-loader.js.map +1 -1
  317. package/dist/core/run-outcome.d.ts +40 -0
  318. package/dist/core/run-outcome.d.ts.map +1 -0
  319. package/dist/core/run-outcome.js +91 -0
  320. package/dist/core/run-outcome.js.map +1 -0
  321. package/dist/core/run-preflight.d.ts +5 -0
  322. package/dist/core/run-preflight.d.ts.map +1 -0
  323. package/dist/core/run-preflight.js +96 -0
  324. package/dist/core/run-preflight.js.map +1 -0
  325. package/dist/core/runtime-credentials.d.ts +18 -2
  326. package/dist/core/runtime-credentials.d.ts.map +1 -1
  327. package/dist/core/runtime-credentials.js +65 -9
  328. package/dist/core/runtime-credentials.js.map +1 -1
  329. package/dist/core/sdk.d.ts +19 -3
  330. package/dist/core/sdk.d.ts.map +1 -1
  331. package/dist/core/sdk.js +115 -20
  332. package/dist/core/sdk.js.map +1 -1
  333. package/dist/core/settings-defaults.d.ts +2 -1
  334. package/dist/core/settings-defaults.d.ts.map +1 -1
  335. package/dist/core/settings-defaults.js +2 -1
  336. package/dist/core/settings-defaults.js.map +1 -1
  337. package/dist/core/settings-manager.d.ts +15 -4
  338. package/dist/core/settings-manager.d.ts.map +1 -1
  339. package/dist/core/settings-manager.js +114 -22
  340. package/dist/core/settings-manager.js.map +1 -1
  341. package/dist/core/settings-schema.d.ts +7 -2
  342. package/dist/core/settings-schema.d.ts.map +1 -1
  343. package/dist/core/settings-schema.js +12 -5
  344. package/dist/core/settings-schema.js.map +1 -1
  345. package/dist/core/skills.d.ts.map +1 -1
  346. package/dist/core/skills.js +11 -0
  347. package/dist/core/skills.js.map +1 -1
  348. package/dist/core/system-prompt.d.ts +3 -0
  349. package/dist/core/system-prompt.d.ts.map +1 -1
  350. package/dist/core/system-prompt.js +10 -2
  351. package/dist/core/system-prompt.js.map +1 -1
  352. package/dist/core/tools/bash-jobs.d.ts +109 -0
  353. package/dist/core/tools/bash-jobs.d.ts.map +1 -0
  354. package/dist/core/tools/bash-jobs.js +563 -0
  355. package/dist/core/tools/bash-jobs.js.map +1 -0
  356. package/dist/core/tools/bash.d.ts +68 -6
  357. package/dist/core/tools/bash.d.ts.map +1 -1
  358. package/dist/core/tools/bash.js +350 -37
  359. package/dist/core/tools/bash.js.map +1 -1
  360. package/dist/core/tools/edit-diff.d.ts +11 -1
  361. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  362. package/dist/core/tools/edit-diff.js +89 -20
  363. package/dist/core/tools/edit-diff.js.map +1 -1
  364. package/dist/core/tools/edit.d.ts.map +1 -1
  365. package/dist/core/tools/edit.js +15 -7
  366. package/dist/core/tools/edit.js.map +1 -1
  367. package/dist/core/tools/file-mutation-custody.d.ts +29 -0
  368. package/dist/core/tools/file-mutation-custody.d.ts.map +1 -0
  369. package/dist/core/tools/file-mutation-custody.js +173 -0
  370. package/dist/core/tools/file-mutation-custody.js.map +1 -0
  371. package/dist/core/tools/find.d.ts +6 -0
  372. package/dist/core/tools/find.d.ts.map +1 -1
  373. package/dist/core/tools/find.js +84 -38
  374. package/dist/core/tools/find.js.map +1 -1
  375. package/dist/core/tools/grep.d.ts +8 -2
  376. package/dist/core/tools/grep.d.ts.map +1 -1
  377. package/dist/core/tools/grep.js +121 -77
  378. package/dist/core/tools/grep.js.map +1 -1
  379. package/dist/core/tools/index.d.ts +3 -1
  380. package/dist/core/tools/index.d.ts.map +1 -1
  381. package/dist/core/tools/index.js +12 -0
  382. package/dist/core/tools/index.js.map +1 -1
  383. package/dist/core/tools/jobs.d.ts +24 -0
  384. package/dist/core/tools/jobs.d.ts.map +1 -0
  385. package/dist/core/tools/jobs.js +86 -0
  386. package/dist/core/tools/jobs.js.map +1 -0
  387. package/dist/core/tools/ls.d.ts.map +1 -1
  388. package/dist/core/tools/ls.js +2 -1
  389. package/dist/core/tools/ls.js.map +1 -1
  390. package/dist/core/tools/output-accumulator.d.ts +12 -1
  391. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  392. package/dist/core/tools/output-accumulator.js +88 -8
  393. package/dist/core/tools/output-accumulator.js.map +1 -1
  394. package/dist/core/tools/output-cleanup.d.ts +40 -0
  395. package/dist/core/tools/output-cleanup.d.ts.map +1 -0
  396. package/dist/core/tools/output-cleanup.js +273 -0
  397. package/dist/core/tools/output-cleanup.js.map +1 -0
  398. package/dist/core/tools/powershell.d.ts.map +1 -1
  399. package/dist/core/tools/powershell.js +15 -2
  400. package/dist/core/tools/powershell.js.map +1 -1
  401. package/dist/core/tools/read.d.ts +21 -0
  402. package/dist/core/tools/read.d.ts.map +1 -1
  403. package/dist/core/tools/read.js +162 -29
  404. package/dist/core/tools/read.js.map +1 -1
  405. package/dist/core/tools/renderers/bash.d.ts.map +1 -1
  406. package/dist/core/tools/renderers/bash.js +3 -1
  407. package/dist/core/tools/renderers/bash.js.map +1 -1
  408. package/dist/core/tools/renderers/index.d.ts.map +1 -1
  409. package/dist/core/tools/renderers/index.js +1 -0
  410. package/dist/core/tools/renderers/index.js.map +1 -1
  411. package/dist/core/tools/subagent.d.ts +5 -1
  412. package/dist/core/tools/subagent.d.ts.map +1 -1
  413. package/dist/core/tools/subagent.js +76 -19
  414. package/dist/core/tools/subagent.js.map +1 -1
  415. package/dist/core/tools/truncate.d.ts +4 -0
  416. package/dist/core/tools/truncate.d.ts.map +1 -1
  417. package/dist/core/tools/truncate.js +24 -1
  418. package/dist/core/tools/truncate.js.map +1 -1
  419. package/dist/core/tools/write.d.ts.map +1 -1
  420. package/dist/core/tools/write.js +6 -1
  421. package/dist/core/tools/write.js.map +1 -1
  422. package/dist/core/trace/config.js +3 -3
  423. package/dist/core/trace/config.js.map +1 -1
  424. package/dist/core/trace/redaction.d.ts.map +1 -1
  425. package/dist/core/trace/redaction.js +12 -9
  426. package/dist/core/trace/redaction.js.map +1 -1
  427. package/dist/core/trace-client/credential-store.d.ts +1 -1
  428. package/dist/core/trace-client/credential-store.d.ts.map +1 -1
  429. package/dist/core/trace-client/credential-store.js +20 -3
  430. package/dist/core/trace-client/credential-store.js.map +1 -1
  431. package/dist/core/usage-ledger.d.ts +35 -0
  432. package/dist/core/usage-ledger.d.ts.map +1 -0
  433. package/dist/core/usage-ledger.js +140 -0
  434. package/dist/core/usage-ledger.js.map +1 -0
  435. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  436. package/dist/extensions/codemode/execute.js +24 -15
  437. package/dist/extensions/codemode/execute.js.map +1 -1
  438. package/dist/extensions/codemode/index.d.ts +4 -2
  439. package/dist/extensions/codemode/index.d.ts.map +1 -1
  440. package/dist/extensions/codemode/index.js +8 -4
  441. package/dist/extensions/codemode/index.js.map +1 -1
  442. package/dist/extensions/codemode/tool.d.ts +4 -2
  443. package/dist/extensions/codemode/tool.d.ts.map +1 -1
  444. package/dist/extensions/codemode/tool.js +34 -12
  445. package/dist/extensions/codemode/tool.js.map +1 -1
  446. package/dist/extensions/llama/client.d.ts +2 -0
  447. package/dist/extensions/llama/client.d.ts.map +1 -1
  448. package/dist/extensions/llama/client.js +23 -2
  449. package/dist/extensions/llama/client.js.map +1 -1
  450. package/dist/extensions/llama/ui.d.ts.map +1 -1
  451. package/dist/extensions/llama/ui.js +15 -3
  452. package/dist/extensions/llama/ui.js.map +1 -1
  453. package/dist/extensions/mcp/runtime.d.ts.map +1 -1
  454. package/dist/extensions/mcp/runtime.js +3 -2
  455. package/dist/extensions/mcp/runtime.js.map +1 -1
  456. package/dist/extensions/tool-search/tool.d.ts.map +1 -1
  457. package/dist/extensions/tool-search/tool.js +18 -6
  458. package/dist/extensions/tool-search/tool.js.map +1 -1
  459. package/dist/extensions/usage/hcode-overview.d.ts +23 -0
  460. package/dist/extensions/usage/hcode-overview.d.ts.map +1 -0
  461. package/dist/extensions/usage/hcode-overview.js +109 -0
  462. package/dist/extensions/usage/hcode-overview.js.map +1 -0
  463. package/dist/extensions/usage/index.d.ts +5 -0
  464. package/dist/extensions/usage/index.d.ts.map +1 -1
  465. package/dist/extensions/usage/index.js +194 -12
  466. package/dist/extensions/usage/index.js.map +1 -1
  467. package/dist/extensions/usage/overview.d.ts +5 -0
  468. package/dist/extensions/usage/overview.d.ts.map +1 -1
  469. package/dist/extensions/usage/overview.js +21 -1
  470. package/dist/extensions/usage/overview.js.map +1 -1
  471. package/dist/extensions/usage/popup.d.ts +14 -3
  472. package/dist/extensions/usage/popup.d.ts.map +1 -1
  473. package/dist/extensions/usage/popup.js +199 -25
  474. package/dist/extensions/usage/popup.js.map +1 -1
  475. package/dist/humain/adaptive-execution.d.ts +51 -0
  476. package/dist/humain/adaptive-execution.d.ts.map +1 -0
  477. package/dist/humain/adaptive-execution.js +100 -0
  478. package/dist/humain/adaptive-execution.js.map +1 -0
  479. package/dist/humain/adaptive-peer-process.d.ts +44 -0
  480. package/dist/humain/adaptive-peer-process.d.ts.map +1 -0
  481. package/dist/humain/adaptive-peer-process.js +159 -0
  482. package/dist/humain/adaptive-peer-process.js.map +1 -0
  483. package/dist/humain/adaptive-peer-worker.d.ts +3 -0
  484. package/dist/humain/adaptive-peer-worker.d.ts.map +1 -0
  485. package/dist/humain/adaptive-peer-worker.js +122 -0
  486. package/dist/humain/adaptive-peer-worker.js.map +1 -0
  487. package/dist/humain/adaptive-runtime-types.d.ts +621 -0
  488. package/dist/humain/adaptive-runtime-types.d.ts.map +1 -0
  489. package/dist/humain/adaptive-runtime-types.js +3 -0
  490. package/dist/humain/adaptive-runtime-types.js.map +1 -0
  491. package/dist/humain/adaptive-session-host.d.ts +113 -0
  492. package/dist/humain/adaptive-session-host.d.ts.map +1 -0
  493. package/dist/humain/adaptive-session-host.js +1838 -0
  494. package/dist/humain/adaptive-session-host.js.map +1 -0
  495. package/dist/humain/adhd/index.d.ts +2 -2
  496. package/dist/humain/adhd/index.d.ts.map +1 -1
  497. package/dist/humain/adhd/index.js +22 -13
  498. package/dist/humain/adhd/index.js.map +1 -1
  499. package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +162 -49
  500. package/dist/humain/caveman/index.d.ts +1 -1
  501. package/dist/humain/caveman/index.d.ts.map +1 -1
  502. package/dist/humain/caveman/index.js +21 -12
  503. package/dist/humain/caveman/index.js.map +1 -1
  504. package/dist/humain/classify-tool.d.ts +4 -0
  505. package/dist/humain/classify-tool.d.ts.map +1 -0
  506. package/dist/humain/classify-tool.js +50 -0
  507. package/dist/humain/classify-tool.js.map +1 -0
  508. package/dist/humain/flow-command.d.ts +1 -1
  509. package/dist/humain/flow-command.d.ts.map +1 -1
  510. package/dist/humain/flow-command.js +21 -3
  511. package/dist/humain/flow-command.js.map +1 -1
  512. package/dist/humain/flow-loader.d.ts +15 -10
  513. package/dist/humain/flow-loader.d.ts.map +1 -1
  514. package/dist/humain/flow-loader.js +72 -18
  515. package/dist/humain/flow-loader.js.map +1 -1
  516. package/dist/humain/fuse-provider.d.ts +5 -0
  517. package/dist/humain/fuse-provider.d.ts.map +1 -0
  518. package/dist/humain/fuse-provider.js +302 -0
  519. package/dist/humain/fuse-provider.js.map +1 -0
  520. package/dist/humain/gateway/provider.d.ts.map +1 -1
  521. package/dist/humain/gateway/provider.js +2 -0
  522. package/dist/humain/gateway/provider.js.map +1 -1
  523. package/dist/humain/gateway/secret-store.d.ts +3 -7
  524. package/dist/humain/gateway/secret-store.d.ts.map +1 -1
  525. package/dist/humain/gateway/secret-store.js +21 -249
  526. package/dist/humain/gateway/secret-store.js.map +1 -1
  527. package/dist/humain/hcode/account-store.d.ts +92 -0
  528. package/dist/humain/hcode/account-store.d.ts.map +1 -0
  529. package/dist/humain/hcode/account-store.js +720 -0
  530. package/dist/humain/hcode/account-store.js.map +1 -0
  531. package/dist/humain/hcode/account.d.ts +42 -0
  532. package/dist/humain/hcode/account.d.ts.map +1 -0
  533. package/dist/humain/hcode/account.js +552 -0
  534. package/dist/humain/hcode/account.js.map +1 -0
  535. package/dist/humain/hcode/catalog.d.ts +6 -0
  536. package/dist/humain/hcode/catalog.d.ts.map +1 -0
  537. package/dist/humain/hcode/catalog.js +47 -0
  538. package/dist/humain/hcode/catalog.js.map +1 -0
  539. package/dist/humain/hcode/contracts.d.ts +389 -0
  540. package/dist/humain/hcode/contracts.d.ts.map +1 -0
  541. package/dist/humain/hcode/contracts.js +1243 -0
  542. package/dist/humain/hcode/contracts.js.map +1 -0
  543. package/dist/humain/hcode/environment.d.ts +9 -0
  544. package/dist/humain/hcode/environment.d.ts.map +1 -0
  545. package/dist/humain/hcode/environment.js +24 -0
  546. package/dist/humain/hcode/environment.js.map +1 -0
  547. package/dist/humain/hcode/facade.d.ts +54 -0
  548. package/dist/humain/hcode/facade.d.ts.map +1 -0
  549. package/dist/humain/hcode/facade.js +326 -0
  550. package/dist/humain/hcode/facade.js.map +1 -0
  551. package/dist/humain/hcode/http.d.ts +10 -0
  552. package/dist/humain/hcode/http.d.ts.map +1 -0
  553. package/dist/humain/hcode/http.js +119 -0
  554. package/dist/humain/hcode/http.js.map +1 -0
  555. package/dist/humain/hcode/notices.d.ts +15 -0
  556. package/dist/humain/hcode/notices.d.ts.map +1 -0
  557. package/dist/humain/hcode/notices.js +69 -0
  558. package/dist/humain/hcode/notices.js.map +1 -0
  559. package/dist/humain/hcode/ports.d.ts +34 -0
  560. package/dist/humain/hcode/ports.d.ts.map +1 -0
  561. package/dist/humain/hcode/ports.js +2 -0
  562. package/dist/humain/hcode/ports.js.map +1 -0
  563. package/dist/humain/hcode/provider.d.ts +15 -0
  564. package/dist/humain/hcode/provider.d.ts.map +1 -0
  565. package/dist/humain/hcode/provider.js +200 -0
  566. package/dist/humain/hcode/provider.js.map +1 -0
  567. package/dist/humain/hcode/selection.d.ts +16 -0
  568. package/dist/humain/hcode/selection.d.ts.map +1 -0
  569. package/dist/humain/hcode/selection.js +37 -0
  570. package/dist/humain/hcode/selection.js.map +1 -0
  571. package/dist/humain/hcode/transport.d.ts +22 -0
  572. package/dist/humain/hcode/transport.d.ts.map +1 -0
  573. package/dist/humain/hcode/transport.js +368 -0
  574. package/dist/humain/hcode/transport.js.map +1 -0
  575. package/dist/humain/hcode/usage.d.ts +5 -0
  576. package/dist/humain/hcode/usage.d.ts.map +1 -0
  577. package/dist/humain/hcode/usage.js +66 -0
  578. package/dist/humain/hcode/usage.js.map +1 -0
  579. package/dist/humain/hcode/wire.d.ts +16 -0
  580. package/dist/humain/hcode/wire.d.ts.map +1 -0
  581. package/dist/humain/hcode/wire.js +104 -0
  582. package/dist/humain/hcode/wire.js.map +1 -0
  583. package/dist/humain/index.d.ts +1 -3
  584. package/dist/humain/index.d.ts.map +1 -1
  585. package/dist/humain/index.js +8 -60
  586. package/dist/humain/index.js.map +1 -1
  587. package/dist/humain/login-menu.d.ts.map +1 -1
  588. package/dist/humain/login-menu.js +8 -1
  589. package/dist/humain/login-menu.js.map +1 -1
  590. package/dist/humain/metadata/contracts.d.ts +82 -0
  591. package/dist/humain/metadata/contracts.d.ts.map +1 -0
  592. package/dist/humain/metadata/contracts.js +214 -0
  593. package/dist/humain/metadata/contracts.js.map +1 -0
  594. package/dist/humain/metadata/identity.d.ts +10 -0
  595. package/dist/humain/metadata/identity.d.ts.map +1 -0
  596. package/dist/humain/metadata/identity.js +209 -0
  597. package/dist/humain/metadata/identity.js.map +1 -0
  598. package/dist/humain/metadata/index.d.ts +41 -0
  599. package/dist/humain/metadata/index.d.ts.map +1 -0
  600. package/dist/humain/metadata/index.js +100 -0
  601. package/dist/humain/metadata/index.js.map +1 -0
  602. package/dist/humain/metadata/sender.d.ts +20 -0
  603. package/dist/humain/metadata/sender.d.ts.map +1 -0
  604. package/dist/humain/metadata/sender.js +302 -0
  605. package/dist/humain/metadata/sender.js.map +1 -0
  606. package/dist/humain/metadata/version.d.ts +8 -0
  607. package/dist/humain/metadata/version.d.ts.map +1 -0
  608. package/dist/humain/metadata/version.js +38 -0
  609. package/dist/humain/metadata/version.js.map +1 -0
  610. package/dist/humain/node-http.d.ts +2 -0
  611. package/dist/humain/node-http.d.ts.map +1 -1
  612. package/dist/humain/node-http.js +9 -4
  613. package/dist/humain/node-http.js.map +1 -1
  614. package/dist/humain/node-provider.d.ts +2 -0
  615. package/dist/humain/node-provider.d.ts.map +1 -1
  616. package/dist/humain/node-provider.js +39 -8
  617. package/dist/humain/node-provider.js.map +1 -1
  618. package/dist/humain/ponytail/vendor/hooks/ponytail-config.d.ts +1 -1
  619. package/dist/humain/ponytail/vendor/hooks/ponytail-config.d.ts.map +1 -1
  620. package/dist/humain/ponytail/vendor/hooks/ponytail-config.js +4 -4
  621. package/dist/humain/ponytail/vendor/hooks/ponytail-config.js.map +1 -1
  622. package/dist/humain/ponytail/vendor/hooks/ponytail-instructions.d.ts.map +1 -1
  623. package/dist/humain/ponytail/vendor/hooks/ponytail-instructions.js +7 -0
  624. package/dist/humain/ponytail/vendor/hooks/ponytail-instructions.js.map +1 -1
  625. package/dist/humain/ponytail/vendor/pi-extension/index.d.ts.map +1 -1
  626. package/dist/humain/ponytail/vendor/pi-extension/index.js +12 -1
  627. package/dist/humain/ponytail/vendor/pi-extension/index.js.map +1 -1
  628. package/dist/humain/systemone.d.ts +23 -0
  629. package/dist/humain/systemone.d.ts.map +1 -0
  630. package/dist/humain/systemone.js +101 -0
  631. package/dist/humain/systemone.js.map +1 -0
  632. package/dist/humain/trace-capture/flow-producer.d.ts.map +1 -1
  633. package/dist/humain/trace-capture/flow-producer.js +3 -3
  634. package/dist/humain/trace-capture/flow-producer.js.map +1 -1
  635. package/dist/index.d.ts +4 -2
  636. package/dist/index.d.ts.map +1 -1
  637. package/dist/index.js.map +1 -1
  638. package/dist/main.d.ts +1 -0
  639. package/dist/main.d.ts.map +1 -1
  640. package/dist/main.js +292 -183
  641. package/dist/main.js.map +1 -1
  642. package/dist/modes/interactive/bug-report.d.ts.map +1 -1
  643. package/dist/modes/interactive/bug-report.js +82 -36
  644. package/dist/modes/interactive/bug-report.js.map +1 -1
  645. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  646. package/dist/modes/interactive/components/assistant-message.js +8 -5
  647. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  648. package/dist/modes/interactive/components/diff.d.ts.map +1 -1
  649. package/dist/modes/interactive/components/diff.js +11 -5
  650. package/dist/modes/interactive/components/diff.js.map +1 -1
  651. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  652. package/dist/modes/interactive/components/extension-selector.js +9 -1
  653. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  654. package/dist/modes/interactive/components/first-time-setup.d.ts +10 -5
  655. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
  656. package/dist/modes/interactive/components/first-time-setup.js +55 -29
  657. package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
  658. package/dist/modes/interactive/components/model-selector.d.ts +16 -2
  659. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  660. package/dist/modes/interactive/components/model-selector.js +164 -19
  661. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  662. package/dist/modes/interactive/components/oauth-selector.d.ts +3 -0
  663. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  664. package/dist/modes/interactive/components/oauth-selector.js +19 -2
  665. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  666. package/dist/modes/interactive/components/status-indicator.d.ts +17 -0
  667. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  668. package/dist/modes/interactive/components/status-indicator.js +78 -1
  669. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  670. package/dist/modes/interactive/components/tree-selector.d.ts +1 -0
  671. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  672. package/dist/modes/interactive/components/tree-selector.js +19 -10
  673. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  674. package/dist/modes/interactive/interactive-mode.d.ts +4 -0
  675. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  676. package/dist/modes/interactive/interactive-mode.js +353 -65
  677. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  678. package/dist/modes/interactive/interactive-mode.lazy.d.ts +3 -0
  679. package/dist/modes/interactive/interactive-mode.lazy.d.ts.map +1 -0
  680. package/dist/modes/interactive/interactive-mode.lazy.js +3 -0
  681. package/dist/modes/interactive/interactive-mode.lazy.js.map +1 -0
  682. package/dist/modes/interactive/model-catalog-refresh.d.ts +2 -0
  683. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -1
  684. package/dist/modes/interactive/model-catalog-refresh.js +12 -0
  685. package/dist/modes/interactive/model-catalog-refresh.js.map +1 -1
  686. package/dist/modes/interactive/theme/theme-controller.d.ts +2 -3
  687. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
  688. package/dist/modes/interactive/theme/theme-controller.js +4 -5
  689. package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
  690. package/dist/modes/interactive/theme/theme-schema.js +4 -4
  691. package/dist/modes/interactive/theme/theme-schema.js.map +1 -1
  692. package/dist/modes/interactive/theme/theme.d.ts +2 -0
  693. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  694. package/dist/modes/interactive/theme/theme.js +8 -0
  695. package/dist/modes/interactive/theme/theme.js.map +1 -1
  696. package/dist/modes/json-event.d.ts +2 -1
  697. package/dist/modes/json-event.d.ts.map +1 -1
  698. package/dist/modes/json-event.js.map +1 -1
  699. package/dist/modes/print-mode.d.ts +4 -0
  700. package/dist/modes/print-mode.d.ts.map +1 -1
  701. package/dist/modes/print-mode.js +57 -11
  702. package/dist/modes/print-mode.js.map +1 -1
  703. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  704. package/dist/modes/rpc/rpc-mode.js +68 -16
  705. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  706. package/dist/modes/rpc/rpc-types.d.ts +2 -0
  707. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  708. package/dist/modes/rpc/rpc-types.js.map +1 -1
  709. package/dist/utils/changelog.d.ts +1 -1
  710. package/dist/utils/changelog.d.ts.map +1 -1
  711. package/dist/utils/changelog.js +7 -5
  712. package/dist/utils/changelog.js.map +1 -1
  713. package/dist/utils/image-resize.d.ts.map +1 -1
  714. package/dist/utils/image-resize.js +3 -1
  715. package/dist/utils/image-resize.js.map +1 -1
  716. package/dist/utils/lazy-validator.d.ts +5 -0
  717. package/dist/utils/lazy-validator.d.ts.map +1 -0
  718. package/dist/utils/lazy-validator.js +7 -0
  719. package/dist/utils/lazy-validator.js.map +1 -0
  720. package/dist/utils/shell.d.ts +3 -1
  721. package/dist/utils/shell.d.ts.map +1 -1
  722. package/dist/utils/shell.js +9 -4
  723. package/dist/utils/shell.js.map +1 -1
  724. package/docs/cli.md +23 -5
  725. package/docs/codemode.md +21 -1
  726. package/docs/development.md +18 -0
  727. package/docs/docs.json +4 -0
  728. package/docs/extensions.md +4 -0
  729. package/docs/flow.md +115 -16
  730. package/docs/headless-modes.md +61 -0
  731. package/docs/humain-code-forge-architecture.md +65 -13
  732. package/docs/humain-code-forge-component-scorecard.md +10 -1
  733. package/docs/humain-code-forge-flow-walkthrough.md +54 -55
  734. package/docs/humain-code.md +22 -19
  735. package/docs/index.md +1 -0
  736. package/docs/keybindings.md +1 -1
  737. package/docs/models-configuration.md +6 -1
  738. package/docs/models.md +1 -1
  739. package/docs/prompt-templates.md +1 -1
  740. package/docs/providers.md +67 -15
  741. package/docs/run-preflight.md +47 -0
  742. package/docs/sdk.md +39 -1
  743. package/docs/security.md +1 -1
  744. package/docs/settings.md +12 -5
  745. package/docs/skills.md +2 -0
  746. package/docs/slash-commands.md +5 -3
  747. package/docs/usage.md +29 -0
  748. package/examples/extensions/custom-provider-anthropic/package-lock.json +4 -4
  749. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  750. package/examples/tsconfig.json +13 -0
  751. package/npm-shrinkwrap.json +67 -67
  752. package/package.json +25 -19
  753. package/schemas/models.schema.json +30 -0
  754. package/schemas/settings.schema.json +28 -9
  755. package/src/humain/caveman/UPSTREAM.md +19 -3
  756. package/src/humain/caveman/upstream.json +2 -2
  757. package/src/humain/ponytail/UPSTREAM.md +16 -1
  758. package/src/humain/web-access/UPSTREAM.md +10 -0
  759. package/src/humain/web-access/upstream.json +1 -0
  760. package/dist/bundle/chunks/anthropic-messages-MNISFDZA.js +0 -66
  761. package/dist/bundle/chunks/chunk-2HZ2V3HS.js +0 -1985
  762. package/dist/bundle/chunks/chunk-2PZ46FSM.js +0 -6
  763. package/dist/bundle/chunks/chunk-4SQUP6IR.js +0 -88
  764. package/dist/bundle/chunks/chunk-5JSLXC2A.js +0 -3
  765. package/dist/bundle/chunks/chunk-75CQYZ63.js +0 -1336
  766. package/dist/bundle/chunks/chunk-DCPACGLH.js +0 -12267
  767. package/dist/bundle/chunks/chunk-FLVBQ6GS.js +0 -24
  768. package/dist/bundle/chunks/chunk-H7Y4QY7K.js +0 -11
  769. package/dist/bundle/chunks/chunk-JEAM6N22.js +0 -139
  770. package/dist/bundle/chunks/chunk-PS2FJ7M4.js +0 -23
  771. package/dist/bundle/chunks/chunk-TEOMXMW6.js +0 -23
  772. package/dist/bundle/chunks/chunk-WEFEQEIQ.js +0 -28
  773. package/dist/bundle/chunks/chunk-WW4SILXG.js +0 -249
  774. package/dist/bundle/chunks/compat-MXAZPYDN.js +0 -13
  775. package/dist/bundle/chunks/dist-3V7ZSLER.js +0 -3166
  776. package/dist/bundle/chunks/dist-66CW64M2.js +0 -8
  777. package/dist/bundle/chunks/host-SCZ4IKWR.js +0 -2
  778. package/dist/bundle/chunks/openai-codex-responses-LZWBQYVP.js +0 -101
  779. package/dist/bundle/chunks/openai-completions-7NWH423P.js +0 -82
  780. package/dist/bundle/chunks/openai-responses-5YOLHMCF.js +0 -27
  781. package/dist/bundle/chunks/runtime-UVPDE4CX.js +0 -2
  782. package/dist/bundle/chunks/typesafe-system-one-BHJYAZ6E.js +0 -3
  783. package/dist/bundle/chunks/virtual-modules-YQPK57CW.js +0 -23
  784. package/dist/humain/legacy-workflow-tiers.d.ts +0 -3
  785. package/dist/humain/legacy-workflow-tiers.d.ts.map +0 -1
  786. package/dist/humain/legacy-workflow-tiers.js +0 -46
  787. package/dist/humain/legacy-workflow-tiers.js.map +0 -1
  788. /package/dist/bundle/{flow → orchestrate}/agents/orch-architect.md +0 -0
  789. /package/dist/bundle/{flow → orchestrate}/agents/orch-scout.md +0 -0
  790. /package/dist/bundle/{flow → orchestrate}/agents/orch-security-review.md +0 -0
  791. /package/dist/bundle/{flow → orchestrate}/agents/orch-technical-lead.md +0 -0
  792. /package/dist/bundle/{flow → orchestrate}/agents/orch-technical-review.md +0 -0
@@ -1,24 +0,0 @@
1
- import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{mcpNamespace,require_proper_lockfile,validateMcpServerConfig}from"./chunk-WW4SILXG.js";import{CONFIG_DIR_NAME,canonicalizePath,pathsEqual,resolvePath,stripBom}from"./chunk-KM4GQ2BU.js";import{__toESM}from"./chunk-JXWJOIH4.js";import{spawn}from"node:child_process";import{dirname,extname,isAbsolute,join}from"node:path";import{fileURLToPath}from"node:url";var WINDOWS_VIEWABLE=new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".txt",".md",".log",".csv",".json",".pdf"]);function windowsLaunch(target){let systemRoot=process.env.SystemRoot??"C:\\Windows",rundll32=join(systemRoot,"System32","rundll32.exe"),path,url=URL.canParse(target)?new URL(target):void 0;if(!url||/^[a-z]:$/i.test(url.protocol))path=target;else{if(url.
3
- protocol==="http:"||url.protocol==="https:"||url.protocol==="mailto:")return{file:rundll32,args:["url.dll,FileProtocolHandler",target]};if(url.protocol==="file:"&&!url.hostname)path=fileURLToPath(url);else return}if(!(!isAbsolute(path)||path.startsWith("\\\\")||path.startsWith("//")||path.includes('"')))return WINDOWS_VIEWABLE.has(extname(path).toLowerCase())?{file:rundll32,args:["url.dll,FileProtocolHandler",path]}:{file:join(systemRoot,"explorer.exe"),args:[`/select,"${path}"`],verbatim:!0}}function unixLaunch(target){
4
- let darwin=process.platform==="darwin",url=URL.canParse(target)?new URL(target):void 0,path;if(!url)path=target;else{if(url.protocol==="http:"||url.protocol==="https:"||url.protocol==="mailto:")return{file:darwin?"open":"xdg-open",args:[url.href]};if(url.protocol==="file:"&&!url.hostname&&!/%2f/i.test(url.pathname))path=fileURLToPath(url);else return}if(!(!isAbsolute(path)||path.includes("\0")))return darwin?{file:"open",args:["-R",path]}:{file:"xdg-open",args:[dirname(path)]}}function openBrowser(target){
5
- let launch;try{launch=process.platform==="win32"?windowsLaunch(target):unixLaunch(target)}catch{return}!launch||launch.args.some(argument=>argument.includes("\0"))||spawn(launch.file,launch.args,{stdio:"ignore",detached:!0,cwd:"/",...launch.verbatim&&{windowsVerbatimArguments:!0}}).on("error",()=>{}).unref()}var import_proper_lockfile=__toESM(require_proper_lockfile(),1);import{existsSync,mkdirSync,readFileSync,writeFileSync}from"node:fs";import{homedir}from"node:os";import{dirname as dirname2,join as join2}from"node:path";var TRUST_REQUIRING_PROJECT_CONFIG_RESOURCES=["settings.json","mcp.json","extensions","skills","prompts","themes","SYSTEM.md","APPEND_SYSTEM.md"];function normalizeCwd(cwd){return canonicalizePath(resolvePath(cwd))}function findTrustFileKeys(data,path){return Object.keys(data).filter(key=>pathsEqual(key,path))}function findNearestTrustEntry(data,cwd){let currentDir=normalizeCwd(cwd);for(;;){for(let key of findTrustFileKeys(data,currentDir)){let value=data[key];if(value===!0||value===!1)return{path:key,
6
- decision:value}}let parentDir=dirname2(currentDir);if(parentDir===currentDir)return null;currentDir=parentDir}}function getProjectTrustParentPath(cwd){let trustPath=normalizeCwd(cwd),parentDir=dirname2(trustPath);return parentDir===trustPath?void 0:parentDir}function getProjectTrustOptions(cwd,options){let trustPath=normalizeCwd(cwd),trustOptions=[{label:"Trust",trusted:!0,updates:[{path:trustPath,decision:!0}],savedPath:trustPath}],parentPath=getProjectTrustParentPath(cwd);return parentPath!==void 0&&
7
- trustOptions.push({label:`Trust parent folder (${parentPath})`,trusted:!0,updates:[{path:parentPath,decision:!0},{path:trustPath,decision:null}],savedPath:parentPath}),options?.includeSessionOnly&&trustOptions.push({label:"Trust (this session only)",trusted:!0,updates:[]}),trustOptions.push({label:"Do not trust",trusted:!1,updates:[{path:trustPath,decision:!1}],savedPath:trustPath}),options?.includeSessionOnly&&trustOptions.push({label:"Do not trust (this session only)",trusted:!1,updates:[]}),trustOptions}
8
- function readTrustFile(path){if(!existsSync(path))return{};let parsed;try{parsed=JSON.parse(stripBom(readFileSync(path,"utf-8")))}catch(error){let message=error instanceof Error?error.message:String(error);throw new Error(`Failed to read trust store ${path}: ${message}`)}if(typeof parsed!="object"||parsed===null||Array.isArray(parsed))throw new Error(`Invalid trust store ${path}: expected an object`);let data={};for(let[key,value]of Object.entries(parsed)){if(value!==!0&&value!==!1&&value!==null)
9
- throw new Error(`Invalid trust store ${path}: value for ${JSON.stringify(key)} must be true, false, or null`);data[key]=value}return data}function writeTrustFile(path,data){let sorted={};for(let key of Object.keys(data).sort()){let value=data[key];(value===!0||value===!1||value===null)&&(sorted[key]=value)}mkdirSync(dirname2(path),{recursive:!0}),writeFileSync(path,`${JSON.stringify(sorted,null,2)}
10
- `,"utf-8")}function acquireTrustLockSync(path){let trustDir=dirname2(path);mkdirSync(trustDir,{recursive:!0});let maxAttempts=10,delayMs=20,lastError;for(let attempt=1;attempt<=maxAttempts;attempt++)try{return import_proper_lockfile.default.lockSync(trustDir,{realpath:!1,lockfilePath:`${path}.lock`})}catch(error){if((typeof error=="object"&&error!==null&&"code"in error?String(error.code):void 0)!=="ELOCKED"||attempt===maxAttempts)throw error;lastError=error;let start=Date.now();for(;Date.now()-start<
11
- delayMs;);}throw lastError instanceof Error?lastError:new Error("Failed to acquire trust store lock")}function withTrustFileLock(path,fn){let release=acquireTrustLockSync(path);try{return fn()}finally{release()}}function hasTrustRequiringProjectResources(cwd){let homeDir=canonicalizePath(resolvePath(process.env.HOME||homedir())),userAgentsSkillsDir=join2(homeDir,".agents","skills"),currentDir=canonicalizePath(resolvePath(cwd)),configDir=join2(currentDir,CONFIG_DIR_NAME);if(TRUST_REQUIRING_PROJECT_CONFIG_RESOURCES.
12
- some(entry=>existsSync(join2(configDir,entry))))return!0;for(;;){let agentsSkillsDir=join2(currentDir,".agents","skills");if(!pathsEqual(agentsSkillsDir,userAgentsSkillsDir)&&existsSync(agentsSkillsDir))return!0;let parentDir=dirname2(currentDir);if(parentDir===currentDir)return!1;currentDir=parentDir}}var ProjectTrustStore=class{trustPath;constructor(agentDir){this.trustPath=join2(resolvePath(agentDir),"trust.json")}get(cwd){return this.getEntry(cwd)?.decision??null}getEntry(cwd){return withTrustFileLock(
13
- this.trustPath,()=>{let data=readTrustFile(this.trustPath);return findNearestTrustEntry(data,cwd)})}set(cwd,decision){this.setMany([{path:cwd,decision}])}setMany(decisions){withTrustFileLock(this.trustPath,()=>{let data=readTrustFile(this.trustPath);for(let{path,decision}of decisions){let key=normalizeCwd(path);for(let existingKey of findTrustFileKeys(data,key))delete data[existingKey];decision!==null&&(data[key]=decision)}writeTrustFile(this.trustPath,data)})}};var import_proper_lockfile2=__toESM(require_proper_lockfile(),1);import{randomUUID}from"node:crypto";import{chmodSync,existsSync as existsSync2,lstatSync,mkdirSync as mkdirSync2,readFileSync as readFileSync2,realpathSync,renameSync,rmSync,statSync,writeFileSync as writeFileSync2}from"node:fs";import{basename,dirname as dirname3,join as join3}from"node:path";var OVERRIDE_KEYS=["enabled","exposure","toolExposure"];function isOverride(value){return value.command===void 0&&value.url===void 0&&value.type===void 0}function isRecord(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)}function readConfigFile(path,scope,state){let{servers,errors}=state;if(!existsSync2(path))return;let parsed;try{parsed=JSON.parse(stripBom(readFileSync2(path,"utf8")))}catch(error){errors.push(`${path}: ${error instanceof Error?error.message:String(error)}`);
14
- return}if(!isRecord(parsed)||parsed.mcpServers!==void 0&&!isRecord(parsed.mcpServers)){errors.push(`${path}: expected an object with an "mcpServers" object`);return}typeof parsed.autoEnableCodemode=="boolean"?state.autoEnableCodemode=parsed.autoEnableCodemode:parsed.autoEnableCodemode!==void 0&&errors.push(`${path}: autoEnableCodemode must be a boolean`);for(let[name,value]of Object.entries(parsed.mcpServers??{})){if(scope==="project"&&isRecord(value)&&isOverride(value)){let base=servers.get(name),
15
- extra=Object.keys(value).filter(key=>!OVERRIDE_KEYS.includes(key));if(!base)errors.push(`${path}: server "${name}" needs "command" or "url", or a global server to override`);else if(extra.length>0)errors.push(`${path}: server "${name}": an override can only set ${OVERRIDE_KEYS.join(", ")}`);else{let config2=validateMcpServerConfig(name,{...base.config,...value});typeof config2=="string"?errors.push(`${path}: ${config2}`):servers.set(name,{...base,config:config2,override:path})}continue}let config=validateMcpServerConfig(
16
- name,value);if(typeof config=="string"){errors.push(`${path}: ${config}`);continue}let clash=[...servers.keys()].find(other=>other!==name&&mcpNamespace(other)===mcpNamespace(name));if(clash){errors.push(`${path}: server "${name}" conflicts with "${clash}"`);continue}if(scope==="project"&&"url"in config&&config.auth){errors.push(`${path}: server "${name}": auth is only allowed in the global mcp.json`);continue}servers.set(name,{name,config,source:path,scope})}}function loadMcpConfig(options){let state={
17
- servers:new Map,errors:[]};readConfigFile(join3(options.agentDir,"mcp.json"),"global",state);let projectConfig=options.projectTrusted?join3(options.cwd,CONFIG_DIR_NAME,"mcp.json"):void 0;return projectConfig&&readConfigFile(projectConfig,"project",state),{servers:[...state.servers.values()],...state.autoEnableCodemode===void 0?{}:{autoEnableCodemode:state.autoEnableCodemode},errors:state.errors,...projectConfig?{projectConfig}:{}}}function updateMcpServerConfig(path,name,patch,options={}){editMcpServers(
18
- path,(servers,parsed)=>{let server=servers?.[name];if(server===void 0&&options.override&&(server={},parsed.mcpServers={...servers,[name]:server}),!isRecord(server))throw new Error(`${path} does not define MCP server "${name}"`);let keepDefaults=isOverride(server);return patch.enabled!==void 0&&(patch.enabled&&!keepDefaults?delete server.enabled:server.enabled=patch.enabled),patch.exposure!==void 0&&(patch.exposure==="codemode"&&!keepDefaults?delete server.exposure:server.exposure=patch.exposure),
19
- !0})}function addMcpServerConfig(path,name,config){return updateMcpConfigLocked(path,servers=>{let replaced=servers[name]!==void 0;return servers[name]=config,replaced})}function updateMcpConfigLocked(path,mutate){let result;return editMcpServers(path,(servers,parsed)=>{let target=servers??{},before=JSON.stringify(target);return result=mutate(target),JSON.stringify(target)===before?!1:(parsed.mcpServers=target,!0)}),result}function removeMcpServerConfig(path,name){if(!existsSync2(path))return!1;let removed=!1;return editMcpServers(path,servers=>!servers||servers[name]===void 0?!1:(delete servers[name],removed=!0,!0)),removed}function parseMcpFile(path,text){let parsed=text===void 0?{}:JSON.parse(stripBom(text));if(!isRecord(parsed)||parsed.mcpServers!==void 0&&!isRecord(parsed.mcpServers))throw new Error(`${path}: expected an object with an "mcpServers" object`);return{parsed,servers:isRecord(parsed.mcpServers)?parsed.
20
- mcpServers:void 0}}function canonicalMcpPath(path){mkdirSync2(dirname3(path),{recursive:!0});let isSymlink=!1;try{isSymlink=lstatSync(path).isSymbolicLink()}catch(error){if(error.code!=="ENOENT")throw error;return join3(realpathSync(dirname3(path)),basename(path))}try{return realpathSync(path)}catch(error){throw isSymlink&&error.code==="ENOENT"?new Error(`Refusing to modify ${path}: it is a dangling symlink. Create its target or remove the link.`):error}}function acquireMcpLockSync(path){let dir=dirname3(
21
- path),maxAttempts=50,delayMs=20;for(let attempt=1;;attempt++)try{return import_proper_lockfile2.default.lockSync(dir,{realpath:!1,lockfilePath:`${path}.lock`})}catch(error){if((typeof error=="object"&&error!==null&&"code"in error?String(error.code):void 0)!=="ELOCKED"||attempt===maxAttempts)throw error;let start=Date.now();for(;Date.now()-start<delayMs;);}}function editMcpServers(path,edit){let canonical=canonicalMcpPath(path),release=acquireMcpLockSync(canonical);try{if(canonicalMcpPath(path)!==
22
- canonical)throw new Error(`Refusing to modify ${path}: it changed while waiting for the lock. Retry.`);let text=existsSync2(canonical)?readFileSync2(canonical,"utf8"):void 0,{parsed,servers}=parseMcpFile(path,text);if(!edit(servers,parsed))return;let indent=text&&/^([ \t]+)\S/m.exec(text)?.[1]||" ",targetPath=canonical,tempPath=join3(dirname3(targetPath),`${randomUUID()}.tmp`),mode=text!==void 0?statSync(targetPath).mode&511:384;try{writeFileSync2(tempPath,`${JSON.stringify(parsed,null,indent)}\
23
-
24
- `,{flag:"wx",mode}),chmodSync(tempPath,mode),renameSync(tempPath,targetPath)}catch(error){throw rmSync(tempPath,{force:!0}),error}}finally{release()}}export{openBrowser,getProjectTrustOptions,hasTrustRequiringProjectResources,ProjectTrustStore,loadMcpConfig,updateMcpServerConfig,addMcpServerConfig,updateMcpConfigLocked,removeMcpServerConfig};
@@ -1,11 +0,0 @@
1
- import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- function buildProviderErrorPattern(patterns){return new RegExp(patterns.join("|"),"i")}var NON_RETRYABLE_PROVIDER_LIMIT_ERROR_PATTERN=buildProviderErrorPattern(["GoUsageLimitError","FreeUsageLimitError","Monthly usage limit reached","available balance","insufficient_quota","out of budget","quota exceeded","billing","subscription_sharing_usage_limit_exceeded","subscription_sharing_workplace_individual_usage_limit_exceeded",'"code"\\s*:\\s*"?1308(?![0-9])']),RETRYABLE_PROVIDER_ERROR_PATTERN=buildProviderErrorPattern(
3
- ["overloaded","server_busy","servers are currently busy","currently experiencing high demand","model is at capacity","rate.?limit","too many requests","(?<![a-z0-9])(?:429|500|502|503|504|520|524)(?![a-z0-9])","service.?(?:is.?)?(?:temporarily.?)?unavailable","server.?error","internal.?error","provider.?returned.?(?:an.?)?error","exceeded request buffer limit while retrying upstream","unable to forward upstream","upstream.?request.?failed","upstream_stream_read_error","stream was interrupted","h\
4
- ttp/?2 stream failed","network.?error","connection.?error","connection.?refused","connection.?lost","other side closed","fetch failed","request to \\S+ failed, reason:","getaddrinfo","ENOTFOUND","EAI_AGAIN","upstream.?connect","reset before headers","socket hang up","socket connection was closed","timed? out","timeout","model provider stopped sending output for \\d+(?:\\.\\d+)? s \\(no progress\\)","terminated","websocket.?closed","websocket.?error","ended without","stream ended before message_s\
5
- top","stream ended before a terminal response event","http2 request did not get a response","stream disconnected before completion","pending stream has been canceled","retry delay","you can retry your request","try your request again","please retry your request","ResourceExhausted","subscription_sharing_usage_unavailable","subscription_sharing_user_unavailable"]),DEFAULT_MAX_AGENT_RETRY_DELAY_MS=6e4;function retryDelayMs(policy,attempt,serverDelayMs){let delay=Math.max(policy.baseDelayMs*2**Math.
6
- max(0,attempt-1),Math.ceil(serverDelayMs??0)),safeDelay=Number.isSafeInteger(delay)?delay:Number.MAX_SAFE_INTEGER;return Math.min(safeDelay,policy.maxAgentDelayMs??DEFAULT_MAX_AGENT_RETRY_DELAY_MS)}var RetrySleepAbortError=class extends Error{constructor(){super("Aborted")}};function sleep(ms,signal){return new Promise((resolve,reject)=>{if(signal?.aborted){reject(new RetrySleepAbortError);return}let timeout=setTimeout(resolve,ms);signal?.addEventListener("abort",()=>{clearTimeout(timeout),reject(
7
- new RetrySleepAbortError)},{once:!0})})}async function retryAssistantCall(produce,policy,signal,callbacks){let maxAttempts=policy?.enabled?policy.maxRetries:0,attempt=0,lastRetry;for(;;){let response=await produce();if(response.stopReason==="aborted")return lastRetry&&await callbacks?.onRetryFinished?.(!1,lastRetry.attempt),response;if(response.stopReason!=="error")return lastRetry&&await callbacks?.onRetryFinished?.(!0,lastRetry.attempt),response;if(attempt>=maxAttempts||!isRetryableAssistantError(
8
- response))return lastRetry&&await callbacks?.onRetryFinished?.(!1,lastRetry.attempt,response.errorMessage),response;let delayMs=getAssistantRetryDelayMs(response,retryDelayMs(policy,attempt+1,response.retryAfterMs));if(delayMs>(policy.maxAgentDelayMs??DEFAULT_MAX_AGENT_RETRY_DELAY_MS))return lastRetry&&await callbacks?.onRetryFinished?.(!1,lastRetry.attempt,response.errorMessage),response;attempt++,lastRetry={attempt,errorMessage:response.errorMessage||"Unknown error"},await callbacks?.onRetryScheduled?.(
9
- attempt,maxAttempts,delayMs,lastRetry.errorMessage);try{await sleep(delayMs,signal)}catch(error){if(await callbacks?.onRetryFinished?.(!1,attempt,lastRetry.errorMessage),error instanceof RetrySleepAbortError){let{errorMessage:_errorMessage,...rest}=response;return{...rest,stopReason:"aborted"}}throw error}await callbacks?.onRetryAttemptStart?.()}}function isRetryableAssistantError(message){if(message.stopReason!=="error"||!message.errorMessage)return!1;if(message.diagnostics?.some(entry=>entry.type===
10
- "provider_no_progress_timeout"))return!0;let httpError=message.diagnostics?.findLast(entry=>entry.type==="provider_http_error");if(typeof httpError?.details?.retryable=="boolean")return httpError.details.retryable;let errorMessage=message.errorMessage;return NON_RETRYABLE_PROVIDER_LIMIT_ERROR_PATTERN.test(errorMessage)?!1:RETRYABLE_PROVIDER_ERROR_PATTERN.test(errorMessage)}function getAssistantRetryDelayMs(message,baseDelayMs){let retryAt=message.diagnostics?.findLast(entry=>entry.type==="provid\
11
- er_http_error")?.details?.retryAt;return typeof retryAt=="number"&&Number.isFinite(retryAt)?Math.max(baseDelayMs,retryAt-Date.now()):baseDelayMs}export{DEFAULT_MAX_AGENT_RETRY_DELAY_MS,retryDelayMs,retryAssistantCall,isRetryableAssistantError,getAssistantRetryDelayMs};
@@ -1,139 +0,0 @@
1
- import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{CodeHighlighter,Container,Spacer,Text,getCapabilities,getImageDimensions,hyperlink,imageFallback,keyHint,markReportsChanges,markStableRender,reportRenderChange,sanitizeTerminalText,sanitizeTerminalTextFrom,startsWithText,truncateToWidth,visibleWidth,wrapTextWithAnsi}from"./chunk-75CQYZ63.js";import{sanitizeBinaryOutput}from"./chunk-PS2FJ7M4.js";import{typebox_exports}from"./chunk-VEGJT52D.js";import{getDocsPath,resolvePath,shortenHomePath}from"./chunk-KM4GQ2BU.js";
3
- import{DEFAULT_MAX_AGENT_RETRY_DELAY_MS}from"./chunk-H7Y4QY7K.js";import{randomBytes}from"node:crypto";import{createWriteStream}from"node:fs";import{writeFile}from"node:fs/promises";import{tmpdir}from"node:os";import{join}from"node:path";var OUTPUT_FILE_MODE=384;function createOutputFilePath(prefix,extension){return join(tmpdir(),`${prefix}-${randomBytes(8).toString("hex")}${extension}`)}async function writeOutputFile(prefix,extension,data){let path=createOutputFilePath(prefix,extension);return await writeFile(path,data,{mode:OUTPUT_FILE_MODE,flag:"wx"}),path}
4
- function createOutputFileStream(prefix,extension){let path=createOutputFilePath(prefix,extension);return{path,stream:createWriteStream(path,{mode:OUTPUT_FILE_MODE,flags:"wx"})}}var DEFAULT_MAX_LINES=2e3,DEFAULT_MAX_BYTES=51200;function countLines(content){if(content.length===0)return 0;let lines=1;for(let i=content.indexOf(`
5
- `);i!==-1;i=content.indexOf(`
6
- `,i+1))lines++;return content.endsWith(`
7
- `)?lines-1:lines}var NON_ASCII=/[\u0080-\uffff]/g,SURROGATE=/[\ud800-\udfff]/,SURROGATE_PAIRS=/[\ud800-\udbff][\udc00-\udfff]/g;function findNonAscii(content,from){return NON_ASCII.lastIndex=from,NON_ASCII.exec(content)?.index??content.length}function copyString(text){return Buffer.from(text,"utf16le").toString("utf16le")}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={}){
8
- let maxLines=options.maxLines??2e3,maxBytes=options.maxBytes??51200,totalBytes=Buffer.byteLength(content,"utf-8"),totalLines=countLines(content);if(totalLines<=maxLines&&totalBytes<=maxBytes)return{content,truncated:!1,truncatedBy:null,totalLines,totalBytes,outputLines:totalLines,outputBytes:totalBytes,lastLinePartial:!1,firstLineExceedsLimit:!1,maxLines,maxBytes};let ascii=totalBytes===content.length,firstNewline=content.indexOf(`
9
- `),firstLineEnd=firstNewline===-1?content.length:firstNewline;if((ascii?firstLineEnd:Buffer.byteLength(content.slice(0,firstLineEnd),"utf-8"))>maxBytes)return{content:"",truncated:!0,truncatedBy:"bytes",totalLines,totalBytes,outputLines:0,outputBytes:0,lastLinePartial:!1,firstLineExceedsLimit:!0,maxLines,maxBytes};let outputLines=0,outputBytesCount=0,outputEnd=0,truncatedBy="lines",nextNonAscii=ascii?content.length:findNonAscii(content,0);for(let start=0;outputLines<totalLines&&outputLines<maxLines;){
10
- let newline=content.indexOf(`
11
- `,start),end=newline===-1?content.length:newline,lineBytes;if(end<=nextNonAscii?lineBytes=end-start:(lineBytes=Buffer.byteLength(content.slice(start,end),"utf-8"),nextNonAscii=findNonAscii(content,end)),outputLines>0&&lineBytes++,outputBytesCount+lineBytes>maxBytes){truncatedBy="bytes";break}outputLines++,outputBytesCount+=lineBytes,outputEnd=end,start=end+1}return outputLines>=maxLines&&outputBytesCount<=maxBytes&&(truncatedBy="lines"),{content:copyString(content.slice(0,outputEnd)),truncated:!0,
12
- truncatedBy,totalLines,totalBytes,outputLines,outputBytes:outputBytesCount,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"),totalLines=countLines(content);if(totalLines<=maxLines&&totalBytes<=maxBytes)return{content,truncated:!1,truncatedBy:null,totalLines,totalBytes,outputLines:totalLines,outputBytes:totalBytes,lastLinePartial:!1,
13
- firstLineExceedsLimit:!1,maxLines,maxBytes};let ascii=totalBytes===content.length,contentEnd=content.endsWith(`
14
- `)?content.length-1:content.length,outputLines=0,outputBytesCount=0,outputStart=contentEnd,partialLine,truncatedBy="lines",end=contentEnd;for(let i=totalLines-1;i>=0&&outputLines<maxLines;i--){let start=i===0?0:content.lastIndexOf(`
15
- `,end-1)+1,lineBytes=(ascii?end-start:Buffer.byteLength(content.slice(start,end),"utf-8"))+(outputLines>0?1:0);if(outputBytesCount+lineBytes>maxBytes){truncatedBy="bytes",outputLines===0&&(partialLine=truncateStringToBytesFromEnd(content.slice(start,end),maxBytes),outputLines=1,outputBytesCount=Buffer.byteLength(partialLine,"utf-8"));break}outputLines++,outputBytesCount+=lineBytes,outputStart=start,end=start-1}return outputLines>=maxLines&&outputBytesCount<=maxBytes&&(truncatedBy="lines"),{content:partialLine??
16
- copyString(content.slice(outputStart,contentEnd)),truncated:!0,truncatedBy,totalLines,totalBytes,outputLines,outputBytes:outputBytesCount,lastLinePartial:partialLine!==void 0,firstLineExceedsLimit:!1,maxLines,maxBytes}}function truncateStringToBytesFromEnd(str2,maxBytes){let buf=Buffer.from(str2,"utf-8");if(buf.length<=maxBytes)return str2;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){
17
- return line.length<=maxChars?{text:line,wasTruncated:!1}:{text:`${line.slice(0,maxChars)}... [truncated]`,wasTruncated:!0}}function truncateMiddle(content,maxBytes){let buf=Buffer.from(content,"utf-8"),totalLines=countLines(content);if(buf.length<=maxBytes)return{content,truncated:!1,removedChars:0,totalBytes:buf.length,totalLines};let isBoundary=index=>index>=buf.length||(buf[index]&192)!==128,headEnd=Math.floor(maxBytes/2);for(;headEnd>0&&!isBoundary(headEnd);)headEnd--;let tailStart=buf.length-
18
- (maxBytes-Math.floor(maxBytes/2));for(;tailStart<buf.length&&!isBoundary(tailStart);)tailStart++;let head=buf.subarray(0,headEnd).toString("utf-8"),tail=buf.subarray(tailStart).toString("utf-8"),removed=buf.subarray(headEnd,tailStart).toString("utf-8"),removedChars=removed.length;return SURROGATE.test(removed)&&(removedChars-=removed.match(SURROGATE_PAIRS)?.length??0),{content:`${head}\u2026${removedChars} chars truncated\u2026${tail}`,truncated:!0,removedChars,totalBytes:buf.length,totalLines}}function createUsageTotals(){return{input:0,output:0,cacheRead:0,cacheWrite:0,cost:0}}function addUsageToTotals(totals,usage){usage.usageIncomplete&&(totals.usageIncomplete=!0),totals.input+=usage.input,totals.output+=usage.output,totals.cacheRead+=usage.cacheRead,totals.cacheWrite+=usage.cacheWrite,totals.cost+=usage.cost.total}function combineUsage(first,second){return{...first.usageIncomplete||second.usageIncomplete?{usageIncomplete:!0}:{},input:first.input+second.input,output:first.output+second.
19
- output,cacheRead:first.cacheRead+second.cacheRead,cacheWrite:first.cacheWrite+second.cacheWrite,...first.cacheWrite1h!==void 0||second.cacheWrite1h!==void 0?{cacheWrite1h:(first.cacheWrite1h??0)+(second.cacheWrite1h??0)}:{},...first.reasoning!==void 0||second.reasoning!==void 0?{reasoning:(first.reasoning??0)+(second.reasoning??0)}:{},totalTokens:first.totalTokens+second.totalTokens,cost:{input:first.cost.input+second.cost.input,output:first.cost.output+second.cost.output,cacheRead:first.cost.cacheRead+
20
- second.cost.cacheRead,cacheWrite:first.cost.cacheWrite+second.cost.cacheWrite,total:first.cost.total+second.cost.total,totalFromProvider:first.cost.totalFromProvider===!0&&second.cost.totalFromProvider===!0}}}function normalizeUsage(usage){let result={input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0},...usage?.usageIncomplete?{usageIncomplete:!0}:{}};for(let key of["input","output","cacheRead","cacheWrite"]){let count=usage?.[key];typeof count==
21
- "number"&&Number.isSafeInteger(count)&&count>=0?result[key]=count:result.usageIncomplete=!0;let cost2=usage?.cost?.[key];typeof cost2=="number"&&Number.isFinite(cost2)&&cost2>=0?result.cost[key]=cost2:result.usageIncomplete=!0}let totalTokens=usage?.totalTokens;(typeof totalTokens!="number"||!Number.isSafeInteger(totalTokens)||totalTokens<0)&&(result.usageIncomplete=!0),result.totalTokens=result.input+result.output+result.cacheRead+result.cacheWrite;let cost=usage?.cost?.total;return typeof cost==
22
- "number"&&Number.isFinite(cost)&&cost>=0?result.cost.total=cost:result.usageIncomplete=!0,result}function getSummaryUsage(usage,ids,kind,owners){if(ids===void 0||Array.isArray(ids)&&ids.length===0)return usage;let remaining=normalizeUsage(usage),ownerIds=Array.isArray(ids)?[...new Set(ids)]:[],covered=ownerIds.length>0,observed=createUsageTotals();for(let id of ownerIds){let owner=typeof id=="string"&&id.length>0?owners.find(entry=>entry.id===id):void 0;if(!owner||owner.kind!==kind){covered=!1;continue}
23
- let value=normalizeUsage(owner.usage);(typeof owner.provider!="string"||owner.provider.length===0||typeof owner.model!="string"||owner.model.length===0||value.usageIncomplete)&&(covered=!1),addUsageToTotals(observed,value)}if(covered&&!usage)return;covered&&!usage?.usageIncomplete&&delete remaining.usageIncomplete;let residual=remaining.cost.total-observed.cost,drift=Number.EPSILON*Math.max(remaining.cost.total,observed.cost)*(ownerIds.length+1);remaining.cost.total=residual>drift?residual:0;for(let key of[
24
- "input","output","cacheRead","cacheWrite"])remaining[key]=Math.max(0,remaining[key]-observed[key]);return remaining.totalTokens=remaining.input+remaining.output+remaining.cacheRead+remaining.cacheWrite,(!covered||remaining.cost.total>0||remaining.totalTokens>0)&&(remaining.usageIncomplete=!0),remaining.usageIncomplete||remaining.cost.total>0||remaining.totalTokens>0?remaining:void 0}function getSessionUsage(entries){let owners=entries.filter(entry=>entry.type==="usage"),seen=new Set,summaries=new Map,
25
- result=[];for(let entry of entries){let usage;if(entry.type==="usage"){if(seen.has(entry.id))continue;seen.add(entry.id),usage=normalizeUsage(entry.usage)}else if(entry.type==="message"&&(entry.message.role==="assistant"||entry.message.role==="toolResult"))usage=entry.message.usage;else if((entry.type==="compaction"||entry.type==="branch_summary")&&(usage=getSummaryUsage(entry.usage,entry.usageEntryIds,entry.type==="compaction"?"compaction":"branchSummary",owners),Array.isArray(entry.usageEntryIds)&&
26
- entry.usageEntryIds.length>0)){let key=JSON.stringify([entry.type,[...new Set(entry.usageEntryIds)].sort()]),previous=summaries.get(key);usage&&(!previous||usage.cost.total>=previous.usage.cost.total)&&summaries.set(key,{entry,usage});continue}usage&&result.push({entry,usage})}return[...result,...summaries.values()]}function getUsageCostBreakdown(entries){let totalsByKey=new Map;for(let{entry,usage}of getSessionUsage(entries)){let key;if(entry.type==="message"&&entry.message.role==="assistant"?key=
27
- `${entry.message.provider}/${entry.message.responseModel??entry.message.model}`:entry.type==="usage"?key=`${entry.provider}/${entry.model}`:key="Tools/summaries",!key||!usage)continue;let totals=totalsByKey.get(key);totals||(totals=createUsageTotals(),totalsByKey.set(key,totals)),addUsageToTotals(totals,usage)}return Array.from(totalsByKey,([key,totals])=>({key,...totals.usageIncomplete?{usageIncomplete:!0}:{},cost:totals.cost,tokens:totals.input+totals.output+totals.cacheRead+totals.cacheWrite})).
28
- filter(entry=>entry.usageIncomplete||entry.cost>0||entry.tokens>0).sort((a,b)=>b.cost-a.cost)}function truncateToVisualLines(text,maxVisualLines,width,paddingX=0,keep="end"){if(!text)return{visualLines:[],skippedCount:0};let allVisualLines=new Text(text,paddingX,0).render(width);if(allVisualLines.length<=maxVisualLines)return{visualLines:allVisualLines,skippedCount:0};let truncatedLines=keep==="start"?allVisualLines.slice(0,maxVisualLines):allVisualLines.slice(-maxVisualLines),skippedCount=allVisualLines.length-maxVisualLines;return{visualLines:truncatedLines,skippedCount}}function truncateStyledLinesToVisualEnd(lines,styleLine,maxVisualLines,width){
29
- if(lines.length===0)return{visualLines:[],skippedCount:0};let contentWidth=Math.max(1,width),visualCount=line=>{let normalized=line.replace(/\t/g," ");return normalized===""||visibleWidth(normalized)<=contentWidth?1:wrapTextWithAnsi(styleLine(normalized),contentWidth).length},start=lines.length,tailVisualLines=0;for(;start>0&&tailVisualLines<maxVisualLines;)start--,tailVisualLines+=visualCount(lines[start]);let headVisualLines=0;for(let i=0;i<start;i++)headVisualLines+=visualCount(lines[i]);let tail=new Text(
30
- lines.slice(start).map(styleLine).join(`
31
- `),0,0).render(width),total=headVisualLines+tail.length;return total<=maxVisualLines?{visualLines:tail,skippedCount:0}:{visualLines:tail.slice(-maxVisualLines),skippedCount:total-maxVisualLines}}var VisualLinePreview=class{options;cachedWidth;cachedLines;constructor(options){this.options=options}render(width){if(this.cachedLines===void 0||this.cachedWidth!==width){let options=this.options,{maxVisualLines,keep,formatHint}=options,preview="lines"in options?truncateStyledLinesToVisualEnd(options.lines,
32
- options.styleLine,maxVisualLines,width):truncateToVisualLines(options.text,maxVisualLines,width,0,keep),lines=preview.visualLines;if(preview.skippedCount>0){let hint=truncateToWidth(formatHint(preview.skippedCount),width,"...");this.cachedLines=keep==="start"?[...lines,hint]:[hint,...lines]}else this.cachedLines=lines;this.cachedWidth=width}return this.cachedLines}invalidate(){this.cachedWidth=void 0,this.cachedLines=void 0,reportRenderChange(this)}};markStableRender(VisualLinePreview);markReportsChanges(
33
- VisualLinePreview);import{pathToFileURL}from"node:url";var ST="(?:\\u0007|\\u001B\\u005C|\\u009C)",OSC_START="\\u001B\\]",CSI_START="(?:(?:\\u001B\\[|\\u009B)[<=>]|[\\u001B\\u009B][[\\]()#;?]*)(?:\\d{1,4}(?:[;:]\\d{0,4})*)?",CSI_FINAL="[\\dA-PR-TZcf-nq-uy=><~]",ansiRegex=new RegExp(`(?:${OSC_START}[\\s\\S]*?${ST})|${CSI_START}${CSI_FINAL}`,"g"),unfinishedAnsiAtEndRegex=new RegExp(`(?:${OSC_START}(?:[^\\u0007\\u009C\\u001B]|\\u001B(?!\\\\))*|${CSI_START})$`),MAX_PENDING_ANSI_LENGTH=256;function splitIncompleteAnsiSuffix(value){if(!value.includes("\x1B")&&
34
- !value.includes("\x9B"))return{complete:value,pending:""};let windowStart=Math.max(0,value.length-MAX_PENDING_ANSI_LENGTH),match=unfinishedAnsiAtEndRegex.exec(value.slice(windowStart));if(!match)return{complete:value,pending:""};let splitAt=windowStart+match.index;return{complete:value.slice(0,splitAt),pending:value.slice(splitAt)}}function stripAnsi(value){if(typeof value!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof value}\``);return!value.includes("\x1B")&&!value.includes(
35
- "\x9B")?value:value.replace(ansiRegex,"")}function shortenPath(path){return typeof path!="string"?"":shortenHomePath(path)}function linkPath(styledText,rawPath,cwd){if(!getCapabilities().hyperlinks)return styledText;let absolutePath=resolvePath(rawPath,cwd);return hyperlink(styledText,pathToFileURL(absolutePath).href)}function str(value){return typeof value=="string"?sanitizeArgument(value):value==null?"":null}var sanitizedArguments=[],SANITIZED_ARGUMENTS_KEPT=4,SANITIZED_ARGUMENT_MIN_LENGTH=1024;function sanitizeArgument(text){if(text.
36
- length<SANITIZED_ARGUMENT_MIN_LENGTH)return sanitizeTerminalText(text);let previous;for(let i=sanitizedArguments.length-1;i>=0;i--){let entry=sanitizedArguments[i];if(startsWithText(text,entry.raw)){previous=entry,sanitizedArguments.splice(i,1);break}}let sanitized=sanitizeTerminalTextFrom(text,previous);return sanitizedArguments.push(sanitized),sanitizedArguments.length>SANITIZED_ARGUMENTS_KEPT&&sanitizedArguments.shift(),sanitized.text}function parseLineNumber(value){return typeof value=="stri\
37
- ng"&&value.trim()!==""&&(value=Number(value)),typeof value=="number"&&Number.isFinite(value)?value:void 0}function formatReadLineRange(offset,limit){if(offset==null&&limit==null)return"";let start=offset==null?1:parseLineNumber(offset);if(start===void 0)return"";if(limit==null)return`:${start}`;let count=parseLineNumber(limit);if(count===void 0)return"";let end=start+count-1;return`:${start}${end?`-${end}`:""}`}function replaceTabs(text){return text.replace(/\t/g," ")}function normalizeDisplayText(text){
38
- return text.replace(/\r/g,"")}function getTextOutput(result,showImages){if(!result)return"";let textBlocks=result.content.filter(c=>c.type==="text"),imageBlocks=result.content.filter(c=>c.type==="image"),output=textBlocks.map(c=>sanitizeBinaryOutput(stripAnsi(c.text||"")).replace(/\r/g,"")).join(`
39
- `),caps=getCapabilities();if(imageBlocks.length>0&&(!caps.images||!showImages)){let imageIndicators=imageBlocks.map(img=>{let mimeType=img.mimeType??"image/unknown",dims=img.data&&img.mimeType?getImageDimensions(img.data,img.mimeType)??void 0:void 0;return imageFallback(mimeType,dims)}).join(`
40
- `);output=output?`${output}
41
- ${imageIndicators}`:imageIndicators}return output}var COLLAPSED_ARGS_CHARS=100;function formatToolCallWithArgs(title,args,theme,expanded){let header=theme.fg("toolTitle",theme.bold(sanitizeTerminalText(title)));if(args==null)return header;let entries=typeof args=="object"&&!Array.isArray(args)?Object.entries(args):[["args",args]];if(entries.length===0)return header;if(expanded){let lines=entries.map(([key,value])=>{let text=typeof value=="string"?value:JSON.stringify(value,null,2)??String(value),
42
- shown=replaceTabs(sanitizeTerminalText(text)).replace(/\r/g,"");return` ${sanitizeTerminalText(key)}: ${shown.split(`
43
- `).join(`
44
- `)}`});return`${header}
45
- ${theme.fg("muted",lines.join(`
46
- `))}`}let pairs=entries.map(([key,value])=>`${key}=${JSON.stringify(value)??String(value)}`).join(" "),preview=pairs.length>COLLAPSED_ARGS_CHARS?`${pairs.slice(0,COLLAPSED_ARGS_CHARS-3)}...`:pairs;return`${header} ${theme.fg("muted",sanitizeTerminalText(preview))}`}function formatToolDuration(ms){let seconds=ms/1e3;if(seconds<60)return`${seconds.toFixed(1)}s`;let totalSeconds=Math.floor(seconds),minutes=Math.floor(totalSeconds/60),remainder=totalSeconds%60;return minutes<60?`${minutes}m ${remainder}\
47
- s`:`${Math.floor(minutes/60)}h ${minutes%60}m ${remainder}s`}function startToolTimer(context){let state=context.state;context.executionStarted&&state.startedAt===void 0&&(state.startedAt=Date.now(),state.endedAt=void 0)}function toolTimerText(context,isPartial){let state=context.state;if(state.startedAt!==void 0&&isPartial&&!state.interval&&(state.interval=setInterval(()=>context.invalidate(),1e3)),(!isPartial||context.isError)&&(state.endedAt??=Date.now(),state.interval&&(clearInterval(state.interval),
48
- state.interval=void 0)),!isPartial&&context.durationMs!==void 0)return`Took ${formatToolDuration(context.durationMs)}`;if(state.startedAt===void 0)return;let endTime=state.endedAt??Date.now();return`${isPartial?"Elapsed":"Took"} ${formatToolDuration(endTime-state.startedAt)}`}function invalidArgText(theme){return theme.fg("error","[invalid arg]")}function renderToolPath(rawPath,theme,cwd,options){if(rawPath===null)return invalidArgText(theme);let value=rawPath||options?.emptyFallback;return value?
49
- linkPath(theme.fg("accent",shortenPath(value)),value,cwd):theme.fg("toolOutput","...")}function toCodemodeIdentifier(name){let identifier="";for(let char of name){let valid=identifier===""?/^[A-Za-z_$]$/.test(char):/^[A-Za-z0-9_$]$/.test(char);identifier+=valid?char:"_"}return identifier===""?"_":identifier}var IDENTIFIER=/^[A-Za-z_$][A-Za-z0-9_$]*$/,INDENT=" ",DEFAULT_INPUT_SCHEMA_MAX_CHARS=16e3,MAX_REF_EXPANSIONS=32,TAG_KEYWORDS=["minimum","exclusiveMinimum","maximum","exclusiveMaximum","multipleOf","minLength","maxLength","pattern","format","minItems","maxItems"],LOWER_BOUNDS=new Set(["minimum","exclusiveMinimum","minLength","minItems"]),UPPER_BOUNDS=new Set(["maximum","exclusiveMaximum","maxLength","maxItems"]),MAX_TAG_CHARS=80,LINE_TERMINATORS=/[\r\n\u2028\u2029]/g;function renderToolSignature(tool,options={}){let input=tool.inputSchema===void 0?"unknown":schemaToType(tool.inputSchema,{maxChars:options.inputMaxChars??DEFAULT_INPUT_SCHEMA_MAX_CHARS});return`${toCodemodeIdentifier(tool.name)}(args: ${input}): Promise<${renderToolOutputType(tool.outputSchema)}>;`}function renderToolSample(tool,options={}){let declaration=`declare const tools: { ${renderToolSignature(tool,options)} };`;return`${tool.description?.trim()??""}
50
-
51
- codemode tool declaration:
52
- \`\`\`ts
53
- ${declaration}
54
- \`\`\``}function renderToolOutputType(schema){return schema===void 0?"unknown":schemaToType(schema)}function propertyKey(name){return IDENTIFIER.test(name)?name:JSON.stringify(name)}function union(types){let unique=[...new Set(types)];return unique.includes("unknown")?"unknown":unique.length===0?"never":unique.join(" | ")}function schemaToType(schema,options={}){let render=tags=>toType(schema,{root:schema,resolving:new Set,expansions:0,tags}),type=render(!0);if(options.maxChars===void 0||type.length<=options.maxChars)return type;let untagged=render(!1);return untagged.length<=options.maxChars?
55
- untagged:"unknown"}function resolveRef(ref,root){if(ref!=="#"&&!ref.startsWith("#/"))return;let current=root;for(let segment of ref.slice(2).split("/").filter(Boolean)){let key=decodeURIComponent(segment).replaceAll("~1","/").replaceAll("~0","~");if(typeof current!="object"||current===null||Array.isArray(current)||!(key in current))return;current=current[key]}return typeof current=="boolean"||typeof current=="object"&&current!==null&&!Array.isArray(current)?current:void 0}function toType(schema,context){
56
- if(schema===!0)return"unknown";if(schema===!1)return"never";if(typeof schema!="object"||schema===null||Array.isArray(schema))return"unknown";if(typeof schema.$ref=="string"){let ref=schema.$ref;if(context.resolving.has(ref)||context.expansions>=MAX_REF_EXPANSIONS)return"unknown";let target=resolveRef(ref,context.root);if(target===void 0)return"unknown";context.expansions++,context.resolving.add(ref);try{return toType(target,context)}finally{context.resolving.delete(ref)}}if("const"in schema)return JSON.
57
- stringify(schema.const)??"unknown";if(Array.isArray(schema.enum))return union(schema.enum.map(value=>JSON.stringify(value)??"unknown"));let variants=Array.isArray(schema.anyOf)?schema.anyOf:Array.isArray(schema.oneOf)?schema.oneOf:void 0;if(variants)return union(variants.map(variant=>toType(variant,context)));if(Array.isArray(schema.allOf)){let parts=schema.allOf.map(part=>toType(part,context)).filter(part=>part!=="unknown");return parts.length===0?"unknown":parts.map(part=>part.includes(" | ")?
58
- `(${part})`:part).join(" & ")}let type=schema.type;if(Array.isArray(type))return union(type.map(entry=>toType({...schema,type:entry},context)));switch(type){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":return arrayType(schema,context);case"object":return objectType(schema,context);case void 0:return"properties"in schema||"additionalProperties"in schema||"required"in schema?objectType(schema,context):"items"in
59
- schema||"prefixItems"in schema?arrayType(schema,context):"unknown";default:return"unknown"}}function arrayType(schema,context){if(schema.items!==void 0&&!Array.isArray(schema.items))return`Array<${toType(schema.items,context)}>`;let tuple=Array.isArray(schema.prefixItems)?schema.prefixItems:Array.isArray(schema.items)?schema.items:[];return tuple.length>0?`[${tuple.map(item=>toType(item,context)).join(", ")}]`:"unknown[]"}function descriptionOf(property){let description=property?.description;return typeof description==
60
- "string"?description.trim():""}function constraintTags(schema){if(typeof schema!="object"||schema===null||Array.isArray(schema))return"";let property=schema,variants=Array.isArray(property.anyOf)?property.anyOf:property.oneOf,nonNull=Array.isArray(variants)?variants.filter(variant=>variant?.type!=="null"):[],branch=nonNull.length===1?nonNull[0]:void 0,schemas=(typeof branch=="object"&&branch!==null&&!Array.isArray(branch)?[property,branch]:[property]).map(schema2=>({...schema2,...schema2.exclusiveMinimum===
61
- !0?{minimum:void 0,exclusiveMinimum:schema2.minimum}:{},...schema2.exclusiveMaximum===!0?{maximum:void 0,exclusiveMaximum:schema2.maximum}:{}})),tags=[],isInteger=type=>type==="integer"||Array.isArray(type)&&type.includes("integer");schemas.some(schema2=>isInteger(schema2.type))&&tags.push("@integer");for(let keyword of TAG_KEYWORDS){let values=schemas.map(schema2=>schema2[keyword]);if(LOWER_BOUNDS.has(keyword)||UPPER_BOUNDS.has(keyword)){let numbers=values.filter(value=>typeof value=="number");
62
- if(numbers.length===0)continue;tags.push(`@${keyword} ${LOWER_BOUNDS.has(keyword)?Math.max(...numbers):Math.min(...numbers)}`);continue}for(let value of new Set(values))(typeof value=="number"||typeof value=="string")&&tags.push(`@${keyword} ${value}`)}return schemas.some(schema2=>schema2.uniqueItems===!0)&&tags.push("@uniqueItems"),property.default!==void 0&&property.default!==null&&tags.push(`@default ${JSON.stringify(property.default)}`),property.deprecated===!0&&tags.push("@deprecated"),tags.
63
- filter(tag=>tag.length<=MAX_TAG_CHARS).map(tag=>tag.replace(LINE_TERMINATORS,char=>`\\u${char.charCodeAt(0).toString(16).padStart(4,"0")}`)).join(" ")}function objectType(schema,context){let properties=typeof schema.properties=="object"&&schema.properties!==null&&!Array.isArray(schema.properties)?schema.properties:{},required=new Set(Array.isArray(schema.required)?schema.required:[]),names=Object.keys(properties).sort(),members=names.map(name=>{let optional=required.has(name)?"":"?";return`${propertyKey(
64
- name)}${optional}: ${toType(properties[name],context)};`}),additional=schema.additionalProperties;if(additional!==void 0&&additional!==!1){let type=additional===!0?"unknown":toType(additional,context);members.push(`[key: string]: ${type};`)}else additional===void 0&&names.length===0&&members.push("[key: string]: unknown;");if(members.length===0)return"{}";let comments=names.map(name=>{let lines2=descriptionOf(properties[name]).split(LINE_TERMINATORS).map(line=>line.trim()).filter(Boolean),tags=context.
65
- tags?constraintTags(properties[name]):"";return tags?[...lines2,tags]:lines2});if(!comments.some(comment=>comment.length>0))return`{ ${members.join(" ")} }`;let lines=["{"];comments.forEach((comment,index)=>{for(let line of comment)lines.push(`${INDENT}// ${line}`);lines.push(`${INDENT}${members[index].replaceAll(`
66
- `,`
67
- ${INDENT}`)}`)});for(let member of members.slice(names.length))lines.push(`${INDENT}${member}`);return lines.push("}"),lines.join(`
68
- `)}var CODEMODE_OPTIONS_PREFIX="// @options:",SUPPORTED_FIELDS=["max_output_tokens","timeout_ms"],SUPPORTED_FIELDS_TEXT="`max_output_tokens` and `timeout_ms`";var CODEMODE_SOURCE_GRAMMAR=String.raw`
69
- start: options_source | plain_source
70
- options_source: OPTIONS_LINE NEWLINE SOURCE
71
- plain_source: SOURCE
72
-
73
- OPTIONS_LINE: /[ \t]*\/\/ @options:[^\r\n]*/
74
- NEWLINE: /\r?\n/
75
- SOURCE: /[\s\S]+/
76
- `,CodemodeSourceError=class extends Error{constructor(message){super(message),this.name="CodemodeSourceError"}};function isSafeInteger(value){return typeof value=="number"&&Number.isSafeInteger(value)&&value>=0}function parseOptions(directive){if(directive==="")throw new CodemodeSourceError(`@options must be a JSON object with supported fields ${SUPPORTED_FIELDS_TEXT}`);let value;try{value=JSON.parse(directive)}catch(error){throw new CodemodeSourceError(`@options must be valid JSON with supporte\
77
- d fields ${SUPPORTED_FIELDS_TEXT}: ${error instanceof Error?error.message:String(error)}`)}if(typeof value!="object"||value===null||Array.isArray(value))throw new CodemodeSourceError(`@options must be a JSON object with supported fields ${SUPPORTED_FIELDS_TEXT}`);let fields=value;for(let key of Object.keys(fields))if(!SUPPORTED_FIELDS.includes(key))throw new CodemodeSourceError(`@options only supports ${SUPPORTED_FIELDS_TEXT}; got \`${key}\``);let options={},{max_output_tokens,timeout_ms}=fields;
78
- if(max_output_tokens!==void 0){if(!isSafeInteger(max_output_tokens))throw new CodemodeSourceError("@options field `max_output_tokens` must be a non-negative safe integer");options.maxOutputTokens=max_output_tokens}if(timeout_ms!==void 0){if(!isSafeInteger(timeout_ms)||timeout_ms===0||timeout_ms>2147483647)throw new CodemodeSourceError("@options field `timeout_ms` must be a positive integer up to 2147483647");options.timeoutMs=timeout_ms}return options}function parseCodemodeSource(input){if(input.
79
- trim()==="")throw new CodemodeSourceError('Expected JavaScript source text (non-empty). Provide JS only, optionally with a first line `// @options: {"max_output_tokens": 1000}`.');let lines=input.split(`
80
- `),misplaced=lines.findIndex((line,index)=>index>0&&line.trimStart().startsWith(CODEMODE_OPTIONS_PREFIX));if(misplaced!==-1)throw new CodemodeSourceError(`The ${CODEMODE_OPTIONS_PREFIX} line must be the first line of the input; found one on line ${misplaced+1}`);let newline=input.indexOf(`
81
- `),trimmed=lines[0].replace(/\r$/,"").trimStart();if(!trimmed.startsWith(CODEMODE_OPTIONS_PREFIX))return{code:input,options:{}};let code=newline===-1?"":input.slice(newline);if(code.trim()==="")throw new CodemodeSourceError("The @options line must be followed by JavaScript source on subsequent lines");return{code,options:parseOptions(trimmed.slice(CODEMODE_OPTIONS_PREFIX.length).trim())}}var TOOL_SEARCH_TOOL_NAME="tool_search",DEFAULT_TOOL_SEARCH_LIMIT=8,wordSegmenter=new Intl.Segmenter(void 0,{granularity:"word"}),STOP_WORDS=new Set(["a","an","and","are","as","at","be","by","for","from","in","is","it","of","on","or","that","the","this","to","with"]);function stem(term){return term.length>4&&term.endsWith("ies")?`${term.slice(0,-3)}y`:term.length>4&&/(ches|shes|sses|xes|zes)$/.test(term)?term.slice(0,-2):term.length>3&&term.endsWith("s")&&!term.endsWith("ss")?term.slice(0,-1):term}
82
- function tokenize(text){let normalized=text.normalize("NFC").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").toLowerCase().replace(/[^\p{L}\p{M}\p{N}]+/gu," ");return(/^[a-z0-9 ]*$/.test(normalized)?normalized.split(" "):Array.from(wordSegmenter.segment(normalized),segment=>segment.isWordLike?segment.segment:"")).filter(word=>word.length>0&&!STOP_WORDS.has(word)).map(word=>/^[a-z0-9]+$/.test(word)?stem(word):word)}function isObject(value){return typeof value=="obje\
83
- ct"&&value!==null&&!Array.isArray(value)}function schemaText(schema,parts){if(isObject(schema)){if(typeof schema.description=="string"&&parts.push(schema.description),isObject(schema.properties))for(let[name,property]of Object.entries(schema.properties))parts.push(name),schemaText(property,parts);schemaText(schema.items,parts);for(let key of["anyOf","oneOf","allOf"]){let variants=schema[key];if(Array.isArray(variants))for(let variant of variants)schemaText(variant,parts)}}}function createToolSearchDocument(tool,namespace){
84
- let parts=[tool.description];schemaText(tool.parameters,parts);let namespaceText=namespace?[namespace.name,namespace.description??"",namespace.instructions??""].join(" "):"";return{name:tool.name,text:parts.filter(part=>part.trim()).join(" "),namespaceText}}function normalizeName(name){return name.trim().toLowerCase().replace(/[^a-z0-9_$]/g,"_")}function isExactNameQuery(query,name){let normalized=normalizeName(name);return normalized===query||normalized.endsWith(`__${query}`)}function indexDocument(document){
85
- let textCounts=new Map;for(let term of tokenize(document.text))textCounts.set(term,(textCounts.get(term)??0)+1);let segments=document.name.split("__");return{name:document.name,nameTerms:new Set(tokenize(document.name)),localNameTerms:[...new Set(tokenize(segments[segments.length-1]))],textCounts,textLength:[...textCounts.values()].reduce((sum,count)=>sum+count,0),namespaceTerms:new Set(tokenize(document.namespaceText??""))}}var NAME_WEIGHT=3,NAMESPACE_WEIGHT=.5,Bm25Ranker=class{k1;b;constructor(options={}){
86
- this.k1=options.k1??1.2,this.b=options.b??.75}rank(query,documents,limit){let queryTerms=new Set(tokenize(query));if(queryTerms.size===0||documents.length===0||limit<=0)return[];let indexed=documents.map(indexDocument),averageLength=indexed.reduce((sum,document)=>sum+document.textLength,0)/indexed.length||1,idf=new Map([...queryTerms].map(term=>{let frequency=indexed.filter(document=>document.nameTerms.has(term)||document.textCounts.has(term)||document.namespaceTerms.has(term)).length;return[term,
87
- Math.log(1+(indexed.length-frequency+.5)/(frequency+.5))]})),fullNameBonus=[...idf.values()].reduce((sum,value)=>sum+value,0),exactQuery=normalizeName(query),matches=[];for(let document of indexed){let norm=this.k1*(1-this.b+this.b*document.textLength/averageLength),score=0,covered=0;for(let term of queryTerms){let count=document.textCounts.get(term)??0,weight=(document.nameTerms.has(term)?NAME_WEIGHT:0)+(document.namespaceTerms.has(term)?NAMESPACE_WEIGHT:0)+count*(this.k1+1)/(count+norm);weight>
88
- 0&&covered++,score+=(idf.get(term)??0)*weight}if(score===0)continue;let local=document.localNameTerms;local.length>0&&local.every(term=>queryTerms.has(term))&&(score+=fullNameBonus),matches.push({name:document.name,score,covered,exact:isExactNameQuery(exactQuery,document.name)})}return matches.sort((a,b)=>Number(b.exact)-Number(a.exact)||b.covered-a.covered||b.score-a.score).slice(0,limit).map(({name,score})=>({name,score}))}},toolSearchSchema=typebox_exports.Object({query:typebox_exports.String(
89
- {description:"Search query for deferred tools."}),limit:typebox_exports.Optional(typebox_exports.Number({description:`Maximum number of tools to return. Defaults to ${DEFAULT_TOOL_SEARCH_LIMIT}.`}))});function isSearchable(exposure){return exposure==="codemode"||exposure==="deferred"}function searchAndLoad(tools,query,limit){let active=tools.getActiveTools(),candidates=tools.getAllTools().filter(tool=>isSearchable(tool.exposure)&&!active.includes(tool.name)),documents=candidates.map(tool=>createToolSearchDocument(
90
- tool,tool.namespace)),matches=new Bm25Ranker().rank(query,documents,limit);return matches.length>0&&tools.setActiveTools([...active,...matches.map(match=>match.name)]),matches.map(match=>({name:match.name,description:candidates.find(tool=>tool.name===match.name)?.description??""}))}var TOOL_SEARCH_DESCRIPTION=`# Tool discovery
91
-
92
- Searches over deferred tool metadata with BM25 and exposes matching tools for the next model call.
93
-
94
- Some of the tools, such as tools of MCP servers, may not have been provided to you upfront, and you should use this tool (\`${TOOL_SEARCH_TOOL_NAME}\`) to search for the required tools. For MCP tool discovery, always use \`${TOOL_SEARCH_TOOL_NAME}\`.`;function createToolSearchToolDefinition(options={}){return{name:TOOL_SEARCH_TOOL_NAME,label:TOOL_SEARCH_TOOL_NAME,description:TOOL_SEARCH_DESCRIPTION,promptSnippet:"Search for tools that are not loaded yet and load the matches",parameters:toolSearchSchema,
95
- exposure:"model-only",reachesTools:()=>"all",async execute(_toolCallId,{query,limit}){if(query.trim()==="")throw new Error("query must not be empty");let max=limit??DEFAULT_TOOL_SEARCH_LIMIT;if(!Number.isInteger(max)||max<=0)throw new Error("limit must be a positive integer");let tools=options.tools?searchAndLoad(options.tools,query,max):[];return{content:[{type:"text",text:tools.length===0?"No matching tools found.":`Loaded ${tools.length} tool${tools.length===1?"":"s"}. They are available from\
96
- your next call:
97
- ${tools.map(tool=>`- ${tool.name}: ${tool.description.trim().split(/\r?\n/)[0]}`).join(`
98
- `)}`}],details:{loaded:tools.map(tool=>tool.name)}}}}}import{join as join2}from"node:path";var SETTINGS_DEFAULTS={transport:"auto",noProgressTimeoutMs:12e4,sessionShareDestination:"auto",steeringMode:"one-at-a-time",followUpMode:"one-at-a-time",compaction:{enabled:!0,reserveTokens:16384,keepRecentTokens:2e4,thresholdPercent:90},branchSummary:{reserveTokens:16384,skipPrompt:!1},retry:{enabled:!0,maxRetries:3,baseDelayMs:2e3,maxAgentDelayMs:DEFAULT_MAX_AGENT_RETRY_DELAY_MS,provider:{maxRetryDelayMs:6e4}},hideThinkingBlock:!1,showCacheMissNotices:!1,quietStartup:!1,defaultProjectTrust:"a\
99
- sk",collapseChangelog:!1,enableInstallTelemetry:!0,enableAnalytics:!1,enableSkillCommands:!0,terminal:{showImages:!0,imageWidthCells:60,clearOnShrink:!1,showTerminalProgress:!1},images:{autoResize:!0,blockImages:!1},doubleEscapeAction:"tree",treeFilterMode:"default",editorPaddingX:0,outputPad:1,autocompleteMaxVisible:5,markdown:{codeBlockIndent:" ",mermaid:"streaming"},warnings:{anthropicExtraUsage:!0},codemode:{mode:"on",inlineBudget:3e3,flowImplementer:"only"},cacheWarming:"streaming",tuiMode:"\
100
- fullscreen",fullscreenExitOutput:"transcript",fullscreenScrollbar:"auto",fullscreenCopyOnSelect:!0,fullscreenWheelScrollLines:"auto"};function wrapToolDefinition(definition,ctxFactory){return{name:definition.name,label:definition.label,description:definition.description,parameters:definition.parameters,outputSchema:definition.outputSchema,constrainedSampling:definition.constrainedSampling,prepareArguments:definition.prepareArguments,executionMode:definition.executionMode,execute:(toolCallId,params,signal,onUpdate,ctx)=>definition.execute(toolCallId,params,signal,onUpdate,ctx??ctxFactory?.(toolCallId,signal))}}function createToolDefinitionFromAgentTool(tool){return{name:tool.name,label:tool.label,description:tool.description,parameters:tool.parameters,outputSchema:tool.outputSchema,constrainedSampling:tool.constrainedSampling,prepareArguments:tool.prepareArguments,executionMode:tool.executionMode,execute:async(toolCallId,params,signal,onUpdate)=>tool.execute(toolCallId,params,signal,onUpdate)}}var loadCodemodeExecutor=()=>import("./execute-LMBACTKA.js");var CODE_PREVIEW_LINES=10,CALL_PREVIEW_COUNT=8,OUTPUT_PREVIEW_LINES=5,COLLAPSED_ARGS_CHARS2=80,SCRIPT_HEADER=/^Script (completed|failed)\nWall time [\d.]+ seconds\nOutput:\n$/;function expandHint(theme,hidden,noun){return`${theme.fg("muted",`... (${hidden} more ${noun},`)} ${keyHint("app.tools.expand","to expand")}${theme.fg("muted",")")}`}function formatDuration(ms){return ms===void 0?"":ms<1e3?`${Math.round(ms)}ms`:`${(ms/1e3).toFixed(1)}s`}function formatCost(cost){return`$${cost>=.01?cost.toFixed(
101
- 2):cost.toPrecision(2)}`}function statusIcon(call,theme){switch(call.status){case"running":return theme.fg("warning","\u2026");case"ok":return theme.fg("success","\u2713");case"error":return theme.fg("error","\u2717");case"cancelled":return theme.fg("muted","\u2298")}}function formatCall(call,theme,expanded){let callArgs=sanitizeTerminalText(call.args),args=!expanded&&callArgs.length>COLLAPSED_ARGS_CHARS2?`${callArgs.slice(0,COLLAPSED_ARGS_CHARS2-3)}...`:callArgs,duration=formatDuration(call.durationMs),
102
- line=`${statusIcon(call,theme)} ${theme.fg("toolTitle",sanitizeTerminalText(call.name))}`;return args&&(line+=` ${theme.fg("muted",args)}`),duration&&(line+=` ${theme.fg("dim",duration)}`),call.cost&&(line+=` ${theme.fg("dim",formatCost(call.cost))}`),expanded&&call.error&&(line+=`
103
- ${theme.fg("error",sanitizeTerminalText(call.error).split(`
104
- `).join(`
105
- `))}`),line}var codemodeRenderers={renderCall(args,theme,context){startToolTimer(context);let code=str(args?.code),title=theme.fg("toolTitle",theme.bold("codemode")),component=context.lastComponent??new Container;if(component.clear(),code===null)return component.addChild(new Text(`${title} ${theme.fg("error","[invalid arg]")}`,0,0)),component;if(component.addChild(new Text(title,0,0)),code){let state=context.state;state.scriptHighlighter??=new CodeHighlighter;let highlighted=state.scriptHighlighter.
106
- highlight(replaceTabs(code.replace(/\r/g,"").trimEnd()),"javascript").join(`
107
- `);component.addChild(context.expanded?new Text(highlighted,0,0):new VisualLinePreview({text:highlighted,maxVisualLines:CODE_PREVIEW_LINES,keep:"start",formatHint:hidden=>expandHint(theme,hidden,"lines")}))}return component},renderResult(result,options,theme,context){let timerText=toolTimerText(context,options.isPartial),component=context.lastComponent??new Container;component.clear();let calls=result.details?.calls??[];if(calls.length>0){let shown=options.expanded?calls:calls.slice(-CALL_PREVIEW_COUNT),
108
- lines=shown.map(call=>formatCall(call,theme,options.expanded));shown.length<calls.length&&lines.unshift(`${theme.fg("muted",`... (${calls.length-shown.length} earlier calls,`)} ${keyHint("app.tools.expand","to expand")}${theme.fg("muted",")")}`);let priced=calls.filter(call=>call.cost);if(priced.length>1){let total=priced.reduce((sum,call)=>sum+(call.cost??0),0);lines.push(theme.fg("muted",`Model calls: ${formatCost(total)}`))}component.addChild(new Spacer(1)),component.addChild(new Text(lines.join(
109
- `
110
- `),0,0))}let[first,...rest]=result.content,hasHeader=first?.type==="text"&&SCRIPT_HEADER.test(first.text),output=options.isPartial?"":getTextOutput({...result,content:hasHeader?rest:result.content},context.showImages).trim();if(output){let color=context.isError?"error":"toolOutput",styled=replaceTabs(output).split(`
111
- `).map(line=>theme.fg(color,line)).join(`
112
- `);if(component.addChild(new Spacer(1)),options.expanded)component.addChild(new Text(styled,0,0));else{component.addChild(new VisualLinePreview({text:styled,maxVisualLines:OUTPUT_PREVIEW_LINES,keep:"start",formatHint:hidden=>expandHint(theme,hidden,"lines")}));let fullOutputPath=result.details?.fullOutputPath;fullOutputPath&&component.addChild(new Text(theme.fg("muted",`Full output: ${fullOutputPath}`),0,0))}}return timerText&&(component.addChild(new Spacer(1)),component.addChild(new Text(theme.
113
- fg("muted",timerText),0,0))),component}};var CODEMODE_TOOL_NAME="codemode",CODEMODE_STORE_ENTRY_TYPE="codemode-store",TEXT_OUTPUT_SCHEMA={type:"string"},codemodeSchema=typebox_exports.Object({code:typebox_exports.String({description:"Raw JavaScript source."})}),codemodeToolSystemPromptContribution={snippet:"Run JavaScript that calls other tools",guidelines:["Use codemode to batch independent tool calls (Promise.allSettled), chain them, or filter large output, instead of many separate calls."]},CODEMODE_DOCS_PATH=join2(getDocsPath(),"co\
114
- demode.md"),DESCRIPTION_INTRO='Run JavaScript that calls other tools. The input is raw JavaScript (not JSON, no code fence), run as an async function body in a QuickJS sandbox: top-level `await` and `return` work. No Node, file system, network, or timers.\n- `await tools.<name>({ ...args })` resolves to a string, or an object if the tool\'s declaration says so, and rejects with an Error on failure. A tool whose declaration returns an object resolves on failure too when it returned that object; che\
115
- ck its fields. Calls still running when the script ends are cancelled.\n- Optional first line: `// @options: {"max_output_tokens": 10000, "timeout_ms": 60000}`';function describeGlobals(models){let lines=["Globals:","- `text(value)`, `image(dataUrlOrImageBlock)`, `console.log(...)`, and top-level `return` add output; `exit()` ends the script. With several text items, each starts with a `==> text N/M <==` line, and `console` lines follow the other output in one `<console_output>` block. `image()`\
116
- also saves the image to a temp file and the result names its path.","- `store(key, value)` and `load(key)` keep JSON values across codemode calls.","- `ALL_TOOLS`, `await searchTools(query, { limit?, namespace? })`, `await describeTool(name)`, `await describeNamespace(name)`: find unlisted tools, such as MCP tools."];return models&&lines.push(`- \`models\`: classifiers and image generation. Read ${CODEMODE_DOCS_PATH} first.`),lines.join(`
117
- `)}var DEFAULT_CODEMODE_INLINE_BUDGET=SETTINGS_DEFAULTS.codemode.inlineBudget,CHARS_PER_TOKEN=4;function toCodemodeDeclaration(tool,guidelines=[]){let bullets=guidelines.flatMap(guideline=>guideline.trim()?[`- ${guideline.trim()}`]:[]);return{name:tool.name,description:bullets.length>0?`${tool.description.trim()}
118
-
119
- ${bullets.join(`
120
- `)}`:tool.description,inputSchema:tool.parameters,outputSchema:tool.outputSchema??TEXT_OUTPUT_SCHEMA}}function getCodemodeCallableTools(tools){return tools.filter(tool=>tool.name!==CODEMODE_TOOL_NAME)}function renderToolSection(declaration){let id=toCodemodeIdentifier(declaration.name);return`${id===declaration.name?`### \`${id}\``:`### \`${id}\` (\`${declaration.name}\`)`}
121
- ${renderToolSample(declaration).trim()}`}function selectCatalog(groups,budget){if(budget===void 0)return new Set(groups.flatMap(group=>group.entries.map(entry=>entry.name)));let queues=groups.map(group=>[...group.entries].sort((a,b)=>a.cost-b.cost)),shown=new Set,remaining=budget,active=queues.filter(queue=>queue.length>0);for(;active.length>0;)active=active.filter(queue=>{let next=queue[0];return next.cost>remaining?!1:(remaining-=next.cost,shown.add(next.name),queue.shift(),queue.length>0)});return shown}
122
- function createCodemodeDescription(tools,options={}){let declarations=getCodemodeCallableTools(tools).filter(tool=>!options.deferred?.has(tool.name)).map(tool=>toCodemodeDeclaration(tool,options.guidelines?.get(tool.name))),groups=new Map([["",{namespace:void 0,entries:[]}]]);for(let declaration of declarations){let namespace=options.namespaces?.get(declaration.name),key=namespace?`ns:${namespace.name}`:"",group=groups.get(key)??{namespace,entries:[]};groups.set(key,group);let section=renderToolSection(
123
- declaration);group.entries.push({name:declaration.name,section,cost:Math.ceil(section.length/CHARS_PER_TOKEN)})}let ordered=[...groups.values()].sort((a,b)=>a.namespace===void 0?-1:b.namespace===void 0?1:a.namespace.name.localeCompare(b.namespace.name)),shown=selectCatalog(ordered,options.inlineBudget),sections=[DESCRIPTION_INTRO,describeGlobals(options.models===!0)];if(declarations.length===0)return sections.join(`
124
-
125
- `);let toolSections=["Nested tools:"];for(let{namespace,entries}of ordered){let visible=entries.filter(entry=>shown.has(entry.name));if(namespace){let listing=visible.length===entries.length?"":visible.length===0?" (tools not listed)":" (some tools not listed)",description=namespace.description?.trim();toolSections.push(`## ${namespace.name}${listing}${description?`
126
- ${description}`:""}`)}for(let entry of visible)toolSections.push(entry.section)}return sections.push(toolSections.join(`
127
-
128
- `)),sections.join(`
129
-
130
- `)}function describeFields(schema,depth){if(typeof schema!="object"||schema===null)return;let{type,properties,required}=schema;if(type!=="object"||typeof properties!="object"||properties===null)return;let requiredNames=new Set(Array.isArray(required)?required:[]);return`{ ${Object.entries(properties).map(([name,field])=>{let constValue=field?.const,nested=constValue!==void 0?JSON.stringify(constValue):depth>0?describeFields(field,depth-1):void 0;return`${name}${requiredNames.has(name)?"":"?"}${nested?
131
- `: ${nested}`:""}`}).join(", ")} }`}function describeOutput(name,schema){let type=renderToolOutputType(schema);if(type==="string")return"a string";let fields=describeFields(schema,1)??describeUnionFields(schema);return fields?`\`${fields}\``:type.includes(`
132
- `)?`a value; \`await describeTool(${JSON.stringify(name)})\` shows its type`:`\`${type}\``}function describeUnionFields(schema){if(typeof schema!="object"||schema===null)return;let{anyOf,oneOf}=schema,variants=anyOf??oneOf;if(!Array.isArray(variants)||variants.length===0)return;let described=variants.map(variant=>describeFields(variant,0));return described.every(fields=>fields!==void 0)?described.join(" | "):void 0}function describeScriptCall(tool){return`${tool.description.trim()}
133
-
134
- Codemode: \`tools.${toCodemodeIdentifier(tool.name)}(args)\` resolves to ${describeOutput(tool.name,toCodemodeDeclaration(tool).outputSchema)}.`}function prepareCodemodeLoadout(loadout,options){let mode=options.getMode?.()??SETTINGS_DEFAULTS.codemode.mode,isDirect=tool=>loadout.getExposure(tool.name)==="direct",callable=getCodemodeCallableTools(loadout.callable),callableNames=new Set(callable.map(tool=>tool.name)),descriptions={};if(mode==="on")for(let tool of loadout.declared)callableNames.has(
135
- tool.name)&&(descriptions[tool.name]=describeScriptCall(tool));let listed=mode==="only"?callable:callable.filter(tool=>!isDirect(tool)),namespaces=new Map(listed.flatMap(tool=>{let namespace=loadout.getNamespace(tool.name);return namespace?[[tool.name,namespace]]:[]})),guidelines=new Map(listed.map(tool=>[tool.name,loadout.getPromptGuidelines(tool.name)]));descriptions[CODEMODE_TOOL_NAME]=createCodemodeDescription(listed,{models:options.models===!0,namespaces,guidelines,deferred:new Set(listed.filter(
136
- tool=>loadout.getExposure(tool.name)==="deferred").map(tool=>tool.name)),inlineBudget:options.getInlineBudget?.()??DEFAULT_CODEMODE_INLINE_BUDGET});let declaredNames=new Set(loadout.declared.map(tool=>tool.name));return{descriptions,hiddenDeclarations:mode==="only"?callable.filter(tool=>isDirect(tool)&&declaredNames.has(tool.name)).map(tool=>tool.name):[]}}var DISCOVERY_GLOBALS=/\b(searchTools|describeNamespace|describeTool|ALL_TOOLS)\b/;function getScriptReach(code){return typeof code!="string"?
137
- []:DISCOVERY_GLOBALS.test(code)?"all":code.match(/\w+/g)??[]}function createCodemodeToolDefinition(options={}){return{name:CODEMODE_TOOL_NAME,label:CODEMODE_TOOL_NAME,description:createCodemodeDescription([],{models:options.models===!0}),promptSnippet:codemodeToolSystemPromptContribution.snippet,promptGuidelines:[...codemodeToolSystemPromptContribution.guidelines],parameters:codemodeSchema,exposure:"model-only",prepareLoadout:loadout=>prepareCodemodeLoadout(loadout,options),reachesTools:input=>getScriptReach(
138
- input.code),constrainedSampling:{type:"grammar",variants:{openai_lark:CODEMODE_SOURCE_GRAMMAR}},execute:async(toolCallId,params,signal,onUpdate,ctx)=>(await loadCodemodeExecutor()).executeCodemode(toolCallId,params,signal,onUpdate,ctx,options),...codemodeRenderers}}export{SETTINGS_DEFAULTS,splitIncompleteAnsiSuffix,stripAnsi,writeOutputFile,createOutputFileStream,DEFAULT_MAX_LINES,DEFAULT_MAX_BYTES,formatSize,truncateHead,truncateTail,truncateLine,truncateMiddle,createUsageTotals,addUsageToTotals,combineUsage,getSummaryUsage,getSessionUsage,getUsageCostBreakdown,wrapToolDefinition,createToolDefinitionFromAgentTool,truncateToVisualLines,VisualLinePreview,shortenPath,str,formatReadLineRange,replaceTabs,normalizeDisplayText,getTextOutput,formatToolCallWithArgs,
139
- startToolTimer,toolTimerText,invalidArgText,renderToolPath,toCodemodeIdentifier,renderToolSample,parseCodemodeSource,TOOL_SEARCH_TOOL_NAME,DEFAULT_TOOL_SEARCH_LIMIT,createToolSearchDocument,Bm25Ranker,createToolSearchToolDefinition,CODEMODE_TOOL_NAME,CODEMODE_STORE_ENTRY_TYPE,CODEMODE_DOCS_PATH,toCodemodeDeclaration,getCodemodeCallableTools,createCodemodeToolDefinition};
@@ -1,23 +0,0 @@
1
- import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{getBinDir}from"./chunk-KM4GQ2BU.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){
3
- 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&&
4
- result.stdout){let firstMatch=result.stdout.trim().split(/\r?\n/)[0];if(firstMatch)return firstMatch}}catch{}return 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.
5
- env["ProgramFiles(x86)"];programFilesX86&&paths.push(`${programFilesX86}\\Git\\bin\\bash.exe`);for(let path of paths)if(shellPathExists(path))return getBashShellConfig(path);let bashOnPath2=findExecutableOnPath("bash.exe");if(bashOnPath2)return getBashShellConfig(bashOnPath2);throw new Error(`No bash shell found. Options:
6
- 1. Install Git for Windows: https://git-scm.com/download/win
7
- 2. Add your bash to PATH (Cygwin, MSYS2, etc.)
8
- 3. Set shellPath in settings.json
9
-
10
- Searched Git Bash in:
11
- ${paths.map(p=>` ${p}`).join(`
12
- `)}`)}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&&
13
- 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 PAT\
14
- H.");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\x7F-\x9F\uFFF9-\uFFFB]/g,"")}
15
- var trackedDetachedChildren=new Map,TERMINATION_GRACE_MS=1500,TERMINATION_CONFIRM_MS=500,TERMINATION_POLL_MS=20,custodyMonitor;function releaseChild(record){record.released=!0,trackedDetachedChildren.get(record.pid)===record&&trackedDetachedChildren.delete(record.pid),trackedDetachedChildren.size===0&&custodyMonitor&&(clearInterval(custodyMonitor),custodyMonitor=void 0)}function validatePid(pid){if(!Number.isSafeInteger(pid)||pid<=1||pid===process.pid)throw new RangeError("Expected an owned chil\
16
- d pid greater than 1")}function isProcessAlive(pid){try{return process.kill(pid,0),!0}catch(error){return error.code!=="ESRCH"}}function processTreeTarget(record){let{pid,child}=record;if(record.released||trackedDetachedChildren.get(pid)!==record)return;let leaderRunning=child&&child.exitCode===null&&child.signalCode===null;if(process.platform!=="win32"&&isProcessAlive(-pid))return-pid;if((leaderRunning||process.platform==="win32"&&!child)&&isProcessAlive(pid))return pid;releaseChild(record)}function signalProcess(target,signal,child){
17
- if(process.platform==="darwin"&&target<0&&signal==="SIGKILL")try{process.kill(target,"SIGSTOP")}catch{}try{target>0&&child?child.kill(signal):process.kill(target,signal)}catch{}}function trackDetachedChildPid(pid,child){if(validatePid(pid),child&&child.pid!==pid)throw new RangeError("ChildProcess pid does not match");let record={pid,child};trackedDetachedChildren.set(pid,record),child?.once("exit",()=>processTreeTarget(record)),custodyMonitor??=setInterval(()=>{for(let owned of trackedDetachedChildren.
18
- values())processTreeTarget(owned)},250).unref()}function untrackDetachedChildPid(pid,child){validatePid(pid);let record=trackedDetachedChildren.get(pid);child&&record?.child!==child||record&&!record.terminationRequested&&releaseChild(record)}function killProcessTreeAsync(pid,graceMs=TERMINATION_GRACE_MS,child){if(validatePid(pid),!Number.isFinite(graceMs)||graceMs<0)throw new RangeError("Invalid termination grace period");let record=trackedDetachedChildren.get(pid);if(!record||child&&record.child!==
19
- child)return Promise.resolve(!0);if(record.termination)return record.termination;record.terminationRequested=!0;let termination=(async()=>{process.platform==="win32"&&killProcessTree(pid);for(let signal of["SIGTERM","SIGKILL"]){if(trackedDetachedChildren.get(pid)!==record)return!0;let target=processTreeTarget(record);if(target===void 0)return!0;process.platform!=="win32"&&signalProcess(target,signal,record.child);let deadline=performance.now()+(signal==="SIGTERM"?graceMs:TERMINATION_CONFIRM_MS);
20
- for(;processTreeTarget(record)!==void 0&&performance.now()<deadline;)if(await new Promise(resolve=>setTimeout(resolve,TERMINATION_POLL_MS)),trackedDetachedChildren.get(pid)!==record)return!0;if(processTreeTarget(record)===void 0)return!0}return!1})().then(confirmed=>(confirmed?releaseChild(record):record.termination=void 0,confirmed));return record.termination=termination,termination}async function killTrackedDetachedChildrenAsync(graceMs=TERMINATION_GRACE_MS){return(await Promise.all([...trackedDetachedChildren.
21
- keys()].map(pid=>killProcessTreeAsync(pid,graceMs)))).every(Boolean)}function killTrackedDetachedChildren(graceMs=TERMINATION_GRACE_MS){if(!Number.isFinite(graceMs)||graceMs<0)throw new RangeError("Invalid termination grace period");let records=[...trackedDetachedChildren.values()];for(let record of records)record.terminationRequested=!0;if(process.platform==="win32")for(let record of records)killProcessTree(record.pid);else{let sleeper=new Int32Array(new SharedArrayBuffer(4));for(let signal of[
22
- "SIGTERM","SIGKILL"]){for(let record of records){let target=processTreeTarget(record);target!==void 0&&(signal==="SIGTERM"&&record.termination||isProcessAlive(target)&&signalProcess(target,signal,record.child))}let deadline=performance.now()+(signal==="SIGTERM"?graceMs:TERMINATION_CONFIRM_MS);for(;;){let alive=!1;for(let record of records)processTreeTarget(record)!==void 0&&(alive=!0);if(!alive||performance.now()>=deadline)break;Atomics.wait(sleeper,0,0,TERMINATION_POLL_MS)}}}for(let record of records)
23
- processTreeTarget(record)}function killProcessTree(pid,child){validatePid(pid);let record=trackedDetachedChildren.get(pid);if(!(!record||child&&record.child!==child||processTreeTarget(record)===void 0))if(process.platform==="win32")try{spawn(join(process.env.SystemRoot||"C:\\Windows","System32","taskkill.exe"),["/F","/T","/PID",String(pid)],{stdio:"ignore",detached:!0,windowsHide:!0}).once("error",()=>{})}catch{}else killProcessTreeAsync(pid)}export{getShellConfig,getPowerShellConfig,getShellEnv,sanitizeBinaryOutput,trackDetachedChildPid,untrackDetachedChildPid,killProcessTreeAsync,killTrackedDetachedChildrenAsync,killTrackedDetachedChildren};
@@ -1,23 +0,0 @@
1
- import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{appendAssistantMessageDiagnostic,ownedSlice}from"./chunk-XMZGB3H4.js";var MAX_PROVIDER_ERROR_BODY_CHARS=4e3,MAX_PROVIDER_ERROR_INPUT_CHARS=64*1024,OVERSIZED_ERROR_TEXT="Provider error text exceeded 65536 characters",UNPARSEABLE_ERROR_TEXT="Unparseable structured provider error";function normalizeProviderError(error){if(!(error instanceof Error))return{message:truncateErrorText(safeJsonStringify(error),MAX_PROVIDER_ERROR_BODY_CHARS),messageCarriesBody:!1};let sdkError=error,status=extractStatus(sdkError),body=extractBody(sdkError),message=body==="[REDACTED]"?body:truncateErrorText(
3
- error.message,MAX_PROVIDER_ERROR_BODY_CHARS),transport=transportEvidence(error);transport.transportCode&&TRANSPORT_CODES.has(transport.transportCode)&&!message.includes(transport.transportCode)&&(message=truncateErrorText(`${message} (${transport.transportCode})`,MAX_PROVIDER_ERROR_BODY_CHARS));let messageCarriesBody=body===void 0||message!=="[REDACTED]"&&message.includes(body);return{status,body,message,messageCarriesBody,...transport}}function transportEvidence(error){let candidate=error,transportCode,
4
- transportName;for(let depth=0;depth<8&&candidate&&typeof candidate=="object";depth++){let nested=candidate,status=extractStatus(nested);if(status!==void 0&&status>=400||nested.name==="AbortError"||nested.constructor?.name==="APIUserAbortError")return{};typeof nested.code=="string"&&TRANSPORT_CODES.has(nested.code)&&(transportCode??=nested.code);for(let name of[nested.name,nested.constructor?.name])["TimeoutError","APIConnectionTimeoutError","APIConnectionError"].includes(name)&&(transportName??=
5
- name);candidate=nested.cause}return transportCode??=transportName,transportCode?{transportCode}:{}}function appendProviderTransportDiagnostic(message,error){message.stopReason!=="error"||!error.transportCode||appendAssistantMessageDiagnostic(message,{type:"provider_transport_error",timestamp:Date.now(),details:{reason:"provider_unreachable",code:error.transportCode}})}function extractStatus(error){return[error.statusCode,error.status,error.$metadata?.httpStatusCode,error.$response?.statusCode].find(
6
- value=>typeof value=="number"&&Number.isInteger(value)&&value>=100&&value<=599)}function extractBody(error){let bodyText=pickBodyText(error);if(bodyText===void 0)return;let trimmed=sanitizeErrorText(bodyText).trim();if(trimmed.length!==0)return truncateErrorText(trimmed,MAX_PROVIDER_ERROR_BODY_CHARS)}function pickBodyText(error){if(typeof error.body=="string")return error.body;if(isPlainNonEmptyObject(error.error))return safeJsonStringify(error.error);let responseBody=error.$response?.body;if(typeof responseBody==
7
- "string")return responseBody;if(responseBody instanceof Uint8Array)return responseBody.byteLength>MAX_PROVIDER_ERROR_INPUT_CHARS?OVERSIZED_ERROR_TEXT:new TextDecoder().decode(responseBody);if(!isReadableStreamLike(responseBody)&&isPlainNonEmptyObject(responseBody))return safeJsonStringify(responseBody)}function isReadableStreamLike(value){return typeof value=="object"&&value!==null&&"pipe"in value&&typeof value.pipe=="function"}function isPlainNonEmptyObject(value){if(typeof value!="object"||value===
8
- null)return!1;let proto=Object.getPrototypeOf(value);return proto!==Object.prototype&&proto!==null?!1:Object.keys(value).length>0}function formatProviderError(norm,prefix){if(norm.messageCarriesBody||norm.status===void 0||norm.body===void 0){let message=prefix!==void 0&&norm.status!==void 0?`${prefix} (${norm.status}): ${norm.message}`:norm.message;return truncateErrorText(message,MAX_PROVIDER_ERROR_BODY_CHARS)}return truncateErrorText(prefix!==void 0?`${prefix} (${norm.status}): ${norm.body}`:`${norm.
9
- status}: ${norm.body}`,MAX_PROVIDER_ERROR_BODY_CHARS)}function truncateErrorText(text,maxChars){let clean=sanitizeErrorText(text),cap=Number.isFinite(maxChars)?Math.max(0,Math.floor(maxChars)):MAX_PROVIDER_ERROR_BODY_CHARS;if(clean.length<=cap)return clean;let start=clean.search(/[{[]/);if(start>=0)try{let parsed=JSON.parse(clean.slice(start));clean=clean.slice(0,start)+summarizeErrorValue(parsed)}catch{}let suffix="... [truncated]";return cap<suffix.length?suffix.slice(0,cap):`${ownedSlice(clean,
10
- 0,cap-suffix.length).replace(/\[[^\]]*$/,"")}${suffix}`}function safeJsonStringify(value){try{let serialized=JSON.stringify(value,(key,nested)=>{if(nested!==null&&typeof nested=="object"&&hasSensitiveLabel(nested,!0))return Array.isArray(nested)?["[REDACTED]"]:"[REDACTED]";let label=normalizeErrorLabel(key);if(hasAmbiguousErrorControls(key)||SENSITIVE_KEY.test(label)||/headers?/i.test(label)||Array.isArray(nested)&&nested.some(item=>typeof item=="string"&&SENSITIVE_KEY.test(normalizeErrorLabel(item)))||
11
- nested!==null&&typeof nested=="object"&&Object.entries(nested).some(([name,item])=>typeof item=="string"&&SENSITIVE_HEADER_NAME.test(normalizeErrorLabel(item))||/^(?:name|key|header|header[-_]?name|header[-_]?key|field[-_]?name|label|identifier)$/i.test(normalizeErrorLabel(name))&&hasSensitiveLabel(item)))return"[REDACTED]";if(Array.isArray(nested)&&hasSensitiveLabel(nested))return["[REDACTED]"];if(nested!==null&&typeof nested=="object"&&!Array.isArray(nested)){let entries=Object.entries(nested);
12
- if(entries.some(([name])=>sanitizePlainText(name)!==stripErrorControls(name)))return Object.fromEntries(entries.map(([name,value2])=>sanitizePlainText(name)!==stripErrorControls(name)?[sanitizePlainText(name),"[REDACTED]"]:[name,value2]))}return typeof nested=="string"?sanitizeErrorText(nested):nested});return serialized!==void 0&&serialized.length>MAX_PROVIDER_ERROR_INPUT_CHARS?truncateErrorText(summarizeErrorValue(JSON.parse(serialized)),MAX_PROVIDER_ERROR_BODY_CHARS):serialized===void 0?sanitizePlainText(
13
- String(value)):serialized}catch{return"[Unserializable provider error]"}}function summarizeErrorValue(value){if(typeof value=="string")try{return summarizeErrorValue(JSON.parse(value))}catch{return sanitizePlainText(value)}if(value===null||typeof value!="object")return String(value);let entries=Object.entries(value),reasons=["message","error","reason","detail"];entries.sort(([left],[right])=>(reasons.includes(left)?reasons.indexOf(left):reasons.length)-(reasons.includes(right)?reasons.indexOf(right):
14
- reasons.length));let parts=[],length=0;for(let[,nested]of entries){let part=truncateErrorText(summarizeErrorValue(nested),MAX_PROVIDER_ERROR_BODY_CHARS);if(parts.push(part),length+=part.length+2,length>=MAX_PROVIDER_ERROR_BODY_CHARS)break}return truncateErrorText(parts.join("; "),MAX_PROVIDER_ERROR_BODY_CHARS)}var TRANSPORT_CODES=new Set(["ECONNREFUSED","ECONNRESET","ETIMEDOUT","ENOTFOUND","EAI_AGAIN","EHOSTUNREACH","ENETUNREACH","EPIPE","EPROTO","CERT_HAS_EXPIRED","DEPTH_ZERO_SELF_SIGNED_CERT",
15
- "SELF_SIGNED_CERT_IN_CHAIN","UNABLE_TO_VERIFY_LEAF_SIGNATURE","ERR_TLS_CERT_ALTNAME_INVALID","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_BODY_TIMEOUT","UND_ERR_SOCKET"]),SENSITIVE_KEY=/(?:authorization|cookie|(?:api[-_\s]*key)|token|password|passwd|secret|credential|signature|private[-_\s]*key)/i,SENSITIVE_HEADER_NAME=/^(?:[a-z0-9]+[-_])*(?:authorization|cookie|(?:api|private|secret)[-_\s]*key|(?:access|refresh|session|security)[-_\s]*token|token|password|passwd|secret|credentials?|signature)$/i;
16
- function sanitizeErrorText(text){if(text.length>MAX_PROVIDER_ERROR_INPUT_CHARS)return OVERSIZED_ERROR_TEXT;try{let parsed=JSON.parse(text);if(parsed!==null&&typeof parsed=="object")return safeJsonStringify(parsed);if(typeof parsed=="string")return sanitizeErrorText(parsed)}catch{let start=text.search(/[{[]/);if(start>0)try{let parsed=JSON.parse(text.slice(start));return sanitizePlainText(text.slice(0,start))+safeJsonStringify(parsed)}catch{}}return sanitizePlainText(text)}function hasSensitiveLabel(value,ambiguityOnly=!1){
17
- let pending=[value],seen=new Set,scanned=0;for(;pending.length>0;){if(++scanned>1024)return!0;let item=pending.pop();if(typeof item=="string"){if(item.length>MAX_PROVIDER_ERROR_INPUT_CHARS||hasAmbiguousErrorControls(item)||!ambiguityOnly&&SENSITIVE_HEADER_NAME.test(normalizeErrorLabel(item)))return!0;try{let decoded=JSON.parse(ambiguityOnly?item:stripErrorControls(item," "));(typeof decoded=="string"||decoded!==null&&typeof decoded=="object")&&pending.push(decoded)}catch{let sanitized=sanitizePlainText(
18
- item);if(ambiguityOnly?sanitized===UNPARSEABLE_ERROR_TEXT:sanitized!==stripErrorControls(item))return!0}}if(item!==null&&typeof item=="object"){if(seen.has(item))return!0;seen.add(item);let entries=Object.entries(item);if(entries.length*2+pending.length>1024)return!0;for(let[name,nested]of entries){if(ambiguityOnly&&hasAmbiguousErrorKey(name))return!0;ambiguityOnly||pending.push(name),pending.push(nested)}}}return!1}function hasAmbiguousErrorKey(name){return name.length>MAX_PROVIDER_ERROR_INPUT_CHARS||
19
- name!==normalizeErrorLabel(name)||sanitizePlainText(name)===UNPARSEABLE_ERROR_TEXT}function normalizeErrorLabel(text){return stripErrorControls(text).replace(/[\s\p{Default_Ignorable_Code_Point}]/gu,"").trim().replace(/:+$/,"").trim()}var ERROR_TERMINAL_SEQUENCES=/(?:\x1b\]|\x9d)[\s\S]*?(?:\x07|\x1b\\|\x9c|$)|\x1b[PX^_][\s\S]*?(?:\x1b\\|$)|(?:\x1b\[|\x9b)[0-?]*[ -/]*[@-~]|\x1b[@-_]/g,ERROR_CONTROLS=/[\x00-\x08\x0b-\x1f\x7f-\x9f\p{Cf}\p{Default_Ignorable_Code_Point}]/gu;function hasAmbiguousErrorControls(text){
20
- return text.replace(ERROR_TERMINAL_SEQUENCES,sequence=>(sequence.startsWith("\x1B[")||sequence.startsWith("\x9B"))&&sequence.endsWith("m")?"":sequence).search(ERROR_CONTROLS)>=0}function stripErrorControls(text,replacement=""){return text.replace(ERROR_TERMINAL_SEQUENCES,replacement).replace(ERROR_CONTROLS,replacement)}function sanitizePlainText(text){if(text.length>MAX_PROVIDER_ERROR_INPUT_CHARS)return OVERSIZED_ERROR_TEXT;let boundaries=stripErrorControls(text," "),clean=stripErrorControls(text);
21
- if((/[@?#<>]/.test(clean)||clean.split(/\s+/).some(part=>{let start=part.search(/(?:https?|wss?|ftp):|[/\\]/i);return start>=0&&/["']/.test(part.slice(start))}))&&/(?:https?|wss?|ftp):|[/\\]/i.test(clean.replace(/\s/g,"")))return"[REDACTED]";if(/\\["/bfnrtu]/i.test(boundaries))return UNPARSEABLE_ERROR_TEXT;let structure=clean.replaceAll("[REDACTED]","").replaceAll("[truncated]","").replace(/\b[a-z_$][\w$]*(?:\[\d+\])+/gi,"");if(/[{}[\]]/.test(structure))return UNPARSEABLE_ERROR_TEXT;if(hasAmbiguousErrorControls(
22
- text)||SENSITIVE_KEY.test(normalizeErrorLabel(clean))||/\b(?:B\s*e\s*a\s*r\s*e\s*r|B\s*a\s*s\s*i\s*c)\s/i.test(boundaries)||/\b(?:B\s*e\s*a\s*r\s*e\s*r|B\s*a\s*s\s*i\s*c)\s/i.test(clean))return"[REDACTED]";let tokenText=clean.replace(/[\t\n\u2028\u2029]/g,"");return tokenText.replace(/[\w-]+(?:\.[\w-]+)*/g,token=>{let segments=token.split(".");return/\b(?:sk-|glpat-|gh[pousr]_|github_pat_|xox[baprs]-)[\w-]+|\b(?:AKIA|ASIA)[A-Z0-9]{16}\b|\bAIza[\w-]{35}/.test(token)||segments.length>=3&&/\beyJ[\w-]+$/.
23
- test(segments[0])?"[REDACTED]":token})===tokenText?clean:"[REDACTED]"}export{MAX_PROVIDER_ERROR_BODY_CHARS,normalizeProviderError,appendProviderTransportDiagnostic,formatProviderError,truncateErrorText};
@@ -1,28 +0,0 @@
1
- import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{ACCOUNT_RETURN_COOLDOWN_MS,ACCOUNT_RETURN_MAX_COOLDOWN_MS,AgentExecInputError,AgentSession,AgentSessionRuntime,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FLOW_ACCOUNT_PERSISTENCE_NOTICE,
3
- FLOW_SETUP_TERMINAL_ONLY,FLOW_SUBCOMMANDS,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthAccountPool,OAuthSelectorComponent,RpcClient,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,SkillInvocationMessageComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,VIRTUAL_MODEL_STATE_ENTRY,assessNodeFallback,calculateContextTokens,collectEntriesForBranchSummary,
4
- compact,completeFlowArguments,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodemodeExtension,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createMcpExtension,
5
- createPiAgentExecutionHost,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSubagentTool,createSyntheticSourceInfo,createToolSearchExtension,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAgents,discoverAndLoadExtensions,estimateTokens,executeHumainAgentRequest,findCutPoint,findTurnStartIndex,flowBuildUnavailable,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,
6
- generateSummaryWithUsage,generateUnifiedPatch,getCompactionThreshold,getFlowAccountsHost,getFlowChildLaunchHost,getFlowControlHost,getFlowTraceProducer,getLastAssistantUsage,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,parseArgs,parseFlowCommand,parseFrontmatter,parseSkillBlock,prepareBranchEntries,prepareChildLaunch,renderDiff,
7
- renderFlowHelp,renderTaskWithContext,resolveCliModel,resolveModelScopeWithDiagnostics,runAgentExecMode,runPrintMode,runRpcMode,serializeConversation,shouldCompact,stripFrontmatter,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunk-DCPACGLH.js";import{ArminComponent}from"./chunk-DLCBSLHW.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunk-FLVBQ6GS.js";import{CURRENT_SESSION_VERSION,SessionManager,buildContextEntries,buildSessionContext,
8
- buildSessionProjection,convertToLlm,formatDimensionNote,getLatestCompactionEntry,migrateSessionEntries,parseSessionEntries,resizeImage,sessionEntryToContextMessages}from"./chunk-NCC2FAJN.js";import{DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,formatReadLineRange,formatSize,truncateHead,truncateLine,truncateTail,truncateToVisualLines}from"./chunk-JEAM6N22.js";import{Container,SelectList,Theme,getAvailableThemes,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,
9
- initTheme,keyHint,keyText,rawKeyHint}from"./chunk-75CQYZ63.js";import{readStoredCredential}from"./chunk-WW4SILXG.js";import{getPowerShellConfig,getShellConfig}from"./chunk-PS2FJ7M4.js";import{HUMAIN_AGENT_EXECUTION_FAILURE_CODES,HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION,HumainAgentArtifactSchema,HumainAgentExecutionClaimSchema,HumainAgentExecutionControlsSchema,HumainAgentExecutionOutcomeSchema,HumainAgentExecutionRequestSchema,HumainAgentExecutionResponseSchema,HumainAgentRouteRefSchema,
10
- HumainAgentUsageSchema,parseHumainAgentExecutionRequest,parseHumainAgentExecutionResponse}from"./chunk-K7SDY3VJ.js";import{CONFIG_DIR_NAME,UPSTREAM_PI_VERSION,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunk-KM4GQ2BU.js";import{__export}from"./chunk-JXWJOIH4.js";var dist_exports={};__export(dist_exports,{ACCOUNT_RETURN_COOLDOWN_MS:()=>ACCOUNT_RETURN_COOLDOWN_MS,ACCOUNT_RETURN_MAX_COOLDOWN_MS:()=>ACCOUNT_RETURN_MAX_COOLDOWN_MS,AgentExecInputError:()=>AgentExecInputError,AgentSession:()=>AgentSession,AgentSessionRuntime:()=>AgentSessionRuntime,ArminComponent:()=>ArminComponent,AssistantMessageComponent:()=>AssistantMessageComponent,BashExecutionComponent:()=>BashExecutionComponent,BorderedLoader:()=>BorderedLoader,BranchSummaryMessageComponent:()=>BranchSummaryMessageComponent,
11
- CONFIG_DIR_NAME:()=>CONFIG_DIR_NAME,CURRENT_SESSION_VERSION:()=>CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent:()=>CompactionSummaryMessageComponent,CredentialSynchronizationError:()=>CredentialSynchronizationError,CustomEditor:()=>CustomEditor,CustomMessageComponent:()=>CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS:()=>DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES:()=>DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES:()=>DEFAULT_MAX_LINES,DefaultPackageManager:()=>DefaultPackageManager,DefaultResourceLoader:()=>DefaultResourceLoader,
12
- DynamicBorder:()=>DynamicBorder,ExtensionEditorComponent:()=>ExtensionEditorComponent,ExtensionInputComponent:()=>ExtensionInputComponent,ExtensionRunner:()=>ExtensionRunner,ExtensionSelectorComponent:()=>ExtensionSelectorComponent,FLOW_ACCOUNT_PERSISTENCE_NOTICE:()=>FLOW_ACCOUNT_PERSISTENCE_NOTICE,FLOW_SETUP_TERMINAL_ONLY:()=>FLOW_SETUP_TERMINAL_ONLY,FLOW_SUBCOMMANDS:()=>FLOW_SUBCOMMANDS,FooterComponent:()=>FooterComponent,HUMAIN_AGENT_EXECUTION_FAILURE_CODES:()=>HUMAIN_AGENT_EXECUTION_FAILURE_CODES,
13
- HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION:()=>HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION,HumainAgentArtifactSchema:()=>HumainAgentArtifactSchema,HumainAgentExecutionClaimSchema:()=>HumainAgentExecutionClaimSchema,HumainAgentExecutionControlsSchema:()=>HumainAgentExecutionControlsSchema,HumainAgentExecutionOutcomeSchema:()=>HumainAgentExecutionOutcomeSchema,HumainAgentExecutionRequestSchema:()=>HumainAgentExecutionRequestSchema,HumainAgentExecutionResponseSchema:()=>HumainAgentExecutionResponseSchema,HumainAgentRouteRefSchema:()=>HumainAgentRouteRefSchema,
14
- HumainAgentUsageSchema:()=>HumainAgentUsageSchema,InteractiveMode:()=>InteractiveMode,LoginDialogComponent:()=>LoginDialogComponent,ModelRegistry:()=>ModelRegistry,ModelRuntime:()=>ModelRuntime,ModelSelectorComponent:()=>ModelSelectorComponent,OAuthAccountPool:()=>OAuthAccountPool,OAuthSelectorComponent:()=>OAuthSelectorComponent,ProjectTrustStore:()=>ProjectTrustStore,RpcClient:()=>RpcClient,SessionManager:()=>SessionManager,SessionSelectorComponent:()=>SessionSelectorComponent,SettingsManager:()=>SettingsManager,
15
- SettingsSelectorComponent:()=>SettingsSelectorComponent,ShowImagesSelectorComponent:()=>ShowImagesSelectorComponent,SkillInvocationMessageComponent:()=>SkillInvocationMessageComponent,Theme:()=>Theme,ThemeSelectorComponent:()=>ThemeSelectorComponent,ThinkingSelectorComponent:()=>ThinkingSelectorComponent,ToolExecutionComponent:()=>ToolExecutionComponent,TreeSelectorComponent:()=>TreeSelectorComponent,UPSTREAM_PI_VERSION:()=>UPSTREAM_PI_VERSION,UserMessageComponent:()=>UserMessageComponent,UserMessageSelectorComponent:()=>UserMessageSelectorComponent,
16
- VERSION:()=>VERSION,VIRTUAL_MODEL_STATE_ENTRY:()=>VIRTUAL_MODEL_STATE_ENTRY,assessNodeFallback:()=>assessNodeFallback,buildContextEntries:()=>buildContextEntries,buildSessionContext:()=>buildSessionContext,buildSessionProjection:()=>buildSessionProjection,calculateContextTokens:()=>calculateContextTokens,collectEntriesForBranchSummary:()=>collectEntriesForBranchSummary,compact:()=>compact,completeFlowArguments:()=>completeFlowArguments,convertToLlm:()=>convertToLlm,convertToPng:()=>convertToPng,
17
- copyToClipboard:()=>copyToClipboard,createAgentSession:()=>createAgentSession,createAgentSessionFromServices:()=>createAgentSessionFromServices,createAgentSessionRuntime:()=>createAgentSessionRuntime,createAgentSessionServices:()=>createAgentSessionServices,createBashTool:()=>createBashTool,createBashToolDefinition:()=>createBashToolDefinition,createCodemodeExtension:()=>createCodemodeExtension,createCodingTools:()=>createCodingTools,createEditTool:()=>createEditTool,createEditToolDefinition:()=>createEditToolDefinition,
18
- createEventBus:()=>createEventBus,createExtensionRuntime:()=>createExtensionRuntime,createFindTool:()=>createFindTool,createFindToolDefinition:()=>createFindToolDefinition,createGrepTool:()=>createGrepTool,createGrepToolDefinition:()=>createGrepToolDefinition,createLocalBashOperations:()=>createLocalBashOperations,createLocalPowerShellOperations:()=>createLocalPowerShellOperations,createLsTool:()=>createLsTool,createLsToolDefinition:()=>createLsToolDefinition,createMcpExtension:()=>createMcpExtension,
19
- createPiAgentExecutionHost:()=>createPiAgentExecutionHost,createPowerShellTool:()=>createPowerShellTool,createPowerShellToolDefinition:()=>createPowerShellToolDefinition,createReadOnlyTools:()=>createReadOnlyTools,createReadTool:()=>createReadTool,createReadToolDefinition:()=>createReadToolDefinition,createSubagentTool:()=>createSubagentTool,createSyntheticSourceInfo:()=>createSyntheticSourceInfo,createToolSearchExtension:()=>createToolSearchExtension,createWriteTool:()=>createWriteTool,createWriteToolDefinition:()=>createWriteToolDefinition,
20
- defineTool:()=>defineTool,detectSupportedImageMimeTypeFromFile:()=>detectSupportedImageMimeTypeFromFile,discoverAgents:()=>discoverAgents,discoverAndLoadExtensions:()=>discoverAndLoadExtensions,estimateTokens:()=>estimateTokens,executeHumainAgentRequest:()=>executeHumainAgentRequest,findCutPoint:()=>findCutPoint,findTurnStartIndex:()=>findTurnStartIndex,flowBuildUnavailable:()=>flowBuildUnavailable,formatDimensionNote:()=>formatDimensionNote,formatReadLineRange:()=>formatReadLineRange,formatSize:()=>formatSize,
21
- formatSkillsForPrompt:()=>formatSkillsForPrompt,generateBranchSummary:()=>generateBranchSummary,generateDiffString:()=>generateDiffString,generateSummary:()=>generateSummary,generateSummaryWithUsage:()=>generateSummaryWithUsage,generateUnifiedPatch:()=>generateUnifiedPatch,getAgentDir:()=>getAgentDir,getCompactionThreshold:()=>getCompactionThreshold,getDocsPath:()=>getDocsPath,getExamplesPath:()=>getExamplesPath,getFlowAccountsHost:()=>getFlowAccountsHost,getFlowChildLaunchHost:()=>getFlowChildLaunchHost,
22
- getFlowControlHost:()=>getFlowControlHost,getFlowTraceProducer:()=>getFlowTraceProducer,getLanguageFromPath:()=>getLanguageFromPath,getLastAssistantUsage:()=>getLastAssistantUsage,getLatestCompactionEntry:()=>getLatestCompactionEntry,getMarkdownTheme:()=>getMarkdownTheme,getPackageDir:()=>getPackageDir,getPowerShellConfig:()=>getPowerShellConfig,getReadmePath:()=>getReadmePath,getSelectListTheme:()=>getSelectListTheme,getSettingsListTheme:()=>getSettingsListTheme,getShellConfig:()=>getShellConfig,
23
- hasTrustRequiringProjectResources:()=>hasTrustRequiringProjectResources,highlightCode:()=>highlightCode,initTheme:()=>initTheme,isBashToolResult:()=>isBashToolResult,isEditToolResult:()=>isEditToolResult,isFindToolResult:()=>isFindToolResult,isGrepToolResult:()=>isGrepToolResult,isLsToolResult:()=>isLsToolResult,isPowerShellToolResult:()=>isPowerShellToolResult,isReadToolResult:()=>isReadToolResult,isToolCallEventType:()=>isToolCallEventType,isWriteToolResult:()=>isWriteToolResult,keyHint:()=>keyHint,
24
- keyText:()=>keyText,loadProjectContextFiles:()=>loadProjectContextFiles,loadSkills:()=>loadSkills,loadSkillsFromDir:()=>loadSkillsFromDir,main:()=>main,migrateSessionEntries:()=>migrateSessionEntries,parseArgs:()=>parseArgs,parseFlowCommand:()=>parseFlowCommand,parseFrontmatter:()=>parseFrontmatter,parseHumainAgentExecutionRequest:()=>parseHumainAgentExecutionRequest,parseHumainAgentExecutionResponse:()=>parseHumainAgentExecutionResponse,parseSessionEntries:()=>parseSessionEntries,parseSkillBlock:()=>parseSkillBlock,
25
- prepareBranchEntries:()=>prepareBranchEntries,prepareChildLaunch:()=>prepareChildLaunch,rawKeyHint:()=>rawKeyHint,readStoredCredential:()=>readStoredCredential,renderDiff:()=>renderDiff,renderFlowHelp:()=>renderFlowHelp,renderTaskWithContext:()=>renderTaskWithContext,resizeImage:()=>resizeImage,resolveCliModel:()=>resolveCliModel,resolveModelScopeWithDiagnostics:()=>resolveModelScopeWithDiagnostics,runAgentExecMode:()=>runAgentExecMode,runPrintMode:()=>runPrintMode,runRpcMode:()=>runRpcMode,serializeConversation:()=>serializeConversation,
26
- sessionEntryToContextMessages:()=>sessionEntryToContextMessages,shouldCompact:()=>shouldCompact,stripFrontmatter:()=>stripFrontmatter,truncateHead:()=>truncateHead,truncateLine:()=>truncateLine,truncateTail:()=>truncateTail,truncateToVisualLines:()=>truncateToVisualLines,withFileMutationQueue:()=>withFileMutationQueue,wrapRegisteredTool:()=>wrapRegisteredTool,wrapRegisteredTools:()=>wrapRegisteredTools});var SHOW_IMAGES_SELECT_LIST_LAYOUT={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},ShowImagesSelectorComponent=class extends Container{selectList;constructor(currentValue,onSelect,onCancel){super();let items=[{value:"yes",label:"Yes",description:"Show images inline in terminal"},{value:"no",label:"No",description:"Show text placeholder instead"}];this.addChild(new DynamicBorder),this.selectList=new SelectList(items,5,getSelectListTheme(),SHOW_IMAGES_SELECT_LIST_LAYOUT),this.selectList.setSelectedIndex(
27
- currentValue?0:1),this.selectList.onSelect=item=>{onSelect(item.value==="yes")},this.selectList.onCancel=()=>{onCancel()},this.addChild(this.selectList),this.addChild(new DynamicBorder)}getSelectList(){return this.selectList}};var THEME_SELECT_LIST_LAYOUT={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},ThemeSelectorComponent=class extends Container{selectList;onPreview;constructor(currentTheme,onSelect,onCancel,onPreview){super(),this.onPreview=onPreview;let themes=getAvailableThemes(),themeItems=themes.map(name=>({value:name,label:name,description:name===currentTheme?"(current)":void 0}));this.addChild(new DynamicBorder),this.selectList=new SelectList(themeItems,10,getSelectListTheme(),THEME_SELECT_LIST_LAYOUT);let currentIndex=themes.
28
- indexOf(currentTheme);currentIndex!==-1&&this.selectList.setSelectedIndex(currentIndex),this.selectList.onSelect=item=>{onSelect(item.value)},this.selectList.onCancel=()=>{onCancel()},this.selectList.onSelectionChange=item=>{this.onPreview(item.value)},this.addChild(this.selectList),this.addChild(new DynamicBorder)}getSelectList(){return this.selectList}};export{ShowImagesSelectorComponent,ThemeSelectorComponent,dist_exports};