@humain/humain-code 0.8.0 → 0.8.2

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 (281) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/bundle/chunks/{anthropic-messages-UZB5HJE3.js → anthropic-messages-XFCDMGD6.js} +4 -4
  3. package/dist/bundle/chunks/{azure-openai-responses-J3LCMWPQ.js → azure-openai-responses-F4KQM3NK.js} +3 -3
  4. package/dist/bundle/chunks/{chunk-7EONJCBE.js → chunk-2JNJJ6SZ.js} +1 -1
  5. package/dist/bundle/chunks/{chunk-3CGMVKHA.js → chunk-3E37CJCE.js} +1 -1
  6. package/dist/bundle/chunks/{chunk-SQ7NTRLJ.js → chunk-3PJ7NPWN.js} +20 -17
  7. package/dist/bundle/chunks/{chunk-WRYGY5XG.js → chunk-4MKATHT2.js} +1 -1
  8. package/dist/bundle/chunks/{chunk-ATFZAFMS.js → chunk-65FLSKDA.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-P2Y2H7SD.js → chunk-6JTCRCNF.js} +2 -2
  10. package/dist/bundle/chunks/{chunk-CET2MXXN.js → chunk-6P6MMQUH.js} +1 -1
  11. package/dist/bundle/chunks/{chunk-APNPBT7Y.js → chunk-BRSLXHED.js} +1 -1
  12. package/dist/bundle/chunks/{chunk-KONLZKPL.js → chunk-E4VUW4RI.js} +1 -1
  13. package/dist/bundle/chunks/{chunk-R3VDXQW2.js → chunk-EFY2QPVP.js} +6 -6
  14. package/dist/bundle/chunks/{chunk-4EV7CK26.js → chunk-F2H47FRF.js} +1 -1
  15. package/dist/bundle/chunks/{chunk-KQXXBQ57.js → chunk-G2QMON4O.js} +382 -331
  16. package/dist/bundle/chunks/{chunk-TYN46EVI.js → chunk-GPLWWO5Q.js} +1 -1
  17. package/dist/bundle/chunks/{chunk-JV7VHOAY.js → chunk-H2B3WLIM.js} +2 -2
  18. package/dist/bundle/chunks/chunk-H7UPU2SH.js +2093 -0
  19. package/dist/bundle/chunks/{chunk-NNWNIBLG.js → chunk-JKX5EGOT.js} +1 -1
  20. package/dist/bundle/chunks/{chunk-4SFWYKL5.js → chunk-JQBZUFH7.js} +467 -440
  21. package/dist/bundle/chunks/{chunk-D3KYOSQY.js → chunk-JSHKS7VH.js} +1 -1
  22. package/dist/bundle/chunks/{chunk-C4DHVDYT.js → chunk-JX6YIPNK.js} +1 -1
  23. package/dist/bundle/chunks/{chunk-Z5UFSRO4.js → chunk-KI7CHPWC.js} +1 -1
  24. package/dist/bundle/chunks/{chunk-VKQNYZUA.js → chunk-KRBELWQH.js} +1 -1
  25. package/dist/bundle/chunks/{chunk-AI7EHDAX.js → chunk-LSRXA7OS.js} +1 -1
  26. package/dist/bundle/chunks/{chunk-WBSGWISD.js → chunk-M5TVWJ5T.js} +5 -4
  27. package/dist/bundle/chunks/{chunk-XVIQYONJ.js → chunk-MIAXMK5F.js} +1 -1
  28. package/dist/bundle/chunks/{chunk-WGXMYMPE.js → chunk-PFBAIRCY.js} +2 -2
  29. package/dist/bundle/chunks/{chunk-CU6KU7JK.js → chunk-PJXBU6CR.js} +47 -44
  30. package/dist/bundle/chunks/{chunk-OVDMYBIT.js → chunk-PWFM6AQQ.js} +1 -1
  31. package/dist/bundle/chunks/{chunk-PGVDL4KB.js → chunk-QFDZEUFU.js} +2 -2
  32. package/dist/bundle/chunks/{chunk-DD5UT56Y.js → chunk-R2KD2HFT.js} +67 -66
  33. package/dist/bundle/chunks/{chunk-EMBIUIQ2.js → chunk-T2ZGMEMV.js} +46 -45
  34. package/dist/bundle/chunks/{chunk-IOLLZXQN.js → chunk-U4EAJPMO.js} +138 -126
  35. package/dist/bundle/chunks/chunk-UZOIHLNU.js +23 -0
  36. package/dist/bundle/chunks/{chunk-QRYDGY5I.js → chunk-ZSWU5KKA.js} +1 -1
  37. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-ETKC6B2S.js → cloudflare-workers-ai-system-one-JEZVYITT.js} +1 -1
  38. package/dist/bundle/chunks/{compat-HS4ARZK3.js → compat-ELBUCH6U.js} +6 -6
  39. package/dist/bundle/chunks/{curator-server-TC7RVVN2.js → curator-server-QB4GITGS.js} +1 -1
  40. package/dist/bundle/chunks/{dist-NMEXYUP3.js → dist-CBODG4CA.js} +5 -5
  41. package/dist/bundle/chunks/{dist-5AQPJ2TI.js → dist-NERIS6SW.js} +1 -1
  42. package/dist/bundle/chunks/{dist-DYB3AR7C.js → dist-QSYDYE3Y.js} +7 -7
  43. package/dist/bundle/chunks/{easter-egg-3d-VVUF3C3X.js → easter-egg-3d-VZC5WOYV.js} +1 -1
  44. package/dist/bundle/chunks/{execute-I3WGGPWL.js → execute-6MEJJF2T.js} +2 -2
  45. package/dist/bundle/chunks/{extract-QHZTEVJP.js → extract-L373D6O7.js} +2 -2
  46. package/dist/bundle/chunks/{flow-implementer-QMN3HKE2.js → flow-implementer-3P3BHQ7E.js} +4 -4
  47. package/dist/bundle/chunks/github-copilot.js +53 -56
  48. package/dist/bundle/chunks/{google-generative-ai-ZND73WDQ.js → google-generative-ai-WIASMWS3.js} +2 -2
  49. package/dist/bundle/chunks/{google-vertex-YAH62YRM.js → google-vertex-WSPHRZIZ.js} +3 -3
  50. package/dist/bundle/chunks/{host-Q565BCXB.js → host-WOLZCWQQ.js} +1 -1
  51. package/dist/bundle/chunks/{inprocess-453SLFL5.js → inprocess-3PDJKE5F.js} +5 -5
  52. package/dist/bundle/chunks/interactive-mode-SDUO5OLD.js +5 -0
  53. package/dist/bundle/chunks/{llama-cpp-classify-Z4GZY4GC.js → llama-cpp-classify-KYZT532X.js} +1 -1
  54. package/dist/bundle/chunks/{mistral-conversations-7I5JURDP.js → mistral-conversations-7JYDDRUT.js} +2 -2
  55. package/dist/bundle/chunks/{node-IMSYVRPL.js → node-N7TPBUJB.js} +1 -1
  56. package/dist/bundle/chunks/{openai-codex-responses-LTHOMN37.js → openai-codex-responses-7PAML4NF.js} +3 -3
  57. package/dist/bundle/chunks/{openai-completions-W2X635EE.js → openai-completions-UJDAIGTK.js} +3 -3
  58. package/dist/bundle/chunks/{openai-decisions-TN2GNOYI.js → openai-decisions-JMSDGR7K.js} +1 -1
  59. package/dist/bundle/chunks/{openai-responses-DVY4QXOG.js → openai-responses-2WNCE6AY.js} +3 -3
  60. package/dist/bundle/chunks/{openrouter-images-SE2JMS44.js → openrouter-images-V3UCCO6X.js} +1 -1
  61. package/dist/bundle/chunks/{pi-messages-WAS6Z5L5.js → pi-messages-TQ7LJUNQ.js} +2 -2
  62. package/dist/bundle/chunks/{session-picker-XNVLSJ22.js → session-picker-EYKCMFQR.js} +1 -1
  63. package/dist/bundle/chunks/{startup-ui-3TCT465D.js → startup-ui-7ODOR34R.js} +2 -2
  64. package/dist/bundle/chunks/{trace-command-7ORDQ3JS.js → trace-command-VM7FBWPE.js} +4 -4
  65. package/dist/bundle/chunks/{typesafe-system-one-AAZH6S3I.js → typesafe-system-one-YP7GGN4C.js} +1 -1
  66. package/dist/bundle/chunks/{virtual-modules-CIVXCEAN.js → virtual-modules-IU5KWB2C.js} +10 -10
  67. package/dist/bundle/cli-runtime.js +5 -5
  68. package/dist/bundle/index.js +8 -8
  69. package/dist/bundle/rpc-entry.js +4 -4
  70. package/dist/cli/args.js +1 -1
  71. package/dist/cli/args.js.map +1 -1
  72. package/dist/cli/list-models.d.ts.map +1 -1
  73. package/dist/cli/list-models.js +16 -1
  74. package/dist/cli/list-models.js.map +1 -1
  75. package/dist/cli/setup.d.ts +1 -1
  76. package/dist/cli/setup.d.ts.map +1 -1
  77. package/dist/cli/setup.js +3 -2
  78. package/dist/cli/setup.js.map +1 -1
  79. package/dist/cli.js.map +1 -1
  80. package/dist/core/agent-session-runtime.d.ts +3 -0
  81. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  82. package/dist/core/agent-session-runtime.js +11 -2
  83. package/dist/core/agent-session-runtime.js.map +1 -1
  84. package/dist/core/keybindings.d.ts +24 -0
  85. package/dist/core/keybindings.d.ts.map +1 -1
  86. package/dist/core/keybindings.js +3 -0
  87. package/dist/core/keybindings.js.map +1 -1
  88. package/dist/core/model-registry.d.ts.map +1 -1
  89. package/dist/core/model-registry.js +12 -1
  90. package/dist/core/model-registry.js.map +1 -1
  91. package/dist/core/model-resolver.d.ts.map +1 -1
  92. package/dist/core/model-resolver.js +13 -9
  93. package/dist/core/model-resolver.js.map +1 -1
  94. package/dist/core/model-runtime.d.ts +11 -2
  95. package/dist/core/model-runtime.d.ts.map +1 -1
  96. package/dist/core/model-runtime.js +23 -6
  97. package/dist/core/model-runtime.js.map +1 -1
  98. package/dist/core/oauth-account-pool.d.ts +4 -0
  99. package/dist/core/oauth-account-pool.d.ts.map +1 -1
  100. package/dist/core/oauth-account-pool.js +104 -20
  101. package/dist/core/oauth-account-pool.js.map +1 -1
  102. package/dist/core/sdk.js +2 -2
  103. package/dist/core/sdk.js.map +1 -1
  104. package/dist/core/settings-manager.d.ts +4 -0
  105. package/dist/core/settings-manager.d.ts.map +1 -1
  106. package/dist/core/settings-manager.js +17 -0
  107. package/dist/core/settings-manager.js.map +1 -1
  108. package/dist/core/settings-schema.d.ts +2 -0
  109. package/dist/core/settings-schema.d.ts.map +1 -1
  110. package/dist/core/settings-schema.js +10 -0
  111. package/dist/core/settings-schema.js.map +1 -1
  112. package/dist/core/slash-commands.d.ts.map +1 -1
  113. package/dist/core/slash-commands.js +1 -0
  114. package/dist/core/slash-commands.js.map +1 -1
  115. package/dist/extensions/usage/confirmation.d.ts.map +1 -1
  116. package/dist/extensions/usage/confirmation.js +1 -1
  117. package/dist/extensions/usage/confirmation.js.map +1 -1
  118. package/dist/extensions/usage/index.js +6 -6
  119. package/dist/extensions/usage/index.js.map +1 -1
  120. package/dist/extensions/usage/panes.d.ts +5 -0
  121. package/dist/extensions/usage/panes.d.ts.map +1 -0
  122. package/dist/extensions/usage/panes.js +10 -0
  123. package/dist/extensions/usage/panes.js.map +1 -0
  124. package/dist/extensions/usage/popup.d.ts.map +1 -1
  125. package/dist/extensions/usage/popup.js +9 -18
  126. package/dist/extensions/usage/popup.js.map +1 -1
  127. package/dist/humain/gateway/client.d.ts.map +1 -1
  128. package/dist/humain/gateway/client.js +36 -9
  129. package/dist/humain/gateway/client.js.map +1 -1
  130. package/dist/humain/gateway/http.d.ts.map +1 -1
  131. package/dist/humain/gateway/http.js +26 -6
  132. package/dist/humain/gateway/http.js.map +1 -1
  133. package/dist/humain/gateway/provider.d.ts.map +1 -1
  134. package/dist/humain/gateway/provider.js +9 -2
  135. package/dist/humain/gateway/provider.js.map +1 -1
  136. package/dist/humain/hcode/contracts.d.ts +15 -0
  137. package/dist/humain/hcode/contracts.d.ts.map +1 -1
  138. package/dist/humain/hcode/contracts.js +85 -10
  139. package/dist/humain/hcode/contracts.js.map +1 -1
  140. package/dist/humain/hcode/environment.d.ts.map +1 -1
  141. package/dist/humain/hcode/environment.js +4 -2
  142. package/dist/humain/hcode/environment.js.map +1 -1
  143. package/dist/humain/hcode/facade.d.ts +12 -1
  144. package/dist/humain/hcode/facade.d.ts.map +1 -1
  145. package/dist/humain/hcode/facade.js +35 -8
  146. package/dist/humain/hcode/facade.js.map +1 -1
  147. package/dist/humain/hcode/images.d.ts.map +1 -1
  148. package/dist/humain/hcode/images.js +4 -2
  149. package/dist/humain/hcode/images.js.map +1 -1
  150. package/dist/humain/hcode/login-copy.d.ts.map +1 -1
  151. package/dist/humain/hcode/login-copy.js +11 -1
  152. package/dist/humain/hcode/login-copy.js.map +1 -1
  153. package/dist/humain/hcode/notices.d.ts +22 -1
  154. package/dist/humain/hcode/notices.d.ts.map +1 -1
  155. package/dist/humain/hcode/notices.js +34 -3
  156. package/dist/humain/hcode/notices.js.map +1 -1
  157. package/dist/humain/hcode/provider.d.ts +3 -1
  158. package/dist/humain/hcode/provider.d.ts.map +1 -1
  159. package/dist/humain/hcode/provider.js +126 -46
  160. package/dist/humain/hcode/provider.js.map +1 -1
  161. package/dist/humain/hcode/run-credential.d.ts +21 -0
  162. package/dist/humain/hcode/run-credential.d.ts.map +1 -0
  163. package/dist/humain/hcode/run-credential.js +140 -0
  164. package/dist/humain/hcode/run-credential.js.map +1 -0
  165. package/dist/humain/hcode/sandbox.d.ts +6 -0
  166. package/dist/humain/hcode/sandbox.d.ts.map +1 -0
  167. package/dist/humain/hcode/sandbox.js +139 -0
  168. package/dist/humain/hcode/sandbox.js.map +1 -0
  169. package/dist/humain/hcode/selection.d.ts +7 -2
  170. package/dist/humain/hcode/selection.d.ts.map +1 -1
  171. package/dist/humain/hcode/selection.js +29 -5
  172. package/dist/humain/hcode/selection.js.map +1 -1
  173. package/dist/humain/hcode/transport.d.ts +3 -2
  174. package/dist/humain/hcode/transport.d.ts.map +1 -1
  175. package/dist/humain/hcode/transport.js +22 -7
  176. package/dist/humain/hcode/transport.js.map +1 -1
  177. package/dist/humain/remote/broker.d.ts +84 -0
  178. package/dist/humain/remote/broker.d.ts.map +1 -0
  179. package/dist/humain/remote/broker.js +427 -0
  180. package/dist/humain/remote/broker.js.map +1 -0
  181. package/dist/humain/remote/deny-store.d.ts +12 -0
  182. package/dist/humain/remote/deny-store.d.ts.map +1 -0
  183. package/dist/humain/remote/deny-store.js +164 -0
  184. package/dist/humain/remote/deny-store.js.map +1 -0
  185. package/dist/humain/remote/enablement.d.ts +5 -0
  186. package/dist/humain/remote/enablement.d.ts.map +1 -0
  187. package/dist/humain/remote/enablement.js +8 -0
  188. package/dist/humain/remote/enablement.js.map +1 -0
  189. package/dist/humain/remote/environment.d.ts +11 -0
  190. package/dist/humain/remote/environment.d.ts.map +1 -0
  191. package/dist/humain/remote/environment.js +19 -0
  192. package/dist/humain/remote/environment.js.map +1 -0
  193. package/dist/humain/remote/host-watch.d.ts +21 -0
  194. package/dist/humain/remote/host-watch.d.ts.map +1 -0
  195. package/dist/humain/remote/host-watch.js +186 -0
  196. package/dist/humain/remote/host-watch.js.map +1 -0
  197. package/dist/humain/remote/ipc-posix.d.ts +5 -0
  198. package/dist/humain/remote/ipc-posix.d.ts.map +1 -0
  199. package/dist/humain/remote/ipc-posix.js +29 -0
  200. package/dist/humain/remote/ipc-posix.js.map +1 -0
  201. package/dist/humain/remote/ipc-windows.d.ts +3 -0
  202. package/dist/humain/remote/ipc-windows.d.ts.map +1 -0
  203. package/dist/humain/remote/ipc-windows.js +5 -0
  204. package/dist/humain/remote/ipc-windows.js.map +1 -0
  205. package/dist/humain/remote/ipc.d.ts +10 -0
  206. package/dist/humain/remote/ipc.d.ts.map +1 -0
  207. package/dist/humain/remote/ipc.js +19 -0
  208. package/dist/humain/remote/ipc.js.map +1 -0
  209. package/dist/humain/remote/protocol.d.ts +43 -0
  210. package/dist/humain/remote/protocol.d.ts.map +1 -0
  211. package/dist/humain/remote/protocol.js +76 -0
  212. package/dist/humain/remote/protocol.js.map +1 -0
  213. package/dist/humain/remote/relay-socket.d.ts +30 -0
  214. package/dist/humain/remote/relay-socket.d.ts.map +1 -0
  215. package/dist/humain/remote/relay-socket.js +137 -0
  216. package/dist/humain/remote/relay-socket.js.map +1 -0
  217. package/dist/humain/remote/secure-channel.d.ts +10 -0
  218. package/dist/humain/remote/secure-channel.d.ts.map +1 -0
  219. package/dist/humain/remote/secure-channel.js +5 -0
  220. package/dist/humain/remote/secure-channel.js.map +1 -0
  221. package/dist/humain/remote/terminal.d.ts +48 -0
  222. package/dist/humain/remote/terminal.d.ts.map +1 -0
  223. package/dist/humain/remote/terminal.js +119 -0
  224. package/dist/humain/remote/terminal.js.map +1 -0
  225. package/dist/humain/remote/tickets.d.ts +35 -0
  226. package/dist/humain/remote/tickets.d.ts.map +1 -0
  227. package/dist/humain/remote/tickets.js +132 -0
  228. package/dist/humain/remote/tickets.js.map +1 -0
  229. package/dist/main.d.ts +1 -1
  230. package/dist/main.d.ts.map +1 -1
  231. package/dist/main.js +13 -1
  232. package/dist/main.js.map +1 -1
  233. package/dist/modes/interactive/components/account-picker.d.ts +31 -0
  234. package/dist/modes/interactive/components/account-picker.d.ts.map +1 -0
  235. package/dist/modes/interactive/components/account-picker.js +150 -0
  236. package/dist/modes/interactive/components/account-picker.js.map +1 -0
  237. package/dist/modes/interactive/components/settings-selector.d.ts +6 -0
  238. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  239. package/dist/modes/interactive/components/settings-selector.js +26 -0
  240. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  241. package/dist/modes/interactive/components/status-indicator.d.ts +35 -1
  242. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  243. package/dist/modes/interactive/components/status-indicator.js +179 -3
  244. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  245. package/dist/modes/interactive/components/working-indicator-engine.d.ts +32 -0
  246. package/dist/modes/interactive/components/working-indicator-engine.d.ts.map +1 -0
  247. package/dist/modes/interactive/components/working-indicator-engine.js +112 -0
  248. package/dist/modes/interactive/components/working-indicator-engine.js.map +1 -0
  249. package/dist/modes/interactive/fullscreen.d.ts +13 -0
  250. package/dist/modes/interactive/fullscreen.d.ts.map +1 -0
  251. package/dist/modes/interactive/fullscreen.js +25 -0
  252. package/dist/modes/interactive/fullscreen.js.map +1 -0
  253. package/dist/modes/interactive/interactive-mode.d.ts +19 -3
  254. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  255. package/dist/modes/interactive/interactive-mode.js +341 -54
  256. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  257. package/dist/modes/interactive/oauth-account-format.d.ts +9 -0
  258. package/dist/modes/interactive/oauth-account-format.d.ts.map +1 -1
  259. package/dist/modes/interactive/oauth-account-format.js +31 -22
  260. package/dist/modes/interactive/oauth-account-format.js.map +1 -1
  261. package/dist/modes/interactive/theme/humain-dark.json +5 -4
  262. package/dist/modes/interactive/theme/humain-light.json +6 -5
  263. package/docs/cli.md +1 -1
  264. package/docs/development.md +7 -0
  265. package/docs/forge-run-bootstrap.md +46 -0
  266. package/docs/humain-code.md +2 -2
  267. package/docs/index.md +2 -1
  268. package/docs/keybindings.md +10 -0
  269. package/docs/providers.md +16 -6
  270. package/docs/quickstart.md +16 -2
  271. package/docs/settings.md +20 -0
  272. package/docs/slash-commands.md +4 -2
  273. package/docs/usage.md +2 -0
  274. package/npm-shrinkwrap.json +2 -2
  275. package/package.json +1 -1
  276. package/schemas/keybindings.schema.json +12 -0
  277. package/schemas/settings.schema.json +29 -0
  278. package/dist/bundle/chunks/chunk-IXQYPQRQ.js +0 -2079
  279. package/dist/bundle/chunks/chunk-J5TSAJGC.js +0 -22
  280. package/dist/bundle/chunks/chunk-YPZPCHNV.js +0 -3
  281. package/dist/bundle/chunks/interactive-mode-MVZOJ5OU.js +0 -5
