@humain/terminal 0.0.6 → 0.0.7

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 (476) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +10 -4
  3. package/dist/bundle/chunks/anthropic-messages-GDMGYAZB.js +6 -0
  4. package/dist/bundle/chunks/anthropic.js +75 -0
  5. package/dist/bundle/chunks/azure-openai-responses-ZN52D6YC.js +2 -0
  6. package/dist/bundle/chunks/bedrock-converse-stream.js +77 -0
  7. package/dist/bundle/chunks/chunk-3D3G2X5U.js +6 -0
  8. package/dist/bundle/chunks/chunk-3VI4HD7D.js +31 -0
  9. package/dist/bundle/chunks/chunk-6R7UI4IY.js +2 -0
  10. package/dist/bundle/chunks/chunk-72KO4OMP.js +2 -0
  11. package/dist/bundle/chunks/chunk-7DDKXS2Q.js +2 -0
  12. package/dist/bundle/chunks/chunk-ARF4OE6X.js +105 -0
  13. package/dist/bundle/chunks/chunk-BOW22LW6.js +42 -0
  14. package/dist/bundle/chunks/chunk-BZQ53VGE.js +70 -0
  15. package/dist/bundle/chunks/chunk-CBHC6EL7.js +133 -0
  16. package/dist/bundle/chunks/chunk-D7XAASZM.js +4 -0
  17. package/dist/bundle/chunks/chunk-ECWELYBH.js +17 -0
  18. package/dist/bundle/chunks/chunk-GMWCTUPB.js +2 -0
  19. package/dist/bundle/chunks/chunk-H2O6VOXT.js +11 -0
  20. package/dist/bundle/chunks/chunk-HNVPY4LZ.js +5995 -0
  21. package/dist/bundle/chunks/chunk-JUUC5AZY.js +2 -0
  22. package/dist/bundle/chunks/chunk-JXWJOIH4.js +2 -0
  23. package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
  24. package/dist/bundle/chunks/chunk-LVVZS2NO.js +12 -0
  25. package/dist/bundle/chunks/chunk-M2GYSCCG.js +44 -0
  26. package/dist/bundle/chunks/chunk-MA4UUCYX.js +18 -0
  27. package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
  28. package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
  29. package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
  30. package/dist/bundle/chunks/chunk-SGTGQNNP.js +4 -0
  31. package/dist/bundle/chunks/chunk-TEPMHNKQ.js +2 -0
  32. package/dist/bundle/chunks/chunk-TXBQIIIO.js +2 -0
  33. package/dist/bundle/chunks/chunk-WJZ4KLGL.js +2 -0
  34. package/dist/bundle/chunks/chunk-XNGRGP62.js +2 -0
  35. package/dist/bundle/chunks/dist-7DSXV2TY.js +9 -0
  36. package/dist/bundle/chunks/dist-BXEVYJIO.js +7 -0
  37. package/dist/bundle/chunks/es-P2KNSZYR.js +9 -0
  38. package/dist/bundle/chunks/es5-FGTJ7ZFW.js +2 -0
  39. package/dist/bundle/chunks/event-streams-JOSQQSII.js +2 -0
  40. package/dist/bundle/chunks/extract-2L7ZVN7F.js +106 -0
  41. package/dist/bundle/chunks/github-copilot.js +2 -0
  42. package/dist/bundle/chunks/google-generative-ai-XT7NQJ2E.js +2 -0
  43. package/dist/bundle/chunks/google-vertex-IDQ6Z53W.js +2 -0
  44. package/dist/bundle/chunks/image-resize-worker.js +2 -0
  45. package/dist/bundle/chunks/kimi-coding.js +2 -0
  46. package/dist/bundle/chunks/mistral-conversations-HHDZ4FHR.js +5 -0
  47. package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +3 -0
  48. package/dist/bundle/chunks/node-XY3CBY3C.js +294 -0
  49. package/dist/bundle/chunks/node-ZHY4LHC7.js +15 -0
  50. package/dist/bundle/chunks/openai-codex-responses-HRVCDY54.js +8 -0
  51. package/dist/bundle/chunks/openai-codex.js +75 -0
  52. package/dist/bundle/chunks/openai-completions-6QBYTBXY.js +7 -0
  53. package/dist/bundle/chunks/openai-responses-4MWLJHIK.js +2 -0
  54. package/dist/bundle/chunks/openrouter-images-Y2PCWAQH.js +2 -0
  55. package/dist/bundle/chunks/openrouter.js +75 -0
  56. package/dist/bundle/chunks/pdfjs-UKQT3OWY.js +107 -0
  57. package/dist/bundle/chunks/pi-messages-57K43J6J.js +8 -0
  58. package/dist/bundle/chunks/promise-J5TGSM32.js +2 -0
  59. package/dist/bundle/chunks/radius.js +75 -0
  60. package/dist/bundle/chunks/src-QKGKDFSU.js +4 -0
  61. package/dist/bundle/chunks/undici-D6ABF53Q.js +2 -0
  62. package/dist/bundle/chunks/webapi-AFS5FDJJ.js +5 -0
  63. package/dist/bundle/chunks/xai.js +2 -0
  64. package/dist/bundle/cli.js +3 -0
  65. package/dist/bundle/client.js +2 -0
  66. package/dist/bundle/index.js +2 -0
  67. package/dist/bundle/rpc-entry.js +3 -0
  68. package/dist/cli/args.d.ts +1 -0
  69. package/dist/cli/args.d.ts.map +1 -1
  70. package/dist/cli/args.js +29 -9
  71. package/dist/cli/args.js.map +1 -1
  72. package/dist/cli/file-processor.d.ts.map +1 -1
  73. package/dist/cli/file-processor.js +2 -1
  74. package/dist/cli/file-processor.js.map +1 -1
  75. package/dist/config.d.ts +1 -0
  76. package/dist/config.d.ts.map +1 -1
  77. package/dist/config.js +19 -11
  78. package/dist/config.js.map +1 -1
  79. package/dist/core/agent-session.d.ts +50 -14
  80. package/dist/core/agent-session.d.ts.map +1 -1
  81. package/dist/core/agent-session.js +163 -95
  82. package/dist/core/agent-session.js.map +1 -1
  83. package/dist/core/auth-storage.d.ts.map +1 -1
  84. package/dist/core/auth-storage.js +6 -7
  85. package/dist/core/auth-storage.js.map +1 -1
  86. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  87. package/dist/core/compaction/branch-summarization.js +3 -0
  88. package/dist/core/compaction/branch-summarization.js.map +1 -1
  89. package/dist/core/compaction/compaction.d.ts +4 -3
  90. package/dist/core/compaction/compaction.d.ts.map +1 -1
  91. package/dist/core/compaction/compaction.js +41 -32
  92. package/dist/core/compaction/compaction.js.map +1 -1
  93. package/dist/core/defaults.d.ts +1 -0
  94. package/dist/core/defaults.d.ts.map +1 -1
  95. package/dist/core/defaults.js +9 -0
  96. package/dist/core/defaults.js.map +1 -1
  97. package/dist/core/extensions/index.d.ts +2 -2
  98. package/dist/core/extensions/index.d.ts.map +1 -1
  99. package/dist/core/extensions/index.js +1 -1
  100. package/dist/core/extensions/index.js.map +1 -1
  101. package/dist/core/extensions/loader.d.ts.map +1 -1
  102. package/dist/core/extensions/loader.js +115 -48
  103. package/dist/core/extensions/loader.js.map +1 -1
  104. package/dist/core/extensions/types.d.ts +38 -9
  105. package/dist/core/extensions/types.d.ts.map +1 -1
  106. package/dist/core/extensions/types.js +3 -0
  107. package/dist/core/extensions/types.js.map +1 -1
  108. package/dist/core/footer-data-provider.d.ts +1 -1
  109. package/dist/core/footer-data-provider.js +1 -1
  110. package/dist/core/footer-data-provider.js.map +1 -1
  111. package/dist/core/keybindings.d.ts +20 -19
  112. package/dist/core/keybindings.d.ts.map +1 -1
  113. package/dist/core/keybindings.js +26 -5
  114. package/dist/core/keybindings.js.map +1 -1
  115. package/dist/core/model-config.d.ts +5 -0
  116. package/dist/core/model-config.d.ts.map +1 -1
  117. package/dist/core/model-config.js +3 -1
  118. package/dist/core/model-config.js.map +1 -1
  119. package/dist/core/model-resolver.d.ts +1 -0
  120. package/dist/core/model-resolver.d.ts.map +1 -1
  121. package/dist/core/model-resolver.js +14 -8
  122. package/dist/core/model-resolver.js.map +1 -1
  123. package/dist/core/models-store.d.ts.map +1 -1
  124. package/dist/core/models-store.js +2 -1
  125. package/dist/core/models-store.js.map +1 -1
  126. package/dist/core/package-manager.d.ts.map +1 -1
  127. package/dist/core/package-manager.js +22 -14
  128. package/dist/core/package-manager.js.map +1 -1
  129. package/dist/core/pi-manifest.d.ts.map +1 -1
  130. package/dist/core/pi-manifest.js +2 -1
  131. package/dist/core/pi-manifest.js.map +1 -1
  132. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  133. package/dist/core/remote-catalog-provider.js +2 -1
  134. package/dist/core/remote-catalog-provider.js.map +1 -1
  135. package/dist/core/resource-loader.d.ts.map +1 -1
  136. package/dist/core/resource-loader.js +3 -2
  137. package/dist/core/resource-loader.js.map +1 -1
  138. package/dist/core/sdk.d.ts +2 -2
  139. package/dist/core/sdk.d.ts.map +1 -1
  140. package/dist/core/sdk.js +10 -3
  141. package/dist/core/sdk.js.map +1 -1
  142. package/dist/core/session-export.d.ts +4 -0
  143. package/dist/core/session-export.d.ts.map +1 -0
  144. package/dist/core/session-export.js +32 -0
  145. package/dist/core/session-export.js.map +1 -0
  146. package/dist/core/session-manager.d.ts.map +1 -1
  147. package/dist/core/session-manager.js +2 -1
  148. package/dist/core/session-manager.js.map +1 -1
  149. package/dist/core/settings-diagnostics.d.ts +9 -0
  150. package/dist/core/settings-diagnostics.d.ts.map +1 -0
  151. package/dist/core/settings-diagnostics.js +21 -0
  152. package/dist/core/settings-diagnostics.js.map +1 -0
  153. package/dist/core/settings-manager.d.ts +9 -0
  154. package/dist/core/settings-manager.d.ts.map +1 -1
  155. package/dist/core/settings-manager.js +51 -10
  156. package/dist/core/settings-manager.js.map +1 -1
  157. package/dist/core/skills.d.ts.map +1 -1
  158. package/dist/core/skills.js +51 -33
  159. package/dist/core/skills.js.map +1 -1
  160. package/dist/core/slash-commands.d.ts.map +1 -1
  161. package/dist/core/slash-commands.js +2 -1
  162. package/dist/core/slash-commands.js.map +1 -1
  163. package/dist/core/system-prompt.d.ts.map +1 -1
  164. package/dist/core/system-prompt.js +11 -2
  165. package/dist/core/system-prompt.js.map +1 -1
  166. package/dist/core/tools/bash.d.ts +16 -3
  167. package/dist/core/tools/bash.d.ts.map +1 -1
  168. package/dist/core/tools/bash.js +62 -29
  169. package/dist/core/tools/bash.js.map +1 -1
  170. package/dist/core/tools/edit-diff.d.ts +0 -5
  171. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  172. package/dist/core/tools/edit-diff.js +2 -5
  173. package/dist/core/tools/edit-diff.js.map +1 -1
  174. package/dist/core/tools/edit.d.ts.map +1 -1
  175. package/dist/core/tools/edit.js +20 -4
  176. package/dist/core/tools/edit.js.map +1 -1
  177. package/dist/core/tools/index.d.ts +4 -1
  178. package/dist/core/tools/index.d.ts.map +1 -1
  179. package/dist/core/tools/index.js +19 -1
  180. package/dist/core/tools/index.js.map +1 -1
  181. package/dist/core/tools/powershell.d.ts +16 -0
  182. package/dist/core/tools/powershell.d.ts.map +1 -0
  183. package/dist/core/tools/powershell.js +39 -0
  184. package/dist/core/tools/powershell.js.map +1 -0
  185. package/dist/core/tools/subagent.d.ts.map +1 -1
  186. package/dist/core/tools/subagent.js +4 -1
  187. package/dist/core/tools/subagent.js.map +1 -1
  188. package/dist/core/trust-manager.d.ts.map +1 -1
  189. package/dist/core/trust-manager.js +2 -1
  190. package/dist/core/trust-manager.js.map +1 -1
  191. package/dist/extensions/llama/index.d.ts.map +1 -1
  192. package/dist/extensions/llama/index.js +2 -0
  193. package/dist/extensions/llama/index.js.map +1 -1
  194. package/dist/extensions/llama/provider.d.ts.map +1 -1
  195. package/dist/extensions/llama/provider.js +6 -2
  196. package/dist/extensions/llama/provider.js.map +1 -1
  197. package/dist/humain/agent-execution-protocol.d.ts +1 -217
  198. package/dist/humain/agent-execution-protocol.d.ts.map +1 -1
  199. package/dist/humain/agent-execution-protocol.js +1 -203
  200. package/dist/humain/agent-execution-protocol.js.map +1 -1
  201. package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +107 -16
  202. package/dist/humain/mcp-adapter/vendor/CHANGELOG.md +82 -0
  203. package/dist/humain/mcp-adapter/vendor/README.md +47 -15
  204. package/dist/humain/mcp-adapter/vendor/cli.js +4 -4
  205. package/dist/humain/mcp-adapter/vendor/commands.ts +5 -3
  206. package/dist/humain/mcp-adapter/vendor/config.ts +46 -5
  207. package/dist/humain/mcp-adapter/vendor/direct-tools.ts +103 -92
  208. package/dist/humain/mcp-adapter/vendor/dist/agent-dir.d.ts +10 -0
  209. package/dist/humain/mcp-adapter/vendor/dist/agent-dir.js +63 -0
  210. package/dist/humain/mcp-adapter/vendor/dist/agent-dir.js.map +1 -0
  211. package/dist/humain/mcp-adapter/vendor/dist/agent-plugin-loader.d.ts +8 -0
  212. package/dist/humain/mcp-adapter/vendor/dist/agent-plugin-loader.js +356 -0
  213. package/dist/humain/mcp-adapter/vendor/dist/agent-plugin-loader.js.map +1 -0
  214. package/dist/humain/mcp-adapter/vendor/dist/config.d.ts +123 -0
  215. package/dist/humain/mcp-adapter/vendor/dist/config.js +1088 -0
  216. package/dist/humain/mcp-adapter/vendor/dist/config.js.map +1 -0
  217. package/dist/humain/mcp-adapter/vendor/dist/mcp-bearer-store.d.ts +24 -0
  218. package/dist/humain/mcp-adapter/vendor/dist/mcp-bearer-store.js +336 -0
  219. package/dist/humain/mcp-adapter/vendor/dist/mcp-bearer-store.js.map +1 -0
  220. package/dist/humain/mcp-adapter/vendor/dist/metadata-cache.d.ts +19 -0
  221. package/dist/humain/mcp-adapter/vendor/dist/metadata-cache.js +319 -0
  222. package/dist/humain/mcp-adapter/vendor/dist/metadata-cache.js.map +1 -0
  223. package/dist/humain/mcp-adapter/vendor/dist/package-mcp-loader.d.ts +2 -0
  224. package/dist/humain/mcp-adapter/vendor/dist/package-mcp-loader.js +156 -0
  225. package/dist/humain/mcp-adapter/vendor/dist/package-mcp-loader.js.map +1 -0
  226. package/dist/humain/mcp-adapter/vendor/dist/resource-tools.d.ts +1 -0
  227. package/dist/humain/mcp-adapter/vendor/dist/resource-tools.js +15 -0
  228. package/dist/humain/mcp-adapter/vendor/dist/resource-tools.js.map +1 -0
  229. package/dist/humain/mcp-adapter/vendor/dist/types.d.ts +566 -0
  230. package/dist/humain/mcp-adapter/vendor/dist/types.js +287 -0
  231. package/dist/humain/mcp-adapter/vendor/dist/types.js.map +1 -0
  232. package/dist/humain/mcp-adapter/vendor/dist/ui-app-bridge-helpers.d.ts +6 -0
  233. package/dist/humain/mcp-adapter/vendor/dist/ui-app-bridge-helpers.js +37 -0
  234. package/dist/humain/mcp-adapter/vendor/dist/ui-app-bridge-helpers.js.map +1 -0
  235. package/dist/humain/mcp-adapter/vendor/dist/ui-stream-types.d.ts +104 -0
  236. package/dist/humain/mcp-adapter/vendor/dist/ui-stream-types.js +59 -0
  237. package/dist/humain/mcp-adapter/vendor/dist/ui-stream-types.js.map +1 -0
  238. package/dist/humain/mcp-adapter/vendor/dist/ui-tool-visibility.d.ts +4 -0
  239. package/dist/humain/mcp-adapter/vendor/dist/ui-tool-visibility.js +27 -0
  240. package/dist/humain/mcp-adapter/vendor/dist/ui-tool-visibility.js.map +1 -0
  241. package/dist/humain/mcp-adapter/vendor/dist/utils.d.ts +32 -0
  242. package/dist/humain/mcp-adapter/vendor/dist/utils.js +338 -0
  243. package/dist/humain/mcp-adapter/vendor/dist/utils.js.map +1 -0
  244. package/dist/humain/mcp-adapter/vendor/failure-backoff.ts +23 -0
  245. package/dist/humain/mcp-adapter/vendor/index.bundle.mjs +4870 -3878
  246. package/dist/humain/mcp-adapter/vendor/index.ts +294 -88
  247. package/dist/humain/mcp-adapter/vendor/init.ts +41 -30
  248. package/dist/humain/mcp-adapter/vendor/lifecycle.ts +16 -8
  249. package/dist/humain/mcp-adapter/vendor/mcp-auth-flow.ts +124 -32
  250. package/dist/humain/mcp-adapter/vendor/mcp-bearer-store.ts +0 -2
  251. package/dist/humain/mcp-adapter/vendor/mcp-code.ts +2 -0
  252. package/dist/humain/mcp-adapter/vendor/mcp-oauth-provider.ts +155 -16
  253. package/dist/humain/mcp-adapter/vendor/mcp-output-guard.ts +95 -7
  254. package/dist/humain/mcp-adapter/vendor/mcp-probe.ts +18 -4
  255. package/dist/humain/mcp-adapter/vendor/mcp-references.ts +376 -0
  256. package/dist/humain/mcp-adapter/vendor/mcp-status.ts +8 -19
  257. package/dist/humain/mcp-adapter/vendor/metadata-cache.ts +20 -12
  258. package/dist/humain/mcp-adapter/vendor/namespace-tools.ts +276 -0
  259. package/dist/humain/mcp-adapter/vendor/package.json +26 -8
  260. package/dist/humain/mcp-adapter/vendor/proxy-modes.ts +128 -32
  261. package/dist/humain/mcp-adapter/vendor/request-headers-command.ts +1 -1
  262. package/dist/humain/mcp-adapter/vendor/search-ranking.ts +2 -0
  263. package/dist/humain/mcp-adapter/vendor/server-manager.ts +69 -12
  264. package/dist/humain/mcp-adapter/vendor/state.ts +1 -3
  265. package/dist/humain/mcp-adapter/vendor/tool-result-renderer.ts +16 -2
  266. package/dist/humain/mcp-adapter/vendor/types.ts +51 -2
  267. package/dist/humain/mcp-adapter/vendor/ui-server.ts +3 -19
  268. package/dist/humain/mcp-adapter/vendor/ui-session.ts +2 -1
  269. package/dist/humain/mcp-adapter/vendor/utils.ts +21 -19
  270. package/dist/humain/mcp-adapter.d.ts.map +1 -1
  271. package/dist/humain/mcp-adapter.js +4 -0
  272. package/dist/humain/mcp-adapter.js.map +1 -1
  273. package/dist/humain/web-access/vendor/chrome-cookies.d.ts +14 -0
  274. package/dist/humain/web-access/vendor/chrome-cookies.d.ts.map +1 -1
  275. package/dist/humain/web-access/vendor/chrome-cookies.js +85 -33
  276. package/dist/humain/web-access/vendor/chrome-cookies.js.map +1 -1
  277. package/dist/humain/web-access/vendor/credential-source.d.ts +1 -1
  278. package/dist/humain/web-access/vendor/credential-source.d.ts.map +1 -1
  279. package/dist/humain/web-access/vendor/credential-source.js +3 -1
  280. package/dist/humain/web-access/vendor/credential-source.js.map +1 -1
  281. package/dist/humain/web-access/vendor/curator-page.d.ts +2 -29
  282. package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
  283. package/dist/humain/web-access/vendor/curator-page.js +10 -1
  284. package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
  285. package/dist/humain/web-access/vendor/curator-server.d.ts +2 -29
  286. package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
  287. package/dist/humain/web-access/vendor/curator-server.js +4 -0
  288. package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
  289. package/dist/humain/web-access/vendor/extract.d.ts +11 -0
  290. package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
  291. package/dist/humain/web-access/vendor/extract.js +163 -20
  292. package/dist/humain/web-access/vendor/extract.js.map +1 -1
  293. package/dist/humain/web-access/vendor/fetch-params.d.ts +2 -0
  294. package/dist/humain/web-access/vendor/fetch-params.d.ts.map +1 -1
  295. package/dist/humain/web-access/vendor/fetch-params.js +11 -0
  296. package/dist/humain/web-access/vendor/fetch-params.js.map +1 -1
  297. package/dist/humain/web-access/vendor/gemini-adc.d.ts +10 -0
  298. package/dist/humain/web-access/vendor/gemini-adc.d.ts.map +1 -0
  299. package/dist/humain/web-access/vendor/gemini-adc.js +268 -0
  300. package/dist/humain/web-access/vendor/gemini-adc.js.map +1 -0
  301. package/dist/humain/web-access/vendor/gemini-api.d.ts +7 -1
  302. package/dist/humain/web-access/vendor/gemini-api.d.ts.map +1 -1
  303. package/dist/humain/web-access/vendor/gemini-api.js +51 -15
  304. package/dist/humain/web-access/vendor/gemini-api.js.map +1 -1
  305. package/dist/humain/web-access/vendor/gemini-search.d.ts +9 -4
  306. package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
  307. package/dist/humain/web-access/vendor/gemini-search.js +63 -21
  308. package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
  309. package/dist/humain/web-access/vendor/gemini-url-context.d.ts.map +1 -1
  310. package/dist/humain/web-access/vendor/gemini-url-context.js +3 -2
  311. package/dist/humain/web-access/vendor/gemini-url-context.js.map +1 -1
  312. package/dist/humain/web-access/vendor/gemini-web-config.d.ts +8 -1
  313. package/dist/humain/web-access/vendor/gemini-web-config.d.ts.map +1 -1
  314. package/dist/humain/web-access/vendor/gemini-web-config.js +49 -4
  315. package/dist/humain/web-access/vendor/gemini-web-config.js.map +1 -1
  316. package/dist/humain/web-access/vendor/gemini-web.d.ts +2 -1
  317. package/dist/humain/web-access/vendor/gemini-web.d.ts.map +1 -1
  318. package/dist/humain/web-access/vendor/gemini-web.js +8 -3
  319. package/dist/humain/web-access/vendor/gemini-web.js.map +1 -1
  320. package/dist/humain/web-access/vendor/github-api.d.ts +1 -1
  321. package/dist/humain/web-access/vendor/github-api.d.ts.map +1 -1
  322. package/dist/humain/web-access/vendor/github-api.js +6 -4
  323. package/dist/humain/web-access/vendor/github-api.js.map +1 -1
  324. package/dist/humain/web-access/vendor/github-extract.d.ts.map +1 -1
  325. package/dist/humain/web-access/vendor/github-extract.js +50 -3
  326. package/dist/humain/web-access/vendor/github-extract.js.map +1 -1
  327. package/dist/humain/web-access/vendor/github-issue-pr.d.ts +27 -0
  328. package/dist/humain/web-access/vendor/github-issue-pr.d.ts.map +1 -0
  329. package/dist/humain/web-access/vendor/github-issue-pr.js +701 -0
  330. package/dist/humain/web-access/vendor/github-issue-pr.js.map +1 -0
  331. package/dist/humain/web-access/vendor/index.d.ts +3 -31
  332. package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
  333. package/dist/humain/web-access/vendor/index.js +643 -530
  334. package/dist/humain/web-access/vendor/index.js.map +1 -1
  335. package/dist/humain/web-access/vendor/kimi-search.d.ts +5 -0
  336. package/dist/humain/web-access/vendor/kimi-search.d.ts.map +1 -0
  337. package/dist/humain/web-access/vendor/kimi-search.js +228 -0
  338. package/dist/humain/web-access/vendor/kimi-search.js.map +1 -0
  339. package/dist/humain/web-access/vendor/openai-search.d.ts +3 -0
  340. package/dist/humain/web-access/vendor/openai-search.d.ts.map +1 -1
  341. package/dist/humain/web-access/vendor/openai-search.js +89 -16
  342. package/dist/humain/web-access/vendor/openai-search.js.map +1 -1
  343. package/dist/humain/web-access/vendor/page-query.d.ts.map +1 -1
  344. package/dist/humain/web-access/vendor/page-query.js +56 -8
  345. package/dist/humain/web-access/vendor/page-query.js.map +1 -1
  346. package/dist/humain/web-access/vendor/ssrf-protection.js +6 -1
  347. package/dist/humain/web-access/vendor/ssrf-protection.js.map +1 -1
  348. package/dist/humain/web-access/vendor/utils.d.ts +12 -0
  349. package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
  350. package/dist/humain/web-access/vendor/utils.js +343 -1
  351. package/dist/humain/web-access/vendor/utils.js.map +1 -1
  352. package/dist/humain/web-access/vendor/xcrawl.d.ts +4 -0
  353. package/dist/humain/web-access/vendor/xcrawl.d.ts.map +1 -0
  354. package/dist/humain/web-access/vendor/xcrawl.js +251 -0
  355. package/dist/humain/web-access/vendor/xcrawl.js.map +1 -0
  356. package/dist/humain/web-access/vendor/youtube-extract.js +2 -2
  357. package/dist/humain/web-access/vendor/youtube-extract.js.map +1 -1
  358. package/dist/index.d.ts +5 -5
  359. package/dist/index.d.ts.map +1 -1
  360. package/dist/index.js +4 -4
  361. package/dist/index.js.map +1 -1
  362. package/dist/main.d.ts +3 -0
  363. package/dist/main.d.ts.map +1 -1
  364. package/dist/main.js +17 -14
  365. package/dist/main.js.map +1 -1
  366. package/dist/migrations.d.ts.map +1 -1
  367. package/dist/migrations.js +4 -3
  368. package/dist/migrations.js.map +1 -1
  369. package/dist/modes/interactive/components/model-selector.d.ts +9 -3
  370. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  371. package/dist/modes/interactive/components/model-selector.js +53 -10
  372. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  373. package/dist/modes/interactive/components/settings-selector.d.ts +7 -2
  374. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  375. package/dist/modes/interactive/components/settings-selector.js +118 -55
  376. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  377. package/dist/modes/interactive/components/settings-submenu.d.ts +72 -0
  378. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -0
  379. package/dist/modes/interactive/components/settings-submenu.js +151 -0
  380. package/dist/modes/interactive/components/settings-submenu.js.map +1 -0
  381. package/dist/modes/interactive/components/thinking-selector.d.ts +15 -3
  382. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  383. package/dist/modes/interactive/components/thinking-selector.js +68 -17
  384. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  385. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  386. package/dist/modes/interactive/external-editor.js +2 -1
  387. package/dist/modes/interactive/external-editor.js.map +1 -1
  388. package/dist/modes/interactive/interactive-mode.d.ts +11 -0
  389. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  390. package/dist/modes/interactive/interactive-mode.js +176 -106
  391. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  392. package/dist/modes/interactive/session-share.d.ts +16 -0
  393. package/dist/modes/interactive/session-share.d.ts.map +1 -0
  394. package/dist/modes/interactive/session-share.js +188 -0
  395. package/dist/modes/interactive/session-share.js.map +1 -0
  396. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  397. package/dist/modes/interactive/theme/theme.js +6 -5
  398. package/dist/modes/interactive/theme/theme.js.map +1 -1
  399. package/dist/modes/json-event.d.ts +16 -13
  400. package/dist/modes/json-event.d.ts.map +1 -1
  401. package/dist/modes/json-event.js +20 -6
  402. package/dist/modes/json-event.js.map +1 -1
  403. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  404. package/dist/modes/rpc/rpc-client.js +3 -2
  405. package/dist/modes/rpc/rpc-client.js.map +1 -1
  406. package/dist/modes/rpc/rpc-types.d.ts +2 -7
  407. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  408. package/dist/modes/rpc/rpc-types.js.map +1 -1
  409. package/dist/package-manager-cli.d.ts +1 -0
  410. package/dist/package-manager-cli.d.ts.map +1 -1
  411. package/dist/package-manager-cli.js +189 -3
  412. package/dist/package-manager-cli.js.map +1 -1
  413. package/dist/utils/changelog.d.ts +1 -1
  414. package/dist/utils/changelog.d.ts.map +1 -1
  415. package/dist/utils/changelog.js +12 -2
  416. package/dist/utils/changelog.js.map +1 -1
  417. package/dist/utils/frontmatter.d.ts.map +1 -1
  418. package/dist/utils/frontmatter.js +2 -1
  419. package/dist/utils/frontmatter.js.map +1 -1
  420. package/dist/utils/management-http.d.ts +5 -3
  421. package/dist/utils/management-http.d.ts.map +1 -1
  422. package/dist/utils/management-http.js +14 -10
  423. package/dist/utils/management-http.js.map +1 -1
  424. package/dist/utils/shell.d.ts +3 -0
  425. package/dist/utils/shell.d.ts.map +1 -1
  426. package/dist/utils/shell.js +17 -5
  427. package/dist/utils/shell.js.map +1 -1
  428. package/dist/utils/syntax-highlight.d.ts +1 -0
  429. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  430. package/dist/utils/syntax-highlight.js +64 -1
  431. package/dist/utils/syntax-highlight.js.map +1 -1
  432. package/dist/utils/text.d.ts +8 -0
  433. package/dist/utils/text.d.ts.map +1 -0
  434. package/dist/utils/text.js +9 -0
  435. package/dist/utils/text.js.map +1 -0
  436. package/dist/utils/version-check.js +4 -4
  437. package/dist/utils/version-check.js.map +1 -1
  438. package/docs/compaction.md +15 -0
  439. package/docs/custom-provider.md +5 -2
  440. package/docs/environment-variables.md +7 -7
  441. package/docs/extensions.md +17 -7
  442. package/docs/json.md +7 -2
  443. package/docs/keybindings.md +8 -8
  444. package/docs/llama-cpp.md +2 -0
  445. package/docs/models.md +8 -2
  446. package/docs/packages.md +2 -2
  447. package/docs/rpc.md +9 -3
  448. package/docs/sdk.md +7 -2
  449. package/docs/settings.md +11 -3
  450. package/docs/skills.md +3 -2
  451. package/docs/terminal-setup.md +8 -0
  452. package/docs/usage.md +10 -7
  453. package/docs/windows.md +15 -1
  454. package/examples/extensions/border-status-editor.ts +1 -1
  455. package/examples/extensions/custom-provider-anthropic/package-lock.json +70 -8
  456. package/examples/extensions/custom-provider-anthropic/package.json +2 -2
  457. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  458. package/examples/extensions/git-checkpoint.ts +2 -2
  459. package/examples/extensions/gondolin/package-lock.json +2 -2
  460. package/examples/extensions/gondolin/package.json +1 -1
  461. package/examples/extensions/notify.ts +3 -1
  462. package/examples/extensions/sandbox/package-lock.json +14 -40
  463. package/examples/extensions/sandbox/package.json +2 -2
  464. package/examples/extensions/titlebar-spinner.ts +1 -1
  465. package/examples/extensions/with-deps/package-lock.json +4 -4
  466. package/examples/extensions/with-deps/package.json +1 -1
  467. package/examples/rpc-extension-ui.ts +1 -1
  468. package/examples/sdk/06-extensions.ts +1 -1
  469. package/examples/sdk/README.md +1 -1
  470. package/npm-shrinkwrap.json +293 -221
  471. package/package.json +21 -18
  472. package/src/humain/mcp-adapter/UPSTREAM.md +15 -5
  473. package/src/humain/mcp-adapter/upstream.json +4 -3
  474. package/src/humain/mcp-adapter/vendor/CHANGELOG.md +82 -0
  475. package/src/humain/web-access/UPSTREAM.md +1 -1
  476. package/src/humain/web-access/upstream.json +6 -4
