@humain/humain-code 0.4.18 → 0.5.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 (444) hide show
  1. package/CHANGELOG.md +247 -0
  2. package/dist/bundle/agent-monitor.js +1 -1
  3. package/dist/bundle/chunks/anthropic-messages-ZP5KUK52.js +67 -0
  4. package/dist/bundle/chunks/anthropic.js +2 -2
  5. package/dist/bundle/chunks/azure-openai-responses-QJFYQ3DF.js +15 -0
  6. package/dist/bundle/chunks/bedrock-converse-stream.js +152 -200
  7. package/dist/bundle/chunks/chunk-2GCMACT4.js +1956 -0
  8. package/dist/bundle/chunks/{chunk-7VY5IL74.js → chunk-476XBL3W.js} +3 -3
  9. package/dist/bundle/chunks/{chunk-P4UKLIQB.js → chunk-5C4VL2AR.js} +4 -4
  10. package/dist/bundle/chunks/{chunk-QEF72EIZ.js → chunk-A6B2QMA7.js} +40 -96
  11. package/dist/bundle/chunks/{chunk-3UXBFT4Q.js → chunk-A6YBWW4T.js} +1428 -1334
  12. package/dist/bundle/chunks/{chunk-OWLBGSXY.js → chunk-CN3Q5UNB.js} +388 -310
  13. package/dist/bundle/chunks/{chunk-SCIGZFN5.js → chunk-DNGJMRJW.js} +11 -11
  14. package/dist/bundle/chunks/{chunk-YMBXWW36.js → chunk-DR37WKFZ.js} +9 -8
  15. package/dist/bundle/chunks/chunk-DU6POZ7E.js +10 -0
  16. package/dist/bundle/chunks/{chunk-G6ABHCPB.js → chunk-FO2NYB6O.js} +655 -663
  17. package/dist/bundle/chunks/{chunk-RXOCQRBG.js → chunk-GEISZXXH.js} +1 -1
  18. package/dist/bundle/chunks/{chunk-OKALNPTJ.js → chunk-HIZWUSPN.js} +24 -24
  19. package/dist/bundle/chunks/{chunk-MVYV6MJY.js → chunk-HT5YN3LX.js} +1 -1
  20. package/dist/bundle/chunks/chunk-IDU5BNNI.js +15 -0
  21. package/dist/bundle/chunks/{chunk-TIFFHHW6.js → chunk-JCXXRCP6.js} +5 -5
  22. package/dist/bundle/chunks/{chunk-QYCOHSI7.js → chunk-KKCMWB63.js} +8 -7
  23. package/dist/bundle/chunks/{chunk-SCBU5WOP.js → chunk-M74U5X4S.js} +30 -23
  24. package/dist/bundle/chunks/{chunk-AWCJWXGD.js → chunk-MIJHJNNQ.js} +3 -2
  25. package/dist/bundle/chunks/{chunk-Y26OS23T.js → chunk-N7CQ3UV3.js} +4 -4
  26. package/dist/bundle/chunks/{chunk-XQZG5HPT.js → chunk-O4DO5RWS.js} +11 -6
  27. package/dist/bundle/chunks/chunk-OR25QDSS.js +365 -0
  28. package/dist/bundle/chunks/{chunk-7PRU6YW3.js → chunk-OZNC2W4B.js} +306 -286
  29. package/dist/bundle/chunks/{chunk-Z33NNMNB.js → chunk-PH7UP57J.js} +1 -1
  30. package/dist/bundle/chunks/{chunk-HPSQKIWK.js → chunk-PS7DGA7B.js} +1 -1
  31. package/dist/bundle/chunks/chunk-Q3SFYT2X.js +1965 -0
  32. package/dist/bundle/chunks/chunk-QW6PTCAB.js +10 -0
  33. package/dist/bundle/chunks/{chunk-5CDES42D.js → chunk-QWXPGBAG.js} +1 -1
  34. package/dist/bundle/chunks/{chunk-NCQ6WAQK.js → chunk-ROZV2IYD.js} +1 -1
  35. package/dist/bundle/chunks/{chunk-3XDL5ZE4.js → chunk-RTXDU3AA.js} +148 -122
  36. package/dist/bundle/chunks/{chunk-L5OUCJ7N.js → chunk-T3HXWZG4.js} +11 -11
  37. package/dist/bundle/chunks/{chunk-FZUJXM6D.js → chunk-UDB6NI4G.js} +309 -240
  38. package/dist/bundle/chunks/chunk-UTNHGOFS.js +88 -0
  39. package/dist/bundle/chunks/{chunk-H2FY3PEV.js → chunk-V62QBESW.js} +4 -3
  40. package/dist/bundle/chunks/{chunk-NSMMDV3N.js → chunk-XA7CJAYH.js} +4 -3
  41. package/dist/bundle/chunks/chunk-XQX7S3GM.js +7 -0
  42. package/dist/bundle/chunks/chunk-YFOLLX5D.js +23 -0
  43. package/dist/bundle/chunks/{chunk-YRCLNWFV.js → chunk-ZI7TK7HM.js} +1 -1
  44. package/dist/bundle/chunks/{chunk-V76YPIMT.js → chunk-ZR4GF4WU.js} +21 -15
  45. package/dist/bundle/chunks/{cli-2NKM2RNJ.js → cli-VXU7OWFU.js} +1 -1
  46. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-T7TPP7SQ.js +4 -0
  47. package/dist/bundle/chunks/codemode-worker.js +27 -27
  48. package/dist/bundle/chunks/compat-S2IBVV6V.js +13 -0
  49. package/dist/bundle/chunks/{dist-ZJIYY3GA.js → dist-645GFIWH.js} +452 -448
  50. package/dist/bundle/chunks/{dist-XVXV2CL4.js → dist-IBUWEKEE.js} +3 -3
  51. package/dist/bundle/chunks/dist-YFMJEHPH.js +8 -0
  52. package/dist/bundle/chunks/{dist-cjs-AXBW3N4F.js → dist-cjs-HTASUQXQ.js} +82 -80
  53. package/dist/bundle/chunks/{easter-egg-3d-VGJ77XZQ.js → easter-egg-3d-YOPLCOVW.js} +2 -2
  54. package/dist/bundle/chunks/es-YEFEOGR3.js +1905 -0
  55. package/dist/bundle/chunks/{esm-GIR7QH65.js → esm-R6HJ4QEG.js} +5 -5
  56. package/dist/bundle/chunks/{event-streams-NXFTZDSF.js → event-streams-BR2IL6C5.js} +1 -1
  57. package/dist/bundle/chunks/{execute-ZBEZNJ4E.js → execute-2JXEKQ2X.js} +17 -8
  58. package/dist/bundle/chunks/{extract-RFWEHH6W.js → extract-OTCGZGTL.js} +50 -47
  59. package/dist/bundle/chunks/github-copilot.js +42 -40
  60. package/dist/bundle/chunks/google-generative-ai-HVPCGIZ6.js +21 -0
  61. package/dist/bundle/chunks/google-vertex-UM5MAALA.js +25 -0
  62. package/dist/bundle/chunks/host-ZHEL5XQW.js +2 -0
  63. package/dist/bundle/chunks/{https-proxy-agent-7CAXVAFH.js → https-proxy-agent-JQICCRPH.js} +1 -1
  64. package/dist/bundle/chunks/{llama-cpp-classify-AGCW7HYN.js → llama-cpp-classify-B3G57LVR.js} +5 -5
  65. package/dist/bundle/chunks/{mistral-conversations-G3GN6CMT.js → mistral-conversations-AH72RLXK.js} +11 -11
  66. package/dist/bundle/chunks/{node-A6SZ3T7E.js → node-SJPZTR4K.js} +190 -190
  67. package/dist/bundle/chunks/{node-DZCAT4Q6.js → node-VSA4ZN7D.js} +1 -1
  68. package/dist/bundle/chunks/openai-chatgpt.js +2 -2
  69. package/dist/bundle/chunks/{openai-codex-responses-FJFDAWHI.js → openai-codex-responses-L366637C.js} +48 -47
  70. package/dist/bundle/chunks/openai-codex.js +2 -2
  71. package/dist/bundle/chunks/openai-completions-ZP62QXJX.js +83 -0
  72. package/dist/bundle/chunks/{openai-decisions-HESOHYZB.js → openai-decisions-WOWUC65P.js} +1 -1
  73. package/dist/bundle/chunks/openai-responses-DXUGSUTN.js +26 -0
  74. package/dist/bundle/chunks/openrouter-images-5K47HDAT.js +8 -0
  75. package/dist/bundle/chunks/openrouter.js +2 -2
  76. package/dist/bundle/chunks/{pi-messages-SAOV3JNW.js → pi-messages-MOQQDZBK.js} +5 -4
  77. package/dist/bundle/chunks/radius.js +2 -2
  78. package/dist/bundle/chunks/{runtime-HJEUOD4R.js → runtime-5VFZTMWL.js} +1 -1
  79. package/dist/bundle/chunks/typesafe-system-one-43OCHGKP.js +3 -0
  80. package/dist/bundle/chunks/{undici-4BK3MVJV.js → undici-EK3EUI2E.js} +1 -1
  81. package/dist/bundle/chunks/virtual-modules-GU6AW5ZK.js +5 -0
  82. package/dist/bundle/cli-runtime.js +3 -3
  83. package/dist/bundle/flow/package.json +4 -4
  84. package/dist/bundle/index.js +6 -6
  85. package/dist/bundle/rpc-entry.js +3 -3
  86. package/dist/cli/args.d.ts +6 -0
  87. package/dist/cli/args.d.ts.map +1 -1
  88. package/dist/cli/args.js +11 -0
  89. package/dist/cli/args.js.map +1 -1
  90. package/dist/coordination/adapter/tool.d.ts.map +1 -1
  91. package/dist/coordination/adapter/tool.js +3 -1
  92. package/dist/coordination/adapter/tool.js.map +1 -1
  93. package/dist/coordination/broker/broker.d.ts +6 -2
  94. package/dist/coordination/broker/broker.d.ts.map +1 -1
  95. package/dist/coordination/broker/broker.js +20 -8
  96. package/dist/coordination/broker/broker.js.map +1 -1
  97. package/dist/coordination/client/client.d.ts.map +1 -1
  98. package/dist/coordination/client/client.js +4 -2
  99. package/dist/coordination/client/client.js.map +1 -1
  100. package/dist/coordination/transport/discovery.d.ts +10 -3
  101. package/dist/coordination/transport/discovery.d.ts.map +1 -1
  102. package/dist/coordination/transport/discovery.js +18 -5
  103. package/dist/coordination/transport/discovery.js.map +1 -1
  104. package/dist/core/agent-session.d.ts +35 -2
  105. package/dist/core/agent-session.d.ts.map +1 -1
  106. package/dist/core/agent-session.js +163 -40
  107. package/dist/core/agent-session.js.map +1 -1
  108. package/dist/core/anthropic-subscription-usage.d.ts +47 -0
  109. package/dist/core/anthropic-subscription-usage.d.ts.map +1 -0
  110. package/dist/core/anthropic-subscription-usage.js +170 -0
  111. package/dist/core/anthropic-subscription-usage.js.map +1 -0
  112. package/dist/core/bash-executor.d.ts.map +1 -1
  113. package/dist/core/bash-executor.js +7 -1
  114. package/dist/core/bash-executor.js.map +1 -1
  115. package/dist/core/client-identity.d.ts +13 -0
  116. package/dist/core/client-identity.d.ts.map +1 -0
  117. package/dist/core/client-identity.js +25 -0
  118. package/dist/core/client-identity.js.map +1 -0
  119. package/dist/core/codex-usage.d.ts +37 -1
  120. package/dist/core/codex-usage.d.ts.map +1 -1
  121. package/dist/core/codex-usage.js +104 -11
  122. package/dist/core/codex-usage.js.map +1 -1
  123. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  124. package/dist/core/compaction/branch-summarization.js +1 -2
  125. package/dist/core/compaction/branch-summarization.js.map +1 -1
  126. package/dist/core/compaction/compaction.d.ts +2 -2
  127. package/dist/core/compaction/compaction.d.ts.map +1 -1
  128. package/dist/core/compaction/compaction.js +20 -15
  129. package/dist/core/compaction/compaction.js.map +1 -1
  130. package/dist/core/export-html/index.d.ts.map +1 -1
  131. package/dist/core/export-html/index.js +2 -0
  132. package/dist/core/export-html/index.js.map +1 -1
  133. package/dist/core/export-html/template.html +1 -0
  134. package/dist/core/export-html/template.js +2 -1
  135. package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
  136. package/dist/core/export-html/vendor/marked.min.js +30 -29
  137. package/dist/core/extensions/loader.d.ts.map +1 -1
  138. package/dist/core/extensions/loader.js +3 -0
  139. package/dist/core/extensions/loader.js.map +1 -1
  140. package/dist/core/extensions/runner.d.ts +14 -0
  141. package/dist/core/extensions/runner.d.ts.map +1 -1
  142. package/dist/core/extensions/runner.js +86 -2
  143. package/dist/core/extensions/runner.js.map +1 -1
  144. package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
  145. package/dist/core/extensions/virtual-modules.js +3 -0
  146. package/dist/core/extensions/virtual-modules.js.map +1 -1
  147. package/dist/core/model-config.d.ts +920 -0
  148. package/dist/core/model-config.d.ts.map +1 -1
  149. package/dist/core/model-config.js +48 -24
  150. package/dist/core/model-config.js.map +1 -1
  151. package/dist/core/model-registry.d.ts +18 -0
  152. package/dist/core/model-registry.d.ts.map +1 -1
  153. package/dist/core/model-registry.js +20 -0
  154. package/dist/core/model-registry.js.map +1 -1
  155. package/dist/core/model-resolver.d.ts.map +1 -1
  156. package/dist/core/model-resolver.js +14 -6
  157. package/dist/core/model-resolver.js.map +1 -1
  158. package/dist/core/model-runtime.d.ts +9 -0
  159. package/dist/core/model-runtime.d.ts.map +1 -1
  160. package/dist/core/model-runtime.js +99 -12
  161. package/dist/core/model-runtime.js.map +1 -1
  162. package/dist/core/output-guard.d.ts +13 -1
  163. package/dist/core/output-guard.d.ts.map +1 -1
  164. package/dist/core/output-guard.js +101 -11
  165. package/dist/core/output-guard.js.map +1 -1
  166. package/dist/core/provider-composer.d.ts +2 -1
  167. package/dist/core/provider-composer.d.ts.map +1 -1
  168. package/dist/core/provider-composer.js +7 -3
  169. package/dist/core/provider-composer.js.map +1 -1
  170. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  171. package/dist/core/remote-catalog-provider.js +7 -2
  172. package/dist/core/remote-catalog-provider.js.map +1 -1
  173. package/dist/core/sdk.d.ts.map +1 -1
  174. package/dist/core/sdk.js +8 -9
  175. package/dist/core/sdk.js.map +1 -1
  176. package/dist/core/session-manager.d.ts +4 -0
  177. package/dist/core/session-manager.d.ts.map +1 -1
  178. package/dist/core/session-manager.js +242 -26
  179. package/dist/core/session-manager.js.map +1 -1
  180. package/dist/core/system-prompt.d.ts +6 -1
  181. package/dist/core/system-prompt.d.ts.map +1 -1
  182. package/dist/core/system-prompt.js +93 -1
  183. package/dist/core/system-prompt.js.map +1 -1
  184. package/dist/core/tools/grep.d.ts.map +1 -1
  185. package/dist/core/tools/grep.js +3 -1
  186. package/dist/core/tools/grep.js.map +1 -1
  187. package/dist/core/tools/ls.d.ts.map +1 -1
  188. package/dist/core/tools/ls.js +37 -12
  189. package/dist/core/tools/ls.js.map +1 -1
  190. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  191. package/dist/extensions/codemode/execute.js +102 -24
  192. package/dist/extensions/codemode/execute.js.map +1 -1
  193. package/dist/extensions/index.d.ts.map +1 -1
  194. package/dist/extensions/index.js +3 -1
  195. package/dist/extensions/index.js.map +1 -1
  196. package/dist/extensions/mcp/config.d.ts.map +1 -1
  197. package/dist/extensions/mcp/config.js +3 -2
  198. package/dist/extensions/mcp/config.js.map +1 -1
  199. package/dist/extensions/usage/index.d.ts +15 -0
  200. package/dist/extensions/usage/index.d.ts.map +1 -0
  201. package/dist/extensions/usage/index.js +110 -0
  202. package/dist/extensions/usage/index.js.map +1 -0
  203. package/dist/extensions/usage/overview.d.ts +90 -0
  204. package/dist/extensions/usage/overview.d.ts.map +1 -0
  205. package/dist/extensions/usage/overview.js +215 -0
  206. package/dist/extensions/usage/overview.js.map +1 -0
  207. package/dist/extensions/usage/popup.d.ts +21 -0
  208. package/dist/extensions/usage/popup.d.ts.map +1 -0
  209. package/dist/extensions/usage/popup.js +98 -0
  210. package/dist/extensions/usage/popup.js.map +1 -0
  211. package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +21 -2
  212. package/dist/humain/bundled-extension-names.d.ts +6 -0
  213. package/dist/humain/bundled-extension-names.d.ts.map +1 -0
  214. package/dist/humain/bundled-extension-names.js +9 -0
  215. package/dist/humain/bundled-extension-names.js.map +1 -0
  216. package/dist/humain/index.d.ts +2 -2
  217. package/dist/humain/index.d.ts.map +1 -1
  218. package/dist/humain/index.js +3 -2
  219. package/dist/humain/index.js.map +1 -1
  220. package/dist/humain/web-access/vendor/anysearch.d.ts.map +1 -1
  221. package/dist/humain/web-access/vendor/anysearch.js +3 -3
  222. package/dist/humain/web-access/vendor/anysearch.js.map +1 -1
  223. package/dist/humain/web-access/vendor/bocha.d.ts.map +1 -1
  224. package/dist/humain/web-access/vendor/bocha.js +3 -3
  225. package/dist/humain/web-access/vendor/bocha.js.map +1 -1
  226. package/dist/humain/web-access/vendor/brightdata-unlocker.d.ts.map +1 -1
  227. package/dist/humain/web-access/vendor/brightdata-unlocker.js +2 -2
  228. package/dist/humain/web-access/vendor/brightdata-unlocker.js.map +1 -1
  229. package/dist/humain/web-access/vendor/brightdata.d.ts.map +1 -1
  230. package/dist/humain/web-access/vendor/brightdata.js +3 -3
  231. package/dist/humain/web-access/vendor/brightdata.js.map +1 -1
  232. package/dist/humain/web-access/vendor/ceramic.d.ts.map +1 -1
  233. package/dist/humain/web-access/vendor/ceramic.js +2 -2
  234. package/dist/humain/web-access/vendor/ceramic.js.map +1 -1
  235. package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
  236. package/dist/humain/web-access/vendor/curator-page.js +3 -1
  237. package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
  238. package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
  239. package/dist/humain/web-access/vendor/curator-server.js +2 -0
  240. package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
  241. package/dist/humain/web-access/vendor/deepseek.d.ts +11 -1
  242. package/dist/humain/web-access/vendor/deepseek.d.ts.map +1 -1
  243. package/dist/humain/web-access/vendor/deepseek.js +170 -5
  244. package/dist/humain/web-access/vendor/deepseek.js.map +1 -1
  245. package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
  246. package/dist/humain/web-access/vendor/extract.js +63 -6
  247. package/dist/humain/web-access/vendor/extract.js.map +1 -1
  248. package/dist/humain/web-access/vendor/gemini-search.d.ts +5 -3
  249. package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
  250. package/dist/humain/web-access/vendor/gemini-search.js +33 -7
  251. package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
  252. package/dist/humain/web-access/vendor/index.d.ts +1 -0
  253. package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
  254. package/dist/humain/web-access/vendor/index.js +18 -3
  255. package/dist/humain/web-access/vendor/index.js.map +1 -1
  256. package/dist/humain/web-access/vendor/jina-search.d.ts.map +1 -1
  257. package/dist/humain/web-access/vendor/jina-search.js +6 -4
  258. package/dist/humain/web-access/vendor/jina-search.js.map +1 -1
  259. package/dist/humain/web-access/vendor/kagi.d.ts.map +1 -1
  260. package/dist/humain/web-access/vendor/kagi.js +4 -4
  261. package/dist/humain/web-access/vendor/kagi.js.map +1 -1
  262. package/dist/humain/web-access/vendor/keenable.d.ts.map +1 -1
  263. package/dist/humain/web-access/vendor/keenable.js +2 -2
  264. package/dist/humain/web-access/vendor/keenable.js.map +1 -1
  265. package/dist/humain/web-access/vendor/linkup.d.ts +6 -0
  266. package/dist/humain/web-access/vendor/linkup.d.ts.map +1 -0
  267. package/dist/humain/web-access/vendor/linkup.js +167 -0
  268. package/dist/humain/web-access/vendor/linkup.js.map +1 -0
  269. package/dist/humain/web-access/vendor/mistral-search.d.ts.map +1 -1
  270. package/dist/humain/web-access/vendor/mistral-search.js +3 -3
  271. package/dist/humain/web-access/vendor/mistral-search.js.map +1 -1
  272. package/dist/humain/web-access/vendor/ollama.d.ts.map +1 -1
  273. package/dist/humain/web-access/vendor/ollama.js +4 -4
  274. package/dist/humain/web-access/vendor/ollama.js.map +1 -1
  275. package/dist/humain/web-access/vendor/parallel.js +6 -7
  276. package/dist/humain/web-access/vendor/parallel.js.map +1 -1
  277. package/dist/humain/web-access/vendor/perplexity.d.ts.map +1 -1
  278. package/dist/humain/web-access/vendor/perplexity.js +4 -3
  279. package/dist/humain/web-access/vendor/perplexity.js.map +1 -1
  280. package/dist/humain/web-access/vendor/querit.d.ts.map +1 -1
  281. package/dist/humain/web-access/vendor/querit.js +3 -3
  282. package/dist/humain/web-access/vendor/querit.js.map +1 -1
  283. package/dist/humain/web-access/vendor/search1api.d.ts.map +1 -1
  284. package/dist/humain/web-access/vendor/search1api.js +3 -3
  285. package/dist/humain/web-access/vendor/search1api.js.map +1 -1
  286. package/dist/humain/web-access/vendor/searchinfinity.d.ts.map +1 -1
  287. package/dist/humain/web-access/vendor/searchinfinity.js +3 -3
  288. package/dist/humain/web-access/vendor/searchinfinity.js.map +1 -1
  289. package/dist/humain/web-access/vendor/serpapi.d.ts.map +1 -1
  290. package/dist/humain/web-access/vendor/serpapi.js +6 -5
  291. package/dist/humain/web-access/vendor/serpapi.js.map +1 -1
  292. package/dist/humain/web-access/vendor/serpbase.d.ts.map +1 -1
  293. package/dist/humain/web-access/vendor/serpbase.js +4 -4
  294. package/dist/humain/web-access/vendor/serpbase.js.map +1 -1
  295. package/dist/humain/web-access/vendor/serpdive.d.ts.map +1 -1
  296. package/dist/humain/web-access/vendor/serpdive.js +3 -3
  297. package/dist/humain/web-access/vendor/serpdive.js.map +1 -1
  298. package/dist/humain/web-access/vendor/serper.d.ts.map +1 -1
  299. package/dist/humain/web-access/vendor/serper.js +5 -4
  300. package/dist/humain/web-access/vendor/serper.js.map +1 -1
  301. package/dist/humain/web-access/vendor/serply.d.ts.map +1 -1
  302. package/dist/humain/web-access/vendor/serply.js +2 -2
  303. package/dist/humain/web-access/vendor/serply.js.map +1 -1
  304. package/dist/humain/web-access/vendor/utils.d.ts +3 -1
  305. package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
  306. package/dist/humain/web-access/vendor/utils.js +27 -2
  307. package/dist/humain/web-access/vendor/utils.js.map +1 -1
  308. package/dist/humain/web-access/vendor/valyu.d.ts.map +1 -1
  309. package/dist/humain/web-access/vendor/valyu.js +3 -3
  310. package/dist/humain/web-access/vendor/valyu.js.map +1 -1
  311. package/dist/humain/web-access/vendor/web-tool-core.d.ts +2 -0
  312. package/dist/humain/web-access/vendor/web-tool-core.d.ts.map +1 -1
  313. package/dist/humain/web-access/vendor/web-tool-core.js +3 -0
  314. package/dist/humain/web-access/vendor/web-tool-core.js.map +1 -1
  315. package/dist/humain/web-access/vendor/xai-search.d.ts.map +1 -1
  316. package/dist/humain/web-access/vendor/xai-search.js +51 -8
  317. package/dist/humain/web-access/vendor/xai-search.js.map +1 -1
  318. package/dist/humain/web-access/vendor/xcrawl.d.ts.map +1 -1
  319. package/dist/humain/web-access/vendor/xcrawl.js +3 -3
  320. package/dist/humain/web-access/vendor/xcrawl.js.map +1 -1
  321. package/dist/humain/web-access/vendor/you.d.ts.map +1 -1
  322. package/dist/humain/web-access/vendor/you.js +2 -2
  323. package/dist/humain/web-access/vendor/you.js.map +1 -1
  324. package/dist/main.d.ts.map +1 -1
  325. package/dist/main.js +15 -2
  326. package/dist/main.js.map +1 -1
  327. package/dist/modes/interactive/components/assistant-message.d.ts +14 -2
  328. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  329. package/dist/modes/interactive/components/assistant-message.js +62 -7
  330. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  331. package/dist/modes/interactive/components/config-selector.js +1 -1
  332. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  333. package/dist/modes/interactive/components/custom-editor.d.ts +2 -0
  334. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  335. package/dist/modes/interactive/components/custom-editor.js +6 -1
  336. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  337. package/dist/modes/interactive/components/easter-egg-3d.js +1 -1
  338. package/dist/modes/interactive/components/easter-egg-3d.js.map +1 -1
  339. package/dist/modes/interactive/components/footer.d.ts +10 -2
  340. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  341. package/dist/modes/interactive/components/footer.js +141 -66
  342. package/dist/modes/interactive/components/footer.js.map +1 -1
  343. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
  344. package/dist/modes/interactive/components/mermaid.js +16 -3
  345. package/dist/modes/interactive/components/mermaid.js.map +1 -1
  346. package/dist/modes/interactive/components/model-selector.js +1 -1
  347. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  348. package/dist/modes/interactive/components/themed-text.d.ts.map +1 -1
  349. package/dist/modes/interactive/components/themed-text.js +3 -2
  350. package/dist/modes/interactive/components/themed-text.js.map +1 -1
  351. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  352. package/dist/modes/interactive/components/tool-execution.js +17 -6
  353. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  354. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  355. package/dist/modes/interactive/components/user-message.js +3 -2
  356. package/dist/modes/interactive/components/user-message.js.map +1 -1
  357. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  358. package/dist/modes/interactive/components/visual-truncate.js +4 -2
  359. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  360. package/dist/modes/interactive/interactive-mode.d.ts +13 -17
  361. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  362. package/dist/modes/interactive/interactive-mode.js +90 -122
  363. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  364. package/dist/modes/print-mode.d.ts.map +1 -1
  365. package/dist/modes/print-mode.js +2 -5
  366. package/dist/modes/print-mode.js.map +1 -1
  367. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  368. package/dist/modes/rpc/rpc-mode.js +2 -3
  369. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  370. package/dist/package-manager-cli.d.ts.map +1 -1
  371. package/dist/package-manager-cli.js +2 -1
  372. package/dist/package-manager-cli.js.map +1 -1
  373. package/dist/utils/child-process.d.ts.map +1 -1
  374. package/dist/utils/child-process.js +3 -2
  375. package/dist/utils/child-process.js.map +1 -1
  376. package/dist/utils/clipboard-command.d.ts.map +1 -1
  377. package/dist/utils/clipboard-command.js +3 -0
  378. package/dist/utils/clipboard-command.js.map +1 -1
  379. package/dist/utils/pi-user-agent.d.ts +1 -0
  380. package/dist/utils/pi-user-agent.d.ts.map +1 -1
  381. package/dist/utils/pi-user-agent.js +3 -2
  382. package/dist/utils/pi-user-agent.js.map +1 -1
  383. package/dist/utils/shell.d.ts.map +1 -1
  384. package/dist/utils/shell.js +45 -13
  385. package/dist/utils/shell.js.map +1 -1
  386. package/dist/utils/tools-manager.d.ts.map +1 -1
  387. package/dist/utils/tools-manager.js +4 -3
  388. package/dist/utils/tools-manager.js.map +1 -1
  389. package/docs/codemode.md +2 -2
  390. package/docs/compaction.md +3 -3
  391. package/docs/coordination.md +1 -1
  392. package/docs/custom-provider.md +53 -1
  393. package/docs/docs.json +4 -0
  394. package/docs/environment-variables.md +2 -0
  395. package/docs/extensions.md +133 -10
  396. package/docs/models-configuration.md +197 -0
  397. package/docs/models.md +21 -5
  398. package/docs/settings.md +1 -1
  399. package/docs/slash-commands.md +10 -0
  400. package/docs/tui.md +70 -0
  401. package/docs/windows.md +16 -2
  402. package/examples/extensions/custom-provider-anthropic/package.json +2 -2
  403. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  404. package/examples/extensions/gondolin/package-lock.json +2 -2
  405. package/examples/extensions/gondolin/package.json +1 -1
  406. package/examples/extensions/sandbox/package-lock.json +2 -2
  407. package/examples/extensions/sandbox/package.json +2 -2
  408. package/examples/extensions/with-deps/package.json +1 -1
  409. package/examples/plugins/pi-example-plugin/package.json +2 -2
  410. package/npm-shrinkwrap.json +243 -219
  411. package/package.json +21 -20
  412. package/schemas/models.schema.json +84 -30
  413. package/src/coordination/UPSTREAM.md +36 -3
  414. package/src/coordination/upstream.json +3 -3
  415. package/src/humain/web-access/UPSTREAM.md +72 -1
  416. package/src/humain/web-access/upstream.json +5 -4
  417. package/dist/bundle/chunks/anthropic-messages-TSNY5MWH.js +0 -67
  418. package/dist/bundle/chunks/azure-openai-responses-Z4DCXO2G.js +0 -15
  419. package/dist/bundle/chunks/chunk-26EAEXO5.js +0 -167
  420. package/dist/bundle/chunks/chunk-2ZFUMXOZ.js +0 -1790
  421. package/dist/bundle/chunks/chunk-5K5RFXXO.js +0 -74
  422. package/dist/bundle/chunks/chunk-PY7SOXCA.js +0 -10
  423. package/dist/bundle/chunks/chunk-UGJAAWNC.js +0 -7
  424. package/dist/bundle/chunks/chunk-UGXYG7HN.js +0 -22
  425. package/dist/bundle/chunks/chunk-VEYTRNQC.js +0 -5
  426. package/dist/bundle/chunks/chunk-X3O5MCKJ.js +0 -7
  427. package/dist/bundle/chunks/chunk-YLYOJQQX.js +0 -1951
  428. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-MUJQ6LT2.js +0 -4
  429. package/dist/bundle/chunks/compat-VDGEZSVM.js +0 -13
  430. package/dist/bundle/chunks/dist-LKDZAEUQ.js +0 -7
  431. package/dist/bundle/chunks/es-N6YFJOD7.js +0 -1901
  432. package/dist/bundle/chunks/google-generative-ai-4OVYRP24.js +0 -21
  433. package/dist/bundle/chunks/google-vertex-3WQAZJQD.js +0 -25
  434. package/dist/bundle/chunks/host-63SNKK5Y.js +0 -2
  435. package/dist/bundle/chunks/openai-completions-IC7WRLTI.js +0 -82
  436. package/dist/bundle/chunks/openai-responses-XXCYDFSM.js +0 -24
  437. package/dist/bundle/chunks/openrouter-images-DT2HMZNO.js +0 -8
  438. package/dist/bundle/chunks/typesafe-system-one-HCMGHK6A.js +0 -2
  439. package/dist/bundle/chunks/virtual-modules-CFJTDIXL.js +0 -5
  440. package/dist/core/provider-attribution.d.ts +0 -4
  441. package/dist/core/provider-attribution.d.ts.map +0 -1
  442. package/dist/core/provider-attribution.js +0 -85
  443. package/dist/core/provider-attribution.js.map +0 -1
  444. /package/dist/bundle/chunks/{chunk-WZMA7HAJ.js → chunk-XQRYOCHA.js} +0 -0