@@ -52,15 +52,19 @@ import { renderHumainCodeIcon } from "../../humain/brand-logo.js";
52
52
  import { CAVEMAN_LEVELS, getCavemanDefaultMode, resolveCavemanSessionMode } from "../../humain/caveman/index.js";
53
53
  import { bindFlowAccountsHost, createFlowAccountReporter, FLOW_ACCOUNT_PERSISTENCE_NOTICE, flowUsageTargets, formatFlowAccountAdvanced, listFlowAccountMetadata, nodeLabelContainsStoredKey, readFlowNodeFallbackState, refreshFlowCatalog, updateFlowNodeFallback, } from "../../humain/flow-accounts-host.js";
54
54
  import { HUMAIN_FUSE_PROVIDER } from "../../humain/fuse-provider.js";
55
+ import { HUMAIN_GATEWAY_PROVIDER } from "../../humain/gateway/constants.js";
55
56
  import { HCODE_SESSION_ONLY_NOTICE } from "../../humain/hcode/account.js";
56
57
  import { sameReference } from "../../humain/hcode/account-store.js";
57
58
  import { watchHcodeCatalog } from "../../humain/hcode/catalog-watch.js";
58
59
  import { hcodeDisplayName } from "../../humain/hcode/environment.js";
59
60
  import { HCODE_PROVIDER } from "../../humain/hcode/http.js";
