@herbertgao/pi-extensions 2026.10.12 → 2026.10.14

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 (269) hide show
  1. package/README.md +11 -11
  2. package/THIRD_PARTY_NOTICES.md +3 -3
  3. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +7 -9
  4. package/node_modules/@herbertgao/pi-cc-extensions/README.md +7 -9
  5. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +1 -0
  6. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +14 -8
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +22 -5
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +28 -6
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/prompt-editor.ts +33 -12
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +60 -17
  11. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +1 -5
  12. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +20 -5
  13. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/markdown-enhance.ts +4 -1
  14. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +42 -18
  15. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/layout.ts +12 -3
  16. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +131 -0
  17. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +217 -113
  18. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/names.ts +12 -5
  19. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/subagent-notification.ts +556 -0
  20. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/ansi-text.ts +50 -0
  21. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/format.ts +11 -0
  22. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/patch-keys.ts +4 -0
  23. package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
  24. package/node_modules/@juicesharp/rpiv-ask-user-question/README.md +1 -0
  25. package/node_modules/@juicesharp/rpiv-ask-user-question/ask-user-question.ts +27 -3
  26. package/node_modules/@juicesharp/rpiv-ask-user-question/config.ts +23 -0
  27. package/node_modules/@juicesharp/rpiv-ask-user-question/docs/configuration.md +15 -0
  28. package/node_modules/@juicesharp/rpiv-ask-user-question/docs/keyboard.md +9 -2
  29. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/de.json +7 -4
  30. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/en.json +8 -5
  31. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/es.json +7 -4
  32. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/fr.json +7 -4
  33. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/pt-BR.json +7 -4
  34. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/pt.json +7 -4
  35. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/ru.json +7 -4
  36. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/uk.json +7 -4
  37. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/zh.json +7 -4
  38. package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +4 -3
  39. package/node_modules/@juicesharp/rpiv-ask-user-question/presentation.ts +11 -1
  40. package/node_modules/@juicesharp/rpiv-ask-user-question/state/build-questionnaire.ts +6 -0
  41. package/node_modules/@juicesharp/rpiv-ask-user-question/state/key-router.ts +49 -8
  42. package/node_modules/@juicesharp/rpiv-ask-user-question/state/questionnaire-session.ts +6 -0
  43. package/node_modules/@juicesharp/rpiv-ask-user-question/state/state-reducer.ts +13 -1
  44. package/node_modules/@juicesharp/rpiv-ask-user-question/state/state.ts +2 -0
  45. package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/preview/preview-block-renderer.ts +19 -7
  46. package/node_modules/@juicesharp/rpiv-ask-user-question/view/dialog-builder.ts +36 -7
  47. package/node_modules/@juicesharp/rpiv-ask-user-question/view/dialog-copy.ts +13 -2
  48. package/node_modules/@juicesharp/rpiv-ask-user-question/view/tab-content-strategy.ts +24 -8
  49. package/node_modules/@juicesharp/rpiv-ask-user-question/view/transcript.ts +144 -0
  50. package/node_modules/@narumitw/pi-btw/README.md +7 -2
  51. package/node_modules/@narumitw/pi-btw/dist/index.ts +371 -118
  52. package/node_modules/@narumitw/pi-btw/dist/index.ts.map +4 -4
  53. package/node_modules/@narumitw/pi-btw/docs/main-context-runtime.md +45 -0
  54. package/node_modules/@narumitw/pi-btw/docs/workflows.md +48 -5
  55. package/node_modules/@narumitw/pi-btw/package.json +1 -1
  56. package/node_modules/@narumitw/pi-btw/src/btw.ts +39 -14
  57. package/node_modules/@narumitw/pi-btw/src/import-main-updates.ts +84 -0
  58. package/node_modules/@narumitw/pi-btw/src/keybindings.ts +29 -4
  59. package/node_modules/@narumitw/pi-btw/src/main-context-snapshot.ts +125 -0
  60. package/node_modules/@narumitw/pi-btw/src/menu.ts +1 -0
  61. package/node_modules/@narumitw/pi-btw/src/side-thread.ts +66 -17
  62. package/node_modules/@narumitw/pi-btw/src/transcript-markdown.ts +5 -5
  63. package/node_modules/@narumitw/pi-btw/src/transcript-pager.ts +47 -6
  64. package/node_modules/pi-lens/CHANGELOG.md +440 -0
  65. package/node_modules/pi-lens/README.md +13 -3
  66. package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +1 -0
  67. package/node_modules/pi-lens/dist/chunk-22Y2BM7H.js +23 -0
  68. package/node_modules/pi-lens/dist/{chunk-ATKJFDQN.js → chunk-27VWVB23.js} +12 -14
  69. package/node_modules/pi-lens/dist/{chunk-S2HEXIWI.js → chunk-2FYKETQJ.js} +10 -6
  70. package/node_modules/pi-lens/dist/{chunk-SRYEJNES.js → chunk-2LDMXL2M.js} +2 -2
  71. package/node_modules/pi-lens/dist/{chunk-ZHH37KZL.js → chunk-2SDHYHHO.js} +17 -17
  72. package/node_modules/pi-lens/dist/chunk-2Y6OJRSI.js +38 -0
  73. package/node_modules/pi-lens/dist/chunk-3SNDVPOR.js +507 -0
  74. package/node_modules/pi-lens/dist/{chunk-5OFV52AM.js → chunk-3WCEHYOI.js} +1 -1
  75. package/node_modules/pi-lens/dist/chunk-44X7VIKR.js +73 -0
  76. package/node_modules/pi-lens/dist/{chunk-DEL2U6CM.js → chunk-4FHUGDKU.js} +16 -14
  77. package/node_modules/pi-lens/dist/{chunk-CT4MN5IU.js → chunk-4ODSZ35Z.js} +353 -359
  78. package/node_modules/pi-lens/dist/{chunk-ZIVJBOO3.js → chunk-4U7GDSZQ.js} +2 -2
  79. package/node_modules/pi-lens/dist/chunk-54NIOJJZ.js +25 -0
  80. package/node_modules/pi-lens/dist/{chunk-N5FLEO7W.js → chunk-5DKE4HGX.js} +37 -37
  81. package/node_modules/pi-lens/dist/{chunk-P63GXC37.js → chunk-5LRUKYFA.js} +31 -4
  82. package/node_modules/pi-lens/dist/{chunk-HRNHZA3N.js → chunk-63NMUNYP.js} +12 -16
  83. package/node_modules/pi-lens/dist/{chunk-HWCCCQNX.js → chunk-6XSESGWD.js} +13 -6
  84. package/node_modules/pi-lens/dist/{chunk-UMS2MFPZ.js → chunk-72J27ICO.js} +2 -3
  85. package/node_modules/pi-lens/dist/{chunk-ED36RF6Y.js → chunk-7FLRUH6B.js} +1 -1
  86. package/node_modules/pi-lens/dist/chunk-7IYC4ENJ.js +297 -0
  87. package/node_modules/pi-lens/dist/chunk-7WWQAW5P.js +30 -0
  88. package/node_modules/pi-lens/dist/{chunk-3DA2JDOL.js → chunk-7ZS7MC24.js} +551 -203
  89. package/node_modules/pi-lens/dist/{chunk-WMYE35PX.js → chunk-AHWA4AKM.js} +7 -5
  90. package/node_modules/pi-lens/dist/{chunk-JW3YWBVB.js → chunk-AI3GP74G.js} +17 -19
  91. package/node_modules/pi-lens/dist/{chunk-AGSS7277.js → chunk-APFJKOP6.js} +6 -23
  92. package/node_modules/pi-lens/dist/{chunk-ZVUL7QYY.js → chunk-ASRAO7KG.js} +29 -32
  93. package/node_modules/pi-lens/dist/{chunk-BW5KFIQC.js → chunk-AWQWXSW4.js} +1 -0
  94. package/node_modules/pi-lens/dist/{chunk-TLX72JTG.js → chunk-CG5V25HX.js} +1 -1
  95. package/node_modules/pi-lens/dist/chunk-CKEQFGLT.js +32 -0
  96. package/node_modules/pi-lens/dist/{chunk-Y6GZHWSJ.js → chunk-COOUUC5W.js} +6 -6
  97. package/node_modules/pi-lens/dist/{chunk-XTBDCR27.js → chunk-CPZ5JJW6.js} +4 -4
  98. package/node_modules/pi-lens/dist/{chunk-RKKOYPRA.js → chunk-DS2USX5G.js} +13 -15
  99. package/node_modules/pi-lens/dist/chunk-EA2ZRG44.js +27 -0
  100. package/node_modules/pi-lens/dist/{chunk-GSLNCYGG.js → chunk-EDMLIW6W.js} +13 -14
  101. package/node_modules/pi-lens/dist/{chunk-2EECBNC5.js → chunk-EIKRZ32J.js} +75 -0
  102. package/node_modules/pi-lens/dist/chunk-EKNWOL2I.js +27 -0
  103. package/node_modules/pi-lens/dist/{chunk-R3T7CLQ2.js → chunk-ELZRSR5N.js} +41 -41
  104. package/node_modules/pi-lens/dist/{chunk-GMX5OS7B.js → chunk-EN5AM7PX.js} +11 -12
  105. package/node_modules/pi-lens/dist/{chunk-3RKP3FMS.js → chunk-EWXXLS26.js} +226 -24
  106. package/node_modules/pi-lens/dist/chunk-EX4EXBW7.js +37 -0
  107. package/node_modules/pi-lens/dist/{chunk-XHJBS436.js → chunk-EXVXBSGN.js} +25 -25
  108. package/node_modules/pi-lens/dist/{chunk-MZGQNL3Y.js → chunk-F7BO6FWH.js} +12 -13
  109. package/node_modules/pi-lens/dist/{chunk-V35JG4JB.js → chunk-FEDWAYDS.js} +152 -334
  110. package/node_modules/pi-lens/dist/{chunk-J64T55EI.js → chunk-FWZRGGGY.js} +73 -9
  111. package/node_modules/pi-lens/dist/{chunk-T57LYLZT.js → chunk-G224FADB.js} +1 -1
  112. package/node_modules/pi-lens/dist/chunk-G5UCJFT7.js +26 -0
  113. package/node_modules/pi-lens/dist/{chunk-LLJNQKQW.js → chunk-GLW3YDZZ.js} +20 -13
  114. package/node_modules/pi-lens/dist/{chunk-GXFV6MYU.js → chunk-GTDSYEA2.js} +72 -39
  115. package/node_modules/pi-lens/dist/{chunk-DUO2TU77.js → chunk-GYRZ72R4.js} +10 -4
  116. package/node_modules/pi-lens/dist/chunk-HYVXA3BB.js +49 -0
  117. package/node_modules/pi-lens/dist/{chunk-W66O5E25.js → chunk-IEBJF3PN.js} +13 -15
  118. package/node_modules/pi-lens/dist/{chunk-GAQ7OQG6.js → chunk-IL7K66ZQ.js} +83 -94
  119. package/node_modules/pi-lens/dist/{chunk-T7FEBKXN.js → chunk-JWOVP5BL.js} +7 -9
  120. package/node_modules/pi-lens/dist/{chunk-UBOQLVT2.js → chunk-K2GUZ4DN.js} +4 -4
  121. package/node_modules/pi-lens/dist/{chunk-5VSF4UUQ.js → chunk-K4SZB56V.js} +34 -39
  122. package/node_modules/pi-lens/dist/{chunk-7D6L4MTX.js → chunk-KCBRHV5E.js} +3 -3
  123. package/node_modules/pi-lens/dist/{chunk-GSM5UU7A.js → chunk-KFXCL4OV.js} +38 -28
  124. package/node_modules/pi-lens/dist/{chunk-J6MPGQTS.js → chunk-KJJAVH3X.js} +81 -15
  125. package/node_modules/pi-lens/dist/{chunk-BWD5EPKO.js → chunk-KPVLQHCZ.js} +4 -6
  126. package/node_modules/pi-lens/dist/{chunk-MPNJLASA.js → chunk-KX56K73G.js} +10 -13
  127. package/node_modules/pi-lens/dist/{chunk-AWSCPCN2.js → chunk-LMCTHJ2H.js} +19 -19
  128. package/node_modules/pi-lens/dist/{chunk-IWDLU6K3.js → chunk-MEFLGBCS.js} +4 -6
  129. package/node_modules/pi-lens/dist/{chunk-TOY6QKOH.js → chunk-MKPCELNI.js} +17 -17
  130. package/node_modules/pi-lens/dist/{chunk-POMLXPMY.js → chunk-N3PLNNCW.js} +1 -1
  131. package/node_modules/pi-lens/dist/chunk-N5FBM25N.js +22 -0
  132. package/node_modules/pi-lens/dist/{chunk-CYRKQRPM.js → chunk-NFNVDDGB.js} +2 -4
  133. package/node_modules/pi-lens/dist/{chunk-RMLC67LF.js → chunk-NLIVE7L6.js} +2 -30
  134. package/node_modules/pi-lens/dist/{chunk-24AKHFGP.js → chunk-OMJ3OFBJ.js} +6 -6
  135. package/node_modules/pi-lens/dist/{chunk-IQWN5JCP.js → chunk-OZNCKLOX.js} +13 -14
  136. package/node_modules/pi-lens/dist/chunk-P5XUGPIX.js +31 -0
  137. package/node_modules/pi-lens/dist/{chunk-2KXTHF3M.js → chunk-PJXNTPB2.js} +253 -33
  138. package/node_modules/pi-lens/dist/chunk-PKOXJIVT.js +88 -0
  139. package/node_modules/pi-lens/dist/{chunk-DGUKIYSI.js → chunk-PP2A5V2T.js} +8 -10
  140. package/node_modules/pi-lens/dist/{chunk-KAPJINKN.js → chunk-Q42LJANT.js} +2 -2
  141. package/node_modules/pi-lens/dist/{chunk-UZ2XCLYS.js → chunk-Q4BKKOVC.js} +8 -8
  142. package/node_modules/pi-lens/dist/{chunk-TIQ2PKDW.js → chunk-QT66NEYN.js} +4 -4
  143. package/node_modules/pi-lens/dist/{chunk-U44DJXQP.js → chunk-RCHO5W7M.js} +15 -18
  144. package/node_modules/pi-lens/dist/{chunk-YH5MVY2U.js → chunk-RG3MXTRI.js} +7 -7
  145. package/node_modules/pi-lens/dist/chunk-RG7OODGM.js +57 -0
  146. package/node_modules/pi-lens/dist/{chunk-OHKJ7PQF.js → chunk-RU34BA4D.js} +43 -39
  147. package/node_modules/pi-lens/dist/{chunk-JMYYOTQG.js → chunk-S26LC76R.js} +13 -1
  148. package/node_modules/pi-lens/dist/{chunk-XBJVAEEO.js → chunk-S55TEC7I.js} +3 -2
  149. package/node_modules/pi-lens/dist/{chunk-RVK72CZX.js → chunk-SJHC3BCZ.js} +1397 -481
  150. package/node_modules/pi-lens/dist/{chunk-IYNJ6YPZ.js → chunk-SNEUMLM7.js} +4 -4
  151. package/node_modules/pi-lens/dist/{chunk-S67KYG37.js → chunk-T4NGVFYI.js} +2 -2
  152. package/node_modules/pi-lens/dist/{chunk-YCWYO6TQ.js → chunk-THEXI2QO.js} +48 -45
  153. package/node_modules/pi-lens/dist/{chunk-AMERCH6V.js → chunk-TL2TCJYL.js} +15 -16
  154. package/node_modules/pi-lens/dist/{chunk-KUA4OJ5Y.js → chunk-TPYYEDP5.js} +823 -350
  155. package/node_modules/pi-lens/dist/{chunk-YNE3RP52.js → chunk-TVZRLTG6.js} +8 -1
  156. package/node_modules/pi-lens/dist/{chunk-ROYSX2S5.js → chunk-UCVMSOXF.js} +2 -2
  157. package/node_modules/pi-lens/dist/chunk-UL5SXQVX.js +32 -0
  158. package/node_modules/pi-lens/dist/{chunk-7HXE67BN.js → chunk-UO66IMVP.js} +2 -2
  159. package/node_modules/pi-lens/dist/{chunk-VOOAPROD.js → chunk-UVY4TOJH.js} +3 -3
  160. package/node_modules/pi-lens/dist/{chunk-RKBXZN3A.js → chunk-VIDEKABZ.js} +2 -2
  161. package/node_modules/pi-lens/dist/{chunk-2FN63LPV.js → chunk-VITFDI3O.js} +13 -14
  162. package/node_modules/pi-lens/dist/{chunk-6DLWKFEX.js → chunk-VUAVE3QC.js} +41 -42
  163. package/node_modules/pi-lens/dist/{chunk-FM4RDMKT.js → chunk-WUY4BZEP.js} +10 -12
  164. package/node_modules/pi-lens/dist/{chunk-SD4I7ZO4.js → chunk-X3UTCXAA.js} +43 -53
  165. package/node_modules/pi-lens/dist/chunk-XHDBJODR.js +45 -0
  166. package/node_modules/pi-lens/dist/{chunk-5IUSNGOC.js → chunk-XHLK33VM.js} +28 -21
  167. package/node_modules/pi-lens/dist/{chunk-3KAZU3VR.js → chunk-XI34NWDI.js} +2 -2
  168. package/node_modules/pi-lens/dist/{chunk-QBFBRV2B.js → chunk-XWFIHYCH.js} +4 -2
  169. package/node_modules/pi-lens/dist/{chunk-JUKMK5Y4.js → chunk-Y2TPADJR.js} +10 -11
  170. package/node_modules/pi-lens/dist/{chunk-EBC36LNN.js → chunk-Y5KTA2OB.js} +17 -17
  171. package/node_modules/pi-lens/dist/{chunk-HYGZEMX6.js → chunk-YKVDBNPO.js} +11 -5
  172. package/node_modules/pi-lens/dist/{chunk-KN35K52N.js → chunk-YSDPVDFC.js} +3 -3
  173. package/node_modules/pi-lens/dist/chunk-YWNO5Q4R.js +44 -0
  174. package/node_modules/pi-lens/dist/{chunk-US7ECLD7.js → chunk-YWWG4AQA.js} +119 -28
  175. package/node_modules/pi-lens/dist/{chunk-O4NWQT6I.js → chunk-YXDCRUKQ.js} +4 -4
  176. package/node_modules/pi-lens/dist/{chunk-XYURS6EN.js → chunk-YXGRRORB.js} +15 -17
  177. package/node_modules/pi-lens/dist/{chunk-IUE7SSKV.js → chunk-ZAPSUBLU.js} +13 -7
  178. package/node_modules/pi-lens/dist/{chunk-EUXZEFTV.js → chunk-ZPJM7DID.js} +3 -3
  179. package/node_modules/pi-lens/dist/{chunk-5HSRT26B.js → chunk-ZSUX7KEM.js} +16 -15
  180. package/node_modules/pi-lens/dist/index.js +37155 -32210
  181. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +11 -12
  182. package/node_modules/pi-lens/dist/mcp/cli.js +46 -45
  183. package/node_modules/pi-lens/dist/mcp/server.js +1210 -574
  184. package/node_modules/pi-lens/dist/mcp/worker.js +65 -65
  185. package/node_modules/pi-lens/dist/probes/installer.js +21 -23
  186. package/node_modules/pi-lens/docs/adr/0010-trace-validation-session-lifecycle.md +390 -0
  187. package/node_modules/pi-lens/docs/adr/README.md +1 -0
  188. package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +5 -3
  189. package/node_modules/pi-lens/docs/configuration.md +9 -0
  190. package/node_modules/pi-lens/docs/engineering-principles.md +12 -0
  191. package/node_modules/pi-lens/docs/environment-variables.md +20 -0
  192. package/node_modules/pi-lens/docs/features.md +16 -1
  193. package/node_modules/pi-lens/docs/globalconfig.md +37 -8
  194. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +105 -12
  195. package/node_modules/pi-lens/docs/lsp-idle-eviction.md +37 -18
  196. package/node_modules/pi-lens/docs/pi-lens-fixer.md +22 -1
  197. package/node_modules/pi-lens/docs/pi-lens-investigator.md +14 -0
  198. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +23 -10
  199. package/node_modules/pi-lens/docs/pi-lens-monitor.md +64 -8
  200. package/node_modules/pi-lens/docs/pi-lens-retro.md +2 -2
  201. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +48 -1
  202. package/node_modules/pi-lens/docs/pi-lens-subagent.md +8 -1
  203. package/node_modules/pi-lens/docs/release-qa-baseline.md +19 -7
  204. package/node_modules/pi-lens/docs/servercapabilities.md +47 -47
  205. package/node_modules/pi-lens/docs/settings.md +9 -5
  206. package/node_modules/pi-lens/docs/subagent-compat.md +1 -1
  207. package/node_modules/pi-lens/docs/usage.md +1 -0
  208. package/node_modules/pi-lens/package.json +6 -4
  209. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-return-value-in-generator-test.yml +17 -0
  210. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-js-test.yml +86 -0
  211. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-test.yml +86 -0
  212. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-numeric-parse-python-test.yml +15 -0
  213. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-return-value-in-generator.yml +9 -4
  214. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +119 -0
  215. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +119 -0
  216. package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-numeric-parse-python.yml +13 -2
  217. package/node_modules/pi-lens/rules/rule-catalog.json +25 -1
  218. package/node_modules/pi-lens/scripts/analyze-pi-lens-logs.mjs +15 -5
  219. package/node_modules/pi-lens/scripts/lib/is-main-module.mjs +27 -0
  220. package/node_modules/pi-lens/scripts/lib/scratch-home-env.mjs +21 -0
  221. package/node_modules/pi-lens/scripts/rpc-load-check.mjs +4 -6
  222. package/node_modules/pi-lens/scripts/warm-loader-cache.mjs +2 -5
  223. package/node_modules/pi-next-cue/package.json +4 -1
  224. package/node_modules/pi-provider-qoder/dist/index.js +438 -283
  225. package/node_modules/pi-provider-qoder/package.json +1 -1
  226. package/node_modules/pi-typesafe/README.md +6 -6
  227. package/node_modules/pi-typesafe/dist/ask.js +9 -2
  228. package/node_modules/pi-typesafe/dist/auth.d.ts +3 -2
  229. package/node_modules/pi-typesafe/dist/auth.js +2 -2
  230. package/node_modules/pi-typesafe/dist/backends.d.ts +20 -5
  231. package/node_modules/pi-typesafe/dist/backends.js +32 -8
  232. package/node_modules/pi-typesafe/dist/batch.d.ts +1 -1
  233. package/node_modules/pi-typesafe/dist/batch.js +2 -2
  234. package/node_modules/pi-typesafe/dist/client.d.ts +1 -1
  235. package/node_modules/pi-typesafe/dist/client.js +24 -12
  236. package/node_modules/pi-typesafe/dist/credentials.d.ts +8 -6
  237. package/node_modules/pi-typesafe/dist/credentials.js +70 -16
  238. package/node_modules/pi-typesafe/dist/extension.js +118 -26
  239. package/node_modules/pi-typesafe/dist/index.d.ts +1 -1
  240. package/node_modules/pi-typesafe/dist/index.js +1 -1
  241. package/node_modules/pi-typesafe/dist/key-prompt.d.ts +1 -1
  242. package/node_modules/pi-typesafe/dist/key-prompt.js +6 -6
  243. package/node_modules/pi-typesafe/dist/login.d.ts +11 -10
  244. package/node_modules/pi-typesafe/dist/login.js +24 -21
  245. package/node_modules/pi-typesafe/dist/schema.d.ts +8 -8
  246. package/node_modules/pi-typesafe/dist/schema.js +29 -7
  247. package/node_modules/pi-typesafe/package.json +2 -2
  248. package/package.json +12 -12
  249. package/node_modules/pi-lens/dist/chunk-3PTHXJXR.js +0 -28
  250. package/node_modules/pi-lens/dist/chunk-3QED2P4V.js +0 -31
  251. package/node_modules/pi-lens/dist/chunk-5WRPDP2A.js +0 -47
  252. package/node_modules/pi-lens/dist/chunk-ABBOA7UD.js +0 -157
  253. package/node_modules/pi-lens/dist/chunk-CUHSHSB6.js +0 -273
  254. package/node_modules/pi-lens/dist/chunk-GL5LUMZE.js +0 -51
  255. package/node_modules/pi-lens/dist/chunk-HAD7QRQI.js +0 -30
  256. package/node_modules/pi-lens/dist/chunk-JORED7EX.js +0 -44
  257. package/node_modules/pi-lens/dist/chunk-KYUB6QDC.js +0 -72
  258. package/node_modules/pi-lens/dist/chunk-LZSEQW6A.js +0 -57
  259. package/node_modules/pi-lens/dist/chunk-M2IFVFWU.js +0 -79
  260. package/node_modules/pi-lens/dist/chunk-M2UD3LPU.js +0 -88
  261. package/node_modules/pi-lens/dist/chunk-MBKQHGA7.js +0 -39
  262. package/node_modules/pi-lens/dist/chunk-R7YOCSNV.js +0 -23
  263. package/node_modules/pi-lens/dist/chunk-SKAMFC7A.js +0 -28
  264. package/node_modules/pi-lens/dist/chunk-SYE6T2EB.js +0 -28
  265. package/node_modules/pi-lens/dist/chunk-TRETHTQO.js +0 -26
  266. package/node_modules/pi-lens/dist/chunk-UA7ZXYDR.js +0 -184
  267. package/node_modules/pi-lens/dist/chunk-XTFDJI3T.js +0 -24
  268. package/node_modules/pi-lens/dist/chunk-Z3CCVDUB.js +0 -76
  269. package/node_modules/pi-next-cue/.github/workflows/publish.yml +0 -20
