@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
|
@@ -10,9 +10,16 @@
|
|
|
10
10
|
* original bytes are archived by observation id outside the provider context,
|
|
11
11
|
* and the agent pulls exact pages back with the registered `obs_recall` tool.
|
|
12
12
|
*
|
|
13
|
-
* The mechanism never edits history
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* The mechanism never edits stored history. It rewrites only at the projection
|
|
14
|
+
* layer (`pi.on("context")`), so the stored session stays intact and recall
|
|
15
|
+
* keeps working after native compaction or a session resume. Pi hands context
|
|
16
|
+
* handlers a structured clone of the conversation, and the placeholder replaces
|
|
17
|
+
* the content of that clone's message objects in place: since Pi 0.87 a handler
|
|
18
|
+
* that returns different message objects makes Pi collapse every
|
|
19
|
+
* mid-conversation system message (prompt and tool-declaration deltas) into one
|
|
20
|
+
* leading system message, which breaks the provider's cached prefix on every
|
|
21
|
+
* later request. Pi 0.84 sends the edited clone too, so the handler returns
|
|
22
|
+
* nothing on every version.
|
|
16
23
|
*
|
|
17
24
|
* Storage lives under the active Pi session directory.
|
|
18
25
|
*/
|
|
@@ -135,7 +142,6 @@ export function createObservationPackExtension(): ExtensionFactory {
|
|
|
135
142
|
});
|
|
136
143
|
|
|
137
144
|
pi.on("context", async (event, ctx: ExtensionContext) => {
|
|
138
|
-
const projected = [...event.messages];
|
|
139
145
|
const root = runtimeRoot(ctx);
|
|
140
146
|
// How many provider requests each message has already been part of,
|
|
141
147
|
// counted by the assistant messages that follow it.
|
|
@@ -197,7 +203,8 @@ export function createObservationPackExtension(): ExtensionFactory {
|
|
|
197
203
|
formatSavingsCount(removedTokens, "context tokens avoided"),
|
|
198
204
|
);
|
|
199
205
|
}
|
|
200
|
-
|
|
206
|
+
// Same message object, new content: see the note at the top of this file.
|
|
207
|
+
message.content = [{ type: "text", text: placeholder }];
|
|
201
208
|
sentCounts.set(sendCountKey, previousSends + 1);
|
|
202
209
|
} catch (error) {
|
|
203
210
|
// Fail open: a packing failure must never cost the agent its observation.
|
|
@@ -205,8 +212,6 @@ export function createObservationPackExtension(): ExtensionFactory {
|
|
|
205
212
|
console.error(`[observationpack] fail-open for tool result: ${reason}`);
|
|
206
213
|
}
|
|
207
214
|
}
|
|
208
|
-
|
|
209
|
-
return { messages: projected };
|
|
210
215
|
});
|
|
211
216
|
};
|
|
212
217
|
}
|
package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/extension.ts
CHANGED
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
import type { AgentMessage, AgentToolResult, ThinkingLevel } from "@earendil-works/pi-agent-core";
|
|
6
6
|
import {
|
|
7
7
|
estimateTokens,
|
|
8
|
-
findCutPoint,
|
|
9
|
-
sessionEntryToContextMessages,
|
|
10
8
|
type ExtensionAPI,
|
|
11
9
|
type ExtensionContext,
|
|
12
10
|
type ExtensionFactory,
|
|
@@ -19,7 +17,7 @@ import {
|
|
|
19
17
|
type CompactionDecision,
|
|
20
18
|
} from "./economics.ts";
|
|
21
19
|
import { analyzePlanTransition, formatPlanSnapshot, parsePlanSteps } from "./plan.ts";
|
|
22
|
-
import {
|
|
20
|
+
import { estimateProjectedCompactionTokens } from "./projection.ts";
|
|
23
21
|
import {
|
|
24
22
|
appendOnlineState,
|
|
25
23
|
initialOnlineState,
|
|
@@ -51,6 +49,9 @@ const RECOVERABLE_COMPACTION_ERRORS = new Set([
|
|
|
51
49
|
"Already compacted",
|
|
52
50
|
"Summarization failed: generation hit the token cap and the summary is incomplete",
|
|
53
51
|
]);
|
|
52
|
+
export const COMPACTION_FAILED_RESUME_REMINDER =
|
|
53
|
+
"Online context compaction did not complete. The parent task is still active. " +
|
|
54
|
+
"Continue the remaining work from the current plan.";
|
|
54
55
|
|
|
55
56
|
export type OnlineContextCompactOptions = {
|
|
56
57
|
readonly cacheWriteReadRatio?: number | null;
|
|
@@ -61,10 +62,8 @@ type PendingBoundary = { readonly toolCallId: string };
|
|
|
61
62
|
type SelectedCompaction = { readonly decision: CompactionDecision };
|
|
62
63
|
type CacheDebt = { readonly debtTokens: number; readonly repaymentTokens: number };
|
|
63
64
|
type PendingContinuation = { readonly promise: Promise<void>; readonly resolve: () => void };
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (continuation) setTimeout(continuation.resolve, 0);
|
|
67
|
-
}
|
|
65
|
+
type CompactionTokenSettings = { readonly keepRecentTokens: number; readonly reserveTokens: number };
|
|
66
|
+
type SettingsSource = { readonly getSettings?: () => unknown };
|
|
68
67
|
|
|
69
68
|
const SUBAGENTS_MANAGER_KEY = Symbol.for("pi-subagents:manager");
|
|
70
69
|
|
|
@@ -116,84 +115,12 @@ function progressSummary(input: PlanUpdateInput, completedStepId: string): Progr
|
|
|
116
115
|
};
|
|
117
116
|
}
|
|
118
117
|
|
|
119
|
-
function compactionTokenEstimate(
|
|
120
|
-
entries: readonly SessionEntry[],
|
|
121
|
-
startIndex: number,
|
|
122
|
-
endIndex: number,
|
|
123
|
-
projected?: ReadonlyMap<string, number>,
|
|
124
|
-
): number {
|
|
125
|
-
let tokens = 0;
|
|
126
|
-
for (let index = startIndex; index < endIndex; index++) {
|
|
127
|
-
const entry = entries[index];
|
|
128
|
-
if (!entry || entry.type === "compaction") continue;
|
|
129
|
-
if (projected) {
|
|
130
|
-
tokens += projected.get(entry.id) ?? 0;
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
const message = sessionEntryToContextMessages(entry)[0];
|
|
134
|
-
if (message) tokens += estimateTokens(message);
|
|
135
|
-
}
|
|
136
|
-
return tokens;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function branchAfterAbort(entries: readonly SessionEntry[]): SessionEntry[] {
|
|
140
|
-
const last = entries.at(-1);
|
|
141
|
-
const markerProvider = ["sol", "pi"].join("-");
|
|
142
|
-
return [
|
|
143
|
-
...entries,
|
|
144
|
-
{
|
|
145
|
-
type: "message",
|
|
146
|
-
id: "sol-pi-online-context-compact-abort-marker",
|
|
147
|
-
parentId: last?.id ?? null,
|
|
148
|
-
timestamp: new Date(0).toISOString(),
|
|
149
|
-
message: {
|
|
150
|
-
role: "assistant",
|
|
151
|
-
content: [],
|
|
152
|
-
api: markerProvider,
|
|
153
|
-
provider: markerProvider,
|
|
154
|
-
model: "aborted",
|
|
155
|
-
usage: {
|
|
156
|
-
input: 0,
|
|
157
|
-
output: 0,
|
|
158
|
-
cacheRead: 0,
|
|
159
|
-
cacheWrite: 0,
|
|
160
|
-
totalTokens: 0,
|
|
161
|
-
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
|
|
162
|
-
},
|
|
163
|
-
stopReason: "aborted",
|
|
164
|
-
timestamp: 0,
|
|
165
|
-
},
|
|
166
|
-
} as SessionEntry,
|
|
167
|
-
];
|
|
168
|
-
}
|
|
169
|
-
|
|
170
118
|
export function estimateNativeCompactionTokens(
|
|
171
119
|
entries: readonly SessionEntry[],
|
|
172
120
|
keepRecentTokens: number,
|
|
173
121
|
projectedMessages?: readonly AgentMessage[],
|
|
174
122
|
): number {
|
|
175
|
-
|
|
176
|
-
const projected = projectedMessages === undefined ? undefined : projectedEntryTokens(entries, projectedMessages);
|
|
177
|
-
let startIndex = 0;
|
|
178
|
-
let previousSummaryTokens = 0;
|
|
179
|
-
for (let index = path.length - 1; index >= 0; index--) {
|
|
180
|
-
const entry = path[index];
|
|
181
|
-
if (entry?.type !== "compaction") continue;
|
|
182
|
-
const keptIndex = path.findIndex((item) => item.id === entry.firstKeptEntryId);
|
|
183
|
-
startIndex = keptIndex >= 0 ? keptIndex : index + 1;
|
|
184
|
-
const previousSummary = sessionEntryToContextMessages(entry)[0];
|
|
185
|
-
previousSummaryTokens = projected
|
|
186
|
-
? projected.get(entry.id) ?? 0
|
|
187
|
-
: previousSummary ? estimateTokens(previousSummary) : 0;
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// Keep Pi's native cut on session entries; price only the corresponding
|
|
192
|
-
// messages that the provider actually saw after context projection.
|
|
193
|
-
const cut = findCutPoint(path, startIndex, path.length, keepRecentTokens);
|
|
194
|
-
const firstKept = cut.firstKeptEntryIndex;
|
|
195
|
-
if (compactionTokenEstimate(path, startIndex, firstKept) === 0) return 0;
|
|
196
|
-
return previousSummaryTokens + compactionTokenEstimate(path, startIndex, firstKept, projected);
|
|
123
|
+
return estimateProjectedCompactionTokens(entries, keepRecentTokens, projectedMessages);
|
|
197
124
|
}
|
|
198
125
|
|
|
199
126
|
function validPositiveInteger(value: unknown): value is number {
|
|
@@ -231,8 +158,45 @@ function restoreCompactionThinking(pi: ExtensionAPI, override: CompactionThinkin
|
|
|
231
158
|
}
|
|
232
159
|
}
|
|
233
160
|
|
|
161
|
+
function tokenSetting(value: unknown): number | undefined {
|
|
162
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : undefined;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function record(value: unknown): Readonly<Record<string, unknown>> | undefined {
|
|
166
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
167
|
+
? (value as Readonly<Record<string, unknown>>)
|
|
168
|
+
: undefined;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Pi's effective compaction token settings for `model`, resolved the way Pi resolves them:
|
|
173
|
+
* `compaction.modelOverrides["<provider>/<id>"]`, then `compaction`, then Pi's defaults.
|
|
174
|
+
*/
|
|
175
|
+
export function resolveCompactionTokenSettings(
|
|
176
|
+
settings: unknown,
|
|
177
|
+
model: { readonly provider: string; readonly id: string } | undefined,
|
|
178
|
+
): CompactionTokenSettings {
|
|
179
|
+
const compaction = record(record(settings)?.compaction);
|
|
180
|
+
const override = model ? record(record(compaction?.modelOverrides)?.[`${model.provider}/${model.id}`]) : undefined;
|
|
181
|
+
return {
|
|
182
|
+
keepRecentTokens:
|
|
183
|
+
tokenSetting(override?.keepRecentTokens) ??
|
|
184
|
+
tokenSetting(compaction?.keepRecentTokens) ??
|
|
185
|
+
DEFAULT_KEEP_RECENT_TOKENS,
|
|
186
|
+
reserveTokens:
|
|
187
|
+
tokenSetting(override?.reserveTokens) ??
|
|
188
|
+
tokenSetting(compaction?.reserveTokens) ??
|
|
189
|
+
DEFAULT_COMPACTION_ECONOMICS.windowReserveTokens,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function isUserAbort(error: Error): boolean {
|
|
194
|
+
return error.name === "AbortError" || error.message === "Compaction cancelled";
|
|
195
|
+
}
|
|
196
|
+
|
|
234
197
|
export function createOnlineContextCompactExtension(options: OnlineContextCompactOptions = {}): ExtensionFactory {
|
|
235
|
-
const
|
|
198
|
+
const configuredKeepRecentTokens =
|
|
199
|
+
options.keepRecentTokens === undefined ? undefined : resolveKeepRecentTokens(options.keepRecentTokens);
|
|
236
200
|
const cacheWriteReadRatio = resolveCacheWriteReadRatio(options.cacheWriteReadRatio);
|
|
237
201
|
|
|
238
202
|
return (pi) => {
|
|
@@ -242,9 +206,10 @@ export function createOnlineContextCompactExtension(options: OnlineContextCompac
|
|
|
242
206
|
let pendingBoundary: PendingBoundary | undefined;
|
|
243
207
|
let selected: SelectedCompaction | undefined;
|
|
244
208
|
let activeDebt: CacheDebt | undefined;
|
|
209
|
+
let nextContinuation: PendingContinuation | undefined;
|
|
245
210
|
let compactionInFlight = false;
|
|
246
211
|
let compactionThinkingOverride: CompactionThinkingOverride | undefined;
|
|
247
|
-
let
|
|
212
|
+
let requestPending = false;
|
|
248
213
|
let compactionRefused = false;
|
|
249
214
|
|
|
250
215
|
const releaseContinuation = (): void => {
|
|
@@ -253,6 +218,10 @@ export function createOnlineContextCompactExtension(options: OnlineContextCompac
|
|
|
253
218
|
continuation?.resolve();
|
|
254
219
|
};
|
|
255
220
|
|
|
221
|
+
const releaseParentContinuation = (continuation: PendingContinuation | undefined): void => {
|
|
222
|
+
if (continuation) setTimeout(continuation.resolve, 0);
|
|
223
|
+
};
|
|
224
|
+
|
|
256
225
|
const restore = (context: ExtensionContext): void => {
|
|
257
226
|
releaseContinuation();
|
|
258
227
|
state = restoreOnlineState(context.sessionManager.getBranch());
|
|
@@ -263,12 +232,27 @@ export function createOnlineContextCompactExtension(options: OnlineContextCompac
|
|
|
263
232
|
selected = undefined;
|
|
264
233
|
activeDebt = undefined;
|
|
265
234
|
compactionInFlight = false;
|
|
235
|
+
requestPending = false;
|
|
266
236
|
compactionRefused = false;
|
|
267
237
|
};
|
|
268
238
|
const ensureRestored = (context: ExtensionContext): void => {
|
|
269
239
|
if (!restored) restore(context);
|
|
270
240
|
};
|
|
271
241
|
const save = (): void => appendOnlineState(pi, state);
|
|
242
|
+
// Pi 1.0 exposes its effective settings; Pi 0.84.2 does not, so it keeps the documented defaults.
|
|
243
|
+
const compactionSettings = (context: ExtensionContext): CompactionTokenSettings => {
|
|
244
|
+
const getSettings = (pi as SettingsSource).getSettings;
|
|
245
|
+
let settings: unknown;
|
|
246
|
+
try {
|
|
247
|
+
settings = typeof getSettings === "function" ? getSettings.call(pi) : undefined;
|
|
248
|
+
} catch {
|
|
249
|
+
settings = undefined;
|
|
250
|
+
}
|
|
251
|
+
const resolved = resolveCompactionTokenSettings(settings, context.model);
|
|
252
|
+
return configuredKeepRecentTokens === undefined
|
|
253
|
+
? resolved
|
|
254
|
+
: { ...resolved, keepRecentTokens: configuredKeepRecentTokens };
|
|
255
|
+
};
|
|
272
256
|
const contextTokens = (context: ExtensionContext): number => {
|
|
273
257
|
const visible = observedMessages.reduce((total, message) => total + estimateTokens(message), 0);
|
|
274
258
|
const estimated = visible + tokenEstimate(context.getSystemPrompt());
|
|
@@ -310,17 +294,31 @@ export function createOnlineContextCompactExtension(options: OnlineContextCompac
|
|
|
310
294
|
pi.on("session_before_tree", () => (compactionInFlight ? { cancel: true } : undefined));
|
|
311
295
|
pi.on("session_tree", (_event, context) => restore(context));
|
|
312
296
|
|
|
297
|
+
// Count a provider request only when it carries an agent-loop context. Pi builds each agent
|
|
298
|
+
// request with one context event before the provider sends it. A build that never reaches the
|
|
299
|
+
// provider, such as the one Pi still starts after this extension aborts at a boundary, is not
|
|
300
|
+
// a request. Pi 1.0 cache warming replays the last request through before_provider_request
|
|
301
|
+
// without a context event; a replay is not a request either.
|
|
313
302
|
pi.on("context", (event, context) => {
|
|
314
303
|
ensureRestored(context);
|
|
315
304
|
observedMessages = [...event.messages];
|
|
305
|
+
requestPending = !context.signal?.aborted;
|
|
316
306
|
});
|
|
317
307
|
|
|
318
308
|
pi.on("before_provider_request", (_event, context) => {
|
|
309
|
+
if (!requestPending) return;
|
|
310
|
+
requestPending = false;
|
|
319
311
|
ensureRestored(context);
|
|
320
312
|
state = recordProviderRequest(state, contextTokens(context));
|
|
321
313
|
save();
|
|
322
314
|
});
|
|
323
315
|
|
|
316
|
+
// The assistant message ends the request a context event started, whether or not it reached
|
|
317
|
+
// the provider, so a later replay cannot take its place.
|
|
318
|
+
pi.on("message_end", (event) => {
|
|
319
|
+
if (event.message.role === "assistant") requestPending = false;
|
|
320
|
+
});
|
|
321
|
+
|
|
324
322
|
pi.on("input", (event, context) => {
|
|
325
323
|
compactionRefused = false;
|
|
326
324
|
ensureRestored(context);
|
|
@@ -359,6 +357,7 @@ export function createOnlineContextCompactExtension(options: OnlineContextCompac
|
|
|
359
357
|
return;
|
|
360
358
|
}
|
|
361
359
|
|
|
360
|
+
const { keepRecentTokens, reserveTokens } = compactionSettings(context);
|
|
362
361
|
const usage = context.getContextUsage();
|
|
363
362
|
const writeTokens = contextTokens(context);
|
|
364
363
|
const archiveTokens = estimateNativeCompactionTokens(
|
|
@@ -392,7 +391,7 @@ export function createOnlineContextCompactExtension(options: OnlineContextCompac
|
|
|
392
391
|
carriedDebtTokens: state.cacheDebtTokens,
|
|
393
392
|
cacheDebtRepaymentTokens: state.cacheDebtRepaymentTokens,
|
|
394
393
|
cacheWriteReadRatio,
|
|
395
|
-
economics: DEFAULT_COMPACTION_ECONOMICS,
|
|
394
|
+
economics: { ...DEFAULT_COMPACTION_ECONOMICS, windowReserveTokens: reserveTokens },
|
|
396
395
|
});
|
|
397
396
|
const decision: CompactionDecision =
|
|
398
397
|
priced.compact && archiveTokens === 0
|
|
@@ -404,9 +403,41 @@ export function createOnlineContextCompactExtension(options: OnlineContextCompac
|
|
|
404
403
|
context.abort();
|
|
405
404
|
});
|
|
406
405
|
|
|
406
|
+
// Resume the parent task after a boundary compaction. Pi before 0.87 starts the requested turn
|
|
407
|
+
// synchronously, and this barrier keeps the settlement open until that turn settles. Pi 0.87+
|
|
408
|
+
// defers a turn requested from agent_settled until every settled handler has returned, keeps
|
|
409
|
+
// the session idle meanwhile, and awaits the turn before its own settlement completes, so
|
|
410
|
+
// waiting here would deadlock.
|
|
411
|
+
const continueParentTask = async (context: ExtensionContext, content: string): Promise<void> => {
|
|
412
|
+
let resolveContinuation!: () => void;
|
|
413
|
+
const continuation: PendingContinuation = {
|
|
414
|
+
promise: new Promise<void>((resolve) => {
|
|
415
|
+
resolveContinuation = resolve;
|
|
416
|
+
}),
|
|
417
|
+
resolve: () => resolveContinuation(),
|
|
418
|
+
};
|
|
419
|
+
nextContinuation = continuation;
|
|
420
|
+
try {
|
|
421
|
+
pi.sendMessage(
|
|
422
|
+
{ customType: "sol-pi-online-context-compact", content, display: false },
|
|
423
|
+
{ triggerTurn: true },
|
|
424
|
+
);
|
|
425
|
+
} catch (error) {
|
|
426
|
+
if (nextContinuation === continuation) nextContinuation = undefined;
|
|
427
|
+
continuation.resolve();
|
|
428
|
+
throw error;
|
|
429
|
+
}
|
|
430
|
+
if (context.isIdle()) {
|
|
431
|
+
if (nextContinuation === continuation) nextContinuation = undefined;
|
|
432
|
+
continuation.resolve();
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
await continuation.promise;
|
|
436
|
+
};
|
|
437
|
+
|
|
407
438
|
pi.on("agent_settled", async (_event, context) => {
|
|
408
|
-
//
|
|
409
|
-
//
|
|
439
|
+
// sendMessage() starts a turn without returning its promise. Capture the
|
|
440
|
+
// child settlement so print/JSON mode cannot dispose while it is running.
|
|
410
441
|
const parentContinuation = nextContinuation;
|
|
411
442
|
nextContinuation = undefined;
|
|
412
443
|
const pending = selected;
|
|
@@ -467,54 +498,20 @@ export function createOnlineContextCompactExtension(options: OnlineContextCompac
|
|
|
467
498
|
restoreCompactionThinking(pi, compactionThinkingOverride);
|
|
468
499
|
compactionThinkingOverride = undefined;
|
|
469
500
|
compactionInFlight = false;
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
compactionError &&
|
|
473
|
-
!recoverableError &&
|
|
474
|
-
compactionError.name !== "AbortError" &&
|
|
475
|
-
compactionError.message !== "Compaction cancelled"
|
|
476
|
-
) {
|
|
477
|
-
throw compactionError;
|
|
478
|
-
}
|
|
479
|
-
|
|
501
|
+
const failure = compactionError && !isUserAbort(compactionError) ? compactionError : undefined;
|
|
502
|
+
const recoverableError = failure !== undefined && RECOVERABLE_COMPACTION_ERRORS.has(failure.message);
|
|
480
503
|
if (recoverableError) {
|
|
481
504
|
compactionRefused = true;
|
|
482
|
-
pi.appendEntry("sol-pi-online-context-compact-skipped", { reason:
|
|
483
|
-
if (context.mode === "tui") context.ui.notify(`Online compaction skipped: ${
|
|
484
|
-
}
|
|
485
|
-
if (compacted || recoverableError) {
|
|
486
|
-
let resolveContinuation!: () => void;
|
|
487
|
-
const continuation: PendingContinuation = {
|
|
488
|
-
promise: new Promise<void>((resolve) => {
|
|
489
|
-
resolveContinuation = resolve;
|
|
490
|
-
}),
|
|
491
|
-
resolve: () => resolveContinuation(),
|
|
492
|
-
};
|
|
493
|
-
nextContinuation = continuation;
|
|
494
|
-
try {
|
|
495
|
-
pi.sendMessage(
|
|
496
|
-
{
|
|
497
|
-
customType: "sol-pi-online-context-compact",
|
|
498
|
-
content: compacted ? POST_COMPACTION_PLAN_REMINDER : SKIPPED_COMPACTION_REMINDER,
|
|
499
|
-
display: false,
|
|
500
|
-
},
|
|
501
|
-
{ triggerTurn: true },
|
|
502
|
-
);
|
|
503
|
-
} catch (error) {
|
|
504
|
-
if (nextContinuation === continuation) nextContinuation = undefined;
|
|
505
|
-
continuation.resolve();
|
|
506
|
-
throw error;
|
|
507
|
-
}
|
|
508
|
-
if (context.isIdle() && nextContinuation === continuation) {
|
|
509
|
-
// Newer Pi hosts defer runs until settled handlers return. Hand
|
|
510
|
-
// control back to that host instead of waiting on a deferred run.
|
|
511
|
-
nextContinuation = undefined;
|
|
512
|
-
continuation.resolve();
|
|
513
|
-
} else {
|
|
514
|
-
// Pi 0.85.1 starts synchronously; keep its print-mode barrier.
|
|
515
|
-
await continuation.promise;
|
|
516
|
-
}
|
|
505
|
+
pi.appendEntry("sol-pi-online-context-compact-skipped", { reason: failure!.message });
|
|
506
|
+
if (context.mode === "tui") context.ui.notify(`Online compaction skipped: ${failure!.message}`, "warning");
|
|
517
507
|
}
|
|
508
|
+
|
|
509
|
+
// The run was stopped for this compaction, so resume it unless the user cancelled.
|
|
510
|
+
// Known native refusals are recorded as skips; other failures still propagate after resuming.
|
|
511
|
+
if (compacted) await continueParentTask(context, POST_COMPACTION_PLAN_REMINDER);
|
|
512
|
+
else if (recoverableError) await continueParentTask(context, SKIPPED_COMPACTION_REMINDER);
|
|
513
|
+
else if (failure) await continueParentTask(context, COMPACTION_FAILED_RESUME_REMINDER);
|
|
514
|
+
if (failure && !recoverableError) throw failure;
|
|
518
515
|
} finally {
|
|
519
516
|
restoreCompactionThinking(pi, compactionThinkingOverride);
|
|
520
517
|
compactionThinkingOverride = undefined;
|
|
@@ -524,6 +521,15 @@ export function createOnlineContextCompactExtension(options: OnlineContextCompac
|
|
|
524
521
|
}
|
|
525
522
|
});
|
|
526
523
|
|
|
524
|
+
// Pi may run its own threshold compaction for a run this extension has already stopped for a
|
|
525
|
+
// selected boundary compaction: Pi 0.84.4+ before the run's next request, older Pi after the
|
|
526
|
+
// run when the aborted request ends with an error. That compaction would consume the
|
|
527
|
+
// selection, so the boundary would get no continuation. Let the selected compaction run from
|
|
528
|
+
// agent_settled instead.
|
|
529
|
+
pi.on("session_before_compact", (event) =>
|
|
530
|
+
selected && event.reason === "threshold" ? { cancel: true } : undefined,
|
|
531
|
+
);
|
|
532
|
+
|
|
527
533
|
pi.on("session_compact", (event, context) => {
|
|
528
534
|
ensureRestored(context);
|
|
529
535
|
compactionRefused = false;
|
|
@@ -535,6 +541,7 @@ export function createOnlineContextCompactExtension(options: OnlineContextCompac
|
|
|
535
541
|
pendingBoundary = undefined;
|
|
536
542
|
selected = undefined;
|
|
537
543
|
activeDebt = undefined;
|
|
544
|
+
requestPending = false;
|
|
538
545
|
observedMessages = [];
|
|
539
546
|
});
|
|
540
547
|
|
|
@@ -546,6 +553,7 @@ export function createOnlineContextCompactExtension(options: OnlineContextCompac
|
|
|
546
553
|
selected = undefined;
|
|
547
554
|
activeDebt = undefined;
|
|
548
555
|
compactionInFlight = false;
|
|
556
|
+
requestPending = false;
|
|
549
557
|
});
|
|
550
558
|
};
|
|
551
559
|
}
|
package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/projection.ts
CHANGED
|
@@ -3,7 +3,33 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
|
6
|
-
import
|
|
6
|
+
import * as pi from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import { estimateTokens, findCutPoint, sessionEntryToContextMessages, type SessionEntry } from "@earendil-works/pi-coding-agent";
|
|
8
|
+
|
|
9
|
+
type ProjectedEntry = { readonly sourceEntry: SessionEntry; readonly messages: readonly AgentMessage[] };
|
|
10
|
+
type ProjectionApi = {
|
|
11
|
+
readonly buildSessionProjection?: (entries: SessionEntry[]) => { readonly entries: readonly ProjectedEntry[] };
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** Pi 1.0 applies context edits before choosing a cut; older Pi uses raw messages. */
|
|
15
|
+
function contextEntries(entries: readonly SessionEntry[]): readonly ProjectedEntry[] {
|
|
16
|
+
// SAFETY: Pi 1.x publicly returns sourceEntry/messages pairs; older Pi omits this API and uses the fallback below.
|
|
17
|
+
const buildProjection = (pi as unknown as ProjectionApi).buildSessionProjection;
|
|
18
|
+
if (buildProjection) return buildProjection([...entries]).entries;
|
|
19
|
+
const lastCompaction = entries.findLastIndex((entry) => entry.type === "compaction");
|
|
20
|
+
let active = entries;
|
|
21
|
+
if (lastCompaction >= 0) {
|
|
22
|
+
const compaction = entries[lastCompaction];
|
|
23
|
+
if (compaction?.type === "compaction") {
|
|
24
|
+
const firstKept = entries.findIndex((entry) => entry.id === compaction.firstKeptEntryId);
|
|
25
|
+
active = [compaction, ...(firstKept >= 0 ? entries.slice(firstKept, lastCompaction) : []), ...entries.slice(lastCompaction + 1)];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return active.map((sourceEntry, index) => ({
|
|
29
|
+
sourceEntry,
|
|
30
|
+
messages: sourceEntry.type === "compaction" && index > 0 ? [] : sessionEntryToContextMessages(sourceEntry),
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
7
33
|
|
|
8
34
|
/** ObservationPack changes tool-result content while preserving its call identity. */
|
|
9
35
|
function messageKey(message: AgentMessage): string {
|
|
@@ -17,22 +43,14 @@ export function projectedEntryTokens(
|
|
|
17
43
|
entries: readonly SessionEntry[],
|
|
18
44
|
projected: readonly AgentMessage[],
|
|
19
45
|
): ReadonlyMap<string, number> {
|
|
20
|
-
const lastCompaction = entries.findLastIndex((entry) => entry.type === "compaction");
|
|
21
|
-
let active = entries;
|
|
22
|
-
if (lastCompaction >= 0) {
|
|
23
|
-
const compaction = entries[lastCompaction];
|
|
24
|
-
if (compaction?.type === "compaction") {
|
|
25
|
-
const firstKept = entries.findIndex((entry) => entry.id === compaction.firstKeptEntryId);
|
|
26
|
-
active = [compaction, ...(firstKept >= 0 ? entries.slice(firstKept, lastCompaction) : []), ...entries.slice(lastCompaction + 1)];
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
46
|
const sources = new Map<string, string[]>();
|
|
30
|
-
for (const
|
|
31
|
-
|
|
32
|
-
|
|
47
|
+
for (const { sourceEntry, messages } of contextEntries(entries)) {
|
|
48
|
+
for (const message of messages) {
|
|
49
|
+
// A compaction preserves its system checkpoint; only its summary is replaced.
|
|
50
|
+
if (String(message.role) === "system") continue;
|
|
33
51
|
const key = messageKey(message);
|
|
34
52
|
const ids = sources.get(key) ?? [];
|
|
35
|
-
ids.push(
|
|
53
|
+
ids.push(sourceEntry.id);
|
|
36
54
|
sources.set(key, ids);
|
|
37
55
|
}
|
|
38
56
|
}
|
|
@@ -56,3 +74,59 @@ export function projectedEntryTokens(
|
|
|
56
74
|
}
|
|
57
75
|
return tokens;
|
|
58
76
|
}
|
|
77
|
+
|
|
78
|
+
/** Materialize Pi's canonical messages for its public cut-point helper. */
|
|
79
|
+
function cutEntries(projected: readonly ProjectedEntry[]): SessionEntry[] {
|
|
80
|
+
return projected.map(({ sourceEntry, messages }) => {
|
|
81
|
+
if (sourceEntry.type === "compaction") {
|
|
82
|
+
// The latest checkpoint is outside the cut range. Retained older checkpoints
|
|
83
|
+
// are invisible, but their entry type still stops metadata-boundary movement.
|
|
84
|
+
return { ...sourceEntry, summary: "", systemMessage: undefined };
|
|
85
|
+
}
|
|
86
|
+
const message = messages[0];
|
|
87
|
+
if (message) return { ...sourceEntry, type: "message", message } as SessionEntry;
|
|
88
|
+
return { ...sourceEntry, type: "custom", customType: "sol-pi-projection-empty", data: undefined } as SessionEntry;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Price the prefix Pi can remove, using its canonical projection for the cut and
|
|
94
|
+
* the last observed extension projection for savings. No context hook runs twice.
|
|
95
|
+
*/
|
|
96
|
+
export function estimateProjectedCompactionTokens(
|
|
97
|
+
entries: readonly SessionEntry[],
|
|
98
|
+
keepRecentTokens: number,
|
|
99
|
+
projectedMessages?: readonly AgentMessage[],
|
|
100
|
+
): number {
|
|
101
|
+
const projected = contextEntries(entries);
|
|
102
|
+
const path = cutEntries(projected);
|
|
103
|
+
const previous = projected.findIndex(({ sourceEntry, messages }) => sourceEntry.type === "compaction" && messages.length > 0);
|
|
104
|
+
const start = previous >= 0 ? previous + 1 : 0;
|
|
105
|
+
// The agent can append an empty aborted assistant after OCC stops the turn.
|
|
106
|
+
// It contributes no tokens but makes the same trailing cut available to Pi.
|
|
107
|
+
path.push({
|
|
108
|
+
type: "message", id: "sol-pi-online-context-compact-abort-marker", parentId: path.at(-1)?.id ?? null,
|
|
109
|
+
timestamp: new Date(0).toISOString(),
|
|
110
|
+
message: { role: "assistant", content: [], api: "sol-pi", provider: "sol-pi", model: "aborted",
|
|
111
|
+
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 0,
|
|
112
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } }, stopReason: "aborted", timestamp: 0 },
|
|
113
|
+
} as SessionEntry);
|
|
114
|
+
// Pi 1.0 can additionally advance through a closed recovery-omission suffix.
|
|
115
|
+
// Its public helper may keep that suffix; conservatively price the smaller prefix.
|
|
116
|
+
const cut = findCutPoint(path, start, path.length, keepRecentTokens).firstKeptEntryIndex;
|
|
117
|
+
const prefix = projected.slice(start, cut);
|
|
118
|
+
// System messages survive as the next checkpoint and are never summarized.
|
|
119
|
+
const removable = (entry: ProjectedEntry): readonly AgentMessage[] =>
|
|
120
|
+
entry.sourceEntry.type === "compaction" ? [] : entry.messages.filter((message) => String(message.role) !== "system");
|
|
121
|
+
if (!prefix.some((entry) => removable(entry).length > 0)) return 0;
|
|
122
|
+
const sizes = projectedMessages === undefined ? undefined : projectedEntryTokens(entries, projectedMessages);
|
|
123
|
+
const prefixTokens = prefix.reduce((total, entry) => total + (sizes
|
|
124
|
+
? sizes.get(entry.sourceEntry.id) ?? 0
|
|
125
|
+
: removable(entry).reduce((sum, message) => sum + estimateTokens(message), 0)), 0);
|
|
126
|
+
const previousEntry = projected[previous];
|
|
127
|
+
const previousTokens = previousEntry ? (sizes
|
|
128
|
+
? sizes.get(previousEntry.sourceEntry.id) ?? 0
|
|
129
|
+
: previousEntry.messages.filter((message) => message.role === "compactionSummary")
|
|
130
|
+
.reduce((sum, message) => sum + estimateTokens(message), 0)) : 0;
|
|
131
|
+
return prefixTokens + previousTokens;
|
|
132
|
+
}
|
package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/tools.ts
CHANGED
|
@@ -45,8 +45,17 @@ const planStepSchema = Type.Object(
|
|
|
45
45
|
{ additionalProperties: false },
|
|
46
46
|
);
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Pi 1.0 tool exposure: keep update_plan declared to the model, including in codemode `only` mode,
|
|
50
|
+
* and never callable from codemode scripts. A script call gets a nested `<parent>/<n>` id that no
|
|
51
|
+
* turn reports as a tool result, so its plan boundary could never compact. Pi 0.84.2 has no
|
|
52
|
+
* exposure field and ignores it; spreading a constant keeps its tool type free of the property.
|
|
53
|
+
*/
|
|
54
|
+
const MODEL_ONLY_EXPOSURE = { exposure: "model-only" } as const;
|
|
55
|
+
|
|
48
56
|
export function registerOnlineTools(pi: ExtensionAPI, handlers: OnlineToolHandlers): void {
|
|
49
57
|
pi.registerTool({
|
|
58
|
+
...MODEL_ONLY_EXPOSURE,
|
|
50
59
|
name: "update_plan",
|
|
51
60
|
label: "Update plan",
|
|
52
61
|
description:
|
|
@@ -3,15 +3,20 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { getAgentDir, type ExtensionAPI, type ExtensionContext, type ExtensionFactory } from "@earendil-works/pi-coding-agent";
|
|
6
|
+
import { getAgentDir, type BashToolOptions, type ExtensionAPI, type ExtensionContext, type ExtensionFactory } from "@earendil-works/pi-coding-agent";
|
|
7
7
|
import { loadSolPiConfig, type SolPiConfig } from "./config.ts";
|
|
8
|
-
import {
|
|
8
|
+
import { createActionFusionExtension } from "./extensions/action-fusion/index.ts";
|
|
9
|
+
import { loadActionFusionBashOptions } from "./shell-options.ts";
|
|
9
10
|
import { registerEvidencePreservingReducer } from "./extensions/evidence-preserving-reducer/index.ts";
|
|
10
11
|
import { registerObservationPack } from "./extensions/observation-pack/index.ts";
|
|
11
12
|
import { registerOnlineContextCompact } from "./extensions/online-context-compact/index.ts";
|
|
12
13
|
|
|
13
|
-
export function registerConfiguredFeatures(
|
|
14
|
-
|
|
14
|
+
export function registerConfiguredFeatures(
|
|
15
|
+
pi: ExtensionAPI,
|
|
16
|
+
config: SolPiConfig,
|
|
17
|
+
bashOptions?: BashToolOptions,
|
|
18
|
+
): void {
|
|
19
|
+
if (config.actionFusion) createActionFusionExtension({ bashOptions })(pi);
|
|
15
20
|
if (config.observationPack) registerObservationPack(pi);
|
|
16
21
|
if (config.evidencePreservingReducer) {
|
|
17
22
|
registerEvidencePreservingReducer(pi, {
|
|
@@ -31,8 +36,12 @@ export function createSolPiExtension(
|
|
|
31
36
|
let initialized = false;
|
|
32
37
|
pi.on("session_start", (_event, ctx) => {
|
|
33
38
|
if (initialized) return;
|
|
39
|
+
const config = loadConfig(ctx);
|
|
40
|
+
const bashOptions = config.actionFusion
|
|
41
|
+
? loadActionFusionBashOptions(ctx.cwd, ctx.isProjectTrusted())
|
|
42
|
+
: undefined;
|
|
34
43
|
initialized = true;
|
|
35
|
-
registerConfiguredFeatures(pi,
|
|
44
|
+
registerConfiguredFeatures(pi, config, bashOptions);
|
|
36
45
|
});
|
|
37
46
|
};
|
|
38
47
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
import { getAgentDir, SettingsManager, type BashToolOptions } from "@earendil-works/pi-coding-agent";
|
|
6
|
+
|
|
7
|
+
/** Inherit Pi's file-backed shell settings without trusting unapproved project settings. */
|
|
8
|
+
export function loadActionFusionBashOptions(
|
|
9
|
+
cwd: string,
|
|
10
|
+
projectTrusted: boolean,
|
|
11
|
+
agentDir: string = getAgentDir(),
|
|
12
|
+
): BashToolOptions {
|
|
13
|
+
const settings = SettingsManager.create(cwd, agentDir, { projectTrusted });
|
|
14
|
+
const errors = settings.drainErrors();
|
|
15
|
+
if (errors.length > 0) {
|
|
16
|
+
throw new Error(`Action Fusion could not load Pi shell settings: ${errors.map(({ error }) => error.message).join("; ")}`);
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
shellPath: settings.getShellPath(),
|
|
20
|
+
commandPrefix: settings.getShellCommandPrefix(),
|
|
21
|
+
};
|
|
22
|
+
}
|