@herbertgao/pi-extensions 2026.10.10 → 2026.10.12

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 (301) hide show
  1. package/README.md +13 -11
  2. package/THIRD_PARTY_NOTICES.md +3 -3
  3. package/node_modules/@herbertgao/pi-agency/README.md +5 -3
  4. package/node_modules/@herbertgao/pi-agency/package.json +1 -1
  5. package/node_modules/@herbertgao/pi-agency/src/index.ts +51 -7
  6. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +3 -0
  7. package/node_modules/@herbertgao/pi-cc-extensions/README.md +3 -0
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +1 -1
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +3 -3
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +126 -42
  11. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +24 -6
  12. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/scroll.ts +69 -16
  13. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/sticky-prompt.ts +1 -1
  14. package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
  15. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
  16. package/node_modules/@herbertgao/pi-subagents/package.json +1 -1
  17. package/node_modules/@herbertgao/pi-subagents/src/agent-color.ts +11 -2
  18. package/node_modules/@herbertgao/pi-subagents/src/index.ts +10 -5
  19. package/node_modules/@herbertgao/pi-subagents/src/ui/agent-widget.ts +3 -2
  20. package/node_modules/@herbertgao/pi-subagents/src/ui/conversation-viewer.ts +1 -1
  21. package/node_modules/@herbertgao/pi-subagents/src/ui/fleet-list.ts +1 -0
  22. package/node_modules/@herbertgao/sol-pi/README.md +8 -2
  23. package/node_modules/@herbertgao/sol-pi/agents-install.md +2 -2
  24. package/node_modules/@herbertgao/sol-pi/docs/compatibility.md +28 -4
  25. package/node_modules/@herbertgao/sol-pi/docs/configuration.md +17 -4
  26. package/node_modules/@herbertgao/sol-pi/package.json +1 -1
  27. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/index.ts +35 -25
  28. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/then-run.ts +95 -26
  29. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/evidence-preserving-reducer/candidate.ts +39 -2
  30. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/evidence-preserving-reducer/index.ts +24 -0
  31. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/observation-pack/index.ts +12 -7
  32. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/extension.ts +138 -130
  33. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/projection.ts +88 -14
  34. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/tools.ts +9 -0
  35. package/node_modules/@herbertgao/sol-pi/src/sol-pi/index.ts +14 -5
  36. package/node_modules/@herbertgao/sol-pi/src/sol-pi/shell-options.ts +22 -0
  37. package/node_modules/@herbertgao/sol-pi/src/sol-pi/tui.ts +11 -0
  38. package/node_modules/@juicesharp/rpiv-ask-user-question/answer-channel.ts +109 -0
  39. package/node_modules/@juicesharp/rpiv-ask-user-question/ask-user-question.ts +117 -71
  40. package/node_modules/@juicesharp/rpiv-ask-user-question/docs/hosts.md +2 -0
  41. package/node_modules/@juicesharp/rpiv-ask-user-question/docs/keyboard.md +3 -1
  42. package/node_modules/@juicesharp/rpiv-ask-user-question/docs/startup-performance.md +83 -0
  43. package/node_modules/@juicesharp/rpiv-ask-user-question/docs/tool-schema.md +74 -5
  44. package/node_modules/@juicesharp/rpiv-ask-user-question/events.ts +84 -0
  45. package/node_modules/@juicesharp/rpiv-ask-user-question/index.ts +10 -4
  46. package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +4 -2
  47. package/node_modules/@juicesharp/rpiv-ask-user-question/presentation.ts +1 -1
  48. package/node_modules/@juicesharp/rpiv-ask-user-question/reconcile.ts +1 -1
  49. package/node_modules/@juicesharp/rpiv-ask-user-question/rpc-fallback.ts +5 -4
  50. package/node_modules/@juicesharp/rpiv-ask-user-question/state/build-questionnaire.ts +19 -19
  51. package/node_modules/@juicesharp/rpiv-ask-user-question/state/i18n-bridge.ts +1 -1
  52. package/node_modules/@juicesharp/rpiv-ask-user-question/state/key-router.ts +7 -4
  53. package/node_modules/@juicesharp/rpiv-ask-user-question/state/questionnaire-session.ts +10 -10
  54. package/node_modules/@juicesharp/rpiv-ask-user-question/state/row-intent.ts +2 -2
  55. package/node_modules/@juicesharp/rpiv-ask-user-question/state/selectors/contract.ts +6 -6
  56. package/node_modules/@juicesharp/rpiv-ask-user-question/state/selectors/derivations.ts +2 -2
  57. package/node_modules/@juicesharp/rpiv-ask-user-question/state/selectors/focus.ts +1 -1
  58. package/node_modules/@juicesharp/rpiv-ask-user-question/state/selectors/projections.ts +9 -9
  59. package/node_modules/@juicesharp/rpiv-ask-user-question/state/state-reducer.ts +5 -5
  60. package/node_modules/@juicesharp/rpiv-ask-user-question/state/state.ts +2 -2
  61. package/node_modules/@juicesharp/rpiv-ask-user-question/tool/external-answer.ts +125 -0
  62. package/node_modules/@juicesharp/rpiv-ask-user-question/tool/format-answer.ts +1 -1
  63. package/node_modules/@juicesharp/rpiv-ask-user-question/tool/normalize-params.ts +1 -1
  64. package/node_modules/@juicesharp/rpiv-ask-user-question/tool/response-envelope.ts +2 -2
  65. package/node_modules/@juicesharp/rpiv-ask-user-question/tool/types.ts +1 -1
  66. package/node_modules/@juicesharp/rpiv-ask-user-question/tool/validate-questionnaire.ts +1 -1
  67. package/node_modules/@juicesharp/rpiv-ask-user-question/view/component-binding.ts +4 -4
  68. package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/multi-select-view.ts +4 -4
  69. package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/option-list-view.ts +2 -2
  70. package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/preview/markdown-content-cache.ts +3 -3
  71. package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/preview/preview-block-renderer.ts +5 -5
  72. package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/preview/preview-layout-decider.ts +3 -3
  73. package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/preview/preview-pane.ts +10 -10
  74. package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/submit-picker.ts +2 -2
  75. package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/tab-bar.ts +1 -1
  76. package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/wrapping-select.ts +1 -1
  77. package/node_modules/@juicesharp/rpiv-ask-user-question/view/dialog-builder.ts +9 -9
  78. package/node_modules/@juicesharp/rpiv-ask-user-question/view/dialog-copy.ts +1 -1
  79. package/node_modules/@juicesharp/rpiv-ask-user-question/view/props-adapter.ts +8 -8
  80. package/node_modules/@juicesharp/rpiv-ask-user-question/view/tab-components.ts +4 -4
  81. package/node_modules/@juicesharp/rpiv-ask-user-question/view/tab-content-strategy.ts +10 -10
  82. package/node_modules/@narumitw/pi-btw/README.md +14 -5
  83. package/node_modules/@narumitw/pi-btw/dist/index.ts +1067 -557
  84. package/node_modules/@narumitw/pi-btw/dist/index.ts.map +4 -4
  85. package/node_modules/@narumitw/pi-btw/docs/core-alignment.md +277 -0
  86. package/node_modules/@narumitw/pi-btw/docs/native-appearance.md +857 -0
  87. package/node_modules/@narumitw/pi-btw/docs/workflows.md +34 -13
  88. package/node_modules/@narumitw/pi-btw/package.json +4 -4
  89. package/node_modules/@narumitw/pi-btw/src/btw.ts +152 -108
  90. package/node_modules/@narumitw/pi-btw/src/conversation-chrome.ts +93 -0
  91. package/node_modules/@narumitw/pi-btw/src/fullscreen-renderer.ts +329 -0
  92. package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +109 -309
  93. package/node_modules/@narumitw/pi-btw/src/keybindings.ts +101 -23
  94. package/node_modules/@narumitw/pi-btw/src/menu.ts +42 -27
  95. package/node_modules/@narumitw/pi-btw/src/session-lifetime.ts +66 -0
  96. package/node_modules/@narumitw/pi-btw/src/transcript-pager.ts +366 -164
  97. package/node_modules/@narumitw/pi-btw/src/workspace-layout.ts +96 -36
  98. package/node_modules/@narumitw/pi-caffeinate/dist/index.ts +1 -0
  99. package/node_modules/@narumitw/pi-caffeinate/dist/index.ts.map +2 -2
  100. package/node_modules/@narumitw/pi-caffeinate/package.json +3 -3
  101. package/node_modules/@narumitw/pi-caffeinate/src/inhibitor-process.ts +1 -0
  102. package/node_modules/pi-antigravity/README.md +6 -2
  103. package/node_modules/pi-antigravity/package.json +2 -2
  104. package/node_modules/pi-antigravity/src/client/client.ts +44 -52
  105. package/node_modules/pi-antigravity/src/index.ts +13 -0
  106. package/node_modules/pi-antigravity/src/models/discovery.ts +25 -2
  107. package/node_modules/pi-antigravity/src/models/grouping.ts +107 -68
  108. package/node_modules/pi-antigravity/src/models/models.ts +10 -0
  109. package/node_modules/pi-antigravity/src/search/search.ts +581 -43
  110. package/node_modules/pi-antigravity/src/stream/stream.ts +53 -13
  111. package/node_modules/pi-antigravity/src/types/types.ts +13 -0
  112. package/node_modules/pi-antigravity/src/usage/usage.ts +11 -3
  113. package/node_modules/pi-lens/CHANGELOG.md +281 -0
  114. package/node_modules/pi-lens/README.md +13 -1
  115. package/node_modules/pi-lens/dist/{chunk-SS36ZX4J.js → chunk-24AKHFGP.js} +6 -6
  116. package/node_modules/pi-lens/dist/{chunk-JSQFTSC6.js → chunk-2FN63LPV.js} +11 -11
  117. package/node_modules/pi-lens/dist/{chunk-5UCAH366.js → chunk-2KXTHF3M.js} +20 -20
  118. package/node_modules/pi-lens/dist/{chunk-EU63SDCG.js → chunk-3DA2JDOL.js} +367 -281
  119. package/node_modules/pi-lens/dist/{chunk-RWWYJ623.js → chunk-3KAZU3VR.js} +1 -1
  120. package/node_modules/pi-lens/dist/chunk-3PTHXJXR.js +28 -0
  121. package/node_modules/pi-lens/dist/chunk-3QED2P4V.js +31 -0
  122. package/node_modules/pi-lens/dist/{chunk-N2H3ZPZY.js → chunk-3RKP3FMS.js} +1 -0
  123. package/node_modules/pi-lens/dist/{chunk-XVF2VVXP.js → chunk-5HSRT26B.js} +2 -2
  124. package/node_modules/pi-lens/dist/{chunk-MXGY6KPT.js → chunk-5IUSNGOC.js} +15 -15
  125. package/node_modules/pi-lens/dist/{chunk-EJIUXPBX.js → chunk-5OFV52AM.js} +1 -1
  126. package/node_modules/pi-lens/dist/{chunk-AW7R2GWG.js → chunk-5VSF4UUQ.js} +12 -7
  127. package/node_modules/pi-lens/dist/{chunk-6STA6Z7I.js → chunk-5WRPDP2A.js} +18 -18
  128. package/node_modules/pi-lens/dist/{chunk-YIUAVF7E.js → chunk-6DLWKFEX.js} +35 -34
  129. package/node_modules/pi-lens/dist/{chunk-WOA4LN2R.js → chunk-7D6L4MTX.js} +2 -2
  130. package/node_modules/pi-lens/dist/{chunk-GAEGEPOC.js → chunk-7HXE67BN.js} +2 -2
  131. package/node_modules/pi-lens/dist/chunk-AGSS7277.js +84 -0
  132. package/node_modules/pi-lens/dist/{chunk-R3PCY3YS.js → chunk-AMERCH6V.js} +13 -13
  133. package/node_modules/pi-lens/dist/{chunk-WU567RSC.js → chunk-ATKJFDQN.js} +14 -10
  134. package/node_modules/pi-lens/dist/{chunk-VSSBEUFT.js → chunk-AWSCPCN2.js} +16 -16
  135. package/node_modules/pi-lens/dist/{chunk-VCHXCQFG.js → chunk-BWD5EPKO.js} +3 -3
  136. package/node_modules/pi-lens/dist/{chunk-H6MF6EVN.js → chunk-CT4MN5IU.js} +1200 -230
  137. package/node_modules/pi-lens/dist/{chunk-FCSOVF55.js → chunk-CUHSHSB6.js} +6 -6
  138. package/node_modules/pi-lens/dist/{chunk-CHOW74WE.js → chunk-CYRKQRPM.js} +7 -10
  139. package/node_modules/pi-lens/dist/{chunk-Q7DUK4LX.js → chunk-DEL2U6CM.js} +5 -5
  140. package/node_modules/pi-lens/dist/{chunk-6C7JWPCP.js → chunk-DGUKIYSI.js} +26 -23
  141. package/node_modules/pi-lens/dist/{chunk-PHDMFAKM.js → chunk-DUO2TU77.js} +2 -2
  142. package/node_modules/pi-lens/dist/{chunk-MRXKYPCS.js → chunk-EBC36LNN.js} +2 -2
  143. package/node_modules/pi-lens/dist/{chunk-CSHFH5IN.js → chunk-ED36RF6Y.js} +1 -1
  144. package/node_modules/pi-lens/dist/{chunk-76MWC2K6.js → chunk-EUXZEFTV.js} +90 -97
  145. package/node_modules/pi-lens/dist/{chunk-QOZXJ4NA.js → chunk-FM4RDMKT.js} +11 -8
  146. package/node_modules/pi-lens/dist/{chunk-ACXEQZOU.js → chunk-GAQ7OQG6.js} +31 -28
  147. package/node_modules/pi-lens/dist/{chunk-XAGLWMJ4.js → chunk-GL5LUMZE.js} +23 -23
  148. package/node_modules/pi-lens/dist/{chunk-BKE7E7TC.js → chunk-GMX5OS7B.js} +9 -9
  149. package/node_modules/pi-lens/dist/{chunk-ZHFZWTZV.js → chunk-GSLNCYGG.js} +11 -11
  150. package/node_modules/pi-lens/dist/{chunk-3W7IEVVL.js → chunk-GSM5UU7A.js} +26 -34
  151. package/node_modules/pi-lens/dist/{chunk-724UL2TJ.js → chunk-GXFV6MYU.js} +3 -3
  152. package/node_modules/pi-lens/dist/chunk-HAD7QRQI.js +30 -0
  153. package/node_modules/pi-lens/dist/{chunk-QOBUHWHX.js → chunk-HRNHZA3N.js} +6 -6
  154. package/node_modules/pi-lens/dist/{chunk-VWCXW2E7.js → chunk-HWCCCQNX.js} +1 -1
  155. package/node_modules/pi-lens/dist/{chunk-7DYBLXYA.js → chunk-HYGZEMX6.js} +3 -3
  156. package/node_modules/pi-lens/dist/chunk-IJYGIDF4.js +186 -0
  157. package/node_modules/pi-lens/dist/{chunk-4W4VLAPJ.js → chunk-IQWN5JCP.js} +11 -11
  158. package/node_modules/pi-lens/dist/{chunk-SQ4TVJBR.js → chunk-IUE7SSKV.js} +7 -7
  159. package/node_modules/pi-lens/dist/{chunk-IBGIOBEE.js → chunk-IWDLU6K3.js} +68 -5
  160. package/node_modules/pi-lens/dist/{chunk-XCJN5IJU.js → chunk-IYNJ6YPZ.js} +4 -4
  161. package/node_modules/pi-lens/dist/{chunk-JAU72XNY.js → chunk-J64T55EI.js} +3 -3
  162. package/node_modules/pi-lens/dist/{chunk-2BBLFX75.js → chunk-J6MPGQTS.js} +5 -5
  163. package/node_modules/pi-lens/dist/chunk-JORED7EX.js +44 -0
  164. package/node_modules/pi-lens/dist/{chunk-6SDEP3AJ.js → chunk-JUKMK5Y4.js} +8 -8
  165. package/node_modules/pi-lens/dist/{chunk-FMSO6RDZ.js → chunk-JW3YWBVB.js} +15 -15
  166. package/node_modules/pi-lens/dist/{chunk-L3BLXZG7.js → chunk-KAPJINKN.js} +30 -69
  167. package/node_modules/pi-lens/dist/{chunk-2B73ZPOK.js → chunk-KN35K52N.js} +3 -3
  168. package/node_modules/pi-lens/dist/{chunk-C34ZXZ7O.js → chunk-KUA4OJ5Y.js} +24 -11
  169. package/node_modules/pi-lens/dist/chunk-KYUB6QDC.js +72 -0
  170. package/node_modules/pi-lens/dist/{chunk-67WMNWEE.js → chunk-LLJNQKQW.js} +12 -10
  171. package/node_modules/pi-lens/dist/chunk-LZSEQW6A.js +57 -0
  172. package/node_modules/pi-lens/dist/{chunk-ZANLILYD.js → chunk-M2IFVFWU.js} +2 -2
  173. package/node_modules/pi-lens/dist/chunk-M2UD3LPU.js +88 -0
  174. package/node_modules/pi-lens/dist/{chunk-XIJZVPD5.js → chunk-MBKQHGA7.js} +15 -15
  175. package/node_modules/pi-lens/dist/{chunk-P7266HLM.js → chunk-MPNJLASA.js} +2 -2
  176. package/node_modules/pi-lens/dist/{chunk-6GFRNVYR.js → chunk-MZGQNL3Y.js} +10 -10
  177. package/node_modules/pi-lens/dist/{chunk-ZWFS3OEF.js → chunk-N5FLEO7W.js} +33 -32
  178. package/node_modules/pi-lens/dist/{chunk-3JNKMP3B.js → chunk-O4NWQT6I.js} +4 -4
  179. package/node_modules/pi-lens/dist/{chunk-T6CPIZNT.js → chunk-OHKJ7PQF.js} +33 -32
  180. package/node_modules/pi-lens/dist/{chunk-VRZP76YM.js → chunk-P63GXC37.js} +4 -1
  181. package/node_modules/pi-lens/dist/{chunk-XTMJ7XDT.js → chunk-POMLXPMY.js} +1 -1
  182. package/node_modules/pi-lens/dist/{chunk-QQNQ7SJW.js → chunk-QBFBRV2B.js} +10 -4
  183. package/node_modules/pi-lens/dist/{chunk-CMMHNUZ2.js → chunk-R3T7CLQ2.js} +60 -38
  184. package/node_modules/pi-lens/dist/{chunk-23WOO7TX.js → chunk-R7YOCSNV.js} +10 -10
  185. package/node_modules/pi-lens/dist/{chunk-2CD5RS6M.js → chunk-RKBXZN3A.js} +23 -2
  186. package/node_modules/pi-lens/dist/{chunk-OCAGUNBC.js → chunk-RKKOYPRA.js} +12 -12
  187. package/node_modules/pi-lens/dist/{chunk-52FUZI6K.js → chunk-RMLC67LF.js} +1 -1
  188. package/node_modules/pi-lens/dist/{chunk-XMSXXAHW.js → chunk-ROYSX2S5.js} +2 -2
  189. package/node_modules/pi-lens/dist/{chunk-M6HSLBWY.js → chunk-RVK72CZX.js} +6507 -7514
  190. package/node_modules/pi-lens/dist/{chunk-FLKWCIZH.js → chunk-S2HEXIWI.js} +5 -5
  191. package/node_modules/pi-lens/dist/{chunk-UZ3TUTRV.js → chunk-S67KYG37.js} +1 -1
  192. package/node_modules/pi-lens/dist/{chunk-VCO24T4L.js → chunk-SD4I7ZO4.js} +14 -14
  193. package/node_modules/pi-lens/dist/{chunk-Z527N6YQ.js → chunk-SKAMFC7A.js} +12 -12
  194. package/node_modules/pi-lens/dist/{chunk-MQLUAEOC.js → chunk-SRYEJNES.js} +2 -2
  195. package/node_modules/pi-lens/dist/{chunk-BRGDSBJE.js → chunk-SYE6T2EB.js} +12 -12
  196. package/node_modules/pi-lens/dist/{chunk-GXW6K4YJ.js → chunk-T57LYLZT.js} +1 -1
  197. package/node_modules/pi-lens/dist/{chunk-ZXYDQ3TZ.js → chunk-T7FEBKXN.js} +48 -15
  198. package/node_modules/pi-lens/dist/{chunk-3EFKIGZN.js → chunk-TIQ2PKDW.js} +3 -3
  199. package/node_modules/pi-lens/dist/{chunk-QILIYSJF.js → chunk-TLX72JTG.js} +1 -1
  200. package/node_modules/pi-lens/dist/{chunk-TYM6OUIT.js → chunk-TOY6QKOH.js} +12 -12
  201. package/node_modules/pi-lens/dist/{chunk-IZSHAIJ7.js → chunk-TRETHTQO.js} +12 -12
  202. package/node_modules/pi-lens/dist/{chunk-3VPVG5SU.js → chunk-U44DJXQP.js} +10 -6
  203. package/node_modules/pi-lens/dist/{chunk-PNQDPDRC.js → chunk-UA7ZXYDR.js} +1 -1
  204. package/node_modules/pi-lens/dist/{chunk-OXXKQCSV.js → chunk-UBOQLVT2.js} +4 -4
  205. package/node_modules/pi-lens/dist/{chunk-QGQ5CCCG.js → chunk-UMS2MFPZ.js} +2 -2
  206. package/node_modules/pi-lens/dist/{chunk-QHJ6DQ2R.js → chunk-US7ECLD7.js} +55 -13
  207. package/node_modules/pi-lens/dist/{chunk-AB3YYG6N.js → chunk-UZ2XCLYS.js} +8 -8
  208. package/node_modules/pi-lens/dist/chunk-V35JG4JB.js +2667 -0
  209. package/node_modules/pi-lens/dist/{chunk-N3X6Q4YT.js → chunk-VOOAPROD.js} +3 -3
  210. package/node_modules/pi-lens/dist/{chunk-SAEFPSB6.js → chunk-W66O5E25.js} +21 -11
  211. package/node_modules/pi-lens/dist/{chunk-KBG47GHP.js → chunk-WMYE35PX.js} +15 -11
  212. package/node_modules/pi-lens/dist/{chunk-5NGR67U5.js → chunk-XBJVAEEO.js} +32 -5
  213. package/node_modules/pi-lens/dist/{chunk-YYOIQFRS.js → chunk-XHJBS436.js} +122 -44
  214. package/node_modules/pi-lens/dist/{chunk-GBPP5P7X.js → chunk-XTBDCR27.js} +4 -4
  215. package/node_modules/pi-lens/dist/{chunk-4UNXBNE2.js → chunk-XTFDJI3T.js} +11 -11
  216. package/node_modules/pi-lens/dist/{chunk-UXGETRP4.js → chunk-XYURS6EN.js} +13 -12
  217. package/node_modules/pi-lens/dist/{chunk-RPLINGVB.js → chunk-Y6GZHWSJ.js} +6 -6
  218. package/node_modules/pi-lens/dist/{chunk-2VUQMUMT.js → chunk-YCWYO6TQ.js} +41 -38
  219. package/node_modules/pi-lens/dist/{chunk-77M37OKR.js → chunk-YH5MVY2U.js} +7 -7
  220. package/node_modules/pi-lens/dist/{chunk-AOHZU2BM.js → chunk-YNE3RP52.js} +1 -1
  221. package/node_modules/pi-lens/dist/{chunk-YSZNHOBY.js → chunk-ZHH37KZL.js} +12 -12
  222. package/node_modules/pi-lens/dist/{chunk-ZGDGW2V3.js → chunk-ZIVJBOO3.js} +2 -2
  223. package/node_modules/pi-lens/dist/{chunk-RXCOMYPY.js → chunk-ZVUL7QYY.js} +29 -28
  224. package/node_modules/pi-lens/dist/index.js +11052 -5852
  225. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +10 -9
  226. package/node_modules/pi-lens/dist/mcp/cli.js +41 -38
  227. package/node_modules/pi-lens/dist/mcp/server.js +1120 -474
  228. package/node_modules/pi-lens/dist/mcp/worker.js +61 -58
  229. package/node_modules/pi-lens/dist/probes/installer.js +19 -19
  230. package/node_modules/pi-lens/dist/workers/project-snapshot-persist-worker.js +28 -9
  231. package/node_modules/pi-lens/dist/workers/review-graph-persist-worker.js +1 -1
  232. package/node_modules/pi-lens/docs/configuration.md +11 -0
  233. package/node_modules/pi-lens/docs/engineering-principles.md +32 -0
  234. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +1 -1
  235. package/node_modules/pi-lens/docs/lsp-idle-eviction.md +15 -26
  236. package/node_modules/pi-lens/docs/pi-lens-fixer.md +117 -13
  237. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +97 -7
  238. package/node_modules/pi-lens/docs/pi-lens-monitor.md +8 -2
  239. package/node_modules/pi-lens/docs/pi-lens-retro.md +4 -1
  240. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +112 -4
  241. package/node_modules/pi-lens/docs/pi-lens-subagent.md +22 -14
  242. package/node_modules/pi-lens/docs/release-qa-baseline.md +3 -1
  243. package/node_modules/pi-lens/docs/servercapabilities.md +9 -19
  244. package/node_modules/pi-lens/package.json +7 -5
  245. package/node_modules/pi-lens/scripts/download-grammars.js +40 -7
  246. package/node_modules/pi-lens/scripts/lib/latency-log-phases.mjs +95 -0
  247. package/node_modules/pi-lens/scripts/rpc-load-check.mjs +570 -81
  248. package/node_modules/pi-provider-qoder/dist/index.js +323 -154
  249. package/node_modules/pi-provider-qoder/package.json +1 -1
  250. package/node_modules/pi-web-access/CHANGELOG.md +60 -0
  251. package/node_modules/pi-web-access/README.md +96 -10
  252. package/node_modules/pi-web-access/anysearch.ts +4 -3
  253. package/node_modules/pi-web-access/bocha.ts +4 -3
  254. package/node_modules/pi-web-access/brightdata-unlocker.ts +3 -2
  255. package/node_modules/pi-web-access/brightdata.ts +4 -3
  256. package/node_modules/pi-web-access/ceramic.ts +3 -2
  257. package/node_modules/pi-web-access/credential-source.ts +54 -4
  258. package/node_modules/pi-web-access/curator-page.ts +5 -1
  259. package/node_modules/pi-web-access/curator-server.ts +2 -0
  260. package/node_modules/pi-web-access/deepseek.ts +377 -0
  261. package/node_modules/pi-web-access/dist/index.js +1463 -748
  262. package/node_modules/pi-web-access/dist/mcp-cli.js +1393 -717
  263. package/node_modules/pi-web-access/extract.ts +58 -6
  264. package/node_modules/pi-web-access/gemini-adc.ts +48 -1
  265. package/node_modules/pi-web-access/gemini-search.ts +33 -6
  266. package/node_modules/pi-web-access/index.ts +36 -4
  267. package/node_modules/pi-web-access/jina-search.ts +6 -4
  268. package/node_modules/pi-web-access/kagi.ts +5 -4
  269. package/node_modules/pi-web-access/keenable.ts +3 -2
  270. package/node_modules/pi-web-access/linkup.ts +170 -0
  271. package/node_modules/pi-web-access/mistral-search.ts +4 -3
  272. package/node_modules/pi-web-access/ollama.ts +5 -4
  273. package/node_modules/pi-web-access/package.json +1 -1
  274. package/node_modules/pi-web-access/page-query.ts +12 -6
  275. package/node_modules/pi-web-access/parallel.ts +7 -7
  276. package/node_modules/pi-web-access/perplexity.ts +5 -3
  277. package/node_modules/pi-web-access/querit.ts +4 -3
  278. package/node_modules/pi-web-access/query-rewrite.ts +16 -13
  279. package/node_modules/pi-web-access/search1api.ts +4 -3
  280. package/node_modules/pi-web-access/searchinfinity.ts +4 -3
  281. package/node_modules/pi-web-access/serpapi.ts +7 -5
  282. package/node_modules/pi-web-access/serpbase.ts +5 -4
  283. package/node_modules/pi-web-access/serpdive.ts +4 -3
  284. package/node_modules/pi-web-access/serper.ts +6 -4
  285. package/node_modules/pi-web-access/serply.ts +3 -2
  286. package/node_modules/pi-web-access/summary-review.ts +16 -6
  287. package/node_modules/pi-web-access/utils.ts +27 -1
  288. package/node_modules/pi-web-access/valyu.ts +4 -3
  289. package/node_modules/pi-web-access/web-tool-core.ts +7 -0
  290. package/node_modules/pi-web-access/xai-search.ts +49 -7
  291. package/node_modules/pi-web-access/xcrawl.ts +4 -3
  292. package/node_modules/pi-web-access/you.ts +3 -2
  293. package/package.json +15 -15
  294. package/node_modules/pi-lens/dist/chunk-3YN6V5TV.js +0 -85
  295. package/node_modules/pi-lens/dist/chunk-466Z26MG.js +0 -30
  296. package/node_modules/pi-lens/dist/chunk-EC47DWFA.js +0 -56
  297. package/node_modules/pi-lens/dist/chunk-KDERNTCQ.js +0 -28
  298. package/node_modules/pi-lens/dist/chunk-KSX3TXSZ.js +0 -69
  299. package/node_modules/pi-lens/dist/chunk-LOP6GRPH.js +0 -31
  300. package/node_modules/pi-lens/dist/chunk-UOPVJQ4N.js +0 -103
  301. /package/node_modules/pi-lens/dist/{chunk-FC4RP4I2.js → chunk-6HWVI6MI.js} +0 -0