@@ -1 +1 @@
1
- {"version":3,"file":"agent-execution-protocol.js","sourceRoot":"","sources":["../../src/humain/agent-execution-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAU,CAAC;AAEhE,MAAM,YAAY,GAAG,CAAoD,UAAa,EAAE,EAAE,CACzF,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC;AAC1D,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;AACvE,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;AACvF,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC1F,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAC1D,MAAM,qBAAqB,GAAG,IAAI,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,CAAC;IACZ,SAA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AK,CAAC,CAC7E,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAI,KAAQ;IAC9B,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACxF,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrB,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAC5D,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport { Compile } from \"typebox/compile\";\n\nexport const HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION = 1 as const;\n\nconst StrictObject = <const T extends Parameters<typeof Type.Object>[0]>(properties: T) =>\n\tType.Object(properties, { additionalProperties: false });\nconst StableIdentifier = Type.String({ minLength: 1, maxLength: 256 });\nconst PositiveInteger = Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER });\nconst NonnegativeInteger = Type.Integer({ minimum: 0, maximum: Number.MAX_SAFE_INTEGER });\nconst Digest = Type.String({ pattern: \"^[a-f0-9]{64}$\" });\nconst SafeArtifactReference = Type.String({\n\tminLength: 1,\n\tmaxLength: 512,\n\tpattern: \"^(?!/)(?!.*(?:^|/)\\\\.\\\\.(?:/|$))[A-Za-z0-9._-]+(?:/[A-Za-z0-9._-]+)*$\",\n});\n\nexport const HumainAgentRouteRefSchema = Type.Union([\n\tType.Literal(\"route:fast\"),\n\tType.Literal(\"route:balanced\"),\n\tType.Literal(\"route:thorough\"),\n]);\nexport type HumainAgentRouteRef = Static<typeof HumainAgentRouteRefSchema>;\n\nexport const HumainAgentArtifactSchema = StrictObject({\n\tid: StableIdentifier,\n\tkind: Type.Union([\n\t\tType.Literal(\"candidate-patch\"),\n\t\tType.Literal(\"dependency-output\"),\n\t\tType.Literal(\"source-observation\"),\n\t\tType.Literal(\"validation-report\"),\n\t]),\n\treference: SafeArtifactReference,\n\tdigest: Digest,\n});\nexport type HumainAgentArtifact = Static<typeof HumainAgentArtifactSchema>;\n\nexport const HumainAgentExecutionControlsSchema = StrictObject({\n\tmaxConcurrency: Type.Integer({ minimum: 1, maximum: 16 }),\n\tmaxDepth: Type.Integer({ minimum: 1, maximum: 16 }),\n\tdepth: Type.Integer({ minimum: 0, maximum: 16 }),\n\ttimeoutMs: Type.Integer({ minimum: 1, maximum: 86_400_000 }),\n});\nexport type HumainAgentExecutionControls = Static<typeof HumainAgentExecutionControlsSchema>;\n\nexport const HumainAgentExecutionClaimSchema = StrictObject({\n\tworkUnitId: StableIdentifier,\n\tnodeId: StableIdentifier,\n\tattemptNumber: PositiveInteger,\n\tattemptFence: PositiveInteger,\n\tsegmentFence: PositiveInteger,\n\trouteRef: HumainAgentRouteRefSchema,\n\ttask: Type.String({ minLength: 1, maxLength: 100_000 }),\n\tcontrols: HumainAgentExecutionControlsSchema,\n\tinput: StrictObject({\n\t\tartifacts: Type.Array(HumainAgentArtifactSchema, { maxItems: 16 }),\n\t}),\n});\nexport type HumainAgentExecutionClaim = Static<typeof HumainAgentExecutionClaimSchema>;\n\nexport const HumainAgentExecutionRequestSchema = StrictObject({\n\tschemaVersion: Type.Literal(HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION),\n\tkind: Type.Literal(\"execute\"),\n\tmode: Type.Union([Type.Literal(\"node\"), Type.Literal(\"workflow\")]),\n\tinvocationId: StableIdentifier,\n\tbatchId: Type.Optional(StableIdentifier),\n\tclaims: Type.Array(HumainAgentExecutionClaimSchema, { minItems: 1, maxItems: 8 }),\n});\nexport type HumainAgentExecutionRequest = Static<typeof HumainAgentExecutionRequestSchema>;\n\nexport const HumainAgentUsageSchema = Type.Union([\n\tStrictObject({ status: Type.Literal(\"unknown\") }),\n\tStrictObject({\n\t\tstatus: Type.Literal(\"measured\"),\n\t\ttotalCalls: Type.Optional(NonnegativeInteger),\n\t\ttotalTurns: Type.Optional(NonnegativeInteger),\n\t\ttotalTokens: NonnegativeInteger,\n\t\tcostMicrocents: NonnegativeInteger,\n\t}),\n]);\nexport type HumainAgentUsage = Static<typeof HumainAgentUsageSchema>;\n\nexport const HUMAIN_AGENT_EXECUTION_FAILURE_CODES = [\n\t\"adapter_execution_failed\",\n\t\"incompatible_adapter_capability\",\n\t\"invalid_adapter_result\",\n\t\"invalid_execution_request\",\n\t\"provider_timeout\",\n\t\"provider_unavailable\",\n\t\"reused_execution_context\",\n\t\"transport_interrupted\",\n] as const;\nexport type HumainAgentExecutionFailureCode = (typeof HUMAIN_AGENT_EXECUTION_FAILURE_CODES)[number];\n\nconst HumainAgentExecutionFailureCodeSchema = Type.Union([\n\tType.Literal(\"adapter_execution_failed\"),\n\tType.Literal(\"incompatible_adapter_capability\"),\n\tType.Literal(\"invalid_adapter_result\"),\n\tType.Literal(\"invalid_execution_request\"),\n\tType.Literal(\"provider_timeout\"),\n\tType.Literal(\"provider_unavailable\"),\n\tType.Literal(\"reused_execution_context\"),\n\tType.Literal(\"transport_interrupted\"),\n]);\n\nconst OutcomeIdentity = {\n\tworkUnitId: StableIdentifier,\n\tnodeId: StableIdentifier,\n\tattemptNumber: PositiveInteger,\n\tattemptFence: PositiveInteger,\n\tsegmentFence: PositiveInteger,\n};\n\nexport const HumainAgentExecutionOutcomeSchema = Type.Union([\n\tStrictObject({\n\t\t...OutcomeIdentity,\n\t\tkind: Type.Literal(\"succeeded\"),\n\t\toutput: StrictObject({\n\t\t\tsummary: Type.String({ minLength: 1, maxLength: 512 }),\n\t\t\tartifacts: Type.Array(HumainAgentArtifactSchema, { maxItems: 16 }),\n\t\t}),\n\t\tusage: HumainAgentUsageSchema,\n\t}),\n\tStrictObject({\n\t\t...OutcomeIdentity,\n\t\tkind: Type.Literal(\"failed\"),\n\t\tfailureCode: HumainAgentExecutionFailureCodeSchema,\n\t\tusage: HumainAgentUsageSchema,\n\t}),\n\tStrictObject({\n\t\t...OutcomeIdentity,\n\t\tkind: Type.Literal(\"cancelled\"),\n\t\tterminationConfirmed: Type.Boolean(),\n\t\tusage: HumainAgentUsageSchema,\n\t}),\n]);\nexport type HumainAgentExecutionOutcome = Static<typeof HumainAgentExecutionOutcomeSchema>;\n\nexport const HumainAgentExecutionResponseSchema = StrictObject({\n\tschemaVersion: Type.Literal(HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION),\n\tkind: Type.Literal(\"result\"),\n\tmode: Type.Union([Type.Literal(\"node\"), Type.Literal(\"workflow\")]),\n\tinvocationId: StableIdentifier,\n\tbatchId: Type.Optional(StableIdentifier),\n\ttermination: Type.Union([Type.Literal(\"not-requested\"), Type.Literal(\"confirmed\"), Type.Literal(\"unconfirmed\")]),\n\toutcomes: Type.Array(HumainAgentExecutionOutcomeSchema, { minItems: 1, maxItems: 8 }),\n});\nexport type HumainAgentExecutionResponse = Static<typeof HumainAgentExecutionResponseSchema>;\n\nconst RequestValidator = Compile(HumainAgentExecutionRequestSchema);\nconst ResponseValidator = Compile(HumainAgentExecutionResponseSchema);\n\nexport function parseHumainAgentExecutionRequest(input: unknown): HumainAgentExecutionRequest {\n\tif (!RequestValidator.Check(input)) {\n\t\tthrow new Error(\"Invalid HUMAIN agent execution request\");\n\t}\n\tif (input.mode === \"node\" && (input.claims.length !== 1 || input.batchId !== undefined)) {\n\t\tthrow new Error(\"Invalid HUMAIN agent execution request: node mode requires one claim and no batch identity\");\n\t}\n\tif (input.mode === \"workflow\" && input.batchId === undefined) {\n\t\tthrow new Error(\"Invalid HUMAIN agent execution request: workflow mode requires a batch identity\");\n\t}\n\tconst workUnitIds = new Set(input.claims.map(({ workUnitId }) => workUnitId));\n\tconst nodeIds = new Set(input.claims.map(({ nodeId }) => nodeId));\n\tif (workUnitIds.size !== input.claims.length || nodeIds.size !== input.claims.length) {\n\t\tthrow new Error(\"Invalid HUMAIN agent execution request: claim identities must be unique\");\n\t}\n\tif (input.claims.some(({ controls }) => controls.depth >= controls.maxDepth)) {\n\t\tthrow new Error(\"Invalid HUMAIN agent execution request: delegation depth limit is exhausted\");\n\t}\n\treturn deepFreeze(structuredClone(input));\n}\n\nexport function parseHumainAgentExecutionResponse(\n\trequestInput: unknown,\n\tresponseInput: unknown,\n): HumainAgentExecutionResponse {\n\tconst request = parseHumainAgentExecutionRequest(requestInput);\n\tif (!ResponseValidator.Check(responseInput)) {\n\t\tthrow new Error(\"Invalid HUMAIN agent execution response\");\n\t}\n\tconst response = responseInput;\n\tif (response.outcomes.some((outcome) => outcome.kind === \"succeeded\" && !isSafeSummary(outcome.output.summary))) {\n\t\tthrow new Error(\"Invalid HUMAIN agent execution response\");\n\t}\n\tif (\n\t\tresponse.mode !== request.mode ||\n\t\tresponse.invocationId !== request.invocationId ||\n\t\tresponse.batchId !== request.batchId\n\t) {\n\t\tthrow new Error(\"HUMAIN agent result envelope mismatch\");\n\t}\n\tif (response.outcomes.length !== request.claims.length) {\n\t\tthrow new Error(\"HUMAIN agent result cardinality mismatch\");\n\t}\n\tfor (const [index, outcome] of response.outcomes.entries()) {\n\t\tconst claim = request.claims[index];\n\t\tif (\n\t\t\t!claim ||\n\t\t\toutcome.workUnitId !== claim.workUnitId ||\n\t\t\toutcome.nodeId !== claim.nodeId ||\n\t\t\toutcome.attemptNumber !== claim.attemptNumber ||\n\t\t\toutcome.attemptFence !== claim.attemptFence ||\n\t\t\toutcome.segmentFence !== claim.segmentFence\n\t\t) {\n\t\t\tthrow new Error(\"HUMAIN agent result identity mismatch\");\n\t\t}\n\t}\n\tconst cancelled = response.outcomes.filter((outcome) => outcome.kind === \"cancelled\");\n\tconst expectedTermination =\n\t\tcancelled.length === 0\n\t\t\t? \"not-requested\"\n\t\t\t: cancelled.every((outcome) => outcome.terminationConfirmed)\n\t\t\t\t? \"confirmed\"\n\t\t\t\t: \"unconfirmed\";\n\tif (response.termination !== expectedTermination) {\n\t\tthrow new Error(\"HUMAIN agent result termination evidence mismatch\");\n\t}\n\treturn deepFreeze(structuredClone(response));\n}\n\nfunction isSafeSummary(value: string): boolean {\n\treturn (\n\t\tvalue === value.trim() &&\n\t\t/^[\\p{L}\\p{N}][\\p{L}\\p{N} .,;:!?()&'-]*$/u.test(value) &&\n\t\t!/\\b(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}(?::\\d{1,5})?\\b/u.test(value) &&\n\t\t!/\\b(?:\\d{1,3}\\.){3}\\d{1,3}(?::\\d{1,5})?\\b/u.test(value) &&\n\t\t!/^(?:rm|curl|wget|sh|bash|zsh|fish|pwsh|powershell|cmd|node|bun|deno|npx|npm|pnpm|yarn|python(?:3)?|perl|ruby|git|docker|kubectl|ssh|scp|sudo|cat|ls|cd|mkdir|touch|chmod|chown|env|export|set|eval|exec)\\b/iu.test(\n\t\t\tvalue,\n\t\t) &&\n\t\t!/\\b(?:api[- ]?key|secret|token|credential|password)\\s*:/iu.test(value) &&\n\t\t!/\\b(?:claude|gpt|gemini|llama|mistral)[-_:][A-Za-z0-9._:-]+\\b/iu.test(value)\n\t);\n}\n\nfunction deepFreeze<T>(value: T): T {\n\tif (value === null || typeof value !== \"object\" || Object.isFrozen(value)) return value;\n\tObject.freeze(value);\n\tfor (const child of Object.values(value)) deepFreeze(child);\n\treturn value;\n}\n"]}
1
+ {"version":3,"file":"agent-execution-protocol.js","sourceRoot":"","sources":["../../src/humain/agent-execution-protocol.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC","sourcesContent":["export * from \"@humain/terminal-contracts\";\n"]}
@@ -663,22 +663,28 @@ function buildBaseOptions(model, context, options, apiKey) {
663
663
  };
664
664
  }