@@ -55,7 +55,7 @@ Reload replaces the extension runtime, so code after `await ctx.reload()` must n
55
55
 
56
56
  <a id="understand-the-lifecycle"></a>
57
57
 
58
- ## Respect the runtime lifecycle
58
+ ## Understand the runtime lifecycle
59
59
 
60
60
  The factory can be synchronous or asynchronous. HUMAIN Code CLI waits for an asynchronous factory before startup continues, allowing it to fetch configuration or register providers needed during startup.
61
61
 
@@ -63,13 +63,112 @@ Do not start processes, sockets, watchers, or timers in the factory because some
63
63
  Start long-lived resources from `session_start` or from the command or tool that needs them.
64
64
  Close session-scoped resources from an idempotent `session_shutdown` handler.
65
65
 
66
- A run proceeds from input and `before_agent_start`, through model, message, and tool events, to `agent_end`.
67
- Pi counts as busy while a run starts, including the compaction check and `before_agent_start`, so messages sent meanwhile go into the starting run.
68
- Automatic retries, recovery, compaction, or queued work can continue afterward.
66
+ A normal prompt starts a run. The run repeats turns, then checks whether more work starts another low-level agent run:
67
+
68
+ ```mermaid
69
+ flowchart TD
70
+ Input["input"] --> Before["before_agent_start"]
71
+ Before --> AgentStart["agent_start"]
72
+ AgentStart --> Turns[["turns"]]
73
+ Turns --> AgentEnd["agent_end"]
74
+ AgentEnd --> MoreRuns{"More work?"}
75
+ MoreRuns -->|yes| AgentStart
76
+ MoreRuns -->|no| BeforeSettle["agent_before_settle"]
77
+ BeforeSettle --> Continue{"Continuation requested?"}
78
+ Continue -->|yes| AgentStart
79
+ Continue -->|no| Settled["agent_settled"]
80
+ ```
81
+
82
+ More work means a retry, recovery, compaction retry, or queued work.
83
+
84
+ Each turn sends one model request and executes the tool calls in the assistant response:
85
+
86
+ ```mermaid
87
+ flowchart TD
88
+ TurnStart["turn_start"] --> Request[["model request"]]
89
+ Request --> ToolDecision{"Tool calls?"}
90
+ ToolDecision -->|yes| Tools[["tool execution"]]
91
+ Tools --> TurnEnd["turn_end"]
92
+ ToolDecision -->|no| TurnEnd
93
+ TurnEnd --> MoreTurns{"Another turn?"}
94
+ MoreTurns -->|yes| TurnStart
95
+ MoreTurns -->|no| AgentEnd(["agent_end"])
96
+ ```
97
+
98
+ The model request runs these hooks in order:
99
+
100
+ 1. `context`
101
+ 2. `context_with_system`
102
+ 3. `before_provider_headers`
103
+ 4. `before_provider_request`
104
+ 5. `after_provider_response`
105
+ 6. `provider_stream_event` and assistant message events
106
+
107
+ Tool execution runs these hooks in order for each tool call:
108
+
109
+ 1. `tool_execution_start`
110
+ 2. `tool_call`
111
+ 3. `tool_execution_update` while the tool executes
112
+ 4. `tool_result`
113
+ 5. `tool_execution_end`
114
+
115
+ The lifecycle involves these event groups:
116
+
117
+ | Area | Events |
118
+ |---|---|
119
+ | Input preparation | `input`, `before_agent_start` |
120
+ | Agent run | `agent_start`, `agent_end` |
121
+ | Model turn | `turn_start`, `context`, `context_with_system`, `turn_end` |
122
+ | Provider call | `before_provider_headers`, `before_provider_request`, `after_provider_response`, `provider_stream_event` |
123
+ | Message lifecycle | `message_start`, `message_update`, `message_end` |
124
+ | Tool execution | `tool_execution_start`, `tool_call`, `tool_execution_update`, `tool_result`, `tool_execution_end` |
125
+ | Settlement | `agent_before_settle`, `agent_settled` |
126
+
127
+ HUMAIN Code CLI counts as busy while a run starts, including the compaction check and `before_agent_start`, so messages sent meanwhile go into the starting run. Message lifecycle events also cover user and tool-result messages; the model request list places only the assistant stream where it occurs in each turn.
128
+
129
+ Tool hooks run for each tool call, and one assistant response can start another turn by returning tool calls. Provider hooks run only when that transport exposes the corresponding stage. See the exported declarations in [`extensions/types.ts`](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/core/extensions/types.ts) for exact event payloads and result types.
130
+
131
+ Session startup and replacement follow a separate lifecycle:
132
+
133
+ ```mermaid
134
+ flowchart TD
135
+ Startup["Process startup"] --> Trust["project_trust when needed"]
136
+ Trust --> SessionStart["session_start"]
137
+ Switch["/new or /resume"] --> BeforeSwitch["session_before_switch"]
138
+ Fork["/fork or /clone"] --> BeforeFork["session_before_fork"]
139
+ BeforeSwitch --> Shutdown["session_shutdown"]
140
+ BeforeFork --> Shutdown
141
+ Reload["reload"] --> Shutdown
142
+ Shutdown --> Replacing{"Replacing the runtime?"}
143
+ Replacing -->|yes| Replacement["load replacement extension runtime"]
144
+ Replacement --> SessionStart
145
+ Replacing -->|no| Stop["process exits"]
146
+ SessionStart --> Discover["resources_discover"]
147
+ ```
148
+
149
+ `project_trust` runs before trusted project resources load and can run again when session replacement enters a new working directory. Retries, recovery, compaction, and queued messages can start another agent run after `agent_end`, so `agent_end` is not a final-idle signal. Reload and session replacement invalidate the old runtime. Code after `await ctx.reload()` still belongs to the old runtime and must not reuse its session-bound state.
150
+
151
+ ### Choose an event by intent
152
+
153
+ | Goal | Event |
154
+ |---|---|
155
+ | Inspect, transform, or consume raw user input | `input` |
156
+ | Change prompt sections, active tools, or add context before a run | `before_agent_start` |
157
+ | Observe one low-level agent run | `agent_start`, `agent_end` |
158
+ | Act after one model response and its tool calls | `turn_end` |
159
+ | Filter conversation messages for one provider request | `context` |
160
+ | Transform the complete transcript, including system messages | `context_with_system` |
161
+ | Change request headers or the serialized provider payload | `before_provider_headers`, `before_provider_request` |
162
+ | Observe provider response metadata or parsed stream events | `after_provider_response`, `provider_stream_event` |
163
+ | Authorize or modify a tool call | `tool_call` |
164
+ | Redact, annotate, or replace a tool result | `tool_result` |
165
+ | Append final entries or request one last continuation | `agent_before_settle` |
166
+ | Run notification work after automatic processing has stopped | `agent_settled` |
167
+ | Initialize or release session-scoped resources | `session_start`, `session_shutdown` |
168
+
69
169
  <a id="agent_start--agent_end--agent_before_settle--agent_settled"></a>