@@ -15,7 +15,17 @@ const KEYBIND_CLEAR = "tui.editor.deleteToLineStart";
15
15
  const KEYBIND_EXTERNAL_EDITOR = "app.editor.external";
16
16
 
17
17
  const NOTES_ACTIVATE_KEY = "n";
18
- const SPACE_KEY = " ";
18
+
19
+ /**
20
+ * The notes shortcut. A single-character key matches the character as typed, so a
21
+ * non-Latin one works (pi-tui's key parser knows only ASCII); anything else matches as
22
+ * a pi-tui key spec. A non-string key — a stale outer module, as with `collapseKey`
23
+ * below — falls back to `n`.
24
+ */
25
+ function matchesNotesKey(data: string, notesKey: unknown): boolean {
26
+ const key = typeof notesKey === "string" ? notesKey : NOTES_ACTIVATE_KEY;
27
+ return data === key || matchesKey(data, key as Parameters<typeof matchesKey>[1]);
28
+ }
19
29
 
20
30
  export type QuestionnaireAction =
21
31
  | { kind: "nav"; nextIndex: number; inputValue: string }
@@ -225,19 +235,37 @@ function routeSubmitTab(
225
235
  // answers flow through `orderedAnswers()` in the host.
226
236
  return state.submitChoiceIndex === 1 ? { kind: "cancel" } : { kind: "submit" };
227
237
  }