60
61
  import { HCODE_LOGIN_MISMATCH_DETAILS, hcodeEmptyCatalogNotice, hcodeEmptyCatalogReason, hcodeLoginAvailability, hcodeSignedInElsewhereNotice, } from "../../humain/hcode/login-copy.js";
61
- import { availableHcodeSelection, HCODE_SELECTION_CHANGED_MESSAGE, HCODE_UNSUPPORTED_THINKING_MESSAGE, } from "../../humain/hcode/selection.js";
62
+ import { availableHcodeSelection, HCODE_SELECTION_CHANGED_MESSAGE, HCODE_UNSUPPORTED_THINKING_MESSAGE, hcodeExcludedSelection, hcodeSelectionUnavailable, } from "../../humain/hcode/selection.js";
62
63
  import { ACCOUNT_LOGIN_LABEL, API_KEY_LOGIN_LABEL, HUMAIN_LOGIN_LABEL, HUMAIN_SHIMMER_COLORS, humainLoginProviders, topLevelLoginOptions, } from "../../humain/login-menu.js";
63
64
  import { RUNTIME_MODES, readDefaultMode, resolveSessionMode as resolvePonytailSessionMode, } from "../../humain/ponytail/index.js";
65
+ import { isRemoteHostEnabled } from "../../humain/remote/enablement.js";
66
+ import { watchCurrentBranch } from "../../humain/remote/host-watch.js";
67
+ import { bindRemoteTerminalSession, runRemoteCommand, } from "../../humain/remote/terminal.js";
64
68
  import { raceWithAbortSignal, timerSignal } from "../../utils/abort.js";
