@herbertgao/pi-extensions 2026.10.10 → 2026.10.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -11
- package/THIRD_PARTY_NOTICES.md +3 -3
- package/node_modules/@herbertgao/pi-agency/README.md +5 -3
- package/node_modules/@herbertgao/pi-agency/package.json +1 -1
- package/node_modules/@herbertgao/pi-agency/src/index.ts +51 -7
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +3 -0
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +3 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +3 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +126 -42
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +24 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/scroll.ts +69 -16
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/sticky-prompt.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-subagents/package.json +1 -1
- package/node_modules/@herbertgao/pi-subagents/src/agent-color.ts +11 -2
- package/node_modules/@herbertgao/pi-subagents/src/index.ts +10 -5
- package/node_modules/@herbertgao/pi-subagents/src/ui/agent-widget.ts +3 -2
- package/node_modules/@herbertgao/pi-subagents/src/ui/conversation-viewer.ts +1 -1
- package/node_modules/@herbertgao/pi-subagents/src/ui/fleet-list.ts +1 -0
- package/node_modules/@herbertgao/sol-pi/README.md +8 -2
- package/node_modules/@herbertgao/sol-pi/agents-install.md +2 -2
- package/node_modules/@herbertgao/sol-pi/docs/compatibility.md +28 -4
- package/node_modules/@herbertgao/sol-pi/docs/configuration.md +17 -4
- package/node_modules/@herbertgao/sol-pi/package.json +1 -1
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/index.ts +35 -25
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/then-run.ts +95 -26
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/evidence-preserving-reducer/candidate.ts +39 -2
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/evidence-preserving-reducer/index.ts +24 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/observation-pack/index.ts +12 -7
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/extension.ts +138 -130
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/projection.ts +88 -14
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/tools.ts +9 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/index.ts +14 -5
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/shell-options.ts +22 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/tui.ts +11 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/answer-channel.ts +109 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/ask-user-question.ts +117 -71
- package/node_modules/@juicesharp/rpiv-ask-user-question/docs/hosts.md +2 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/docs/keyboard.md +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/docs/startup-performance.md +83 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/docs/tool-schema.md +74 -5
- package/node_modules/@juicesharp/rpiv-ask-user-question/events.ts +84 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/index.ts +10 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +4 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/presentation.ts +1 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/reconcile.ts +1 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/rpc-fallback.ts +5 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/build-questionnaire.ts +19 -19
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/i18n-bridge.ts +1 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/key-router.ts +7 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/questionnaire-session.ts +10 -10
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/row-intent.ts +2 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/selectors/contract.ts +6 -6
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/selectors/derivations.ts +2 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/selectors/focus.ts +1 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/selectors/projections.ts +9 -9
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/state-reducer.ts +5 -5
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/state.ts +2 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/tool/external-answer.ts +125 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/tool/format-answer.ts +1 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/tool/normalize-params.ts +1 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/tool/response-envelope.ts +2 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/tool/types.ts +1 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/tool/validate-questionnaire.ts +1 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/component-binding.ts +4 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/multi-select-view.ts +4 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/option-list-view.ts +2 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/preview/markdown-content-cache.ts +3 -3
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/preview/preview-block-renderer.ts +5 -5
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/preview/preview-layout-decider.ts +3 -3
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/preview/preview-pane.ts +10 -10
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/submit-picker.ts +2 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/tab-bar.ts +1 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/wrapping-select.ts +1 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/dialog-builder.ts +9 -9
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/dialog-copy.ts +1 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/props-adapter.ts +8 -8
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/tab-components.ts +4 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/tab-content-strategy.ts +10 -10
- package/node_modules/@narumitw/pi-btw/README.md +14 -5
- package/node_modules/@narumitw/pi-btw/dist/index.ts +1067 -557
- package/node_modules/@narumitw/pi-btw/dist/index.ts.map +4 -4
- package/node_modules/@narumitw/pi-btw/docs/core-alignment.md +277 -0
- package/node_modules/@narumitw/pi-btw/docs/native-appearance.md +857 -0
- package/node_modules/@narumitw/pi-btw/docs/workflows.md +34 -13
- package/node_modules/@narumitw/pi-btw/package.json +4 -4
- package/node_modules/@narumitw/pi-btw/src/btw.ts +152 -108
- package/node_modules/@narumitw/pi-btw/src/conversation-chrome.ts +93 -0
- package/node_modules/@narumitw/pi-btw/src/fullscreen-renderer.ts +329 -0
- package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +109 -309
- package/node_modules/@narumitw/pi-btw/src/keybindings.ts +101 -23
- package/node_modules/@narumitw/pi-btw/src/menu.ts +42 -27
- package/node_modules/@narumitw/pi-btw/src/session-lifetime.ts +66 -0
- package/node_modules/@narumitw/pi-btw/src/transcript-pager.ts +366 -164
- package/node_modules/@narumitw/pi-btw/src/workspace-layout.ts +96 -36
- package/node_modules/@narumitw/pi-caffeinate/dist/index.ts +1 -0
- package/node_modules/@narumitw/pi-caffeinate/dist/index.ts.map +2 -2
- package/node_modules/@narumitw/pi-caffeinate/package.json +3 -3
- package/node_modules/@narumitw/pi-caffeinate/src/inhibitor-process.ts +1 -0
- package/node_modules/pi-antigravity/README.md +6 -2
- package/node_modules/pi-antigravity/package.json +2 -2
- package/node_modules/pi-antigravity/src/client/client.ts +44 -52
- package/node_modules/pi-antigravity/src/index.ts +13 -0
- package/node_modules/pi-antigravity/src/models/discovery.ts +25 -2
- package/node_modules/pi-antigravity/src/models/grouping.ts +107 -68
- package/node_modules/pi-antigravity/src/models/models.ts +10 -0
- package/node_modules/pi-antigravity/src/search/search.ts +581 -43
- package/node_modules/pi-antigravity/src/stream/stream.ts +53 -13
- package/node_modules/pi-antigravity/src/types/types.ts +13 -0
- package/node_modules/pi-antigravity/src/usage/usage.ts +11 -3
- package/node_modules/pi-lens/CHANGELOG.md +281 -0
- package/node_modules/pi-lens/README.md +13 -1
- package/node_modules/pi-lens/dist/{chunk-SS36ZX4J.js → chunk-24AKHFGP.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-JSQFTSC6.js → chunk-2FN63LPV.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-5UCAH366.js → chunk-2KXTHF3M.js} +20 -20
- package/node_modules/pi-lens/dist/{chunk-EU63SDCG.js → chunk-3DA2JDOL.js} +367 -281
- package/node_modules/pi-lens/dist/{chunk-RWWYJ623.js → chunk-3KAZU3VR.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-3PTHXJXR.js +28 -0
- package/node_modules/pi-lens/dist/chunk-3QED2P4V.js +31 -0
- package/node_modules/pi-lens/dist/{chunk-N2H3ZPZY.js → chunk-3RKP3FMS.js} +1 -0
- package/node_modules/pi-lens/dist/{chunk-XVF2VVXP.js → chunk-5HSRT26B.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-MXGY6KPT.js → chunk-5IUSNGOC.js} +15 -15
- package/node_modules/pi-lens/dist/{chunk-EJIUXPBX.js → chunk-5OFV52AM.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-AW7R2GWG.js → chunk-5VSF4UUQ.js} +12 -7
- package/node_modules/pi-lens/dist/{chunk-6STA6Z7I.js → chunk-5WRPDP2A.js} +18 -18
- package/node_modules/pi-lens/dist/{chunk-YIUAVF7E.js → chunk-6DLWKFEX.js} +35 -34
- package/node_modules/pi-lens/dist/{chunk-WOA4LN2R.js → chunk-7D6L4MTX.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-GAEGEPOC.js → chunk-7HXE67BN.js} +2 -2
- package/node_modules/pi-lens/dist/chunk-AGSS7277.js +84 -0
- package/node_modules/pi-lens/dist/{chunk-R3PCY3YS.js → chunk-AMERCH6V.js} +13 -13
- package/node_modules/pi-lens/dist/{chunk-WU567RSC.js → chunk-ATKJFDQN.js} +14 -10
- package/node_modules/pi-lens/dist/{chunk-VSSBEUFT.js → chunk-AWSCPCN2.js} +16 -16
- package/node_modules/pi-lens/dist/{chunk-VCHXCQFG.js → chunk-BWD5EPKO.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-H6MF6EVN.js → chunk-CT4MN5IU.js} +1200 -230
- package/node_modules/pi-lens/dist/{chunk-FCSOVF55.js → chunk-CUHSHSB6.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-CHOW74WE.js → chunk-CYRKQRPM.js} +7 -10
- package/node_modules/pi-lens/dist/{chunk-Q7DUK4LX.js → chunk-DEL2U6CM.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-6C7JWPCP.js → chunk-DGUKIYSI.js} +26 -23
- package/node_modules/pi-lens/dist/{chunk-PHDMFAKM.js → chunk-DUO2TU77.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-MRXKYPCS.js → chunk-EBC36LNN.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-CSHFH5IN.js → chunk-ED36RF6Y.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-76MWC2K6.js → chunk-EUXZEFTV.js} +90 -97
- package/node_modules/pi-lens/dist/{chunk-QOZXJ4NA.js → chunk-FM4RDMKT.js} +11 -8
- package/node_modules/pi-lens/dist/{chunk-ACXEQZOU.js → chunk-GAQ7OQG6.js} +31 -28
- package/node_modules/pi-lens/dist/{chunk-XAGLWMJ4.js → chunk-GL5LUMZE.js} +23 -23
- package/node_modules/pi-lens/dist/{chunk-BKE7E7TC.js → chunk-GMX5OS7B.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-ZHFZWTZV.js → chunk-GSLNCYGG.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-3W7IEVVL.js → chunk-GSM5UU7A.js} +26 -34
- package/node_modules/pi-lens/dist/{chunk-724UL2TJ.js → chunk-GXFV6MYU.js} +3 -3
- package/node_modules/pi-lens/dist/chunk-HAD7QRQI.js +30 -0
- package/node_modules/pi-lens/dist/{chunk-QOBUHWHX.js → chunk-HRNHZA3N.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-VWCXW2E7.js → chunk-HWCCCQNX.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-7DYBLXYA.js → chunk-HYGZEMX6.js} +3 -3
- package/node_modules/pi-lens/dist/chunk-IJYGIDF4.js +186 -0
- package/node_modules/pi-lens/dist/{chunk-4W4VLAPJ.js → chunk-IQWN5JCP.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-SQ4TVJBR.js → chunk-IUE7SSKV.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-IBGIOBEE.js → chunk-IWDLU6K3.js} +68 -5
- package/node_modules/pi-lens/dist/{chunk-XCJN5IJU.js → chunk-IYNJ6YPZ.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-JAU72XNY.js → chunk-J64T55EI.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-2BBLFX75.js → chunk-J6MPGQTS.js} +5 -5
- package/node_modules/pi-lens/dist/chunk-JORED7EX.js +44 -0
- package/node_modules/pi-lens/dist/{chunk-6SDEP3AJ.js → chunk-JUKMK5Y4.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-FMSO6RDZ.js → chunk-JW3YWBVB.js} +15 -15
- package/node_modules/pi-lens/dist/{chunk-L3BLXZG7.js → chunk-KAPJINKN.js} +30 -69
- package/node_modules/pi-lens/dist/{chunk-2B73ZPOK.js → chunk-KN35K52N.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-C34ZXZ7O.js → chunk-KUA4OJ5Y.js} +24 -11
- package/node_modules/pi-lens/dist/chunk-KYUB6QDC.js +72 -0
- package/node_modules/pi-lens/dist/{chunk-67WMNWEE.js → chunk-LLJNQKQW.js} +12 -10
- package/node_modules/pi-lens/dist/chunk-LZSEQW6A.js +57 -0
- package/node_modules/pi-lens/dist/{chunk-ZANLILYD.js → chunk-M2IFVFWU.js} +2 -2
- package/node_modules/pi-lens/dist/chunk-M2UD3LPU.js +88 -0
- package/node_modules/pi-lens/dist/{chunk-XIJZVPD5.js → chunk-MBKQHGA7.js} +15 -15
- package/node_modules/pi-lens/dist/{chunk-P7266HLM.js → chunk-MPNJLASA.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-6GFRNVYR.js → chunk-MZGQNL3Y.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-ZWFS3OEF.js → chunk-N5FLEO7W.js} +33 -32
- package/node_modules/pi-lens/dist/{chunk-3JNKMP3B.js → chunk-O4NWQT6I.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-T6CPIZNT.js → chunk-OHKJ7PQF.js} +33 -32
- package/node_modules/pi-lens/dist/{chunk-VRZP76YM.js → chunk-P63GXC37.js} +4 -1
- package/node_modules/pi-lens/dist/{chunk-XTMJ7XDT.js → chunk-POMLXPMY.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-QQNQ7SJW.js → chunk-QBFBRV2B.js} +10 -4
- package/node_modules/pi-lens/dist/{chunk-CMMHNUZ2.js → chunk-R3T7CLQ2.js} +60 -38
- package/node_modules/pi-lens/dist/{chunk-23WOO7TX.js → chunk-R7YOCSNV.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-2CD5RS6M.js → chunk-RKBXZN3A.js} +23 -2
- package/node_modules/pi-lens/dist/{chunk-OCAGUNBC.js → chunk-RKKOYPRA.js} +12 -12
- package/node_modules/pi-lens/dist/{chunk-52FUZI6K.js → chunk-RMLC67LF.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-XMSXXAHW.js → chunk-ROYSX2S5.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-M6HSLBWY.js → chunk-RVK72CZX.js} +6507 -7514
- package/node_modules/pi-lens/dist/{chunk-FLKWCIZH.js → chunk-S2HEXIWI.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-UZ3TUTRV.js → chunk-S67KYG37.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-VCO24T4L.js → chunk-SD4I7ZO4.js} +14 -14
- package/node_modules/pi-lens/dist/{chunk-Z527N6YQ.js → chunk-SKAMFC7A.js} +12 -12
- package/node_modules/pi-lens/dist/{chunk-MQLUAEOC.js → chunk-SRYEJNES.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-BRGDSBJE.js → chunk-SYE6T2EB.js} +12 -12
- package/node_modules/pi-lens/dist/{chunk-GXW6K4YJ.js → chunk-T57LYLZT.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-ZXYDQ3TZ.js → chunk-T7FEBKXN.js} +48 -15
- package/node_modules/pi-lens/dist/{chunk-3EFKIGZN.js → chunk-TIQ2PKDW.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-QILIYSJF.js → chunk-TLX72JTG.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-TYM6OUIT.js → chunk-TOY6QKOH.js} +12 -12
- package/node_modules/pi-lens/dist/{chunk-IZSHAIJ7.js → chunk-TRETHTQO.js} +12 -12
- package/node_modules/pi-lens/dist/{chunk-3VPVG5SU.js → chunk-U44DJXQP.js} +10 -6
- package/node_modules/pi-lens/dist/{chunk-PNQDPDRC.js → chunk-UA7ZXYDR.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-OXXKQCSV.js → chunk-UBOQLVT2.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-QGQ5CCCG.js → chunk-UMS2MFPZ.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-QHJ6DQ2R.js → chunk-US7ECLD7.js} +55 -13
- package/node_modules/pi-lens/dist/{chunk-AB3YYG6N.js → chunk-UZ2XCLYS.js} +8 -8
- package/node_modules/pi-lens/dist/chunk-V35JG4JB.js +2667 -0
- package/node_modules/pi-lens/dist/{chunk-N3X6Q4YT.js → chunk-VOOAPROD.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-SAEFPSB6.js → chunk-W66O5E25.js} +21 -11
- package/node_modules/pi-lens/dist/{chunk-KBG47GHP.js → chunk-WMYE35PX.js} +15 -11
- package/node_modules/pi-lens/dist/{chunk-5NGR67U5.js → chunk-XBJVAEEO.js} +32 -5
- package/node_modules/pi-lens/dist/{chunk-YYOIQFRS.js → chunk-XHJBS436.js} +122 -44
- package/node_modules/pi-lens/dist/{chunk-GBPP5P7X.js → chunk-XTBDCR27.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-4UNXBNE2.js → chunk-XTFDJI3T.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-UXGETRP4.js → chunk-XYURS6EN.js} +13 -12
- package/node_modules/pi-lens/dist/{chunk-RPLINGVB.js → chunk-Y6GZHWSJ.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-2VUQMUMT.js → chunk-YCWYO6TQ.js} +41 -38
- package/node_modules/pi-lens/dist/{chunk-77M37OKR.js → chunk-YH5MVY2U.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-AOHZU2BM.js → chunk-YNE3RP52.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-YSZNHOBY.js → chunk-ZHH37KZL.js} +12 -12
- package/node_modules/pi-lens/dist/{chunk-ZGDGW2V3.js → chunk-ZIVJBOO3.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-RXCOMYPY.js → chunk-ZVUL7QYY.js} +29 -28
- package/node_modules/pi-lens/dist/index.js +11052 -5852
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +10 -9
- package/node_modules/pi-lens/dist/mcp/cli.js +41 -38
- package/node_modules/pi-lens/dist/mcp/server.js +1120 -474
- package/node_modules/pi-lens/dist/mcp/worker.js +61 -58
- package/node_modules/pi-lens/dist/probes/installer.js +19 -19
- package/node_modules/pi-lens/dist/workers/project-snapshot-persist-worker.js +28 -9
- package/node_modules/pi-lens/dist/workers/review-graph-persist-worker.js +1 -1
- package/node_modules/pi-lens/docs/configuration.md +11 -0
- package/node_modules/pi-lens/docs/engineering-principles.md +32 -0
- package/node_modules/pi-lens/docs/lsp-capability-matrix.md +1 -1
- package/node_modules/pi-lens/docs/lsp-idle-eviction.md +15 -26
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +117 -13
- package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +97 -7
- package/node_modules/pi-lens/docs/pi-lens-monitor.md +8 -2
- package/node_modules/pi-lens/docs/pi-lens-retro.md +4 -1
- package/node_modules/pi-lens/docs/pi-lens-reviewer.md +112 -4
- package/node_modules/pi-lens/docs/pi-lens-subagent.md +22 -14
- package/node_modules/pi-lens/docs/release-qa-baseline.md +3 -1
- package/node_modules/pi-lens/docs/servercapabilities.md +9 -19
- package/node_modules/pi-lens/package.json +7 -5
- package/node_modules/pi-lens/scripts/download-grammars.js +40 -7
- package/node_modules/pi-lens/scripts/lib/latency-log-phases.mjs +95 -0
- package/node_modules/pi-lens/scripts/rpc-load-check.mjs +570 -81
- package/node_modules/pi-provider-qoder/dist/index.js +323 -154
- package/node_modules/pi-provider-qoder/package.json +1 -1
- package/node_modules/pi-web-access/CHANGELOG.md +60 -0
- package/node_modules/pi-web-access/README.md +96 -10
- package/node_modules/pi-web-access/anysearch.ts +4 -3
- package/node_modules/pi-web-access/bocha.ts +4 -3
- package/node_modules/pi-web-access/brightdata-unlocker.ts +3 -2
- package/node_modules/pi-web-access/brightdata.ts +4 -3
- package/node_modules/pi-web-access/ceramic.ts +3 -2
- package/node_modules/pi-web-access/credential-source.ts +54 -4
- package/node_modules/pi-web-access/curator-page.ts +5 -1
- package/node_modules/pi-web-access/curator-server.ts +2 -0
- package/node_modules/pi-web-access/deepseek.ts +377 -0
- package/node_modules/pi-web-access/dist/index.js +1463 -748
- package/node_modules/pi-web-access/dist/mcp-cli.js +1393 -717
- package/node_modules/pi-web-access/extract.ts +58 -6
- package/node_modules/pi-web-access/gemini-adc.ts +48 -1
- package/node_modules/pi-web-access/gemini-search.ts +33 -6
- package/node_modules/pi-web-access/index.ts +36 -4
- package/node_modules/pi-web-access/jina-search.ts +6 -4
- package/node_modules/pi-web-access/kagi.ts +5 -4
- package/node_modules/pi-web-access/keenable.ts +3 -2
- package/node_modules/pi-web-access/linkup.ts +170 -0
- package/node_modules/pi-web-access/mistral-search.ts +4 -3
- package/node_modules/pi-web-access/ollama.ts +5 -4
- package/node_modules/pi-web-access/package.json +1 -1
- package/node_modules/pi-web-access/page-query.ts +12 -6
- package/node_modules/pi-web-access/parallel.ts +7 -7
- package/node_modules/pi-web-access/perplexity.ts +5 -3
- package/node_modules/pi-web-access/querit.ts +4 -3
- package/node_modules/pi-web-access/query-rewrite.ts +16 -13
- package/node_modules/pi-web-access/search1api.ts +4 -3
- package/node_modules/pi-web-access/searchinfinity.ts +4 -3
- package/node_modules/pi-web-access/serpapi.ts +7 -5
- package/node_modules/pi-web-access/serpbase.ts +5 -4
- package/node_modules/pi-web-access/serpdive.ts +4 -3
- package/node_modules/pi-web-access/serper.ts +6 -4
- package/node_modules/pi-web-access/serply.ts +3 -2
- package/node_modules/pi-web-access/summary-review.ts +16 -6
- package/node_modules/pi-web-access/utils.ts +27 -1
- package/node_modules/pi-web-access/valyu.ts +4 -3
- package/node_modules/pi-web-access/web-tool-core.ts +7 -0
- package/node_modules/pi-web-access/xai-search.ts +49 -7
- package/node_modules/pi-web-access/xcrawl.ts +4 -3
- package/node_modules/pi-web-access/you.ts +3 -2
- package/package.json +15 -15
- package/node_modules/pi-lens/dist/chunk-3YN6V5TV.js +0 -85
- package/node_modules/pi-lens/dist/chunk-466Z26MG.js +0 -30
- package/node_modules/pi-lens/dist/chunk-EC47DWFA.js +0 -56
- package/node_modules/pi-lens/dist/chunk-KDERNTCQ.js +0 -28
- package/node_modules/pi-lens/dist/chunk-KSX3TXSZ.js +0 -69
- package/node_modules/pi-lens/dist/chunk-LOP6GRPH.js +0 -31
- package/node_modules/pi-lens/dist/chunk-UOPVJQ4N.js +0 -103
- /package/node_modules/pi-lens/dist/{chunk-FC4RP4I2.js → chunk-6HWVI6MI.js} +0 -0
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
> [!NOTE]
|
|
16
|
-
> This package republishes the MIT-licensed SoL-Pi source from [NVlabs/SoL-Pi](https://github.com/NVlabs/SoL-Pi)
|
|
16
|
+
> This package republishes the MIT-licensed SoL-Pi source from [NVlabs/SoL-Pi](https://github.com/NVlabs/SoL-Pi). The complete import baseline remains `e1a586af0ad8956f42ae5b26bba20e48fbf30e00`, recorded in `package.json`; Pi 1.x and codemode compatibility fixes from `41fa7e0e230bedc5e639aed2e7b9cc5698726db1..219568034fa54ed121ede80961655e33dfb9d0e3` are selectively ported on top. This is not a complete re-import or an npm `sol-pi@0.1.1` release. It is maintained here as `@herbertgao/sol-pi`, not an official distribution of Pi or NVIDIA.
|
|
17
17
|
>
|
|
18
18
|
> The package is independently loadable and is bundled by `@herbertgao/pi-extensions`; its aggregate entry is covered by the collection smoke test.
|
|
19
19
|
|
|
@@ -49,6 +49,12 @@ The mechanisms share four rules:
|
|
|
49
49
|
- **Preserve evidence.** Original observations remain available locally, and reducer failures leave the original result unchanged.
|
|
50
50
|
- **Use Pi's runtime choices.** Authentication, provider URLs, the main model, and shell behavior remain under Pi's control.
|
|
51
51
|
|
|
52
|
+
## Pi 1.x and codemode behavior
|
|
53
|
+
|
|
54
|
+
Action Fusion reports failed follow-up commands without losing the mutation's edit details, and inherits Pi's file-backed shell settings with project trust respected. Nested codemode calls do not count as independent model round-trips. Evidence-Preserving Reducer leaves nested tool results and their structured content unchanged. ObservationPack preserves message identity so Pi's mid-conversation system messages keep their positions and cached prefixes.
|
|
55
|
+
|
|
56
|
+
Online Context Compact declares `update_plan` to the model only, including in codemode-only mode. Codemode scripts cannot call it: plan boundaries must appear as direct tool results in the agent turn. Compaction uses Pi's effective token settings and context projection, does not count cache-warming replays as provider requests, and resumes a stopped task after a non-cancellation compaction failure before reporting that error. User cancellation does not schedule a continuation.
|
|
57
|
+
|
|
52
58
|
## Technical Details and Core Insights
|
|
53
59
|
|
|
54
60
|
Read the [SoL-Pi blog](https://nvlabs.github.io/SoL-Pi/) for a deeper look at the technical details, design rationale, and core insights behind SoL-Pi, including how auto-research led to the four efficiency mechanisms and how they work.
|
|
@@ -61,7 +67,7 @@ Read our paper: [SoL-Pi: Recursively Scaling Auto-Research Loops for Efficient A
|
|
|
61
67
|
|
|
62
68
|
### Requirements
|
|
63
69
|
|
|
64
|
-
- Node.js
|
|
70
|
+
- Node.js 22.19.0 or newer
|
|
65
71
|
- npm
|
|
66
72
|
- `@earendil-works/pi-coding-agent` 1.2.0 (the monorepo's tested host; runtime peers remain `*`)
|
|
67
73
|
|
|
@@ -7,7 +7,7 @@ Installation and configuration are complete only when Pi remains unmodified, the
|
|
|
7
7
|
## Rules
|
|
8
8
|
|
|
9
9
|
- Do not modify, patch, fork, or vendor upstream Pi. SoL-Pi must load as a standalone extension through Pi's public package interface.
|
|
10
|
-
- Use Node.js
|
|
10
|
+
- Use Node.js 22.19.0 or newer and the tested Pi release `@earendil-works/pi-coding-agent@1.2.0`. Treat a different Pi version as a compatibility change and rerun the full suite before using it.
|
|
11
11
|
- Do not clean, reset, switch, or overwrite unrelated repository changes.
|
|
12
12
|
- Do not print, log, commit, upload, or include any secret in a command line. Check only whether a credential is present.
|
|
13
13
|
- Keep SoL-Pi settings in `sol-pi.json`. The Evidence-Preserving Reducer provider/model route is a SoL-Pi setting; provider URLs, credentials, the main agent model, and shell behavior remain Pi settings.
|
|
@@ -35,7 +35,7 @@ node --version
|
|
|
35
35
|
npm --version
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
Require Node.js
|
|
38
|
+
Require Node.js 22.19.0 or newer. In this monorepo, run the dependency and full checks from the repository root, then return to `packages/sol-pi` for package validation:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
41
|
# Repository root
|
|
@@ -12,6 +12,9 @@ SoL-Pi imports only public package exports:
|
|
|
12
12
|
- native compaction events, `ExtensionContext.getContextUsage()`, and `ExtensionContext.compact()`
|
|
13
13
|
- `ExtensionContext.model` and `ExtensionContext.modelRegistry`
|
|
14
14
|
- the public session-manager methods exposed through `ExtensionContext`
|
|
15
|
+
- `SettingsManager` for trusted file-backed shell settings
|
|
16
|
+
- feature-detected `ExtensionAPI.getSettings()` and `buildSessionProjection()` on Pi 1.x
|
|
17
|
+
- tool `exposure` for model-only `update_plan` calls
|
|
15
18
|
|
|
16
19
|
## Action Fusion
|
|
17
20
|
|
|
@@ -31,7 +34,9 @@ Pi 1.x may return `Bash.isError` instead of throwing on a failed follow-up. Acti
|
|
|
31
34
|
|
|
32
35
|
## ObservationPack
|
|
33
36
|
|
|
34
|
-
ObservationPack changes only the messages projected through the public `context` event.
|
|
37
|
+
ObservationPack changes only the messages projected through the public `context` event. Pi passes `context` handlers a cloned copy of the conversation, so stored session history remains intact. ObservationPack replaces the content of those message objects in place and returns nothing. Since Pi 0.87, a handler that returns different message objects makes Pi merge every mid-conversation system message, such as prompt sections and tool-declaration deltas, into one leading system message, which breaks the provider's cached prefix on every later request. The in-place edit keeps those messages where they are on Pi 1.x and behaves the same on Pi 0.84.2.
|
|
38
|
+
|
|
39
|
+
Original bytes and the JSONL ledger live under the session-derived SoL-Pi directory.
|
|
35
40
|
|
|
36
41
|
## Evidence-Preserving Reducer
|
|
37
42
|
|
|
@@ -47,15 +52,15 @@ Online Context Compact uses ordinary public `context` and `before_provider_reque
|
|
|
47
52
|
|
|
48
53
|
Before selecting or executing a boundary compaction, it also checks the optional `Symbol.for("pi-subagents:manager")` registry exposed by `pi-subagents`. A running top-level subagent, or an unreadable registry, suppresses that compaction rather than risking a context rewrite during delegated work. When the registry is absent, the check is a no-op.
|
|
49
54
|
|
|
50
|
-
The native cut is
|
|
55
|
+
The native cut is estimated from Pi's canonical session projection when available (Pi 1.x), and from raw session entries on Pi 0.84.2. Removable-token savings are measured from corresponding messages in the latest observed extension projection. ObservationPack placeholders are therefore priced at their projected size, context edits are applied before choosing the cut, and retained system checkpoints are excluded from savings. Dropped messages, unseen additions, and ambiguous matches contribute no proven savings; the estimator never substitutes their raw byte counts or reruns context hooks. Pi's special recovery-omission suffix can allow a larger removable prefix than the public cut-point helper predicts; OCC conservatively underestimates savings in that case.
|
|
51
56
|
|
|
52
57
|
Compaction preserves the current plan, request-horizon samples, and context-growth history. Every plan update uses the same step-ID/status comparison, including the first update after compaction. A boundary requires a previously registered unfinished step to become completed. Newly introduced completed IDs establish history without creating a boundary, so re-keyed completed snapshots do not retrigger compaction. An assistant must register a step before completing it to make that completion eligible for OCC. Economic compaction has a two-provider-request cooldown; context-window protection can override it. A new user task following a fully completed plan resets the request-horizon samples while preserving unpaid cache debt.
|
|
53
58
|
|
|
54
|
-
Pi
|
|
59
|
+
On Pi builds whose `ExtensionAPI` has `getSettings()` (1.0.x), Online Context Compact reads Pi's effective `compaction.keepRecentTokens` and `compaction.reserveTokens`. A per-model `compaction.modelOverrides["<provider>/<id>"]` entry for the current `ctx.model` takes precedence, as in Pi. The reserve is used for window-pressure protection. On Pi 0.84.2 it uses the documented defaults of 20,000 retained-tail tokens and a 16,384-token reserve. An explicit `keepRecentTokens` passed to the programmatic factory overrides the retained tail on every version.
|
|
55
60
|
|
|
56
61
|
Pi 0.85.1's `ExtensionContext.compact()` aborts the active agent before it summarizes, and `agent_settled` fires only once a whole run has drained every turn, retry, auto-compaction, and queued continuation. A plan boundary that selects compaction therefore saves its plan and progress state, calls `ExtensionContext.abort()` to stop the run, and runs compaction from the `agent_settled` that stop produces. The handler awaits the compaction's own `onComplete`/`onError` callbacks. On success, the extension sends a hidden reminder through public `ExtensionAPI.sendMessage()` with `triggerTurn: true`, so Pi starts a new turn against the compacted context and continues the current plan. The reminder asks it to preserve existing step IDs when updating progress; an immediate plan update is not required.
|
|
57
62
|
|
|
58
|
-
A settlement barrier keeps the original `agent_settled` dispatch open until a synchronously triggered continuation settles. Print- and JSON-mode processes therefore complete the compact-and-continue sequence within the same Pi invocation; an outer driver does not need to resume the session or send `Continue working`. Successful compaction schedules a continuation. The exact native refusals `Nothing to compact (session too small)` and `Already compacted`, and Pi's explicit incomplete-summary token-cap error, also resume the interrupted task with the existing context. These skips are recorded as `sol-pi-online-context-compact-skipped` entries and shown as TUI warnings; they do not record a compaction or charge new cache debt. Plan-only turns cannot retry compaction until successful non-plan tool work or new user input occurs. Cancelling or exiting does not schedule a continuation. Other compaction errors
|
|
63
|
+
A settlement barrier keeps the original `agent_settled` dispatch open until a synchronously triggered continuation settles. Print- and JSON-mode processes therefore complete the compact-and-continue sequence within the same Pi invocation; an outer driver does not need to resume the session or send `Continue working`. Successful compaction schedules a continuation. The exact native refusals `Nothing to compact (session too small)` and `Already compacted`, and Pi's explicit incomplete-summary token-cap error, also resume the interrupted task with the existing context. These skips are recorded as `sol-pi-online-context-compact-skipped` entries and shown as TUI warnings; they do not record a compaction or charge new cache debt. Plan-only turns cannot retry compaction until successful non-plan tool work or new user input occurs. Cancelling or exiting does not schedule a continuation. Other non-cancellation compaction errors schedule a hidden continuation before the failure propagates.
|
|
59
64
|
|
|
60
65
|
Pi 0.85.1 does not return a promise from `ExtensionAPI.sendMessage()` and starts the requested turn synchronously, so it uses the extension's settlement barrier. Newer hosts can keep the context idle and defer the turn until settled handlers return; OCC returns control to such a host instead of waiting on the deferred turn or reporting a false start failure. A later-loaded third-party extension that performs long asynchronous work in its own `agent_settled` handler needs an integration test with that extension set.
|
|
61
66
|
|
|
@@ -67,6 +72,25 @@ Online Context Compact reads `ExtensionContext.getContextUsage()` for both the c
|
|
|
67
72
|
|
|
68
73
|
The standalone entry passes `cacheWriteReadRatio` from `sol-pi.json` directly into Online Context Compact's economic check. It does not inspect model price metadata. Changing models during a session does not change the ratio; users who want a different decision policy update the configuration and start a new session.
|
|
69
74
|
|
|
75
|
+
## Codemode
|
|
76
|
+
|
|
77
|
+
Pi 1.x codemode lets the model run a script that calls other tools through `ctx.executeTool()`. With `codemode.mode: "on"`, declared tools stay declared and are also callable from scripts. With `"only"`, they are hidden from the model and listed in the `codemode` tool description instead. Calls made from a script get the id `<codemode call id>/<n>`, and their results reach only the script, not the transcript. Every mechanism loads and runs in both modes:
|
|
78
|
+
|
|
79
|
+
| Mechanism | `codemode.mode: "on"` | `codemode.mode: "only"` |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| Action Fusion | Fused edit/write stay declared to the model and are also callable from scripts. | Fused edit/write are callable from scripts only. |
|
|
82
|
+
| ObservationPack | Large text results of direct tools and of `codemode` itself are packed. `obs_recall` is declared directly and callable from scripts. | `codemode` results are packed. `obs_recall` is listed in the `codemode` description and callable from scripts. |
|
|
83
|
+
| Evidence-Preserving Reducer | Reduces direct bash and fused edit/write results as before. Script calls are skipped. | No effect in normal operation: the model reaches bash, edit, and write through scripts, and script calls are skipped. It makes no model calls. |
|
|
84
|
+
| Online Context Compact | `update_plan` stays declared to the model and is not callable from scripts. | Same as `"on"`. |
|
|
85
|
+
|
|
86
|
+
**Action Fusion.** Scripts call `tools.edit` and `tools.write`; the `then_run` parameter appears in their script declarations. Edit and write declare no output schema, so following codemode's rule a successful call resolves to the combined text, including `[then_run:succeeded]` and the command output. A failed command (`[then_run:failed]`) or a failed mutation (`[then_run:skipped]`) rejects with an `Error` whose message holds that text. The file change is kept, so scripts that run `then_run` should use `try`/`catch` or `Promise.allSettled()`. Codemode lists script calls inside its own TUI row, so they show neither the Action Fusion banner nor the savings notice: a script already chains tools inside one model request.
|
|
87
|
+
|
|
88
|
+
**ObservationPack.** A `codemode` result is an ordinary tool result. Successful text-only results over 10 KiB are sent in full for two provider requests and then replaced by a placeholder naming `tool: codemode`. Tool calls made inside a script are not in the transcript and are never packed; only the script's output is. `tools.obs_recall({ id, offset })` resolves to the recall text, a header followed by the original bytes. The placeholder still says to call `obs_recall`; its wording is unchanged so placeholder bytes stay stable.
|
|
89
|
+
|
|
90
|
+
**Evidence-Preserving Reducer.** Because script calls are skipped, a script calling `tools.bash` gets Pi's own result: the call resolves to Pi's structured value `{ output, exit_code, truncated, full_output_path?, wall_time_seconds }`, and a non-zero exit resolves rather than rejects. A timeout, an abort, or a missing exit code rejects. The `codemode` result itself is never reduced.
|
|
91
|
+
|
|
92
|
+
**Online Context Compact.** `update_plan` is registered with exposure `"model-only"`: a script call would get a nested id that no turn reports as a tool result, so its plan boundary could never compact. The model calls `update_plan` directly in both modes, and plan boundaries compact and continue as described above.
|
|
93
|
+
|
|
70
94
|
## Interactive TUI
|
|
71
95
|
|
|
72
96
|
The lightning savings treatment uses Pi 0.85.1's public `renderCall`,
|
|
@@ -46,7 +46,7 @@ This preflight does not make every valid SoL-Pi configuration all-enabled. Witho
|
|
|
46
46
|
- `evidencePreservingReducer`: registers a `tool_result` handler and delegates long diagnostic-log reduction to the configured reducer provider/model.
|
|
47
47
|
- `evidencePreservingReducerProvider`: provider namespace used to resolve the reducer model through Pi's model registry.
|
|
48
48
|
- `evidencePreservingReducerModel`: model id used for Evidence-Preserving Reducer.
|
|
49
|
-
- `onlineContextCompact`: registers `update_plan` and boundary-driven native compaction after the other SoL-Pi context transformers.
|
|
49
|
+
- `onlineContextCompact`: registers `update_plan` and boundary-driven native compaction after the other SoL-Pi context transformers. On Pi 1.x, `update_plan` is declared to the model only and cannot be called from codemode scripts.
|
|
50
50
|
- `cacheWriteReadRatio`: supplies the single economic decision ratio used by Online Context Compact.
|
|
51
51
|
|
|
52
52
|
## Evidence-Preserving Reducer runtime inputs
|
|
@@ -57,18 +57,31 @@ The release entry supplies the run label and session-derived storage. It uses on
|
|
|
57
57
|
|
|
58
58
|
## Online Context Compact runtime inputs
|
|
59
59
|
|
|
60
|
-
The release entry uses
|
|
60
|
+
The release entry uses these runtime inputs:
|
|
61
61
|
|
|
62
62
|
- **Context window** — from `ExtensionContext.getContextUsage()`, used for window-pressure protection.
|
|
63
|
+
- **Compaction settings** — on Pi 1.x, the retained tail and the window-protection reserve follow Pi's effective `compaction.keepRecentTokens` and `compaction.reserveTokens`, including a `compaction.modelOverrides["<provider>/<id>"]` entry for the current model. Pi 0.84.2 does not expose its settings to extensions, so SoL-Pi uses Pi's defaults of 20,000 and 16,384 tokens there.
|
|
63
64
|
- **Cache write/read ratio** — from `cacheWriteReadRatio` in the effective `sol-pi.json`. The value remains fixed for the session and is not recomputed when the model changes. It drives one runtime decision and is not a cost report.
|
|
64
65
|
|
|
65
|
-
The configured ratio stays fixed for the loaded extension. The mechanism stores its current plan, progress summaries, request horizon, context growth, and compaction debt as versioned custom entries in Pi's session log. After a successful compaction it sends one hidden, generic message with `triggerTurn: true`, which starts a new turn and asks the assistant to continue the current plan, preserving existing step IDs when updating progress.
|
|
66
|
+
The configured ratio stays fixed for the loaded extension. The mechanism stores its current plan, progress summaries, request horizon, context growth, and compaction debt as versioned custom entries in Pi's session log. After a successful compaction it sends one hidden, generic message with `triggerTurn: true`, which starts a new turn and asks the assistant to continue the current plan, preserving existing step IDs when updating progress. Newly introduced completed steps are recorded as history and do not create completion boundaries. Economic compaction has a two-provider-request cooldown; context-window protection can override it. Known native refusals and incomplete-summary token-cap failures are recorded as skips, resume the task, and block plan-only compaction retries until successful non-plan tool work or new user input. If the compaction fails for any other non-cancellation reason, it sends a hidden message that tells the assistant to continue from the current plan, then reports the error. Print and JSON modes finish that continuation in the same Pi invocation, so callers do not need to resume the session or inject `Continue working`. Cancelling the compaction or exiting Pi does not schedule an automatic continuation. The mechanism creates no separate Online Context Compact files. The programmatic factory accepts an explicit retained-tail value, which overrides Pi's setting.
|
|
66
67
|
|
|
67
68
|
## Pi integration
|
|
68
69
|
|
|
69
70
|
SoL-Pi reads no dedicated environment variables. Evidence-Preserving Reducer resolves its configured reducer provider/model through `ExtensionContext.modelRegistry` and uses Pi-managed authentication. If the configured reducer model is unavailable or the nested model call fails, the original tool result continues unchanged.
|
|
70
71
|
|
|
71
|
-
SoL-Pi does not configure shell paths, command prefixes, storage paths, run IDs, provider URLs, reasoning levels, timeouts, or per-mechanism enable flags through environment variables. Apart from the EPR reducer provider/model route in `sol-pi.json`, model selection remains with Pi. Action Fusion uses Pi's
|
|
72
|
+
SoL-Pi does not configure shell paths, command prefixes, storage paths, run IDs, provider URLs, reasoning levels, timeouts, or per-mechanism enable flags through environment variables. Apart from the EPR reducer provider/model route in `sol-pi.json`, model selection remains with Pi. Action Fusion uses Pi's built-in Bash execution, with `shellPath` and `shellCommandPrefix` inherited from Pi's file-backed settings at extension startup. Global settings apply everywhere; project settings override them only after project trust. Malformed settings stop initialization rather than silently selecting a different shell. Persistent artifacts are derived from Pi's session directory and session ID.
|
|
73
|
+
|
|
74
|
+
For native Windows with Git for Windows installed outside the default directories, configure its Bash executable in Pi's `settings.json` (not `sol-pi.json`), for example:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"shellPath": "D:/Tools/Git/bin/bash.exe"
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Replace that example path with your actual Git Bash installation. `then_run.command` remains a Bash command even if the model's ordinary command tool is PowerShell; Git Bash is a native Windows program and does not require WSL. Do not point `shellPath` at `powershell.exe`, because the built-in Bash tool invokes it with Bash arguments. Restart the extension after changing shell settings.
|
|
83
|
+
|
|
84
|
+
This bridge reads file-backed settings, not SDK/CLI-only in-memory overrides. Embedded runtimes can pass explicit `bashOptions` to `createActionFusionExtension`; programmatic execution overrides remain supported.
|
|
72
85
|
|
|
73
86
|
## Trust
|
|
74
87
|
|
|
@@ -25,18 +25,14 @@ import {
|
|
|
25
25
|
type EditToolDetails,
|
|
26
26
|
type EditToolOptions,
|
|
27
27
|
type ExtensionAPI,
|
|
28
|
+
type ExtensionContext,
|
|
28
29
|
type ExtensionFactory,
|
|
29
30
|
type WriteToolOptions,
|
|
30
31
|
} from "@earendil-works/pi-coding-agent";
|
|
31
32
|
import { Type } from "typebox";
|
|
32
33
|
import { resolveToolPath } from "./file-queue.ts";
|
|
33
|
-
import { renderSolPiTool, showSolPiSavings } from "../../tui.ts";
|
|
34
|
-
import {
|
|
35
|
-
createThenRunSchema,
|
|
36
|
-
executeMutationThenRun,
|
|
37
|
-
THEN_RUN_SUCCEEDED,
|
|
38
|
-
type ThenRunInput,
|
|
39
|
-
} from "./then-run.ts";
|
|
34
|
+
import { isNestedToolCallId, renderSolPiTool, showSolPiSavings } from "../../tui.ts";
|
|
35
|
+
import { createThenRunSchema, runFusedMutation, type ThenRunInput, type ThenRunStatus } from "./then-run.ts";
|
|
40
36
|
|
|
41
37
|
const EDIT_THEN_RUN_DESCRIPTION =
|
|
42
38
|
"Command to run next on this file after the edit succeeds — e.g. run, build, start/restart, install, or check it; optional timeout in seconds. Skipped if the edit fails; a non-zero exit is reported but keeps the edit.";
|
|
@@ -80,6 +76,26 @@ function hasExternalToolOwner(pi: ExtensionAPI, name: string): boolean {
|
|
|
80
76
|
}
|
|
81
77
|
}
|
|
82
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Announce the avoided round-trip only when the command actually succeeded,
|
|
81
|
+
* as reported by the fusion itself, never by matching command output. Calls
|
|
82
|
+
* from a codemode script (`<parent id>/<n>`) save no model round-trip of their
|
|
83
|
+
* own: the script already chains tools inside one model call.
|
|
84
|
+
*/
|
|
85
|
+
function announceSavings(status: ThenRunStatus, toolCallId: string, ctx: ExtensionContext): void {
|
|
86
|
+
if (status !== "succeeded" || isNestedToolCallId(toolCallId)) return;
|
|
87
|
+
showSolPiSavings(ctx, "Action Fusion", "1 model round-trip avoided");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Show the savings banner on a fused call unless it settled as an error: a
|
|
92
|
+
* failed or skipped command avoided no round-trip. Pi redraws the call row
|
|
93
|
+
* with the settled `isError` as well, so both renderers drop it together.
|
|
94
|
+
*/
|
|
95
|
+
function showsSavingsBanner(thenRun: unknown, context: { readonly isError?: boolean }): boolean {
|
|
96
|
+
return Boolean(thenRun) && !context.isError;
|
|
97
|
+
}
|
|
98
|
+
|
|
83
99
|
export function createActionFusionExtension(options: ActionFusionOptions = {}): ExtensionFactory {
|
|
84
100
|
const baseEdit = memoizeByCwd((cwd: string) => createEditToolDefinition(cwd, options.editOptions));
|
|
85
101
|
const baseWrite = memoizeByCwd((cwd: string) => createWriteToolDefinition(cwd, options.writeOptions));
|
|
@@ -103,7 +119,7 @@ export function createActionFusionExtension(options: ActionFusionOptions = {}):
|
|
|
103
119
|
parameters: editParameters,
|
|
104
120
|
async execute(toolCallId, input, signal, onUpdate, ctx) {
|
|
105
121
|
const { then_run, ...editInput } = input as typeof input & { then_run?: ThenRunInput };
|
|
106
|
-
const result = await
|
|
122
|
+
const { result, status } = await runFusedMutation({
|
|
107
123
|
toolCallId,
|
|
108
124
|
absolutePath: resolveToolPath(ctx.cwd, input.path),
|
|
109
125
|
thenRun: then_run,
|
|
@@ -112,21 +128,18 @@ export function createActionFusionExtension(options: ActionFusionOptions = {}):
|
|
|
112
128
|
ctx,
|
|
113
129
|
mutate: () => baseEdit(ctx.cwd).execute(toolCallId, editInput, signal, onUpdate, ctx),
|
|
114
130
|
});
|
|
115
|
-
|
|
116
|
-
then_run &&
|
|
117
|
-
result.content.some((block) => block.type === "text" && block.text.includes(THEN_RUN_SUCCEEDED))
|
|
118
|
-
) {
|
|
119
|
-
showSolPiSavings(ctx, "Action Fusion", "1 model round-trip avoided");
|
|
120
|
-
}
|
|
131
|
+
announceSavings(status, toolCallId, ctx);
|
|
121
132
|
return result;
|
|
122
133
|
},
|
|
123
134
|
renderCall: (args, theme, context) => {
|
|
124
135
|
const base = baseEdit(context.cwd).renderCall!(args, theme, context);
|
|
125
|
-
return args.then_run
|
|
136
|
+
return showsSavingsBanner(args.then_run, context)
|
|
137
|
+
? renderSolPiTool(theme, "Action Fusion", "1 model round-trip avoided", base)
|
|
138
|
+
: base;
|
|
126
139
|
},
|
|
127
140
|
renderResult: (result, resultOptions, theme, context) => {
|
|
128
141
|
const base = baseEdit(context.cwd).renderResult!(result, resultOptions, theme, context);
|
|
129
|
-
return context.args.then_run
|
|
142
|
+
return showsSavingsBanner(context.args.then_run, context)
|
|
130
143
|
? renderSolPiTool(theme, "Action Fusion", "1 model round-trip avoided", base)
|
|
131
144
|
: base;
|
|
132
145
|
},
|
|
@@ -147,7 +160,7 @@ export function createActionFusionExtension(options: ActionFusionOptions = {}):
|
|
|
147
160
|
}),
|
|
148
161
|
async execute(toolCallId, input, signal, onUpdate, ctx) {
|
|
149
162
|
const { then_run, ...writeInput } = input as typeof input & { then_run?: ThenRunInput };
|
|
150
|
-
const result = await
|
|
163
|
+
const { result, status } = await runFusedMutation({
|
|
151
164
|
toolCallId,
|
|
152
165
|
absolutePath: resolveToolPath(ctx.cwd, input.path),
|
|
153
166
|
thenRun: then_run,
|
|
@@ -173,21 +186,18 @@ export function createActionFusionExtension(options: ActionFusionOptions = {}):
|
|
|
173
186
|
return write.execute(toolCallId, writeInput, signal, onUpdate, ctx);
|
|
174
187
|
},
|
|
175
188
|
});
|
|
176
|
-
|
|
177
|
-
then_run &&
|
|
178
|
-
result.content.some((block) => block.type === "text" && block.text.includes(THEN_RUN_SUCCEEDED))
|
|
179
|
-
) {
|
|
180
|
-
showSolPiSavings(ctx, "Action Fusion", "1 model round-trip avoided");
|
|
181
|
-
}
|
|
189
|
+
announceSavings(status, toolCallId, ctx);
|
|
182
190
|
return result;
|
|
183
191
|
},
|
|
184
192
|
renderCall: (args, theme, context) => {
|
|
185
193
|
const base = baseWrite(context.cwd).renderCall!(args, theme, context);
|
|
186
|
-
return args.then_run
|
|
194
|
+
return showsSavingsBanner(args.then_run, context)
|
|
195
|
+
? renderSolPiTool(theme, "Action Fusion", "1 model round-trip avoided", base)
|
|
196
|
+
: base;
|
|
187
197
|
},
|
|
188
198
|
renderResult: (result, resultOptions, theme, context) => {
|
|
189
199
|
const base = baseWrite(context.cwd).renderResult!(result, resultOptions, theme, context);
|
|
190
|
-
return context.args.then_run
|
|
200
|
+
return showsSavingsBanner(context.args.then_run, context)
|
|
191
201
|
? renderSolPiTool(theme, "Action Fusion", "1 model round-trip avoided", base)
|
|
192
202
|
: base;
|
|
193
203
|
},
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { readFile } from "node:fs/promises";
|
|
7
7
|
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
8
|
-
import { type BashToolOptions, createBashToolDefinition, type
|
|
8
|
+
import { type BashToolOptions, createBashToolDefinition, type ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
9
9
|
import { Type } from "typebox";
|
|
10
10
|
import { withFusedFileQueue } from "./file-queue.ts";
|
|
11
11
|
|
|
@@ -13,6 +13,18 @@ export const THEN_RUN_SUCCEEDED = "[then_run:succeeded]";
|
|
|
13
13
|
export const THEN_RUN_FAILED = "[then_run:failed]";
|
|
14
14
|
export const THEN_RUN_SKIPPED = "[then_run:skipped]";
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* The context Pi passes to tool `execute()`: `ExtensionContext` before Pi 0.99,
|
|
18
|
+
* `ExtensionToolContext` since then. Derived so it compiles against both.
|
|
19
|
+
*/
|
|
20
|
+
type ToolExecuteContext = Parameters<ToolDefinition["execute"]>[4];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* What happened to the follow-up command of a returned fused result. Thrown
|
|
24
|
+
* results carry the status in their message instead.
|
|
25
|
+
*/
|
|
26
|
+
export type ThenRunStatus = "none" | "succeeded" | "failed" | "skipped";
|
|
27
|
+
|
|
16
28
|
export interface ThenRunInput {
|
|
17
29
|
command: string;
|
|
18
30
|
timeout?: number;
|
|
@@ -41,10 +53,10 @@ function resultText(result: AgentToolResult<unknown>): string {
|
|
|
41
53
|
.join("\n");
|
|
42
54
|
}
|
|
43
55
|
|
|
56
|
+
const THEN_RUN_SKIPPED_REASON = "The file mutation did not complete successfully; the command was not run.";
|
|
57
|
+
|
|
44
58
|
function thenRunSkippedError(error: unknown): Error {
|
|
45
|
-
return new Error(
|
|
46
|
-
`${errorText(error)}\n\n${THEN_RUN_SKIPPED} The file mutation did not complete successfully; the command was not run.`,
|
|
47
|
-
);
|
|
59
|
+
return new Error(`${errorText(error)}\n\n${THEN_RUN_SKIPPED} ${THEN_RUN_SKIPPED_REASON}`);
|
|
48
60
|
}
|
|
49
61
|
|
|
50
62
|
async function fileSha256(path: string): Promise<string> {
|
|
@@ -75,7 +87,35 @@ export async function assertUnchangedBeforeCommand(
|
|
|
75
87
|
* fused mutation of the same file cannot interleave. Pi's built-in mutation
|
|
76
88
|
* tool keeps its own queue; the two queues are not nested.
|
|
77
89
|
*/
|
|
78
|
-
export async function executeMutationThenRun<TDetails>(
|
|
90
|
+
export async function executeMutationThenRun<TDetails>(
|
|
91
|
+
options: FusedMutationOptions<TDetails>,
|
|
92
|
+
): Promise<AgentToolResult<TDetails>> {
|
|
93
|
+
return (await runFusedMutation(options)).result;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface FusedMutationOptions<TDetails> {
|
|
97
|
+
toolCallId: string;
|
|
98
|
+
absolutePath: string;
|
|
99
|
+
thenRun: ThenRunInput | undefined;
|
|
100
|
+
mutate: () => Promise<AgentToolResult<TDetails>>;
|
|
101
|
+
bashOptions: BashToolOptions | undefined;
|
|
102
|
+
signal: AbortSignal | undefined;
|
|
103
|
+
ctx: ToolExecuteContext;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* {@link executeMutationThenRun} plus the status of the follow-up command, so
|
|
108
|
+
* callers never have to infer success from text the command itself printed.
|
|
109
|
+
*
|
|
110
|
+
* A failing command is reported in one of two shapes, depending on Pi's bash:
|
|
111
|
+
* before Pi 0.99 it throws on a non-zero exit, and so do later versions on a
|
|
112
|
+
* timeout, an abort, or a missing exit code. Those failures throw an error
|
|
113
|
+
* that keeps the mutation output. Since Pi 0.99 a non-zero exit comes back as
|
|
114
|
+
* an `isError` result; it is returned as an `isError` result that keeps the
|
|
115
|
+
* mutation's details, so the edit diff still renders. Both carry
|
|
116
|
+
* `[then_run:failed]` followed by the command output.
|
|
117
|
+
*/
|
|
118
|
+
export async function runFusedMutation<TDetails>({
|
|
79
119
|
toolCallId,
|
|
80
120
|
absolutePath,
|
|
81
121
|
thenRun,
|
|
@@ -83,15 +123,7 @@ export async function executeMutationThenRun<TDetails>({
|
|
|
83
123
|
bashOptions,
|
|
84
124
|
signal,
|
|
85
125
|
ctx,
|
|
86
|
-
}: {
|
|
87
|
-
toolCallId: string;
|
|
88
|
-
absolutePath: string;
|
|
89
|
-
thenRun: ThenRunInput | undefined;
|
|
90
|
-
mutate: () => Promise<AgentToolResult<TDetails>>;
|
|
91
|
-
bashOptions: BashToolOptions | undefined;
|
|
92
|
-
signal: AbortSignal | undefined;
|
|
93
|
-
ctx: ExtensionToolContext;
|
|
94
|
-
}): Promise<AgentToolResult<TDetails>> {
|
|
126
|
+
}: FusedMutationOptions<TDetails>): Promise<{ result: AgentToolResult<TDetails>; status: ThenRunStatus }> {
|
|
95
127
|
return withFusedFileQueue(absolutePath, async () => {
|
|
96
128
|
let mutationResult: AgentToolResult<TDetails>;
|
|
97
129
|
try {
|
|
@@ -104,26 +136,63 @@ export async function executeMutationThenRun<TDetails>({
|
|
|
104
136
|
}
|
|
105
137
|
|
|
106
138
|
if (thenRun === undefined) {
|
|
107
|
-
return mutationResult;
|
|
139
|
+
return { result: mutationResult, status: "none" };
|
|
140
|
+
}
|
|
141
|
+
if (isErrorResult(mutationResult)) {
|
|
142
|
+
return {
|
|
143
|
+
result: appendThenRunText(mutationResult, `${THEN_RUN_SKIPPED} ${THEN_RUN_SKIPPED_REASON}`, true),
|
|
144
|
+
status: "skipped",
|
|
145
|
+
};
|
|
108
146
|
}
|
|
109
147
|
|
|
110
148
|
await assertUnchangedBeforeCommand(absolutePath);
|
|
111
149
|
const bash = createBashToolDefinition(ctx.cwd, bashOptions);
|
|
150
|
+
let bashResult: AgentToolResult<unknown>;
|
|
112
151
|
try {
|
|
113
|
-
|
|
114
|
-
const bashResult = await bash.execute(`${toolCallId}:then_run`, thenRun, signal, undefined, ctx);
|
|
115
|
-
const output = resultText(bashResult);
|
|
116
|
-
if (bashResult.isError) throw new Error(output);
|
|
117
|
-
return {
|
|
118
|
-
...mutationResult,
|
|
119
|
-
content: [
|
|
120
|
-
...mutationResult.content,
|
|
121
|
-
{ type: "text", text: output ? `${THEN_RUN_SUCCEEDED}\n${output}` : THEN_RUN_SUCCEEDED },
|
|
122
|
-
],
|
|
123
|
-
};
|
|
152
|
+
bashResult = await bash.execute(`${toolCallId}:then_run`, thenRun, signal, undefined, ctx);
|
|
124
153
|
} catch (error) {
|
|
125
154
|
const mutationOutput = resultText(mutationResult);
|
|
126
155
|
throw new Error([mutationOutput, THEN_RUN_FAILED, errorText(error)].filter(Boolean).join("\n\n"), { cause: error });
|
|
127
156
|
}
|
|
157
|
+
const output = resultText(bashResult);
|
|
158
|
+
if (isErrorResult(bashResult)) {
|
|
159
|
+
return {
|
|
160
|
+
result: appendThenRunText(mutationResult, output ? `${THEN_RUN_FAILED}\n${output}` : THEN_RUN_FAILED, true),
|
|
161
|
+
status: "failed",
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
result: appendThenRunText(
|
|
166
|
+
mutationResult,
|
|
167
|
+
output ? `${THEN_RUN_SUCCEEDED}\n${output}` : THEN_RUN_SUCCEEDED,
|
|
168
|
+
false,
|
|
169
|
+
),
|
|
170
|
+
status: "succeeded",
|
|
171
|
+
};
|
|
128
172
|
});
|
|
129
173
|
}
|
|
174
|
+
|
|
175
|
+
/** Pi 0.99+ results may report a failure with `isError` instead of throwing; 0.84 has no such field. */
|
|
176
|
+
type MaybeErrorResult<TDetails> = AgentToolResult<TDetails> & { isError?: boolean };
|
|
177
|
+
|
|
178
|
+
function isErrorResult(result: AgentToolResult<unknown>): boolean {
|
|
179
|
+
return (result as MaybeErrorResult<unknown>).isError === true;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Add the follow-up report to the mutation result. Only the mutation's own
|
|
184
|
+
* fields are kept: bash `details` and `structuredContent` describe a different
|
|
185
|
+
* tool and would confuse the edit and write renderers.
|
|
186
|
+
*/
|
|
187
|
+
function appendThenRunText<TDetails>(
|
|
188
|
+
mutationResult: AgentToolResult<TDetails>,
|
|
189
|
+
text: string,
|
|
190
|
+
isError: boolean,
|
|
191
|
+
): AgentToolResult<TDetails> {
|
|
192
|
+
const result: MaybeErrorResult<TDetails> = {
|
|
193
|
+
...mutationResult,
|
|
194
|
+
content: [...mutationResult.content, { type: "text", text }],
|
|
195
|
+
};
|
|
196
|
+
if (isError) result.isError = true;
|
|
197
|
+
return result;
|
|
198
|
+
}
|
|
@@ -11,10 +11,17 @@ import { recordValue } from "./config.ts";
|
|
|
11
11
|
/** Markers written by the action-fusion extension around a fused command's output. */
|
|
12
12
|
const THEN_RUN_SUCCEEDED = "[then_run:succeeded]";
|
|
13
13
|
const THEN_RUN_FAILED = "[then_run:failed]";
|
|
14
|
+
/** Status line pi's bash appends to the inline text of a command that exited non-zero. */
|
|
15
|
+
const EXIT_STATUS_LINE = /(?:^|\n)Command exited with code (-?\d+)\s*$/u;
|
|
14
16
|
|
|
15
17
|
export interface ReducibleToolResult {
|
|
16
18
|
readonly command: string;
|
|
17
19
|
readonly body: string;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the result itself reports a failed command: a non-zero exit code or
|
|
22
|
+
* a `[then_run:failed]` marker. `undefined` when the result carries no signal.
|
|
23
|
+
*/
|
|
24
|
+
readonly exitFailed: boolean | undefined;
|
|
18
25
|
/** Put the receipt back where the raw output was, leaving the rest of the result alone. */
|
|
19
26
|
readonly projectReceipt: (receipt: string) => ToolResultEvent["content"];
|
|
20
27
|
}
|
|
@@ -41,6 +48,22 @@ async function safePiBashTempPath(path: string | undefined): Promise<boolean> {
|
|
|
41
48
|
}
|
|
42
49
|
}
|
|
43
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Read the exit status from the inline text. This must run on the text pi put
|
|
53
|
+
* in the result, not on the full-output file: the file holds only the
|
|
54
|
+
* command's output, without the status line.
|
|
55
|
+
*/
|
|
56
|
+
function inlineExitFailed(inline: string): boolean | undefined {
|
|
57
|
+
const match = inline.match(EXIT_STATUS_LINE);
|
|
58
|
+
return match ? Number(match[1]) !== 0 : undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** `structuredContent.exit_code` of a pi >= 0.99 bash result; absent on older pi. */
|
|
62
|
+
function structuredExitCode(event: ToolResultEvent): number | undefined {
|
|
63
|
+
const value = recordValue((event as { structuredContent?: unknown }).structuredContent, "exit_code");
|
|
64
|
+
return typeof value === "number" ? value : undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
44
67
|
/**
|
|
45
68
|
* Prefer the untruncated file pi wrote for a large bash result, so evidence is
|
|
46
69
|
* checked against the exact bytes the command produced rather than a preview.
|
|
@@ -57,6 +80,10 @@ async function exactBodyFromInline(inline: string, details: unknown): Promise<st
|
|
|
57
80
|
}
|
|
58
81
|
}
|
|
59
82
|
|
|
83
|
+
function firstIndex(left: number, right: number): number {
|
|
84
|
+
return left < 0 ? right : right < 0 ? left : Math.min(left, right);
|
|
85
|
+
}
|
|
86
|
+
|
|
60
87
|
/**
|
|
61
88
|
* Identify the log inside a tool result: either a plain bash result, or the
|
|
62
89
|
* command output appended by a fused `edit`/`write` call.
|
|
@@ -66,9 +93,11 @@ export async function reducibleToolResult(event: ToolResultEvent): Promise<Reduc
|
|
|
66
93
|
const command = typeof event.input.command === "string" ? event.input.command : "";
|
|
67
94
|
if (!command) return undefined;
|
|
68
95
|
const inline = textContent(event);
|
|
96
|
+
const exitCode = structuredExitCode(event);
|
|
69
97
|
return {
|
|
70
98
|
command,
|
|
71
99
|
body: await exactBodyFromInline(inline, event.details),
|
|
100
|
+
exitFailed: exitCode !== undefined ? exitCode !== 0 : inlineExitFailed(inline),
|
|
72
101
|
projectReceipt: (receipt) => [{ type: "text", text: receipt }],
|
|
73
102
|
};
|
|
74
103
|
}
|
|
@@ -76,12 +105,14 @@ export async function reducibleToolResult(event: ToolResultEvent): Promise<Reduc
|
|
|
76
105
|
const thenRun = recordValue(event.input, "then_run");
|
|
77
106
|
const commandValue = recordValue(thenRun, "command");
|
|
78
107
|
if (typeof commandValue !== "string" || !commandValue) return undefined;
|
|
79
|
-
const marker = event.isError ? THEN_RUN_FAILED : THEN_RUN_SUCCEEDED;
|
|
80
108
|
for (let index = 0; index < event.content.length; index++) {
|
|
81
109
|
const block = event.content[index];
|
|
82
110
|
if (!block || block.type !== "text") continue;
|
|
83
|
-
|
|
111
|
+
// The first marker in the block is the one action-fusion wrote; the
|
|
112
|
+
// command's own output may quote either marker later on.
|
|
113
|
+
const markerIndex = firstIndex(block.text.indexOf(THEN_RUN_SUCCEEDED), block.text.indexOf(THEN_RUN_FAILED));
|
|
84
114
|
if (markerIndex < 0) continue;
|
|
115
|
+
const marker = block.text.startsWith(THEN_RUN_FAILED, markerIndex) ? THEN_RUN_FAILED : THEN_RUN_SUCCEEDED;
|
|
85
116
|
const suffixStart = markerIndex + marker.length;
|
|
86
117
|
const suffix = block.text.slice(suffixStart);
|
|
87
118
|
const separator = suffix.match(/^(?:\r?\n)+/u)?.[0] ?? "\n";
|
|
@@ -89,6 +120,12 @@ export async function reducibleToolResult(event: ToolResultEvent): Promise<Reduc
|
|
|
89
120
|
return {
|
|
90
121
|
command: commandValue,
|
|
91
122
|
body: await exactBodyFromInline(inline, event.details),
|
|
123
|
+
// Fused results carry no structured exit code, so pi's status line is
|
|
124
|
+
// also trusted over a succeeded marker. This is deliberately conservative:
|
|
125
|
+
// a passing command whose own last line reads `Command exited with code N`
|
|
126
|
+
// is only left unreduced, while a misreported failure would otherwise get
|
|
127
|
+
// a success receipt.
|
|
128
|
+
exitFailed: marker === THEN_RUN_FAILED || inlineExitFailed(inline) === true,
|
|
92
129
|
projectReceipt: (receipt) =>
|
|
93
130
|
event.content.map((content, contentIndex) =>
|
|
94
131
|
contentIndex === index && content.type === "text"
|
package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/evidence-preserving-reducer/index.ts
CHANGED
|
@@ -55,16 +55,39 @@ function errorName(error: unknown): string | undefined {
|
|
|
55
55
|
return isRecord(error) && typeof error.name === "string" ? error.name : undefined;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* A call another tool made through `executeTool` (a codemode script, for
|
|
60
|
+
* example) carries `parentToolCallId` on pi >= 0.99; older pi never sets it.
|
|
61
|
+
* Such a result never enters the transcript, so reducing it saves nothing, and
|
|
62
|
+
* replacing its content drops the `structuredContent` the calling script reads.
|
|
63
|
+
*/
|
|
64
|
+
function isNestedToolResult(event: ToolResultEvent): boolean {
|
|
65
|
+
return (event as { parentToolCallId?: string }).parentToolCallId !== undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
58
68
|
export async function reduceToolResult(
|
|
59
69
|
journal: Journal,
|
|
60
70
|
config: ReducerConfig,
|
|
61
71
|
event: ToolResultEvent,
|
|
62
72
|
context: ExtensionContext,
|
|
63
73
|
): Promise<ReducedToolResult | undefined> {
|
|
74
|
+
if (isNestedToolResult(event)) return undefined;
|
|
64
75
|
const reducible = await reducibleToolResult(event);
|
|
65
76
|
if (!reducible || !DIAGNOSTIC_COMMAND.test(reducible.command)) return undefined;
|
|
66
77
|
const { body, command } = reducible;
|
|
67
78
|
if (Buffer.byteLength(body, "utf8") < config.minBytes) return undefined;
|
|
79
|
+
// The receipt status follows `isError`. When the result's own text disagrees
|
|
80
|
+
// (a non-zero exit or a failed then_run reported as success, or the reverse),
|
|
81
|
+
// leave the original output in place rather than certify the wrong status.
|
|
82
|
+
if (reducible.exitFailed !== undefined && reducible.exitFailed !== event.isError) {
|
|
83
|
+
journal("fallback", {
|
|
84
|
+
toolCallId: event.toolCallId,
|
|
85
|
+
reason: "exit-state-mismatch",
|
|
86
|
+
isError: event.isError,
|
|
87
|
+
exitFailed: reducible.exitFailed,
|
|
88
|
+
});
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
68
91
|
if (body.length > config.maxChars) {
|
|
69
92
|
journal("fallback", { reason: "source-over-max-chars", sourceChars: body.length, maxChars: config.maxChars });
|
|
70
93
|
return undefined;
|
|
@@ -180,6 +203,7 @@ export function createEvidencePreservingReducerExtension(options: EvidencePreser
|
|
|
180
203
|
return (pi: ExtensionAPI) => {
|
|
181
204
|
const states = new Map<string, { config: ReducerConfig; journal: Journal }>();
|
|
182
205
|
pi.on("tool_result", (event, context) => {
|
|
206
|
+
if (isNestedToolResult(event)) return undefined;
|
|
183
207
|
let root: string;
|
|
184
208
|
try {
|
|
185
209
|
root = runtimeRoot(context);
|