228
- // Global note (#182): `n` on the Submit tab opens the notes editor scoped to the whole
238
+ // Global note (#182): the notes key on the Submit tab opens the notes editor scoped to the whole
229
239
  // questionnaire at the pseudo-index (`questions.length` in notesByTab). Reachable only
230
240
  // with the editor closed — `routeKey` dispatches notesVisible traffic to
231
241
  // `routeNotesMode` before the submit-tab block runs. The branch shadows nothing above
232
- // it (cancel, tab switch, submit-nav, confirm): a literal `n` byte matches none of them
242
+ // it (cancel, tab switch, submit-nav, confirm): the default `n` matches none of them
233
243
  // under default bindings, and a user who deliberately binds one of those actions to
234
244
  // `n` keeps that mapping because the earlier branch still wins (Enter still submits).
235
- if (data === NOTES_ACTIVATE_KEY) {
245
+ if (matchesNotesKey(data, runtime.notesKey)) {
236
246
  return { kind: "notes_enter" };
237
247
  }
238
248
  return { kind: "ignore" };
239
249
  }
240
250
 
251
+ const DIGIT_KEYS = ["1", "2", "3", "4", "5", "6", "7", "8", "9"] as const;
252
+
253
+ /**
254
+ * The row a digit hotkey names: `1`-`9` follow the list's numbering, so the
255
+ * unnumbered Next row has no digit. One key per keystroke — a pasted `"12"`
256
+ * matches none. Checked after every keybinding, so a digit bound to an action
257
+ * keeps that action.
258
+ */
259
+ function digitRow(
260
+ data: string,
261
+ runtime: QuestionnaireRuntime,
262
+ ): { index: number; activatesInputMode: boolean } | undefined {
263
+ const index = DIGIT_KEYS.findIndex((digit) => matchesKey(data, digit));
264
+ const item = runtime.items[index];
265
+ if (!item || !ROW_INTENT_META[item.kind].numbered) return undefined;
266
+ return { index, activatesInputMode: ROW_INTENT_META[item.kind].activatesInputMode };
267
+ }
268
+
241
269
  function routeMultiSelectTab(
242
270
  kb: QuestionnaireKeybindings,
243
271
  data: string,
@@ -249,7 +277,7 @@ function routeMultiSelectTab(
249
277
  // Space toggles the focused row's checkbox. Suppressed on rows whose META declares
250
278
  // `blocksMultiToggle` (the Next sentinel) or `activatesInputMode` (the "Type
251
279
  // something." row — it is an inline input, not a checkable option).
252
- if (data === SPACE_KEY) {
280
+ if (matchesKey(data, Key.space)) {
253
281
  if (focusedMeta?.blocksMultiToggle) return { kind: "ignore" };
254
282
  if (focusedMeta?.activatesInputMode) return { kind: "ignore" };
255
283
  return { kind: "toggle", index: state.optionIndex };
@@ -266,7 +294,11 @@ function routeMultiSelectTab(
266
294
  return buildMultiConfirmAction(state, runtime);
267
295
  }
268
296
  if (kb.matches(data, KEYBIND_CANCEL)) return { kind: "cancel" };
269
- return { kind: "ignore" };
297
+ // A digit toggles its row; the Type something. row's digit focuses it instead.
298
+ const row = digitRow(data, runtime);
299
+ if (!row) return { kind: "ignore" };
300
+ if (row.activatesInputMode) return { kind: "nav", nextIndex: row.index, inputValue: runtime.inputBuffer };
301
+ return { kind: "toggle", index: row.index };
270
302
  }
271
303
 
272
304
  function routeSingleSelectTab(
@@ -281,7 +313,16 @@ function routeSingleSelectTab(
281
313
  return { kind: "confirm", answer, autoAdvanceTab: computeAutoAdvanceTab(state, runtime) };
282
314
  }
283
315
  if (kb.matches(data, KEYBIND_CANCEL)) return { kind: "cancel" };
284
- return { kind: "ignore" };
316
+ // A digit answers with its row, as Enter on it would; the Type something. row's digit focuses it instead.
317
+ const row = digitRow(data, runtime);
318
+ if (!row) return { kind: "ignore" };
319
+ if (row.activatesInputMode) return { kind: "nav", nextIndex: row.index, inputValue: runtime.inputBuffer };
320
+ const answer = buildSingleSelectAnswer(
321
+ { ...state, optionIndex: row.index },
322
+ { ...runtime, currentItem: runtime.items[row.index] },
323
+ );
324
+ if (!answer) return { kind: "ignore" };
325
+ return { kind: "confirm", answer, autoAdvanceTab: computeAutoAdvanceTab(state, runtime) };
285
326
  }
286
327
 
287
328
  export function routeKey(data: string, state: QuestionnaireState, runtime: QuestionnaireRuntime): QuestionnaireAction {
@@ -342,7 +383,7 @@ export function routeKey(data: string, state: QuestionnaireState, runtime: Quest
342
383
  // "Type something.") is irrelevant: the gate sits ABOVE the multi-select
343
384
  // toggle block and the Next sentinel never activates inputMode, so `n` is
344
385
  // neither swallowed earlier nor blocked by `blocksMultiToggle`.
345
- if (data === NOTES_ACTIVATE_KEY) {
386
+ if (matchesNotesKey(data, runtime.notesKey)) {
346
387
  return { kind: "notes_enter" };
347
388
  }
348
389
 
@@ -22,6 +22,8 @@ export interface QuestionnaireSessionConfig {
22
22
  editInput: (value: string) => Promise<string | undefined>;
23
23
  /** Key spec for the collapse/expand shortcut, e.g. `"ctrl+]"` or `"alt+o"`. */
24
24
  collapseKey: string;
25
+ /** Key that opens the notes editor (`resolveNotesKey` output). */
26
+ notesKey: string;
25
27
  /**
26
28
  * True iff `execute()` registered the raw `ctx.ui.onTerminalInput` listener — the only
27
29
  * path that can reach a hidden overlay. Gates the `set_overlay_hidden` effect: a host
@@ -75,6 +77,7 @@ export class QuestionnaireSession {
75
77
  private readonly keybindings: QuestionnaireRuntime["keybindings"];
76
78
  private readonly editInput: QuestionnaireSessionConfig["editInput"];
77
79
  private readonly collapseKey: string;
80
+ private readonly notesKey: string;
78
81
  private readonly canReopenWhileHidden: boolean;
79
82
  private inputEditorOpen = false;
80
83
 
@@ -98,6 +101,7 @@ export class QuestionnaireSession {
98
101
  this.keybindings = config.keybindings;
99
102
  this.editInput = config.editInput;
100
103
  this.collapseKey = config.collapseKey;
104
+ this.notesKey = config.notesKey;
101
105
  this.canReopenWhileHidden = config.canReopenWhileHidden;
102
106
 
103
107
  const built = buildQuestionnaire({
@@ -109,6 +113,7 @@ export class QuestionnaireSession {
109
113
  initialState: this.state,
110
114
  getCurrentTab: () => this.state.currentTab,
111
115
  collapseKey: this.collapseKey,
116
+ notesKey: this.notesKey,
112
117
  rowBudget: config.rowBudget,
113
118
  });
114
119
 
@@ -251,6 +256,7 @@ export class QuestionnaireSession {
251
256
  currentItem: this.currentItem(),
252
257
  items: this.itemsByTab[this.state.currentTab] ?? [],
253
258
  collapseKey: this.collapseKey,
259
+ notesKey: this.notesKey,
254
260
  };
255
261
  }
256
262
 
@@ -124,12 +124,24 @@ function withoutCustomDraft(state: QuestionnaireState, tab: number): ReadonlyMap
124
124
  return drafts;
125
125
  }
126
126
 
127
+ /**
128
+ * Row focused on entering a tab: the chosen option, or Next for a multi-select answer, so a
129
+ * stray Enter re-confirms the answer instead of replacing it with row 0. A custom answer
130
+ * starts at row 0, since focusing its row would enter input mode.
131
+ */
132
+ function answeredRowIndex(answer: QuestionAnswer | undefined, items: readonly WrappingSelectItem[]): number {
133
+ let index = -1;
134
+ if (answer?.kind === "option") index = items.findIndex((i) => i.kind === "option" && i.label === answer.answer);
135
+ if (answer?.kind === "multi") index = items.findIndex((i) => i.kind === "next");
136
+ return Math.max(0, index);
137
+ }
138
+
127
139
  function switchTabResult(state: QuestionnaireState, nextTab: number, ctx: ApplyContext): ApplyResult {
128
140
  const notesValue = notesValueFor(state, nextTab);
129
141
  const transitioned: QuestionnaireState = {
130
142
  ...state,
131
143
  currentTab: nextTab,
132
- optionIndex: 0,
144
+ optionIndex: answeredRowIndex(state.answers.get(nextTab), ctx.itemsByTab[nextTab] ?? []),
133
145
  inputMode: false,
134
146
  notesVisible: false,
135
147
  submitChoiceIndex: 0,
@@ -62,4 +62,6 @@ export interface QuestionnaireRuntime {
62
62
  * the collapse shortcut is disabled.
63
63
  */
64
64
  collapseKey: string;
65
+ /** Key that opens the notes editor (`resolveNotesKey` output: `"n"` by default). */
66
+ notesKey: string;
65
67
  }
@@ -1,7 +1,9 @@
1
1
  import type { Theme } from "@earendil-works/pi-coding-agent";
2
2
  import type { MarkdownTheme } from "@earendil-works/pi-tui";
3
+ import { DEFAULT_NOTES_KEY, formatNotesKeyForDisplay } from "../../../config.ts";
3
4
  import { t } from "../../../state/i18n-bridge.ts";
4
5
  import type { QuestionData } from "../../../tool/types.ts";
6
+ import { KEY_PLACEHOLDER } from "../../dialog-copy.ts";
5
7
  import {
6
8
  MAX_PREVIEW_HEIGHT_SIDE_BY_SIDE,
7
9
  MAX_PREVIEW_HEIGHT_STACKED,
@@ -21,9 +23,12 @@ import type { PreviewLayoutMode } from "./preview-layout-decider.ts";
21
23
  * Affordance text shown below the bordered preview when focused on a preview-bearing option.
22
24
  * Re-exported by `preview-pane.ts` for the existing test surface.
23
25
  */
24
- export const NOTES_AFFORDANCE_TEXT = "Notes: press n to add notes";
26
+ export const NOTES_AFFORDANCE_TEMPLATE = `Notes: press ${KEY_PLACEHOLDER} to add notes`;
25
27
  /** Affordance text once the question carries a saved note (#197). */
26
- export const NOTES_EDIT_AFFORDANCE_TEXT = "Note saved: press n to edit";
28
+ export const NOTES_EDIT_AFFORDANCE_TEMPLATE = `Note saved: press ${KEY_PLACEHOLDER} to edit`;
29
+ /** Default-key (`n`) renderings of the two affordance templates. */
30
+ export const NOTES_AFFORDANCE_TEXT = NOTES_AFFORDANCE_TEMPLATE.replace(KEY_PLACEHOLDER, DEFAULT_NOTES_KEY);
31
+ export const NOTES_EDIT_AFFORDANCE_TEXT = NOTES_EDIT_AFFORDANCE_TEMPLATE.replace(KEY_PLACEHOLDER, DEFAULT_NOTES_KEY);
27
32
 
28
33
  /**
29
34
  * Which notes affordance the block shows under the preview: `add` / `edit` (no note yet /
@@ -32,10 +37,12 @@ export const NOTES_EDIT_AFFORDANCE_TEXT = "Note saved: press n to edit";
32
37
  */
33
38
  export type NotesAffordance = "add" | "edit" | "none";
34
39
 
35
- function affordanceText(affordance: Exclude<NotesAffordance, "none">): string {
36
- return affordance === "edit"
37
- ? t("preview.notes_edit_affordance", NOTES_EDIT_AFFORDANCE_TEXT)
38
- : t("preview.notes_affordance", NOTES_AFFORDANCE_TEXT);
40
+ function affordanceText(affordance: Exclude<NotesAffordance, "none">, notesKey: string): string {
41
+ const text =
42
+ affordance === "edit"
43
+ ? t("preview.notes_edit_affordance", NOTES_EDIT_AFFORDANCE_TEMPLATE)
44
+ : t("preview.notes_affordance", NOTES_AFFORDANCE_TEMPLATE);
45
+ return text.replace(KEY_PLACEHOLDER, formatNotesKeyForDisplay(notesKey));
39
46
  }
40
47
 
41
48
  /** Content row budget for a layout mode: preview cap minus border + affordance overhead. */
@@ -73,6 +80,8 @@ export interface PreviewBlockRendererConfig {
73
80
  question: QuestionData;
74
81
  theme: Theme;
75
82
  markdownTheme: MarkdownTheme;
83
+ /** Resolved notes key (`resolveNotesKey` output), named by the affordance. */
84
+ notesKey: string;
76
85
  }
77
86
 
78
87
  /**
@@ -88,9 +97,11 @@ export interface PreviewBlockRendererConfig {
88
97
  export class PreviewBlockRenderer {
89
98
  private readonly theme: Theme;
90
99
  private readonly cache: MarkdownContentCache;
100
+ private readonly notesKey: string;
91
101
 
92
102
  constructor(config: PreviewBlockRendererConfig) {
93
103
  this.theme = config.theme;
104
+ this.notesKey = config.notesKey;
94
105
  this.cache = new MarkdownContentCache(config.question, config.theme, config.markdownTheme);
95
106
  }
96
107
 
@@ -143,7 +154,8 @@ export class PreviewBlockRenderer {
143
154
  const boxedLines = renderBorderedBox(contentLines, boxWidth, colorFn, hidden);
144
155
  if (!fit.affordance) return boxedLines;
145
156
 
146
- const text = affordance !== "none" && this.cache.has(optionIndex) ? affordanceText(affordance) : "";
157
+ const text =
158
+ affordance !== "none" && this.cache.has(optionIndex) ? affordanceText(affordance, this.notesKey) : "";
147
159
  return [...boxedLines, "", text ? this.theme.fg("muted", text) : ""];
148
160
  }
149
161
  }
@@ -1,5 +1,5 @@
1
1
  import { DynamicBorder, type Theme } from "@earendil-works/pi-coding-agent";
2
- import { type Component, Container, type Editor, Spacer } from "@earendil-works/pi-tui";
2
+ import { type Component, Container, CURSOR_MARKER, type Editor, Spacer } from "@earendil-works/pi-tui";
3
3
  import type { QuestionnaireState } from "../state/state.ts";
4
4
  import type { QuestionData } from "../tool/types.ts";
5
5
  import type { PreviewPaneProps } from "./components/preview/preview-pane.ts";
@@ -48,6 +48,11 @@ function renderChromeOnly(natural: string[], topFixed: number, bottomFixed: numb
48
48
  return chromeOnly.length > termRows ? chromeOnly.slice(0, termRows) : chromeOnly;
49
49
  }
50
50
 
51
+ /** Shift an end-exclusive row range by `delta` rows; undefined (no focus) passes through. */
52
+ function offsetRange(range: [number, number] | undefined, delta: number): [number, number] | undefined {
53
+ return range && [range[0] + delta, range[1] + delta];
54
+ }
55
+
51
56
  export type DialogState = QuestionnaireState;
52
57
 
53
58
  /** Per-tick projection of dialog state. Written by the adapter; read by the strategy thunk. */
@@ -82,6 +87,8 @@ export interface DialogConfig {
82
87
  * The footer hint interpolates it, and drops the collapse part when `"off"`.
83
88
  */
84
89
  collapseKey: string;
90
+ /** Resolved notes key (`resolveNotesKey` output), named by both tabs' notes hints. */
91
+ notesKey: string;
85
92
  }
86
93
 
87
94
  /**
@@ -111,6 +118,7 @@ export class DialogView implements StatefulView<DialogProps> {
111
118
  isMulti: config.isMulti,
112
119
  getCurrentBodyHeight: config.getCurrentBodyHeight,
113
120
  collapseKey: config.collapseKey,
121
+ notesKey: config.notesKey,
114
122
  });
115
123
  this.submitStrategy = config.isMulti
116
124
  ? new SubmitTabStrategy({
@@ -118,6 +126,7 @@ export class DialogView implements StatefulView<DialogProps> {
118
126
  questions: config.questions,
119
127
  submitPicker: config.submitPicker,
120
128
  notesInput: config.notesInput,
129
+ notesKey: config.notesKey,
121
130
  })
122
131
  : undefined;
123
132
  this.maxFooterRowCount = Math.max(this.questionStrategy.footerRowCount, this.submitStrategy?.footerRowCount ?? 0);
@@ -195,13 +204,14 @@ export class DialogView implements StatefulView<DialogProps> {
195
204
  // below — that would draw the bottom border and hint twice (#260).
196
205
  const windowRows = Math.min(availableMiddle, middleRows);
197
206
  const rowsBeforeBody = pinHeading ? 0 : headingHeight;
198
- const focusedRange = strategy.focusedItemRowRange(width, state);
199
- const scrollStart = computeScrollStart(focusedRange, rowsBeforeBody, windowRows, middleRows);
207
+ // Scroll-to-focus target in middle-region rows. While the notes editor is open it is the
208
+ // keyboard's target, so the window follows it rather than the focused option (#317).
209
+ const focusedRange = state.notesVisible
210
+ ? this.notesFocusRange(natural.slice(top, top + middleRows), strategy, width, windowRows)
211
+ : offsetRange(strategy.focusedItemRowRange(width, state), rowsBeforeBody);
212
+ const scrollStart = computeScrollStart(focusedRange, 0, windowRows, middleRows);
200
213
  const scrollableMiddle = natural.slice(top + scrollStart, top + scrollStart + windowRows);
201
- const focusedInWindow: [number, number] | undefined = focusedRange && [
202
- rowsBeforeBody + focusedRange[0] - scrollStart,
203
- rowsBeforeBody + focusedRange[1] - scrollStart,
204
- ];
214
+ const focusedInWindow = offsetRange(focusedRange, -scrollStart);
205
215
  decorateOverflow(
206
216
  scrollableMiddle,
207
217
  scrollStart > 0,
@@ -221,6 +231,25 @@ export class DialogView implements StatefulView<DialogProps> {
221
231
  return 1 + strategy.midRows(this.liveProps.state).reduce((rows, c) => rows + c.render(width).length, 0);
222
232
  }
223
233
 
234
+ /**
235
+ * Focus range, in middle-region rows, for the open notes editor. Mid rows end the middle
236
+ * region, so the whole editor block (header included) is kept in view when it fits; a taller
237
+ * one is followed by the row carrying the editor's cursor marker, so typed text and an IME
238
+ * composition window stay on screen (#317).
239
+ */
240
+ private notesFocusRange(
241
+ middle: readonly string[],
242
+ strategy: TabContentStrategy,
243
+ width: number,
244
+ windowRows: number,
245
+ ): [number, number] {
246
+ const notesRows = this.rowsAroundBody(strategy, width) - 1;
247
+ const notesStart = middle.length - notesRows;
248
+ if (notesRows <= windowRows) return [notesStart, middle.length];
249
+ const cursorRow = middle.findIndex((line, i) => i >= notesStart && line.includes(CURSOR_MARKER));
250
+ return cursorRow === -1 ? [notesStart, middle.length] : [cursorRow, cursorRow + 1];
251
+ }
252
+
224
253
  /**
225
254
  * Hand the active question's preview pane the rows its body may use this frame, so a body
226
255
  * taller than the space fits itself — options scroll in their column, the preview box
@@ -1,4 +1,9 @@
1
- import { DEFAULT_COLLAPSE_KEY, formatKeySpecForDisplay } from "../config.ts";
1
+ import {
2
+ DEFAULT_COLLAPSE_KEY,
3
+ DEFAULT_NOTES_KEY,
4
+ formatKeySpecForDisplay,
5
+ formatNotesKeyForDisplay,
6
+ } from "../config.ts";
2
7
 
3
8
  /** Leaf: imports nothing from `view/`, so `dialog-builder` and `tab-content-strategy` never form a runtime cycle (#208). */
4
9
 
@@ -7,7 +12,6 @@ export const HINT_PART_NAV = "↑/↓ to navigate";
7
12
  export const HINT_PART_NEW_LINE = "Shift+Enter for newline";
8
13
  export const HINT_PART_CLEAR = "Ctrl+U to clear";
9
14
  export const HINT_PART_TOGGLE = "Space to toggle";
10
- export const HINT_PART_NOTES = "n to add notes";
11
15
  export const HINT_PART_TAB = "Tab to switch questions";
12
16
  export const HINT_PART_CANCEL = "Esc to cancel";
13
17
  /**
@@ -20,6 +24,13 @@ export const HINT_PART_CANCEL = "Esc to cancel";
20
24
  export const KEY_PLACEHOLDER = "{key}";
21
25
  export const HINT_PART_COLLAPSE_TEMPLATE = `${KEY_PLACEHOLDER} to collapse`;
22
26
  export const HINT_PART_EXPAND_TEMPLATE = `${KEY_PLACEHOLDER} to expand`;
27
+ /** Notes hint, templated the same way on the configurable `notesKey`. */
28
+ export const HINT_PART_NOTES_TEMPLATE = `${KEY_PLACEHOLDER} to add notes`;
29
+ /** Default-key (`n`) rendering of the notes template. */
30
+ export const HINT_PART_NOTES = HINT_PART_NOTES_TEMPLATE.replace(
31
+ KEY_PLACEHOLDER,
32
+ formatNotesKeyForDisplay(DEFAULT_NOTES_KEY),
33
+ );
23
34
  /** Default-key (`Ctrl+]`) rendering of the collapse template, for tests and default-config assertions. */
24
35
  export const HINT_PART_COLLAPSE = HINT_PART_COLLAPSE_TEMPLATE.replace(
25
36
  KEY_PLACEHOLDER,
@@ -1,6 +1,6 @@
1
1
  import type { Theme } from "@earendil-works/pi-coding-agent";
2
2
  import { type Component, Container, type Editor, Spacer, Text, truncateToWidth } from "@earendil-works/pi-tui";
3
- import { COLLAPSE_KEY_OFF, formatKeySpecForDisplay } from "../config.ts";
3
+ import { COLLAPSE_KEY_OFF, formatKeySpecForDisplay, formatNotesKeyForDisplay } from "../config.ts";
4
4
  import { t } from "../state/i18n-bridge.ts";
5
5
  import { selectSavedNote } from "../state/selectors/derivations.ts";
6
6
  import { formatAnswerScalar } from "../tool/format-answer.ts";
@@ -14,7 +14,7 @@ import {
14
14
  HINT_PART_ENTER,
15
15
  HINT_PART_NAV,
16
16
  HINT_PART_NEW_LINE,
17
- HINT_PART_NOTES,
17
+ HINT_PART_NOTES_TEMPLATE,
18
18
  HINT_PART_TAB,
19
19
  HINT_PART_TOGGLE,
20
20
  INCOMPLETE_WARNING_PREFIX,
@@ -27,7 +27,7 @@ import type { TabComponents } from "./tab-components.ts";
27
27
 
28
28
  const NOTES_HEADER = "Notes:";
29
29
  const GLOBAL_NOTES_HEADER = "Global note:";
30
- const REVIEW_GLOBAL_HINT = "n to add a note";
30
+ const REVIEW_GLOBAL_HINT_TEMPLATE = `${KEY_PLACEHOLDER} to add a note`;
31
31
  const REVIEW_NOTE_LABEL = "Note";
32
32
  /** Label for a question's saved note — the question tab's resting row and the review entry (#197). */
33
33
  const SAVED_NOTE_LABEL = "Note for this answer:";
@@ -96,6 +96,8 @@ export interface QuestionTabStrategyConfig {
96
96
  getCurrentBodyHeight: (width: number) => number;
97
97
  /** Resolved collapse key spec (`"ctrl+]"`, `"alt+o"`, or `"off"`). Drives the footer's collapse hint. */
98
98
  collapseKey: string;
99
+ /** Resolved notes key (`resolveNotesKey` output). Named by the footer's notes hint. */
100
+ notesKey: string;
99
101
  }
100
102
 
101
103
  export class QuestionTabStrategy implements TabContentStrategy {
@@ -158,7 +160,10 @@ export class QuestionTabStrategy implements TabContentStrategy {
158
160
  return [
159
161
  new Spacer(1),
160
162
  new OneLineClippedText(
161
- this.config.theme.fg("dim", buildHintText(question, this.config.isMulti, state, this.config.collapseKey)),
163
+ this.config.theme.fg(
164
+ "dim",
165
+ buildHintText(question, this.config.isMulti, state, this.config.collapseKey, this.config.notesKey),
166
+ ),
162
167
  1,
163
168
  ),
164
169
  ];
@@ -178,6 +183,8 @@ export interface SubmitTabStrategyConfig {
178
183
  submitPicker: Component | undefined;
179
184
  /** Shared notes Editor — mounted into midRows while the global-note editor is open on this tab. */
180
185
  notesInput: Editor;
186
+ /** Resolved notes key (`resolveNotesKey` output). Named by the global-note hint. */
187
+ notesKey: string;
181
188
  }
182
189
 
183
190
  export class SubmitTabStrategy implements TabContentStrategy {
@@ -277,7 +284,9 @@ export class SubmitTabStrategy implements TabContentStrategy {
277
284
  // with no hint wedged between them. Always present so footerRowCount stays
278
285
  // exactly 5. OneLineClippedText (not pi-tui Text) — a wrapped hint would inflate
279
286
  // the footer past footerRowCount and desync the chrome's cross-tab height math.
280
- out.push(new OneLineClippedText(this.config.theme.fg("dim", buildSubmitHintText(state)), 1));
287
+ out.push(
288
+ new OneLineClippedText(this.config.theme.fg("dim", buildSubmitHintText(state, this.config.notesKey)), 1),
289
+ );
281
290
  return out;
282
291
  }
283
292
 
@@ -306,10 +315,12 @@ export function buildHintText(
306
315
  isMulti: boolean,
307
316
  state: DialogState,
308
317
  collapseKey: string,
318
+ notesKey: string,
309
319
  ): string {
310
320
  const parts: string[] = [t("hint.enter", HINT_PART_ENTER), t("hint.navigate", HINT_PART_NAV)];
311
321
  if (question?.multiSelect === true) parts.push(t("hint.toggle", HINT_PART_TOGGLE));
312
- if (question && !state.notesVisible && !state.inputMode) parts.push(t("hint.notes", HINT_PART_NOTES));
322
+ if (question && !state.notesVisible && !state.inputMode)
323
+ parts.push(notesHint("hint.notes", HINT_PART_NOTES_TEMPLATE, notesKey));
313
324
  if (isMulti) parts.push(t("hint.tab", HINT_PART_TAB));
314
325
  parts.push(t("hint.cancel", HINT_PART_CANCEL));
315
326
  if (collapseKey !== COLLAPSE_KEY_OFF) {
@@ -328,10 +339,15 @@ export function buildHintText(
328
339
  * open the note part drops (the editor is the affordance then) and the Shift+Enter
329
340
  * newline hint is appended after cancel, mirroring the question tabs' notes-open shape.
330
341
  */
331
- export function buildSubmitHintText(state: DialogState): string {
342
+ export function buildSubmitHintText(state: DialogState, notesKey: string): string {
332
343
  const parts: string[] = [t("hint.enter", HINT_PART_ENTER), t("hint.navigate", HINT_PART_NAV)];
333
- if (!state.notesVisible) parts.push(t("review.global_hint", REVIEW_GLOBAL_HINT));
344
+ if (!state.notesVisible) parts.push(notesHint("review.global_hint", REVIEW_GLOBAL_HINT_TEMPLATE, notesKey));
334
345
  parts.push(t("hint.cancel", HINT_PART_CANCEL));
335
346
  if (state.notesVisible) parts.push(t("hint.newline", HINT_PART_NEW_LINE));
336
347
  return parts.join(" · ");
337
348
  }
349
+
350
+ /** A notes hint with the configured key in place of `{key}`. */
351
+ function notesHint(key: string, template: string, notesKey: string): string {
352
+ return t(key, template).replace(KEY_PLACEHOLDER, formatNotesKeyForDisplay(notesKey));
353
+ }
@@ -0,0 +1,144 @@
1
+ import type { Theme } from "@earendil-works/pi-coding-agent";
2
+ import { type Component, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
3
+ import { t } from "../state/i18n-bridge.ts";
4
+ import { NO_INPUT_PLACEHOLDER } from "../tool/format-answer.ts";
5
+ import {
6
+ isQuestionnaireResult,
7
+ type QuestionAnswer,
8
+ type QuestionnaireResult,
9
+ type QuestionParams,
10
+ } from "../tool/types.ts";
11
+ import { stripFenceMarkers } from "./components/preview/preview-box-renderer.ts";
12
+
13
+ const INDENT = " ";
14
+ const COLUMN_GAP = " ";
15
+ const RECOMMENDED_SUFFIX = /\s*\(Recommended\)$/;
16
+
17
+ type ToolResultView = { content: ReadonlyArray<{ type: string; text?: string }>; details?: unknown };
18
+
19
+ /** Lines laid out at render time, so wrapping and truncation follow the terminal width. */
20
+ class WidthLines implements Component {
21
+ constructor(private readonly layout: (width: number) => string[]) {}
22
+ render(width: number): string[] {
23
+ return this.layout(width);
24
+ }
25
+ invalidate(): void {}
26
+ }
27
+
28
+ /** `Ask Format · Migration`: the headers name the questions. */
29
+ export function renderAskCall(args: QuestionParams | undefined, theme: Theme): Component {
30
+ const headers = (args?.questions ?? []).map((q) => q?.header).filter(Boolean);
31
+ const title = theme.fg("toolTitle", theme.bold("Ask"));
32
+ const text = headers.length > 0 ? `${title} ${theme.fg("accent", headers.join(" · "))}` : title;
33
+ return new WidthLines((width) => [truncateToWidth(text, width, "…")]);
34
+ }
35
+
36
+ /**
37
+ * The transcript receipt: one `✓ answer` line for a single question, an aligned
38
+ * header/answer table for several. A failure shows `✗` with the first line of the
39
+ * model-facing message; a declined questionnaire shows a dimmed `✗ no answer`.
40
+ */
41
+ export function renderAskResult(
42
+ result: ToolResultView,
43
+ args: QuestionParams | undefined,
44
+ theme: Theme,
45
+ options: { expanded: boolean; isError: boolean },
46
+ ): Component {
47
+ const details = isQuestionnaireResult(result.details) ? result.details : undefined;
48
+ if (options.isError || details?.error) {
49
+ return new WidthLines(() => [theme.fg("error", `✗ ${firstTextLine(result)}`)]);
50
+ }
51
+ if (!details) return new WidthLines(() => [theme.fg("success", "✓")]);
52
+ if (details.cancelled) {
53
+ return new WidthLines(() => [theme.fg("dim", `✗ ${t("transcript.no_answer", "no answer")}`)]);
54
+ }
55
+ const questions = args?.questions ?? [];
56
+ return new WidthLines((width) =>
57
+ questions.length > 1
58
+ ? tableLines(details, args as QuestionParams, theme, options.expanded, width)
59
+ : singleLines(details, questions[0]?.question, theme, options.expanded, width),
60
+ );
61
+ }
62
+
63
+ function singleLines(
64
+ details: QuestionnaireResult,
65
+ questionText: string | undefined,
66
+ theme: Theme,
67
+ expanded: boolean,
68
+ width: number,
69
+ ): string[] {
70
+ const answer = details.answers[0];
71
+ const lines = hanging(`${theme.fg("success", "✓")} `, answerText(answer, theme), width);
72
+ lines.push(...detailLines(answer, expanded ? questionText : undefined, INDENT, theme, width));
73
+ return [...lines, ...globalNoteLines(details, theme, width)];
74
+ }
75
+
76
+ function tableLines(
77
+ details: QuestionnaireResult,
78
+ args: QuestionParams,
79
+ theme: Theme,
80
+ expanded: boolean,
81
+ width: number,
82
+ ): string[] {
83
+ const headerWidth = Math.max(...args.questions.map((q) => visibleWidth(q.header)));
84
+ const answerIndent = " ".repeat(INDENT.length + headerWidth + COLUMN_GAP.length);
85
+ const lines = args.questions.flatMap((q, i) => {
86
+ const answer = details.answers.find((a) => a.questionIndex === i);
87
+ const header = q.header + " ".repeat(headerWidth - visibleWidth(q.header));
88
+ const row = hanging(`${INDENT}${theme.fg("muted", header)}${COLUMN_GAP}`, answerText(answer, theme), width);
89
+ return [...row, ...detailLines(answer, expanded ? q.question : undefined, answerIndent, theme, width)];
90
+ });
91
+ return [...lines, ...globalNoteLines(details, theme, width)];
92
+ }
93
+
94
+ /** Under an answer: the question text and chosen preview when expanded, then the answer's note. */
95
+ function detailLines(
96
+ answer: QuestionAnswer | undefined,
97
+ questionText: string | undefined,
98
+ indent: string,
99
+ theme: Theme,
100
+ width: number,
101
+ ): string[] {
102
+ const lines: string[] = [];
103
+ if (questionText) lines.push(...hanging(indent, theme.fg("dim", questionText), width));
104
+ if (questionText && answer?.preview) {
105
+ for (const line of stripFenceMarkers(answer.preview.split("\n"))) {
106
+ lines.push(truncateToWidth(`${indent}${theme.fg("dim", `│ ${line}`)}`, width, "…"));
107
+ }
108
+ }
109
+ if (answer?.notes) lines.push(...hanging(indent, theme.fg("dim", `✎ ${answer.notes}`), width));
110
+ return lines;
111
+ }
112
+
113
+ function globalNoteLines(details: QuestionnaireResult, theme: Theme, width: number): string[] {
114
+ return details.globalNote ? hanging(INDENT, theme.fg("dim", `✎ ${details.globalNote}`), width) : [];
115
+ }
116
+
117
+ function answerText(answer: QuestionAnswer | undefined, theme: Theme): string {
118
+ if (!answer) return theme.fg("dim", t("transcript.not_answered", "not answered"));
119
+ const typed = answer.answer ? `"${answer.answer}"` : undefined;
120
+ const picks =
121
+ answer.kind === "option"
122
+ ? [label(answer.answer ?? "")]
123
+ : answer.kind === "custom"
124
+ ? [typed]
125
+ : [...(answer.selected ?? []).map(label), typed];
126
+ return theme.fg("toolOutput", picks.filter(Boolean).join(", ") || NO_INPUT_PLACEHOLDER);
127
+ }
128
+
129
+ function label(text: string): string {
130
+ return text.replace(RECOMMENDED_SUFFIX, "");
131
+ }
132
+
133
+ /** `prefix` then `text` wrapped to the width left after it; continuation lines align under the text. */
134
+ function hanging(prefix: string, text: string, width: number): string[] {
135
+ const indent = visibleWidth(prefix);
136
+ return wrapTextWithAnsi(text, Math.max(1, width - indent)).map(
137
+ (line, i) => (i === 0 ? prefix : " ".repeat(indent)) + line,
138
+ );
139
+ }
140
+
141
+ function firstTextLine(result: ToolResultView): string {
142
+ const text = result.content.find((c) => c.type === "text")?.text ?? "";
143
+ return text.split("\n")[0] ?? "";
144
+ }
@@ -13,6 +13,7 @@ Only context you explicitly bring back is loaded into the main editor.
13
13
  - Uses Pi's message components, a native-style working editor border, and a compact footer below the editor.
14
14
  - Offers fullscreen, side-thread-left, and side-thread-right workspaces with Pi's live main-thread view, mouse or keyboard pane focus, and a draggable remembered divider.
15
15
  - Renders supported Mermaid fences as width-safe, themed Unicode diagrams without a browser or network request.
16
+ - Manually previews and imports new main-thread context without stopping main work or rewriting earlier side exchanges.
16
17
  - Keeps side questions and answers out of the main conversation by default.
17
18
  - Brings back the latest answer, a question suffix, an exact range, or the complete thread only when requested.
18
19
  - Uses Pi's current model and thinking level or saved pi-btw choices.
@@ -56,7 +57,9 @@ Both routes require TUI mode and a model with usable credentials; see [Settings]
56
57
  Side questions and selected conversation context are sent to that model's provider.
57
58
  Bringing context back fills the main editor without submitting; replacing an existing draft requires confirmation.
58
59
  Ctrl+C cancels the response and discards the current draft and queued questions, but completed exchanges remain resumable in memory.
59
- Read the [workflow guide](./docs/workflows.md) for context selection, copying, search, steering, and draft recovery; `/new`, `/resume`, `/reload`, and restart discard retained threads.
60
+ While composing, use **Import main updates** (`F9` by default) to preview and confirm new main context; no content is imported automatically.
61
+ Imports can increase context size and provider cost; see [import scope and branch limits](./docs/workflows.md#import-main-updates).
62
+ Read the [workflow guide](./docs/workflows.md) for context selection, importing, copying, search, steering, and draft recovery; `/new`, `/resume`, `/fork`, `/reload`, and restart discard retained threads.
60
63
 
61
64
  ## ⚙️ Settings
62
65
 
@@ -142,6 +145,7 @@ The literal `/btw settings` remains a side question, not a settings subcommand.
142
145
  | `cycleThinkingLevel` | Inherit Pi's `app.thinking.cycle` | Cycle supported levels while composing or generating. |
143
146
  | `bringToMain` | `ctrl+r` | Open the bring-to-main chooser after a completed answer. |
144
147
  | `switchPane` | First available `f6`, `f7`, or `f8` | Switch keyboard focus between panes in a split workspace. |
148
+ | `importMainUpdates` | First available `f9`, `f10`, or `f11` | Preview and confirm main updates while the side composer is idle. |
145
149
 
146
150
  For example, merge these overrides into `pi-btw.json`:
147
151
 
@@ -182,9 +186,10 @@ The file is read for every `/btw` invocation, so edits apply without `/reload`.
182
186
  ## 🚧 Limitations
183
187
 
184
188
  - `/btw` supports TUI mode only.
189
+ - The side model does not execute tools. Answers appear only after the response completes, not token by token.
185
190
  - Only the active pane receives keyboard input; hovering or scrolling over the other pane does not move focus.
186
191
  - Resume state is memory-only and lasts only for the current extension instance.
187
- - A side thread retains the latest 40,000 characters of main-conversation context and adds a truncation notice when earlier content is omitted.
192
+ - Main-conversation context is a limited text snapshot, not the complete session; see [context scope](./docs/workflows.md#choose-context-and-resume-threads).
188
193
  - Clipboard access depends on Pi's host helper, the operating system, and the terminal.
189
194
  - The live workspace still uses a BTW-owned terminal handoff and private host-layout access because Pi has no public workspace-composition API; see the [core-alignment handoff](./docs/core-alignment.md) for tested safeguards, exact limits, and proposed APIs.
190
195
  - Pi does not expose all effective renderer options or a public clipboard-read callback. BTW uses native automatic wheel behavior but does not inherit private host wheel overrides or right-click clipboard paste.