65
69
  import { getChangelogPath, getNewEntries, normalizeChangelogLinks, parseChangelog } from "../../utils/changelog.js";
66
70
  import { copyToClipboard, readClipboardFilePaths, readClipboardText } from "../../utils/clipboard.js";
@@ -77,6 +81,7 @@ import { checkForNewPiVersion } from "../../utils/version-check.js";
77
81
  import { waitForSignalShutdown } from "../signal-shutdown.js";
78
82
  import { reportBug } from "./bug-report.js";
79
83
  import { createChatViewport } from "./chat-viewport.js";
84
+ import { AccountPickerComponent, } from "./components/account-picker.js";
80
85
  import { ArminComponent } from "./components/armin.js";
81
86
  import { AssistantMessageComponent } from "./components/assistant-message.js";
82
87
  import { BashExecutionComponent } from "./components/bash-execution.js";
@@ -100,7 +105,7 @@ import { formatAuthSelectorProviderType, OAuthSelectorComponent, } from "./compo
100
105
  import { createLoginMenuSelector } from "./components/radius-login-selector.js";
101
106
  import { ScopedModelsSelectorComponent } from "./components/scoped-models-selector.js";
102
107
  import { SessionSelectorComponent } from "./components/session-selector.js";
103
- import { SettingsSelectorComponent } from "./components/settings-selector.js";
108
+ import { createWorkingIndicatorChoice, SettingsSelectorComponent } from "./components/settings-selector.js";
104
109
  import { SkillInvocationMessageComponent } from "./components/skill-invocation-message.js";
105
110
  import { BranchSummaryStatusIndicator, CompactionStatusIndicator, IdleStatus, RetryStatusIndicator, WorkingStatusIndicator, } from "./components/status-indicator.js";
106
111
  import { ThemedText } from "./components/themed-text.js";
@@ -112,9 +117,10 @@ import { TrustSelectorComponent } from "./components/trust-selector.js";
112
117
  import { UserMessageComponent } from "./components/user-message.js";
113
118
  import { UserMessageSelectorComponent } from "./components/user-message-selector.js";
114
119
  import { editInExternalEditor } from "./external-editor.js";
120
+ import { FULLSCREEN_OVERLAY, fullscreenSurface } from "./fullscreen.js";
115
121
  import { checkWatchedHcodeCatalog, refreshModelCatalogs, refreshStartupModelCatalogs, retryHcodeCatalog, } from "./model-catalog-refresh.js";
116
122
  import { getModelSearchText } from "./model-search.js";
117
- import { formatOAuthAccountOption, formatOAuthAccountResetTime, formatOAuthAccountUsage, } from "./oauth-account-format.js";
123
+ import { formatOAuthAccountOption, formatOAuthAccountResetTime, formatOAuthAccountUsage, subscriptionAccountUsage, } from "./oauth-account-format.js";
118
124
  import { ProgramStatusReporter } from "./program-status-reporter.js";
119
125
  import { shareSession } from "./session-share.js";
120
126
  import { DEFAULT_THEME_NAME, getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getSelectListTheme, getThemeByName, onThemeChange, setRegisteredThemes, stopThemeWatcher, Theme, theme, } from "./theme/theme.js";