70
170
 
71
- `agent_before_settle` is the final actionable boundary: it can append entries and request one continuation.
72
- `agent_settled` is final and notification-only; use it when an integration needs to know HUMAIN Code CLI will not continue automatically.
171
+ Use `agent_before_settle` when an extension must append entries or request one final continuation. Use `agent_settled` for notification-only work that should run after HUMAIN Code CLI has no automatic continuation remaining.
73
172
 
74
173
  <a id="extensionapi-methods"></a>
75
174
 
@@ -105,6 +204,19 @@ Use each event’s declared result type rather than assuming every return value
105
204
 
106
205
  Events cover resource discovery, sessions, agent and message lifecycle, providers, tools, and raw input.
107
206
 
207
+ #### Understand handler composition
208
+
209
+ | Pattern | Behavior |
210
+ |---|---|
211
+ | Notification | Return values are ignored. Use the event for observation only. |
212
+ | In-place mutation | Later handlers see changes to values such as `before_provider_headers.headers`, `before_agent_start.systemPromptOptions`, and `tool_call.input`. |
213
+ | Chained transformation | Later handlers receive the value returned by earlier `input`, `context`, `context_with_system`, `message_end`, `tool_result`, and `before_provider_request` handlers. |
214
+ | Gate | A handled input, blocked tool call, cancelled session operation, or handled `user_bash` command stops that operation's normal fallback path. |
215
+ | Actionable boundary | Each `turn_end` or `agent_before_settle` handler sees the entries and continuation decision proposed so far. |
216
+ | Last override | The last `cache_warming_decision` handler that returns an action wins. |
217
+
218
+ Notification handlers should not perform slow work on a streaming event. Transform handlers should preserve fields they do not intentionally own, and gate handlers should fail closed when their safety decision cannot be made.
219
+
108
220
  `before_agent_start` exposes both the current prompt and its structured `systemPromptOptions`. `event.messageType` says what started the run: `"user"` for a prompt or `pi.sendUserMessage()`, with `prompt` and `images`; `"custom"` for `pi.sendMessage(..., { triggerTurn: true })`, with the starting `message` and no `prompt`. A returned `message` is added to either kind of run; check `messageType` to skip runs started by custom messages. Prefer changing prompt sections, selected tools, or guidelines so HUMAIN Code CLI can append a transcript delta. Returning `systemPrompt`, or setting `forceSystemPrompt`, replaces the whole prompt for that run while the transcript continues recording the structured sections. Providers receive the forced text as their leading system prompt.