@@ -49,6 +49,17 @@ export function renderSolPiTool(
49
49
  return container;
50
50
  }
51
51
 
52
+ /**
53
+ * Whether a tool call was made by another tool through `ctx.executeTool()`,
54
+ * such as a codemode script, rather than by the model. Pi 0.99+ gives such
55
+ * calls the id `<calling id>/<n>` (documented on `ExtensionToolContext`) and
56
+ * passes no other marker to `execute()`. Provider-issued ids do not end in
57
+ * `/<digits>`; a false match would only suppress a savings notice.
58
+ */
59
+ export function isNestedToolCallId(toolCallId: string): boolean {
60
+ return /\/\d+$/u.test(toolCallId);
61
+ }
62
+
52
63
  export function showSolPiSavings(
53
64
  context: ExtensionContext,
54
65
  mechanism: SolPiTuiMechanism,
@@ -0,0 +1,109 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+ import {
3
+ ASK_USER_ANSWER_EVENT,
4
+ ASK_USER_ANSWER_RESULT_EVENT,
5
+ type AskUserAnswerRejectCode,
6
+ type AskUserAnswerResultEventPayload,
7
+ } from "./events.ts";
8
+ import { resolveExternalAnswer } from "./tool/external-answer.ts";
9
+ import type { QuestionData, QuestionnaireResult } from "./tool/types.ts";
10
+
11
+ /** "rpc" while the RPC dialog walker owns the prompts — those cannot be answered from outside. */
12
+ export type AnswerHost = "tui" | "rpc";
13
+
14
+ /**
15
+ * One questionnaire an inbound `rpiv:ask-user:answer` may resolve, opened by `execute()`
16
+ * before its prompt event goes out and closed in its `finally`. Both answer sources —
17
+ * the dialog's own `done` and the inbound event — go through `settle`, so the first
18
+ * wins and a later one is refused instead of reported as applied.
19
+ */
20
+ export class OpenQuestionnaire {
21
+ private result: QuestionnaireResult | undefined;
22
+ private deliver: ((result: QuestionnaireResult) => void) | undefined;
23
+ private resolveEarly!: (result: QuestionnaireResult) => void;
24
+ /** Resolves with an answer accepted while no dialog was mounted to take it. */
25
+ readonly answeredEarly = new Promise<QuestionnaireResult>((resolve) => {
26
+ this.resolveEarly = resolve;
27
+ });
28
+
29
+ constructor(
30
+ readonly toolCallId: string,
31
+ readonly questions: readonly QuestionData[],
32
+ public host: AnswerHost,
33
+ ) {}
34
+
35
+ /** The accepted result, once settled. */
36
+ get settled(): QuestionnaireResult | undefined {
37
+ return this.result;
38
+ }
39
+
40
+ /** Hand over the mounted dialog's `done`; answers from now on close the dialog through it. */
41
+ attach(done: (result: QuestionnaireResult) => void): void {
42
+ this.deliver = done;
43
+ }
44
+
45
+ /** First answer wins. False when this questionnaire is already settled. */
46
+ settle(result: QuestionnaireResult): boolean {
47
+ if (this.result) return false;
48
+ this.result = result;
49
+ if (this.deliver) this.deliver(result);
50
+ else this.resolveEarly(result);
51
+ return true;
52
+ }
53
+ }
54
+
55
+ export interface AnswerChannel {
56
+ open(toolCallId: string, questions: readonly QuestionData[], host: AnswerHost): OpenQuestionnaire;
57
+ close(questionnaire: OpenQuestionnaire): void;
58
+ }
59
+
60
+ const isRecord = (v: unknown): v is Record<string, unknown> => typeof v === "object" && v !== null && !Array.isArray(v);
61
+
62
+ /**
63
+ * Listen for `rpiv:ask-user:answer` and answer every attempt on `rpiv:ask-user:answer-result`.
64
+ * Open questionnaires are keyed by tool-call id: Pi runs tool calls in parallel, so several
65
+ * can be open at once and the emitter must name the one it answers.
66
+ */
67
+ export function registerAnswerChannel(pi: ExtensionAPI): AnswerChannel {
68
+ const open = new Map<string, OpenQuestionnaire>();
69
+
70
+ pi.events.on(ASK_USER_ANSWER_EVENT, (data: unknown) => {
71
+ const payload = isRecord(data) ? data : {};
72
+ const requestId = typeof payload.requestId === "string" ? payload.requestId : undefined;
73
+ const toolCallId = typeof payload.toolCallId === "string" ? payload.toolCallId : undefined;
74
+ const reply = (code?: AskUserAnswerRejectCode, reason?: string) => {
75
+ const verdict: AskUserAnswerResultEventPayload = {
76
+ ok: code === undefined,
77
+ ...(code ? { code, reason } : {}),
78
+ ...(requestId !== undefined ? { requestId } : {}),
79
+ ...(toolCallId !== undefined ? { toolCallId } : {}),
80
+ };
81
+ pi.events.emit(ASK_USER_ANSWER_RESULT_EVENT, verdict);
82
+ };
83
+
84
+ if (!isRecord(data)) return reply("invalid_payload", "payload must be an object");
85
+ if (payload.requestId !== undefined && requestId === undefined) {
86
+ return reply("invalid_payload", "requestId must be a string");
87
+ }
88
+ if (toolCallId === undefined) return reply("invalid_payload", "toolCallId must be a string");
89
+ const target = open.get(toolCallId);
90
+ if (!target || target.settled) return reply("not_found", `no open questionnaire for tool call ${toolCallId}`);
91
+ if (target.host === "rpc") return reply("unsupported_host", "this host shows the questions in its own dialogs");
92
+
93
+ const outcome = resolveExternalAnswer(target.questions, payload);
94
+ if (!outcome.ok) return reply(outcome.code, outcome.reason);
95
+ if (!target.settle(outcome.result)) return reply("not_found", `tool call ${toolCallId} is already answered`);
96
+ reply();
97
+ });
98
+
99
+ return {
100
+ open(toolCallId, questions, host) {
101
+ const questionnaire = new OpenQuestionnaire(toolCallId, questions, host);
102
+ open.set(toolCallId, questionnaire);
103
+ return questionnaire;
104
+ },
105
+ close(questionnaire) {
106
+ if (open.get(questionnaire.toolCallId) === questionnaire) open.delete(questionnaire.toolCallId);
107
+ },
108
+ };
109
+ }
@@ -1,18 +1,19 @@
1
1
  import type { ExtensionAPI, ExtensionContext, Theme } from "@earendil-works/pi-coding-agent";
2
2
  import { isKeyRelease, isKeyRepeat, matchesKey, type OverlayHandle, type TUI } from "@earendil-works/pi-tui";
3
+ import { type OpenQuestionnaire, registerAnswerChannel } from "./answer-channel.ts";
3
4
  import {
4
5
  COLLAPSE_KEY_OFF,
5
6
  formatKeySpecForDisplay,
6
7
  loadConfig,
7
8
  resolveCollapseKey,
8
9
  validateGuidanceFields,
9
- } from "./config.js";
10
+ } from "./config.ts";
10
11
  import {
11
12
  ASK_USER_BLOCKED_EVENT,
12
13
  ASK_USER_PROMPT_EVENT,
13
14
  type AskUserBlockedEventPayload,
14
15
  type AskUserPromptEventPayload,
15
- } from "./events.js";
16
+ } from "./events.ts";
16
17
  // Static import is fine — rpc-fallback pulls only types + the i18n bridge,
