@humain/humain-code 0.8.3 → 0.8.4

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 (899) hide show
  1. package/CHANGELOG.md +141 -0
  2. package/dist/bundle/agent-monitor.js +1 -1
  3. package/dist/bundle/chunks/anthropic-messages-42CGJCSR.js +82 -0
  4. package/dist/bundle/chunks/ask-VH7GNX75.js +97 -0
  5. package/dist/bundle/chunks/azure-openai-responses-DOKKMBUN.js +15 -0
  6. package/dist/bundle/chunks/bedrock-converse-stream.js +200 -179
  7. package/dist/bundle/chunks/bowser-UX7KDMIY.js +92 -0
  8. package/dist/bundle/chunks/{chunk-46C6D7UC.js → chunk-2CYGUEQO.js} +1 -1
  9. package/dist/bundle/chunks/chunk-3RXT35Y3.js +3 -0
  10. package/dist/bundle/chunks/chunk-4BNDLR6C.js +177 -0
  11. package/dist/bundle/chunks/{chunk-MPRAQ6ZI.js → chunk-4LGBXPUD.js} +1 -1
  12. package/dist/bundle/chunks/chunk-4SL6URR3.js +90 -0
  13. package/dist/bundle/chunks/{chunk-7LSTTCSC.js → chunk-52642TYH.js} +316 -148
  14. package/dist/bundle/chunks/{chunk-LSRXA7OS.js → chunk-5C5K4EVJ.js} +3 -3
  15. package/dist/bundle/chunks/{chunk-2JNJJ6SZ.js → chunk-5KUCY54O.js} +3 -3
  16. package/dist/bundle/chunks/{chunk-4TDNOR36.js → chunk-625QJSFJ.js} +1 -1
  17. package/dist/bundle/chunks/chunk-73YX5XGR.js +2461 -0
  18. package/dist/bundle/chunks/chunk-7DIRHF4H.js +17 -0
  19. package/dist/bundle/chunks/{chunk-QJB5YI3I.js → chunk-7PAXKU7M.js} +1 -1
  20. package/dist/bundle/chunks/{chunk-R2KD2HFT.js → chunk-7YB3HRRN.js} +83 -196
  21. package/dist/bundle/chunks/{chunk-DCXHRP6C.js → chunk-A2UZYK23.js} +13 -13
  22. package/dist/bundle/chunks/chunk-A5ZMBTTM.js +12 -0
  23. package/dist/bundle/chunks/{chunk-JKX5EGOT.js → chunk-AER66CNP.js} +13 -13
  24. package/dist/bundle/chunks/chunk-ARTF7ZMQ.js +5 -0
  25. package/dist/bundle/chunks/chunk-B3FT6L6S.js +131 -0
  26. package/dist/bundle/chunks/chunk-BIC5BSNX.js +13 -0
  27. package/dist/bundle/chunks/{chunk-JSHKS7VH.js → chunk-BNZZJ4LO.js} +1 -1
  28. package/dist/bundle/chunks/{chunk-4MKATHT2.js → chunk-CG43CMFH.js} +1 -1
  29. package/dist/bundle/chunks/{chunk-2XD7TLKB.js → chunk-CIAXW64K.js} +16 -16
  30. package/dist/bundle/chunks/{chunk-VFLVWPLZ.js → chunk-CKFLQGJN.js} +20 -16
  31. package/dist/bundle/chunks/chunk-D4UCXXDP.js +115 -0
  32. package/dist/bundle/chunks/{chunk-HQMUDHC3.js → chunk-D6ZWWDW5.js} +6 -5
  33. package/dist/bundle/chunks/{chunk-4GB7A76U.js → chunk-EVDQRT3I.js} +225 -348
  34. package/dist/bundle/chunks/{chunk-FJIISX5W.js → chunk-F74XLJPC.js} +195 -192
  35. package/dist/bundle/chunks/chunk-FDRBTGFJ.js +4 -0
  36. package/dist/bundle/chunks/{chunk-E4VUW4RI.js → chunk-FLWO3H5J.js} +12 -12
  37. package/dist/bundle/chunks/{chunk-KLSRGGOH.js → chunk-G2PFPQX7.js} +2 -2
  38. package/dist/bundle/chunks/chunk-GMPJWLZS.js +57 -0
  39. package/dist/bundle/chunks/{chunk-M5TVWJ5T.js → chunk-H35P7ROY.js} +462 -441
  40. package/dist/bundle/chunks/chunk-HCHCYBNK.js +2 -0
  41. package/dist/bundle/chunks/{chunk-7WE77IE3.js → chunk-HRNYDRL7.js} +1 -1
  42. package/dist/bundle/chunks/chunk-HWFAAGYK.js +23 -0
  43. package/dist/bundle/chunks/{chunk-VSXVZVBE.js → chunk-HWXQCJDP.js} +408 -392
  44. package/dist/bundle/chunks/{chunk-PVNXN2TC.js → chunk-II5C7G67.js} +1 -1
  45. package/dist/bundle/chunks/{chunk-F2H47FRF.js → chunk-IMRZP5SC.js} +182 -137
  46. package/dist/bundle/chunks/{chunk-AW24RHGJ.js → chunk-J5YFXMTM.js} +4 -4
  47. package/dist/bundle/chunks/chunk-J64VNQ6D.js +13 -0
  48. package/dist/bundle/chunks/{chunk-65FLSKDA.js → chunk-K5EFEIFP.js} +5 -4
  49. package/dist/bundle/chunks/{chunk-KI7CHPWC.js → chunk-KJ3QRSSY.js} +46 -43
  50. package/dist/bundle/chunks/{cli-6DJO467D.js → chunk-KSEO2LRK.js} +12 -10
  51. package/dist/bundle/chunks/{chunk-HHWVVNGG.js → chunk-MA2WCMSN.js} +2 -2
  52. package/dist/bundle/chunks/{chunk-L4J7SMJB.js → chunk-MAEKQSFU.js} +1 -1
  53. package/dist/bundle/chunks/chunk-MHQNLTZR.js +8 -0
  54. package/dist/bundle/chunks/chunk-MLOUZAVZ.js +122 -0
  55. package/dist/bundle/chunks/chunk-MQYR4Q6X.js +5 -0
  56. package/dist/bundle/chunks/chunk-MXF3KYLZ.js +4 -0
  57. package/dist/bundle/chunks/{chunk-GY663MNP.js → chunk-MZRTVX7F.js} +1 -1
  58. package/dist/bundle/chunks/chunk-MZYHSWHX.js +59 -0
  59. package/dist/bundle/chunks/{chunk-6HTHDVJC.js → chunk-NPVRWPGX.js} +1 -1
  60. package/dist/bundle/chunks/{chunk-BRSLXHED.js → chunk-O44A4E4K.js} +1 -1
  61. package/dist/bundle/chunks/{chunk-T2ZGMEMV.js → chunk-OADQOW67.js} +175 -260
  62. package/dist/bundle/chunks/chunk-OTVHRZ67.js +17 -0
  63. package/dist/bundle/chunks/{chunk-J4GII2EE.js → chunk-P7SLTLSZ.js} +51 -46
  64. package/dist/bundle/chunks/{chunk-7OZNMWAJ.js → chunk-PPGSQZZF.js} +1 -1
  65. package/dist/bundle/chunks/chunk-PYX6ZCC7.js +29 -0
  66. package/dist/bundle/chunks/chunk-PZ7NYBHJ.js +8 -0
  67. package/dist/bundle/chunks/{chunk-VCMXBP5S.js → chunk-QESIDBMW.js} +1 -7
  68. package/dist/bundle/chunks/chunk-QUWVILLB.js +3 -0
  69. package/dist/bundle/chunks/chunk-QZWUXGY7.js +99 -0
  70. package/dist/bundle/chunks/{chunk-MIAXMK5F.js → chunk-QZXLTW7V.js} +8 -7
  71. package/dist/bundle/chunks/chunk-RP6MWUAP.js +4 -0
  72. package/dist/bundle/chunks/{chunk-MUN4ZZZP.js → chunk-SOE25WIS.js} +1143 -1167
  73. package/dist/bundle/chunks/{chunk-JSZBTGI6.js → chunk-SZZ5PNP6.js} +2 -2
  74. package/dist/bundle/chunks/chunk-T5WECB2D.js +7 -0
  75. package/dist/bundle/chunks/{chunk-2NVGOSBN.js → chunk-T7F2TEIS.js} +37 -13
  76. package/dist/bundle/chunks/{chunk-ZSWU5KKA.js → chunk-UOSJTMCL.js} +7 -3
  77. package/dist/bundle/chunks/{chunk-6P6MMQUH.js → chunk-UTRUALFN.js} +3 -3
  78. package/dist/bundle/chunks/{chunk-PWFM6AQQ.js → chunk-V2HTCZRF.js} +70 -67
  79. package/dist/bundle/chunks/{chunk-JX6YIPNK.js → chunk-WCKS2DPT.js} +1 -1
  80. package/dist/bundle/chunks/chunk-XGOJCV6Z.js +2 -0
  81. package/dist/bundle/chunks/chunk-XGSJX23G.js +1151 -0
  82. package/dist/bundle/chunks/{chunk-7WETECIB.js → chunk-Z7BWHPJ2.js} +1 -1
  83. package/dist/bundle/chunks/chunk-ZFFDBTG3.js +17 -0
  84. package/dist/bundle/chunks/cli-NJLV3XDZ.js +3 -0
  85. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-JEZVYITT.js → cloudflare-workers-ai-system-one-ZAZW4M4B.js} +1 -1
  86. package/dist/bundle/chunks/{compat-4ILE5BEC.js → compat-7UJJAO4E.js} +12 -12
  87. package/dist/bundle/chunks/{curator-server-QB4GITGS.js → curator-server-MW645JI3.js} +2 -2
  88. package/dist/bundle/chunks/{dist-NXHRL2KY.js → dist-7PCCEUQF.js} +2 -2
  89. package/dist/bundle/chunks/{dist-I6CI3CG5.js → dist-I53JI67E.js} +9 -9
  90. package/dist/bundle/chunks/{dist-35STTNYA.js → dist-NI2PTSLH.js} +1 -1
  91. package/dist/bundle/chunks/{dist-CBODG4CA.js → dist-VXQT3DQY.js} +6 -6
  92. package/dist/bundle/chunks/{dist-cjs-EROMDUKS.js → dist-cjs-4JQA6W3S.js} +31 -31
  93. package/dist/bundle/chunks/doctor-KJVAYG3F.js +83 -0
  94. package/dist/bundle/chunks/{easter-egg-3d-VZC5WOYV.js → easter-egg-3d-Z24JLXD4.js} +1 -1
  95. package/dist/bundle/chunks/entry-3EL6GOWK.js +2 -0
  96. package/dist/bundle/chunks/{entry-6XDR2IDE.js → entry-4IMREZBD.js} +80 -79
  97. package/dist/bundle/chunks/{execute-6MEJJF2T.js → execute-C4BZQRPQ.js} +23 -22
  98. package/dist/bundle/chunks/{extract-L373D6O7.js → extract-XVQCIS7D.js} +5 -5
  99. package/dist/bundle/chunks/{flow-implementer-XOP4MG5X.js → flow-implementer-GE2ARQKR.js} +5 -5
  100. package/dist/bundle/chunks/github-copilot.js +57 -56
  101. package/dist/bundle/chunks/google-generative-ai-P2P45MYP.js +22 -0
  102. package/dist/bundle/chunks/google-vertex-SHY4IS5F.js +26 -0
  103. package/dist/bundle/chunks/{host-WOLZCWQQ.js → host-YESS2VAB.js} +1 -1
  104. package/dist/bundle/chunks/{index.bundle-HONF3PUD.js → index.bundle-TZT64KLH.js} +102 -89
  105. package/dist/bundle/chunks/{inprocess-MBKFGDM2.js → inprocess-MGMVI6HN.js} +6 -6
  106. package/dist/bundle/chunks/interactive-mode-HHWOE4FD.js +5 -0
  107. package/dist/bundle/chunks/{llama-cpp-classify-KYZT532X.js → llama-cpp-classify-RSRH4KV2.js} +5 -5
  108. package/dist/bundle/chunks/mistral-conversations-YTMJKHHI.js +42 -0
  109. package/dist/bundle/chunks/{node-N7TPBUJB.js → node-FF6QQQLH.js} +1 -1
  110. package/dist/bundle/chunks/openai-codex-responses-NUCJOJSZ.js +97 -0
  111. package/dist/bundle/chunks/openai-completions-E5NRJUHA.js +91 -0
  112. package/dist/bundle/chunks/{openai-decisions-JMSDGR7K.js → openai-decisions-342J5ZYG.js} +1 -1
  113. package/dist/bundle/chunks/openai-responses-BN5Z4HFI.js +26 -0
  114. package/dist/bundle/chunks/openrouter-images-7RNG3JVF.js +12 -0
  115. package/dist/bundle/chunks/{pdfjs-FE3L72A6.js → pdfjs-LSTLRXQW.js} +1415 -1416
  116. package/dist/bundle/chunks/pi-messages-2L7FV5OK.js +22 -0
  117. package/dist/bundle/chunks/questionnaire-session-XEVAK7JS.js +123 -0
  118. package/dist/bundle/chunks/runtime-2FSZRUG5.js +2 -0
  119. package/dist/bundle/chunks/session-picker-666KJIVM.js +4 -0
  120. package/dist/bundle/chunks/startup-ui-INEVSNGK.js +3 -0
  121. package/dist/bundle/chunks/{trace-command-VM7FBWPE.js → trace-command-BCVMZ5ZD.js} +4 -4
  122. package/dist/bundle/chunks/typesafe-system-one-UJUNSZG4.js +3 -0
  123. package/dist/bundle/chunks/{undici-WVNE45GY.js → undici-7IGAYA4S.js} +1 -1
  124. package/dist/bundle/chunks/virtual-modules-UXSSFNV5.js +29 -0
  125. package/dist/bundle/cli-runtime.js +5 -5
  126. package/dist/bundle/flow/package.json +3 -3
  127. package/dist/bundle/index.js +13 -13
  128. package/dist/bundle/orchestrate/package.json +1 -1
  129. package/dist/bundle/rpc-entry.js +5 -4
  130. package/dist/cli/agent-dir-arg.d.ts +12 -0
  131. package/dist/cli/agent-dir-arg.d.ts.map +1 -0
  132. package/dist/cli/agent-dir-arg.js +15 -0
  133. package/dist/cli/agent-dir-arg.js.map +1 -0
  134. package/dist/cli/args.d.ts +9 -0
  135. package/dist/cli/args.d.ts.map +1 -1
  136. package/dist/cli/args.js +19 -5
  137. package/dist/cli/args.js.map +1 -1
  138. package/dist/cli/auth-check.d.ts +1 -1
  139. package/dist/cli/auth-check.d.ts.map +1 -1
  140. package/dist/cli/auth-check.js +4 -2
  141. package/dist/cli/auth-check.js.map +1 -1
  142. package/dist/cli/doctor-config.d.ts +14 -0
  143. package/dist/cli/doctor-config.d.ts.map +1 -0
  144. package/dist/cli/doctor-config.js +92 -0
  145. package/dist/cli/doctor-config.js.map +1 -0
  146. package/dist/cli/doctor-system.d.ts +12 -0
  147. package/dist/cli/doctor-system.d.ts.map +1 -0
  148. package/dist/cli/doctor-system.js +109 -0
  149. package/dist/cli/doctor-system.js.map +1 -0
  150. package/dist/cli/doctor.d.ts +11 -0
  151. package/dist/cli/doctor.d.ts.map +1 -0
  152. package/dist/cli/doctor.js +323 -0
  153. package/dist/cli/doctor.js.map +1 -0
  154. package/dist/cli/doctor.lazy.d.ts +3 -0
  155. package/dist/cli/doctor.lazy.d.ts.map +1 -0
  156. package/dist/cli/doctor.lazy.js +3 -0
  157. package/dist/cli/doctor.lazy.js.map +1 -0
  158. package/dist/cli/list-models.d.ts.map +1 -1
  159. package/dist/cli/list-models.js +0 -4
  160. package/dist/cli/list-models.js.map +1 -1
  161. package/dist/cli/project-trust.d.ts.map +1 -1
  162. package/dist/cli/project-trust.js +6 -6
  163. package/dist/cli/project-trust.js.map +1 -1
  164. package/dist/cli/startup-ui.d.ts +3 -2
  165. package/dist/cli/startup-ui.d.ts.map +1 -1
  166. package/dist/cli/startup-ui.js +23 -10
  167. package/dist/cli/startup-ui.js.map +1 -1
  168. package/dist/config.d.ts +5 -1
  169. package/dist/config.d.ts.map +1 -1
  170. package/dist/config.js +13 -3
  171. package/dist/config.js.map +1 -1
  172. package/dist/coordination/broker/broker.d.ts +3 -3
  173. package/dist/coordination/broker/broker.d.ts.map +1 -1
  174. package/dist/coordination/broker/broker.js +15 -7
  175. package/dist/coordination/broker/broker.js.map +1 -1
  176. package/dist/core/acceptance-command.d.ts +6 -3
  177. package/dist/core/acceptance-command.d.ts.map +1 -1
  178. package/dist/core/acceptance-command.js +43 -12
  179. package/dist/core/acceptance-command.js.map +1 -1
  180. package/dist/core/acceptance-ledger.d.ts +2 -0
  181. package/dist/core/acceptance-ledger.d.ts.map +1 -1
  182. package/dist/core/acceptance-ledger.js +14 -3
  183. package/dist/core/acceptance-ledger.js.map +1 -1
  184. package/dist/core/agent-session-runtime.d.ts +11 -4
  185. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  186. package/dist/core/agent-session-runtime.js +13 -4
  187. package/dist/core/agent-session-runtime.js.map +1 -1
  188. package/dist/core/agent-session-services.d.ts.map +1 -1
  189. package/dist/core/agent-session-services.js +6 -0
  190. package/dist/core/agent-session-services.js.map +1 -1
  191. package/dist/core/agent-session.d.ts +19 -1
  192. package/dist/core/agent-session.d.ts.map +1 -1
  193. package/dist/core/agent-session.js +131 -36
  194. package/dist/core/agent-session.js.map +1 -1
  195. package/dist/core/auth-storage.d.ts.map +1 -1
  196. package/dist/core/auth-storage.js +7 -1
  197. package/dist/core/auth-storage.js.map +1 -1
  198. package/dist/core/bash-executor.d.ts +3 -1
  199. package/dist/core/bash-executor.d.ts.map +1 -1
  200. package/dist/core/bash-executor.js +18 -8
  201. package/dist/core/bash-executor.js.map +1 -1
  202. package/dist/core/compaction/branch-summarization.d.ts +2 -2
  203. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  204. package/dist/core/compaction/branch-summarization.js +9 -15
  205. package/dist/core/compaction/branch-summarization.js.map +1 -1
  206. package/dist/core/compaction/compaction.d.ts.map +1 -1
  207. package/dist/core/compaction/compaction.js +3 -0
  208. package/dist/core/compaction/compaction.js.map +1 -1
  209. package/dist/core/export-html/index.d.ts.map +1 -1
  210. package/dist/core/export-html/index.js +12 -10
  211. package/dist/core/export-html/index.js.map +1 -1
  212. package/dist/core/export-html/template.js +23 -1
  213. package/dist/core/extensions/runner.d.ts.map +1 -1
  214. package/dist/core/extensions/runner.js +13 -2
  215. package/dist/core/extensions/runner.js.map +1 -1
  216. package/dist/core/extensions/types.d.ts +9 -1
  217. package/dist/core/extensions/types.d.ts.map +1 -1
  218. package/dist/core/extensions/types.js.map +1 -1
  219. package/dist/core/footer-data-provider.d.ts.map +1 -1
  220. package/dist/core/footer-data-provider.js +2 -4
  221. package/dist/core/footer-data-provider.js.map +1 -1
  222. package/dist/core/http-dispatcher.d.ts +5 -2
  223. package/dist/core/http-dispatcher.d.ts.map +1 -1
  224. package/dist/core/http-dispatcher.js +6 -3
  225. package/dist/core/http-dispatcher.js.map +1 -1
  226. package/dist/core/keybindings.d.ts +20 -0
  227. package/dist/core/keybindings.d.ts.map +1 -1
  228. package/dist/core/keybindings.js +4 -1
  229. package/dist/core/keybindings.js.map +1 -1
  230. package/dist/core/mcp-servers.d.ts +29 -0
  231. package/dist/core/mcp-servers.d.ts.map +1 -1
  232. package/dist/core/mcp-servers.js +63 -17
  233. package/dist/core/mcp-servers.js.map +1 -1
  234. package/dist/core/messages.d.ts +4 -0
  235. package/dist/core/messages.d.ts.map +1 -1
  236. package/dist/core/messages.js +10 -2
  237. package/dist/core/messages.js.map +1 -1
  238. package/dist/core/model-config.d.ts +36 -0
  239. package/dist/core/model-config.d.ts.map +1 -1
  240. package/dist/core/model-resolver.js +1 -1
  241. package/dist/core/model-resolver.js.map +1 -1
  242. package/dist/core/model-runtime.d.ts.map +1 -1
  243. package/dist/core/model-runtime.js +6 -2
  244. package/dist/core/model-runtime.js.map +1 -1
  245. package/dist/core/nested-tool-calls.d.ts +6 -5
  246. package/dist/core/nested-tool-calls.d.ts.map +1 -1
  247. package/dist/core/nested-tool-calls.js +1 -3
  248. package/dist/core/nested-tool-calls.js.map +1 -1
  249. package/dist/core/os-secret-store.js +1 -1
  250. package/dist/core/os-secret-store.js.map +1 -1
  251. package/dist/core/package-manager.d.ts +3 -1
  252. package/dist/core/package-manager.d.ts.map +1 -1
  253. package/dist/core/package-manager.js +25 -4
  254. package/dist/core/package-manager.js.map +1 -1
  255. package/dist/core/pi-ai-schemas.d.ts +4 -0
  256. package/dist/core/pi-ai-schemas.d.ts.map +1 -1
  257. package/dist/core/project-trust.d.ts.map +1 -1
  258. package/dist/core/project-trust.js +1 -1
  259. package/dist/core/project-trust.js.map +1 -1
  260. package/dist/core/provider-composer.d.ts +1 -0
  261. package/dist/core/provider-composer.d.ts.map +1 -1
  262. package/dist/core/provider-composer.js +1 -0
  263. package/dist/core/provider-composer.js.map +1 -1
  264. package/dist/core/resolve-config-value.d.ts +4 -0
  265. package/dist/core/resolve-config-value.d.ts.map +1 -1
  266. package/dist/core/resolve-config-value.js +14 -3
  267. package/dist/core/resolve-config-value.js.map +1 -1
  268. package/dist/core/resource-loader.d.ts.map +1 -1
  269. package/dist/core/resource-loader.js +40 -2
  270. package/dist/core/resource-loader.js.map +1 -1
  271. package/dist/core/runtime-credentials.d.ts.map +1 -1
  272. package/dist/core/runtime-credentials.js +11 -7
  273. package/dist/core/runtime-credentials.js.map +1 -1
  274. package/dist/core/sdk.d.ts.map +1 -1
  275. package/dist/core/sdk.js +8 -4
  276. package/dist/core/sdk.js.map +1 -1
  277. package/dist/core/session-manager.d.ts +22 -1
  278. package/dist/core/session-manager.d.ts.map +1 -1
  279. package/dist/core/session-manager.js +227 -37
  280. package/dist/core/session-manager.js.map +1 -1
  281. package/dist/core/settings-defaults.d.ts +10 -1
  282. package/dist/core/settings-defaults.d.ts.map +1 -1
  283. package/dist/core/settings-defaults.js +7 -1
  284. package/dist/core/settings-defaults.js.map +1 -1
  285. package/dist/core/settings-manager.d.ts +14 -4
  286. package/dist/core/settings-manager.d.ts.map +1 -1
  287. package/dist/core/settings-manager.js +48 -15
  288. package/dist/core/settings-manager.js.map +1 -1
  289. package/dist/core/settings-schema.d.ts +20 -2
  290. package/dist/core/settings-schema.d.ts.map +1 -1
  291. package/dist/core/settings-schema.js +27 -4
  292. package/dist/core/settings-schema.js.map +1 -1
  293. package/dist/core/slash-commands.d.ts.map +1 -1
  294. package/dist/core/slash-commands.js +2 -0
  295. package/dist/core/slash-commands.js.map +1 -1
  296. package/dist/core/tools/bash-jobs.js +2 -2
  297. package/dist/core/tools/bash-jobs.js.map +1 -1
  298. package/dist/core/tools/bash.d.ts +3 -0
  299. package/dist/core/tools/bash.d.ts.map +1 -1
  300. package/dist/core/tools/bash.js +78 -46
  301. package/dist/core/tools/bash.js.map +1 -1
  302. package/dist/core/tools/edit-diff.d.ts +7 -1
  303. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  304. package/dist/core/tools/edit-diff.js +139 -75
  305. package/dist/core/tools/edit-diff.js.map +1 -1
  306. package/dist/core/tools/edit.d.ts.map +1 -1
  307. package/dist/core/tools/edit.js +4 -1
  308. package/dist/core/tools/edit.js.map +1 -1
  309. package/dist/core/tools/output-accumulator.d.ts +21 -6
  310. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  311. package/dist/core/tools/output-accumulator.js +90 -76
  312. package/dist/core/tools/output-accumulator.js.map +1 -1
  313. package/dist/core/tools/render-utils.d.ts +7 -2
  314. package/dist/core/tools/render-utils.d.ts.map +1 -1
  315. package/dist/core/tools/render-utils.js +14 -1
  316. package/dist/core/tools/render-utils.js.map +1 -1
  317. package/dist/core/tools/renderers/bash.d.ts.map +1 -1
  318. package/dist/core/tools/renderers/bash.js +9 -3
  319. package/dist/core/tools/renderers/bash.js.map +1 -1
  320. package/dist/core/tools/truncate.d.ts +1 -1
  321. package/dist/core/tools/truncate.d.ts.map +1 -1
  322. package/dist/core/tools/truncate.js +16 -7
  323. package/dist/core/tools/truncate.js.map +1 -1
  324. package/dist/core/tools/write.d.ts.map +1 -1
  325. package/dist/core/tools/write.js +2 -0
  326. package/dist/core/tools/write.js.map +1 -1
  327. package/dist/core/trust-manager.d.ts +2 -0
  328. package/dist/core/trust-manager.d.ts.map +1 -1
  329. package/dist/core/trust-manager.js +5 -4
  330. package/dist/core/trust-manager.js.map +1 -1
  331. package/dist/core/usage-totals.d.ts.map +1 -1
  332. package/dist/core/usage-totals.js +3 -0
  333. package/dist/core/usage-totals.js.map +1 -1
  334. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  335. package/dist/extensions/codemode/execute.js +64 -20
  336. package/dist/extensions/codemode/execute.js.map +1 -1
  337. package/dist/extensions/codemode/renderer.d.ts.map +1 -1
  338. package/dist/extensions/codemode/renderer.js +8 -3
  339. package/dist/extensions/codemode/renderer.js.map +1 -1
  340. package/dist/extensions/codemode/tool.d.ts +5 -0
  341. package/dist/extensions/codemode/tool.d.ts.map +1 -1
  342. package/dist/extensions/codemode/tool.js.map +1 -1
  343. package/dist/extensions/llama/client.d.ts.map +1 -1
  344. package/dist/extensions/llama/client.js +3 -13
  345. package/dist/extensions/llama/client.js.map +1 -1
  346. package/dist/extensions/llama/ui.d.ts.map +1 -1
  347. package/dist/extensions/llama/ui.js +2 -1
  348. package/dist/extensions/llama/ui.js.map +1 -1
  349. package/dist/extensions/mcp/cli.d.ts +7 -0
  350. package/dist/extensions/mcp/cli.d.ts.map +1 -1
  351. package/dist/extensions/mcp/cli.js +35 -8
  352. package/dist/extensions/mcp/cli.js.map +1 -1
  353. package/dist/extensions/mcp/config.d.ts +33 -0
  354. package/dist/extensions/mcp/config.d.ts.map +1 -1
  355. package/dist/extensions/mcp/config.js +11 -2
  356. package/dist/extensions/mcp/config.js.map +1 -1
  357. package/dist/extensions/mcp/index.d.ts +8 -0
  358. package/dist/extensions/mcp/index.d.ts.map +1 -1
  359. package/dist/extensions/mcp/index.js +16 -0
  360. package/dist/extensions/mcp/index.js.map +1 -1
  361. package/dist/extensions/mcp/resources.d.ts +1 -1
  362. package/dist/extensions/mcp/resources.d.ts.map +1 -1
  363. package/dist/extensions/mcp/resources.js +4 -3
  364. package/dist/extensions/mcp/resources.js.map +1 -1
  365. package/dist/extensions/mcp/runtime.d.ts +1 -1
  366. package/dist/extensions/mcp/runtime.d.ts.map +1 -1
  367. package/dist/extensions/mcp/runtime.js +15 -14
  368. package/dist/extensions/mcp/runtime.js.map +1 -1
  369. package/dist/extensions/mcp/tools.d.ts +1 -24
  370. package/dist/extensions/mcp/tools.d.ts.map +1 -1
  371. package/dist/extensions/mcp/tools.js +10 -163
  372. package/dist/extensions/mcp/tools.js.map +1 -1
  373. package/dist/humain/ask-user-question/index.d.ts +4 -0
  374. package/dist/humain/ask-user-question/index.d.ts.map +1 -0
  375. package/dist/humain/ask-user-question/index.js +18 -0
  376. package/dist/humain/ask-user-question/index.js.map +1 -0
  377. package/dist/humain/ask-user-question/vendor/ask/answer-channel.d.ts +38 -0
  378. package/dist/humain/ask-user-question/vendor/ask/answer-channel.d.ts.map +1 -0
  379. package/dist/humain/ask-user-question/vendor/ask/answer-channel.js +97 -0
  380. package/dist/humain/ask-user-question/vendor/ask/answer-channel.js.map +1 -0
  381. package/dist/humain/ask-user-question/vendor/ask/ask-user-question.d.ts +41 -0
  382. package/dist/humain/ask-user-question/vendor/ask/ask-user-question.d.ts.map +1 -0
  383. package/dist/humain/ask-user-question/vendor/ask/ask-user-question.js +441 -0
  384. package/dist/humain/ask-user-question/vendor/ask/ask-user-question.js.map +1 -0
  385. package/dist/humain/ask-user-question/vendor/ask/config.d.ts +39 -0
  386. package/dist/humain/ask-user-question/vendor/ask/config.d.ts.map +1 -0
  387. package/dist/humain/ask-user-question/vendor/ask/config.js +95 -0
  388. package/dist/humain/ask-user-question/vendor/ask/config.js.map +1 -0
  389. package/dist/humain/ask-user-question/vendor/ask/events.d.ts +132 -0
  390. package/dist/humain/ask-user-question/vendor/ask/events.d.ts.map +1 -0
  391. package/dist/humain/ask-user-question/vendor/ask/events.js +50 -0
  392. package/dist/humain/ask-user-question/vendor/ask/events.js.map +1 -0
  393. package/dist/humain/ask-user-question/vendor/ask/index.d.ts +5 -0
  394. package/dist/humain/ask-user-question/vendor/ask/index.d.ts.map +1 -0
  395. package/dist/humain/ask-user-question/vendor/ask/index.js +15 -0
  396. package/dist/humain/ask-user-question/vendor/ask/index.js.map +1 -0
  397. package/dist/humain/ask-user-question/vendor/ask/presentation.d.ts +81 -0
  398. package/dist/humain/ask-user-question/vendor/ask/presentation.d.ts.map +1 -0
  399. package/dist/humain/ask-user-question/vendor/ask/presentation.js +105 -0
  400. package/dist/humain/ask-user-question/vendor/ask/presentation.js.map +1 -0
  401. package/dist/humain/ask-user-question/vendor/ask/reconcile.d.ts +28 -0
  402. package/dist/humain/ask-user-question/vendor/ask/reconcile.d.ts.map +1 -0
  403. package/dist/humain/ask-user-question/vendor/ask/reconcile.js +45 -0
  404. package/dist/humain/ask-user-question/vendor/ask/reconcile.js.map +1 -0
  405. package/dist/humain/ask-user-question/vendor/ask/rpc-fallback.d.ts +41 -0
  406. package/dist/humain/ask-user-question/vendor/ask/rpc-fallback.d.ts.map +1 -0
  407. package/dist/humain/ask-user-question/vendor/ask/rpc-fallback.js +166 -0
  408. package/dist/humain/ask-user-question/vendor/ask/rpc-fallback.js.map +1 -0
  409. package/dist/humain/ask-user-question/vendor/ask/state/build-questionnaire.d.ts +46 -0
  410. package/dist/humain/ask-user-question/vendor/ask/state/build-questionnaire.d.ts.map +1 -0
  411. package/dist/humain/ask-user-question/vendor/ask/state/build-questionnaire.js +247 -0
  412. package/dist/humain/ask-user-question/vendor/ask/state/build-questionnaire.js.map +1 -0
  413. package/dist/humain/ask-user-question/vendor/ask/state/external-editor.d.ts +11 -0
  414. package/dist/humain/ask-user-question/vendor/ask/state/external-editor.d.ts.map +1 -0
  415. package/dist/humain/ask-user-question/vendor/ask/state/external-editor.js +56 -0
  416. package/dist/humain/ask-user-question/vendor/ask/state/external-editor.js.map +1 -0
  417. package/dist/humain/ask-user-question/vendor/ask/state/i18n-bridge.d.ts +6 -0
  418. package/dist/humain/ask-user-question/vendor/ask/state/i18n-bridge.d.ts.map +1 -0
  419. package/dist/humain/ask-user-question/vendor/ask/state/i18n-bridge.js +10 -0
  420. package/dist/humain/ask-user-question/vendor/ask/state/i18n-bridge.js.map +1 -0
  421. package/dist/humain/ask-user-question/vendor/ask/state/key-router.d.ts +57 -0
  422. package/dist/humain/ask-user-question/vendor/ask/state/key-router.d.ts.map +1 -0
  423. package/dist/humain/ask-user-question/vendor/ask/state/key-router.js +357 -0
  424. package/dist/humain/ask-user-question/vendor/ask/state/key-router.js.map +1 -0
  425. package/dist/humain/ask-user-question/vendor/ask/state/questionnaire-session.d.ts +112 -0
  426. package/dist/humain/ask-user-question/vendor/ask/state/questionnaire-session.d.ts.map +1 -0
  427. package/dist/humain/ask-user-question/vendor/ask/state/questionnaire-session.js +240 -0
  428. package/dist/humain/ask-user-question/vendor/ask/state/questionnaire-session.js.map +1 -0
  429. package/dist/humain/ask-user-question/vendor/ask/state/row-intent.d.ts +87 -0
  430. package/dist/humain/ask-user-question/vendor/ask/state/row-intent.d.ts.map +1 -0
  431. package/dist/humain/ask-user-question/vendor/ask/state/row-intent.js +79 -0
  432. package/dist/humain/ask-user-question/vendor/ask/state/row-intent.js.map +1 -0
  433. package/dist/humain/ask-user-question/vendor/ask/state/selectors/contract.d.ts +22 -0
  434. package/dist/humain/ask-user-question/vendor/ask/state/selectors/contract.d.ts.map +1 -0
  435. package/dist/humain/ask-user-question/vendor/ask/state/selectors/contract.js +2 -0
  436. package/dist/humain/ask-user-question/vendor/ask/state/selectors/contract.js.map +1 -0
  437. package/dist/humain/ask-user-question/vendor/ask/state/selectors/derivations.d.ts +27 -0
  438. package/dist/humain/ask-user-question/vendor/ask/state/selectors/derivations.d.ts.map +1 -0
  439. package/dist/humain/ask-user-question/vendor/ask/state/selectors/derivations.js +48 -0
  440. package/dist/humain/ask-user-question/vendor/ask/state/selectors/derivations.js.map +1 -0
  441. package/dist/humain/ask-user-question/vendor/ask/state/selectors/focus.d.ts +13 -0
  442. package/dist/humain/ask-user-question/vendor/ask/state/selectors/focus.d.ts.map +1 -0
  443. package/dist/humain/ask-user-question/vendor/ask/state/selectors/focus.js +15 -0
  444. package/dist/humain/ask-user-question/vendor/ask/state/selectors/focus.js.map +1 -0
  445. package/dist/humain/ask-user-question/vendor/ask/state/selectors/projections.d.ts +14 -0
  446. package/dist/humain/ask-user-question/vendor/ask/state/selectors/projections.d.ts.map +1 -0
  447. package/dist/humain/ask-user-question/vendor/ask/state/selectors/projections.js +96 -0
  448. package/dist/humain/ask-user-question/vendor/ask/state/selectors/projections.js.map +1 -0
  449. package/dist/humain/ask-user-question/vendor/ask/state/state-reducer.d.ts +58 -0
  450. package/dist/humain/ask-user-question/vendor/ask/state/state-reducer.d.ts.map +1 -0
  451. package/dist/humain/ask-user-question/vendor/ask/state/state-reducer.js +310 -0
  452. package/dist/humain/ask-user-question/vendor/ask/state/state-reducer.js.map +1 -0
  453. package/dist/humain/ask-user-question/vendor/ask/state/state.d.ts +68 -0
  454. package/dist/humain/ask-user-question/vendor/ask/state/state.d.ts.map +1 -0
  455. package/dist/humain/ask-user-question/vendor/ask/state/state.js +2 -0
  456. package/dist/humain/ask-user-question/vendor/ask/state/state.js.map +1 -0
  457. package/dist/humain/ask-user-question/vendor/ask/tool/external-answer.d.ts +24 -0
  458. package/dist/humain/ask-user-question/vendor/ask/tool/external-answer.d.ts.map +1 -0
  459. package/dist/humain/ask-user-question/vendor/ask/tool/external-answer.js +114 -0
  460. package/dist/humain/ask-user-question/vendor/ask/tool/external-answer.js.map +1 -0
  461. package/dist/humain/ask-user-question/vendor/ask/tool/format-answer.d.ts +18 -0
  462. package/dist/humain/ask-user-question/vendor/ask/tool/format-answer.d.ts.map +1 -0
  463. package/dist/humain/ask-user-question/vendor/ask/tool/format-answer.js +29 -0
  464. package/dist/humain/ask-user-question/vendor/ask/tool/format-answer.js.map +1 -0
  465. package/dist/humain/ask-user-question/vendor/ask/tool/normalize-params.d.ts +41 -0
  466. package/dist/humain/ask-user-question/vendor/ask/tool/normalize-params.d.ts.map +1 -0
  467. package/dist/humain/ask-user-question/vendor/ask/tool/normalize-params.js +99 -0
  468. package/dist/humain/ask-user-question/vendor/ask/tool/normalize-params.js.map +1 -0
  469. package/dist/humain/ask-user-question/vendor/ask/tool/response-envelope.d.ts +37 -0
  470. package/dist/humain/ask-user-question/vendor/ask/tool/response-envelope.d.ts.map +1 -0
  471. package/dist/humain/ask-user-question/vendor/ask/tool/response-envelope.js +70 -0
  472. package/dist/humain/ask-user-question/vendor/ask/tool/response-envelope.js.map +1 -0
  473. package/dist/humain/ask-user-question/vendor/ask/tool/types.d.ts +129 -0
  474. package/dist/humain/ask-user-question/vendor/ask/tool/types.d.ts.map +1 -0
  475. package/dist/humain/ask-user-question/vendor/ask/tool/types.js +76 -0
  476. package/dist/humain/ask-user-question/vendor/ask/tool/types.js.map +1 -0
  477. package/dist/humain/ask-user-question/vendor/ask/tool/validate-questionnaire.d.ts +21 -0
  478. package/dist/humain/ask-user-question/vendor/ask/tool/validate-questionnaire.d.ts.map +1 -0
  479. package/dist/humain/ask-user-question/vendor/ask/tool/validate-questionnaire.js +49 -0
  480. package/dist/humain/ask-user-question/vendor/ask/tool/validate-questionnaire.js.map +1 -0
  481. package/dist/humain/ask-user-question/vendor/ask/view/component-binding.d.ts +23 -0
  482. package/dist/humain/ask-user-question/vendor/ask/view/component-binding.d.ts.map +1 -0
  483. package/dist/humain/ask-user-question/vendor/ask/view/component-binding.js +16 -0
  484. package/dist/humain/ask-user-question/vendor/ask/view/component-binding.js.map +1 -0
  485. package/dist/humain/ask-user-question/vendor/ask/view/components/inline-input.d.ts +21 -0
  486. package/dist/humain/ask-user-question/vendor/ask/view/components/inline-input.d.ts.map +1 -0
  487. package/dist/humain/ask-user-question/vendor/ask/view/components/inline-input.js +49 -0
  488. package/dist/humain/ask-user-question/vendor/ask/view/components/inline-input.js.map +1 -0
  489. package/dist/humain/ask-user-question/vendor/ask/view/components/multi-select-view.d.ts +43 -0
  490. package/dist/humain/ask-user-question/vendor/ask/view/components/multi-select-view.d.ts.map +1 -0
  491. package/dist/humain/ask-user-question/vendor/ask/view/components/multi-select-view.js +130 -0
  492. package/dist/humain/ask-user-question/vendor/ask/view/components/multi-select-view.js.map +1 -0
  493. package/dist/humain/ask-user-question/vendor/ask/view/components/option-list-view.d.ts +45 -0
  494. package/dist/humain/ask-user-question/vendor/ask/view/components/option-list-view.d.ts.map +1 -0
  495. package/dist/humain/ask-user-question/vendor/ask/view/components/option-list-view.js +39 -0
  496. package/dist/humain/ask-user-question/vendor/ask/view/components/option-list-view.js.map +1 -0
  497. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/markdown-content-cache.d.ts +36 -0
  498. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/markdown-content-cache.d.ts.map +1 -0
  499. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/markdown-content-cache.js +72 -0
  500. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/markdown-content-cache.js.map +1 -0
  501. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-block-renderer.d.ts +61 -0
  502. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-block-renderer.d.ts.map +1 -0
  503. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-block-renderer.js +108 -0
  504. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-block-renderer.js.map +1 -0
  505. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-box-renderer.d.ts +39 -0
  506. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-box-renderer.d.ts.map +1 -0
  507. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-box-renderer.js +76 -0
  508. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-box-renderer.js.map +1 -0
  509. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-layout-decider.d.ts +123 -0
  510. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-layout-decider.d.ts.map +1 -0
  511. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-layout-decider.js +180 -0
  512. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-layout-decider.js.map +1 -0
  513. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-pane.d.ts +108 -0
  514. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-pane.d.ts.map +1 -0
  515. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-pane.js +235 -0
  516. package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-pane.js.map +1 -0
  517. package/dist/humain/ask-user-question/vendor/ask/view/components/submit-picker.d.ts +37 -0
  518. package/dist/humain/ask-user-question/vendor/ask/view/components/submit-picker.d.ts.map +1 -0
  519. package/dist/humain/ask-user-question/vendor/ask/view/components/submit-picker.js +47 -0
  520. package/dist/humain/ask-user-question/vendor/ask/view/components/submit-picker.js.map +1 -0
  521. package/dist/humain/ask-user-question/vendor/ask/view/components/tab-bar.d.ts +31 -0
  522. package/dist/humain/ask-user-question/vendor/ask/view/components/tab-bar.d.ts.map +1 -0
  523. package/dist/humain/ask-user-question/vendor/ask/view/components/tab-bar.js +35 -0
  524. package/dist/humain/ask-user-question/vendor/ask/view/components/tab-bar.js.map +1 -0
  525. package/dist/humain/ask-user-question/vendor/ask/view/components/wrapping-select.d.ts +124 -0
  526. package/dist/humain/ask-user-question/vendor/ask/view/components/wrapping-select.d.ts.map +1 -0
  527. package/dist/humain/ask-user-question/vendor/ask/view/components/wrapping-select.js +205 -0
  528. package/dist/humain/ask-user-question/vendor/ask/view/components/wrapping-select.js.map +1 -0
  529. package/dist/humain/ask-user-question/vendor/ask/view/dialog-builder.d.ts +83 -0
  530. package/dist/humain/ask-user-question/vendor/ask/view/dialog-builder.d.ts.map +1 -0
  531. package/dist/humain/ask-user-question/vendor/ask/view/dialog-builder.js +186 -0
  532. package/dist/humain/ask-user-question/vendor/ask/view/dialog-builder.js.map +1 -0
  533. package/dist/humain/ask-user-question/vendor/ask/view/dialog-copy.d.ts +47 -0
  534. package/dist/humain/ask-user-question/vendor/ask/view/dialog-copy.d.ts.map +1 -0
  535. package/dist/humain/ask-user-question/vendor/ask/view/dialog-copy.js +48 -0
  536. package/dist/humain/ask-user-question/vendor/ask/view/dialog-copy.js.map +1 -0
  537. package/dist/humain/ask-user-question/vendor/ask/view/props-adapter.d.ts +58 -0
  538. package/dist/humain/ask-user-question/vendor/ask/view/props-adapter.d.ts.map +1 -0
  539. package/dist/humain/ask-user-question/vendor/ask/view/props-adapter.js +84 -0
  540. package/dist/humain/ask-user-question/vendor/ask/view/props-adapter.js.map +1 -0
  541. package/dist/humain/ask-user-question/vendor/ask/view/scroll-window.d.ts +20 -0
  542. package/dist/humain/ask-user-question/vendor/ask/view/scroll-window.d.ts.map +1 -0
  543. package/dist/humain/ask-user-question/vendor/ask/view/scroll-window.js +55 -0
  544. package/dist/humain/ask-user-question/vendor/ask/view/scroll-window.js.map +1 -0
  545. package/dist/humain/ask-user-question/vendor/ask/view/stateful-view.d.ts +23 -0
  546. package/dist/humain/ask-user-question/vendor/ask/view/stateful-view.d.ts.map +1 -0
  547. package/dist/humain/ask-user-question/vendor/ask/view/stateful-view.js +2 -0
  548. package/dist/humain/ask-user-question/vendor/ask/view/stateful-view.js.map +1 -0
  549. package/dist/humain/ask-user-question/vendor/ask/view/tab-components.d.ts +15 -0
  550. package/dist/humain/ask-user-question/vendor/ask/view/tab-components.d.ts.map +1 -0
  551. package/dist/humain/ask-user-question/vendor/ask/view/tab-components.js +2 -0
  552. package/dist/humain/ask-user-question/vendor/ask/view/tab-components.js.map +1 -0
  553. package/dist/humain/ask-user-question/vendor/ask/view/tab-content-strategy.d.ts +98 -0
  554. package/dist/humain/ask-user-question/vendor/ask/view/tab-content-strategy.d.ts.map +1 -0
  555. package/dist/humain/ask-user-question/vendor/ask/view/tab-content-strategy.js +248 -0
  556. package/dist/humain/ask-user-question/vendor/ask/view/tab-content-strategy.js.map +1 -0
  557. package/dist/humain/ask-user-question/vendor/ask/view/transcript.d.ts +23 -0
  558. package/dist/humain/ask-user-question/vendor/ask/view/transcript.d.ts.map +1 -0
  559. package/dist/humain/ask-user-question/vendor/ask/view/transcript.js +131 -0
  560. package/dist/humain/ask-user-question/vendor/ask/view/transcript.js.map +1 -0
  561. package/dist/humain/ask-user-question/vendor/config/config.d.ts +132 -0
  562. package/dist/humain/ask-user-question/vendor/config/config.d.ts.map +1 -0
  563. package/dist/humain/ask-user-question/vendor/config/config.js +286 -0
  564. package/dist/humain/ask-user-question/vendor/config/config.js.map +1 -0
  565. package/dist/humain/ask-user-question/vendor/config/index.d.ts +2 -0
  566. package/dist/humain/ask-user-question/vendor/config/index.d.ts.map +1 -0
  567. package/dist/humain/ask-user-question/vendor/config/index.js +2 -0
  568. package/dist/humain/ask-user-question/vendor/config/index.js.map +1 -0
  569. package/dist/humain/ask-user-question/vendor/i18n/i18n.d.ts +64 -0
  570. package/dist/humain/ask-user-question/vendor/i18n/i18n.d.ts.map +1 -0
  571. package/dist/humain/ask-user-question/vendor/i18n/i18n.js +185 -0
  572. package/dist/humain/ask-user-question/vendor/i18n/i18n.js.map +1 -0
  573. package/dist/humain/ask-user-question/vendor/i18n/loader.d.ts +44 -0
  574. package/dist/humain/ask-user-question/vendor/i18n/loader.d.ts.map +1 -0
  575. package/dist/humain/ask-user-question/vendor/i18n/loader.js +55 -0
  576. package/dist/humain/ask-user-question/vendor/i18n/loader.js.map +1 -0
  577. package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +26 -16
  578. package/dist/humain/brand-logo.d.ts +2 -0
  579. package/dist/humain/brand-logo.d.ts.map +1 -1
  580. package/dist/humain/brand-logo.js +4 -0
  581. package/dist/humain/brand-logo.js.map +1 -1
  582. package/dist/humain/bundled-extension-names.d.ts +1 -0
  583. package/dist/humain/bundled-extension-names.d.ts.map +1 -1
  584. package/dist/humain/bundled-extension-names.js +1 -0
  585. package/dist/humain/bundled-extension-names.js.map +1 -1
  586. package/dist/humain/checklist/footer-progress.d.ts +7 -0
  587. package/dist/humain/checklist/footer-progress.d.ts.map +1 -0
  588. package/dist/humain/checklist/footer-progress.js +15 -0
  589. package/dist/humain/checklist/footer-progress.js.map +1 -0
  590. package/dist/humain/checklist/glyphs.d.ts +7 -0
  591. package/dist/humain/checklist/glyphs.d.ts.map +1 -0
  592. package/dist/humain/checklist/glyphs.js +8 -0
  593. package/dist/humain/checklist/glyphs.js.map +1 -0
  594. package/dist/humain/checklist/index.d.ts +6 -0
  595. package/dist/humain/checklist/index.d.ts.map +1 -0
  596. package/dist/humain/checklist/index.js +37 -0
  597. package/dist/humain/checklist/index.js.map +1 -0
  598. package/dist/humain/checklist/progress.d.ts +37 -0
  599. package/dist/humain/checklist/progress.d.ts.map +1 -0
  600. package/dist/humain/checklist/progress.js +234 -0
  601. package/dist/humain/checklist/progress.js.map +1 -0
  602. package/dist/humain/checklist/projector.d.ts +53 -0
  603. package/dist/humain/checklist/projector.d.ts.map +1 -0
  604. package/dist/humain/checklist/projector.js +198 -0
  605. package/dist/humain/checklist/projector.js.map +1 -0
  606. package/dist/humain/checklist/sidebar.d.ts +18 -0
  607. package/dist/humain/checklist/sidebar.d.ts.map +1 -0
  608. package/dist/humain/checklist/sidebar.js +38 -0
  609. package/dist/humain/checklist/sidebar.js.map +1 -0
  610. package/dist/humain/checklist/status-segment.d.ts +19 -0
  611. package/dist/humain/checklist/status-segment.d.ts.map +1 -0
  612. package/dist/humain/checklist/status-segment.js +59 -0
  613. package/dist/humain/checklist/status-segment.js.map +1 -0
  614. package/dist/humain/checklist/vendor/add-task-dialog.d.ts +54 -0
  615. package/dist/humain/checklist/vendor/add-task-dialog.d.ts.map +1 -0
  616. package/dist/humain/checklist/vendor/add-task-dialog.js +238 -0
  617. package/dist/humain/checklist/vendor/add-task-dialog.js.map +1 -0
  618. package/dist/humain/checklist/vendor/commands.d.ts +38 -0
  619. package/dist/humain/checklist/vendor/commands.d.ts.map +1 -0
  620. package/dist/humain/checklist/vendor/commands.js +193 -0
  621. package/dist/humain/checklist/vendor/commands.js.map +1 -0
  622. package/dist/humain/checklist/vendor/index.d.ts +3 -0
  623. package/dist/humain/checklist/vendor/index.d.ts.map +1 -0
  624. package/dist/humain/checklist/vendor/index.js +276 -0
  625. package/dist/humain/checklist/vendor/index.js.map +1 -0
  626. package/dist/humain/checklist/vendor/render.d.ts +97 -0
  627. package/dist/humain/checklist/vendor/render.d.ts.map +1 -0
  628. package/dist/humain/checklist/vendor/render.js +354 -0
  629. package/dist/humain/checklist/vendor/render.js.map +1 -0
  630. package/dist/humain/checklist/vendor/settings.d.ts +11 -0
  631. package/dist/humain/checklist/vendor/settings.d.ts.map +1 -0
  632. package/dist/humain/checklist/vendor/settings.js +8 -0
  633. package/dist/humain/checklist/vendor/settings.js.map +1 -0
  634. package/dist/humain/checklist/vendor/store.d.ts +120 -0
  635. package/dist/humain/checklist/vendor/store.d.ts.map +1 -0
  636. package/dist/humain/checklist/vendor/store.js +990 -0
  637. package/dist/humain/checklist/vendor/store.js.map +1 -0
  638. package/dist/humain/checklist/vendor/tools.d.ts +21 -0
  639. package/dist/humain/checklist/vendor/tools.d.ts.map +1 -0
  640. package/dist/humain/checklist/vendor/tools.js +162 -0
  641. package/dist/humain/checklist/vendor/tools.js.map +1 -0
  642. package/dist/humain/checklist/vendor/types.d.ts +188 -0
  643. package/dist/humain/checklist/vendor/types.d.ts.map +1 -0
  644. package/dist/humain/checklist/vendor/types.js +32 -0
  645. package/dist/humain/checklist/vendor/types.js.map +1 -0
  646. package/dist/humain/gateway/catalog.d.ts +1 -0
  647. package/dist/humain/gateway/catalog.d.ts.map +1 -1
  648. package/dist/humain/gateway/catalog.js +1 -0
  649. package/dist/humain/gateway/catalog.js.map +1 -1
  650. package/dist/humain/gateway/client.d.ts +1 -0
  651. package/dist/humain/gateway/client.d.ts.map +1 -1
  652. package/dist/humain/gateway/client.js +8 -1
  653. package/dist/humain/gateway/client.js.map +1 -1
  654. package/dist/humain/gateway/http.d.ts.map +1 -1
  655. package/dist/humain/gateway/http.js +11 -3
  656. package/dist/humain/gateway/http.js.map +1 -1
  657. package/dist/humain/gateway/images.d.ts +3 -0
  658. package/dist/humain/gateway/images.d.ts.map +1 -0
  659. package/dist/humain/gateway/images.js +73 -0
  660. package/dist/humain/gateway/images.js.map +1 -0
  661. package/dist/humain/gateway/provider.js +1 -1
  662. package/dist/humain/gateway/provider.js.map +1 -1
  663. package/dist/humain/hcode/account-store.d.ts.map +1 -1
  664. package/dist/humain/hcode/account-store.js +3 -1
  665. package/dist/humain/hcode/account-store.js.map +1 -1
  666. package/dist/humain/hcode/account.d.ts.map +1 -1
  667. package/dist/humain/hcode/account.js +23 -13
  668. package/dist/humain/hcode/account.js.map +1 -1
  669. package/dist/humain/hcode/images.d.ts.map +1 -1
  670. package/dist/humain/hcode/images.js +19 -13
  671. package/dist/humain/hcode/images.js.map +1 -1
  672. package/dist/humain/hcode/login-failure.d.ts +1 -0
  673. package/dist/humain/hcode/login-failure.d.ts.map +1 -1
  674. package/dist/humain/hcode/login-failure.js +1 -0
  675. package/dist/humain/hcode/login-failure.js.map +1 -1
  676. package/dist/humain/hcode/provider.d.ts.map +1 -1
  677. package/dist/humain/hcode/provider.js +2 -1
  678. package/dist/humain/hcode/provider.js.map +1 -1
  679. package/dist/humain/hcode/run-credential.d.ts +1 -0
  680. package/dist/humain/hcode/run-credential.d.ts.map +1 -1
  681. package/dist/humain/hcode/run-credential.js +12 -4
  682. package/dist/humain/hcode/run-credential.js.map +1 -1
  683. package/dist/humain/index.d.ts.map +1 -1
  684. package/dist/humain/index.js +4 -0
  685. package/dist/humain/index.js.map +1 -1
  686. package/dist/humain/node-provider.d.ts.map +1 -1
  687. package/dist/humain/node-provider.js +37 -8
  688. package/dist/humain/node-provider.js.map +1 -1
  689. package/dist/main.d.ts +1 -1
  690. package/dist/main.d.ts.map +1 -1
  691. package/dist/main.js +36 -26
  692. package/dist/main.js.map +1 -1
  693. package/dist/modes/interactive/chat-viewport.js +1 -1
  694. package/dist/modes/interactive/chat-viewport.js.map +1 -1
  695. package/dist/modes/interactive/components/bash-execution.d.ts +2 -1
  696. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  697. package/dist/modes/interactive/components/bash-execution.js +7 -4
  698. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  699. package/dist/modes/interactive/components/config-selector.js +1 -1
  700. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  701. package/dist/modes/interactive/components/custom-editor.d.ts +2 -0
  702. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  703. package/dist/modes/interactive/components/custom-editor.js +20 -1
  704. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  705. package/dist/modes/interactive/components/extension-editor.d.ts +1 -1
  706. package/dist/modes/interactive/components/extension-editor.js +2 -2
  707. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  708. package/dist/modes/interactive/components/footer.d.ts +7 -0
  709. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  710. package/dist/modes/interactive/components/footer.js +74 -1
  711. package/dist/modes/interactive/components/footer.js.map +1 -1
  712. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
  713. package/dist/modes/interactive/components/mermaid.js +11 -4
  714. package/dist/modes/interactive/components/mermaid.js.map +1 -1
  715. package/dist/modes/interactive/components/model-selector.d.ts +2 -0
  716. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  717. package/dist/modes/interactive/components/model-selector.js +56 -8
  718. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  719. package/dist/modes/interactive/components/oauth-selector.d.ts +13 -1
  720. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  721. package/dist/modes/interactive/components/oauth-selector.js +10 -9
  722. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  723. package/dist/modes/interactive/components/session-selector.js +3 -3
  724. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  725. package/dist/modes/interactive/components/settings-selector.d.ts +4 -3
  726. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  727. package/dist/modes/interactive/components/settings-selector.js +83 -37
  728. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  729. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
  730. package/dist/modes/interactive/components/settings-submenu.js +3 -3
  731. package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
  732. package/dist/modes/interactive/components/status-indicator.d.ts +18 -7
  733. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  734. package/dist/modes/interactive/components/status-indicator.js +70 -24
  735. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  736. package/dist/modes/interactive/components/status-line.d.ts +16 -0
  737. package/dist/modes/interactive/components/status-line.d.ts.map +1 -0
  738. package/dist/modes/interactive/components/status-line.js +51 -0
  739. package/dist/modes/interactive/components/status-line.js.map +1 -0
  740. package/dist/modes/interactive/components/tool-execution.d.ts +5 -0
  741. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  742. package/dist/modes/interactive/components/tool-execution.js +8 -1
  743. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  744. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  745. package/dist/modes/interactive/components/visual-truncate.js +11 -3
  746. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  747. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  748. package/dist/modes/interactive/external-editor.js +13 -3
  749. package/dist/modes/interactive/external-editor.js.map +1 -1
  750. package/dist/modes/interactive/interactive-mode.d.ts +17 -1
  751. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  752. package/dist/modes/interactive/interactive-mode.js +232 -108
  753. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  754. package/dist/modes/interactive/program-status-reporter.d.ts +2 -0
  755. package/dist/modes/interactive/program-status-reporter.d.ts.map +1 -1
  756. package/dist/modes/interactive/program-status-reporter.js +4 -0
  757. package/dist/modes/interactive/program-status-reporter.js.map +1 -1
  758. package/dist/modes/interactive/session-share.d.ts.map +1 -1
  759. package/dist/modes/interactive/session-share.js +9 -1
  760. package/dist/modes/interactive/session-share.js.map +1 -1
  761. package/dist/modes/print-mode.d.ts.map +1 -1
  762. package/dist/modes/print-mode.js +34 -7
  763. package/dist/modes/print-mode.js.map +1 -1
  764. package/dist/modes/rpc/jsonl.js +6 -5
  765. package/dist/modes/rpc/jsonl.js.map +1 -1
  766. package/dist/modes/rpc/rpc-client.d.ts +2 -0
  767. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  768. package/dist/modes/rpc/rpc-client.js +9 -2
  769. package/dist/modes/rpc/rpc-client.js.map +1 -1
  770. package/dist/modes/rpc/rpc-mode.d.ts +2 -1
  771. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  772. package/dist/modes/rpc/rpc-mode.js +113 -13
  773. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  774. package/dist/modes/rpc/rpc-types.d.ts +22 -1
  775. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  776. package/dist/modes/rpc/rpc-types.js.map +1 -1
  777. package/dist/modes/uncaught-errors.d.ts +20 -0
  778. package/dist/modes/uncaught-errors.d.ts.map +1 -0
  779. package/dist/modes/uncaught-errors.js +56 -0
  780. package/dist/modes/uncaught-errors.js.map +1 -0
  781. package/dist/package-manager-cli.d.ts.map +1 -1
  782. package/dist/package-manager-cli.js +10 -1
  783. package/dist/package-manager-cli.js.map +1 -1
  784. package/dist/utils/clipboard-image.js +1 -1
  785. package/dist/utils/clipboard-image.js.map +1 -1
  786. package/dist/utils/clipboard.js +2 -2
  787. package/dist/utils/clipboard.js.map +1 -1
  788. package/dist/utils/image-process.d.ts +5 -0
  789. package/dist/utils/image-process.d.ts.map +1 -1
  790. package/dist/utils/image-process.js +22 -4
  791. package/dist/utils/image-process.js.map +1 -1
  792. package/dist/utils/output-files.d.ts +44 -7
  793. package/dist/utils/output-files.d.ts.map +1 -1
  794. package/dist/utils/output-files.js +206 -12
  795. package/dist/utils/output-files.js.map +1 -1
  796. package/dist/utils/piped-stdin.d.ts +21 -0
  797. package/dist/utils/piped-stdin.d.ts.map +1 -0
  798. package/dist/utils/piped-stdin.js +60 -0
  799. package/dist/utils/piped-stdin.js.map +1 -0
  800. package/dist/utils/shell.d.ts +5 -2
  801. package/dist/utils/shell.d.ts.map +1 -1
  802. package/dist/utils/shell.js +77 -8
  803. package/dist/utils/shell.js.map +1 -1
  804. package/dist/utils/syntax-highlight.d.ts +33 -2
  805. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  806. package/dist/utils/syntax-highlight.js +77 -10
  807. package/dist/utils/syntax-highlight.js.map +1 -1
  808. package/dist/utils/tools-manager.d.ts +1 -0
  809. package/dist/utils/tools-manager.d.ts.map +1 -1
  810. package/dist/utils/tools-manager.js +9 -8
  811. package/dist/utils/tools-manager.js.map +1 -1
  812. package/dist/utils/wsl.d.ts +8 -2
  813. package/dist/utils/wsl.d.ts.map +1 -1
  814. package/dist/utils/wsl.js +12 -3
  815. package/dist/utils/wsl.js.map +1 -1
  816. package/docs/cli.md +39 -3
  817. package/docs/codemode.md +7 -3
  818. package/docs/compaction.md +1 -1
  819. package/docs/development.md +6 -0
  820. package/docs/environment-variables.md +3 -2
  821. package/docs/extensions.md +19 -5
  822. package/docs/keybindings.md +2 -0
  823. package/docs/llama-cpp.md +2 -2
  824. package/docs/message-types.md +1 -0
  825. package/docs/models-configuration.md +14 -3
  826. package/docs/models.md +29 -7
  827. package/docs/providers.md +20 -2
  828. package/docs/rpc-commands.md +25 -2
  829. package/docs/rpc.md +20 -0
  830. package/docs/run-preflight.md +2 -2
  831. package/docs/session-format.md +9 -0
  832. package/docs/settings.md +35 -5
  833. package/docs/shell-aliases.md +1 -1
  834. package/docs/slash-commands.md +3 -1
  835. package/docs/terminal-setup.md +25 -0
  836. package/docs/windows.md +2 -1
  837. package/examples/extensions/custom-provider-anthropic/package-lock.json +4 -4
  838. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  839. package/examples/rpc-extension-ui.ts +8 -7
  840. package/npm-shrinkwrap.json +209 -180
  841. package/package.json +26 -20
  842. package/schemas/keybindings.schema.json +12 -0
  843. package/schemas/models.schema.json +20 -7
  844. package/schemas/settings.schema.json +43 -5
  845. package/src/coordination/UPSTREAM.md +27 -1
  846. package/src/coordination/upstream.json +3 -3
  847. package/src/humain/ask-user-question/UPSTREAM.md +31 -0
  848. package/src/humain/ask-user-question/upstream.json +258 -0
  849. package/src/humain/ask-user-question/vendor/ask/LICENSE +21 -0
  850. package/src/humain/ask-user-question/vendor/ask/locales/de.json +38 -0
  851. package/src/humain/ask-user-question/vendor/ask/locales/en.json +41 -0
  852. package/src/humain/ask-user-question/vendor/ask/locales/es.json +38 -0
  853. package/src/humain/ask-user-question/vendor/ask/locales/fr.json +38 -0
  854. package/src/humain/ask-user-question/vendor/ask/locales/pt-BR.json +38 -0
  855. package/src/humain/ask-user-question/vendor/ask/locales/pt.json +38 -0
  856. package/src/humain/ask-user-question/vendor/ask/locales/ru.json +38 -0
  857. package/src/humain/ask-user-question/vendor/ask/locales/uk.json +38 -0
  858. package/src/humain/ask-user-question/vendor/ask/locales/zh.json +40 -0
  859. package/src/humain/ask-user-question/vendor/config/LICENSE +21 -0
  860. package/src/humain/ask-user-question/vendor/i18n/LICENSE +21 -0
  861. package/src/humain/caveman/UPSTREAM.md +44 -11
  862. package/src/humain/caveman/upstream.json +3 -3
  863. package/src/humain/caveman/vendor/NOTICE +4 -0
  864. package/dist/bundle/chunks/anthropic-messages-XFCDMGD6.js +0 -77
  865. package/dist/bundle/chunks/azure-openai-responses-F4KQM3NK.js +0 -15
  866. package/dist/bundle/chunks/bowser-DXKSTXFQ.js +0 -89
  867. package/dist/bundle/chunks/chunk-3E37CJCE.js +0 -34
  868. package/dist/bundle/chunks/chunk-3HVHETMU.js +0 -18
  869. package/dist/bundle/chunks/chunk-6JTCRCNF.js +0 -74
  870. package/dist/bundle/chunks/chunk-B3ZLWVDA.js +0 -80
  871. package/dist/bundle/chunks/chunk-F77J5EQZ.js +0 -3
  872. package/dist/bundle/chunks/chunk-GPLWWO5Q.js +0 -121
  873. package/dist/bundle/chunks/chunk-GV5OVRKK.js +0 -4
  874. package/dist/bundle/chunks/chunk-JBSWWCT5.js +0 -12
  875. package/dist/bundle/chunks/chunk-JWOPWHVH.js +0 -51
  876. package/dist/bundle/chunks/chunk-KRBELWQH.js +0 -7
  877. package/dist/bundle/chunks/chunk-PFBAIRCY.js +0 -56
  878. package/dist/bundle/chunks/chunk-Q5RKNQ2T.js +0 -73
  879. package/dist/bundle/chunks/chunk-QFDZEUFU.js +0 -12
  880. package/dist/bundle/chunks/chunk-SKCJ25SX.js +0 -24
  881. package/dist/bundle/chunks/chunk-UZOIHLNU.js +0 -23
  882. package/dist/bundle/chunks/chunk-YSWDFV2L.js +0 -11
  883. package/dist/bundle/chunks/chunk-YZMQXAJM.js +0 -8
  884. package/dist/bundle/chunks/chunk-ZAHVC5V2.js +0 -3591
  885. package/dist/bundle/chunks/entry-2GZ3PTWQ.js +0 -2
  886. package/dist/bundle/chunks/google-generative-ai-WIASMWS3.js +0 -22
  887. package/dist/bundle/chunks/google-vertex-WSPHRZIZ.js +0 -25
  888. package/dist/bundle/chunks/interactive-mode-3322RQEH.js +0 -5
  889. package/dist/bundle/chunks/mistral-conversations-7JYDDRUT.js +0 -43
  890. package/dist/bundle/chunks/openai-codex-responses-7PAML4NF.js +0 -102
  891. package/dist/bundle/chunks/openai-completions-UJDAIGTK.js +0 -87
  892. package/dist/bundle/chunks/openai-responses-2WNCE6AY.js +0 -26
  893. package/dist/bundle/chunks/openrouter-images-V3UCCO6X.js +0 -8
  894. package/dist/bundle/chunks/pi-messages-TQ7LJUNQ.js +0 -28
  895. package/dist/bundle/chunks/runtime-H7LYNKCZ.js +0 -2
  896. package/dist/bundle/chunks/session-picker-EYKCMFQR.js +0 -4
  897. package/dist/bundle/chunks/startup-ui-7ODOR34R.js +0 -3
  898. package/dist/bundle/chunks/typesafe-system-one-YP7GGN4C.js +0 -3
  899. package/dist/bundle/chunks/virtual-modules-47MGUPYN.js +0 -28
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key-router.js","sourceRoot":"","sources":["../../../../../../src/humain/ask-user-question/vendor/ask/state/key-router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,MAAM,UAAU,GAAG,eAAe,CAAC;AACn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E,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAClD,IAAI,GAAG;QAAE,OAAO,GAAG,CAAC;IAEpB,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC9C,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAElC,gFAAgF;IAChF,6EAA6E;IAC7E,2EAA2E;IAC3E,4EAA4E;IAC5E,wEAAwE;IACxE,+EAA+E;IAC/E,+EAA+E;IAC/E,yEAAyE;IACzE,0EAA0E;IAC1E,gEAAgE;IAChE,IAAI,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7C,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;IAChC,CAAC;IAED,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,CAAC;QAClC,OAAO,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;IACD,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,CAAC;QACpC,OAAO,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,CAAC,CAAC,WAAW;QAAE,OAAO,mBAAmB,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACxE,OAAO,oBAAoB,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import { Key, matchesKey } from \"@earendil-works/pi-tui\";\nimport type { QuestionAnswer } from \"../tool/types.ts\";\nimport { ROW_INTENT_META } from \"./row-intent.ts\";\nimport type { QuestionnaireRuntime, QuestionnaireState } from \"./state.ts\";\n\nconst KEYBIND_UP = \"tui.select.up\";\nconst KEYBIND_DOWN = \"tui.select.down\";\nconst KEYBIND_CONFIRM = \"tui.select.confirm\";\nconst KEYBIND_SUBMIT = \"tui.input.submit\";\nconst KEYBIND_CANCEL = \"tui.select.cancel\";\nconst KEYBIND_NEW_LINE = \"tui.input.newLine\";\nconst KEYBIND_EDITOR_UP = \"tui.editor.cursorUp\";\nconst KEYBIND_EDITOR_DOWN = \"tui.editor.cursorDown\";\nconst KEYBIND_CLEAR = \"tui.editor.deleteToLineStart\";\nconst KEYBIND_EXTERNAL_EDITOR = \"app.editor.external\";\n\nconst NOTES_ACTIVATE_KEY = \"n\";\n\n/**\n * The notes shortcut. A single-character key matches the character as typed, so a\n * non-Latin one works (pi-tui's key parser knows only ASCII); anything else matches as\n * a pi-tui key spec. A non-string key — a stale outer module, as with `collapseKey`\n * below — falls back to `n`.\n */\nfunction matchesNotesKey(data: string, notesKey: unknown): boolean {\n\tconst key = typeof notesKey === \"string\" ? notesKey : NOTES_ACTIVATE_KEY;\n\treturn data === key || matchesKey(data, key as Parameters<typeof matchesKey>[1]);\n}\n\nexport type QuestionnaireAction =\n\t| { kind: \"nav\"; nextIndex: number; inputValue: string }\n\t| { kind: \"input_clear\" }\n\t| { kind: \"input_edit\"; value: string }\n\t| { kind: \"input_replace\"; value: string }\n\t| { kind: \"tab_switch\"; nextTab: number }\n\t| { kind: \"confirm\"; answer: QuestionAnswer; autoAdvanceTab?: number }\n\t| { kind: \"toggle\"; index: number }\n\t| { kind: \"multi_confirm\"; selected: string[]; answer: string | null; autoAdvanceTab?: number }\n\t| { kind: \"cancel\" }\n\t| { kind: \"notes_enter\" }\n\t| { kind: \"notes_exit\" }\n\t| { kind: \"submit\" }\n\t| { kind: \"submit_nav\"; nextIndex: 0 | 1 }\n\t| { kind: \"notes_forward\"; data: string }\n\t/** Flip `state.collapsed`. Always available, regardless of inner mode (see top intercept in `routeKey`). */\n\t| { kind: \"toggle_collapsed\" }\n\t| { kind: \"ignore\" };\n\nexport interface QuestionnaireKeybindings {\n\tmatches(data: string, name: string): boolean;\n}\n\n// Confirm has two semantic sources: `tui.select.confirm` (the select-list default)\n// and `tui.input.submit` (the user's \"send\" key). A Slack-style configuration folds\n// `enter` into `tui.input.newLine` and moves submit elsewhere (e.g. `ctrl+enter`);\n// the newline checks below stay first, so without the submit source every confirm\n// branch would be shadowed by the collision and no key could confirm (#156). With\n// pi defaults both names resolve to `enter`, so matching either is equivalent.\nfunction isConfirm(kb: QuestionnaireKeybindings, data: string): boolean {\n\treturn kb.matches(data, KEYBIND_CONFIRM) || kb.matches(data, KEYBIND_SUBMIT);\n}\n\nexport function wrapTab(index: number, total: number): number {\n\tif (total <= 0) return 0;\n\treturn ((index % total) + total) % total;\n}\n\nexport function allAnswered(state: QuestionnaireState, runtime: QuestionnaireRuntime): boolean {\n\tif (runtime.questions.length === 0) return false;\n\tfor (let i = 0; i < runtime.questions.length; i++) {\n\t\tif (!state.answers.has(i)) return false;\n\t}\n\treturn true;\n}\n\nfunction totalTabs(runtime: QuestionnaireRuntime): number {\n\treturn runtime.isMulti ? runtime.questions.length + 1 : 1;\n}\n\nfunction computeAutoAdvanceTab(state: QuestionnaireState, runtime: QuestionnaireRuntime): number | undefined {\n\tif (!runtime.isMulti) return undefined;\n\tif (state.currentTab < runtime.questions.length - 1) return state.currentTab + 1;\n\treturn runtime.questions.length;\n}\n\nfunction buildSingleSelectAnswer(state: QuestionnaireState, runtime: QuestionnaireRuntime): QuestionAnswer | null {\n\tconst q = runtime.questions[state.currentTab];\n\tif (!q) return null;\n\n\tconst item = runtime.currentItem;\n\n\tif (state.inputMode) {\n\t\t// A blank draft is not an answer (#301): Enter stays on the row instead of recording\n\t\t// an empty custom answer. Skipping a question is the Submit tab's `unanswered:` path.\n\t\tconst label = runtime.inputBuffer;\n\t\tif (label.trim().length === 0) return null;\n\t\treturn {\n\t\t\tquestionIndex: state.currentTab,\n\t\t\tquestion: q.question,\n\t\t\tkind: \"custom\",\n\t\t\tanswer: label,\n\t\t};\n\t}\n\tif (!item) return null;\n\tif (item.kind === \"other\") {\n\t\treturn null;\n\t}\n\tif (item.kind === \"next\") {\n\t\treturn null;\n\t}\n\treturn {\n\t\tquestionIndex: state.currentTab,\n\t\tquestion: q.question,\n\t\tkind: \"option\",\n\t\tanswer: item.label,\n\t};\n}\n\nfunction buildMultiSelected(state: QuestionnaireState, runtime: QuestionnaireRuntime): string[] {\n\tconst q = runtime.questions[state.currentTab];\n\tif (!q) return [];\n\tconst out: string[] = [];\n\tfor (let i = 0; i < q.options.length; i++) {\n\t\tif (state.multiSelectChecked.has(i)) {\n\t\t\tconst label = q.options[i]?.label;\n\t\t\tif (typeof label === \"string\") out.push(label);\n\t\t}\n\t}\n\treturn out;\n}\n\nfunction buildMultiConfirmAction(state: QuestionnaireState, runtime: QuestionnaireRuntime): QuestionnaireAction {\n\treturn {\n\t\tkind: \"multi_confirm\",\n\t\tselected: buildMultiSelected(state, runtime),\n\t\tanswer: runtime.inputBuffer.trim().length > 0 ? runtime.inputBuffer : null,\n\t\tautoAdvanceTab: computeAutoAdvanceTab(state, runtime),\n\t};\n}\n\nfunction tabSwitchAction(\n\tdata: string,\n\tstate: QuestionnaireState,\n\truntime: QuestionnaireRuntime,\n): QuestionnaireAction | null {\n\tif (!runtime.isMulti) return null;\n\tconst total = totalTabs(runtime);\n\tif (matchesKey(data, Key.tab) || matchesKey(data, Key.right)) {\n\t\treturn { kind: \"tab_switch\", nextTab: wrapTab(state.currentTab + 1, total) };\n\t}\n\tif (matchesKey(data, Key.shift(\"tab\")) || matchesKey(data, Key.left)) {\n\t\treturn { kind: \"tab_switch\", nextTab: wrapTab(state.currentTab - 1, total) };\n\t}\n\treturn null;\n}\n\n// DOWN at the last item wraps to the first (cycle through [option0, …, optionLast]).\nfunction nextNavOnDown(state: QuestionnaireState, runtime: QuestionnaireRuntime): QuestionnaireAction {\n\treturn {\n\t\tkind: \"nav\",\n\t\tnextIndex: wrapTab(state.optionIndex + 1, Math.max(1, runtime.items.length)),\n\t\tinputValue: runtime.inputBuffer,\n\t};\n}\n\n// UP at the first item wraps to the last (symmetric with nextNavOnDown).\nfunction prevNavOnUp(state: QuestionnaireState, runtime: QuestionnaireRuntime): QuestionnaireAction {\n\treturn {\n\t\tkind: \"nav\",\n\t\tnextIndex: wrapTab(state.optionIndex - 1, Math.max(1, runtime.items.length)),\n\t\tinputValue: runtime.inputBuffer,\n\t};\n}\n\n// Collapsed-mode lockout: while collapsed, swallow every keystroke except cancel so\n// the user can read the now-uncovered transcript without accidentally mutating\n// answers or notes. The collapse toggle itself is already handled above.\nfunction routeCollapsed(kb: QuestionnaireKeybindings, data: string): QuestionnaireAction {\n\tif (kb.matches(data, KEYBIND_CANCEL)) return { kind: \"cancel\" };\n\treturn { kind: \"ignore\" };\n}\n\nfunction routeNotesMode(kb: QuestionnaireKeybindings, data: string): QuestionnaireAction {\n\tif (kb.matches(data, KEYBIND_CANCEL)) return { kind: \"notes_exit\" };\n\tif (kb.matches(data, KEYBIND_NEW_LINE)) return { kind: \"notes_forward\", data };\n\tif (isConfirm(kb, data)) return { kind: \"notes_exit\" };\n\treturn { kind: \"notes_forward\", data };\n}\n\nfunction routeInputMode(\n\tkb: QuestionnaireKeybindings,\n\tdata: string,\n\tstate: QuestionnaireState,\n\truntime: QuestionnaireRuntime,\n): QuestionnaireAction {\n\t// Newline takes precedence over confirmation if a user configuration binds\n\t// the same physical key to both semantic actions.\n\tif (kb.matches(data, KEYBIND_NEW_LINE)) return { kind: \"ignore\" };\n\tif (isConfirm(kb, data)) {\n\t\tconst q = runtime.questions[state.currentTab];\n\t\tif (q?.multiSelect) return buildMultiConfirmAction(state, runtime);\n\t\tconst answer = buildSingleSelectAnswer(state, runtime);\n\t\tif (!answer) return { kind: \"ignore\" };\n\t\treturn { kind: \"confirm\", answer, autoAdvanceTab: computeAutoAdvanceTab(state, runtime) };\n\t}\n\t// Treat Pi's Ctrl+U line-kill binding as an explicit whole-draft clear,\n\t// independent of the current cursor position.\n\tif (kb.matches(data, KEYBIND_CLEAR)) return { kind: \"input_clear\" };\n\tif (kb.matches(data, KEYBIND_EXTERNAL_EDITOR)) return { kind: \"input_edit\", value: runtime.inputBuffer };\n\tif (kb.matches(data, KEYBIND_CANCEL)) return { kind: \"cancel\" };\n\tif (kb.matches(data, KEYBIND_EDITOR_UP) && runtime.canMoveInputUp) return { kind: \"ignore\" };\n\tif (kb.matches(data, KEYBIND_EDITOR_DOWN) && runtime.canMoveInputDown) return { kind: \"ignore\" };\n\tif (kb.matches(data, KEYBIND_UP)) return prevNavOnUp(state, runtime);\n\tif (kb.matches(data, KEYBIND_DOWN)) return nextNavOnDown(state, runtime);\n\treturn { kind: \"ignore\" };\n}\n\nfunction routeSubmitTab(\n\tkb: QuestionnaireKeybindings,\n\tdata: string,\n\tstate: QuestionnaireState,\n\truntime: QuestionnaireRuntime,\n): QuestionnaireAction {\n\tif (kb.matches(data, KEYBIND_CANCEL)) return { kind: \"cancel\" };\n\tconst tab = tabSwitchAction(data, state, runtime);\n\tif (tab) return tab;\n\tif (kb.matches(data, KEYBIND_UP) || kb.matches(data, KEYBIND_DOWN)) {\n\t\tconst delta = kb.matches(data, KEYBIND_DOWN) ? 1 : -1;\n\t\tconst next = wrapTab(state.submitChoiceIndex + delta, 2);\n\t\treturn { kind: \"submit_nav\", nextIndex: (next === 1 ? 1 : 0) as 0 | 1 };\n\t}\n\tif (isConfirm(kb, data)) {\n\t\t// D1 (revised): Submit always submits; Cancel always cancels. The warning header\n\t\t// is informational only — `allAnswered(state)` no longer gates submission. Partial\n\t\t// answers flow through `orderedAnswers()` in the host.\n\t\treturn state.submitChoiceIndex === 1 ? { kind: \"cancel\" } : { kind: \"submit\" };\n\t}\n\t// Global note (#182): the notes key on the Submit tab opens the notes editor scoped to the whole\n\t// questionnaire at the pseudo-index (`questions.length` in notesByTab). Reachable only\n\t// with the editor closed — `routeKey` dispatches notesVisible traffic to\n\t// `routeNotesMode` before the submit-tab block runs. The branch shadows nothing above\n\t// it (cancel, tab switch, submit-nav, confirm): the default `n` matches none of them\n\t// under default bindings, and a user who deliberately binds one of those actions to\n\t// `n` keeps that mapping because the earlier branch still wins (Enter still submits).\n\tif (matchesNotesKey(data, runtime.notesKey)) {\n\t\treturn { kind: \"notes_enter\" };\n\t}\n\treturn { kind: \"ignore\" };\n}\n\nconst DIGIT_KEYS = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"] as const;\n\n/**\n * The row a digit hotkey names: `1`-`9` follow the list's numbering, so the\n * unnumbered Next row has no digit. One key per keystroke — a pasted `\"12\"`\n * matches none. Checked after every keybinding, so a digit bound to an action\n * keeps that action.\n */\nfunction digitRow(\n\tdata: string,\n\truntime: QuestionnaireRuntime,\n): { index: number; activatesInputMode: boolean } | undefined {\n\tconst index = DIGIT_KEYS.findIndex((digit) => matchesKey(data, digit));\n\tconst item = runtime.items[index];\n\tif (!item || !ROW_INTENT_META[item.kind].numbered) return undefined;\n\treturn { index, activatesInputMode: ROW_INTENT_META[item.kind].activatesInputMode };\n}\n\nfunction routeMultiSelectTab(\n\tkb: QuestionnaireKeybindings,\n\tdata: string,\n\tstate: QuestionnaireState,\n\truntime: QuestionnaireRuntime,\n): QuestionnaireAction {\n\tconst focusedKind = runtime.currentItem?.kind;\n\tconst focusedMeta = focusedKind ? ROW_INTENT_META[focusedKind] : undefined;\n\t// Space toggles the focused row's checkbox. Suppressed on rows whose META declares\n\t// `blocksMultiToggle` (the Next sentinel) or `activatesInputMode` (the \"Type\n\t// something.\" row — it is an inline input, not a checkable option).\n\tif (matchesKey(data, Key.space)) {\n\t\tif (focusedMeta?.blocksMultiToggle) return { kind: \"ignore\" };\n\t\tif (focusedMeta?.activatesInputMode) return { kind: \"ignore\" };\n\t\treturn { kind: \"toggle\", index: state.optionIndex };\n\t}\n\tif (isConfirm(kb, data)) {\n\t\t// Enter on the \"Type something.\" row is handled by the inputMode block above.\n\t\t// Defensive: never enter the toggle/multi_confirm path for an input-mode row.\n\t\tif (focusedMeta?.activatesInputMode) return { kind: \"ignore\" };\n\t\t// Enter on a regular row toggles (matching Space) — committing the question is now\n\t\t// gated behind explicit focus on a row whose META declares `autoSubmitsInMulti`\n\t\t// (the Next sentinel), so Enter on options is a no-cost way to flip checkboxes\n\t\t// without leaving the keyboard home row.\n\t\tif (!focusedMeta?.autoSubmitsInMulti) return { kind: \"toggle\", index: state.optionIndex };\n\t\treturn buildMultiConfirmAction(state, runtime);\n\t}\n\tif (kb.matches(data, KEYBIND_CANCEL)) return { kind: \"cancel\" };\n\t// A digit toggles its row; the Type something. row's digit focuses it instead.\n\tconst row = digitRow(data, runtime);\n\tif (!row) return { kind: \"ignore\" };\n\tif (row.activatesInputMode) return { kind: \"nav\", nextIndex: row.index, inputValue: runtime.inputBuffer };\n\treturn { kind: \"toggle\", index: row.index };\n}\n\nfunction routeSingleSelectTab(\n\tkb: QuestionnaireKeybindings,\n\tdata: string,\n\tstate: QuestionnaireState,\n\truntime: QuestionnaireRuntime,\n): QuestionnaireAction {\n\tif (isConfirm(kb, data)) {\n\t\tconst answer = buildSingleSelectAnswer(state, runtime);\n\t\tif (!answer) return { kind: \"ignore\" };\n\t\treturn { kind: \"confirm\", answer, autoAdvanceTab: computeAutoAdvanceTab(state, runtime) };\n\t}\n\tif (kb.matches(data, KEYBIND_CANCEL)) return { kind: \"cancel\" };\n\t// A digit answers with its row, as Enter on it would; the Type something. row's digit focuses it instead.\n\tconst row = digitRow(data, runtime);\n\tif (!row) return { kind: \"ignore\" };\n\tif (row.activatesInputMode) return { kind: \"nav\", nextIndex: row.index, inputValue: runtime.inputBuffer };\n\tconst answer = buildSingleSelectAnswer(\n\t\t{ ...state, optionIndex: row.index },\n\t\t{ ...runtime, currentItem: runtime.items[row.index] },\n\t);\n\tif (!answer) return { kind: \"ignore\" };\n\treturn { kind: \"confirm\", answer, autoAdvanceTab: computeAutoAdvanceTab(state, runtime) };\n}\n\nexport function routeKey(data: string, state: QuestionnaireState, runtime: QuestionnaireRuntime): QuestionnaireAction {\n\tconst kb = runtime.keybindings;\n\n\t// Collapse/expand toggle is a UI-level affordance — intercepted at the top so it\n\t// works from every inner state (notes, inputMode, submit tab, multi-select)\n\t// without reaching any branch that would otherwise consume the keystroke. The\n\t// questionnaire overlay is fully hidden via `OverlayHandle.setHidden(true)` while\n\t// collapsed; pi-tui's overlay stack updates accordingly, so overlay-aware consumers\n\t// (e.g. `pi-station`) see no visible modal and chat scroll resumes. The toggle key is\n\t// also captured at the raw terminal level via `ctx.ui.onTerminalInput` so it still\n\t// routes here when the overlay is hidden (pi-tui does not deliver input to a hidden\n\t// overlay's `component.handleInput`).\n\t//\n\t// The default `ctrl+]` is free in every mainstream macOS terminal (Terminal.app,\n\t// iTerm2, Warp), every multiplexer (tmux, zellij, screen — none use it as a prefix),\n\t// and the legacy telnet/ssh escape role doesn't apply because our overlay runs\n\t// in-process. It is, however, awkward on keyboard layouts where `]` is on the\n\t// shifted layer (Latin American `es-AR`/`es-MX` require `Ctrl+Shift+}` for `Ctrl+]`)\n\t// — use the `collapseKey` config field to override.\n\t// Treat a missing/non-string key as disabled. This can occur at runtime when\n\t// a long-lived Pi process retains an older outer module while a package update\n\t// replaces the lazily imported QuestionnaireSession graph on disk. Passing\n\t// undefined into matchesKey reaches parseKeyId().toLowerCase() and crashes the\n\t// entire host process, so keep the runtime boundary defensive even though the\n\t// TypeScript contract requires a string. The \"off\" literal is deliberate:\n\t// importing COLLAPSE_KEY_OFF would pull ../config.js (and its rpiv-config\n\t// loader graph) into this pure module for a string that cannot change.\n\tif (\n\t\ttypeof runtime.collapseKey === \"string\" &&\n\t\truntime.collapseKey !== \"off\" &&\n\t\tmatchesKey(data, runtime.collapseKey as Parameters<typeof matchesKey>[1])\n\t) {\n\t\treturn { kind: \"toggle_collapsed\" };\n\t}\n\n\tif (state.collapsed) return routeCollapsed(kb, data);\n\tif (state.notesVisible) return routeNotesMode(kb, data);\n\tif (state.inputMode) return routeInputMode(kb, data, state, runtime);\n\tif (runtime.isMulti && state.currentTab === runtime.questions.length) {\n\t\treturn routeSubmitTab(kb, data, state, runtime);\n\t}\n\n\tconst tab = tabSwitchAction(data, state, runtime);\n\tif (tab) return tab;\n\n\tconst q = runtime.questions[state.currentTab];\n\tif (!q) return { kind: \"ignore\" };\n\n\t// Universal `n` activation (FR-1): the notes editor opens on every question tab\n\t// (single- or multi-select, preview or no-preview). The blocks above already\n\t// swallow `n` when it should NOT reach here — notesVisible forwards to the\n\t// notes Input, inputMode forwards to the inline Input, the submit-tab block\n\t// activates it via its own branch (the global note, ahead of its ignore\n\t// fall-through), and tabSwitchAction ignores it — so by the time we reach this\n\t// gate, `n` is unambiguously a notes-enter request. Row intent (Next sentinel,\n\t// \"Type something.\") is irrelevant: the gate sits ABOVE the multi-select\n\t// toggle block and the Next sentinel never activates inputMode, so `n` is\n\t// neither swallowed earlier nor blocked by `blocksMultiToggle`.\n\tif (matchesNotesKey(data, runtime.notesKey)) {\n\t\treturn { kind: \"notes_enter\" };\n\t}\n\n\tif (kb.matches(data, KEYBIND_UP)) {\n\t\treturn prevNavOnUp(state, runtime);\n\t}\n\tif (kb.matches(data, KEYBIND_DOWN)) {\n\t\treturn nextNavOnDown(state, runtime);\n\t}\n\n\tif (q.multiSelect) return routeMultiSelectTab(kb, data, state, runtime);\n\treturn routeSingleSelectTab(kb, data, state, runtime);\n}\n"]}
@@ -0,0 +1,112 @@
1
+ import type { OverlayHandle, TUI } from "@earendil-works/pi-tui";
2
+ import type { Theme } from "../../../../../modes/interactive/theme/theme.ts";
3
+ import type { QuestionnaireResult, QuestionParams } from "../tool/types.ts";
4
+ import type { WrappingSelectItem } from "../view/components/wrapping-select.ts";
5
+ import type { QuestionnaireRuntime } from "./state.ts";
6
+ export interface QuestionnaireSessionConfig {
7
+ tui: TUI;
8
+ theme: Theme;
9
+ params: QuestionParams;
10
+ itemsByTab: WrappingSelectItem[][];
11
+ done: (result: QuestionnaireResult) => void;
12
+ keybindings: QuestionnaireRuntime["keybindings"];
13
+ /** Opens Pi's configured external editor. Resolve `undefined` on a reported launch failure. */
14
+ editInput: (value: string) => Promise<string | undefined>;
15
+ /** Key spec for the collapse/expand shortcut, e.g. `"ctrl+]"` or `"alt+o"`. */
16
+ collapseKey: string;
17
+ /** Key that opens the notes editor (`resolveNotesKey` output). */
18
+ notesKey: string;
19
+ /**
20
+ * True iff `execute()` registered the raw `ctx.ui.onTerminalInput` listener — the only
21
+ * path that can reach a hidden overlay. Gates the `set_overlay_hidden` effect: a host
22
+ * that delivers an `OverlayHandle` but no raw terminal input must fall back to the
23
+ * visible one-line collapsed row (which keeps focus and input routing), or collapsing
24
+ * would hide the overlay into a state nothing can reopen.
25
+ */
26
+ canReopenWhileHidden: boolean;
27
+ /** Terminal rows → rows the dialog may render; see `QuestionnaireBuildConfig.rowBudget`. */
28
+ rowBudget: (terminalRows: number) => number;
29
+ }
30
+ export interface QuestionnaireSessionComponent {
31
+ render(width: number): string[];
32
+ invalidate(): void;
33
+ handleInput(data: string): void;
34
+ }
35
+ /**
36
+ * Slim runtime: owns the canonical state cell, the headless editor cells, the
37
+ * notes-draft mirror, and the effect runner. State
38
+ * transitions go through the pure `reduce` reducer; UI fan-out goes through
39
+ * the `QuestionnairePropsAdapter` produced by `buildQuestionnaire`.
40
+ */
41
+ export declare class QuestionnaireSession {
42
+ private state;
43
+ private readonly questions;
44
+ private readonly isMulti;
45
+ private readonly itemsByTab;
46
+ private readonly notesInput;
47
+ private readonly inlineInput;
48
+ private readonly viewAdapter;
49
+ private readonly keybindings;
50
+ private readonly editInput;
51
+ private readonly collapseKey;
52
+ private readonly notesKey;
53
+ private readonly canReopenWhileHidden;
54
+ private inputEditorOpen;
55
+ /**
56
+ * Overlay handle captured by `ctx.ui.custom`'s `onHandle` callback. Lets the session
57
+ * call `setHidden(true/false)` so pi-tui's overlay stack reflects the collapsed state
58
+ * and overlay-aware consumers (e.g. `pi-station`) can resume normal behaviour.
59
+ */
60
+ private overlayHandle;
61
+ private readonly tui;
62
+ private readonly done;
63
+ readonly component: QuestionnaireSessionComponent;
64
+ constructor(config: QuestionnaireSessionConfig);
65
+ private assembleComponent;
66
+ /**
67
+ * Collapsed render: a single dim row (inline presentation: in the editor slot, where it
68
+ * keeps focus so the same key expands it). For the overlay, pi-tui sizes
69
+ * the overlay to `min(lines.length, maxHeight)`, so returning one line shrinks
70
+ * the bottom-anchored overlay from full-height to one row and the transcript
71
+ * behind it becomes readable (#47). The overlay stays focused and in the
72
+ * stack, so the collapse key still routes here to expand. `t` stays inside the
73
+ * closure (live locale updates); the key display is static per session.
74
+ *
75
+ * With collapseKey "off" the router and raw listener never toggle `collapsed`,
76
+ * but `toggleCollapsedExternal()` is a public ungated entry — fall back to the
77
+ * cancel-only line rather than rendering a literal "Off to expand".
78
+ */
79
+ private buildCollapsedRender;
80
+ dispatch(data: string): void;
81
+ private commit;
82
+ private mirrorNotesDraft;
83
+ private runEffect;
84
+ /** Opens Pi's configured external editor; on success commits the replacement buffer, on reported failure retains the draft. */
85
+ private openInputEditorAsync;
86
+ /**
87
+ * Per-keystroke `ignore` fast path: delegates text editing to Pi's headless
88
+ * multiline `Editor`, including paste, undo, cursor movement, and configured
89
+ * `tui.input.newLine` handling. `viewAdapter.apply` then projects its public
90
+ * text/cursor state without a reducer round-trip.
91
+ */
92
+ private handleIgnoreInline;
93
+ private runtime;
94
+ private applyContext;
95
+ private currentItem;
96
+ /**
97
+ * Setter for the overlay handle, called by `ctx.ui.custom`'s `onHandle` callback once
98
+ * the TUI has created the overlay. Until this is called, `set_overlay_hidden` effects
99
+ * are no-ops — the session still tracks `state.collapsed` for the view layer.
100
+ */
101
+ setOverlayHandle(handle: OverlayHandle): void;
102
+ /**
103
+ * Public toggle used by the raw terminal input listener registered in `execute()`.
104
+ * pi-tui does not route input to a hidden overlay's `component.handleInput`, so the
105
+ * raw listener (which fires for terminal data regardless of overlay visibility)
106
+ * reaches the session through this method instead of the dispatch path. Routed
107
+ * through `commit` so the transition stays in the reducer and the overlay hide
108
+ * happens via the `set_overlay_hidden` effect like every other side effect.
109
+ */
110
+ toggleCollapsedExternal(): void;
111
+ }
112
+ //# sourceMappingURL=questionnaire-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"questionnaire-session.d.ts","sourceRoot":"","sources":["../../../../../../src/humain/ask-user-question/vendor/ask/state/questionnaire-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,aAAa,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iDAAiD,CAAC;AAE7E,OAAO,KAAK,EAAgB,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAMhF,OAAO,KAAK,EAAE,oBAAoB,EAAsB,MAAM,YAAY,CAAC;AAG3E,MAAM,WAAW,0BAA0B;IAC1C,GAAG,EAAE,GAAG,CAAC;IACT,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,kBAAkB,EAAE,EAAE,CAAC;IACnC,IAAI,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC5C,WAAW,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IACjD,+FAA+F;IAC/F,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC1D,+EAA+E;IAC/E,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,oBAAoB,EAAE,OAAO,CAAC;IAC9B,4FAA4F;IAC5F,SAAS,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C;AAED,MAAM,WAAW,6BAA6B;IAC7C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,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,OAAO;IAiBf,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,WAAW;IAKnB;;;;OAIG;IACH,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAE5C;IAED;;;;;;;OAOG;IACH,uBAAuB,IAAI,IAAI,CAE9B;CACD"}
@@ -0,0 +1,240 @@
1
+ import { COLLAPSE_KEY_OFF, formatKeySpecForDisplay } from "../config.js";
2
+ import { COLLAPSED_HINT_TEMPLATE, HINT_PART_CANCEL, KEY_PLACEHOLDER } from "../view/dialog-builder.js";
3
+ import { buildQuestionnaire } from "./build-questionnaire.js";
4
+ import { t } from "./i18n-bridge.js";
5
+ import { routeKey } from "./key-router.js";
6
+ import { reduce } from "./state-reducer.js";
7
+ function initialState() {
8
+ return {
9
+ currentTab: 0,
10
+ optionIndex: 0,
11
+ inputMode: false,
12
+ notesVisible: false,
13
+ answers: new Map(),
14
+ multiSelectChecked: new Set(),
15
+ customDraftsByTab: new Map(),
16
+ notesByTab: new Map(),
17
+ submitChoiceIndex: 0,
18
+ notesDraft: "",
19
+ collapsed: false,
20
+ };
21
+ }
22
+ /**
23
+ * Slim runtime: owns the canonical state cell, the headless editor cells, the
24
+ * notes-draft mirror, and the effect runner. State
25
+ * transitions go through the pure `reduce` reducer; UI fan-out goes through
26
+ * the `QuestionnairePropsAdapter` produced by `buildQuestionnaire`.
27
+ */
28
+ export class QuestionnaireSession {
29
+ state = initialState();
30
+ questions;
31
+ isMulti;
32
+ itemsByTab;
33
+ notesInput;
34
+ inlineInput;
35
+ viewAdapter;
36
+ keybindings;
37
+ editInput;
38
+ collapseKey;
39
+ notesKey;
40
+ canReopenWhileHidden;
41
+ inputEditorOpen = false;
42
+ /**
43
+ * Overlay handle captured by `ctx.ui.custom`'s `onHandle` callback. Lets the session
44
+ * call `setHidden(true/false)` so pi-tui's overlay stack reflects the collapsed state
45
+ * and overlay-aware consumers (e.g. `pi-station`) can resume normal behaviour.
46
+ */
47
+ overlayHandle;
48
+ tui;
49
+ done;
50
+ component;
51
+ constructor(config) {
52
+ this.tui = config.tui;
53
+ this.done = config.done;
54
+ this.questions = config.params.questions;
55
+ this.isMulti = this.questions.length > 1;
56
+ this.itemsByTab = config.itemsByTab;
57
+ this.keybindings = config.keybindings;
58
+ this.editInput = config.editInput;
59
+ this.collapseKey = config.collapseKey;
60
+ this.notesKey = config.notesKey;
61
+ this.canReopenWhileHidden = config.canReopenWhileHidden;
62
+ const built = buildQuestionnaire({
63
+ tui: this.tui,
64
+ theme: config.theme,
65
+ questions: this.questions,
66
+ itemsByTab: this.itemsByTab,
67
+ isMulti: this.isMulti,
68
+ initialState: this.state,
69
+ getCurrentTab: () => this.state.currentTab,
70
+ collapseKey: this.collapseKey,
71
+ notesKey: this.notesKey,
72
+ rowBudget: config.rowBudget,
73
+ });
74
+ this.notesInput = built.notesInput;
75
+ this.inlineInput = built.inlineInput;
76
+ this.viewAdapter = built.adapter;
77
+ this.component = this.assembleComponent(built, config.theme);
78
+ this.viewAdapter.apply(this.state);
79
+ }
80
+ assembleComponent(built, theme) {
81
+ const collapsedRender = this.buildCollapsedRender(theme);
82
+ return {
83
+ render: (width) => (this.state.collapsed ? collapsedRender(width) : built.render(width)),
84
+ invalidate: built.invalidate,
85
+ handleInput: (data) => this.dispatch(data),
86
+ };
87
+ }
88
+ /**
89
+ * Collapsed render: a single dim row (inline presentation: in the editor slot, where it
90
+ * keeps focus so the same key expands it). For the overlay, pi-tui sizes
91
+ * the overlay to `min(lines.length, maxHeight)`, so returning one line shrinks
92
+ * the bottom-anchored overlay from full-height to one row and the transcript
93
+ * behind it becomes readable (#47). The overlay stays focused and in the
94
+ * stack, so the collapse key still routes here to expand. `t` stays inside the
95
+ * closure (live locale updates); the key display is static per session.
96
+ *
97
+ * With collapseKey "off" the router and raw listener never toggle `collapsed`,
98
+ * but `toggleCollapsedExternal()` is a public ungated entry — fall back to the
99
+ * cancel-only line rather than rendering a literal "Off to expand".
100
+ */
101
+ buildCollapsedRender(theme) {
102
+ const collapseKeyDisplay = formatKeySpecForDisplay(this.collapseKey);
103
+ const collapsedHintLine = () => this.collapseKey === COLLAPSE_KEY_OFF
104
+ ? t("hint.cancel", HINT_PART_CANCEL)
105
+ : t("hint.expand_line", COLLAPSED_HINT_TEMPLATE).replace(KEY_PLACEHOLDER, collapseKeyDisplay);
106
+ return (_width) => [theme.fg("dim", ` ${collapsedHintLine()} `)];
107
+ }
108
+ dispatch(data) {
109
+ if (this.inputEditorOpen)
110
+ return;
111
+ const action = routeKey(data, this.state, this.runtime());
112
+ if (action.kind === "ignore") {
113
+ this.handleIgnoreInline(data);
114
+ return;
115
+ }
116
+ this.commit(action);
117
+ }
118
+ commit(action) {
119
+ const result = reduce(this.state, action, this.applyContext());
120
+ this.state = result.state;
121
+ for (const effect of result.effects)
122
+ this.runEffect(effect);
123
+ this.state = this.mirrorNotesDraft(this.state);
124
+ this.viewAdapter.apply(this.state);
125
+ }
126
+ mirrorNotesDraft(s) {
127
+ // Drafts restore through Editor.setText, which clears the backing paste map —
128
+ // read expanded so stored drafts never orphan a paste marker.
129
+ const draft = this.notesInput.getExpandedText?.() ?? this.notesInput.getText();
130
+ return s.notesDraft === draft ? s : { ...s, notesDraft: draft };
131
+ }
132
+ runEffect(effect) {
133
+ switch (effect.kind) {
134
+ case "set_input_buffer":
135
+ this.inlineInput.setText(effect.value);
136
+ return;
137
+ case "clear_input_buffer":
138
+ this.inlineInput.setText("");
139
+ return;
140
+ case "open_input_editor":
141
+ this.openInputEditorAsync(effect.value);
142
+ return;
143
+ case "set_notes_value":
144
+ this.notesInput.setText(effect.value);
145
+ return;
146
+ case "set_notes_focused":
147
+ this.notesInput.focused = effect.focused;
148
+ return;
149
+ case "forward_notes_keystroke":
150
+ this.notesInput.handleInput(effect.data);
151
+ return;
152
+ case "set_overlay_hidden":
153
+ // No-op until `setOverlayHandle` has been called (the handle arrives via
154
+ // `ctx.ui.custom`'s `onHandle` right after the overlay is shown), and
155
+ // suppressed entirely when no raw terminal listener exists — hiding would
156
+ // then be irreversible (pi-tui routes no input to a hidden overlay), so the
157
+ // visible one-line collapsed row serves as the fallback rendering instead.
158
+ if (this.canReopenWhileHidden)
159
+ this.overlayHandle?.setHidden(effect.hidden);
160
+ return;
161
+ case "done":
162
+ this.done(effect.result);
163
+ return;
164
+ }
165
+ }
166
+ /** Opens Pi's configured external editor; on success commits the replacement buffer, on reported failure retains the draft. */
167
+ openInputEditorAsync(value) {
168
+ if (this.inputEditorOpen)
169
+ return;
170
+ this.inputEditorOpen = true;
171
+ void this.editInput(value).then((edited) => {
172
+ this.inputEditorOpen = false;
173
+ if (edited !== undefined)
174
+ this.commit({ kind: "input_replace", value: edited });
175
+ }, () => {
176
+ // The host callback reports launch errors; retain the draft and restore input handling.
177
+ this.inputEditorOpen = false;
178
+ });
179
+ }
180
+ /**
181
+ * Per-keystroke `ignore` fast path: delegates text editing to Pi's headless
182
+ * multiline `Editor`, including paste, undo, cursor movement, and configured
183
+ * `tui.input.newLine` handling. `viewAdapter.apply` then projects its public
184
+ * text/cursor state without a reducer round-trip.
185
+ */
186
+ handleIgnoreInline(data) {
187
+ // Collapsed routing also returns ignore; do not forward hidden keystrokes into the retained draft.
188
+ if (this.state.collapsed || !this.state.inputMode)
189
+ return;
190
+ this.inlineInput.handleInput(data);
191
+ this.viewAdapter.apply(this.state);
192
+ }
193
+ runtime() {
194
+ const cursor = this.inlineInput.getCursor();
195
+ const lastLine = this.inlineInput.getLines().length - 1;
196
+ return {
197
+ keybindings: this.keybindings,
198
+ inputBuffer: this.inlineInput.getExpandedText?.() ?? this.inlineInput.getText(),
199
+ canMoveInputUp: cursor.line > 0,
200
+ canMoveInputDown: cursor.line < lastLine,
201
+ questions: this.questions,
202
+ isMulti: this.isMulti,
203
+ currentItem: this.currentItem(),
204
+ items: this.itemsByTab[this.state.currentTab] ?? [],
205
+ collapseKey: this.collapseKey,
206
+ notesKey: this.notesKey,
207
+ };
208
+ }
209
+ applyContext() {
210
+ return {
211
+ questions: this.questions,
212
+ itemsByTab: this.itemsByTab,
213
+ };
214
+ }
215
+ currentItem() {
216
+ const arr = this.itemsByTab[this.state.currentTab] ?? [];
217
+ return this.state.optionIndex < arr.length ? arr[this.state.optionIndex] : undefined;
218
+ }
219
+ /**
220
+ * Setter for the overlay handle, called by `ctx.ui.custom`'s `onHandle` callback once
221
+ * the TUI has created the overlay. Until this is called, `set_overlay_hidden` effects
222
+ * are no-ops — the session still tracks `state.collapsed` for the view layer.
223
+ */
224
+ setOverlayHandle(handle) {
225
+ this.overlayHandle = handle;
226
+ }
227
+ /**
228
+ * Public toggle used by the raw terminal input listener registered in `execute()`.
229
+ * pi-tui does not route input to a hidden overlay's `component.handleInput`, so the
230
+ * raw listener (which fires for terminal data regardless of overlay visibility)
231
+ * reaches the session through this method instead of the dispatch path. Routed
232
+ * through `commit` so the transition stays in the reducer and the overlay hide
233
+ * happens via the `set_overlay_hidden` effect like every other side effect.
234
+ */
235
+ toggleCollapsedExternal() {
236
+ if (!this.inputEditorOpen)
237
+ this.commit({ kind: "toggle_collapsed" });
238
+ }
239
+ }
240
+ //# sourceMappingURL=questionnaire-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"questionnaire-session.js","sourceRoot":"","sources":["../../../../../../src/humain/ask-user-question/vendor/ask/state/questionnaire-session.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAGzE,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEvG,OAAO,EAAE,kBAAkB,EAA2B,MAAM,0BAA0B,CAAC;AACvF,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAC;AACrC,OAAO,EAA4B,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAAkC,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAiC5E,SAAS,YAAY;IACpB,OAAO;QACN,UAAU,EAAE,CAAC;QACb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E,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IACtE,CAAC;CACD","sourcesContent":["import type { Editor, OverlayHandle, TUI } from \"@earendil-works/pi-tui\";\nimport type { Theme } from \"../../../../../modes/interactive/theme/theme.ts\";\nimport { COLLAPSE_KEY_OFF, formatKeySpecForDisplay } from \"../config.ts\";\nimport type { QuestionData, QuestionnaireResult, QuestionParams } from \"../tool/types.ts\";\nimport type { WrappingSelectItem } from \"../view/components/wrapping-select.ts\";\nimport { COLLAPSED_HINT_TEMPLATE, HINT_PART_CANCEL, KEY_PLACEHOLDER } from \"../view/dialog-builder.ts\";\nimport type { QuestionnairePropsAdapter } from \"../view/props-adapter.ts\";\nimport { buildQuestionnaire, type QuestionnaireBuilt } from \"./build-questionnaire.ts\";\nimport { t } from \"./i18n-bridge.ts\";\nimport { type QuestionnaireAction, routeKey } from \"./key-router.ts\";\nimport type { QuestionnaireRuntime, QuestionnaireState } from \"./state.ts\";\nimport { type ApplyContext, type Effect, reduce } from \"./state-reducer.ts\";\n\nexport interface QuestionnaireSessionConfig {\n\ttui: TUI;\n\ttheme: Theme;\n\tparams: QuestionParams;\n\titemsByTab: WrappingSelectItem[][];\n\tdone: (result: QuestionnaireResult) => void;\n\tkeybindings: QuestionnaireRuntime[\"keybindings\"];\n\t/** Opens Pi's configured external editor. Resolve `undefined` on a reported launch failure. */\n\teditInput: (value: string) => Promise<string | undefined>;\n\t/** Key spec for the collapse/expand shortcut, e.g. `\"ctrl+]\"` or `\"alt+o\"`. */\n\tcollapseKey: string;\n\t/** Key that opens the notes editor (`resolveNotesKey` output). */\n\tnotesKey: string;\n\t/**\n\t * True iff `execute()` registered the raw `ctx.ui.onTerminalInput` listener — the only\n\t * path that can reach a hidden overlay. Gates the `set_overlay_hidden` effect: a host\n\t * that delivers an `OverlayHandle` but no raw terminal input must fall back to the\n\t * visible one-line collapsed row (which keeps focus and input routing), or collapsing\n\t * would hide the overlay into a state nothing can reopen.\n\t */\n\tcanReopenWhileHidden: boolean;\n\t/** Terminal rows → rows the dialog may render; see `QuestionnaireBuildConfig.rowBudget`. */\n\trowBudget: (terminalRows: number) => number;\n}\n\nexport interface QuestionnaireSessionComponent {\n\trender(width: number): string[];\n\tinvalidate(): void;\n\thandleInput(data: string): void;\n}\n\nfunction initialState(): QuestionnaireState {\n\treturn {\n\t\tcurrentTab: 0,\n\t\toptionIndex: 0,\n\t\tinputMode: false,\n\t\tnotesVisible: false,\n\t\tanswers: new Map(),\n\t\tmultiSelectChecked: new Set(),\n\t\tcustomDraftsByTab: new Map(),\n\t\tnotesByTab: new Map(),\n\t\tsubmitChoiceIndex: 0,\n\t\tnotesDraft: \"\",\n\t\tcollapsed: false,\n\t};\n}\n\n/**\n * Slim runtime: owns the canonical state cell, the headless editor cells, the\n * notes-draft mirror, and the effect runner. State\n * transitions go through the pure `reduce` reducer; UI fan-out goes through\n * the `QuestionnairePropsAdapter` produced by `buildQuestionnaire`.\n */\nexport class QuestionnaireSession {\n\tprivate state: QuestionnaireState = initialState();\n\n\tprivate readonly questions: readonly QuestionData[];\n\tprivate readonly isMulti: boolean;\n\tprivate readonly itemsByTab: WrappingSelectItem[][];\n\n\tprivate readonly notesInput: Editor;\n\tprivate readonly inlineInput: Editor;\n\tprivate readonly viewAdapter: QuestionnairePropsAdapter;\n\tprivate readonly keybindings: QuestionnaireRuntime[\"keybindings\"];\n\tprivate readonly editInput: QuestionnaireSessionConfig[\"editInput\"];\n\tprivate readonly collapseKey: string;\n\tprivate readonly notesKey: string;\n\tprivate readonly canReopenWhileHidden: boolean;\n\tprivate inputEditorOpen = false;\n\n\t/**\n\t * Overlay handle captured by `ctx.ui.custom`'s `onHandle` callback. Lets the session\n\t * call `setHidden(true/false)` so pi-tui's overlay stack reflects the collapsed state\n\t * and overlay-aware consumers (e.g. `pi-station`) can resume normal behaviour.\n\t */\n\tprivate overlayHandle: OverlayHandle | undefined;\n\n\tprivate readonly tui: QuestionnaireSessionConfig[\"tui\"];\n\tprivate readonly done: QuestionnaireSessionConfig[\"done\"];\n\treadonly component: QuestionnaireSessionComponent;\n\n\tconstructor(config: QuestionnaireSessionConfig) {\n\t\tthis.tui = config.tui;\n\t\tthis.done = config.done;\n\t\tthis.questions = config.params.questions;\n\t\tthis.isMulti = this.questions.length > 1;\n\t\tthis.itemsByTab = config.itemsByTab;\n\t\tthis.keybindings = config.keybindings;\n\t\tthis.editInput = config.editInput;\n\t\tthis.collapseKey = config.collapseKey;\n\t\tthis.notesKey = config.notesKey;\n\t\tthis.canReopenWhileHidden = config.canReopenWhileHidden;\n\n\t\tconst built = buildQuestionnaire({\n\t\t\ttui: this.tui,\n\t\t\ttheme: config.theme,\n\t\t\tquestions: this.questions,\n\t\t\titemsByTab: this.itemsByTab,\n\t\t\tisMulti: this.isMulti,\n\t\t\tinitialState: this.state,\n\t\t\tgetCurrentTab: () => this.state.currentTab,\n\t\t\tcollapseKey: this.collapseKey,\n\t\t\tnotesKey: this.notesKey,\n\t\t\trowBudget: config.rowBudget,\n\t\t});\n\n\t\tthis.notesInput = built.notesInput;\n\t\tthis.inlineInput = built.inlineInput;\n\t\tthis.viewAdapter = built.adapter;\n\n\t\tthis.component = this.assembleComponent(built, config.theme);\n\t\tthis.viewAdapter.apply(this.state);\n\t}\n\n\tprivate assembleComponent(built: QuestionnaireBuilt, theme: Theme): QuestionnaireSessionComponent {\n\t\tconst collapsedRender = this.buildCollapsedRender(theme);\n\t\treturn {\n\t\t\trender: (width) => (this.state.collapsed ? collapsedRender(width) : built.render(width)),\n\t\t\tinvalidate: built.invalidate,\n\t\t\thandleInput: (data) => this.dispatch(data),\n\t\t};\n\t}\n\n\t/**\n\t * Collapsed render: a single dim row (inline presentation: in the editor slot, where it\n\t * keeps focus so the same key expands it). For the overlay, pi-tui sizes\n\t * the overlay to `min(lines.length, maxHeight)`, so returning one line shrinks\n\t * the bottom-anchored overlay from full-height to one row and the transcript\n\t * behind it becomes readable (#47). The overlay stays focused and in the\n\t * stack, so the collapse key still routes here to expand. `t` stays inside the\n\t * closure (live locale updates); the key display is static per session.\n\t *\n\t * With collapseKey \"off\" the router and raw listener never toggle `collapsed`,\n\t * but `toggleCollapsedExternal()` is a public ungated entry — fall back to the\n\t * cancel-only line rather than rendering a literal \"Off to expand\".\n\t */\n\tprivate buildCollapsedRender(theme: Theme): (width: number) => string[] {\n\t\tconst collapseKeyDisplay = formatKeySpecForDisplay(this.collapseKey);\n\t\tconst collapsedHintLine = (): string =>\n\t\t\tthis.collapseKey === COLLAPSE_KEY_OFF\n\t\t\t\t? t(\"hint.cancel\", HINT_PART_CANCEL)\n\t\t\t\t: t(\"hint.expand_line\", COLLAPSED_HINT_TEMPLATE).replace(KEY_PLACEHOLDER, collapseKeyDisplay);\n\t\treturn (_width: number): string[] => [theme.fg(\"dim\", ` ${collapsedHintLine()} `)];\n\t}\n\n\tdispatch(data: string): void {\n\t\tif (this.inputEditorOpen) return;\n\t\tconst action = routeKey(data, this.state, this.runtime());\n\t\tif (action.kind === \"ignore\") {\n\t\t\tthis.handleIgnoreInline(data);\n\t\t\treturn;\n\t\t}\n\t\tthis.commit(action);\n\t}\n\n\tprivate commit(action: QuestionnaireAction): void {\n\t\tconst result = reduce(this.state, action, this.applyContext());\n\t\tthis.state = result.state;\n\t\tfor (const effect of result.effects) this.runEffect(effect);\n\t\tthis.state = this.mirrorNotesDraft(this.state);\n\t\tthis.viewAdapter.apply(this.state);\n\t}\n\n\tprivate mirrorNotesDraft(s: QuestionnaireState): QuestionnaireState {\n\t\t// Drafts restore through Editor.setText, which clears the backing paste map —\n\t\t// read expanded so stored drafts never orphan a paste marker.\n\t\tconst draft = this.notesInput.getExpandedText?.() ?? this.notesInput.getText();\n\t\treturn s.notesDraft === draft ? s : { ...s, notesDraft: draft };\n\t}\n\n\tprivate runEffect(effect: Effect): void {\n\t\tswitch (effect.kind) {\n\t\t\tcase \"set_input_buffer\":\n\t\t\t\tthis.inlineInput.setText(effect.value);\n\t\t\t\treturn;\n\t\t\tcase \"clear_input_buffer\":\n\t\t\t\tthis.inlineInput.setText(\"\");\n\t\t\t\treturn;\n\t\t\tcase \"open_input_editor\":\n\t\t\t\tthis.openInputEditorAsync(effect.value);\n\t\t\t\treturn;\n\t\t\tcase \"set_notes_value\":\n\t\t\t\tthis.notesInput.setText(effect.value);\n\t\t\t\treturn;\n\t\t\tcase \"set_notes_focused\":\n\t\t\t\tthis.notesInput.focused = effect.focused;\n\t\t\t\treturn;\n\t\t\tcase \"forward_notes_keystroke\":\n\t\t\t\tthis.notesInput.handleInput(effect.data);\n\t\t\t\treturn;\n\t\t\tcase \"set_overlay_hidden\":\n\t\t\t\t// No-op until `setOverlayHandle` has been called (the handle arrives via\n\t\t\t\t// `ctx.ui.custom`'s `onHandle` right after the overlay is shown), and\n\t\t\t\t// suppressed entirely when no raw terminal listener exists — hiding would\n\t\t\t\t// then be irreversible (pi-tui routes no input to a hidden overlay), so the\n\t\t\t\t// visible one-line collapsed row serves as the fallback rendering instead.\n\t\t\t\tif (this.canReopenWhileHidden) this.overlayHandle?.setHidden(effect.hidden);\n\t\t\t\treturn;\n\t\t\tcase \"done\":\n\t\t\t\tthis.done(effect.result);\n\t\t\t\treturn;\n\t\t}\n\t}\n\n\t/** Opens Pi's configured external editor; on success commits the replacement buffer, on reported failure retains the draft. */\n\tprivate openInputEditorAsync(value: string): void {\n\t\tif (this.inputEditorOpen) return;\n\t\tthis.inputEditorOpen = true;\n\t\tvoid this.editInput(value).then(\n\t\t\t(edited) => {\n\t\t\t\tthis.inputEditorOpen = false;\n\t\t\t\tif (edited !== undefined) this.commit({ kind: \"input_replace\", value: edited });\n\t\t\t},\n\t\t\t() => {\n\t\t\t\t// The host callback reports launch errors; retain the draft and restore input handling.\n\t\t\t\tthis.inputEditorOpen = false;\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Per-keystroke `ignore` fast path: delegates text editing to Pi's headless\n\t * multiline `Editor`, including paste, undo, cursor movement, and configured\n\t * `tui.input.newLine` handling. `viewAdapter.apply` then projects its public\n\t * text/cursor state without a reducer round-trip.\n\t */\n\tprivate handleIgnoreInline(data: string): void {\n\t\t// Collapsed routing also returns ignore; do not forward hidden keystrokes into the retained draft.\n\t\tif (this.state.collapsed || !this.state.inputMode) return;\n\t\tthis.inlineInput.handleInput(data);\n\t\tthis.viewAdapter.apply(this.state);\n\t}\n\n\tprivate runtime(): QuestionnaireRuntime {\n\t\tconst cursor = this.inlineInput.getCursor();\n\t\tconst lastLine = this.inlineInput.getLines().length - 1;\n\t\treturn {\n\t\t\tkeybindings: this.keybindings,\n\t\t\tinputBuffer: this.inlineInput.getExpandedText?.() ?? this.inlineInput.getText(),\n\t\t\tcanMoveInputUp: cursor.line > 0,\n\t\t\tcanMoveInputDown: cursor.line < lastLine,\n\t\t\tquestions: this.questions,\n\t\t\tisMulti: this.isMulti,\n\t\t\tcurrentItem: this.currentItem(),\n\t\t\titems: this.itemsByTab[this.state.currentTab] ?? [],\n\t\t\tcollapseKey: this.collapseKey,\n\t\t\tnotesKey: this.notesKey,\n\t\t};\n\t}\n\n\tprivate applyContext(): ApplyContext {\n\t\treturn {\n\t\t\tquestions: this.questions,\n\t\t\titemsByTab: this.itemsByTab,\n\t\t};\n\t}\n\n\tprivate currentItem(): WrappingSelectItem | undefined {\n\t\tconst arr = this.itemsByTab[this.state.currentTab] ?? [];\n\t\treturn this.state.optionIndex < arr.length ? arr[this.state.optionIndex] : undefined;\n\t}\n\n\t/**\n\t * Setter for the overlay handle, called by `ctx.ui.custom`'s `onHandle` callback once\n\t * the TUI has created the overlay. Until this is called, `set_overlay_hidden` effects\n\t * are no-ops — the session still tracks `state.collapsed` for the view layer.\n\t */\n\tsetOverlayHandle(handle: OverlayHandle): void {\n\t\tthis.overlayHandle = handle;\n\t}\n\n\t/**\n\t * Public toggle used by the raw terminal input listener registered in `execute()`.\n\t * pi-tui does not route input to a hidden overlay's `component.handleInput`, so the\n\t * raw listener (which fires for terminal data regardless of overlay visibility)\n\t * reaches the session through this method instead of the dispatch path. Routed\n\t * through `commit` so the transition stays in the reducer and the overlay hide\n\t * happens via the `set_overlay_hidden` effect like every other side effect.\n\t */\n\ttoggleCollapsedExternal(): void {\n\t\tif (!this.inputEditorOpen) this.commit({ kind: \"toggle_collapsed\" });\n\t}\n}\n"]}
@@ -0,0 +1,87 @@
1
+ import type { QuestionData } from "../tool/types.ts";
2
+ import type { WrappingSelectItem } from "../view/components/wrapping-select.ts";
3
+ /**
4
+ * Row kind discriminator. Single source of truth — derived from the runtime
5
+ * `WrappingSelectItem` union (`wrapping-select.ts:18-22`) so adding a new
6
+ * variant there forces a `ROW_INTENT_META` entry here (compile-time
7
+ * exhaustiveness via `Record<RowKind, …>`).
8
+ */
9
+ export type RowKind = WrappingSelectItem["kind"];
10
+ /**
11
+ * Sentinel kinds — the subset of `RowKind` representing protocol-driven rows
12
+ * (vs author-defined `option` rows). The auto-append walker, the reserved-label
13
+ * derivation, and `LABELS_BY_KIND` consumers iterate this list.
14
+ */
15
+ export type SentinelKind = Exclude<RowKind, "option">;
16
+ export declare const SENTINEL_KINDS: readonly SentinelKind[];
17
+ /**
18
+ * Per-kind static metadata. Pure data — no closures, no per-kind handler
19
+ * functions. Behavior-bearing branches (answer construction in
20
+ * `key-router.ts:69-99`, the Next-row render block in `multi-select-view.ts`,
21
+ * and the inline-Input render branch in `wrapping-select.ts`) keep their
22
+ * exhaustive switches and READ flags from this table.
23
+ *
24
+ * Adding a new sentinel:
25
+ * 1. Add the variant to `WrappingSelectItem` (`wrapping-select.ts:18-22`).
26
+ * 2. Add an entry here. Compile fails until both edits are present.
27
+ * 3. (If user-facing) author wherever the row is synthesized — typically
28
+ * `buildItemsForQuestion` for main-list residents.
29
+ *
30
+ * Field semantics:
31
+ * - `label` — user-facing string. For `option` it's an empty placeholder
32
+ * (per-instance labels come from `QuestionData.options[i].label`); every
33
+ * sentinel uses its META entry as the single source of truth.
34
+ * - `reserved` — author-facing labels matching this string trigger
35
+ * `reserved_label` at validation time. `RESERVED_LABEL_SET` is derived.
36
+ * - `livesInMainList` — true iff the row appears in `itemsByTab[i]`. Every
37
+ * current sentinel lives in the main list (the `next` row is synthesized by
38
+ * `sentinelsToAppend`).
39
+ * - `numbered` — true iff the row contributes to the main-list numbering.
40
+ * Multi-select Next is the only `numbered=false` row that lives in the list.
41
+ * - `activatesInputMode` — true iff focusing the row should toggle
42
+ * `state.inputMode = true`. Read by `state-reducer.ts` `nav` case.
43
+ * - `blocksMultiToggle` — in multiSelect mode, Space (and Enter-as-toggle)
44
+ * on this row is suppressed. The Next sentinel is the only true.
45
+ * - `autoSubmitsInMulti` — in multiSelect mode, Enter on this row commits
46
+ * the question (emits `multi_confirm`). The Next sentinel is the only true.
47
+ * - `autoAppendOnSingleSelect` — `buildItemsForQuestion` appends
48
+ * this row when the question is single-select, regardless of whether any
49
+ * option carries a `preview`. The "other" sentinel is the only true.
50
+ * - `autoAppendOnMultiSelect` — `buildItemsForQuestion` appends this row
51
+ * when the question is multi-select. The `other` and `next` sentinels are both true.
52
+ */
53
+ export interface RowIntentMeta {
54
+ label: string;
55
+ reserved: boolean;
56
+ livesInMainList: boolean;
57
+ numbered: boolean;
58
+ activatesInputMode: boolean;
59
+ blocksMultiToggle: boolean;
60
+ autoSubmitsInMulti: boolean;
61
+ autoAppendOnSingleSelect: boolean;
62
+ autoAppendOnMultiSelect: boolean;
63
+ }
64
+ export declare const ROW_INTENT_META: Record<RowKind, RowIntentMeta>;
65
+ /**
66
+ * Kind-keyed label view. `option` is excluded — its label is per-instance,
67
+ * not per-kind. `types.ts#SENTINEL_LABELS` re-sources from here.
68
+ */
69
+ export declare const LABELS_BY_KIND: {
70
+ readonly [K in SentinelKind]: string;
71
+ };
72
+ /**
73
+ * Reserved-label set for runtime validation. Includes "Other" (a model-conditioned
74
+ * label that has no runtime kind) plus every sentinel with `reserved: true`.
75
+ */
76
+ export declare const RESERVED_LABEL_SET: ReadonlySet<string>;
77
+ /**
78
+ * Walk the META table to synthesize sentinel rows for one question. The two
79
+ * append predicates are mutually exclusive in practice (`multiSelect` vs
80
+ * single-select) but the walker doesn't enforce that — adding a third bucket
81
+ * only requires a new META flag.
82
+ *
83
+ * Returns sentinel descriptors in declaration order of `SENTINEL_KINDS`. The
84
+ * caller wraps each with the `WrappingSelectItem` shape (kind + label).
85
+ */
86
+ export declare function sentinelsToAppend(question: QuestionData): SentinelKind[];
87
+ //# sourceMappingURL=row-intent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"row-intent.d.ts","sourceRoot":"","sources":["../../../../../../src/humain/ask-user-question/vendor/ask/state/row-intent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAEjD;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACtD,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAAsB,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,wBAAwB,EAAE,OAAO,CAAC;IAClC,uBAAuB,EAAE,OAAO,CAAC;CACjC;AAED,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,OAAO,EAAE,aAAa,CAkC1D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE;IAAE,QAAQ,EAAE,CAAC,IAAI,YAAY,GAAG,MAAM;CAGlE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAGjD,CAAC;AAEH;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,YAAY,EAAE,CAYxE"}
@@ -0,0 +1,79 @@
1
+ export const SENTINEL_KINDS = ["other", "next"];
2
+ export const ROW_INTENT_META = {
3
+ option: {
4
+ label: "",
5
+ reserved: false,
6
+ livesInMainList: true,
7
+ numbered: true,
8
+ activatesInputMode: false,
9
+ blocksMultiToggle: false,
10
+ autoSubmitsInMulti: false,
11
+ autoAppendOnSingleSelect: false,
12
+ autoAppendOnMultiSelect: false,
13
+ },
14
+ other: {
15
+ label: "Type something.",
16
+ reserved: true,
17
+ livesInMainList: true,
18
+ numbered: true,
19
+ activatesInputMode: true,
20
+ blocksMultiToggle: false,
21
+ autoSubmitsInMulti: false,
22
+ autoAppendOnSingleSelect: true,
23
+ autoAppendOnMultiSelect: true,
24
+ },
25
+ next: {
26
+ label: "Next",
27
+ reserved: true,
28
+ livesInMainList: true,
29
+ numbered: false,
30
+ activatesInputMode: false,
31
+ blocksMultiToggle: true,
32
+ autoSubmitsInMulti: true,
33
+ autoAppendOnSingleSelect: false,
34
+ autoAppendOnMultiSelect: true,
35
+ },
36
+ };
37
+ /**
38
+ * Kind-keyed label view. `option` is excluded — its label is per-instance,
39
+ * not per-kind. `types.ts#SENTINEL_LABELS` re-sources from here.
40
+ */
41
+ export const LABELS_BY_KIND = {
42
+ other: ROW_INTENT_META.other.label,
43
+ next: ROW_INTENT_META.next.label,
44
+ };
45
+ /**
46
+ * Reserved-label set for runtime validation. Includes "Other" (a model-conditioned
47
+ * label that has no runtime kind) plus every sentinel with `reserved: true`.
48
+ */
49
+ export const RESERVED_LABEL_SET = new Set([
50
+ "Other",
51
+ ...SENTINEL_KINDS.filter((k) => ROW_INTENT_META[k].reserved).map((k) => ROW_INTENT_META[k].label),
52
+ ]);
53
+ /**
54
+ * Walk the META table to synthesize sentinel rows for one question. The two
55
+ * append predicates are mutually exclusive in practice (`multiSelect` vs
56
+ * single-select) but the walker doesn't enforce that — adding a third bucket
57
+ * only requires a new META flag.
58
+ *
59
+ * Returns sentinel descriptors in declaration order of `SENTINEL_KINDS`. The
60
+ * caller wraps each with the `WrappingSelectItem` shape (kind + label).
61
+ */
62
+ export function sentinelsToAppend(question) {
63
+ const out = [];
64
+ for (const k of SENTINEL_KINDS) {
65
+ const meta = ROW_INTENT_META[k];
66
+ if (!meta.livesInMainList)
67
+ continue;
68
+ if (question.multiSelect === true) {
69
+ if (meta.autoAppendOnMultiSelect)
70
+ out.push(k);
71
+ }
72
+ else {
73
+ if (meta.autoAppendOnSingleSelect)
74
+ out.push(k);
75
+ }
76
+ }
77
+ return out;
78
+ }
79
+ //# sourceMappingURL=row-intent.js.map