109
221
 
110
222
  `message_end` can replace a finalized message while preserving its role. `tool_call` can mutate input or block execution. `tool_result` handlers compose, with each handler seeing prior changes.
@@ -282,7 +394,18 @@ Use `ctx.shutdown()` to request an orderly process shutdown.
282
394
 
283
395
  ## Examples and reference
284
396
 
285
- The checked [extension examples](../examples/extensions/) cover tools, lifecycle events, commands, flags, shortcuts, state, rendering, providers, OAuth, remote execution, and terminal components.
286
- Start with the smallest example matching your integration point.
287
-
288
- Use [Custom Providers](custom-provider.md) for model-service integrations, [Terminal UI](tui.md) for custom components, and [HUMAIN Code CLI Packages](packages.md) to install or distribute extensions with other resources.
397
+ The checked [extension examples](../examples/extensions/) are the implementation reference. Start with the smallest example matching the behavior you need:
398
+
399
+ | Goal | Start with | Why |
400
+ |---|---|---|
401
+ | Confirm or block tool calls | [`permission-gate.ts`](../examples/extensions/permission-gate.ts) | Combines `tool_call`, mode-aware UI, and fail-closed behavior. |
402
+ | Modify prompt sections for a run | [`prompt-customizer.ts`](../examples/extensions/prompt-customizer.ts) | Uses structured prompt options instead of replacing the complete prompt. |
403
+ | Keep branch-aware tool state | [`todo.ts`](../examples/extensions/todo.ts) | Reconstructs state from persisted entries and renders it in the TUI. |
404
+ | Register tools after startup | [`dynamic-tools.ts`](../examples/extensions/dynamic-tools.ts) | Shares registration logic between lifecycle and command handlers. |
405
+ | Run cancellable model work from a command | [`qna.ts`](../examples/extensions/qna.ts) | Combines nested model calls, cancellation, and custom UI. |
406
+ | Replace the main editor | [`modal-editor.ts`](../examples/extensions/modal-editor.ts) | Extends `CustomEditor` while preserving application controls. |
407
+ | Run finalization at shutdown | [`auto-commit-on-exit.ts`](../examples/extensions/auto-commit-on-exit.ts) | Uses the session shutdown hook for finalization work. |
408
+ | Route built-in tools to another machine | [`ssh.ts`](../examples/extensions/ssh.ts) | Reuses tool operation interfaces instead of recreating tool contracts. |
409
+ | Add OAuth and provider-specific streaming | [`custom-provider-gitlab-duo/`](../examples/extensions/custom-provider-gitlab-duo/) | Shows a complete provider integration while delegating supported protocols. |
410
+
411
+ Use [Custom Providers](custom-provider.md) for model-service integrations, [Terminal UI](tui.md) for custom components, and [HUMAIN Code CLI Packages](packages.md) to install or distribute extensions with other resources. Use the exported declarations for exact signatures, payloads, and result schemas; this guide focuses on lifecycle choices, composition, and durable implementation patterns.
@@ -0,0 +1,197 @@
1
+ # Models Configuration
2
+
3
+ <!-- This file is generated from TypeScript source. Do not edit it manually; run npm run generate:references. -->
4
+
5
+ This reference lists the fields of `models.json`. See [Configure a compatible endpoint](models.md#configure-a-compatible-endpoint) for examples and [Configuration](configuration.md#agent-directory) for the file location.
6
+
7
+ Add `"$schema": "https://pi.dev/schemas/models.schema.json"` to `models.json` for editor validation and completion.
8
+
9
+ ## Providers
10
+
11
+ Each key under `providers` is a provider ID. A built-in provider ID changes that provider. Any other ID adds a provider, which needs `baseUrl` and an `api` at provider or model level.
12
+
13
+ | Field | Type | Default | Description |
14
+ |---|---|---|---|
15
+ | `name` | string | | Display name. |
16
+ | `baseUrl` | string | | API base URL. Also applies to the provider's built-in models. |
17
+ | `apiKey` | string | | Literal key, "$NAME" environment interpolation, or "!command" output. |
18
+ | `api` | string | | API for the provider's models, such as "openai-completions", "openai-responses", "anthropic-messages", or "google-generative-ai". |
19
+ | `oauth` | `"radius"` | | OAuth login flow. Requires baseUrl. |
20
+ | `headers` | object | | Request headers. Values resolve like apiKey. |
21
+ | `compat` | [object](#compatibility) | | Provider and model compatibility overrides. |
22
+ | `authHeader` | boolean | `false` | Whether to send the resolved API key as Authorization: Bearer. |
23
+ | `models` | [`object[]`](#models) | | |
24
+ | `modelOverrides` | [object](#model-overrides) | | |
25
+
26
+ ## Models
27
+
28
+ Each `models` entry adds a model to the provider. An entry whose `id` matches an existing model replaces it.
29
+
30
+ | Field | Type | Default | Description |
31
+ |---|---|---|---|
32
+ | `id` | string | | Required. Model ID sent to the API. |
33
+ | `name` | string | | Display name, also matched by --model patterns. |
34
+ | `api` | string | | Overrides the provider api. |
35
+ | `baseUrl` | string | | Overrides the provider baseUrl. |
36
+ | `reasoning` | boolean | `false` | Whether the model supports thinking. |
37
+ | `thinkingLevelMap` | object | | Provider value sent for each thinking level. null marks a level unsupported. Levels the model does not map use the provider's default value through high; xhigh and max are unsupported. |
38
+ | `input` | `("text" \| "image")[]` | `["text"]` | |
39
+ | `inputLimits` | [object](#input-limits) | | |
40
+ | `cost` | object | | |
41
+ | `cost.input` | number | | Required. Input cost in USD per million tokens. |
42
+ | `cost.output` | number | | Required. Output cost in USD per million tokens. |
43
+ | `cost.cacheRead` | number | | Required. Cache-read cost in USD per million tokens. |
44
+ | `cost.cacheWrite` | number | | Required. Cache-write cost in USD per million tokens. |
45
+ | `cost.tiers` | `object[]` | | Request-wide pricing tiers. The highest matching input threshold applies to the full request. |
46
+ | `cost.tiers[].inputTokensAbove` | number | | Required. Use this tier when total request input exceeds this token count. |
47
+ | `cost.tiers[].input` | number | | Required. Input cost in USD per million tokens. |
48
+ | `cost.tiers[].output` | number | | Required. Output cost in USD per million tokens. |
49
+ | `cost.tiers[].cacheRead` | number | | Required. Cache-read cost in USD per million tokens. |
50
+ | `cost.tiers[].cacheWrite` | number | | Required. Cache-write cost in USD per million tokens. |
51
+ | `promptCache` | object | | Best-effort prompt cache lifetime in seconds for the short and long retention tiers. Pi warms only tiers with a known lifetime. |
52
+ | `contextWindow` | number | `128000` | Context window in tokens. |
53
+ | `maxTokens` | number | `16384` | Maximum output tokens. |
54
+ | `samplingParams` | object | | Fields merged into every request body. Applies only to OpenAI-compatible APIs. |
55
+ | `samplingParamsByThinkingLevel` | object | | samplingParams per thinking level, merged over samplingParams. |
56
+ | `headers` | object | | Request headers. Values resolve like apiKey. |
57
+ | `compat` | [object](#compatibility) | | Provider and model compatibility overrides. |
58
+
59
+ ## Model overrides
60
+
61
+ Each `modelOverrides` key is the ID of a built-in or extension model. Unknown IDs are ignored. Object fields, such as `cost`, merge with the model's value field by field; other fields replace it.
62
+
63
+ | Field | Type | Default | Description |
64
+ |---|---|---|---|
65
+ | `name` | string | | Display name, also matched by --model patterns. |
66
+ | `reasoning` | boolean | | Whether the model supports thinking. |
67
+ | `thinkingLevelMap` | object | | Provider value sent for each thinking level. null marks a level unsupported. Levels the model does not map use the provider's default value through high; xhigh and max are unsupported. |
68
+ | `input` | `("text" \| "image")[]` | | |
69
+ | `inputLimits` | [object](#input-limits) | | |
70
+ | `cost` | object | | |
71
+ | `cost.input` | number | | Input cost in USD per million tokens. |
72
+ | `cost.output` | number | | Output cost in USD per million tokens. |
73
+ | `cost.cacheRead` | number | | Cache-read cost in USD per million tokens. |
74
+ | `cost.cacheWrite` | number | | Cache-write cost in USD per million tokens. |
75
+ | `cost.tiers` | `object[]` | | Request-wide pricing tiers. The highest matching input threshold applies to the full request. |
76
+ | `cost.tiers[].inputTokensAbove` | number | | Required. Use this tier when total request input exceeds this token count. |
77
+ | `cost.tiers[].input` | number | | Required. Input cost in USD per million tokens. |
78
+ | `cost.tiers[].output` | number | | Required. Output cost in USD per million tokens. |
79
+ | `cost.tiers[].cacheRead` | number | | Required. Cache-read cost in USD per million tokens. |
80
+ | `cost.tiers[].cacheWrite` | number | | Required. Cache-write cost in USD per million tokens. |
81
+ | `promptCache` | object | | Best-effort prompt cache lifetime in seconds for the short and long retention tiers. Pi warms only tiers with a known lifetime. |
82
+ | `contextWindow` | number | | Context window in tokens. |
83
+ | `maxTokens` | number | | Maximum output tokens. |
84
+ | `samplingParams` | object | | Fields merged into every request body. Applies only to OpenAI-compatible APIs. |
85
+ | `samplingParamsByThinkingLevel` | object | | samplingParams per thinking level, merged over samplingParams. |
86
+ | `headers` | object | | Request headers. Values resolve like apiKey. |
87
+ | `compat` | [object](#compatibility) | | Provider and model compatibility overrides. |
88
+
89
+ ## Input limits
90
+
91
+ See [Describe model input and caching](models.md#describe-model-input-and-caching).
92
+
93
+ | Field | Type | Default | Description |
94
+ |---|---|---|---|
95
+ | `maxRequestBytes` | integer | | Maximum serialized provider request size in bytes. |
96
+ | `images` | object | | |
97
+ | `images.resize` | object | | Cache-safe resize profile applied before a new image enters conversation history. |
98
+ | `images.resize.maxWidth` | integer | | |
99
+ | `images.resize.maxHeight` | integer | | |
100
+ | `images.resize.maxBytes` | integer | | Maximum base64-encoded payload size in bytes. |
101
+ | `images.resize.jpegQuality` | integer | | |
102
+ | `images.maxPerMessage` | integer | | Maximum images accepted in one provider message. |
103
+ | `images.maxPerRequest` | integer | | Maximum images accepted across one provider request. |
104
+
105
+ ## Compatibility
106
+
107
+ `compat` describes verified differences from an API's standard request and response behavior. Model values override provider values per field. The fields that apply depend on the model's `api`.
108
+
109
+ ### `openai-completions`
110
+
111
+ | Field | Type | Default | Description |
112
+ |---|---|---|---|
113
+ | `supportsStore` | boolean | | Whether the provider supports the store field. Default: auto-detected from URL. |
114
+ | `supportsDeveloperRole` | boolean | | Whether the provider supports the developer role instead of system. Default: auto-detected from URL. |
115
+ | `supportsReasoningEffort` | boolean | | Whether the provider supports reasoning_effort. Default: auto-detected from URL. |
116
+ | `supportsUsageInStreaming` | boolean | `true` | Whether the provider supports stream_options.include_usage for token usage in streaming responses. |
117
+ | `supportsFinishReason` | boolean | `true` | Whether streamed responses include finish_reason. When false, pi infers stop or toolUse when the stream ends. |
118
+ | `maxTokensField` | `"max_completion_tokens" \| "max_tokens"` | | Which field to use for max tokens. Default: auto-detected from URL. |
119
+ | `requiresToolResultName` | boolean | | Whether tool results require the name field. Default: auto-detected from URL. |
120
+ | `requiresAssistantAfterToolResult` | boolean | | Whether a user message after tool results requires an assistant message in between. Default: auto-detected from URL. |
121
+ | `requiresThinkingAsText` | boolean | | Whether thinking blocks must be converted to text blocks with &lt;thinking> delimiters. Default: auto-detected from URL. |
122
+ | `requiresReasoningContentOnAssistantMessages` | boolean | | Whether all replayed assistant messages must include an empty reasoning_content field when reasoning is enabled. Default: auto-detected from URL. |
123
+ | `inlineThinkTags` | boolean | | Whether a leading &lt;think>...&lt;/think> section in streamed content is reasoning and is parsed into thinking blocks. Default: false. |
124
+ | `thinkingFormat` | `"openai" \| "openrouter" \| "deepseek" \| "together" \| "baseten" \| "zai" \| "qwen" \| "chat-template" \| "qwen-chat-template" \| "string-thinking" \| "ant-ling"` | | Format for reasoning or thinking parameters. When omitted, Pi auto-detects the format from the provider URL. "openai" uses reasoning_effort, "openrouter" uses reasoning.effort, "deepseek" uses thinking.type plus reasoning_effort when supported, "together" uses reasoning.enabled plus reasoning_effort when supported, "baseten" uses configurable chat_template_args plus reasoning_effort when supported, "zai" uses thinking.type, "qwen" uses top-level enable_thinking, "qwen-chat-template" uses chat_template_kwargs.enable_thinking and preserve_thinking, "chat-template" uses configurable chat_template_kwargs, "string-thinking" uses top-level thinking, and "ant-ling" uses reasoning.effort only when the mapped effort is non-null. |
125
+ | `chatTemplateKwargs` | object | | Kwargs sent as chat_template_kwargs when thinkingFormat is "chat-template". Use $var with "thinking.enabled", "thinking.effort", or "thinking.budget" for pi-controlled values. |
126
+ | `chatTemplateArgs` | object | | Arguments sent as chat_template_args when thinkingFormat is "baseten". Use $var with "thinking.enabled", "thinking.effort", or "thinking.budget" for pi-controlled values. |
127
+ | `openRouterRouting` | object | | OpenRouter provider routing preferences. Controls which upstream providers OpenRouter routes requests to. Sent as the provider field in the OpenRouter API request body. See https://openrouter.ai/docs/guides/routing/provider-selection. |
128
+ | `vercelGatewayRouting` | object | | Vercel AI Gateway routing preferences. Controls which upstream providers the gateway routes requests to. See https://vercel.com/docs/ai-gateway/models-and-providers/provider-options. |
129
+ | `zaiToolStream` | boolean | `false` | Whether z.ai supports top-level tool_stream for streaming tool call deltas. |
130
+ | `thinkingTokenBudgetField` | `"thinking_token_budget" \| "thinking_budget" \| "thinking_budget_tokens"` | | Top-level request field used to cap reasoning tokens from thinkingBudgets. Reasoning and the answer share max_tokens on these endpoints. "thinking_token_budget" is vLLM, "thinking_budget" is Qwen, DashScope, or SGLang, and "thinking_budget_tokens" is llama.cpp. Off by default and not set on the generated catalog. |
131
+ | `supportsThinkingTokenBudget` | boolean | `false` | Alias for thinkingTokenBudgetField: "thinking_token_budget" (vLLM). Prefer thinkingTokenBudgetField. |
132
+ | `supportsOpenAIGrammarTools` | boolean | `false` | Whether the provider supports OpenAI custom tools with Lark or regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. The generated catalog enables this for capable models. |
133
+ | `supportsMidConvoSystemMessages` | boolean | `false` | Whether the exact model accepts system or developer messages after the conversation has started. When false, later system messages are folded into the leading system message. The generated catalog enables this for verified models. |
134
+ | `supportsMidConvoToolAdditions` | boolean | `false` | Whether system messages can introduce additional tools mid-conversation. Requires supportsMidConvoSystemMessages. The generated catalog enables this for capable models. |
135
+ | `supportsStrictMode` | boolean | `false` | Whether the provider supports the strict field in tool definitions. Generated capable models enable it explicitly. |
136
+ | `cacheControlFormat` | `"anthropic"` | | Cache control convention for prompt caching. Anthropic applies cache_control markers to the system prompt, last tool definition, and last user, assistant, or tool-result text content. |
137
+ | `sendSessionAffinityHeaders` | boolean | | Whether to send session-affinity data from options.sessionId. Default: true for OpenRouter endpoints, false otherwise. |
138
+ | `sessionAffinityFormat` | `"openai" \| "openai-nosession" \| "openrouter"` | | Session-affinity header format. openai sends session_id, x-client-request-id, and x-session-affinity; openai-nosession sends x-client-request-id and x-session-affinity; openrouter sends x-session-id. Does not affect prompt_cache_key. Default: auto-detected. |
139
+ | `supportsLongCacheRetention` | boolean | | Whether the provider supports long prompt cache retention (prompt_cache_retention: "24h" or Anthropic-style cache_control.ttl: "1h", depending on format). Default: auto-detected from provider and URL. |
140
+ | `vllmPriority` | number | | vLLM scheduler priority sent as the top-level priority request field. Lower values are handled earlier and the server default is 0. Only meaningful with --scheduling-policy priority. Off by default and not set on the generated catalog. |
141
+
142
+ ### `openai-responses`
143
+
144
+ Also applies to `azure-openai-responses` and `openai-codex-responses`.
145
+
146
+ | Field | Type | Default | Description |
147
+ |---|---|---|---|
148
+ | `supportsDeveloperRole` | boolean | `true` | Whether the provider supports the developer role instead of system. |
149
+ | `supportsMidConvoSystemMessages` | boolean | `false` | Whether the exact model accepts developer or system messages after the conversation has started. When false, later system messages are folded into the leading system message. The generated catalog enables this for verified models. |
150
+ | `sessionAffinityFormat` | `"openai" \| "openai-nosession" \| "openrouter"` | | Session-affinity header format. openai sends session_id and x-client-request-id; openai-nosession sends x-client-request-id; openrouter sends x-session-id. Does not affect prompt_cache_key. Default: auto-detected. |
151
+ | `supportsLongCacheRetention` | boolean | `true` | Whether the provider supports long prompt cache retention. This uses prompt_cache_options.ttl: "30m" on GPT-5.6+ and prompt_cache_retention: "24h" on earlier models. |
152
+ | `supportsStrictMode` | boolean | | Whether the provider supports strict JSON-schema function tools. Defaults are API-specific; generated OpenAI models enable it explicitly. |
153
+ | `supportsOpenAIGrammarTools` | boolean | `false` | Whether to emit OpenAI custom tools with Lark or regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. The generated catalog enables this for capable models. |
154
+ | `supportsAdditionalTools` | boolean | `false` | Whether the model supports message-anchored additional_tools input items. |
155
+ | `supportsToolSearch` | boolean | `false` | Whether the model supports client-executed tool search for transcript-anchored additions. |
156
+ | `supportsExplicitPromptCacheMode` | boolean | `false` | Whether the model accepts prompt_cache_options. Older OpenAI models reject the parameter. |
157
+ | `supportsMidConvoEffort` | boolean | `false` | Whether thinking level changes are sent as configuration_update input items instead of changing reasoning.effort, so a change keeps the prompt cache. Only used by the openai-responses API, and ignored with Sign in with ChatGPT on the openai provider. |
158
+ | `supportsMaxOutputTokens` | boolean | `true` | Whether the provider accepts max_output_tokens. Some Codex-protocol gateways reject it. |
159
+
160
+ ### `anthropic-messages`
161
+
162
+ | Field | Type | Default | Description |
163
+ |---|---|---|---|
164
+ | `supportsEagerToolInputStreaming` | boolean | `true` | Whether the provider accepts per-tool eager_input_streaming. When false, the Anthropic provider omits tools[].eager_input_streaming and sends the legacy fine-grained-tool-streaming-2025-05-14 beta header for tool-enabled requests. |
165
+ | `supportsLongCacheRetention` | boolean | `true` | Whether the provider supports Anthropic long cache retention through cache_control.ttl. |
166
+ | `sendSessionAffinityHeaders` | boolean | | Whether to send x-session-affinity from options.sessionId when caching is enabled. Required for providers like Fireworks that use session affinity for prompt cache routing; requests to the same replica maximize cache hits. Default: true for OpenRouter endpoints, false otherwise. |
167
+ | `sessionAffinityFormat` | `"openrouter"` | | Session-affinity format. openrouter sends x-session-id; when unset, sends x-session-affinity. |
168
+ | `supportsCacheControlOnTools` | boolean | `true` | Whether the provider supports Anthropic-style cache_control markers on tool definitions. When false, cache_control is omitted from tool parameters. Some Anthropic-compatible providers, such as Fireworks, do not support this field on tools and may reject or ignore it. |
169
+ | `supportsTemperature` | boolean | `true` | Ignored. The Anthropic Messages API version in use (2026-10-21) has no temperature field, so temperature is never sent. |
170
+ | `forceAdaptiveThinking` | boolean | `false` | Whether to force adaptive thinking (thinking.type: adaptive plus output_config.effort) regardless of model ID. Built-in models that require adaptive thinking set this in generated metadata. Custom Anthropic-compatible providers can set this to true for any model whose upstream requires the adaptive format. Set false to opt out on overridden built-in models. |
171
+ | `allowEmptySignature` | boolean | `false` | Whether to replay empty thinking signatures instead of converting thinking to text. |
172
+ | `supportsStrictTools` | boolean | `false` | Whether the provider supports Anthropic strict tool schemas. Generated Anthropic models enable it explicitly. |
173
+ | `supportsMidConvoEffort` | boolean | `false` | Whether the exact model transport supports effort-only system messages and thinking binding controls. |
174
+ | `supportsMidConvoSystemMessages` | boolean | `false` | Whether the exact model accepts system-role messages inside the conversation. When false, later system messages are folded into the top-level system prompt. |
175
+ | `supportsMidConvoToolChanges` | boolean | `false` | Whether the exact model accepts mid-conversation tool_addition and tool_removal blocks. Requires supportsMidConvoSystemMessages. |
176
+ | `allowedFallbackModels` | `object[]` | | Models Anthropic accepts for server-side refusal fallback, with local pricing metadata for returned fallback responses. When absent or empty, callers must omit fallbacks; Anthropic rejects the field for models with no permitted fallback targets. |
177
+
178
+ ### `bedrock-converse-stream`
179
+
180
+ | Field | Type | Default | Description |
181
+ |---|---|---|---|
182
+ | `supportsStrictMode` | boolean | `false` | Whether the model supports Bedrock strict tool schemas. |
183
+
184
+ ### `mistral-conversations`
185
+
186
+ | Field | Type | Default | Description |
187
+ |---|---|---|---|
188
+ | `supportsMidConvoSystemMessages` | boolean | `false` | Whether the exact model accepts system messages after the conversation has started. When false, later system messages are folded into the leading system message. |
189
+
190
+ ### `typesafe-system-one`
191
+
192
+ Also applies to `cloudflare-workers-ai-system-one`.
193
+
194
+ | Field | Type | Default | Description |
195
+ |---|---|---|---|
196
+ | `imageInput` | `"assets" \| "images" \| "state-image-urls"` | | How the service takes classifier images. "assets" sends TypeSafe's assets map (PNG and JPEG) and references the images from the state, as TypeSafe and Jev on Workers AI expect. "images" sends Clef's images list of data URLs (PNG, JPEG, and WebP, at most four), as Clef on Workers AI expects. "state-image-urls" places image_url parts before the state, as OpenRouter expects; OpenRouter drops assets without an error. Auto-detected from the provider, baseUrl, and model ID. Classifier models read it from the provider-level compat; models and modelOverrides entries apply to chat models only. |
197
+ | `sendImageOptInHeader` | boolean | | Whether requests with images send the TypeSafe-Danger-Zone-Images: true header, which TypeSafe's own API requires for its experimental image input. Defaults to true for the typesafe-system-one API unless the model is detected as OpenRouter. |
package/docs/models.md CHANGED
@@ -62,10 +62,22 @@ Use [`models.json`](configuration.md#agent-directory) when an endpoint speaks an
62
62
  }
63
63
  ```
64
64
 
65
- The dummy key makes the model available to HUMAIN Code CLI; Ollama ignores it. For an authenticated endpoint, `apiKey` and header values can use `$NAME` or `${NAME}` environment interpolation, a literal value, or a leading `!command`. Commands in `models.json` run at request time and are not cached by HUMAIN Code CLI.
65
+ The dummy key makes the model available to HUMAIN Code CLI; Ollama ignores it. For an authenticated endpoint, `apiKey` and header values can use `$NAME` or `${NAME}` environment interpolation, a literal value, or a leading `!command`. `$$` and `$!` produce a literal `$` and `!`. Commands in `models.json` run at request time and are not cached by HUMAIN Code CLI.
66
66
 
67
67
  Opening `/model` reloads the file. A `models` entry adds or replaces a model with the same ID on that provider. Use `modelOverrides` to change metadata for an existing built-in or extension-provided model without replacing the provider's model list. Unknown override IDs are ignored.
68
68
 
69
+ To route a built-in provider through a proxy, set only its `baseUrl`. Its models and authentication stay unchanged:
70
+
71
+ ```json
72
+ {
73
+ "providers": {
74
+ "anthropic": { "baseUrl": "https://proxy.example.com/v1" }
75
+ }
76
+ }
77
+ ```
78
+
79
+ [Models Configuration](models-configuration.md) lists every field.
80
+
69
81
  ### Describe model input and caching
70
82
 
71
83
  Use `inputLimits.images.resize` to control how HUMAIN Code CLI encodes new image attachments, `read` results, and tool-result images before storing them in conversation history:
@@ -129,20 +141,20 @@ Compatibility settings should describe verified differences in the endpoint's re
129
141
 
130
142
  ## Use classifier models
131
143
 
132
- Classifier models do not chat. They answer typed questions about JSON state: pick one of several choices, answer yes or no, or give a score, each with probabilities. HUMAIN Code CLI includes TypeSafe's Jev model from these providers, Cloudflare's Clef and Clef Flash models from Workers AI, and OpenAI's GPT-6 Luna through the [Decisions API](https://developers.openai.com/api/docs/guides/decisions):
144
+ Classifier models do not chat. They answer typed questions about JSON state: pick one of several choices, answer yes or no, or give a score, each with probabilities. HUMAIN Code CLI includes TypeSafe's Jev model from these providers, Cloudflare's Clef, Clef Flash, and Clef Omni models from Workers AI and OpenRouter, and OpenAI's GPT-6 Luna through the [Decisions API](https://developers.openai.com/api/docs/guides/decisions):
133
145
 
134
146
  | Provider | Model IDs | Authentication |
135
147
  |---|---|---|
136
148
  | `typesafe` | `jev-latest` | `TYPESAFE_API_KEY` |
137
- | `openrouter` | `typesafe/jev-1.13`, `~typesafe/jev-latest` | `OPENROUTER_API_KEY` or `/login` |
138
- | `cloudflare-workers-ai` | `typesafe/jev`, `@cf/cloudflare/clef`, `@cf/cloudflare/clef-flash` | `CLOUDFLARE_API_KEY` and `CLOUDFLARE_ACCOUNT_ID` |
149
+ | `openrouter` | `typesafe/jev-1.13`, `typesafe/jev-1.14`, `~typesafe/jev-latest`, `cloudflare/clef`, `cloudflare/clef-flash`, `cloudflare/clef-omni` | `OPENROUTER_API_KEY` or `/login` |
150
+ | `cloudflare-workers-ai` | `typesafe/jev`, `typesafe/jev-1.14.0`, `@cf/cloudflare/clef`, `@cf/cloudflare/clef-flash`, `@cf/cloudflare/clef-omni` | `CLOUDFLARE_API_KEY` and `CLOUDFLARE_ACCOUNT_ID` |
139
151
  | `vercel-ai-gateway` | `typesafe-ai/jev` | `AI_GATEWAY_API_KEY` |
140
152
  | `opencode` | `jev-1.13`, `jev-1.13-free` | `OPENCODE_API_KEY` |
141
153
  | `openai` | `gpt-6-luna` | `OPENAI_API_KEY` |
142
154
 
143
155
  Chat models on a [llama.cpp router](llama-cpp.md#classification) are also listed as classifier models.
144
156
 
145
- OpenAI's Decisions API needs an API key. Sign in with ChatGPT credentials do not work with it, so `gpt-6-luna` is not listed as available while `openai` is logged in through `/login`, even when `OPENAI_API_KEY` is set; log out of `openai` to use the key. GPT-6 Luna also judges images passed in `images` (see [Codemode](codemode.md#classify)); other classifier models return an error for them. The API rejects inputs above 922K tokens, but requests that run longer than about five seconds, currently above roughly 600K input tokens, fail with a gateway timeout.
157
+ OpenAI's Decisions API needs an API key. Sign in with ChatGPT credentials do not work with it, so `gpt-6-luna` is not listed as available while `openai` is logged in through `/login`, even when `OPENAI_API_KEY` is set; log out of `openai` to use the key. The API rejects inputs above 922K tokens, but requests that run longer than about five seconds, currently above roughly 600K input tokens, fail with a gateway timeout.
146
158
 
147
159
  Classifier models do not appear in `/model`. The model reaches them through the [`codemode`](cli.md#enable-codemode) tool, which is off unless an MCP server turned it on. Enable it with `"defaultTools": ["+codemode"]` in [settings](settings.md#tools). Scripts then list classifier models with `models.getAvailableOfType("classifier")` and call `models.classify(model, { state, questions })`:
148
160
 
@@ -163,6 +175,10 @@ return result.answers;
163
175
 
164
176
  [Codemode](codemode.md#classify) describes the question and answer types.
165
177
 
178
+ Classifier models whose `input` includes `"image"` also judge images passed in `images`; other classifier models return an error for them. Image input works with GPT-6 Luna, with Jev from `typesafe` and `cloudflare-workers-ai`, with Clef from `cloudflare-workers-ai`, and with the OpenRouter models whose catalog lists image input. Jev takes PNG and JPEG images, and image input is experimental on TypeSafe's own API. Clef takes PNG, JPEG, and WebP images, at most four per request. Jev from `vercel-ai-gateway` and `opencode` takes text only.
179
+
180
+ Each System One service takes images in its own request format, set by the model's `compat.imageInput`. Built-in models set it, so overriding a provider's `baseUrl` keeps it. A custom provider that proxies another service's classifiers sets it in its provider-level `compat` in `models.json` (see [System One compatibility](models-configuration.md#typesafe-system-one)). OpenRouter in particular answers requests in TypeSafe's format without an error but drops the images.
181
+
166
182
  When the service reports token counts, as all System One services do, `result.usage` carries them with their cost. HUMAIN Code CLI adds the usage of a script's classifier calls to the `codemode` tool result, so it counts toward the session cost in the footer and `/session`. The cost uses the model's catalog price; models without one, such as TypeSafe's direct `jev-latest`, report tokens at no cost.
167
183
 
168
184
  Extensions call classifiers through `ctx.modelRegistry.classify()`, without codemode. [Virtual models](virtual-models.md#route-requests) can use them to route requests; see the `jev-router.ts` example.
package/docs/settings.md CHANGED
@@ -120,7 +120,7 @@ CLI tool options override this setting for one invocation. `--tools` with only `
120
120
  | Setting | Type | Default | Description |
121
121
  |---|---|---|---|
122
122
  | `compaction.enabled` | boolean | `true` | Enable automatic compaction. |
123
- | `compaction.reserveTokens` | number | `16384` | Tokens reserved for the model response. |
123
+ | `compaction.reserveTokens` | number | `16384` | Free context tokens below which automatic compaction starts. |
124
124
  | `compaction.keepRecentTokens` | number | `20000` | Recent tokens retained without summarization. |
125
125
  | `compaction.modelOverrides` | object | None | Per-model token settings keyed by exact `provider/modelId`. |
126
126
 
@@ -24,12 +24,22 @@ Extensions, prompt templates, and skills can add commands. The command menu in P
24
24
  | `/resume` | Switch to another saved session |
25
25
  | `/name [name]` | Set the session display name, or show the current name when omitted |
26
26
  | `/session` | Show current session information and statistics |
27
+ | `/usage` | Show session tokens, cost and context, plus the subscription limits of the active OpenAI Codex or Claude account (see [/usage](#usage)) |
27
28
  | `/tree` | Navigate the session tree |
28
29
  | `/fork` | Create a new session from an earlier user message |
29
30
  | `/clone` | Duplicate the current session at its current position |
30
31
  | `/compact [instructions]` | Compact the current context, optionally with custom instructions |
31
32
  | `/import <path>` | Import and resume a JSONL session |
32
33
 
34
+ ### /usage
35
+
36
+ `/usage` opens a popup with the session's tokens, cost and context use. It is available in interactive mode only. With a subscription sign-in it also shows one bar per limit window, each with the percentage used and its reset time:
37
+
38
+ - **OpenAI Codex (ChatGPT subscription):** every window the active account's usage route reports. This is the route `/accounts` reads. The popup shows the 5h and weekly windows first, then additional limits (named by the provider, for example `GPT-5.3-Codex-Spark 5h`) and the code review limit. A reached limit is shown in the error color. A credits line shows `unlimited`, the balance, or `none`.
39
+ - **Claude subscription:** the 5h, weekly, weekly Opus, weekly Sonnet and weekly OAuth apps limits, plus extra usage as a percentage when it is enabled. These come from Anthropic's undocumented subscription usage endpoint (`https://api.anthropic.com/api/oauth/usage`), requested with the active Anthropic account's token, without redirects. Results are cached for 60 seconds, and a rate-limit response is remembered for its `Retry-After`. If the live request fails, the popup shows Claude Code's cached limits from `~/.claude.json` and their age. The live failure reason is shown only when that fallback also fails.
40
+
41
+ Limits are read only for a subscription sign-in. They do not apply to API-key use of the same provider. Other providers' subscription limits are not shown.
42
+
33
43
  ## Export and share
34
44
 
35
45
  | Command | Description |
package/docs/tui.md CHANGED
@@ -65,6 +65,76 @@ Regular mode leaves mouse input to the terminal because the terminal owns scroll
65
65
 
66
66
  `ctx.ui.custom()` temporarily gives one component control of the interactive area and resolves when that component calls the supplied completion callback.
67
67
 
68
+ ### Build a minimal custom screen
69
+
70
+ This complete extension shows the custom-component lifecycle: render within the supplied width, use injected keybindings, invalidate cached output after state changes, request a render, and finish through `done()`.
71
+
72
+ ```typescript
73
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
74
+ import { truncateToWidth } from "@earendil-works/pi-tui";
75
+
76
+ export default function (pi: ExtensionAPI) {
77
+ pi.registerCommand("pick-target", {
78
+ description: "Pick a deployment target",
79
+ handler: async (_args, ctx) => {
80
+ if (ctx.mode !== "tui") {
81
+ ctx.ui.notify("pick-target requires interactive mode", "error");
82
+ return;
83
+ }
84
+
85
+ const choices = ["development", "staging", "production"];
86
+ const selected = await ctx.ui.custom<string | undefined>((tui, theme, keybindings, done) => {
87
+ let selectedIndex = 0;
88
+ let cachedWidth: number | undefined;
89
+ let cachedLines: string[] | undefined;
90
+
91
+ const invalidate = () => {
92
+ cachedWidth = undefined;
93
+ cachedLines = undefined;
94
+ };
95
+
96
+ return {
97
+ render(width: number): string[] {
98
+ if (cachedLines && cachedWidth === width) return cachedLines;
99
+
100
+ cachedWidth = width;
101
+ cachedLines = [
102
+ theme.fg("accent", "Choose a deployment target"),
103
+ ...choices.map((choice, index) => `${index === selectedIndex ? "> " : " "}${choice}`),
104
+ theme.fg("dim", "up/down move, enter selects, escape cancels"),
105
+ ].map((line) => truncateToWidth(line, width));
106
+ return cachedLines;
107
+ },
108
+ handleInput(data: string): void {
109
+ if (keybindings.matches(data, "tui.select.up")) {
110
+ selectedIndex = (selectedIndex - 1 + choices.length) % choices.length;
111
+ } else if (keybindings.matches(data, "tui.select.down")) {
112
+ selectedIndex = (selectedIndex + 1) % choices.length;
113
+ } else if (keybindings.matches(data, "tui.select.confirm")) {
114
+ done(choices[selectedIndex]);
115
+ return;
116
+ } else if (keybindings.matches(data, "tui.select.cancel")) {
117
+ done(undefined);
118
+ return;
119
+ } else {
120
+ return;
121
+ }
122
+
123
+ invalidate();
124
+ tui.requestRender();
125
+ },
126
+ invalidate,
127
+ };
128
+ });
129
+
130
+ if (selected) ctx.ui.notify(`Selected ${selected}`, "info");
131
+ },
132
+ });
133
+ }
134
+ ```
135
+
136
+ This component does not display a text cursor, so it does not need `Focusable`. A component containing `Input` or `Editor` must implement `Focusable` and propagate its `focused` value to that child.
137
+
68
138
  Pass `overlay: true` to draw above existing content. Overlay options control size, anchors, offsets, margins, and responsive visibility. An overlay handle can change focus or temporarily hide and show the overlay with `setHidden()` while the interaction remains active.
69
139
 
70
140
  Focused overlays retain input ownership across ordinary renders. If another component should receive input while an overlay remains visible, explicitly release or redirect focus through the handle.
package/docs/windows.md CHANGED
@@ -19,8 +19,9 @@ For most native Windows users, installing [Git for Windows](https://git-scm.com/
19
19
  HUMAIN Code CLI resolves Bash in this order:
20
20
 
21
21
  1. `shellPath` from `~/.humain-terminal/agent/settings.json`
22
- 2. Git Bash under `Program Files` or `Program Files (x86)`
23
- 3. `bash.exe` on `PATH`, including Cygwin, MSYS2, or legacy WSL Bash
22
+ 2. Git Bash at `%ProgramFiles%\Git\bin\bash.exe`
23
+ 3. Git Bash at `%ProgramFiles(x86)%\Git\bin\bash.exe`
24
+ 4. `bash.exe` on `PATH`, including Cygwin, MSYS2, or legacy WSL Bash
24
25
 
25
26
  Start HUMAIN Code CLI and enter this command to verify the shell:
26
27
 
@@ -34,6 +35,13 @@ If HUMAIN Code CLI cannot find Bash, it reports the locations it checked. Instal
34
35
 
35
36
  The optional `powershell` tool runs commands through `pwsh.exe` when available, then falls back to Windows PowerShell. It starts PowerShell with `-NoProfile -NonInteractive -ExecutionPolicy Bypass`. Administrator-enforced execution policies can still take precedence.
36
37
 
38
+ PowerShell discovery checks these locations in order:
39
+
40
+ 1. `pwsh.exe` on `PATH`
41
+ 2. `%ProgramFiles%\PowerShell\7\pwsh.exe`
42
+ 3. `powershell.exe` on `PATH`
43
+ 4. `%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe`
44
+
37
45
  To replace the model-facing `bash` tool with `powershell`, add this to `~/.humain-terminal/agent/settings.json`:
38
46
 
39
47
  ```json
@@ -48,6 +56,12 @@ Restart HUMAIN Code CLI, then ask it to run a harmless PowerShell command. The `
48
56
 
49
57
  See [Settings](settings.md#tools) for other tool combinations.
50
58
 
59
+ ## WSL
60
+
61
+ WSL path conversion on Windows and extra Git branch polling in WSL recognize `/mnt/<drive>`, not custom mount roots.
62
+
63
+ When using the legacy WSL `bash.exe` launcher from Windows, HUMAIN Code CLI sends commands over stdin to avoid command-line quoting problems.
64
+
51
65
  ## Use a custom Bash executable
52
66
 
53
67
  Set `shellPath` when Bash is installed somewhere HUMAIN Code CLI does not discover automatically:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "1.3.0",
4
+ "version": "1.4.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -14,6 +14,6 @@
14
14
  ]
15
15
  },
16
16
  "dependencies": {
17
- "@anthropic-ai/sdk": "0.135.0"
17
+ "@anthropic-ai/sdk": "1.2.0"
18
18
  }
19
19
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "1.3.0",
4
+ "version": "1.4.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",