17
18
  // none of the ~560ms TUI render graph that QuestionnaireSession lazy-loads.
18
19
  import {
@@ -22,12 +23,12 @@ import {
22
23
  rowBudgetForHost,
23
24
  STACKED_OVERLAY_PRESENTATION,
24
25
  YIELD_TO_OVERLAY,
25
- } from "./presentation.js";
26
- import { type DialogUI, hasDialogUI, runRpcQuestionnaire } from "./rpc-fallback.js";
27
- import { displayLabel, t } from "./state/i18n-bridge.js";
28
- import { sentinelsToAppend } from "./state/row-intent.js";
29
- import { normalizeQuestionParams, prepareQuestionArguments } from "./tool/normalize-params.js";
30
- import { buildQuestionnaireResponse, buildToolResult } from "./tool/response-envelope.js";
26
+ } from "./presentation.ts";
27
+ import { type DialogUI, hasDialogUI, runRpcQuestionnaire } from "./rpc-fallback.ts";
28
+ import { displayLabel, t } from "./state/i18n-bridge.ts";
29
+ import { sentinelsToAppend } from "./state/row-intent.ts";
30
+ import { normalizeQuestionParams, prepareQuestionArguments } from "./tool/normalize-params.ts";
31
+ import { buildQuestionnaireResponse, buildToolResult } from "./tool/response-envelope.ts";
31
32
  import {
32
33
  MAX_OPTIONS,
33
34
  MAX_QUESTIONS,
@@ -37,12 +38,13 @@ import {
37
38
  type QuestionnaireResult,
38
39
  type QuestionParams,
39
40
  QuestionParamsSchema,
40
- } from "./tool/types.js";
41
- import { validateQuestionnaire } from "./tool/validate-questionnaire.js";
42
- import type { WrappingSelectItem } from "./view/components/wrapping-select.js";
41
+ } from "./tool/types.ts";
42
+ import { validateQuestionnaire } from "./tool/validate-questionnaire.ts";
43
+ import type { WrappingSelectItem } from "./view/components/wrapping-select.ts";
43
44
 