@@ -208,6 +214,13 @@ export function formatResumeCommand(sessionManager) {
208
214
  function hasDefaultModelProvider(providerId) {
209
215
  return providerId in defaultModelPerProvider;
210
216
  }
217
+ function gatewayCatalogUnavailableNotice(error) {
218
+ // Gateway access warnings can combine safe notices with server-derived catalog text in a plain Error.
219
+ // At this UI boundary, display only the fixed 5xx notice, never the surrounding provider error.
220
+ return error instanceof Error
221
+ ? error.message.match(/HUMAIN Gateway is temporarily unavailable \(5\d{2}\); your saved sign-in is unchanged\. Wait and retry \/model\./)?.[0]
222
+ : undefined;
223
+ }
211
224
  function llamaCppPostLoginGuidance(actionLabel, loadedModelCount) {
212
225
  return loadedModelCount === 0
213
226
  ? `${actionLabel}. No llama.cpp models are loaded. Use /llama to load a model, then /model to select it.`
@@ -331,6 +344,9 @@ export class InteractiveMode {
331
344
  pendingUserInputs = [];
332
345
  activeStatusIndicator = undefined;
333
346
  activeWorkingIndicatorEmbedded = false;
347
+ settingsWorkingPreview;
348
+ settingsPreviewOpen = false;
349
+ resolveWorkingIndicator = createWorkingIndicatorChoice();
334
350
  idleStatus = new IdleStatus();
335
351
  workingMessage = undefined;
336
352
  workingVisible = true;
@@ -422,6 +438,9 @@ export class InteractiveMode {
422
438
  // Custom header from extension (undefined = use built-in header)
423
439
  customHeader = undefined;
424
440
  options;
441
+ remoteTerminalLifetime;
442
+ remoteTerminalStopped = false;
443
+ remoteTerminal;
425
444
  onRightClickPaste = () => {
426
445
  void this.handleRightClickPaste();
427
446
  };
@@ -448,6 +467,7 @@ export class InteractiveMode {
448
467
  this.options = { ...options, tuiMode };
449
468
  this.autoTrustOnReloadCwd = options.autoTrustOnReloadCwd;
450
469
  this.runtimeHost.setBeforeSessionInvalidate(() => {
470
+ this.remoteTerminal = undefined;
451
471
  // The next session may bring a new model runtime; its account starts without the re-check.
452
472
  this.hcodeCatalogWatch?.stop();
453
473
  this.resetExtensionUI();
@@ -1136,8 +1156,7 @@ export class InteractiveMode {
1136
1156
  else {
1137
1157
  this.showWarning(this.hcodeCatalogFailed
1138
1158
  ? "Signed in to HUMAIN Code, but the model list could not be loaded. Use /model to retry."
1139
- : (this.options.modelFallbackMessage ??
1140
- "The saved HUMAIN Code model is unavailable. Use /model to choose another."));
1159
+ : hcodeSelectionUnavailable(runtime, [savedId]));
1141
1160
  }
1142
1161
  }
1143
1162
  await this.updateAvailableProviderCount();
@@ -2117,10 +2136,15 @@ export class InteractiveMode {
2117
2136
  }
2118
2137
  }
2119
2138
  showWorkingStatusIndicator() {
2139
+ if (this.settingsPreviewOpen)
2140
+ return;
2120
2141
  const colorFn = isEmbeddedStatus(this.editor)
2121
2142
  ? (text) => (this.editor.borderColor ?? theme.getThinkingBorderColor(this.session.thinkingLevel || "off"))(text)
2122
2143
  : undefined;
2123
- this.showStatusIndicator(new WorkingStatusIndicator(this.ui, this.workingMessage ?? this.defaultWorkingMessage, this.workingIndicatorOptions, colorFn));
2144
+ this.showStatusIndicator(new WorkingStatusIndicator(this.ui, this.workingMessage ?? this.defaultWorkingMessage, this.workingIndicatorOptions, colorFn, this.resolveWorkingIndicator(this.settingsManager.getWorkingIndicator()), this.session.model?.reasoning &&
2145
+ this.session.getAvailableThinkingLevels().includes(this.session.thinkingLevel)
2146
+ ? this.session.thinkingLevel
2147
+ : "off", this.settingsManager.getReducedMotion()));
2124
2148
  }
2125
2149
  setWorkingVisible(visible) {
2126
2150
  this.workingVisible = visible;
@@ -2137,7 +2161,7 @@ export class InteractiveMode {
2137
2161
  setWorkingIndicator(options) {
2138
2162
  this.workingIndicatorOptions = options;
2139
2163
  if (this.activeStatusIndicator?.kind === "working") {
2140
- this.activeStatusIndicator.setIndicator(options);
2164
+ this.showWorkingStatusIndicator();
2141
2165
  }
2142
2166
  this.ui.requestRender();
2143
2167
  }
@@ -2425,12 +2449,15 @@ export class InteractiveMode {
2425
2449
  /**
2426
2450
  * Show an extension dialog in the editor slot.
2427
2451
  * Dialogs form a stack: a new dialog hides the visible one, and closing the visible dialog shows
2428
- * the previous one again. Every dialog stays answerable, so no dialog promise is left pending,
2429
- * and dialogs opened from inside another dialog (for example a confirm from a custom component) work.
2452
+ * the previous one again, unless it requires uninterrupted local attention (Remote consent).
2453
+ * Dialogs opened from inside another dialog can still return to their parent.
2430
2454
  */
2431
- pushExtensionDialog(component, blocked, cancel) {
2455
+ pushExtensionDialog(component, blocked, cancel, visibility) {
2432
2456
  this.disposeActiveSelector();
2433
- this.extensionDialogs.push({ component, blocked, cancel });
2457
+ const covered = this.extensionDialogs.at(-1);
2458
+ this.extensionDialogs.push({ component, blocked, cancel, dismissOnCover: visibility === "foreground-only" });
2459
+ if (covered?.dismissOnCover)
2460
+ covered.cancel?.();
2434
2461
  this.showTopExtensionDialog();
2435
2462
  }
2436
2463
  /** Close every extension dialog and settle its pending promise, then show the editor. */
@@ -2492,6 +2519,84 @@ export class InteractiveMode {
2492
2519
  });
2493
2520
  return result === "Yes";
2494
2521
  }
2522
+ async handleRemoteCommand(input) {
2523
+ if (this.remoteTerminalStopped)
2524
+ return;
2525
+ const label = hcodeDisplayName(this.session.modelRuntime.hcode.environment.id);
2526
+ const owner = this.runtimeHost.sessionLifetime;
2527
+ let flags = this.options.featureFlags;
2528
+ const lookup = this.options.remoteFlagLookup;
2529
+ if (lookup) {
2530
+ try {
2531
+ flags = await lookup(owner);
2532
+ }
2533
+ catch {
2534
+ // Owner decision: a failed lookup must not block Remote; detail is withheld because it may carry credentials.
2535
+ this.showWarning(`${label}: Remote flag lookup failed; Remote stays available.`);
2536
+ }
2537
+ if (this.remoteTerminalStopped || owner.aborted)
2538
+ return;
2539
+ }
2540
+ // Disabled: no binding, broker, relay or pairing is ever touched.
2541
+ if (!isRemoteHostEnabled(flags)) {
2542
+ this.showWarning(`${label}: Remote is not enabled.`);
2543
+ return;
2544
+ }
2545
+ const binding = this.options.remoteWatch;
2546
+ if (binding)
2547
+ this.remoteTerminalLifetime ??= new AbortController();
2548
+ const terminal = this.remoteTerminalLifetime?.signal;
2549
+ if (owner.aborted || terminal?.aborted)
2550
+ return;
2551
+ const remote = this.remoteTerminal;
2552
+ const lifetime = remote?.owner === owner ? remote.lifetime : terminal ? AbortSignal.any([owner, terminal]) : owner;
2553
+ const ui = {
2554
+ notice: (message) => {
2555
+ if (!lifetime.aborted)
2556
+ this.showWarning(message);
2557
+ },
2558
+ confirm: (title, message, signal) => this.showRemoteConfirm(title, message, signal ? AbortSignal.any([signal, lifetime]) : lifetime),
2559
+ };
2560
+ if (binding && remote?.owner !== owner) {
2561
+ this.remoteTerminal = {
2562
+ owner,
2563
+ lifetime,
2564
+ session: bindRemoteTerminalSession({
2565
+ ...binding,
2566
+ environment: this.session.modelRuntime.hcode.environment,
2567
+ lifetime,
2568
+ source: watchCurrentBranch(this.session),
2569
+ ui,
2570
+ }),
2571
+ };
2572
+ }
2573
+ await runRemoteCommand(input, ui, this.remoteTerminal?.session, this.session.modelRuntime.hcode.environment.id);
2574
+ }
2575
+ /** Remote consent is local UI, not an agent question or a published blocked status. */
2576
+ showRemoteConfirm(title, message, signal) {
2577
+ if (signal?.aborted ||
2578
+ this.extensionDialogs.length ||
2579
+ this.activeSelectorToken ||
2580
+ this.extensionOverlays.size ||
2581
+ this.editorContainer.children[0] !== this.editor) {
2582
+ return Promise.resolve(false);
2583
+ }
2584
+ return new Promise((resolve) => {
2585
+ const finish = (allow) => {
2586
+ const current = this.extensionDialogs.at(-1)?.component === selector &&
2587
+ this.editorContainer.children[0] === selector &&
2588
+ !this.extensionOverlays.size;
2589
+ signal?.removeEventListener("abort", cancel);
2590
+ this.removeExtensionDialog(selector);
2591
+ resolve(allow && current && !signal?.aborted);
2592
+ };
2593
+ const cancel = () => finish(false);
2594
+ const selector = new ExtensionSelectorComponent(`${title}\n${message}`, ["No", "Yes"], (option) => finish(option === "Yes"), cancel);
2595
+ signal?.addEventListener("abort", cancel, { once: true });
2596
+ // Never resume a preselected Remote action after a different dialog takes focus.
2597
+ this.pushExtensionDialog(selector, undefined, cancel, "foreground-only");
2598
+ });
2599
+ }
2495
2600
  async promptForMissingSessionCwd(error) {
2496
2601
  const confirmed = await this.showExtensionConfirm("Session cwd not found", formatMissingSessionCwdPrompt(error.issue));
2497
2602
  return confirmed ? error.issue.fallbackCwd : undefined;
@@ -2685,7 +2790,12 @@ export class InteractiveMode {
2685
2790
  const w = c.width;
2686
2791
  return w ? { width: w } : undefined;
2687
2792
  };
2688
- overlayHandle = this.ui.showOverlay(c, resolveOptions());
2793
+ const overlayOptions = resolveOptions();
2794
+ const covered = this.extensionDialogs.at(-1);
2795
+ // Dismiss before mounting so dialog cleanup cannot steal the overlay's focus.
2796
+ if (covered?.dismissOnCover)
2797
+ covered.cancel?.();
2798
+ overlayHandle = this.ui.showOverlay(c, overlayOptions);
2689
2799
  this.extensionOverlays.set(overlayHandle, removeOverlay);
2690
2800
  // Expose handle to caller for visibility control
2691
2801
  options?.onHandle?.(overlayHandle);
@@ -2910,6 +3020,11 @@ export class InteractiveMode {
2910
3020
  this.editor.setText("");
2911
3021
  return;
2912
3022
  }
3023
+ if (/^\/remote(?:\s|$)/.test(text)) {
3024
+ this.editor.setText("");
3025
+ await this.handleRemoteCommand(text);
3026
+ return;
3027
+ }
2913
3028
  if (text === "/share") {
2914
3029
  await this.handleShareCommand();
2915
3030
  this.editor.setText("");
@@ -3216,6 +3331,12 @@ export class InteractiveMode {
3216
3331
  }
3217
3332
  break;
3218
3333
  case "message_update":
3334
+ if (this.activeStatusIndicator instanceof WorkingStatusIndicator) {
3335
+ if (event.assistantMessageEvent.type === "thinking_delta")
3336
+ this.activeStatusIndicator.setPhase("Thinking");
3337
+ if (event.assistantMessageEvent.type === "text_delta")
3338
+ this.activeStatusIndicator.setPhase("Writing");
3339
+ }
3219
3340
  if (this.streamingComponent && event.message.role === "assistant") {
3220
3341
  this.streamingMessage = event.message;
3221
3342
  this.streamingComponent.updateContent(this.streamingMessage, true);
@@ -3299,6 +3420,16 @@ export class InteractiveMode {
3299
3420
  // The bash execution callback handles TUI output rendering.
3300
3421
  break;
3301
3422
  case "tool_execution_start": {
3423
+ if (this.activeStatusIndicator instanceof WorkingStatusIndicator) {
3424
+ const name = event.toolName.toLowerCase();
3425
+ this.activeStatusIndicator.setPhase(name.includes("read")
3426
+ ? "Reading"
3427
+ : /edit|write/.test(name)
3428
+ ? "Editing"
3429
+ : /search|grep|find/.test(name)
3430
+ ? "Searching"
3431
+ : "Running");
3432
+ }
3302
3433
  // Nested calls (from codemode scripts) are shown inside their parent's row.
3303
3434
  if (event.parentToolCallId)
3304
3435
  break;
@@ -3914,6 +4045,8 @@ export class InteractiveMode {
3914
4045
  if (this.isShuttingDown)
3915
4046
  return;
3916
4047
  this.isShuttingDown = true;
4048
+ this.remoteTerminalStopped = true;
4049
+ this.remoteTerminalLifetime?.abort();
3917
4050
  this.releaseFlowAccountsHost();
3918
4051
  const termination = killTrackedDetachedChildrenAsync();
3919
4052
  // Keep signal handlers registered until terminal cleanup has completed.
@@ -4152,6 +4285,9 @@ export class InteractiveMode {
4152
4285
  }
4153
4286
  }
4154
4287
  updateEditorBorderColor() {
4288
+ const level = this.session.model?.reasoning && this.session.getAvailableThinkingLevels().includes(this.session.thinkingLevel)
4289
+ ? this.session.thinkingLevel
4290
+ : "off";
4155
4291
  const accent = this.isBashMode ? undefined : this.extensionEditorAccent;
4156
4292
  if ("setAccentLabel" in this.editor && typeof this.editor.setAccentLabel === "function")
4157
4293
  this.editor.setAccentLabel(accent?.label);
@@ -4163,9 +4299,12 @@ export class InteractiveMode {
4163
4299
  this.editor.borderColor = (s) => theme.fg(color, s);
4164
4300
  }
4165
4301
  else {
4166
- const level = this.session.thinkingLevel || "off";
4167
4302
  this.editor.borderColor = theme.getThinkingBorderColor(level);
4168
4303
  }
4304
+ if (this.activeStatusIndicator instanceof WorkingStatusIndicator)
4305
+ this.activeStatusIndicator.updateLevel(level);
4306
+ this.settingsWorkingPreview?.updateLevel(level);
4307
+ this.settingsWorkingPreview?.invalidate();
4169
4308
  this.activeStatusIndicator?.invalidate();
4170
4309
  this.ui.requestRender();
4171
4310
  }
@@ -4497,13 +4636,15 @@ export class InteractiveMode {
4497
4636
  dispose?.();
4498
4637
  }
4499
4638
  /**
4500
- * Shows a selector component in place of the editor.
4639
+ * Shows a selector in the editor area or an edge-to-edge fullscreen overlay.
4501
4640
  * @param create Factory that receives a `done` callback and returns the component and focus target
4502
4641
  */
4503
- showSelector(create) {
4642
+ showSelector(create, layout = "editor") {
4504
4643
  const token = {};
4505
4644
  let dispose;
4645
+ let hide;
4506
4646
  const done = () => {
4647
+ hide?.();
4507
4648
  dispose?.();
4508
4649
  if (this.activeSelectorToken !== token)
4509
4650
  return;
@@ -4517,10 +4658,20 @@ export class InteractiveMode {
4517
4658
  dispose = created.dispose;
4518
4659
  this.disposeActiveSelector();
4519
4660
  this.activeSelectorToken = token;
4520
- this.activeSelectorDispose = dispose;
4521
- this.editorContainer.clear();
4522
- this.editorContainer.addChild(created.component);
4523
- this.ui.setFocus(created.focus);
4661
+ if (layout === "fullscreen") {
4662
+ const handle = this.ui.showOverlay(fullscreenSurface(created.component, () => this.ui.terminal.rows), FULLSCREEN_OVERLAY.overlayOptions);
4663
+ hide = () => handle.hide();
4664
+ this.activeSelectorDispose = () => {
4665
+ hide?.();
4666
+ dispose?.();
4667
+ };
4668
+ }
4669
+ else {
4670
+ this.activeSelectorDispose = dispose;
4671
+ this.editorContainer.clear();
4672
+ this.editorContainer.addChild(created.component);
4673
+ this.ui.setFocus(created.focus);
4674
+ }
4524
4675
  this.ui.requestRender();
4525
4676
  }
4526
4677
  getModeSettings() {
@@ -4544,6 +4695,21 @@ export class InteractiveMode {
4544
4695
  showSettingsSelector() {
4545
4696
  this.showSelector((done) => {
4546
4697
  let selector;
4698
+ const previewContainer = new Container();
4699
+ let preview;
4700
+ this.settingsPreviewOpen = true;
4701
+ this.clearStatusIndicator("working");
4702
+ const updatePreview = () => {
4703
+ preview?.dispose();
4704
+ preview = new WorkingStatusIndicator(this.ui, "Working", this.workingIndicatorOptions, undefined, this.resolveWorkingIndicator(this.settingsManager.getWorkingIndicator()), this.session.model?.reasoning &&
4705
+ this.session.getAvailableThinkingLevels().includes(this.session.thinkingLevel)
4706
+ ? this.session.thinkingLevel
4707
+ : "off", this.settingsManager.getReducedMotion());
4708
+ this.settingsWorkingPreview = preview;
4709
+ previewContainer.clear();
4710
+ previewContainer.addChild(preview);
4711
+ this.ui.requestRender();
4712
+ };
4547
4713
  const defaultProvider = this.settingsManager.getDefaultProvider();
4548
4714
  const defaultModelId = this.settingsManager.getDefaultModel();
4549
4715
  const defaultModel = defaultProvider && defaultModelId ? `${defaultProvider}/${defaultModelId}` : "not set";
@@ -4571,6 +4737,8 @@ export class InteractiveMode {
4571
4737
  thinkingLevel: this.settingsManager.getDefaultThinkingLevel() ?? DEFAULT_THINKING_LEVEL,
4572
4738
  availableThinkingLevels: [...THINKING_LEVEL_OPTIONS],
4573
4739
  modelThinkingLevels: this.settingsManager.getAllModelThinkingLevels(),
4740
+ workingIndicator: this.settingsManager.getWorkingIndicator(),
4741
+ reducedMotion: this.settingsManager.getReducedMotion(),
4574
4742
  currentTheme: this.themeController.getThemeSelection() || DEFAULT_THEME_NAME,
4575
4743
  terminalTheme: this.themeController.getTerminalTheme(),
4576
4744
  availableThemes: getAvailableThemes(),
@@ -4698,6 +4866,14 @@ export class InteractiveMode {
4698
4866
  this.updateEditorBorderColor();
4699
4867
  }
4700
4868
  },
4869
+ onWorkingIndicatorChange: (value) => {
4870
+ this.settingsManager.setWorkingIndicator(value);
4871
+ updatePreview();
4872
+ },
4873
+ onReducedMotionChange: (value) => {
4874
+ this.settingsManager.setReducedMotion(value);
4875
+ updatePreview();
4876
+ },
4701
4877
  onThemeChange: (themeSetting) => {
4702
4878
  this.settingsManager.setTheme(themeSetting);
4703
4879
  this.themeController.setThemeSetting(themeSetting);
@@ -4811,7 +4987,19 @@ export class InteractiveMode {
4811
4987
  this.ui.requestRender();
4812
4988
  },
4813
4989
  });
4814
- return { component: selector, focus: selector.getSettingsList() };
4990
+ selector.addChild(previewContainer);
4991
+ updatePreview();
4992
+ return {
4993
+ component: selector,
4994
+ focus: selector.getSettingsList(),
4995
+ dispose: () => {
4996
+ preview?.dispose();
4997
+ this.settingsWorkingPreview = undefined;
4998
+ this.settingsPreviewOpen = false;
4999
+ if (this.session.isStreaming && this.workingVisible && !this.activeStatusIndicator)
5000
+ this.showWorkingStatusIndicator();
5001
+ },
5002
+ };
4815
5003
  });
4816
5004
  }
4817
5005
  handleThinkingCommand(searchTerm) {
@@ -4867,6 +5055,14 @@ export class InteractiveMode {
4867
5055
  const model = await this.findExactModelMatch(searchTerm);
4868
5056
  if (this.session !== session)
4869
5057
  return;
5058
+ // An explicitly managed ID cannot fall through to another provider's literal ID.
5059
+ if (!model || searchTerm.trim().toLowerCase().startsWith(`${HCODE_PROVIDER}/`)) {
5060
+ const excluded = hcodeExcludedSelection(session.modelRuntime, searchTerm);
5061
+ if (excluded) {
5062
+ this.showError(excluded);
5063
+ return;
5064
+ }
5065
+ }
4870
5066
  if (model) {
4871
5067
  try {
4872
5068
  const notice = await this.session.setModelKeepingThinking(model);
@@ -5560,7 +5756,7 @@ export class InteractiveMode {
5560
5756
  this.ui.requestRender();
5561
5757
  });
5562
5758
  return { component: selector, focus: selector };
5563
- });
5759
+ }, "fullscreen");
5564
5760
  }
5565
5761
  bindFlowAccountsHostToSession() {
5566
5762
  this.releaseFlowAccountsHost();
@@ -5752,7 +5948,10 @@ export class InteractiveMode {
5752
5948
  let unidentified = false;
5753
5949
  try {
5754
5950
  const options = { signal: AbortSignal.timeout(15_000) };
5755
- accounts = await runtime.accounts.list(provider.id, options);
5951
+ accounts = await runtime.accounts.list(provider.id, {
5952
+ ...options,
5953
+ ...(mode === "manage" ? { distinctForDisplay: true } : {}),
5954
+ });
5756
5955
  sources = await runtime.accounts.sources(provider.id, options);
5757
5956
  usageAccounts = provider.id === CODEX_USAGE_PROVIDER_ID ? await pool.list(provider.id, options) : [];
5758
5957
  unidentified =
@@ -5767,8 +5966,10 @@ export class InteractiveMode {
5767
5966
  }
5768
5967
  const now = Date.now();
5769
5968
  const labelCounts = new Map();
5770
- for (const account of accounts)
5771
- labelCounts.set(account.label, (labelCounts.get(account.label) ?? 0) + 1);
5969
+ for (const account of accounts) {
5970
+ const label = account.displayLabel ?? account.label;
5971
+ labelCounts.set(label, (labelCounts.get(label) ?? 0) + 1);
5972
+ }
5772
5973
  const isCodex = provider.id === CODEX_USAGE_PROVIDER_ID;
5773
5974
  const hasSubscriptionUsage = isCodex || isClaude;
5774
5975
  const accountLabel = (account) => {
@@ -5803,10 +6004,13 @@ export class InteractiveMode {
5803
6004
  ...extraOptions,
5804
6005
  ];
5805
6006
  this.showSelector((done) => {
5806
- const selector = new ExtensionSelectorComponent(mode === "logout"
5807
- ? `HUMAIN Code / Accounts — Remove which ${provider.name} account?`
5808
- : `HUMAIN Code / Accounts — ${provider.name}:`, currentOptions, (option) => {
6007
+ const cancel = () => {
5809
6008
  done();
6009
+ this.ui.requestRender();
6010
+ };
6011
+ const select = (index, action) => {
6012
+ done();
6013
+ const option = extraOptions[index - accounts.length];
5810
6014
  if (option === unidentifiedOption) {
5811
6015
  void this.removeUnidentifiedCredential(provider);
5812
6016
  return;
@@ -5819,26 +6023,95 @@ export class InteractiveMode {
5819
6023
  void this.showAccountPolicy(provider);
5820
6024
  return;
5821
6025
  }
5822
- if (sourceOptions.includes(option)) {
6026
+ if (option && sourceOptions.includes(option)) {
5823
6027
  void this.showExtensionSelector(`${option}\n${EXTERNAL_SOURCE_NOTICE}`, ["Back"]).then(() => this.showOAuthAccountSelector(provider));
5824
6028
  return;
5825
6029
  }
5826
- const index = currentOptions.indexOf(option);
5827
- if (index < 0 || index >= accounts.length)
5828
- return;
5829
6030
  const account = accounts[index];
5830
6031
  if (!account)
5831
6032
  return;
5832
- if (mode === "logout") {
6033
+ if (mode === "logout" || action === "remove") {
5833
6034
  void this.removeOAuthAccount(provider, account.key);
5834
6035
  }
6036
+ else if (action === "reconnect") {
6037
+ void this.reauthenticateAccount(provider.id, account.type, account.key);
6038
+ }
5835
6039
  else {
5836
- void this.showOAuthAccountActions(provider, account, undefined, claudeActions.get(account.key));
6040
+ void this.showOAuthAccountActions(provider, account, undefined, claudeActions.get(account.key), action === "choose" ? "Use for future requests" : undefined);
5837
6041
  }
5838
- }, () => {
5839
- done();
5840
- this.ui.requestRender();
5841
- });
6042
+ };
6043
+ const getRows = () => {
6044
+ const occurrences = new Map();
6045
+ const auth = runtime.getProvider(provider.id)?.auth;
6046
+ return [
6047
+ ...accounts.map((account, index) => {
6048
+ const state = usageStates[index];
6049
+ const usage = subscriptionAccountUsage(state.kind === "subscription" ? state.result : undefined);
6050
+ const loading = state.kind === "loading";
6051
+ const cooldown = account.exhaustedUntil !== undefined && account.exhaustedUntil > Date.now()
6052
+ ? formatOAuthAccountResetTime(account.exhaustedUntil)
6053
+ : undefined;
6054
+ const status = usage.expired
6055
+ ? "Sign-in expired"
6056
+ : usage.availability === "blocked" || cooldown
6057
+ ? "Blocked"
6058
+ : account.active
6059
+ ? "Active"
6060
+ : usage.weeklyLeft !== undefined
6061
+ ? "Ready"
6062
+ : "Saved";
6063
+ const subscription = account.type === "oauth" ? auth?.oauth?.isSubscription : auth?.apiKey?.isSubscription;
6064
+ const label = account.displayLabel ?? account.label;
6065
+ const occurrence = (occurrences.get(label) ?? 0) + 1;
6066
+ occurrences.set(label, occurrence);
6067
+ const duplicate = (labelCounts.get(label) ?? 0) > 1;
6068
+ return {
6069
+ kind: "account",
6070
+ label: duplicate ? `${occurrence}. ${label}` : label,
6071
+ status,
6072
+ loading,
6073
+ weeklyLeft: usage.weeklyLeft,
6074
+ details: [
6075
+ label,
6076
+ ...(duplicate ? [`Account ID: ${account.key}`] : []),
6077
+ `${account.type === "oauth" ? "OAuth" : "API key"}${subscription ? " subscription" : ""}`,
6078
+ `Status: ${status}${status !== "Active" && account.active ? " · Active" : ""}${account.effective ? " · Effective" : ""}`,
6079
+ `Provider: ${provider.name}${usage.availability ? ` · ${usage.availability === "unknown" ? "Unknown" : usage.availability === "allowed" ? "Allowed" : "Blocked"}` : ""}`,
6080
+ ...(cooldown ? [`Cached cooldown until ${cooldown}`] : []),
6081
+ ...(state.kind === "subscription" && state.status ? [state.status] : []),
6082
+ ...(state.kind === "none"
6083
+ ? []
6084
+ : loading
6085
+ ? ["Weekly usage: Loading…"]
6086
+ : [
6087
+ `Weekly left: ${usage.weeklyLeft === undefined ? "Unavailable" : `${usage.weeklyLeft}%`}`,
6088
+ ...(usage.reset ? [`Next reset: ${usage.reset}`] : []),
6089
+ `Saved resets: ${usage.savedResets}`,
6090
+ `Paid credits: ${usage.paidCredits}`,
6091
+ ...(usage.extraUsage ? [`Extra usage: ${usage.extraUsage}`] : []),
6092
+ ]),
6093
+ ],
6094
+ };
6095
+ }),
6096
+ ...extraOptions.map((label) => ({
6097
+ kind: "action",
6098
+ label,
6099
+ details: [
6100
+ label,
6101
+ label === addAccountOption
6102
+ ? "Connect another account for this provider."
6103
+ : label === policyOption
6104
+ ? "Configure auto-switch and API-key fallback."
6105
+ : EXTERNAL_SOURCE_NOTICE,
6106
+ ],
6107
+ })),
6108
+ ];
6109
+ };
6110
+ const logoutSelector = mode === "logout"
6111
+ ? new ExtensionSelectorComponent(`HUMAIN Code / Accounts — Remove which ${provider.name} account?`, currentOptions, (option) => select(currentOptions.indexOf(option), "choose"), cancel)
6112
+ : undefined;
6113
+ const selector = logoutSelector ??
6114
+ new AccountPickerComponent(`Manage accounts · ${provider.name}`, getRows, () => Math.max(1, this.ui.terminal?.rows ?? 24), select, cancel);
5842
6115
  const controller = new AbortController();
5843
6116
  let closed = false;
5844
6117
  if (hasSubscriptionUsage) {
@@ -5904,7 +6177,7 @@ export class InteractiveMode {
5904
6177
  ...accounts.map((entry, accountIndex) => formatOAuthAccountOption(accountLabel(entry), usageStates[accountIndex])),
5905
6178
  ...extraOptions,
5906
6179
  ];
5907
- selector.setOptions(currentOptions);
6180
+ logoutSelector?.setOptions(currentOptions);
5908
6181
  this.ui.requestRender();
5909
6182
  }
5910
6183
  };
@@ -5918,7 +6191,7 @@ export class InteractiveMode {
5918
6191
  controller.abort();
5919
6192
  },
5920
6193
  };
5921
- });
6194
+ }, "fullscreen");
5922
6195
  }
5923
6196
  async showAccountPolicy(provider) {
5924
6197
  try {
@@ -5974,20 +6247,21 @@ export class InteractiveMode {
5974
6247
  this.showError("Login method is no longer available.");
5975
6248
  }
5976
6249
  /** `flow` runs the actions inside the awaited Flow setup, where Back and Add another account stay in that flow. */
5977
- async showOAuthAccountActions(provider, account, flow, claudeUsage) {
6250
+ async showOAuthAccountActions(provider, account, flow, claudeUsage, directAction) {
5978
6251
  const signal = flow?.signal;
5979
6252
  const canRefresh = !flow && provider.id === ANTHROPIC_USAGE_PROVIDER_ID && account.type === "oauth";
5980
6253
  const usageText = claudeUsage ? `\n${formatOAuthAccountUsage(claudeUsage.state)}` : "";
5981
6254
  const reauthenticate = claudeUsage?.reconnect ? "Reconnect…" : "Reauthenticate…";
5982
- const action = await this.showExtensionSelector(`HUMAIN Code / Accounts — ${provider.name}: ${account.label}${usageText}\nSelection is global. OAuth plans may bill extra usage at the provider. OAuth logins without provider identity cannot detect duplicates; reconnect this account to keep the same entry.${flow ? `\n${FLOW_ACCOUNT_PERSISTENCE_NOTICE}` : ""}`, [
5983
- "Use for future requests",
5984
- "Rename…",
5985
- "Add another account…",
5986
- ...(canRefresh ? ["Refresh"] : []),
5987
- reauthenticate,
5988
- "Remove from HUMAIN Code…",
5989
- "Back",
5990
- ], { signal });
6255
+ const action = directAction ??
6256
+ (await this.showExtensionSelector(`HUMAIN Code / Accounts — ${provider.name}: ${account.label}${usageText}\nSelection is global. OAuth plans may bill extra usage at the provider. OAuth logins without provider identity cannot detect duplicates; reconnect this account to keep the same entry.${flow ? `\n${FLOW_ACCOUNT_PERSISTENCE_NOTICE}` : ""}`, [
6257
+ "Use for future requests",
6258
+ "Rename…",
6259
+ "Add another account…",
6260
+ ...(canRefresh ? ["Refresh"] : []),
6261
+ reauthenticate,
6262
+ "Remove from HUMAIN Code…",
6263
+ "Back",
6264
+ ], { signal }));
5991
6265
  if (action === "Back") {
5992
6266
  if (!flow)
5993
6267
  await this.showOAuthAccountSelector(provider);
@@ -6170,6 +6444,10 @@ export class InteractiveMode {
6170
6444
  return;
6171
6445
  close();
6172
6446
  this.ui.requestRender();
6447
+ if (readiness.kind === "not-configured" || readiness.kind === "http-error") {
6448
+ this.showStatus(hcodeLoginAvailability(readiness).text.replace(/ \[Retry\]$/, ""));
6449
+ return;
6450
+ }
6173
6451
  if (readiness.kind === "unreachable") {
6174
6452
  this.showStatus(`Can't reach ${readiness.host}: check VPN/Zscaler, then try /login again.`);
6175
6453
  return;
@@ -6250,7 +6528,7 @@ export class InteractiveMode {
6250
6528
  ? new ExtensionSelectorComponent(title, options, onSelect, onCancel)
6251
6529
  : createLoginMenuSelector(this.ui, title, options, { label: HUMAIN_LOGIN_LABEL, text: HUMAIN_LOGIN_LABEL, colors: HUMAIN_SHIMMER_COLORS }, onSelect, onCancel);
6252
6530
  return { component: selector, focus: selector, dispose: () => selector.dispose() };
6253
- });
6531
+ }, "fullscreen");
6254
6532
  }
6255
6533
  async checkHcodeLogin(signal) {
6256
6534
  const runtime = this.session.modelRuntime;
@@ -6426,7 +6704,7 @@ export class InteractiveMode {
6426
6704
  clearInterval(spinner);
6427
6705
  },
6428
6706
  };
6429
- });
6707
+ }, "fullscreen");
6430
6708
  }
6431
6709
  async showOAuthSelector(mode) {
6432
6710
  if (mode === "login") {
@@ -6458,7 +6736,7 @@ export class InteractiveMode {
6458
6736
  this.ui.requestRender();
6459
6737
  });
6460
6738
  return { component: selector, focus: selector };
6461
- });
6739
+ }, "fullscreen");
6462
6740
  }
6463
6741
  async completeProviderAuthentication(providerId, providerName, authType, previousModel) {
6464
6742
  if (providerId === HCODE_PROVIDER || providerId === HUMAIN_FUSE_PROVIDER) {
@@ -6556,7 +6834,10 @@ export class InteractiveMode {
6556
6834
  this.showWarning(`${actionLabel}, but its model catalog refresh timed out; using cached models.`);
6557
6835
  }
6558
6836
  else if (result.errors.size > 0) {
6559
- this.showWarning(`${actionLabel}, but its model catalog could not be refreshed; using cached models.`);
6837
+ const gatewayNotice = providerId === HUMAIN_GATEWAY_PROVIDER
6838
+ ? gatewayCatalogUnavailableNotice(result.errors.get(providerId))
6839
+ : undefined;
6840
+ this.showWarning(gatewayNotice ?? `${actionLabel}, but its model catalog could not be refreshed; using cached models.`);
6560
6841
  }
6561
6842
  // Do not replace a model or session selected while the refresh was running.
6562
6843
  if (deferSelection && this.session === session && session.model === previousModel) {
@@ -6567,7 +6848,10 @@ export class InteractiveMode {
6567
6848
  this.ui.requestRender();
6568
6849
  })
6569
6850
  .catch((error) => {
6570
- this.showWarning(`${actionLabel}, but its model catalog could not be refreshed: ${error instanceof Error ? error.message : String(error)}`);
6851
+ this.showWarning(providerId === HUMAIN_GATEWAY_PROVIDER
6852
+ ? (gatewayCatalogUnavailableNotice(error) ??
6853
+ `${actionLabel}, but its model catalog could not be refreshed; using cached models.`)
6854
+ : `${actionLabel}, but its model catalog could not be refreshed: ${error instanceof Error ? error.message : String(error)}`);
6571
6855
  })
6572
6856
  .finally(() => clearTimeout(timeout));
6573
6857
  }
@@ -7588,6 +7872,9 @@ export class InteractiveMode {
7588
7872
  }
7589
7873
  }
7590
7874
  stop(fullscreenExitOutput = this.settingsManager.getFullscreenExitOutput()) {
7875
+ this.remoteTerminalStopped = true;
7876
+ this.remoteTerminalLifetime?.abort();
7877
+ this.remoteTerminal = undefined;
7591
7878
  this.disposeActiveSelector();
7592
7879
  if (this.settingsManager.getShowTerminalProgress()) {
7593
7880
  this.ui.terminal.setProgress(false);