665
665
  var MIN_ANSWER_TOKENS = 1024;
666
+ var DEFAULT_THINKING_BUDGETS = {
667
+ minimal: 1024,
668
+ low: 2048,
669
+ medium: 8192,
670
+ high: 16384
671
+ };
666
672
  function clampReasoning(effort) {
667
673
  return effort === "xhigh" || effort === "max" ? "high" : effort;
668
674
  }
669
- function adjustMaxTokensForThinking(baseMaxTokens, modelMaxTokens, reasoningLevel, customBudgets) {
670
- const defaultBudgets = {
671
- minimal: 1024,
672
- low: 2048,
673
- medium: 8192,
674
- high: 16384
675
- };
676
- const budgets = { ...defaultBudgets, ...customBudgets };
675
+ function thinkingBudgetForLevel(reasoningLevel, customBudgets) {
676
+ const budgets = { ...DEFAULT_THINKING_BUDGETS, ...customBudgets };
677
677
  const level = clampReasoning(reasoningLevel);
678
- let thinkingBudget = budgets[level];
678
+ return budgets[level];
679
+ }
680
+ function clampThinkingBudgetToAnswerRoom(thinkingBudget, ceiling) {
681
+ return Math.min(thinkingBudget, Math.max(0, ceiling - MIN_ANSWER_TOKENS));
682
+ }
683
+ function adjustMaxTokensForThinking(baseMaxTokens, modelMaxTokens, reasoningLevel, customBudgets) {
684
+ let thinkingBudget = thinkingBudgetForLevel(reasoningLevel, customBudgets);
679
685
  const maxTokens = baseMaxTokens === void 0 ? modelMaxTokens : Math.min(baseMaxTokens + thinkingBudget, modelMaxTokens);
680
686
  if (maxTokens <= thinkingBudget) {
681
- thinkingBudget = Math.max(0, maxTokens - MIN_ANSWER_TOKENS);
687
+ thinkingBudget = clampThinkingBudgetToAnswerRoom(thinkingBudget, maxTokens);
682
688
  }
683
689
  return { maxTokens, thinkingBudget };
684
690
  }
@@ -836,6 +842,7 @@ function transformMessages(messages, model, normalizeToolCallId2) {
836
842
 
837
843
  // packages/ai/src/api/bedrock-converse-stream.ts
838
844
  var EMPTY_TEXT_PLACEHOLDER = "<empty>";
845
+ var REDACTED_THINKING_PLACEHOLDER = "[Reasoning redacted]";
839
846
  var stream = (model, context, options = {}) => {
840
847
  const stream2 = new AssistantMessageEventStream();
841
848
  (async () => {
@@ -917,6 +924,12 @@ var stream = (model, context, options = {}) => {
917
924
  try {
918
925
  const supportsStrictMode = model.compat?.supportsStrictMode ?? false;
919
926
  client = new BedrockRuntimeClient(config);
927
+ let observedRawResponse = false;
928
+ if (options.onResponse) {
929
+ addResponseHeadersMiddleware(client, options.onResponse, model, () => {
930
+ observedRawResponse = true;
931
+ });
932
+ }
920
933
  const customHeaders = providerHeadersToRecord(options.headers);
921
934
  if (customHeaders) {
922
935
  addCustomHeadersMiddleware(client, customHeaders);
@@ -942,7 +955,7 @@ var stream = (model, context, options = {}) => {
942
955
  const command = new ConverseStreamCommand(commandInput);
943
956
  const response = await client.send(command, { abortSignal: options.signal });
944
957
  responseRequestId = normalizeDiagnosticValue(response.$metadata.requestId);
945
- if (response.$metadata.httpStatusCode !== void 0) {
958
+ if (!observedRawResponse && response.$metadata.httpStatusCode !== void 0) {
946
959
  const responseHeaders = {};
947
960
  if (response.$metadata.requestId) {
948
961
  responseHeaders["x-amzn-requestid"] = response.$metadata.requestId;
@@ -991,12 +1004,12 @@ var stream = (model, context, options = {}) => {
991
1004
  if (output.stopReason === "error" || output.stopReason === "aborted") {
992
1005
  throw new Error(output.errorMessage || "An unknown error occurred");
993
1006
  }
1007
+ for (const block of output.content) finalizeStreamingBlock(block);
994
1008
  stream2.push({ type: "done", reason: output.stopReason, message: output });
995
1009
  stream2.end();
996
1010
  } catch (error) {
997
1011
  for (const block of output.content) {
998
- delete block.index;
999
- delete block.partialJson;
1012
+ finalizeStreamingBlock(block);
1000
1013
  }
1001
1014
  output.stopReason = options.signal?.aborted ? "aborted" : "error";
1002
1015
  output.errorMessage = formatBedrockError(error);
@@ -1071,8 +1084,32 @@ function addCustomHeadersMiddleware(client, headers) {
1071
1084
  };
1072
1085
  client.middlewareStack.add(middleware, { step: "build", name: "pi-ai-custom-headers", priority: "low" });
1073
1086
  }
1087
+ function isSmithyHttpResponse(response) {
1088
+ if (!response || typeof response !== "object") return false;
1089
+ const candidate = response;
1090
+ return typeof candidate.statusCode === "number" && !!candidate.headers && typeof candidate.headers === "object";
1091
+ }
1092
+ function toProviderResponse(response) {
1093
+ if (!isSmithyHttpResponse(response)) return void 0;
1094
+ return { status: response.statusCode, headers: { ...response.headers } };
1095
+ }
1096
+ function addResponseHeadersMiddleware(client, onResponse, model, onObserved) {
1097
+ const middleware = (next) => async (args) => {
1098
+ const result = await next(args);
1099
+ const providerResponse = toProviderResponse(result.response);
1100
+ if (providerResponse) {
1101
+ onObserved();
1102
+ await onResponse(providerResponse, model);
1103
+ }
1104
+ return result;
1105
+ };
1106
+ client.middlewareStack.add(middleware, { step: "deserialize", name: "pi-ai-response-headers" });
1107
+ }
1074
1108
  var streamSimple = (model, context, options) => {
1075
- const base = buildBaseOptions(model, context, options, void 0);
1109
+ const base = {
1110
+ ...buildBaseOptions(model, context, options, void 0),
1111
+ toolChoice: options?.toolChoice
1112
+ };
1076
1113
  if (!options?.reasoning) {
1077
1114
  return stream(model, context, { ...base, reasoning: void 0 });
1078
1115
  }
@@ -1164,12 +1201,37 @@ function handleContentBlockDelta(event, blocks, output, stream2) {
1164
1201
  partial: output
1165
1202
  });
1166
1203
  }
1167
- if (delta.reasoningContent.signature) {
1204
+ if (delta.reasoningContent.signature && !thinkingBlock.redacted) {
1168
1205
  thinkingBlock.thinkingSignature = (thinkingBlock.thinkingSignature || "") + delta.reasoningContent.signature;
1169
1206
  }
1207
+ if (delta.reasoningContent.redactedContent?.length) {
1208
+ if (!thinkingBlock.redacted) {
1209
+ thinkingBlock.redacted = true;
1210
+ thinkingBlock.thinkingSignature = "";
1211
+ thinkingBlock.thinking += REDACTED_THINKING_PLACEHOLDER;
1212
+ stream2.push({
1213
+ type: "thinking_delta",
1214
+ contentIndex: thinkingIndex,
1215
+ delta: REDACTED_THINKING_PLACEHOLDER,
1216
+ partial: output
1217
+ });
1218
+ }
1219
+ thinkingBlock.redactedChunks ??= [];
1220
+ thinkingBlock.redactedChunks.push(delta.reasoningContent.redactedContent);
1221
+ }
1170
1222
  }
1171
1223
  }
1172
1224
  }
1225
+ function flushRedactedContent(block) {
1226
+ if (block.type !== "thinking" || !block.redactedChunks) return;
1227
+ block.thinkingSignature = bytesToBase64(block.redactedChunks);
1228
+ delete block.redactedChunks;
1229
+ }
1230
+ function finalizeStreamingBlock(block) {
1231
+ delete block.index;
1232
+ delete block.partialJson;
1233
+ flushRedactedContent(block);
1234
+ }
1173
1235
  function handleMetadata(event, model, output) {
1174
1236
  if (event.usage) {
1175
1237
  output.usage.input = event.usage.inputTokens || 0;
@@ -1190,6 +1252,7 @@ function handleContentBlockStop(event, blocks, output, stream2) {
1190
1252
  stream2.push({ type: "text_end", contentIndex: index, content: block.text, partial: output });
1191
1253
  break;
1192
1254
  case "thinking":
1255
+ flushRedactedContent(block);
1193
1256
  stream2.push({ type: "thinking_end", contentIndex: index, content: block.thinking, partial: output });
1194
1257
  break;
1195
1258
  case "toolCall":
@@ -1361,6 +1424,13 @@ function convertMessages(context, model, cacheRetention, env) {
1361
1424
  });
1362
1425
  break;
1363
1426
  case "thinking": {
1427
+ if (c.redacted) {
1428
+ const redactedContent = decodeRedactedContent(c.thinkingSignature);
1429
+ if (redactedContent?.length) {
1430
+ contentBlocks.push({ reasoningContent: { redactedContent } });
1431
+ }
1432
+ continue;
1433
+ }
1364
1434
  const thinking = sanitizeSurrogates(c.thinking);
1365
1435
  if (thinking.trim().length === 0) continue;
1366
1436
  if (supportsThinkingSignature(model)) {
@@ -1611,12 +1681,33 @@ function createImageBlock(mimeType, data) {
1611
1681
  default:
1612
1682
  throw new Error(`Unknown image type: ${mimeType}`);
1613
1683
  }
1684
+ return { source: { bytes: base64ToBytes(data) }, format };
1685
+ }
1686
+ function base64ToBytes(data) {
1614
1687
  const binaryString = atob(data);
1615
1688
  const bytes = new Uint8Array(binaryString.length);
1616
1689
  for (let i = 0; i < binaryString.length; i++) {
1617
1690
  bytes[i] = binaryString.charCodeAt(i);
1618
1691
  }
1619
- return { source: { bytes }, format };
1692
+ return bytes;
1693
+ }
1694
+ function decodeRedactedContent(signature) {
1695
+ if (!signature) return void 0;
1696
+ try {
1697
+ return base64ToBytes(signature);
1698
+ } catch {
1699
+ return void 0;
1700
+ }
1701
+ }
1702
+ function bytesToBase64(chunks) {
1703
+ const WINDOW = 32768;
1704
+ let binary = "";
1705
+ for (const chunk of chunks) {
1706
+ for (let i = 0; i < chunk.length; i += WINDOW) {
1707
+ binary += String.fromCharCode(...chunk.subarray(i, i + WINDOW));
1708
+ }
1709
+ }
1710
+ return btoa(binary);
1620
1711
  }
1621
1712
 
1622
1713
  // packages/ai/src/bedrock-provider.ts
@@ -7,6 +7,88 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.31.0] - 2026-08-28
11
+
12
+ ### Highlights
13
+ - MCP Apps-aware servers can now recognize Pi as a UI-capable host and expose interactive resources.
14
+ - UI capability advertising works consistently across legacy and modern MCP protocol negotiation.
15
+ - Manual OAuth callback completion now supports HTTPS redirect URLs for pre-registered clients.
16
+
17
+ ### Added
18
+
19
+ - Pi now advertises MCP Apps UI support with the `io.modelcontextprotocol/ui` extension capability, so compatible servers can expose UI resources. Thanks to [@VikashLoomba](https://github.com/VikashLoomba) for #465.
20
+
21
+ ### Fixed
22
+
23
+ - Pre-registered OAuth clients can use HTTPS callback URLs through manual callback completion instead of being rejected as non-local redirects. Thanks to [@jluisrojas](https://github.com/jluisrojas) for PR #464.
24
+
25
+ ## [2.30.0] - 2026-08-28
26
+
27
+ ### Highlights
28
+ - Other extensions can safely inspect one runtime MCP server without seeing the whole MCP config.
29
+ - OAuth setup works better with providers that publish authorization metadata at a custom URL.
30
+ - MCP tool names are safer for providers, including servers with non-ASCII names.
31
+ - Token CLI commands and Windows request-header cleanup are less fragile in installed packages and long-running sessions.
32
+
33
+ ### Added
34
+
35
+ - Added a fail-closed API for child extensions to inspect one selected runtime MCP server without exporting configured servers or persisting the registration. (#453)
36
+ - Added `oauth.authServerMetadataUrl` for servers whose authorization-server metadata cannot be discovered through MCP protected-resource metadata. Thanks to [@fmoda3](https://github.com/fmoda3) for #458.
37
+
38
+ ### Fixed
39
+
40
+ - Namespace proxy tool names now use provider-safe characters without making encoded-looking server names collide with non-ASCII server names. Thanks to [@nyankosama](https://github.com/nyankosama) for PR #463.
41
+ - npm-installed token CLI commands now load their credential, config, and utility helpers from the published JavaScript build instead of package-local TypeScript files. Thanks to [@Qhilm](https://github.com/Qhilm) for #456.
42
+ - Server-scoped MCP calls now resolve raw upstream tool names before normalized fallbacks without weakening ambiguity checks. Thanks to [@MikeLP](https://github.com/MikeLP) for #452.
43
+ - Windows request-header command cleanup now treats an already-exited process (`taskkill` exit code 128) as successful cleanup. Thanks to [@peterxcx](https://github.com/peterxcx) for #457.
44
+
45
+ ## [2.29.0] - 2026-08-26
46
+
47
+ ### Highlights
48
+ - `/mcp setup` can now add Parallel Search as an opt-in preset.
49
+ - Users can try web search and page fetching without first creating an API key.
50
+ - MCP status updates work better in non-TUI hosts that provide plain theme values.
51
+
52
+ ### Added
53
+ - Added an opt-in Parallel Search preset to `/mcp setup` for web search and page fetching without an API key. Thanks to [@georgeatparallel](https://github.com/georgeatparallel) for PR #448.
54
+
55
+ ### Fixed
56
+ - MCP status updates now use plain text when a non-TUI host provides a theme without styling methods. Thanks to [@jinnnyang](https://github.com/jinnnyang) for #449.
57
+
58
+ ## [2.28.0] - 2026-08-26
59
+
60
+ ### Highlights
61
+ - MCP connections are less fragile when servers fail, recover, move slowly, or refresh their catalogs.
62
+ - Direct MCP tools are safer to expose, with stricter input checks and bounded result details when hosts opt in.
63
+ - Other Pi extensions can register MCP servers at runtime without sharing module state.
64
+ - Proxy calls now show live server progress in the interactive UI.
65
+ - Package installs and public helper imports are easier to use from downstream hosts.
66
+
67
+ ### Added
68
+ - Persistent metadata cache entries now honor server `ttlMs` hints without extending the default max age. Thanks to [@Seinra](https://github.com/Seinra) for #431.
69
+ - Proxy tool calls now forward server progress notifications to the interactive UI. Thanks to [@Seinra](https://github.com/Seinra) for PR #440 and for mapping the area in #431.
70
+ - Added a pure `mcp:` reference resolver API for consumers that validate adapter tool names from explicit config and cache inputs. Thanks to [@abdwhb-png](https://github.com/abdwhb-png) for PR #420.
71
+ - Direct tools can opt into strict advertised-schema validation with one-layer JSON recovery for object and array properties. Thanks to [@4ndr3wxh1ll](https://github.com/4ndr3wxh1ll) for PR #430.
72
+ - Direct tools can opt into guarded raw MCP result details, retaining bounded structured fields while summarizing oversized values.
73
+ - Embedding hosts can import the configuration loader and metadata cache helpers from public package subpaths, and can validate cached metadata against an explicit private process environment.
74
+
75
+ ### Fixed
76
+ - Runtime MCP registration now works across separately loaded Pi extensions through a versioned shared event contract. Thanks to [@fmoda3](https://github.com/fmoda3) for #443.
77
+ - Stdio MCP startup errors now identify a configured missing or non-directory `cwd` instead of blaming the executable. Thanks to [@SoyElf](https://github.com/SoyElf) for #442.
78
+ - Package installs with `--omit=dev` no longer run the public helper build during `prepare`; Git installs and package tarballs still include the built public exports. Thanks to [@KripaMishra](https://github.com/KripaMishra) for #441.
79
+ - MCP gateway descriptions now stay stable across metadata-only refreshes and keep live counts behind `mcp({})`. Thanks to [@voidfreud](https://github.com/voidfreud) for PR #432.
80
+ - Failed MCP servers in active backoff no longer remain advertised through cached direct tools, gateway list/search/describe results, or status tool counts. Thanks to [@voidfreud](https://github.com/voidfreud) for PR #434.
81
+ - OAuth token invalidation now preserves credentials replaced by another Pi process instead of letting a stale refresh delete newly authorized shared credentials. Thanks to [@mjlbach](https://github.com/mjlbach) for PR #422.
82
+ - Failed first-time MCP initialization no longer leaves the session permanently stuck with only `MCP not initialized`; the gateway keeps the failure reason and retries initialization on the next `mcp(...)` call. Thanks to [@hara-seihun](https://github.com/hara-seihun) for #428.
83
+ - HTTP 202 and unauthenticated HTTP 401 endpoint probes now report ambiguous endpoint shape instead of claiming the URL is not MCP. Thanks to [@jayshah5696](https://github.com/jayshah5696) for #415.
84
+ - Expanded `mcpScript` calls now show bounded submitted code. Thanks to [@DenisBalan](https://github.com/DenisBalan) for #413.
85
+ - Gateway parameters nested inside `args` now fail with top-level guidance instead of dispatching inconsistently. Thanks to [@voidfreud](https://github.com/voidfreud) for PR #417.
86
+ - Large direct-tool advisories now explain how to hide them with `settings.warnOnLargeDirectTools: false`. Thanks to [@afrodao2394](https://github.com/afrodao2394) for #412.
87
+ - Namespace proxy tools now use valid cached metadata, include resource-only proxy servers, clean up only prior namespace registrations, follow `MCP_DIRECT_TOOLS` selection, and skip ambiguous normalized server names. Thanks to [@abdwhb-png](https://github.com/abdwhb-png) for PR #414.
88
+ - Kept transient HTTP 503 connection failures as availability errors without multiplying gateway retries or misdiagnosing the endpoint as non-MCP. Thanks to [@elkaix](https://github.com/elkaix) for PR #411.
89
+ - Preserved cached keep-alive catalogs during transient 503 refresh outages while deferred recovery continues with bounded backoff.
90
+ - Startup connections that fail with a transient HTTP 503 now surface one quiet "temporarily unavailable; retry later" warning instead of the full hard failure; documented lifecycle behavior is unchanged, and keep-alive health checks continue their existing self-healing path. Thanks to [@elkaix](https://github.com/elkaix) for PR #424.
91
+
10
92
  ## [2.27.0] - 2026-08-20
11
93
 
12
94
  ### Highlights
@@ -24,6 +24,8 @@ pi install npm:pi-mcp-adapter
24
24
 
25
25
  Restart Pi after installation.
26
26
 
27
+ > **DeepSeek Harness (third-party bridge):** Run the unmodified adapter in DSH via [pi2dsh](https://github.com/weijiafu14/pi2dsh); see the [verified dsh-TUI and Web MCP guide](https://github.com/weijiafu14/pi2dsh/tree/main/examples/tui-mcp).
28
+
27
29
  ## What happens on first run
28
30
 
29
31
  The adapter reads standard MCP files automatically. No extra setup needed if you already have them.
@@ -145,22 +147,43 @@ A Pi package can ship MCP servers for the installed adapter without requiring a
145
147
  An extension can register MCP servers with the installed adapter at runtime, for example a plugin host that discovers plugins after load:
146
148
 
147
149
  ```ts
148
- import { registerMcpServer } from "pi-mcp-adapter";
150
+ const MCP_RUNTIME_REGISTER_EVENT = "pi-mcp-adapter:runtime-register:v1";
151
+ type RuntimeRegistrationRequest = {
152
+ version: 1;
153
+ name: string;
154
+ definition: { url: string };
155
+ result?:
156
+ | { ok: true; registration: { dispose(): Promise<void> } }
157
+ | { ok: false; error: Error };
158
+ };
149
159
 
150
160
  export default function pluginHost(pi) {
151
- const registration = registerMcpServer({
152
- pi,
153
- name: "acme__docs",
154
- definition: {
155
- url: "https://mcp.example.com/mcp",
156
- },
161
+ let registration: { dispose(): Promise<void> } | undefined;
162
+
163
+ pi.on("session_start", () => {
164
+ if (registration) return;
165
+ const request: RuntimeRegistrationRequest = {
166
+ version: 1,
167
+ name: "acme__docs",
168
+ definition: { url: "https://mcp.example.com/mcp" },
169
+ };
170
+ pi.events.emit(MCP_RUNTIME_REGISTER_EVENT, request);
171
+ if (!request.result) throw new Error("pi-mcp-adapter is not installed");
172
+ if (!request.result.ok) throw request.result.error;
173
+ registration = request.result.registration;
174
+ });
175
+
176
+ pi.on("session_shutdown", async () => {
177
+ const current = registration;
178
+ registration = undefined;
179
+ await current?.dispose();
157
180
  });
158
- // Later, when the plugin is uninstalled:
159
- await registration.dispose();
160
181
  }
161
182
  ```
162
183
 
163
- Runtime registrations are session scoped and never written to config files. Duplicate server names fail closed against configured servers and other registrations. Registered servers use the normal lazy connection, OAuth, approval, and shutdown behavior, but they are proxy-tool-only and their tools become visible at the next tool sync. To change a definition, dispose the registration and register again. Registration throws when no adapter is installed for the given Pi instance.
184
+ Cross-extension registration uses Pi's shared event bus and does not require a runtime import from `pi-mcp-adapter`. Emit during `session_start` or later so the adapter listener is installed. The adapter writes `request.result` synchronously; the first adapter listener to respond wins.
185
+
186
+ Runtime registrations are session scoped and never written to config files. Duplicate server names fail closed against configured servers and other registrations. Registered servers use the normal lazy connection, OAuth, approval, and shutdown behavior, but they are proxy-tool-only and their tools become visible at the next tool sync. To change a definition, dispose the registration and register again.
164
187
 
165
188
  ### SDK configuration
166
189
 
@@ -249,10 +272,11 @@ In the configuration examples below, `30000` is illustrative only. If `requestTi
249
272
  | `oauth.clientId` | Pre-registered OAuth client ID. MCP 2026 prefers pre-registered clients or Client ID Metadata Documents; this adapter falls back to Dynamic Client Registration when the ID is omitted and the server supports it. |
250
273
  | `oauth.clientSecret` | OAuth client secret for confidential clients; a value beginning with `!` runs a command when OAuth authenticates, while `!!` escapes a literal leading `!` |
251
274
  | `oauth.scope` | Requested OAuth scopes |
252
- | `oauth.redirectUri` | Exact localhost redirect URI for browser OAuth, including port and path, for providers that pre-register callbacks |
275
+ | `oauth.redirectUri` | Exact redirect URI for browser OAuth. Local `http://` loopback URIs need an explicit port. Pre-registered `https://` callbacks use manual completion by pasting the full callback URL. |
253
276
  | `oauth.clientName` | Client display name advertised during Dynamic Client Registration fallback |
254
277
  | `oauth.clientUri` | Client homepage URI advertised during Dynamic Client Registration fallback. Defaults to `piConfig.clientUri` from the host's manifest when set, and is omitted rather than guessed under a rebranded host |
255
278
  | `oauth.logoUri` | Client logo URL advertised during Dynamic Client Registration fallback (RFC 7591 `logo_uri`). Must be an absolute `http(s)` URL — consent screens fetch it server-side, so local paths render nothing. Omitted from the registration request when unset |
279
+ | `oauth.authServerMetadataUrl` | HTTPS URL of an OAuth/OIDC authorization-server metadata document. When set, this document is authoritative instead of MCP protected-resource discovery; its issuer remains validated by default |
256
280
  | `oauth.skipIssuerMetadataValidation` | `true` disables the OAuth authorization-server metadata issuer check for this server. This weakens OAuth mix-up protection and should only be used for known-misconfigured internal servers while their metadata is being fixed. |
257
281
  | `bearerToken` / `bearerTokenEnv` | Token or env var name; `bearerToken` supports `${VAR}` and `$env:VAR` interpolation. A leading `!` in `bearerToken` runs a command when the HTTP server connects; use `!!` for a literal leading `!`. |
258
282
  | `bearerTokenStore` | Set to `true` to read a static bearer token from the adapter-owned OS credential store when `auth` is `"bearer"` and no `bearerToken` or `bearerTokenEnv` is configured. Stored records are keyed only by the server name, bind to the resolved server URL, and are never named by config. Store a token with `pi-mcp-adapter token set <server>`, which reads it from a masked prompt or stdin pipe and never from an argument. `/mcp token status <server>` and `/mcp token remove <server>` manage non-secret state inside Pi; `/mcp token set` stays disabled until Pi exposes masked secret input. |
@@ -280,10 +304,12 @@ Use `"2026-07-28"` to pin that revision. Pinning has no legacy or SSE fallback a
280
304
 
281
305
  The stable SDK handles era-specific request envelopes, result decoding, list-changed subscriptions, cancellation, and multi-round-trip sampling/elicitation. The adapter keeps strict OAuth issuer validation in every mode. Adapter-level roots support, standard MCP logging presentation, and configuration/UI for protocol cache hints are not yet implemented.
282
306
 
283
- For pre-registered browser OAuth clients, set `oauth.redirectUri` to the exact callback registered with the provider, for example `"http://localhost:3118/callback"`. Dynamic clients normally omit it and use a lazy OS-assigned localhost callback port.
307
+ For pre-registered browser OAuth clients, set `oauth.redirectUri` to the exact callback registered with the provider, for example `"http://localhost:3118/callback"`. Dynamic clients normally omit it and use a lazy OS-assigned localhost callback port. A configured `https://` callback runs in manual mode because the adapter cannot receive a callback on another host. After authorization, copy the full callback URL from the browser address bar and paste it into `/mcp-auth` or `mcp({ action: "auth-complete", ... })`.
284
308
 
285
309
  If an internal authorization server publishes mismatched OAuth metadata and cannot be fixed immediately, set `oauth.skipIssuerMetadataValidation: true` on that server only. This is security-weakening. It disables the RFC 8414 issuer echo check and should not be used for public or untrusted servers.
286
310
 
311
+ If an MCP server does not publish usable protected-resource metadata, set `oauth.authServerMetadataUrl` to its HTTPS OAuth/OIDC authorization-server metadata document. The configured document is used authoritatively, while issuer validation remains enabled by default. This is trusted configuration; use it only for a metadata endpoint you control or explicitly trust.
312
+
287
313
  Secret values in `headers`, `bearerToken`, `oauth.clientSecret`, and stdio `env` may use a leading `!command` to obtain their value at connection or authentication time. The command runs with stdin and stderr suppressed, stdout is limited to 1 MiB and trimmed, and it must finish within 10 seconds with non-empty output; failures stop the connection or authentication flow. Commands are not run during OAuth discovery or while reading, merging, previewing, hashing, or rendering configuration. Use `!!` to escape a literal leading `!`; ordinary and escaped values retain environment interpolation.
288
314
 
289
315
  For local desktop bearer tokens, `bearerTokenStore: true` can opt in to the adapter-owned credential-store namespace. It never falls back to plaintext if the store is unavailable, if the stored record is malformed, or if the stored URL differs from the effective server URL. Literal tokens, command tokens, and environment tokens keep precedence so existing configs do not change. Create or rotate a stored token with `pi-mcp-adapter token set <server>` (masked prompt on a terminal, or piped stdin such as `security find-generic-password -s my-token -w | pi-mcp-adapter token set <server>`); the record binds to the effective configured URL at write time. Token commands need Node 22.18+.
@@ -383,6 +409,8 @@ When any enabled server uses `eager` or `keep-alive`, initialization also starts
383
409
  | `oauthDir` | Legacy OAuth `tokens.json` import directory for this MCP config. Relative paths resolve from the active project cwd. `MCP_OAUTH_DIR` still wins when set. Persistent OAuth credentials are stored in the OS credential store, not this directory. |
384
410
  | `mcpServers.<name>.oauth.authorizationParams` | Extra authorization URL parameters for provider-specific OAuth extensions. Flow-owned parameters such as `client_id`, `redirect_uri`, `scope`, `state`, `code_challenge`, `response_type`, and `resource` cannot be overridden. |
385
411
  | `directTools` | Global default for all servers (default: false). Per-server overrides this. |
412
+ | `strictDirectToolArguments` | Validate direct-tool inputs against their advertised schemas and recover one JSON string layer for object and array properties (default: false). |
413
+ | `directToolResultDetails` | Direct-tool result details: `"lean"` (default) or `"bounded"` to retain the guarded raw MCP result. |
386
414
  | `warnOnLargeDirectTools` | Show the advisory when 75 or more direct tools resolve (default: `true`). Set to `false` to suppress only this advisory. |
387
415
  | `freezeDirectTools` | Keep direct-tool registration stable after the initial sync so automatic reconnects and list-change notifications do not rebuild the system prompt. Use `mcp({ connect: "server" })` or `/mcp reconnect <server>` to refresh deliberately. Default: false. |
388
416
  | `scriptMode` | Register the MCP-only `mcpScript` plain-JavaScript tool (default: true). Set to `false` to hide it. |
@@ -438,7 +466,7 @@ Oversized MCP tool/resource results are guarded by default so a single huge resp
438
466
  - Inline text output is capped at **50 KiB / 2,000 lines** (matching Pi's built-in `bash` guard). Larger output is truncated to a head preview and the full text is saved to a temp file whose path is included in the result, so the agent can `read`/`grep` it.
439
467
  - **Image content blocks pass through unchanged** — only text output is guarded. Images are delivered to the provider as native image content.
440
468
  - Binary resource blobs up to **10 MiB** are decoded to private temp files and replaced with file references. Each session is limited to **100 MiB** and **10,000 files**. The files are removed at session teardown.
441
- - In proxy mode, `details.mcpResult` is kept raw when its JSON is **≤ 16 KiB**; larger results are replaced with a compact summary (block counts, sizes, key previews) and the raw JSON is saved to a temp file. Direct tools keep their lean details and never carry `mcpResult`.
469
+ - In proxy mode, `details.mcpResult` is kept raw when its JSON is **≤ 16 KiB**; larger results are replaced with a compact summary (block counts, sizes, key previews) and the raw JSON is saved to a temp file. Direct tools keep lean details unless `settings.directToolResultDetails` is set to `"bounded"`, which applies the same guarded `mcpResult` limit.
442
470
 
443
471
  Tune the text and details limits with the object form:
444
472
 
@@ -592,6 +620,10 @@ Each direct tool costs ~150-300 tokens in the system prompt (name + description
592
620
 
593
621
  Direct tools register from the metadata cache in the Pi agent dir (`~/.pi/agent/mcp-cache.json` by default, or `$PI_CODING_AGENT_DIR/mcp-cache.json` when set), so no server connections are needed at startup. On the first session after adding `directTools` to a new server, the cache won't exist yet — tools fall back to proxy-only while the cache populates, then the extension hot-loads the refreshed direct tools into the current session. Servers that advertise MCP list-change notifications refresh the current session when their tool or resource list changes. On Pi versions that expose `pi.unregisterTool()`, stale direct tools are removed from the registry during refresh; older Pi versions still deactivate them from the active tool set. To force a refresh: `/mcp reconnect <server>`.
594
622
 
623
+ Models sometimes encode an object or array argument as a JSON string. Set `settings.strictDirectToolArguments` to `true` to recover one such layer for schema-declared object and array properties, then validate the complete input against the advertised schema before execution.
624
+
625
+ Set `settings.directToolResultDetails` to `"bounded"` when an extension needs structured MCP result fields in Pi's direct-tool result details. The same output guard limits apply. Small leading structured fields stay available, while large fields receive bounded summaries and the complete guarded result follows the output guard's spill-file policy. The default `"lean"` mode keeps the existing server and tool metadata only.
626
+
595
627
  If prompt-cache stability matters more than automatic direct-tool hot-loading, set `settings.freezeDirectTools` to `true`. The initial direct-tool sync still runs, but later automatic reconnects, lazy-connects, and list-change notifications keep the registered tool surface unchanged. Deliberate refreshes through `mcp({ connect: "server" })` or `/mcp reconnect <server>` still update direct tools.
596
628
 
597
629
  When you change direct-tool toggles in `/mcp`, the extension updates direct tool registration in the current session. Broader setup writes from `/mcp setup` still use Pi's normal reload flow because they can add or restructure MCP config files.
@@ -730,9 +762,9 @@ Keys match a tool's original name, prefixed name, or a glob (`*` applies to ever
730
762
 
731
763
  When `includeSchemas` is enabled, search and describe render common JSON Schema parameters as compact TypeScript shapes like `{ query: string; limit?: number; }`, with the older schema formatter retained as a fallback for unsupported schemas.
732
764
 
733
- For HTTP servers, failed connects run a one-request shape probe that can turn opaque transport errors into setup hints such as `endpoint returned HTML (200) — this URL does not appear to speak MCP`. Healthy connections are not probed.
765
+ For HTTP servers, Pi reports HTTP 503 as temporary unavailability and does not add another immediate retry loop. Keep-alive servers keep cached metadata available and retry after 30 seconds, backing off to 5 minutes. Other failed connects run a one-request shape probe that can turn opaque transport errors into setup hints such as `endpoint returned HTML (200) — this URL does not appear to speak MCP`. Healthy connections are not probed.
734
766
 
735
- Servers that provide usage guidance via the MCP `instructions` field surface it at three levels: a truncated head in the `mcp` proxy tool description itself (so the model sees it without any call), a longer preview at the end of `mcp({ server: "name" })` listings, and the full text via `mcp({ instructions: "name" })`. Instructions are captured at connect time and cached alongside tool metadata, so they stay available without a live connection.
767
+ Servers that provide usage guidance via the MCP `instructions` field surface it through discovery paths: `mcp({ server: "name" })` includes a preview, and `mcp({ instructions: "name" })` returns the full text. Instructions are captured at connect time and cached alongside tool metadata, so they stay available without a live connection.
736
768
 
737
769
  ## Commands
738
770
 
@@ -202,13 +202,13 @@ async function runInit(argv, log = console.log) {
202
202
  async function importTokenModules(error) {
203
203
  try {
204
204
  const [store, config, utils] = await Promise.all([
205
- import("./mcp-bearer-store.ts"),
206
- import("./config.ts"),
207
- import("./utils.ts"),
205
+ import("./dist/mcp-bearer-store.js"),
206
+ import("./dist/config.js"),
207
+ import("./dist/utils.js"),
208
208
  ]);
209
209
  return { store, config, utils };
210
210
  } catch (err) {
211
- error("Token commands need a Node.js version that can load TypeScript modules (Node 22.18+ or 23+).");
211
+ error("Unable to load token command modules.");
212
212
  error(`Import failed: ${err instanceof Error ? err.message : String(err)}`);
213
213
  return undefined;
214
214
  }
@@ -17,6 +17,7 @@ import {
17
17
  writeStarterProjectConfig,
18
18
  } from "./config.ts";
19
19
  import { markKeepAliveAfterConnect, notifyToolMetadataUpdated, updateMetadataCache, updateStatusBar, getFailureAgeSeconds, getFailureMessage, clearFailure, recordFailure } from "./init.ts";
20
+ import { isServerInActiveFailureBackoff } from "./failure-backoff.ts";
20
21
  import { loadMetadataCache, reconstructPromptMetadata } from "./metadata-cache.ts";
21
22
  import { buildToolMetadata } from "./tool-metadata.ts";
22
23
  import { supportsOAuth, authenticate, removeAuth, type McpOAuthRuntime } from "./mcp-auth-flow.ts";
@@ -131,6 +132,7 @@ export async function showTools(state: McpExtensionState, ctx: ExtensionContext)
131
132
 
132
133
  const allTools = [...state.toolMetadata.entries()]
133
134
  .filter(([serverName]) => !isServerDisabled(state.config.mcpServers[serverName]))
135
+ .filter(([serverName]) => !isServerInActiveFailureBackoff(state, serverName))
134
136
  .flatMap(([, metadata]) => metadata.map(m => m.name));
135
137
 
136
138
  if (allTools.length === 0) {
@@ -196,9 +198,9 @@ export async function reconnectServer(
196
198
  state.serverInstructions.delete(name);
197
199
  }
198
200
  updateMetadataCache(state, name);
199
- notifyToolMetadataUpdated(state, name, "command-reconnect");
201
+ const restored = clearFailure(state, name, "command-reconnect");
202
+ if (!restored) notifyToolMetadataUpdated(state, name, "command-reconnect");
200
203
  markKeepAliveAfterConnect(state, name);
201
- clearFailure(state, name);
202
204
 
203
205
  if (ui) {
204
206
  ui.notify(
@@ -295,7 +297,7 @@ export async function authenticateServer(
295
297
  return ui.input(
296
298
  `Complete ${serverName} OAuth\n\n` +
297
299
  `${terminalHyperlink("Open authorization page", authorizationUrl)}\n${authorizationUrl}\n\n` +
298
- "Approve access, then paste the full localhost callback URL below.",
300
+ "Approve access, then paste the full callback URL from the browser address bar below.",
299
301
  undefined,
300
302
  { signal: inputSignal },
301
303
  );