44
- function emitAskUserPromptEvent(pi: ExtensionAPI, params: QuestionParams): void {
45
+ function emitAskUserPromptEvent(pi: ExtensionAPI, params: QuestionParams, toolCallId: string): void {
45
46
  const payload: AskUserPromptEventPayload = {
47
+ toolCallId,
46
48
  questions: params.questions.map((q) => ({
47
49
  question: q.question,
48
50
  header: q.header,
@@ -57,8 +59,8 @@ function emitAskUserPromptEvent(pi: ExtensionAPI, params: QuestionParams): void
57
59
  pi.events.emit(ASK_USER_PROMPT_EVENT, payload);
58
60
  }
59
61
 
60
- function emitAskUserBlockedEvent(pi: ExtensionAPI, active: boolean): void {
61
- const payload: AskUserBlockedEventPayload = { active };
62
+ function emitAskUserBlockedEvent(pi: ExtensionAPI, active: boolean, toolCallId: string): void {
63
+ const payload: AskUserBlockedEventPayload = { active, toolCallId };
62
64
  pi.events.emit(ASK_USER_BLOCKED_EVENT, payload);
63
65
  }
64
66
 
@@ -68,13 +70,13 @@ function rejectWithoutUi() {
68
70
  }
69
71
 
70
72
  /** Sequential native-dialog walker for RPC hosts; brackets it with the blocked-event pair + terminal bell. */
71
- async function runRpcPath(pi: ExtensionAPI, ui: DialogUI, typed: QuestionParams) {
72
- emitAskUserBlockedEvent(pi, true);
73
+ async function runRpcPath(pi: ExtensionAPI, ui: DialogUI, typed: QuestionParams, toolCallId: string) {
74
+ emitAskUserBlockedEvent(pi, true, toolCallId);
73
75
  try {
74
76
  emitTerminalAttention();
75
77
  return buildQuestionnaireResponse(await runRpcQuestionnaire(ui, typed), typed);
76
78
  } finally {
77
- emitAskUserBlockedEvent(pi, false);
79
+ emitAskUserBlockedEvent(pi, false, toolCallId);
78
80
  }
79
81
  }
80
82
 
@@ -113,9 +115,9 @@ function emitTerminalAttention(): void {
113
115
  /** Delay before the background session-graph pre-warm; mirrors rpiv-workflow's /wf prewarm. */
114
116
  export const PREWARM_DELAY_MS = 2000;
115
117
 
116
- type SessionModule = typeof import("./state/questionnaire-session.js");
118
+ type SessionModule = typeof import("./state/questionnaire-session.ts");
117
119
 
118
- type SessionRef = { current: import("./state/questionnaire-session.js").QuestionnaireSession | null };
120
+ type SessionRef = { current: import("./state/questionnaire-session.ts").QuestionnaireSession | null };
119
121
  type OverlayHandleRef = { current: OverlayHandle | undefined };
120
122
 
121
123
  type SessionLoad =
@@ -136,7 +138,7 @@ type SessionLoad =
136
138
  export async function loadQuestionnaireSession(): Promise<SessionLoad> {
137
139
  let mod: SessionModule;
138
140
  try {
139
- mod = await import("./state/questionnaire-session.js");
141
+ mod = await import("./state/questionnaire-session.ts");
140
142
  } catch (e) {
141
143
  const cause = e instanceof Error ? e.message : String(e);
142
144
  return { ok: false, error: "session_load_failed", message: `${ERROR_SESSION_LOAD_FAILED} (cause: ${cause})` };
@@ -200,33 +202,43 @@ function makeSessionFactory(config: {
200
202
  canReopenWhileHidden: boolean;
201
203
  presentation: Presentation;
202
204
  sessionRef: SessionRef;
205
+ open: OpenQuestionnaire;
203
206
  Session: SessionModule["QuestionnaireSession"];
204
207
  }) {
205
- const { ctx, typed, itemsByTab, collapseKey, canReopenWhileHidden, presentation, sessionRef, Session } = config;
208
+ const { ctx, typed, itemsByTab, collapseKey, canReopenWhileHidden, presentation, sessionRef, open, Session } =
209
+ config;
206
210
  return (
207
211
  tui: TUI,
208
212
  theme: Theme,
209
- keybindings: import("./state/questionnaire-session.js").QuestionnaireSessionConfig["keybindings"],
213
+ keybindings: import("./state/questionnaire-session.ts").QuestionnaireSessionConfig["keybindings"],
210
214
  done: (result: QuestionnaireResult) => void,
211
- ): import("./state/questionnaire-session.js").QuestionnaireSessionComponent => {
215
+ ): import("./state/questionnaire-session.ts").QuestionnaireSessionComponent => {
212
216
  // The factory runs at mount time — the first point the TUI is reachable — so this is
213
217
  // where an inline mount notices an overlay already on screen and gives the slot up.
214
218
  if (!presentation.overlay && mustYieldInlineSlot(tui)) {
215
219
  done(YIELD_TO_OVERLAY);
216
220
  return INERT_COMPONENT;
217
221
  }
222
+ // Answered from outside before this mount (a host may mount late, e.g. a lane
223
+ // console): close at once with that answer.
224
+ if (open.settled) {
225
+ done(open.settled);
226
+ return INERT_COMPONENT;
227
+ }
228
+ open.attach(done);
218
229
  const session = new Session({
219
230
  tui,
220
231
  theme,
221
232
  params: typed,
222
233
  itemsByTab,
223
- done,
234
+ // Through the first-answer-wins gate shared with inbound answers.
235
+ done: (result) => open.settle(result),
224
236
  keybindings,
225
237
  editInput: async (value) => {
226
238
  try {
227
239
  const [{ SettingsManager }, { editWithExternalEditor }] = await Promise.all([
228
240
  import("@earendil-works/pi-coding-agent"),
229
- import("./state/external-editor.js"),
241
+ import("./state/external-editor.ts"),
230
242
  ]);
231
243
  const editorCommand = SettingsManager.create(ctx.cwd, undefined, {
232
244
  projectTrusted: ctx.isProjectTrusted(),
@@ -249,7 +261,7 @@ function makeSessionFactory(config: {
249
261
  }
250
262
 
251
263
  /** Stand-in returned by a mount that resolved before mounting (Pi discards it unmounted). */
252
- const INERT_COMPONENT: import("./state/questionnaire-session.js").QuestionnaireSessionComponent = {
264
+ const INERT_COMPONENT: import("./state/questionnaire-session.ts").QuestionnaireSessionComponent = {
253
265
  render: () => [],
254
266
  invalidate: () => {},
255
267
  handleInput: () => {},
@@ -268,6 +280,7 @@ async function mountQuestionnaire(config: {
268
280
  itemsByTab: WrappingSelectItem[][];
269
281
  collapseKey: string;
270
282
  presentation: Presentation;
283
+ open: OpenQuestionnaire;
271
284
  Session: SessionModule["QuestionnaireSession"];
272
285
  }): Promise<QuestionnaireResult | undefined> {
273
286
  const { ctx, collapseKey, presentation } = config;
@@ -317,6 +330,73 @@ async function resolveUndefinedResult(ctx: ExtensionContext, typed: QuestionPara
317
330
  return buildToolResult(ERROR_NO_CUSTOM_UI, { answers: [], cancelled: true, error: "no_custom_ui" });
318
331
  }
319
332
 
333
+ /**
334
+ * The terminal dialog: inline in Pi's editor slot, or an overlay (see presentation.ts).
335
+ * Each mount races `open.answeredEarly`, so an inbound answer accepted before any dialog
336
+ * took it ends the call — a host that mounts later closes the dialog on sight (factory).
337
+ */
338
+ async function runTuiPath(pi: ExtensionAPI, ctx: ExtensionContext, typed: QuestionParams, open: OpenQuestionnaire) {
339
+ const itemsByTab: WrappingSelectItem[][] = typed.questions.map((q) => buildItemsForQuestion(q));
340
+ let presentation: Presentation | undefined;
341
+
342
+ // Bracketed from before the load: every prompt event is followed by exactly one
343
+ // `{ active: false }` for its tool call, however the call ends — a remote mirror
344
+ // dismisses on it.
345
+ emitAskUserBlockedEvent(pi, true, open.toolCallId);
346
+ try {
347
+ // Lazy — QuestionnaireSession pulls the ~560ms view/TUI render graph;
348
+ // load it only when the tool runs, not at extension registration.
349
+ const sessionLoad = await loadQuestionnaireSession();
350
+ // Answered during the load: the answer needs no dialog.
351
+ if (open.settled) return buildQuestionnaireResponse(open.settled, typed);
352
+ if (!sessionLoad.ok) {
353
+ return buildToolResult(sessionLoad.message, { answers: [], cancelled: true, error: sessionLoad.error });
354
+ }
355
+ const { QuestionnaireSession } = sessionLoad.module;
356
+ // Resolve the collapse/expand key spec from config. Default is `ctrl+]`; users
357
+ // with non-US layouts (e.g. Latin American, where `]` is shifted) can override
358
+ // via the `collapseKey` config field. `resolveCollapseKey` also accepts the
359
+ // sentinel value `"off"` to disable the shortcut entirely.
360
+ const collapseKey = resolveCollapseKey(loadConfig());
361
+ const mount = (p: Presentation) =>
362
+ Promise.race([
363
+ mountQuestionnaire({
364
+ ctx,
365
+ typed,
366
+ itemsByTab,
367
+ collapseKey,
368
+ presentation: p,
369
+ open,
370
+ Session: QuestionnaireSession,
371
+ }),
372
+ open.answeredEarly,
373
+ ]);
374
+
375
+ // Pi's editor slot (#253); the overlay only while another questionnaire holds the slot,
376
+ // or stacked when another overlay is already on screen (see below).
377
+ presentation = resolvePresentation();
378
+ emitTerminalAttention();
379
+ let result = await mount(presentation);
380
+ if (result === YIELD_TO_OVERLAY) {
381
+ // Another overlay was on screen: stack on top of it instead (see mustYieldInlineSlot).
382
+ presentation.release?.();
383
+ presentation = STACKED_OVERLAY_PRESENTATION;
384
+ result = await mount(presentation);
385
+ }
386
+
387
+ if (result === undefined) {
388
+ // The RPC walker takes over; its prompts cannot be answered from outside.
389
+ open.host = "rpc";
390
+ return await resolveUndefinedResult(ctx, typed);
391
+ }
392
+
393
+ return buildQuestionnaireResponse(result, typed);
394
+ } finally {
395
+ presentation?.release?.();
396
+ emitAskUserBlockedEvent(pi, false, open.toolCallId);
397
+ }
398
+ }
399
+
320
400
  /**
321
401
  * Pre-warm the lazy session graph once startup settles (#107). A graph
322
402
  * evaluated while the paths Pi resolved at boot still exist stays in memory
@@ -374,6 +454,7 @@ Preview content is rendered as markdown in a monospace box. Multi-line text with
374
454
 
375
455
  export function registerAskUserQuestionTool(pi: ExtensionAPI): void {
376
456
  const guidance = validateGuidanceFields(loadConfig().guidance);
457
+ const answers = registerAnswerChannel(pi);
377
458
  pi.registerTool({
378
459
  name: ASK_USER_QUESTION_TOOL_NAME,
379
460
  label: "Ask User Question",
@@ -384,7 +465,7 @@ export function registerAskUserQuestionTool(pi: ExtensionAPI): void {
384
465
  // Undo double-encoded nested arguments before Pi validates them (#244).
385
466
  prepareArguments: prepareQuestionArguments,
386
467
 
387
- async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
468
+ async execute(toolCallId, params, _signal, _onUpdate, ctx) {
388
469
  // Line-terminator normalization runs once here, ahead of validation, so
389
470
  // every downstream consumer — validator, TUI, RPC walker, envelope, prompt
390
471
  // event — sees the same clean text (#192).
@@ -400,58 +481,23 @@ export function registerAskUserQuestionTool(pi: ExtensionAPI): void {
400
481
  });
401
482
  }
402
483
 
403
- // Emit event for external listeners (e.g., notification plugins)
404
- emitAskUserPromptEvent(pi, typed);
405
-
406
484
  // RPC hosts (VSCode pendant, ACP clients like Zed/Paseo — issue #78):
407
485
  // ui.custom() cannot render there, but the select/input dialog
408
486
  // sub-protocol works. Hosts that advertise ctx.mode (pi ≥0.79) route to
409
487
  // the sequential dialog walker up front, skipping the TUI render-graph
410
488
  // import entirely; RPC builds that predate ctx.mode are caught by the
411
489
  // custom()-resolved-undefined backstop below. See ./rpc-fallback.ts.
412
- if ((ctx as { mode?: string }).mode === "rpc" && hasDialogUI(ctx.ui)) {
413
- return runRpcPath(pi, ctx.ui, typed);
414
- }
415
-
416
- const itemsByTab: WrappingSelectItem[][] = typed.questions.map((q) => buildItemsForQuestion(q));
417
-
418
- // Lazy — QuestionnaireSession pulls the ~560ms view/TUI render graph;
419
- // load it only when the tool runs, not at extension registration.
420
- const sessionLoad = await loadQuestionnaireSession();
421
- if (!sessionLoad.ok) {
422
- return buildToolResult(sessionLoad.message, { answers: [], cancelled: true, error: sessionLoad.error });
423
- }
424
- const { QuestionnaireSession } = sessionLoad.module;
425
- // Resolve the collapse/expand key spec from config. Default is `ctrl+]`; users
426
- // with non-US layouts (e.g. Latin American, where `]` is shifted) can override
427
- // via the `collapseKey` config field. `resolveCollapseKey` also accepts the
428
- // sentinel value `"off"` to disable the shortcut entirely.
429
- const collapseKey = resolveCollapseKey(loadConfig());
430
- // Pi's editor slot (#253); the overlay only while another questionnaire holds the slot,
431
- // or stacked when another overlay is already on screen (see below).
432
- let presentation = resolvePresentation();
433
- const mount = (p: Presentation) =>
434
- mountQuestionnaire({ ctx, typed, itemsByTab, collapseKey, presentation: p, Session: QuestionnaireSession });
435
-
436
- emitAskUserBlockedEvent(pi, true);
490
+ const viaRpc = (ctx as { mode?: string }).mode === "rpc" && hasDialogUI(ctx.ui);
491
+ // Open for inbound answers before the prompt goes out: an emitter may answer
492
+ // straight from its prompt listener.
493
+ const open = answers.open(toolCallId, typed.questions, viaRpc ? "rpc" : "tui");
437
494
  try {
438
- emitTerminalAttention();
439
- let result = await mount(presentation);
440
- if (result === YIELD_TO_OVERLAY) {
441
- // Another overlay was on screen: stack on top of it instead (see mustYieldInlineSlot).
442
- presentation.release?.();
443
- presentation = STACKED_OVERLAY_PRESENTATION;
444
- result = await mount(presentation);
445
- }
446
-
447
- if (result === undefined) {
448
- return resolveUndefinedResult(ctx, typed);
449
- }
450
-
451
- return buildQuestionnaireResponse(result, typed);
495
+ // Emit event for external listeners (e.g., notification plugins)
496
+ emitAskUserPromptEvent(pi, typed, toolCallId);
497
+ if (viaRpc) return await runRpcPath(pi, ctx.ui, typed, toolCallId);
498
+ return await runTuiPath(pi, ctx, typed, open);
452
499
  } finally {
453
- presentation.release?.();
454
- emitAskUserBlockedEvent(pi, false);
500
+ answers.close(open);
455
501
  }
456
502
  },
457
503
  });
@@ -50,6 +50,8 @@ TUI produces. Trade-offs inherent to the native primitives:
50
50
  Add a semicolon and custom text to return both (`1,3; another color`). Plain text still
51
51
  returns a custom-only multi-select answer. An empty input commits an empty selection,
52
52
  matching `Next` with nothing selected.
53
+ - In a single-select question, picking `Type something.` opens a text input. Cancelling it
54
+ or leaving it blank returns to the options; it never records an empty answer.
53
55
  - Dismissing any dialog cancels the whole questionnaire, mirroring `Esc` in the TUI.
54
56
 
55
57
  If the host can render neither custom UI nor dialogs, the call returns
@@ -47,7 +47,9 @@ squeezed into the narrow options column. `Shift+Enter` inserts a line break. Ver
47
47
  arrows move between lines and return to row navigation at the draft's top and bottom.
48
48
  The draft replaces the static row label while you browse other options and is isolated
49
49
  per question. `Ctrl+G` sends it through Pi's configured external editor. `Ctrl+U` clears
50
- it, while `Esc` cancels the questionnaire.
50
+ it, while `Esc` cancels the questionnaire. In a single-select question, `Enter` on an empty
51
+ or blank draft does nothing: a blank custom answer is never recorded. To leave a question
52
+ unanswered, move on and submit; the model is told which questions were left blank.
51
53
 
52
54
  On a single-select question, confirming the input produces `kind: "custom"`. On a
53
55
  multi-select question, the result uses `kind: "multi"`: `selected` contains checked
@@ -0,0 +1,83 @@
1
+ # Startup import resolution
2
+
3
+ Pi loads this package's published TypeScript sources directly through Jiti. On the
4
+ entry point's eager import graph, relative specifiers should name the actual `.ts`
5
+ files. A `.js` specifier whose target exists only as `.ts` still works, but makes
6
+ Jiti perform fallback resolution even when its transform cache is warm.
7
+
8
+ This change only updates those static import/export specifiers and permits `.ts`
9
+ imports in the repository's existing no-emit TypeScript check. It does not change
10
+ registration order, the optional i18n contract, or the questionnaire UI's lazy
11
+ loading/prewarm behavior. The import-graph test guards the eager graph without
12
+ placing a machine-dependent timing threshold in CI.
13
+
14
+ The same rule now applies repo-wide: every package names the real `.ts` file in
15
+ relative imports, enforced by `scripts/check-ts-import-specifiers.mjs`
16
+ (`npm run check:ts-specifiers`).
17
+
18
+ ## Reproduce
19
+
20
+ From the repository root, with npm, Git, tar, and a Pi CLI supporting `PI_TIMING=1`:
21
+
22
+ ```sh
23
+ node scripts/benchmark-ask-user-question-startup.mjs --baseline 1ffa165c --runs 15 > before-after.json
24
+ node scripts/benchmark-ask-user-question-startup.mjs --baseline 1ffa165c --runs 15 --with-i18n > before-after-i18n.json
25
+ ```
26
+
27
+ Use `--pi /path/to/pi` to select a different Pi installation. The default baseline
28
+ is `HEAD`, useful when comparing uncommitted edits; after committing the fix,
29
+ explicitly select its parent or the original upstream commit instead.
30
+
31
+ The script:
32
+
33
+ - Packs the baseline Git revision and current working tree with `npm pack
34
+ --ignore-scripts`, then extracts their published files into equal-depth paths.
35
+ - Gives both packages identical packed `rpiv-config` sources from the current
36
+ checkout, and optionally identical `rpiv-i18n` sources. Host-provided libraries
37
+ remain supplied by Pi. It installs nothing and does not run package scripts.
38
+ - Uses an isolated home, agent directory, and working directory, with discovery
39
+ and startup network operations disabled. It does not read the user's Pi
40
+ settings or credentials and does not make model calls.
41
+ - Starts a fresh process per sample; discards two warm-ups per variant and then
42
+ alternates execution order. Run on an otherwise idle machine.
43
+ - Fails on load errors or missing module/factory timings, emits raw samples and
44
+ summary statistics as JSON, and removes its temporary package trees.
45
+
46
+ `importMs` is Pi's extension-import timing, including shared loader setup because
47
+ this extension loads first. `wallMs` measures the complete empty print-mode
48
+ process, **not** time until an interactive editor is ready. Neither measures
49
+ first-ever/cold-cache installation or first-question rendering.
50
+
51
+ ## Example measurements
52
+
53
+ Pi 1.2.0, Node v26.0.0, macOS arm64; baseline
54
+ `1ffa165c224b5489fb5774a6652ef2e1c3bc6b2a`; 15 measured fresh processes per variant,
55
+ following two warm-ups each:
56
+
57
+ | Optional i18n | Metric | Baseline median | Patched median |
58
+ | --- | --- | ---: | ---: |
59
+ | Absent | Extension import | 97 ms | 23 ms |
60
+ | Absent | Whole process | 327.74 ms | 252.84 ms |
61
+ | Present | Extension import | 99 ms | 25 ms |
62
+ | Present | Whole process | 330.06 ms | 254.88 ms |
63
+
64
+ The improvement is approximately **74 ms of import time** and **75 ms of
65
+ whole-process time** in both configurations. Factory time stayed at 0–1 ms.
66
+ Import ranges were 96–104 vs 22–24 ms without i18n, and 98–110 vs 24–27 ms with it.
67
+ The same 15-sample benchmark also improves startup on the two Node majors used
68
+ by CI (same Pi version and machine):
69
+
70
+ | Node | Optional i18n | Import median, before → after | Whole-process median, before → after |
71
+ | --- | --- | ---: | ---: |
72
+ | 22.23.3 | Absent | 82 → 22 ms | 250.94 → 189.46 ms |
73
+ | 22.23.3 | Present | 84 → 22 ms | 253.30 → 190.52 ms |
74
+ | 24.21.0 | Absent | 85 → 20 ms | 262.31 → 190.02 ms |
75
+ | 24.21.0 | Present | 85 → 22 ms | 252.85 → 190.17 ms |
76
+
77
+ The package suite passes all 787 tests on both Node 22 and 24, including the new
78
+ startup-import regression test and the existing real-TUI factory, RPC, locale,
79
+ and lazy-load tests. The full monorepo suite passes 6,906 tests on Node 26 and
80
+ on Node 24 with coverage enabled; all repository coverage thresholds pass.
81
+
82
+ Results depend on the host, loader version, filesystem, and caches; they are not a
83
+ universal latency guarantee.
@@ -109,21 +109,90 @@ in `details.globalNote`.
109
109
 
110
110
  ## Event contract
111
111
 
112
- The package publishes one event on Pi's event bus, emitted after validation passes and
113
- before the dialog is shown. Import it from the `/events` subpath:
112
+ Everything here imports from the `/events` subpath.
113
+
114
+ ### Outbound
115
+
116
+ `rpiv:ask-user:prompt` carries the questionnaire, emitted after validation passes and
117
+ before the dialog is shown:
114
118
 
115
119
  ```ts
116
120
  import { ASK_USER_PROMPT_EVENT, type AskUserPromptEventPayload } from "@juicesharp/rpiv-ask-user-question/events";
117
121
 
118
122
  pi.events.on(ASK_USER_PROMPT_EVENT, (payload: AskUserPromptEventPayload) => {
123
+ // payload.toolCallId — names this questionnaire on the events below
119
124
  // payload.questions[].{ question, header, multiSelect, options[] }
120
125
  // payload.questions[].options[].{ label, description, hasPreview }
121
126
  });
122
127
  ```
123
128
 
124
- The channel name is `rpiv:ask-user:prompt`. Preview *content* is deliberately not shipped
125
- in the payload — only `hasPreview: boolean` — so listeners forwarding the event across a
126
- process or network boundary stay cheap.
129
+ Preview *content* is deliberately not shipped in the payload — only `hasPreview: boolean` —
130
+ so listeners forwarding the event across a process or network boundary stay cheap.
131
+
132
+ `rpiv:ask-user:blocked` brackets the wait for input: `{ active: true, toolCallId }` before the
133
+ dialog opens, `{ active: false, toolCallId }` in a `finally` when it closes for any reason, so
134
+ a listener can tell blocked-on-human apart from working. Several questionnaires can be open
135
+ at once (Pi runs tool calls in parallel), so match `active: false` to its prompt by
136
+ `toolCallId` — that is also how a remote mirror learns a question was answered elsewhere.
137
+
138
+ ### Inbound
139
+
140
+ `rpiv:ask-user:answer` answers or cancels one open questionnaire without synthesizing
141
+ keystrokes — for programs driving Pi from outside: a pane supervisor, a phone or web
142
+ bridge, a test harness. Name the questionnaire by the `toolCallId` from its prompt event:
143
+
144
+ ```ts
145
+ import {
146
+ ASK_USER_ANSWER_EVENT,
147
+ ASK_USER_ANSWER_RESULT_EVENT,
148
+ ASK_USER_PROMPT_EVENT,
149
+ type AskUserAnswerResultEventPayload,
150
+ type AskUserPromptEventPayload,
151
+ } from "@juicesharp/rpiv-ask-user-question/events";
152
+
153
+ pi.events.on(ASK_USER_PROMPT_EVENT, ({ toolCallId }: AskUserPromptEventPayload) => {
154
+ pi.events.emit(ASK_USER_ANSWER_EVENT, {
155
+ toolCallId,
156
+ requestId: "r1", // optional, echoed on the verdict
157
+ answers: [
158
+ { questionIndex: 0, optionIndexes: [1] }, // single-select: one index…
159
+ { questionIndex: 1, text: "something else" }, // …or custom text
160
+ { questionIndex: 2, optionIndexes: [0, 2], text: "and" }, // multi-select: either or both
161
+ ],
162
+ globalNote: "optional, like the Submit tab's note",
163
+ });
164
+ // or decline, as Esc does: { toolCallId, cancel: true }
165
+ });
166
+
167
+ pi.events.on(ASK_USER_ANSWER_RESULT_EVENT, (v: AskUserAnswerResultEventPayload) => {
168
+ // { ok, code?, reason?, requestId?, toolCallId? }
169
+ });
170
+ ```
171
+
172
+ Indexes are 0-based into the prompt's `questions` and each question's `options`. Per-question
173
+ `notes` are accepted too; notes are trimmed and dropped when blank, as in the dialog.
174
+
175
+ - **When:** from the moment the prompt event is emitted — answering straight from the
176
+ prompt listener works, and no dialog is shown — until the questionnaire closes.
177
+ - **First answer wins**, typed in the terminal or sent here. A later one is refused.
178
+ - **All or nothing.** Every question must be answered once, indexes in range and distinct,
179
+ custom text not blank. Otherwise nothing is applied and the dialog stays open — a partly
180
+ applied answer would reach the model indistinguishable from one the user gave. Unknown
181
+ fields are ignored.
182
+ - **One verdict per attempt** on `rpiv:ask-user:answer-result`. Branch on `code`; `reason`
183
+ is for logs and its wording may change:
184
+
185
+ | `code` | Meaning |
186
+ |---|---|
187
+ | `not_found` | No open questionnaire has that `toolCallId` — never opened, or already answered or closed. |
188
+ | `invalid_payload` | A field is missing or has the wrong type. |
189
+ | `invalid_answer` | Well-formed, but does not fit the questions: a question unanswered or answered twice, an index out of range or repeated, blank text, two options or option plus text on single-select. |
190
+ | `unsupported_host` | An RPC/ACP host shows the questions in its own dialogs ([Hosts and runtime behavior](./hosts.md)); those cannot be answered from here. |
191
+
192
+ The bus is per session: questions asked inside a `/lanes` workflow child run on that child's
193
+ own bus, so an emitter on the parent session's bus cannot see or answer them.
194
+
195
+ ### Stability
127
196
 
128
197
  Stability policy for the `rpiv:*` namespace: channel names are immutable, payload changes
129
198
  are append-only and always optional, payloads stay JSON-safe, and any breaking change ships