@herbertgao/pi-extensions 2026.10.13 → 2026.10.15
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.
- package/README.md +16 -14
- package/THIRD_PARTY_NOTICES.md +3 -3
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +1 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +3 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +22 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +44 -14
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +1 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +20 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/markdown-enhance.ts +4 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +42 -18
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/layout.ts +12 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +131 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +217 -113
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/names.ts +12 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/subagent-notification.ts +556 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/ansi-text.ts +50 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/format.ts +11 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/patch-keys.ts +4 -0
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/README.md +1 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/ask-user-question.ts +27 -3
- package/node_modules/@juicesharp/rpiv-ask-user-question/config.ts +23 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/docs/configuration.md +15 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/docs/keyboard.md +9 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/de.json +7 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/en.json +8 -5
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/es.json +7 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/fr.json +7 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/pt-BR.json +7 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/pt.json +7 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/ru.json +7 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/uk.json +7 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/zh.json +7 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +4 -3
- package/node_modules/@juicesharp/rpiv-ask-user-question/presentation.ts +11 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/build-questionnaire.ts +6 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/key-router.ts +49 -8
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/questionnaire-session.ts +6 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/state-reducer.ts +13 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/state.ts +2 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/preview/preview-block-renderer.ts +19 -7
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/dialog-builder.ts +36 -7
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/dialog-copy.ts +13 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/tab-content-strategy.ts +24 -8
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/transcript.ts +144 -0
- package/node_modules/@narumitw/pi-btw/README.md +8 -3
- package/node_modules/@narumitw/pi-btw/dist/index.ts +448 -182
- package/node_modules/@narumitw/pi-btw/dist/index.ts.map +4 -4
- package/node_modules/@narumitw/pi-btw/docs/core-alignment.md +10 -2
- package/node_modules/@narumitw/pi-btw/docs/main-context-runtime.md +45 -0
- package/node_modules/@narumitw/pi-btw/docs/workflows.md +48 -5
- package/node_modules/@narumitw/pi-btw/package.json +5 -5
- package/node_modules/@narumitw/pi-btw/src/btw.ts +39 -14
- package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +83 -63
- package/node_modules/@narumitw/pi-btw/src/import-main-updates.ts +84 -0
- package/node_modules/@narumitw/pi-btw/src/keybindings.ts +29 -4
- package/node_modules/@narumitw/pi-btw/src/main-context-snapshot.ts +125 -0
- package/node_modules/@narumitw/pi-btw/src/menu.ts +1 -0
- package/node_modules/@narumitw/pi-btw/src/side-thread.ts +66 -17
- package/node_modules/@narumitw/pi-btw/src/transcript-markdown.ts +5 -5
- package/node_modules/@narumitw/pi-btw/src/transcript-pager.ts +47 -6
- package/node_modules/@narumitw/pi-caffeinate/package.json +3 -3
- package/node_modules/pi-lens/CHANGELOG.md +440 -0
- package/node_modules/pi-lens/README.md +13 -3
- package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +1 -0
- package/node_modules/pi-lens/dist/chunk-22Y2BM7H.js +23 -0
- package/node_modules/pi-lens/dist/{chunk-ATKJFDQN.js → chunk-27VWVB23.js} +12 -14
- package/node_modules/pi-lens/dist/{chunk-S2HEXIWI.js → chunk-2FYKETQJ.js} +10 -6
- package/node_modules/pi-lens/dist/{chunk-SRYEJNES.js → chunk-2LDMXL2M.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-ZHH37KZL.js → chunk-2SDHYHHO.js} +17 -17
- package/node_modules/pi-lens/dist/chunk-2Y6OJRSI.js +38 -0
- package/node_modules/pi-lens/dist/chunk-3SNDVPOR.js +507 -0
- package/node_modules/pi-lens/dist/{chunk-5OFV52AM.js → chunk-3WCEHYOI.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-44X7VIKR.js +73 -0
- package/node_modules/pi-lens/dist/{chunk-DEL2U6CM.js → chunk-4FHUGDKU.js} +16 -14
- package/node_modules/pi-lens/dist/{chunk-CT4MN5IU.js → chunk-4ODSZ35Z.js} +353 -359
- package/node_modules/pi-lens/dist/{chunk-ZIVJBOO3.js → chunk-4U7GDSZQ.js} +2 -2
- package/node_modules/pi-lens/dist/chunk-54NIOJJZ.js +25 -0
- package/node_modules/pi-lens/dist/{chunk-N5FLEO7W.js → chunk-5DKE4HGX.js} +37 -37
- package/node_modules/pi-lens/dist/{chunk-P63GXC37.js → chunk-5LRUKYFA.js} +31 -4
- package/node_modules/pi-lens/dist/{chunk-HRNHZA3N.js → chunk-63NMUNYP.js} +12 -16
- package/node_modules/pi-lens/dist/{chunk-HWCCCQNX.js → chunk-6XSESGWD.js} +13 -6
- package/node_modules/pi-lens/dist/{chunk-UMS2MFPZ.js → chunk-72J27ICO.js} +2 -3
- package/node_modules/pi-lens/dist/{chunk-ED36RF6Y.js → chunk-7FLRUH6B.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-7IYC4ENJ.js +297 -0
- package/node_modules/pi-lens/dist/chunk-7WWQAW5P.js +30 -0
- package/node_modules/pi-lens/dist/{chunk-3DA2JDOL.js → chunk-7ZS7MC24.js} +551 -203
- package/node_modules/pi-lens/dist/{chunk-WMYE35PX.js → chunk-AHWA4AKM.js} +7 -5
- package/node_modules/pi-lens/dist/{chunk-JW3YWBVB.js → chunk-AI3GP74G.js} +17 -19
- package/node_modules/pi-lens/dist/{chunk-AGSS7277.js → chunk-APFJKOP6.js} +6 -23
- package/node_modules/pi-lens/dist/{chunk-ZVUL7QYY.js → chunk-ASRAO7KG.js} +29 -32
- package/node_modules/pi-lens/dist/{chunk-BW5KFIQC.js → chunk-AWQWXSW4.js} +1 -0
- package/node_modules/pi-lens/dist/{chunk-TLX72JTG.js → chunk-CG5V25HX.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-CKEQFGLT.js +32 -0
- package/node_modules/pi-lens/dist/{chunk-Y6GZHWSJ.js → chunk-COOUUC5W.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-XTBDCR27.js → chunk-CPZ5JJW6.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-RKKOYPRA.js → chunk-DS2USX5G.js} +13 -15
- package/node_modules/pi-lens/dist/chunk-EA2ZRG44.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-GSLNCYGG.js → chunk-EDMLIW6W.js} +13 -14
- package/node_modules/pi-lens/dist/{chunk-2EECBNC5.js → chunk-EIKRZ32J.js} +75 -0
- package/node_modules/pi-lens/dist/chunk-EKNWOL2I.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-R3T7CLQ2.js → chunk-ELZRSR5N.js} +41 -41
- package/node_modules/pi-lens/dist/{chunk-GMX5OS7B.js → chunk-EN5AM7PX.js} +11 -12
- package/node_modules/pi-lens/dist/{chunk-3RKP3FMS.js → chunk-EWXXLS26.js} +226 -24
- package/node_modules/pi-lens/dist/chunk-EX4EXBW7.js +37 -0
- package/node_modules/pi-lens/dist/{chunk-XHJBS436.js → chunk-EXVXBSGN.js} +25 -25
- package/node_modules/pi-lens/dist/{chunk-MZGQNL3Y.js → chunk-F7BO6FWH.js} +12 -13
- package/node_modules/pi-lens/dist/{chunk-V35JG4JB.js → chunk-FEDWAYDS.js} +152 -334
- package/node_modules/pi-lens/dist/{chunk-J64T55EI.js → chunk-FWZRGGGY.js} +73 -9
- package/node_modules/pi-lens/dist/{chunk-T57LYLZT.js → chunk-G224FADB.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-G5UCJFT7.js +26 -0
- package/node_modules/pi-lens/dist/{chunk-LLJNQKQW.js → chunk-GLW3YDZZ.js} +20 -13
- package/node_modules/pi-lens/dist/{chunk-GXFV6MYU.js → chunk-GTDSYEA2.js} +72 -39
- package/node_modules/pi-lens/dist/{chunk-DUO2TU77.js → chunk-GYRZ72R4.js} +10 -4
- package/node_modules/pi-lens/dist/chunk-HYVXA3BB.js +49 -0
- package/node_modules/pi-lens/dist/{chunk-W66O5E25.js → chunk-IEBJF3PN.js} +13 -15
- package/node_modules/pi-lens/dist/{chunk-GAQ7OQG6.js → chunk-IL7K66ZQ.js} +83 -94
- package/node_modules/pi-lens/dist/{chunk-T7FEBKXN.js → chunk-JWOVP5BL.js} +7 -9
- package/node_modules/pi-lens/dist/{chunk-UBOQLVT2.js → chunk-K2GUZ4DN.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-5VSF4UUQ.js → chunk-K4SZB56V.js} +34 -39
- package/node_modules/pi-lens/dist/{chunk-7D6L4MTX.js → chunk-KCBRHV5E.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-GSM5UU7A.js → chunk-KFXCL4OV.js} +38 -28
- package/node_modules/pi-lens/dist/{chunk-J6MPGQTS.js → chunk-KJJAVH3X.js} +81 -15
- package/node_modules/pi-lens/dist/{chunk-BWD5EPKO.js → chunk-KPVLQHCZ.js} +4 -6
- package/node_modules/pi-lens/dist/{chunk-MPNJLASA.js → chunk-KX56K73G.js} +10 -13
- package/node_modules/pi-lens/dist/{chunk-AWSCPCN2.js → chunk-LMCTHJ2H.js} +19 -19
- package/node_modules/pi-lens/dist/{chunk-IWDLU6K3.js → chunk-MEFLGBCS.js} +4 -6
- package/node_modules/pi-lens/dist/{chunk-TOY6QKOH.js → chunk-MKPCELNI.js} +17 -17
- package/node_modules/pi-lens/dist/{chunk-POMLXPMY.js → chunk-N3PLNNCW.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-N5FBM25N.js +22 -0
- package/node_modules/pi-lens/dist/{chunk-CYRKQRPM.js → chunk-NFNVDDGB.js} +2 -4
- package/node_modules/pi-lens/dist/{chunk-RMLC67LF.js → chunk-NLIVE7L6.js} +2 -30
- package/node_modules/pi-lens/dist/{chunk-24AKHFGP.js → chunk-OMJ3OFBJ.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-IQWN5JCP.js → chunk-OZNCKLOX.js} +13 -14
- package/node_modules/pi-lens/dist/chunk-P5XUGPIX.js +31 -0
- package/node_modules/pi-lens/dist/{chunk-2KXTHF3M.js → chunk-PJXNTPB2.js} +253 -33
- package/node_modules/pi-lens/dist/chunk-PKOXJIVT.js +88 -0
- package/node_modules/pi-lens/dist/{chunk-DGUKIYSI.js → chunk-PP2A5V2T.js} +8 -10
- package/node_modules/pi-lens/dist/{chunk-KAPJINKN.js → chunk-Q42LJANT.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-UZ2XCLYS.js → chunk-Q4BKKOVC.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-TIQ2PKDW.js → chunk-QT66NEYN.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-U44DJXQP.js → chunk-RCHO5W7M.js} +15 -18
- package/node_modules/pi-lens/dist/{chunk-YH5MVY2U.js → chunk-RG3MXTRI.js} +7 -7
- package/node_modules/pi-lens/dist/chunk-RG7OODGM.js +57 -0
- package/node_modules/pi-lens/dist/{chunk-OHKJ7PQF.js → chunk-RU34BA4D.js} +43 -39
- package/node_modules/pi-lens/dist/{chunk-JMYYOTQG.js → chunk-S26LC76R.js} +13 -1
- package/node_modules/pi-lens/dist/{chunk-XBJVAEEO.js → chunk-S55TEC7I.js} +3 -2
- package/node_modules/pi-lens/dist/{chunk-RVK72CZX.js → chunk-SJHC3BCZ.js} +1397 -481
- package/node_modules/pi-lens/dist/{chunk-IYNJ6YPZ.js → chunk-SNEUMLM7.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-S67KYG37.js → chunk-T4NGVFYI.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-YCWYO6TQ.js → chunk-THEXI2QO.js} +48 -45
- package/node_modules/pi-lens/dist/{chunk-AMERCH6V.js → chunk-TL2TCJYL.js} +15 -16
- package/node_modules/pi-lens/dist/{chunk-KUA4OJ5Y.js → chunk-TPYYEDP5.js} +823 -350
- package/node_modules/pi-lens/dist/{chunk-YNE3RP52.js → chunk-TVZRLTG6.js} +8 -1
- package/node_modules/pi-lens/dist/{chunk-ROYSX2S5.js → chunk-UCVMSOXF.js} +2 -2
- package/node_modules/pi-lens/dist/chunk-UL5SXQVX.js +32 -0
- package/node_modules/pi-lens/dist/{chunk-7HXE67BN.js → chunk-UO66IMVP.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-VOOAPROD.js → chunk-UVY4TOJH.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-RKBXZN3A.js → chunk-VIDEKABZ.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-2FN63LPV.js → chunk-VITFDI3O.js} +13 -14
- package/node_modules/pi-lens/dist/{chunk-6DLWKFEX.js → chunk-VUAVE3QC.js} +41 -42
- package/node_modules/pi-lens/dist/{chunk-FM4RDMKT.js → chunk-WUY4BZEP.js} +10 -12
- package/node_modules/pi-lens/dist/{chunk-SD4I7ZO4.js → chunk-X3UTCXAA.js} +43 -53
- package/node_modules/pi-lens/dist/chunk-XHDBJODR.js +45 -0
- package/node_modules/pi-lens/dist/{chunk-5IUSNGOC.js → chunk-XHLK33VM.js} +28 -21
- package/node_modules/pi-lens/dist/{chunk-3KAZU3VR.js → chunk-XI34NWDI.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-QBFBRV2B.js → chunk-XWFIHYCH.js} +4 -2
- package/node_modules/pi-lens/dist/{chunk-JUKMK5Y4.js → chunk-Y2TPADJR.js} +10 -11
- package/node_modules/pi-lens/dist/{chunk-EBC36LNN.js → chunk-Y5KTA2OB.js} +17 -17
- package/node_modules/pi-lens/dist/{chunk-HYGZEMX6.js → chunk-YKVDBNPO.js} +11 -5
- package/node_modules/pi-lens/dist/{chunk-KN35K52N.js → chunk-YSDPVDFC.js} +3 -3
- package/node_modules/pi-lens/dist/chunk-YWNO5Q4R.js +44 -0
- package/node_modules/pi-lens/dist/{chunk-US7ECLD7.js → chunk-YWWG4AQA.js} +119 -28
- package/node_modules/pi-lens/dist/{chunk-O4NWQT6I.js → chunk-YXDCRUKQ.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-XYURS6EN.js → chunk-YXGRRORB.js} +15 -17
- package/node_modules/pi-lens/dist/{chunk-IUE7SSKV.js → chunk-ZAPSUBLU.js} +13 -7
- package/node_modules/pi-lens/dist/{chunk-EUXZEFTV.js → chunk-ZPJM7DID.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-5HSRT26B.js → chunk-ZSUX7KEM.js} +16 -15
- package/node_modules/pi-lens/dist/index.js +37155 -32210
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +11 -12
- package/node_modules/pi-lens/dist/mcp/cli.js +46 -45
- package/node_modules/pi-lens/dist/mcp/server.js +1210 -574
- package/node_modules/pi-lens/dist/mcp/worker.js +65 -65
- package/node_modules/pi-lens/dist/probes/installer.js +21 -23
- package/node_modules/pi-lens/docs/adr/0010-trace-validation-session-lifecycle.md +390 -0
- package/node_modules/pi-lens/docs/adr/README.md +1 -0
- package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +5 -3
- package/node_modules/pi-lens/docs/configuration.md +9 -0
- package/node_modules/pi-lens/docs/engineering-principles.md +12 -0
- package/node_modules/pi-lens/docs/environment-variables.md +20 -0
- package/node_modules/pi-lens/docs/features.md +16 -1
- package/node_modules/pi-lens/docs/globalconfig.md +37 -8
- package/node_modules/pi-lens/docs/lsp-capability-matrix.md +105 -12
- package/node_modules/pi-lens/docs/lsp-idle-eviction.md +37 -18
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +22 -1
- package/node_modules/pi-lens/docs/pi-lens-investigator.md +14 -0
- package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +23 -10
- package/node_modules/pi-lens/docs/pi-lens-monitor.md +64 -8
- package/node_modules/pi-lens/docs/pi-lens-retro.md +2 -2
- package/node_modules/pi-lens/docs/pi-lens-reviewer.md +48 -1
- package/node_modules/pi-lens/docs/pi-lens-subagent.md +8 -1
- package/node_modules/pi-lens/docs/release-qa-baseline.md +19 -7
- package/node_modules/pi-lens/docs/servercapabilities.md +47 -47
- package/node_modules/pi-lens/docs/settings.md +9 -5
- package/node_modules/pi-lens/docs/subagent-compat.md +1 -1
- package/node_modules/pi-lens/docs/usage.md +1 -0
- package/node_modules/pi-lens/package.json +6 -4
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-return-value-in-generator-test.yml +17 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-js-test.yml +86 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-test.yml +86 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-numeric-parse-python-test.yml +15 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-return-value-in-generator.yml +9 -4
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +119 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +119 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-numeric-parse-python.yml +13 -2
- package/node_modules/pi-lens/rules/rule-catalog.json +25 -1
- package/node_modules/pi-lens/scripts/analyze-pi-lens-logs.mjs +15 -5
- package/node_modules/pi-lens/scripts/lib/is-main-module.mjs +27 -0
- package/node_modules/pi-lens/scripts/lib/scratch-home-env.mjs +21 -0
- package/node_modules/pi-lens/scripts/rpc-load-check.mjs +4 -6
- package/node_modules/pi-lens/scripts/warm-loader-cache.mjs +2 -5
- package/node_modules/pi-next-cue/package.json +4 -1
- package/node_modules/pi-typesafe/README.md +6 -6
- package/node_modules/pi-typesafe/dist/ask.js +9 -2
- package/node_modules/pi-typesafe/dist/auth.d.ts +3 -2
- package/node_modules/pi-typesafe/dist/auth.js +2 -2
- package/node_modules/pi-typesafe/dist/backends.d.ts +20 -5
- package/node_modules/pi-typesafe/dist/backends.js +32 -8
- package/node_modules/pi-typesafe/dist/batch.d.ts +1 -1
- package/node_modules/pi-typesafe/dist/batch.js +2 -2
- package/node_modules/pi-typesafe/dist/client.d.ts +1 -1
- package/node_modules/pi-typesafe/dist/client.js +24 -12
- package/node_modules/pi-typesafe/dist/credentials.d.ts +8 -6
- package/node_modules/pi-typesafe/dist/credentials.js +70 -16
- package/node_modules/pi-typesafe/dist/extension.js +118 -26
- package/node_modules/pi-typesafe/dist/index.d.ts +1 -1
- package/node_modules/pi-typesafe/dist/index.js +1 -1
- package/node_modules/pi-typesafe/dist/key-prompt.d.ts +1 -1
- package/node_modules/pi-typesafe/dist/key-prompt.js +6 -6
- package/node_modules/pi-typesafe/dist/login.d.ts +11 -10
- package/node_modules/pi-typesafe/dist/login.js +24 -21
- package/node_modules/pi-typesafe/dist/schema.d.ts +8 -8
- package/node_modules/pi-typesafe/dist/schema.js +29 -7
- package/node_modules/pi-typesafe/package.json +2 -2
- package/node_modules/pi-web-access/CHANGELOG.md +40 -0
- package/node_modules/pi-web-access/README.md +96 -22
- package/node_modules/pi-web-access/brave-rate-limit.ts +2 -2
- package/node_modules/pi-web-access/curator-page.ts +3 -1
- package/node_modules/pi-web-access/curator-server.ts +1 -0
- package/node_modules/pi-web-access/dist/index.js +2607 -1674
- package/node_modules/pi-web-access/dist/mcp-cli.js +1119 -327
- package/node_modules/pi-web-access/duckduckgo-rate-limit.ts +95 -0
- package/node_modules/pi-web-access/duckduckgo.ts +51 -45
- package/node_modules/pi-web-access/exa.ts +48 -6
- package/node_modules/pi-web-access/extract.ts +2 -2
- package/node_modules/pi-web-access/fetch-params.ts +5 -4
- package/node_modules/pi-web-access/field-extract.ts +347 -0
- package/node_modules/pi-web-access/gemini-search.ts +151 -13
- package/node_modules/pi-web-access/index.ts +128 -125
- package/node_modules/pi-web-access/mistral-search.ts +1 -1
- package/node_modules/pi-web-access/ninerouter.ts +92 -0
- package/node_modules/pi-web-access/offtopic-judge.ts +72 -0
- package/node_modules/pi-web-access/openai-search.ts +36 -10
- package/node_modules/pi-web-access/package.json +1 -1
- package/node_modules/pi-web-access/perplexity.ts +1 -0
- package/node_modules/pi-web-access/query-rewrite.ts +39 -13
- package/node_modules/pi-web-access/source-check.ts +31 -15
- package/node_modules/pi-web-access/summary-model-scope.ts +19 -1
- package/node_modules/pi-web-access/summary-review.ts +13 -20
- package/node_modules/pi-web-access/tool-arguments.ts +1 -1
- package/node_modules/pi-web-access/upgrade-notice.ts +47 -0
- package/node_modules/pi-web-access/utils.ts +26 -1
- package/node_modules/pi-web-access/web-tool-contract.ts +4 -1
- package/node_modules/pi-web-access/web-tool-core.ts +99 -19
- package/node_modules/pi-web-access/xai-search.ts +3 -3
- package/package.json +15 -15
- package/node_modules/pi-lens/dist/chunk-3PTHXJXR.js +0 -28
- package/node_modules/pi-lens/dist/chunk-3QED2P4V.js +0 -31
- package/node_modules/pi-lens/dist/chunk-5WRPDP2A.js +0 -47
- package/node_modules/pi-lens/dist/chunk-ABBOA7UD.js +0 -157
- package/node_modules/pi-lens/dist/chunk-CUHSHSB6.js +0 -273
- package/node_modules/pi-lens/dist/chunk-GL5LUMZE.js +0 -51
- package/node_modules/pi-lens/dist/chunk-HAD7QRQI.js +0 -30
- package/node_modules/pi-lens/dist/chunk-JORED7EX.js +0 -44
- package/node_modules/pi-lens/dist/chunk-KYUB6QDC.js +0 -72
- package/node_modules/pi-lens/dist/chunk-LZSEQW6A.js +0 -57
- package/node_modules/pi-lens/dist/chunk-M2IFVFWU.js +0 -79
- package/node_modules/pi-lens/dist/chunk-M2UD3LPU.js +0 -88
- package/node_modules/pi-lens/dist/chunk-MBKQHGA7.js +0 -39
- package/node_modules/pi-lens/dist/chunk-R7YOCSNV.js +0 -23
- package/node_modules/pi-lens/dist/chunk-SKAMFC7A.js +0 -28
- package/node_modules/pi-lens/dist/chunk-SYE6T2EB.js +0 -28
- package/node_modules/pi-lens/dist/chunk-TRETHTQO.js +0 -26
- package/node_modules/pi-lens/dist/chunk-UA7ZXYDR.js +0 -184
- package/node_modules/pi-lens/dist/chunk-XTFDJI3T.js +0 -24
- package/node_modules/pi-lens/dist/chunk-Z3CCVDUB.js +0 -76
- 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
|
-
|
|
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):
|
|
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):
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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:
|
|
144
|
+
optionIndex: answeredRowIndex(state.answers.get(nextTab), ctx.itemsByTab[nextTab] ?? []),
|
|
133
145
|
inputMode: false,
|
|
134
146
|
notesVisible: false,
|
|
135
147
|
submitChoiceIndex: 0,
|
|
@@ -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
|
|
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
|
|
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"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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 =
|
|
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
|
-
|
|
199
|
-
|
|
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
|
|
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 {
|
|
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
|
-
|
|
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
|
|
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(
|
|
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(
|
|
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)
|
|
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(
|
|
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
|
+
}
|