@herbertgao/pi-extensions 2026.10.6 → 2026.10.8
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 +11 -15
- package/THIRD_PARTY_NOTICES.md +2 -54
- package/extensions/clef-format.mjs +113 -0
- package/extensions/clef.mjs +112 -0
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-debt.md +1 -1
- package/node_modules/@dietrichgebert/ponytail/.opencode/plugins/ponytail.mjs +30 -6
- package/node_modules/@dietrichgebert/ponytail/.qoder-plugin/plugin.json +1 -1
- package/node_modules/@dietrichgebert/ponytail/README.md +5 -1
- package/node_modules/@dietrichgebert/ponytail/hooks/claude-codex-hooks.json +3 -3
- package/node_modules/@dietrichgebert/ponytail/hooks/copilot-hooks.json +4 -4
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-activate.js +158 -127
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-config.js +5 -0
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-map.js +8 -3
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-runtime.js +14 -8
- package/node_modules/@dietrichgebert/ponytail/package.json +1 -1
- package/node_modules/@dietrichgebert/ponytail/pi-extension/index.js +16 -3
- package/node_modules/@dietrichgebert/ponytail/scripts/cursor-hooks.js +13 -3
- package/node_modules/@dietrichgebert/ponytail/scripts/uninstall.js +3 -2
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-debt/SKILL.md +3 -3
- package/node_modules/@herbertgao/pi-agency/package.json +2 -2
- package/node_modules/@herbertgao/pi-bark/package.json +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +29 -28
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +7 -7
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +16 -27
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +49 -48
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +2 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +228 -141
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/index.ts +2 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer-layout.ts +105 -23
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +59 -43
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/prompt-editor.ts +96 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/index.ts +6 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +124 -54
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +7 -4
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +69 -28
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/scroll.ts +23 -8
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/sticky-prompt.ts +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +24 -12
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +121 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-limits.ts +3 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-palette.ts +39 -8
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-presentation.ts +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +13 -13
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/message-display.ts +3 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/names.ts +49 -49
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/result.ts +24 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-state.ts +51 -2
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +5 -5
- package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark.json +71 -70
- package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light.json +71 -70
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +8 -0
- package/node_modules/@herbertgao/pi-subagents/docs/packages.md +211 -0
- package/node_modules/@herbertgao/pi-subagents/docs/rpc.md +61 -63
- package/node_modules/@herbertgao/pi-subagents/docs/workflows.md +24 -16
- package/node_modules/@herbertgao/pi-subagents/package.json +5 -5
- package/node_modules/@herbertgao/pi-subagents/src/agent-file-toggle.ts +51 -14
- package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +123 -55
- package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +144 -13
- package/node_modules/@herbertgao/pi-subagents/src/agent-source-badge.ts +78 -0
- package/node_modules/@herbertgao/pi-subagents/src/completion-outbox.ts +122 -0
- package/node_modules/@herbertgao/pi-subagents/src/custom-agents.ts +171 -79
- package/node_modules/@herbertgao/pi-subagents/src/index.ts +597 -296
- package/node_modules/@herbertgao/pi-subagents/src/package-resources.ts +724 -0
- package/node_modules/@herbertgao/pi-subagents/src/schedule.ts +1 -1
- package/node_modules/@herbertgao/pi-subagents/src/settings.ts +66 -0
- package/node_modules/@herbertgao/pi-subagents/src/types.ts +26 -4
- package/node_modules/@herbertgao/pi-subagents/src/ui/agent-widget.ts +2 -0
- package/node_modules/@herbertgao/pi-subagents/src/ui/conversation-viewer.ts +354 -32
- package/node_modules/@herbertgao/pi-subagents/src/ui/fleet-list.ts +33 -15
- package/node_modules/@herbertgao/pi-subagents/src/workflow/host.ts +6 -0
- package/node_modules/@herbertgao/pi-subagents/src/workflow/saved.ts +48 -2
- package/node_modules/@herbertgao/sol-pi/package.json +2 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/README.md +3 -3
- package/node_modules/@juicesharp/rpiv-ask-user-question/ask-user-question.ts +89 -39
- package/node_modules/@juicesharp/rpiv-ask-user-question/docs/configuration.md +1 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/docs/hosts.md +4 -4
- package/node_modules/@juicesharp/rpiv-ask-user-question/docs/keyboard.md +56 -23
- package/node_modules/@juicesharp/rpiv-ask-user-question/docs/tool-schema.md +6 -3
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/de.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/en.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/es.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/fr.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/pt-BR.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/pt.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/ru.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/uk.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/locales/zh.json +3 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +5 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/presentation.ts +122 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/rpc-fallback.ts +73 -36
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/build-questionnaire.ts +10 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/key-router.ts +15 -13
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/questionnaire-session.ts +5 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/selectors/derivations.ts +15 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/selectors/projections.ts +4 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/state-reducer.ts +29 -18
- package/node_modules/@juicesharp/rpiv-ask-user-question/state/state.ts +1 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/tool/format-answer.ts +5 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/tool/normalize-params.ts +46 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/tool/response-envelope.ts +19 -8
- package/node_modules/@juicesharp/rpiv-ask-user-question/tool/types.ts +9 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/multi-select-view.ts +4 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/preview/preview-block-renderer.ts +56 -25
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/preview/preview-pane.ts +131 -46
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/dialog-builder.ts +94 -106
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/dialog-copy.ts +51 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/scroll-window.ts +73 -0
- package/node_modules/@juicesharp/rpiv-ask-user-question/view/tab-content-strategy.ts +31 -10
- package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts.map +1 -1
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +474 -93
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -1
- package/node_modules/@pi-plugins/fast-mode/package.json +1 -1
- package/node_modules/@tifan/pi-inline-skills/package.json +5 -1
- package/node_modules/@tifan/pi-inline-skills/src/index.ts +5 -2
- package/node_modules/pi-lens/CHANGELOG.md +88 -0
- package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +3 -1
- package/node_modules/pi-lens/dist/{chunk-BJF25SUG.js → chunk-23WOO7TX.js} +11 -10
- package/node_modules/pi-lens/dist/{chunk-WATC3IQR.js → chunk-2B73ZPOK.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-N2IRDBZI.js → chunk-2BBLFX75.js} +101 -11
- package/node_modules/pi-lens/dist/{chunk-TA5L5KWQ.js → chunk-2CD5RS6M.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-3TTPKMEF.js → chunk-2VUQMUMT.js} +38 -37
- package/node_modules/pi-lens/dist/{chunk-5JHXUETW.js → chunk-3EFKIGZN.js} +3 -3
- package/node_modules/pi-lens/dist/chunk-3JNKMP3B.js +17 -0
- package/node_modules/pi-lens/dist/{chunk-6P54TMWL.js → chunk-3VPVG5SU.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-ZETYB3XG.js → chunk-3W7IEVVL.js} +44 -28
- package/node_modules/pi-lens/dist/chunk-3YN6V5TV.js +85 -0
- package/node_modules/pi-lens/dist/chunk-466Z26MG.js +30 -0
- package/node_modules/pi-lens/dist/{chunk-PCHDGUKT.js → chunk-4UNXBNE2.js} +12 -11
- package/node_modules/pi-lens/dist/{chunk-J7WJZ6W7.js → chunk-4W4VLAPJ.js} +12 -11
- package/node_modules/pi-lens/dist/{chunk-F5VLZHUW.js → chunk-52FUZI6K.js} +4 -2
- package/node_modules/pi-lens/dist/{chunk-H5EV3VMF.js → chunk-5NGR67U5.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-CBD2B5CP.js → chunk-5UCAH366.js} +21 -20
- package/node_modules/pi-lens/dist/{chunk-BHWHXMQ2.js → chunk-67WMNWEE.js} +9 -8
- package/node_modules/pi-lens/dist/{chunk-USHG4DLH.js → chunk-6C7JWPCP.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-VPWKF3GN.js → chunk-6GFRNVYR.js} +11 -10
- package/node_modules/pi-lens/dist/{chunk-3JL6IFD7.js → chunk-6SDEP3AJ.js} +9 -8
- package/node_modules/pi-lens/dist/{chunk-NJF2X5XF.js → chunk-6STA6Z7I.js} +19 -17
- package/node_modules/pi-lens/dist/{chunk-KJCWXUUS.js → chunk-724UL2TJ.js} +6 -4
- package/node_modules/pi-lens/dist/{chunk-MQA2YBAH.js → chunk-76MWC2K6.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-YLN4K6WD.js → chunk-77M37OKR.js} +10 -8
- package/node_modules/pi-lens/dist/{chunk-XHSCVSOL.js → chunk-7DYBLXYA.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-OC7LYAU5.js → chunk-AB3YYG6N.js} +24 -10
- package/node_modules/pi-lens/dist/{chunk-LD7WFTRX.js → chunk-ACXEQZOU.js} +16 -16
- package/node_modules/pi-lens/dist/{chunk-VSMJK3ZJ.js → chunk-AOHZU2BM.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-T4QZ6FEH.js → chunk-AW7R2GWG.js} +65 -8
- package/node_modules/pi-lens/dist/{chunk-GAYGGICG.js → chunk-BKE7E7TC.js} +10 -9
- package/node_modules/pi-lens/dist/{chunk-EUT3B22Y.js → chunk-BRGDSBJE.js} +13 -12
- package/node_modules/pi-lens/dist/{chunk-T54VJRAD.js → chunk-C34ZXZ7O.js} +55 -11
- package/node_modules/pi-lens/dist/{chunk-UGSMCQ4D.js → chunk-CHOW74WE.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-H2W2AXD3.js → chunk-CMMHNUZ2.js} +66 -58
- package/node_modules/pi-lens/dist/chunk-CSHFH5IN.js +17 -0
- package/node_modules/pi-lens/dist/chunk-EC47DWFA.js +56 -0
- package/node_modules/pi-lens/dist/{chunk-KJN4IOEJ.js → chunk-EJIUXPBX.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-IQZXOZ7S.js → chunk-EU63SDCG.js} +720 -334
- package/node_modules/pi-lens/dist/{chunk-LNOMA3MP.js → chunk-FCSOVF55.js} +107 -3
- package/node_modules/pi-lens/dist/{chunk-CFYISHUW.js → chunk-FLKWCIZH.js} +8 -5
- package/node_modules/pi-lens/dist/{chunk-OYTMZXRF.js → chunk-FMSO6RDZ.js} +16 -14
- package/node_modules/pi-lens/dist/{chunk-IUKPRZER.js → chunk-GAEGEPOC.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-6XX5HCLK.js → chunk-GBPP5P7X.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-TQFBZVCG.js → chunk-GXW6K4YJ.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-ZZUFZUQZ.js → chunk-H6MF6EVN.js} +331 -107
- package/node_modules/pi-lens/dist/{chunk-3JSEWUWI.js → chunk-IBGIOBEE.js} +3 -3
- package/node_modules/pi-lens/dist/chunk-IZSHAIJ7.js +26 -0
- package/node_modules/pi-lens/dist/{chunk-7ELY2CSM.js → chunk-JAU72XNY.js} +16 -14
- package/node_modules/pi-lens/dist/chunk-JMYYOTQG.js +77 -0
- package/node_modules/pi-lens/dist/{chunk-ELVWJYRV.js → chunk-JSQFTSC6.js} +12 -11
- package/node_modules/pi-lens/dist/{chunk-J6DFZDFA.js → chunk-KBG47GHP.js} +4 -4
- package/node_modules/pi-lens/dist/chunk-KDERNTCQ.js +28 -0
- package/node_modules/pi-lens/dist/chunk-KSX3TXSZ.js +69 -0
- package/node_modules/pi-lens/dist/{chunk-XGUL4SLQ.js → chunk-L3BLXZG7.js} +2 -2
- package/node_modules/pi-lens/dist/chunk-LOP6GRPH.js +31 -0
- package/node_modules/pi-lens/dist/{chunk-MTDRLSI7.js → chunk-M6HSLBWY.js} +1064 -986
- package/node_modules/pi-lens/dist/chunk-MQLUAEOC.js +162 -0
- package/node_modules/pi-lens/dist/{chunk-3MRXIJ6I.js → chunk-MRXKYPCS.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-D65GOCJB.js → chunk-MXGY6KPT.js} +19 -16
- package/node_modules/pi-lens/dist/{chunk-G3RLJYA2.js → chunk-N2H3ZPZY.js} +47 -1
- package/node_modules/pi-lens/dist/{chunk-HREZQCT3.js → chunk-N3X6Q4YT.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-HSIRMK2D.js → chunk-OCAGUNBC.js} +15 -15
- package/node_modules/pi-lens/dist/{chunk-ZOEYVXSV.js → chunk-OXXKQCSV.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-S6AMWKPC.js → chunk-P7266HLM.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-64LU2OVH.js → chunk-PHDMFAKM.js} +12 -2
- package/node_modules/pi-lens/dist/{chunk-IMSQR4WO.js → chunk-PNQDPDRC.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-IUR76K6A.js → chunk-Q7DUK4LX.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-CULQYFLU.js → chunk-QGQ5CCCG.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-UEAHAMEI.js → chunk-QHJ6DQ2R.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-BNKLYOOO.js → chunk-QILIYSJF.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-VYKKMYVT.js → chunk-QOBUHWHX.js} +11 -6
- package/node_modules/pi-lens/dist/{chunk-3PNFWVHT.js → chunk-QQNQ7SJW.js} +2 -75
- package/node_modules/pi-lens/dist/{chunk-7M4T5N3V.js → chunk-R3PCY3YS.js} +14 -13
- package/node_modules/pi-lens/dist/{chunk-MGIWSROG.js → chunk-RPLINGVB.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-CMU4RMJB.js → chunk-RWWYJ623.js} +10 -1
- package/node_modules/pi-lens/dist/{chunk-3FERWMCH.js → chunk-RXCOMYPY.js} +27 -26
- package/node_modules/pi-lens/dist/{chunk-7BX5DWSA.js → chunk-SAEFPSB6.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-N7YNJE5R.js → chunk-SQ4TVJBR.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-DMS52BEP.js → chunk-SS36ZX4J.js} +9 -7
- package/node_modules/pi-lens/dist/{chunk-JONGANYH.js → chunk-T6CPIZNT.js} +32 -30
- package/node_modules/pi-lens/dist/{chunk-6UYA642J.js → chunk-TYM6OUIT.js} +13 -12
- package/node_modules/pi-lens/dist/{chunk-ALQRYH6O.js → chunk-UXGETRP4.js} +13 -12
- package/node_modules/pi-lens/dist/{chunk-FGALODG3.js → chunk-UZ3TUTRV.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-J3FZR3YY.js → chunk-VCHXCQFG.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-3P4PF2BX.js → chunk-VCO24T4L.js} +34 -22
- package/node_modules/pi-lens/dist/{chunk-O7HZX7CA.js → chunk-VRZP76YM.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-VZHJS6DR.js → chunk-VSSBEUFT.js} +16 -15
- package/node_modules/pi-lens/dist/{chunk-U52SAGRM.js → chunk-VWCXW2E7.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-WW5BLB74.js → chunk-WOA4LN2R.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-ZMOMPX2Z.js → chunk-WU567RSC.js} +11 -10
- package/node_modules/pi-lens/dist/{chunk-N77WFUL7.js → chunk-XAGLWMJ4.js} +23 -22
- package/node_modules/pi-lens/dist/{chunk-WSEWKCXU.js → chunk-XCJN5IJU.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-IR6XFA5P.js → chunk-XIJZVPD5.js} +16 -14
- package/node_modules/pi-lens/dist/{chunk-OYOB3ZFG.js → chunk-XMSXXAHW.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-34OCDWOS.js → chunk-XTMJ7XDT.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-Z6BB4JLQ.js → chunk-XVF2VVXP.js} +5 -3
- package/node_modules/pi-lens/dist/{chunk-AFZYMAIV.js → chunk-YIUAVF7E.js} +37 -35
- package/node_modules/pi-lens/dist/{chunk-NFXP47RV.js → chunk-YSZNHOBY.js} +85 -31
- package/node_modules/pi-lens/dist/{chunk-V5MEBST3.js → chunk-YYOIQFRS.js} +21 -21
- package/node_modules/pi-lens/dist/chunk-Z527N6YQ.js +28 -0
- package/node_modules/pi-lens/dist/{chunk-D6YF5HKX.js → chunk-ZANLILYD.js} +22 -2
- package/node_modules/pi-lens/dist/{chunk-2UMYMRI3.js → chunk-ZGDGW2V3.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-6B5I6ICN.js → chunk-ZHFZWTZV.js} +12 -11
- package/node_modules/pi-lens/dist/{chunk-OEX24ECI.js → chunk-ZWFS3OEF.js} +51 -41
- package/node_modules/pi-lens/dist/{chunk-AXKPQ6ZI.js → chunk-ZXYDQ3TZ.js} +5 -5
- package/node_modules/pi-lens/dist/index.js +73783 -71033
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +18 -8
- package/node_modules/pi-lens/dist/mcp/cli.js +48 -37
- package/node_modules/pi-lens/dist/mcp/server.js +568 -397
- package/node_modules/pi-lens/dist/mcp/worker.js +67 -55
- package/node_modules/pi-lens/dist/probes/installer.js +20 -19
- package/node_modules/pi-lens/docs/astplayground.md +1 -1
- package/node_modules/pi-lens/docs/configuration.md +29 -0
- package/node_modules/pi-lens/docs/dependencies.md +3 -0
- package/node_modules/pi-lens/docs/features.md +2 -2
- package/node_modules/pi-lens/docs/globalconfig.md +2 -0
- package/node_modules/pi-lens/docs/language-coverage.md +2 -1
- package/node_modules/pi-lens/docs/lsp-capability-matrix.md +29 -7
- package/node_modules/pi-lens/docs/lsp-idle-eviction.md +38 -47
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +4 -0
- package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +17 -4
- package/node_modules/pi-lens/docs/pi-lens-retro.md +2 -1
- package/node_modules/pi-lens/docs/pi-lens-reviewer.md +18 -0
- package/node_modules/pi-lens/docs/pi-lens-subagent.md +7 -0
- package/node_modules/pi-lens/docs/real-harness.md +17 -0
- package/node_modules/pi-lens/docs/schema/pi-lens-config-v1.json +37 -2
- package/node_modules/pi-lens/docs/servercapabilities.md +15 -4
- package/node_modules/pi-lens/docs/settings.md +2 -1
- package/node_modules/pi-lens/package.json +1 -1
- package/node_modules/pi-provider-qoder/dist/index.js +166 -33
- package/node_modules/pi-provider-qoder/package.json +1 -1
- package/node_modules/pi-typesafe/README.md +3 -3
- package/node_modules/pi-typesafe/dist/backends.d.ts +7 -2
- package/node_modules/pi-typesafe/dist/backends.js +42 -0
- package/node_modules/pi-typesafe/dist/batch.d.ts +10 -6
- package/node_modules/pi-typesafe/dist/batch.js +20 -9
- package/node_modules/pi-typesafe/dist/client.d.ts +4 -1
- package/node_modules/pi-typesafe/dist/client.js +5 -4
- package/node_modules/pi-typesafe/dist/index.d.ts +2 -2
- package/node_modules/pi-typesafe/dist/index.js +1 -1
- package/node_modules/pi-typesafe/dist/schema.d.ts +18 -3
- package/node_modules/pi-typesafe/dist/schema.js +29 -3
- package/node_modules/pi-typesafe/package.json +1 -1
- package/node_modules/pi-web-access/CHANGELOG.md +66 -0
- package/node_modules/pi-web-access/README.md +17 -8
- package/node_modules/pi-web-access/brave.ts +20 -2
- package/node_modules/pi-web-access/content-find.ts +2 -1
- package/node_modules/pi-web-access/dist/index.js +668 -408
- package/node_modules/pi-web-access/dist/mcp-cli.js +666 -418
- package/node_modules/pi-web-access/duckduckgo.ts +5 -1
- package/node_modules/pi-web-access/endpoint-pdf-extract.ts +225 -0
- package/node_modules/pi-web-access/extract.ts +54 -14
- package/node_modules/pi-web-access/fetch-params.ts +10 -0
- package/node_modules/pi-web-access/gemini-api.ts +15 -0
- package/node_modules/pi-web-access/gemini-search.ts +32 -152
- package/node_modules/pi-web-access/github-issue-pr.ts +80 -68
- package/node_modules/pi-web-access/index.ts +3 -0
- package/node_modules/pi-web-access/package.json +1 -1
- package/node_modules/pi-web-access/pdf-extract.ts +38 -4
- package/node_modules/pi-web-access/perplexity.ts +19 -2
- package/node_modules/pi-web-access/searxng.ts +2 -1
- package/node_modules/pi-web-access/ssrf-protection.ts +35 -4
- package/node_modules/pi-web-access/summary-review.ts +10 -0
- package/node_modules/pi-web-access/tool-arguments.ts +5 -2
- package/node_modules/pi-web-access/video-extract.ts +6 -2
- package/node_modules/pi-web-access/web-tool-core.ts +53 -13
- package/package.json +21 -26
- package/node_modules/pi-jev-auto-mode/CHANGELOG.md +0 -118
- package/node_modules/pi-jev-auto-mode/LICENSE +0 -21
- package/node_modules/pi-jev-auto-mode/README.md +0 -292
- package/node_modules/pi-jev-auto-mode/SECURITY.md +0 -32
- package/node_modules/pi-jev-auto-mode/docs/calibration.md +0 -154
- package/node_modules/pi-jev-auto-mode/docs/design.md +0 -164
- package/node_modules/pi-jev-auto-mode/docs/security.md +0 -124
- package/node_modules/pi-jev-auto-mode/index.ts +0 -1
- package/node_modules/pi-jev-auto-mode/package.json +0 -72
- package/node_modules/pi-jev-auto-mode/src/call.ts +0 -180
- package/node_modules/pi-jev-auto-mode/src/decide.ts +0 -86
- package/node_modules/pi-jev-auto-mode/src/extension.ts +0 -881
- package/node_modules/pi-jev-auto-mode/src/intent.ts +0 -71
- package/node_modules/pi-jev-auto-mode/src/jev/availability.ts +0 -53
- package/node_modules/pi-jev-auto-mode/src/jev/criteria.ts +0 -19
- package/node_modules/pi-jev-auto-mode/src/jev/decide.ts +0 -187
- package/node_modules/pi-jev-auto-mode/src/jev/engine.ts +0 -165
- package/node_modules/pi-jev-auto-mode/src/jev/index.ts +0 -20
- package/node_modules/pi-jev-auto-mode/src/jev/questions.ts +0 -273
- package/node_modules/pi-jev-auto-mode/src/jev/response.ts +0 -64
- package/node_modules/pi-jev-auto-mode/src/jev/state.ts +0 -20
- package/node_modules/pi-jev-auto-mode/src/jev/transport.ts +0 -117
- package/node_modules/pi-jev-auto-mode/src/jev/types.ts +0 -46
- package/node_modules/pi-jev-auto-mode/src/policy.ts +0 -558
- package/node_modules/pi-jev-auto-mode/src/records.ts +0 -184
- package/node_modules/pi-jev-auto-mode/src/settings.ts +0 -349
- package/node_modules/pi-jev-auto-mode/src/ui.ts +0 -243
- package/node_modules/pi-lens/dist/chunk-2FQ62SPM.js +0 -83
- package/node_modules/pi-lens/dist/chunk-7AXO3ZDF.js +0 -30
- package/node_modules/pi-lens/dist/chunk-KMGPUKFD.js +0 -25
- package/node_modules/pi-lens/dist/chunk-OZJINN4O.js +0 -84
- package/node_modules/pi-lens/dist/chunk-RJFED73B.js +0 -79
- package/node_modules/pi-lens/dist/chunk-RTQNRM5X.js +0 -27
- package/node_modules/pi-lens/dist/chunk-VGEVL5EQ.js +0 -29
- package/node_modules/pi-lens/dist/chunk-WPE5FPGR.js +0 -54
- package/node_modules/pi-lens/dist/chunk-Z7QQA2KT.js +0 -27
- package/node_modules/resume-from/LICENSE +0 -21
- package/node_modules/resume-from/README.md +0 -167
- package/node_modules/resume-from/dist/adapters/claude-code/adapter.d.ts +0 -20
- package/node_modules/resume-from/dist/adapters/claude-code/adapter.js +0 -59
- package/node_modules/resume-from/dist/adapters/claude-code/contract.d.ts +0 -8
- package/node_modules/resume-from/dist/adapters/claude-code/contract.js +0 -4
- package/node_modules/resume-from/dist/adapters/claude-code/entries.d.ts +0 -30
- package/node_modules/resume-from/dist/adapters/claude-code/entries.js +0 -107
- package/node_modules/resume-from/dist/adapters/claude-code/index.d.ts +0 -3
- package/node_modules/resume-from/dist/adapters/claude-code/index.js +0 -2
- package/node_modules/resume-from/dist/adapters/claude-code/layout.d.ts +0 -29
- package/node_modules/resume-from/dist/adapters/claude-code/layout.js +0 -80
- package/node_modules/resume-from/dist/adapters/claude-code/readback.d.ts +0 -9
- package/node_modules/resume-from/dist/adapters/claude-code/readback.js +0 -39
- package/node_modules/resume-from/dist/adapters/claude-code/reader.d.ts +0 -40
- package/node_modules/resume-from/dist/adapters/claude-code/reader.js +0 -436
- package/node_modules/resume-from/dist/adapters/claude-code/redaction.d.ts +0 -26
- package/node_modules/resume-from/dist/adapters/claude-code/redaction.js +0 -145
- package/node_modules/resume-from/dist/adapters/claude-code/validation.d.ts +0 -4
- package/node_modules/resume-from/dist/adapters/claude-code/validation.js +0 -39
- package/node_modules/resume-from/dist/adapters/claude-code/writer.d.ts +0 -21
- package/node_modules/resume-from/dist/adapters/claude-code/writer.js +0 -306
- package/node_modules/resume-from/dist/adapters/codex/contract.d.ts +0 -13
- package/node_modules/resume-from/dist/adapters/codex/contract.js +0 -4
- package/node_modules/resume-from/dist/adapters/codex/index.d.ts +0 -6
- package/node_modules/resume-from/dist/adapters/codex/index.js +0 -43
- package/node_modules/resume-from/dist/adapters/codex/read.d.ts +0 -44
- package/node_modules/resume-from/dist/adapters/codex/read.js +0 -723
- package/node_modules/resume-from/dist/adapters/codex/readback.d.ts +0 -9
- package/node_modules/resume-from/dist/adapters/codex/readback.js +0 -47
- package/node_modules/resume-from/dist/adapters/codex/redaction.d.ts +0 -26
- package/node_modules/resume-from/dist/adapters/codex/redaction.js +0 -145
- package/node_modules/resume-from/dist/adapters/codex/rollout.d.ts +0 -115
- package/node_modules/resume-from/dist/adapters/codex/rollout.js +0 -269
- package/node_modules/resume-from/dist/adapters/codex/validation.d.ts +0 -7
- package/node_modules/resume-from/dist/adapters/codex/validation.js +0 -78
- package/node_modules/resume-from/dist/adapters/codex/write.d.ts +0 -17
- package/node_modules/resume-from/dist/adapters/codex/write.js +0 -141
- package/node_modules/resume-from/dist/adapters/contract.d.ts +0 -78
- package/node_modules/resume-from/dist/adapters/contract.js +0 -4
- package/node_modules/resume-from/dist/adapters/pi/adapter.d.ts +0 -15
- package/node_modules/resume-from/dist/adapters/pi/adapter.js +0 -213
- package/node_modules/resume-from/dist/adapters/pi/contract.d.ts +0 -24
- package/node_modules/resume-from/dist/adapters/pi/contract.js +0 -4
- package/node_modules/resume-from/dist/adapters/pi/format.d.ts +0 -162
- package/node_modules/resume-from/dist/adapters/pi/format.js +0 -223
- package/node_modules/resume-from/dist/adapters/pi/index.d.ts +0 -7
- package/node_modules/resume-from/dist/adapters/pi/index.js +0 -10
- package/node_modules/resume-from/dist/adapters/pi/parse.d.ts +0 -41
- package/node_modules/resume-from/dist/adapters/pi/parse.js +0 -371
- package/node_modules/resume-from/dist/adapters/pi/redaction.d.ts +0 -26
- package/node_modules/resume-from/dist/adapters/pi/redaction.js +0 -145
- package/node_modules/resume-from/dist/adapters/pi/serialize.d.ts +0 -20
- package/node_modules/resume-from/dist/adapters/pi/serialize.js +0 -87
- package/node_modules/resume-from/dist/adapters/pi/validate.d.ts +0 -14
- package/node_modules/resume-from/dist/adapters/pi/validate.js +0 -134
- package/node_modules/resume-from/dist/bin.d.ts +0 -35
- package/node_modules/resume-from/dist/bin.js +0 -135
- package/node_modules/resume-from/dist/contract.d.ts +0 -10
- package/node_modules/resume-from/dist/contract.js +0 -4
- package/node_modules/resume-from/dist/host/agents.d.ts +0 -29
- package/node_modules/resume-from/dist/host/agents.js +0 -20
- package/node_modules/resume-from/dist/host/cli/args.d.ts +0 -21
- package/node_modules/resume-from/dist/host/cli/args.js +0 -187
- package/node_modules/resume-from/dist/host/cli/contract.d.ts +0 -27
- package/node_modules/resume-from/dist/host/cli/contract.js +0 -4
- package/node_modules/resume-from/dist/host/cli/index.d.ts +0 -2
- package/node_modules/resume-from/dist/host/cli/index.js +0 -1
- package/node_modules/resume-from/dist/host/cli/presentation.d.ts +0 -2
- package/node_modules/resume-from/dist/host/cli/presentation.js +0 -11
- package/node_modules/resume-from/dist/host/cli/render.d.ts +0 -3
- package/node_modules/resume-from/dist/host/cli/render.js +0 -70
- package/node_modules/resume-from/dist/host/cli/runner.d.ts +0 -8
- package/node_modules/resume-from/dist/host/cli/runner.js +0 -125
- package/node_modules/resume-from/dist/host/contract.d.ts +0 -42
- package/node_modules/resume-from/dist/host/contract.js +0 -4
- package/node_modules/resume-from/dist/host/entry.d.ts +0 -52
- package/node_modules/resume-from/dist/host/entry.js +0 -91
- package/node_modules/resume-from/dist/host/index.d.ts +0 -11
- package/node_modules/resume-from/dist/host/index.js +0 -10
- package/node_modules/resume-from/dist/host/pi-extension/command.d.ts +0 -18
- package/node_modules/resume-from/dist/host/pi-extension/command.js +0 -126
- package/node_modules/resume-from/dist/host/pi-extension/contract.d.ts +0 -34
- package/node_modules/resume-from/dist/host/pi-extension/contract.js +0 -4
- package/node_modules/resume-from/dist/host/pi-extension/index.d.ts +0 -6
- package/node_modules/resume-from/dist/host/pi-extension/index.js +0 -4
- package/node_modules/resume-from/dist/host/pi-extension/picker.d.ts +0 -16
- package/node_modules/resume-from/dist/host/pi-extension/picker.js +0 -35
- package/node_modules/resume-from/dist/host/pi-extension/presentation.d.ts +0 -2
- package/node_modules/resume-from/dist/host/pi-extension/presentation.js +0 -11
- package/node_modules/resume-from/dist/host/pi-extension/register.d.ts +0 -25
- package/node_modules/resume-from/dist/host/pi-extension/register.js +0 -11
- package/node_modules/resume-from/dist/host/pi-extension/ui.d.ts +0 -20
- package/node_modules/resume-from/dist/host/pi-extension/ui.js +0 -1
- package/node_modules/resume-from/dist/host/profile.d.ts +0 -8
- package/node_modules/resume-from/dist/host/profile.js +0 -31
- package/node_modules/resume-from/dist/host/registry.d.ts +0 -8
- package/node_modules/resume-from/dist/host/registry.js +0 -33
- package/node_modules/resume-from/dist/host/wiring.d.ts +0 -41
- package/node_modules/resume-from/dist/host/wiring.js +0 -66
- package/node_modules/resume-from/dist/import/confirmation.d.ts +0 -9
- package/node_modules/resume-from/dist/import/confirmation.js +0 -27
- package/node_modules/resume-from/dist/import/contract.d.ts +0 -43
- package/node_modules/resume-from/dist/import/contract.js +0 -4
- package/node_modules/resume-from/dist/import/discovery/contract.d.ts +0 -63
- package/node_modules/resume-from/dist/import/discovery/contract.js +0 -4
- package/node_modules/resume-from/dist/import/discovery/errors.d.ts +0 -9
- package/node_modules/resume-from/dist/import/discovery/errors.js +0 -12
- package/node_modules/resume-from/dist/import/discovery/finder.d.ts +0 -11
- package/node_modules/resume-from/dist/import/discovery/finder.js +0 -269
- package/node_modules/resume-from/dist/import/discovery/homes.d.ts +0 -23
- package/node_modules/resume-from/dist/import/discovery/homes.js +0 -83
- package/node_modules/resume-from/dist/import/discovery/index.d.ts +0 -2
- package/node_modules/resume-from/dist/import/discovery/index.js +0 -2
- package/node_modules/resume-from/dist/import/discovery/ordering.d.ts +0 -3
- package/node_modules/resume-from/dist/import/discovery/ordering.js +0 -21
- package/node_modules/resume-from/dist/import/errors.d.ts +0 -22
- package/node_modules/resume-from/dist/import/errors.js +0 -20
- package/node_modules/resume-from/dist/import/index.d.ts +0 -3
- package/node_modules/resume-from/dist/import/index.js +0 -5
- package/node_modules/resume-from/dist/import/landing/contract.d.ts +0 -44
- package/node_modules/resume-from/dist/import/landing/contract.js +0 -4
- package/node_modules/resume-from/dist/import/landing/errors.d.ts +0 -15
- package/node_modules/resume-from/dist/import/landing/errors.js +0 -15
- package/node_modules/resume-from/dist/import/landing/handover.d.ts +0 -5
- package/node_modules/resume-from/dist/import/landing/handover.js +0 -12
- package/node_modules/resume-from/dist/import/landing/index.d.ts +0 -4
- package/node_modules/resume-from/dist/import/landing/index.js +0 -4
- package/node_modules/resume-from/dist/import/landing/lander.d.ts +0 -7
- package/node_modules/resume-from/dist/import/landing/lander.js +0 -133
- package/node_modules/resume-from/dist/import/landing/marker.d.ts +0 -9
- package/node_modules/resume-from/dist/import/landing/marker.js +0 -46
- package/node_modules/resume-from/dist/import/pipeline.d.ts +0 -28
- package/node_modules/resume-from/dist/import/pipeline.js +0 -154
- package/node_modules/resume-from/dist/import/preview/builder.d.ts +0 -6
- package/node_modules/resume-from/dist/import/preview/builder.js +0 -80
- package/node_modules/resume-from/dist/import/preview/contract.d.ts +0 -39
- package/node_modules/resume-from/dist/import/preview/contract.js +0 -4
- package/node_modules/resume-from/dist/import/preview/format.d.ts +0 -19
- package/node_modules/resume-from/dist/import/preview/format.js +0 -45
- package/node_modules/resume-from/dist/import/preview/index.d.ts +0 -2
- package/node_modules/resume-from/dist/import/preview/index.js +0 -1
- package/node_modules/resume-from/dist/import/preview/warnings.d.ts +0 -14
- package/node_modules/resume-from/dist/import/preview/warnings.js +0 -86
- package/node_modules/resume-from/dist/import/transfer/contract.d.ts +0 -48
- package/node_modules/resume-from/dist/import/transfer/contract.js +0 -4
- package/node_modules/resume-from/dist/import/transfer/index.d.ts +0 -2
- package/node_modules/resume-from/dist/import/transfer/index.js +0 -1
- package/node_modules/resume-from/dist/import/transfer/rules.d.ts +0 -3
- package/node_modules/resume-from/dist/import/transfer/rules.js +0 -228
- package/node_modules/resume-from/dist/import/wiring.d.ts +0 -24
- package/node_modules/resume-from/dist/import/wiring.js +0 -37
- package/node_modules/resume-from/dist/index.d.ts +0 -36
- package/node_modules/resume-from/dist/index.js +0 -36
- package/node_modules/resume-from/dist/platform/config/contract.d.ts +0 -35
- package/node_modules/resume-from/dist/platform/config/contract.js +0 -4
- package/node_modules/resume-from/dist/platform/config/defaults.d.ts +0 -16
- package/node_modules/resume-from/dist/platform/config/defaults.js +0 -22
- package/node_modules/resume-from/dist/platform/config/errors.d.ts +0 -9
- package/node_modules/resume-from/dist/platform/config/errors.js +0 -12
- package/node_modules/resume-from/dist/platform/config/index.d.ts +0 -5
- package/node_modules/resume-from/dist/platform/config/index.js +0 -6
- package/node_modules/resume-from/dist/platform/config/loader.d.ts +0 -10
- package/node_modules/resume-from/dist/platform/config/loader.js +0 -47
- package/node_modules/resume-from/dist/platform/config/paths.d.ts +0 -13
- package/node_modules/resume-from/dist/platform/config/paths.js +0 -37
- package/node_modules/resume-from/dist/platform/config/validate.d.ts +0 -9
- package/node_modules/resume-from/dist/platform/config/validate.js +0 -117
- package/node_modules/resume-from/dist/platform/repo/contract.d.ts +0 -36
- package/node_modules/resume-from/dist/platform/repo/contract.js +0 -4
- package/node_modules/resume-from/dist/platform/repo/git.d.ts +0 -21
- package/node_modules/resume-from/dist/platform/repo/git.js +0 -77
- package/node_modules/resume-from/dist/platform/repo/index.d.ts +0 -2
- package/node_modules/resume-from/dist/platform/repo/index.js +0 -1
- package/node_modules/resume-from/dist/platform/repo/reader.d.ts +0 -3
- package/node_modules/resume-from/dist/platform/repo/reader.js +0 -170
- package/node_modules/resume-from/dist/platform/store/contract.d.ts +0 -31
- package/node_modules/resume-from/dist/platform/store/contract.js +0 -4
- package/node_modules/resume-from/dist/platform/store/file-committer.d.ts +0 -3
- package/node_modules/resume-from/dist/platform/store/file-committer.js +0 -391
- package/node_modules/resume-from/dist/platform/store/index.d.ts +0 -2
- package/node_modules/resume-from/dist/platform/store/index.js +0 -2
- package/node_modules/resume-from/dist/platform/tokens/contract.d.ts +0 -12
- package/node_modules/resume-from/dist/platform/tokens/contract.js +0 -4
- package/node_modules/resume-from/dist/platform/tokens/estimator.d.ts +0 -12
- package/node_modules/resume-from/dist/platform/tokens/estimator.js +0 -111
- package/node_modules/resume-from/dist/platform/tokens/index.d.ts +0 -2
- package/node_modules/resume-from/dist/platform/tokens/index.js +0 -1
- package/node_modules/resume-from/dist/session/contract.d.ts +0 -116
- package/node_modules/resume-from/dist/session/contract.js +0 -4
- package/node_modules/resume-from/package.json +0 -83
- package/node_modules/resume-from/shims/pi/extensions/resume-from.js +0 -118
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TypeSafeIntegrationError } from "./errors.js";
|
|
2
|
+
import { DEFAULT_BACKEND_LIMITS } from "./schema.js";
|
|
2
3
|
/** The backend every key and auth function assumes when none is named. */
|
|
3
4
|
export const DEFAULT_BACKEND = "typesafe";
|
|
4
5
|
/** The environment variable and login store that the default backend reads. */
|
|
@@ -35,6 +36,17 @@ export const DECISIONS_BACKENDS = {
|
|
|
35
36
|
modelsVerifyKey: true,
|
|
36
37
|
prices: { d1: 0.04, "d1:free": 0 },
|
|
37
38
|
},
|
|
39
|
+
subq: {
|
|
40
|
+
label: "SubQ",
|
|
41
|
+
host: "https://api.subq.ai",
|
|
42
|
+
keyEnv: "SUBQ_API_KEY",
|
|
43
|
+
modelsField: "data",
|
|
44
|
+
modelsIdField: "id",
|
|
45
|
+
modelsVerifyKey: false,
|
|
46
|
+
// SubQ answers 422 to 17 questions, a 1-option Choice, or an 11-level Score. Its 255-option Choice cap is above the schema's 64.
|
|
47
|
+
limits: { maxQuestions: 16, minChoiceOptions: 2, maxScoreLevels: 10 },
|
|
48
|
+
prices: { "subq-snap-preview": 0.05 },
|
|
49
|
+
},
|
|
38
50
|
};
|
|
39
51
|
/** The registry entry for a backend name; a `configuration` error for a name the registry does not know. */
|
|
40
52
|
export function backendConfig(name) {
|
|
@@ -49,6 +61,7 @@ const DEFAULT_MODEL = {
|
|
|
49
61
|
openrouter: "typesafe/jev-1.13",
|
|
50
62
|
commandcode: "typesafe/jev",
|
|
51
63
|
liquid: "d1:free",
|
|
64
|
+
subq: "subq-snap-preview",
|
|
52
65
|
};
|
|
53
66
|
/**
|
|
54
67
|
* The model id to send for a caller's `model` on this backend. OpenRouter routes a bare Jev id under the `typesafe`
|
|
@@ -95,6 +108,32 @@ function refuse(message) {
|
|
|
95
108
|
function hasRawQueryOrFragment(value) {
|
|
96
109
|
return value.includes("?") || value.includes("#");
|
|
97
110
|
}
|
|
111
|
+
const LIMITS_MESSAGE = `Backend limits must be an object of whole numbers within the schema's bounds: maxQuestions 1–${DEFAULT_BACKEND_LIMITS.maxQuestions}, minChoiceOptions and maxChoiceOptions ${DEFAULT_BACKEND_LIMITS.minChoiceOptions}–${DEFAULT_BACKEND_LIMITS.maxChoiceOptions} with min at most max, maxScoreLevels 2–${DEFAULT_BACKEND_LIMITS.maxScoreLevels}.`;
|
|
112
|
+
/** An endpoint's limits, each within the schema's bound: a backend can narrow what the schema admits, never widen it. */
|
|
113
|
+
function resolveLimits(value) {
|
|
114
|
+
if (value === undefined)
|
|
115
|
+
return { ...DEFAULT_BACKEND_LIMITS };
|
|
116
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
117
|
+
refuse(LIMITS_MESSAGE);
|
|
118
|
+
const given = value;
|
|
119
|
+
const floors = { maxQuestions: 1, minChoiceOptions: DEFAULT_BACKEND_LIMITS.minChoiceOptions, maxChoiceOptions: DEFAULT_BACKEND_LIMITS.minChoiceOptions, maxScoreLevels: 2 };
|
|
120
|
+
const ceilings = { ...DEFAULT_BACKEND_LIMITS, minChoiceOptions: DEFAULT_BACKEND_LIMITS.maxChoiceOptions };
|
|
121
|
+
for (const key of Object.keys(given))
|
|
122
|
+
if (!Object.hasOwn(floors, key))
|
|
123
|
+
refuse(LIMITS_MESSAGE);
|
|
124
|
+
const limits = { ...DEFAULT_BACKEND_LIMITS };
|
|
125
|
+
for (const key of Object.keys(floors)) {
|
|
126
|
+
const field = given[key];
|
|
127
|
+
if (field === undefined)
|
|
128
|
+
continue;
|
|
129
|
+
if (typeof field !== "number" || !Number.isInteger(field) || field < floors[key] || field > ceilings[key])
|
|
130
|
+
refuse(LIMITS_MESSAGE);
|
|
131
|
+
limits[key] = field;
|
|
132
|
+
}
|
|
133
|
+
if (limits.minChoiceOptions > limits.maxChoiceOptions)
|
|
134
|
+
refuse(LIMITS_MESSAGE);
|
|
135
|
+
return limits;
|
|
136
|
+
}
|
|
98
137
|
/**
|
|
99
138
|
* Resolve a registry name or a caller-supplied endpoint into the validated form the client uses. A name resolves to
|
|
100
139
|
* its registry entry unchanged; an endpoint is validated field by field and returned as a fresh object whose `host`
|
|
@@ -112,6 +151,7 @@ export function resolveBackend(backend) {
|
|
|
112
151
|
keyEnv: entry.keyEnv ?? TYPESAFE_KEY_ENV,
|
|
113
152
|
defaultModel: defaultModelId(spec),
|
|
114
153
|
modelsVerifyKey: entry.modelsVerifyKey !== false,
|
|
154
|
+
limits: { ...DEFAULT_BACKEND_LIMITS, ...entry.limits },
|
|
115
155
|
};
|
|
116
156
|
}
|
|
117
157
|
if (spec === null || typeof spec !== "object") {
|
|
@@ -145,6 +185,7 @@ export function resolveBackend(backend) {
|
|
|
145
185
|
refuse("Backend modelsIdField must be a nonempty string.");
|
|
146
186
|
if (spec.modelsVerifyKey !== undefined && typeof spec.modelsVerifyKey !== "boolean")
|
|
147
187
|
refuse("Backend modelsVerifyKey must be a boolean.");
|
|
188
|
+
const limits = resolveLimits(spec.limits);
|
|
148
189
|
if (typeof spec.keyEnv !== "string" || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(spec.keyEnv))
|
|
149
190
|
refuse(KEY_ENV_MESSAGE);
|
|
150
191
|
if (spec.keyEnv.toUpperCase() === TYPESAFE_KEY_ENV) {
|
|
@@ -158,6 +199,7 @@ export function resolveBackend(backend) {
|
|
|
158
199
|
host: host.origin,
|
|
159
200
|
keyEnv: spec.keyEnv,
|
|
160
201
|
modelsVerifyKey: spec.modelsVerifyKey === true,
|
|
202
|
+
limits,
|
|
161
203
|
...(spec.path === undefined ? {} : { path: spec.path }),
|
|
162
204
|
...(spec.modelsPath === undefined ? {} : { modelsPath: spec.modelsPath }),
|
|
163
205
|
...(spec.modelsField === undefined ? {} : { modelsField: spec.modelsField }),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Questions, SystemOneRequest, Usage } from "@typesafe-ai/sdk";
|
|
2
2
|
import type { Evaluation, TypeSafe } from "./client.js";
|
|
3
|
+
import type { BackendSpec } from "./backends.js";
|
|
3
4
|
/** Default number of requests in flight. TypeSafe answers in isolation, so a small pool is enough. */
|
|
4
5
|
export declare const DEFAULT_CONCURRENCY = 4;
|
|
5
6
|
/** One item's outcome. `skipped` marks work that was never started because of an abort or a stop rule. */
|
|
@@ -57,17 +58,20 @@ export interface BatchEvaluation<Q extends Questions = Questions> {
|
|
|
57
58
|
*/
|
|
58
59
|
export declare function evaluateMany<Q extends Questions>(client: TypeSafe, requests: readonly SystemOneRequest<Q>[], options?: BatchOptions): Promise<BatchEvaluation<Q>>;
|
|
59
60
|
/**
|
|
60
|
-
* Split a request that asks more questions than one request may carry into chunks of at most `maxQuestions
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
61
|
+
* Split a request that asks more questions than one request may carry into chunks of at most `maxQuestions`, capped at
|
|
62
|
+
* the question limit of `backend` (default: the TypeSafe backend). Sharing one state across several questions is one
|
|
63
|
+
* request; asking more than the per-request limit is the only reason to fan out, and the state is repeated in each
|
|
64
|
+
* chunk. The order of `questions` is preserved. A pure splitter: admission still happens once per chunk, in `evaluate`
|
|
65
|
+
* or `evaluateMany`, so what one accepts the others accept.
|
|
64
66
|
*/
|
|
65
67
|
export declare function chunkEvaluationRequest(request: SystemOneRequest<Questions>, options?: {
|
|
66
68
|
maxQuestions?: number;
|
|
69
|
+
backend?: BackendSpec;
|
|
67
70
|
}): SystemOneRequest<Questions>[];
|
|
68
71
|
/**
|
|
69
|
-
* Ask any number of questions about one state: chunk to the
|
|
70
|
-
* and model. Use this when one coherent state carries many
|
|
72
|
+
* Ask any number of questions about one state: chunk to the client's question limit, or the caller's `maxQuestions`
|
|
73
|
+
* when smaller, fan out, and merge the answers, usage, and model. Use this when one coherent state carries many
|
|
74
|
+
* independent questions; use `evaluate` for one request.
|
|
71
75
|
*/
|
|
72
76
|
export declare function evaluateAll<Q extends Questions>(client: TypeSafe, request: SystemOneRequest<Q>, options?: BatchOptions & {
|
|
73
77
|
maxQuestions?: number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TypeSafeIntegrationError } from "./errors.js";
|
|
2
|
-
import {
|
|
2
|
+
import { resolveBackend } from "./backends.js";
|
|
3
|
+
import { DEFAULT_BACKEND_LIMITS, prepareEvaluationRequest } from "./schema.js";
|
|
3
4
|
/** Default number of requests in flight. TypeSafe answers in isolation, so a small pool is enough. */
|
|
4
5
|
export const DEFAULT_CONCURRENCY = 4;
|
|
5
6
|
/**
|
|
@@ -86,14 +87,22 @@ export async function evaluateMany(client, requests, options = {}) {
|
|
|
86
87
|
});
|
|
87
88
|
return summarize(results, Math.round(performance.now() - start));
|
|
88
89
|
}
|
|
90
|
+
/** A caller's chunk size, capped at the backend's question limit; the limit itself when the caller names none. */
|
|
91
|
+
function chunkSize(maxQuestions, backendMax) {
|
|
92
|
+
return Math.max(1, Math.min(backendMax, Math.floor(maxQuestions ?? backendMax)));
|
|
93
|
+
}
|
|
89
94
|
/**
|
|
90
|
-
* Split a request that asks more questions than one request may carry into chunks of at most `maxQuestions
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
95
|
+
* Split a request that asks more questions than one request may carry into chunks of at most `maxQuestions`, capped at
|
|
96
|
+
* the question limit of `backend` (default: the TypeSafe backend). Sharing one state across several questions is one
|
|
97
|
+
* request; asking more than the per-request limit is the only reason to fan out, and the state is repeated in each
|
|
98
|
+
* chunk. The order of `questions` is preserved. A pure splitter: admission still happens once per chunk, in `evaluate`
|
|
99
|
+
* or `evaluateMany`, so what one accepts the others accept.
|
|
94
100
|
*/
|
|
95
101
|
export function chunkEvaluationRequest(request, options = {}) {
|
|
96
|
-
const limit =
|
|
102
|
+
const limit = chunkSize(options.maxQuestions, resolveBackend(options.backend).limits.maxQuestions);
|
|
103
|
+
return splitQuestions(request, limit);
|
|
104
|
+
}
|
|
105
|
+
function splitQuestions(request, limit) {
|
|
97
106
|
const questions = request.questions;
|
|
98
107
|
const entries = questions && typeof questions === "object" && !Array.isArray(questions) ? Object.entries(questions) : undefined;
|
|
99
108
|
// Anything that is not a plain question map, or that already fits, is one chunk and is validated later.
|
|
@@ -107,10 +116,12 @@ export function chunkEvaluationRequest(request, options = {}) {
|
|
|
107
116
|
return chunks;
|
|
108
117
|
}
|
|
109
118
|
/**
|
|
110
|
-
* Ask any number of questions about one state: chunk to the
|
|
111
|
-
* and model. Use this when one coherent state carries many
|
|
119
|
+
* Ask any number of questions about one state: chunk to the client's question limit, or the caller's `maxQuestions`
|
|
120
|
+
* when smaller, fan out, and merge the answers, usage, and model. Use this when one coherent state carries many
|
|
121
|
+
* independent questions; use `evaluate` for one request.
|
|
112
122
|
*/
|
|
113
123
|
export async function evaluateAll(client, request, options = {}) {
|
|
114
|
-
const
|
|
124
|
+
const limit = chunkSize(options.maxQuestions, (client.limits ?? DEFAULT_BACKEND_LIMITS).maxQuestions);
|
|
125
|
+
const chunks = splitQuestions(request, limit);
|
|
115
126
|
return evaluateMany(client, chunks, options);
|
|
116
127
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Fetch, Questions, SystemOneRequest, SystemOneResult } from "@typesafe-ai/sdk";
|
|
2
2
|
import type { BackendSpec } from "./backends.js";
|
|
3
3
|
import type { BatchEvaluation, BatchOptions } from "./batch.js";
|
|
4
|
+
import type { BackendLimits } from "./schema.js";
|
|
4
5
|
import type { BlockedCap, SpendCaps, UsageLedger, UsageReport } from "./usage.js";
|
|
5
6
|
export { backendHost, backendPrice, resolveBackend, DECISIONS_BACKENDS, DEFAULT_BACKEND } from "./backends.js";
|
|
6
7
|
export type { BackendConfig, BackendEndpoint, BackendSpec, RegistryBackendConfig, ResolvedBackend, TypeSafeBackend } from "./backends.js";
|
|
@@ -55,10 +56,12 @@ export interface SpendReport {
|
|
|
55
56
|
readonly blocked?: BlockedCap;
|
|
56
57
|
}
|
|
57
58
|
export interface TypeSafe {
|
|
59
|
+
/** What one request may ask on this client's backend; known without a request. Absent only on a hand-built TypeSafe, which gets the schema's bounds. */
|
|
60
|
+
readonly limits?: BackendLimits;
|
|
58
61
|
evaluate<Q extends Questions>(request: SystemOneRequest<Q>, options?: EvaluationOptions): Promise<Evaluation<Q>>;
|
|
59
62
|
/** Several requests with bounded concurrency; answers, usage, and model merged. Never throws. */
|
|
60
63
|
evaluateMany<Q extends Questions>(requests: readonly SystemOneRequest<Q>[], options?: BatchOptions): Promise<BatchEvaluation<Q>>;
|
|
61
|
-
/** One state, any number of questions: chunk to the
|
|
64
|
+
/** One state, any number of questions: chunk to the backend's question limit, then fan out. Never throws. */
|
|
62
65
|
evaluateAll<Q extends Questions>(request: SystemOneRequest<Q>, options?: BatchOptions & {
|
|
63
66
|
maxQuestions?: number;
|
|
64
67
|
}): Promise<BatchEvaluation<Q>>;
|
|
@@ -18,7 +18,7 @@ function backendFetch(backend, inner = fetch) {
|
|
|
18
18
|
const { path, modelsPath, modelsField } = backend;
|
|
19
19
|
return async (input, init) => {
|
|
20
20
|
const url = String(input);
|
|
21
|
-
const models = modelsPath !== undefined && url.includes(SDK_MODELS_PATH);
|
|
21
|
+
const models = (modelsPath !== undefined || modelsField !== undefined) && url.includes(SDK_MODELS_PATH);
|
|
22
22
|
const rewrite = models ? modelsPath : path;
|
|
23
23
|
const response = await inner(rewrite === undefined ? url : url.replace(models ? SDK_MODELS_PATH : SDK_PATH, rewrite), init);
|
|
24
24
|
return models && modelsField !== undefined ? translateModels(response, backend) : response;
|
|
@@ -151,8 +151,8 @@ export function createTypeSafe(options = {}) {
|
|
|
151
151
|
...(options.maxInputTokensPerDay === undefined ? {} : { maxInputTokensPerDay: positiveInteger(options.maxInputTokensPerDay, "maxInputTokensPerDay") }),
|
|
152
152
|
...(options.maxUsdPerDay === undefined ? {} : { maxUsdPerDay: positiveNumber(options.maxUsdPerDay, "maxUsdPerDay") }),
|
|
153
153
|
}, capsFromEnvironment());
|
|
154
|
-
// A backend
|
|
155
|
-
const transport = backend.path !== undefined || backend.modelsPath !== undefined ? backendFetch(backend, options.fetch) : options.fetch;
|
|
154
|
+
// A backend with its own paths or model list fields gets a transport that rewrites them; the default backend keeps the caller's.
|
|
155
|
+
const transport = backend.path !== undefined || backend.modelsPath !== undefined || backend.modelsField !== undefined ? backendFetch(backend, options.fetch) : options.fetch;
|
|
156
156
|
// The caller's input is validated as written, then mapped to the backend's id form; omitting it sends the backend's
|
|
157
157
|
// own default, which the mapping leaves unchanged.
|
|
158
158
|
const requested = options.model ?? backend.defaultModel;
|
|
@@ -184,6 +184,7 @@ export function createTypeSafe(options = {}) {
|
|
|
184
184
|
const snapshot = () => ({ ...usage, estimatedUsd: Math.round(sessionUsd * 1e6) / 1e6 });
|
|
185
185
|
const blocked = () => (usage.requestsStarted >= maxRequests ? undefined : ledger.blocked(caps));
|
|
186
186
|
const typesafe = {
|
|
187
|
+
limits: backend.limits,
|
|
187
188
|
getUsage: snapshot,
|
|
188
189
|
getSpend: () => {
|
|
189
190
|
const reached = blocked();
|
|
@@ -212,7 +213,7 @@ export function createTypeSafe(options = {}) {
|
|
|
212
213
|
}
|
|
213
214
|
},
|
|
214
215
|
async evaluate(input, callOptions = {}) {
|
|
215
|
-
const validated = prepareEvaluationRequest(input, { maxInputBytes });
|
|
216
|
+
const validated = prepareEvaluationRequest(input, { maxInputBytes, limits: backend.limits });
|
|
216
217
|
// A per-request model meets the same mapping as the client default; the schema already limited the caller's own id.
|
|
217
218
|
const sentModel = validated.model === undefined ? model : mapModel(validated.model);
|
|
218
219
|
const body = JSON.stringify({ ...validated, model: sentModel });
|
|
@@ -12,7 +12,7 @@ export { capsFromEnvironment, DEFAULT_USD_PER_MTOK, emptyTotals, estimateUsd, lo
|
|
|
12
12
|
export type { BlockedCap, SpendCaps, UsageLedger, UsageLedgerOptions, UsageReport, UsageTotals } from "./usage.js";
|
|
13
13
|
export { TypeSafeIntegrationError } from "./errors.js";
|
|
14
14
|
export type { IntegrationErrorCode } from "./errors.js";
|
|
15
|
-
export { DEFAULT_MAX_INPUT_BYTES, DEFAULT_MAX_QUESTIONS, evaluationSchema, normalizeEvaluationRequest, parseEvaluationRequest, prepareEvaluationRequest, } from "./schema.js";
|
|
16
|
-
export type { PrepareEvaluationOptions } from "./schema.js";
|
|
15
|
+
export { DEFAULT_BACKEND_LIMITS, DEFAULT_MAX_INPUT_BYTES, DEFAULT_MAX_QUESTIONS, evaluationSchema, normalizeEvaluationRequest, parseEvaluationRequest, prepareEvaluationRequest, } from "./schema.js";
|
|
16
|
+
export type { BackendLimits, PrepareEvaluationOptions } from "./schema.js";
|
|
17
17
|
export { choice, noul, score } from "@typesafe-ai/sdk";
|
|
18
18
|
export type { Questions, Question, SystemOneRequest, SystemOneResult, EntryType, JsonValue, ChoiceQuestion, ChoiceResponse, NoulQuestion, NoulResponse, ScoreQuestion, ScoreResponse, Usage, } from "@typesafe-ai/sdk";
|
|
@@ -5,5 +5,5 @@ export { authState, authStatePath, clearAuthState, describeAuth, recordAuthFailu
|
|
|
5
5
|
export { clearStoredApiKey, credentialsPath, keySituation, keySourceLabel, normalizeApiKey, piTypesafeDir, resolveApiKey, storeApiKey, } from "./credentials.js";
|
|
6
6
|
export { capsFromEnvironment, DEFAULT_USD_PER_MTOK, emptyTotals, estimateUsd, localDay, mergeCaps, openUsageLedger, usagePath, } from "./usage.js";
|
|
7
7
|
export { TypeSafeIntegrationError } from "./errors.js";
|
|
8
|
-
export { DEFAULT_MAX_INPUT_BYTES, DEFAULT_MAX_QUESTIONS, evaluationSchema, normalizeEvaluationRequest, parseEvaluationRequest, prepareEvaluationRequest, } from "./schema.js";
|
|
8
|
+
export { DEFAULT_BACKEND_LIMITS, DEFAULT_MAX_INPUT_BYTES, DEFAULT_MAX_QUESTIONS, evaluationSchema, normalizeEvaluationRequest, parseEvaluationRequest, prepareEvaluationRequest, } from "./schema.js";
|
|
9
9
|
export { choice, noul, score } from "@typesafe-ai/sdk";
|
|
@@ -4,6 +4,19 @@ import { Type } from "typebox";
|
|
|
4
4
|
export declare const DEFAULT_MAX_INPUT_BYTES = 65536;
|
|
5
5
|
/** Questions one request may ask. More than this needs `chunkEvaluationRequest`, which splits and fans out. */
|
|
6
6
|
export declare const DEFAULT_MAX_QUESTIONS = 32;
|
|
7
|
+
/** What one request may ask on a backend. A backend can only narrow the schema's own bounds, never widen them. */
|
|
8
|
+
export interface BackendLimits {
|
|
9
|
+
/** Questions in one request. */
|
|
10
|
+
readonly maxQuestions: number;
|
|
11
|
+
/** Options in one Choice question, at least. */
|
|
12
|
+
readonly minChoiceOptions: number;
|
|
13
|
+
/** Options in one Choice question, at most. */
|
|
14
|
+
readonly maxChoiceOptions: number;
|
|
15
|
+
/** Levels in one Score rubric, at most. */
|
|
16
|
+
readonly maxScoreLevels: number;
|
|
17
|
+
}
|
|
18
|
+
/** The schema's own bounds: the limits of a backend that declares none. */
|
|
19
|
+
export declare const DEFAULT_BACKEND_LIMITS: BackendLimits;
|
|
7
20
|
/** The JSON schema used by both the Pi tool and the programmatic interface. */
|
|
8
21
|
export declare const evaluationSchema: Type.TObject<{
|
|
9
22
|
state: Type.TUnion<[Type.TString, Type.TNull, Type.TArray<Type.TUnknown>, Type.TRecord<"^.*$", Type.TUnknown>]>;
|
|
@@ -32,12 +45,14 @@ export declare function normalizeEvaluationRequest(value: unknown): unknown;
|
|
|
32
45
|
export interface PrepareEvaluationOptions {
|
|
33
46
|
/** UTF-8 JSON bytes of the serialized request. Default: DEFAULT_MAX_INPUT_BYTES. */
|
|
34
47
|
maxInputBytes?: number;
|
|
48
|
+
/** The backend's limits, checked after the schema. Default: DEFAULT_BACKEND_LIMITS, which the schema already enforces. */
|
|
49
|
+
limits?: BackendLimits;
|
|
35
50
|
}
|
|
36
51
|
/** One byte rule for every limit check: measure the serialized request and name the configured limit. */
|
|
37
52
|
export declare function assertWithinByteLimit(text: string, maxInputBytes: number): void;
|
|
38
53
|
/**
|
|
39
|
-
* The one admission rule: normalize known near-miss aliases, validate the schema and JSON-safety,
|
|
40
|
-
* budget — always in that order. The Pi tool, the playground, and client.evaluate() all
|
|
41
|
-
* accepts the others accept.
|
|
54
|
+
* The one admission rule: normalize known near-miss aliases, validate the schema and JSON-safety, check the backend's
|
|
55
|
+
* limits, then enforce the byte budget — always in that order. The Pi tool, the playground, and client.evaluate() all
|
|
56
|
+
* pass through here, so what one accepts the others accept.
|
|
42
57
|
*/
|
|
43
58
|
export declare function prepareEvaluationRequest(value: unknown, options?: PrepareEvaluationOptions): SystemOneRequest;
|
|
@@ -5,6 +5,8 @@ import { TypeSafeIntegrationError } from "./errors.js";
|
|
|
5
5
|
export const DEFAULT_MAX_INPUT_BYTES = 65_536;
|
|
6
6
|
/** Questions one request may ask. More than this needs `chunkEvaluationRequest`, which splits and fans out. */
|
|
7
7
|
export const DEFAULT_MAX_QUESTIONS = 32;
|
|
8
|
+
/** The schema's own bounds: the limits of a backend that declares none. */
|
|
9
|
+
export const DEFAULT_BACKEND_LIMITS = Object.freeze({ maxQuestions: DEFAULT_MAX_QUESTIONS, minChoiceOptions: 1, maxChoiceOptions: 64, maxScoreLevels: 32 });
|
|
8
10
|
// The API accepts structured descriptions, not only strings. The schema is the only shape guidance the model gets
|
|
9
11
|
// before its first call, so every field the agent authors says what it means.
|
|
10
12
|
const entry = (description) => Type.Union([
|
|
@@ -140,6 +142,28 @@ export function normalizeEvaluationRequest(value) {
|
|
|
140
142
|
}
|
|
141
143
|
return { ...request, questions: normalized };
|
|
142
144
|
}
|
|
145
|
+
/** Counts only, never the submitted values: a request the schema accepts but the backend would refuse. */
|
|
146
|
+
function assertWithinBackendLimits(request, limits) {
|
|
147
|
+
const refuse = (detail) => {
|
|
148
|
+
throw new TypeSafeIntegrationError("validation", `Evaluation exceeds the backend's limits: ${detail}`);
|
|
149
|
+
};
|
|
150
|
+
const questions = Object.entries(request.questions);
|
|
151
|
+
if (questions.length > limits.maxQuestions) {
|
|
152
|
+
refuse(`${questions.length} questions, at most ${limits.maxQuestions} per request. evaluateAll splits a request to this limit.`);
|
|
153
|
+
}
|
|
154
|
+
for (const [id, question] of questions) {
|
|
155
|
+
const where = `questions.${id.slice(0, 100)}`;
|
|
156
|
+
if (question.type === "choice") {
|
|
157
|
+
const options = Object.keys(question.criteria).length;
|
|
158
|
+
if (options < limits.minChoiceOptions || options > limits.maxChoiceOptions) {
|
|
159
|
+
refuse(`${where} has ${options} choice options; ${limits.minChoiceOptions}–${limits.maxChoiceOptions} allowed.`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
else if (question.type === "score" && question.criteria.length > limits.maxScoreLevels) {
|
|
163
|
+
refuse(`${where} has ${question.criteria.length} score levels; 2–${limits.maxScoreLevels} allowed.`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
143
167
|
/** One byte rule for every limit check: measure the serialized request and name the configured limit. */
|
|
144
168
|
export function assertWithinByteLimit(text, maxInputBytes) {
|
|
145
169
|
if (Buffer.byteLength(text, "utf8") > maxInputBytes) {
|
|
@@ -147,12 +171,14 @@ export function assertWithinByteLimit(text, maxInputBytes) {
|
|
|
147
171
|
}
|
|
148
172
|
}
|
|
149
173
|
/**
|
|
150
|
-
* The one admission rule: normalize known near-miss aliases, validate the schema and JSON-safety,
|
|
151
|
-
* budget — always in that order. The Pi tool, the playground, and client.evaluate() all
|
|
152
|
-
* accepts the others accept.
|
|
174
|
+
* The one admission rule: normalize known near-miss aliases, validate the schema and JSON-safety, check the backend's
|
|
175
|
+
* limits, then enforce the byte budget — always in that order. The Pi tool, the playground, and client.evaluate() all
|
|
176
|
+
* pass through here, so what one accepts the others accept.
|
|
153
177
|
*/
|
|
154
178
|
export function prepareEvaluationRequest(value, options = {}) {
|
|
155
179
|
const validated = parseEvaluationRequest(normalizeEvaluationRequest(value));
|
|
180
|
+
if (options.limits !== undefined)
|
|
181
|
+
assertWithinBackendLimits(validated, options.limits);
|
|
156
182
|
assertWithinByteLimit(JSON.stringify(validated), options.maxInputBytes ?? DEFAULT_MAX_INPUT_BYTES);
|
|
157
183
|
return validated;
|
|
158
184
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-typesafe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "TypeSafe AI (Jev) decisions for Pi: batched Choice/Score/Noul evaluation tool, terminal playground, and a typed API other extensions build on.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -4,6 +4,72 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.41.0] - 2026-10-14
|
|
8
|
+
|
|
9
|
+
### Highlights
|
|
10
|
+
|
|
11
|
+
- Sites that turn away AI fetchers can now be read directly: set your own User-Agent for page fetches.
|
|
12
|
+
- A SearXNG instance on your own machine works without opening every local service to page fetches.
|
|
13
|
+
- A bad User-Agent setting fails with a clear config error and never sends the page to another provider.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Set `fetchContent.userAgent` in `web-search.json` to choose the `User-Agent` sent on page fetches. Use it for sites that reject the default `OpenAI File Downloader, XaiImageApiFetch/1.0`, such as some Australian government sites. Leaving it unset keeps the default. A value that is empty or not printable ASCII fails with a config error before anything is fetched. Thanks to [@r1ckyIn](https://github.com/r1ckyIn) for [issue #568](https://github.com/nicobailon/pi-web-access/issues/568).
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- A SearXNG instance on the same machine (`searxngBaseUrl` on `localhost`, `127.0.0.0/8`, or `::1`) now works without adding loopback to `ssrf.allowRanges`. That workaround also let `fetch_content` reach every local service. Only the configured SearXNG address is allowed, so a redirect to another local service is still blocked. Thanks to [@mikeydiamonds](https://github.com/mikeydiamonds) for [PR #569](https://github.com/nicobailon/pi-web-access/pull/569).
|
|
22
|
+
|
|
23
|
+
## [0.40.0] - 2026-10-12
|
|
24
|
+
|
|
25
|
+
### Highlights
|
|
26
|
+
|
|
27
|
+
- Keep page fetches on the site you asked for: an opt-in policy refuses any redirect to another origin before that site is contacted.
|
|
28
|
+
- With a Gemini gateway configured, video uploads now go through the gateway instead of straight to Google with your gateway key.
|
|
29
|
+
- Asking a question about a YouTube or local video works again when a thumbnail comes back with the transcript.
|
|
30
|
+
- Emoji and other special characters no longer get cut in half at the edge of an excerpt or a page.
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- An opt-in same-origin redirect policy for page fetches. Turn it on for every fetch with `fetchContent.redirects: "same-origin"` in config, or for one call by passing `redirects: "same-origin"` to `fetch_content`. Every redirect must then stay on the requested URL's scheme, hostname and port. A redirect that leaves is refused before the new site is contacted, with no page content and no fallback to another provider. While the policy is on, extraction paths that fetch pages themselves (Jina Reader, hosted providers, Gemini, and the GitHub and YouTube integrations) are turned off. Thanks to [@jordan-droverinsights](https://github.com/jordan-droverinsights) for [issue #560](https://github.com/nicobailon/pi-web-access/issues/560).
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- With `geminiBaseUrl` pointing at a gateway, video uploads to the Gemini Files API now go through the gateway. Before, the file was sent to `generativelanguage.googleapis.com` directly, along with the gateway key. Thanks to [@goodman-b](https://github.com/goodman-b) for [PR #561](https://github.com/nicobailon/pi-web-access/pull/561).
|
|
39
|
+
- `fetch_content` answer mode now answers from a YouTube or local-video transcript that comes with a thumbnail, instead of failing with "Page answer requires textual fetched content". Requests for several video frames are refused in answer mode instead of being answered from a placeholder line. Thanks to [@goodman-b](https://github.com/goodman-b) for [PR #562](https://github.com/nicobailon/pi-web-access/pull/562).
|
|
40
|
+
- `get_search_content` `findText` excerpts no longer end in half an emoji. A character split at the excerpt edge shows as `�`, so the text stays valid. Thanks to [@yazanabuashour](https://github.com/yazanabuashour) for [PR #563](https://github.com/nicobailon/pi-web-access/pull/563).
|
|
41
|
+
- Reading stored content page by page with `fetch_content` and `get_search_content` no longer splits an emoji across two pages. The whole character starts the next page, and the next-page offset points to it ([#564](https://github.com/nicobailon/pi-web-access/issues/564)).
|
|
42
|
+
## [0.39.0] - 2026-10-11
|
|
43
|
+
|
|
44
|
+
### Highlights
|
|
45
|
+
|
|
46
|
+
- Convert PDFs with a document parser you run yourself, with no API key and no per-page cost.
|
|
47
|
+
- Search summaries now read each source's snippet, so providers that return only links still get a real summary.
|
|
48
|
+
- Answer mode with several URLs shows every page's answer, and stored pages are easier to find again.
|
|
49
|
+
- Search is less fragile: stalled Perplexity requests time out, empty results move `auto` on to the next provider, and DuckDuckGo bot checks are reported as such.
|
|
50
|
+
- GitHub pull request and issue fetches no longer repeat long text, and Brave results no longer show leftover HTML.
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
|
|
54
|
+
- PDFs can be converted by a document parser you run yourself. Set `pdf.provider: "endpoint"` and `pdf.endpointUrl`, and `fetch_content` sends the PDF to that service and uses the Markdown it returns, with no API key or per-page cost. In `auto`, a configured endpoint is tried before Datalab, Gemini and the built-in parser, and a failed request falls back to them. The URL passes the same SSRF checks as other fetches, so a LAN host needs its range in `ssrf.allowRanges`. Thanks to [@goodman-b](https://github.com/goodman-b) for [PR #553](https://github.com/nicobailon/pi-web-access/pull/553).
|
|
55
|
+
|
|
56
|
+
### Changed
|
|
57
|
+
|
|
58
|
+
- Search summaries now give the summary model each source's snippet along with its title and URL, so providers that return ranked results without an answer still get a summary of what the pages say. Snippets are capped per source and per query (600 and 12,000 characters, or 200 and 3,000 when the provider already answered) to stay within the summary deadline. Thanks to [@axelbaumlisto](https://github.com/axelbaumlisto) for [PR #547](https://github.com/nicobailon/pi-web-access/pull/547).
|
|
59
|
+
|
|
60
|
+
### Fixed
|
|
61
|
+
|
|
62
|
+
- Single-URL fetches and finished search summaries now end with the stored `responseId` and a `get_search_content(…)` call the model can run, so stored content stays reachable when the host hides tool details. The call uses the configured retrieval tool name, or says retrieval is not registered when it is turned off. Thanks to [@mothieras](https://github.com/mothieras) for [issue #548](https://github.com/nicobailon/pi-web-access/issues/548) and [PR #551](https://github.com/nicobailon/pi-web-access/pull/551).
|
|
63
|
+
- Truncated `fetch_content` answers now say the stored content is the original source, not the rest of the answer, and offer to read it from offset zero instead of an answer offset. Thanks to [@mothieras](https://github.com/mothieras) for [issue #550](https://github.com/nicobailon/pi-web-access/issues/550) and [PR #552](https://github.com/nicobailon/pi-web-access/pull/552).
|
|
64
|
+
- When a model sends `queries`, `provider` or `domainFilter` as a string starting with `[` that isn't valid JSON, `web_search` now errors that the field must be an array of strings instead of searching the raw string. Thanks to [@tschnorpfeil](https://github.com/tschnorpfeil) for [issue #542](https://github.com/nicobailon/pi-web-access/issues/542) and [@MatrixNeoKozak](https://github.com/MatrixNeoKozak) for [PR #543](https://github.com/nicobailon/pi-web-access/pull/543).
|
|
65
|
+
- `auto` search now moves on when a provider answers successfully with no results and no answer, and returns the first empty response only when every provider is empty. Thanks to [@axelbaumlisto](https://github.com/axelbaumlisto) for [PR #546](https://github.com/nicobailon/pi-web-access/pull/546).
|
|
66
|
+
- Brave search results no longer show raw HTML such as `<strong>` tags or `—` entities in titles and snippets. Thanks to [@axelbaumlisto](https://github.com/axelbaumlisto) for [PR #545](https://github.com/nicobailon/pi-web-access/pull/545).
|
|
67
|
+
- A Perplexity request that stalls now gives up after 30 seconds instead of holding the search for the whole turn. The timeout is reported as a provider error, so `auto` search and configured routing move on to the next provider. Thanks to [@axelbaumlisto](https://github.com/axelbaumlisto) for [PR #544](https://github.com/nicobailon/pi-web-access/pull/544).
|
|
68
|
+
- DuckDuckGo search now tells a bot check apart from an empty search. A bot check (HTTP 202 or a challenge page) fails with an error saying DuckDuckGo blocked the request, and configured `searchRouting` treats it as `quota`. A search that found nothing returns no results instead of failing with "no parseable results". Thanks to [@tschnorpfeil](https://github.com/tschnorpfeil) for [issue #541](https://github.com/nicobailon/pi-web-access/issues/541).
|
|
69
|
+
- `fetch_content` with `mode: "raw"` on a PDF now points at the default Markdown mode or `mode: "answer"` with a prompt, instead of only reporting an unsupported content type. Thanks to [@goodman-b](https://github.com/goodman-b) for [PR #555](https://github.com/nicobailon/pi-web-access/pull/555), split out of [PR #553](https://github.com/nicobailon/pi-web-access/pull/553).
|
|
70
|
+
- `fetch_content` on a GitHub pull request or issue now stores each fetched body, comment, review comment, file, commit, check and review once: the inline view shows the start and the end of the document holds the rest, so the retrieval hint finds what it points at. Data GitHub was never asked for points at `gh` instead, and hints use the retrieval tool's configured name, or only `gh` when retrieval is off. Thanks to [@mothieras](https://github.com/mothieras) for [issue #549](https://github.com/nicobailon/pi-web-access/issues/549).
|
|
71
|
+
- `fetch_content` answer mode with several URLs now shows each URL's answer, instead of only a list of URLs with character counts. The answers share the output limit of a single-URL answer and say when one is cut short, and the retrieval hint points at the original pages, as for a single URL. See [issue #556](https://github.com/nicobailon/pi-web-access/issues/556).
|
|
72
|
+
|
|
7
73
|
## [0.38.0] - 2026-10-09
|
|
8
74
|
|
|
9
75
|
### Highlights
|
|
@@ -332,15 +332,18 @@ Requires `ffmpeg` (and `yt-dlp` for YouTube). Timestamps accept `H:MM:SS`, `MM:S
|
|
|
332
332
|
|
|
333
333
|
With `mode: "answer"`, the answer model receives the extracted PDF Markdown rather than the saved-file notice. The Markdown file is still saved, and the original extracted content remains available through `get_search_content`; ordinary readable-mode PDF fetches continue to return the file path.
|
|
334
334
|
|
|
335
|
-
PDF URLs are converted to Markdown and saved under the temporary `pi-web-pdf` directory by default so the agent can `read` specific sections without loading the full document into context.
|
|
335
|
+
PDF URLs are converted to Markdown and saved under the temporary `pi-web-pdf` directory by default so the agent can `read` specific sections without loading the full document into context. Four engines are available, selected with `pdf.provider` (`"auto"` is the default):
|
|
336
336
|
|
|
337
337
|
| Provider | Engine | Trade-offs |
|
|
338
338
|
| --- | --- | --- |
|
|
339
|
+
| `endpoint` | Self-hosted parser endpoint (POST the PDF, get Markdown) | Layout-aware conversion (marker and similar pipelines) on hardware you run; no key, no per-page cost; requires `pdf.endpointUrl` |
|
|
339
340
|
| `datalab` | Datalab hosted conversion (Marker) | Deterministic layout-aware output — tables, multi-column reading order, headings, math; `accurate` mode handles scanned pages; may return a `parse_quality_score`; requires a Datalab key, billed per page with a free monthly credit |
|
|
340
341
|
| `gemini` | Gemini API (vision LLM) | Best on scanned/complex pages; LLM transcription can occasionally drift or truncate; requires a Gemini key |
|
|
341
342
|
| `unpdf` | Local pdf.js text extraction | Free, offline, no key; flattened text only — no layout, no tables, no OCR |
|
|
342
343
|
|
|
343
|
-
`auto` order: Datalab (when a key is configured) → Gemini (when a key is configured) → local `unpdf`.
|
|
344
|
+
`auto` order: self-hosted endpoint (when `pdf.endpointUrl` is configured) → Datalab (when a key is configured) → Gemini (when a key is configured) → local `unpdf`. The endpoint runs first because it is local and deterministic. If its request fails — parser down, engine error, timeout — the chain continues to Datalab, then Gemini, then `unpdf`, automatically. Setting `pdf.provider` to `endpoint`, `gemini`, `datalab`, or `unpdf` pins that engine and skips the other remote tiers (an explicit engine still falls back to `unpdf` when it errors, except for credential/config errors and caller cancellation). No Datalab key means the `datalab` tier is simply skipped — behavior is unchanged for existing users.
|
|
345
|
+
|
|
346
|
+
**Self-hosted parser endpoint.** `pdf.endpointUrl` receives a `multipart/form-data` POST with a `file` field (plus `engine` when `pdf.endpointEngine` is set, and `max_pages`) and answers `{ "markdown": "…" }`, or `{ "job_id": "…" }`, which is polled at `jobs/{id}` next to the configured URL until `done`, `error`, or `pdf.endpointTimeoutMs` (default 120s, capped at 300s). The URL passes the same SSRF guard as every other fetch, so a LAN host needs its range in `ssrf.allowRanges` (loopback is allowed); `PDF_ENDPOINT_URL` overrides `pdf.endpointUrl`. For a LAN parser: `{ "ssrf": { "allowRanges": ["192.168.50.0/24"] }, "pdf": { "endpointUrl": "http://192.168.50.48:8070/parse", "endpointEngine": "marker" } }`.
|
|
344
347
|
|
|
345
348
|
**Why Datalab.** The hosted converter uses a dedicated extraction engine (Marker) intended to retain document structure such as tables, multi-column reading order, headings, links, and math, where local `unpdf` extraction only yields flattened text. It is deterministic rather than LLM-based. Completed responses may include a `parse_quality_score` (0–5) for optional quality gating. Pricing is per processed page: **fast / balanced** $4 / 1,000 pages; **accurate** $10 / 1,000 pages. The free tier gives a **$10 monthly credit** (personal email; $20 with a work email) at **25 requests/minute** — roughly **2,500 pages/month free in `fast` mode** or 1,000 in `accurate` mode. Processing defaults to the **US region**. EU data residency uses **1.25× usage**; opt in with `DATALAB_PROCESSING_LOCATION=eu`.
|
|
346
349
|
|
|
@@ -352,7 +355,7 @@ Configure Datalab via the web-search config:
|
|
|
352
355
|
"pdf": {
|
|
353
356
|
"maxSizeMB": 20,
|
|
354
357
|
"maxPages": 100,
|
|
355
|
-
"provider": "auto", // "auto" | "gemini" | "datalab" | "unpdf"
|
|
358
|
+
"provider": "auto", // "auto" | "endpoint" | "gemini" | "datalab" | "unpdf"
|
|
356
359
|
"datalabMode": "balanced", // "fast" | "balanced" | "accurate"
|
|
357
360
|
"datalabTimeoutMs": 120000
|
|
358
361
|
}
|
|
@@ -398,7 +401,7 @@ fetch_content(url)
|
|
|
398
401
|
→ Video file? Gemini API (Files API) → Gemini Web (if browser cookies enabled)
|
|
399
402
|
→ GitHub URL? Clone repo, return file contents + local path
|
|
400
403
|
→ YouTube URL? Gemini Web (if browser cookies enabled) → Gemini API → Perplexity
|
|
401
|
-
→ HTTP fetch (asks for markdown first; raw mode does not) → PDF? Datalab → Gemini API → local text extraction, save to temp pi-web-pdf
|
|
404
|
+
→ HTTP fetch (asks for markdown first; raw mode does not) → PDF? Self-hosted endpoint → Datalab → Gemini API → local text extraction, save to temp pi-web-pdf
|
|
402
405
|
→ HTML? Readability (+ declared Link/rel discovery) → RSC parser → Firecrawl → Crawl4AI (each if configured) → third-party hosted fallbacks only when fetchRouting.allowRemoteHostedProviders is enabled
|
|
403
406
|
→ Text/JSON/Markdown? Return directly
|
|
404
407
|
```
|
|
@@ -594,7 +597,9 @@ Config defaults to `~/.pi/agent/web-search.json` when neither `PI_CODING_AGENT_D
|
|
|
594
597
|
"domainPolicy": {
|
|
595
598
|
"allow": ["example.com"],
|
|
596
599
|
"deny": ["blocked.example.com"]
|
|
597
|
-
}
|
|
600
|
+
},
|
|
601
|
+
"redirects": "same-origin",
|
|
602
|
+
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36"
|
|
598
603
|
},
|
|
599
604
|
"shortcuts": {
|
|
600
605
|
"curate": "ctrl+shift+s",
|
|
@@ -640,17 +645,21 @@ Set `braveBaseUrl`, `exaBaseUrl`, or `tavilyBaseUrl` to route those providers th
|
|
|
640
645
|
|
|
641
646
|
`fetchContent.domainPolicy` is an optional hostname allow/deny policy for `fetch_content` target URLs. It is off when omitted. Each bare hostname matches itself and its subdomains; `deny` wins when a hostname matches both lists. The policy is checked before HTTP(S) target handling and before each redirect followed by this extension's own fetch path. Local file paths and non-HTTP sources are not subject to this policy. It is an additional restriction: the existing SSRF guard still blocks private and internal destinations. Remote extraction services can still perform their own DNS, redirects, and egress after this extension preflights the submitted target URL, so third-party hosted HTTP(S) fallbacks stay disabled unless `fetchRouting.allowRemoteHostedProviders` is enabled for separately isolated provider deployments.
|
|
642
647
|
|
|
648
|
+
`fetchContent.redirects: "same-origin"` turns on a same-origin redirect policy for every page fetch, including `web_search` `includeContent` and `source_check`. The `fetch_content` parameter `redirects: "same-origin"` turns it on for one call; omitting it never turns a configured policy off. Under the policy every redirect target, including in `auth` profile and `mode: "raw"` fetches, must match the requested URL's scheme, hostname and effective port. The check runs before the target is resolved or requested, so in an A → B → A chain B is never contacted. A refused redirect returns an error with no page content, and no other extraction provider or retry runs after it. Only this extension's own HTTP fetch is used: Jina Reader, Firecrawl, Crawl4AI, the hosted providers and Gemini are disabled, and GitHub issue/PR, GitHub repository and YouTube URLs are refused by name, even when those integrations are turned off. In `mode: "raw"` and `auth` fetches those URLs skip the GitHub and YouTube integrations and go through the same checked HTTP fetch instead. A trusted Pi extension can enforce the policy per call by setting `event.input.redirects = "same-origin"` in a `tool_call` handler for `fetch_content`. Local files and videos are not subject to the policy.
|
|
649
|
+
|
|
650
|
+
`fetchContent.userAgent` sets the `User-Agent` header of this extension's own direct HTTP page fetch, which `fetch_content`, `web_search` `includeContent`, and `source_check` use, including `auth` profile and `mode: "raw"` fetches. It defaults to `OpenAI File Downloader, XaiImageApiFetch/1.0`; set it when a site rejects that default, for example to a regular browser User-Agent. Extraction providers such as Jina Reader or Firecrawl are not affected. The value must be a non-empty string of printable ASCII characters; any other value fails the page fetch with a config error.
|
|
651
|
+
|
|
643
652
|
`fetch.timeout` is an optional positive finite number of seconds for direct HTTP fetches and the Jina Reader fallback. When omitted, both use a 30-second budget. Fractional values are supported and rounded up to at least 1 millisecond; values that cannot be converted to a finite safe integer delay from 1 through Node's 2,147,483,647 ms timer maximum are rejected. An invalid declared value fails closed with an error naming `web-search.json`. An internal/per-call `timeoutMs` override takes precedence over this setting. Other remote extraction fallbacks keep their own documented budgets.
|
|
644
653
|
|
|
645
654
|
`fetch.defaultMode` sets the mode used when `fetch_content` omits `mode`, and `fetch.allowedModes` controls which modes the tool exposes and accepts. Valid modes are `readable`, `raw`, and `answer`. By default, the default mode is `readable` and all three modes are allowed. The default must be included in the non-empty, duplicate-free allowed list. An explicitly requested disabled mode fails before fetching or invoking a model and is never replaced with another mode. Raw mode remains direct HTTP-only and never runs readability, specialized source handling, or hosted extraction fallbacks.
|
|
646
655
|
|
|
647
656
|
`fetch.answerProvider` and `fetch.answerModel` are an optional pair that selects the model used by `fetch_content` answer mode when no per-call `answerModel` is supplied. Both values must be non-empty strings and must identify an enabled text-capable model available in Pi's model registry; invalid or partial configuration fails closed. This is opt-in: answering with the configured provider/model can send fetched page text outside the current session and may incur that provider's costs. A per-call `answerModel` override is resolved first and remains usable even when these configured defaults are malformed.
|
|
648
657
|
|
|
649
|
-
Set `searxngBaseUrl` or `SEARXNG_BASE_URL` to use a self-hosted SearXNG JSON API. A configured endpoint is preferred first in `auto` mode for local/private search.
|
|
658
|
+
Set `searxngBaseUrl` or `SEARXNG_BASE_URL` to use a self-hosted SearXNG JSON API. A configured endpoint is preferred first in `auto` mode for local/private search. A configured SearXNG base URL may use `localhost`, `127.0.0.0/8`, or `::1` without adding those ranges to global `ssrf.allowRanges`; a base URL on another private or synthetic range needs a narrow `ssrf.allowRanges` entry. The base URL and its redirects are otherwise validated like other remote requests, and configured headers are stripped from cross-origin redirects. Optional `searxngHeaders` merges extra HTTP headers into each SearXNG request (string values only; invalid header names are ignored), which is useful for reverse-proxy or Zero Trust auth such as Cloudflare Access service tokens (`CF-Access-Client-Id` / `CF-Access-Client-Secret`). Configured headers override the default `Accept: application/json` when the same name is supplied. Thanks to Marcos A. Núñez (@marnunez) for PR #107 and Avinash Kanaujiya (@avinashkanaujiya) for issue #105.
|
|
650
659
|
|
|
651
660
|
**degoog.** Set `degoogBaseUrl` or `DEGOOG_URL` to use a self-hosted [degoog](https://degoog.org) metasearch instance, or omit both to use the public `https://degoog.org` instance. degoog is keyless and explicit-only: select it with `provider: "degoog"` or place it in `searchRouting`; it is never chosen by `auto` and never participates in `provider: "all"`, so queries do not leave for a third-party metasearch instance unless you ask. When the instance protects its search routes, set `degoogApiKey` or `DEGOOG_API_KEY` and the key is sent as `Authorization: Bearer <key>`; the API key and any `degoogHeaders` are stripped from cross-origin redirects. `degoogEngines` restricts the request to specific engine ids from the instance's engine list (an array of strings), which is sent as the `engines` field on `POST /api/search`; omitting it uses the instance defaults. `recencyFilter` maps to degoog's `time` parameter, and domain filters become `site:`/`-site:` query clauses plus a local result filter; multiple allowed domains are grouped as `(site:a OR site:b)` so the query terms apply to every branch. Only absolute HTTP(S) result URLs are returned as sources, and duplicate URLs are collapsed. A 200 response without a results array is reported as an invalid response, so a configured route can continue when `fallbackOn` includes `"invalid-response"`, while a genuine empty `results` array remains a successful empty search. The configured base URL and redirects remain subject to the SSRF guard; add only the narrowest self-hosted range to `ssrf.allowRanges` when it resolves to a private or synthetic range. Optional `degoogHeaders` merges extra HTTP headers (string values only; invalid header names are ignored) for reverse-proxy or Zero Trust auth. Values from `degoogApiKey` and the configured `degoogHeaders` are redacted from reported upstream error text, and a request that exceeds the 30-second deadline fails as a timeout instead of being recorded as a completed request.
|
|
652
661
|
|
|
653
|
-
**DuckDuckGo.** DuckDuckGo HTML search is keyless and explicit-only. Select it with `provider: "duckduckgo"` or place it in `searchRouting`; it is never chosen by `auto` and never participates in `provider: "all"`. Domain filters are enforced locally after DuckDuckGo redirect URLs are decoded. `recencyFilter` is not guaranteed because the HTML endpoint has no documented stable time parameter. A
|
|
662
|
+
**DuckDuckGo.** DuckDuckGo HTML search is keyless and explicit-only. Select it with `provider: "duckduckgo"` or place it in `searchRouting`; it is never chosen by `auto` and never participates in `provider: "all"`. Domain filters are enforced locally after DuckDuckGo redirect URLs are decoded. `recencyFilter` is not guaranteed because the HTML endpoint has no documented stable time parameter. A page that is neither results nor DuckDuckGo's "no results" page is reported as an invalid response, so routing can continue when `fallbackOn` includes `"invalid-response"`; DuckDuckGo's bot check is reported as `quota`.
|
|
654
663
|
|
|
655
664
|
Set `firecrawlBaseUrl` or `FIRECRAWL_BASE_URL` to use Firecrawl for `web_search` and as an extraction fallback for `fetch_content`. Search calls `/v2/search` by default, requests `sources: ["web"]`, maps `numResults` to `limit`, maps `recencyFilter` to Firecrawl's `tbs`, and maps domain filters to `includeDomains` or `excludeDomains` when possible. With `includeContent: true`, Firecrawl search adds Markdown scrape options and returns successful result Markdown as inline content. Fetch extraction calls `/v2/scrape` by default. Set `firecrawlApiVersion` or `FIRECRAWL_API_VERSION` to `v1` for older self-hosted images. Firecrawl bills PDFs per parsed page; set `firecrawlPdfMaxPages` to a positive integer to have Firecrawl parse at most that many pages of each PDF in fetch extraction and `includeContent` search. It is a per-document cap, not a credit budget: several PDFs or repeated requests still add up. Unset keeps the current behavior, and API `v1` does not support the cap, so setting it with `v1` is a config error. When Firecrawl reports fewer parsed pages than the PDF has, the content ends with a truncation notice naming both page counts. Firecrawl page scraping is cache-only by default (`lockdown: true`), so the Firecrawl server does not make fresh outbound target requests unless you explicitly set `firecrawlFreshScrape: true` or `FIRECRAWL_FRESH_SCRAPE=1`. Enable fresh scraping only for a Firecrawl deployment whose own egress, redirects, DNS rebinding behavior, and internal-network access are isolated or allowlisted; this extension can preflight submitted fetch URLs but cannot control network requests made by the Firecrawl server. A configured Firecrawl API base URL may use `localhost`, `127.0.0.0/8`, or `::1` without adding those loopback ranges to global `ssrf.allowRanges`; that exception is only for Firecrawl API calls, not submitted fetch/search target URLs. The configured Firecrawl API base URL and redirects are otherwise still validated by the same SSRF guard as other remote requests, and Firecrawl credentials are stripped from cross-origin API redirects.
|
|
656
665
|
|
|
@@ -1073,7 +1082,7 @@ Values use the same format as pi keybindings (e.g. `ctrl+s`, `ctrl+shift+s`, `al
|
|
|
1073
1082
|
|
|
1074
1083
|
Set `"enabled": false` under `tools`, `commands`, `image`, or `pdf` to disable that feature. Tool-specific settings override the legacy `webSearch.enabled` shorthand; without an override, it still disables `web_search` and `source_check`. `image.enabled: false` blocks direct image fetches and video frame extraction, and prevents video thumbnails. `pdf.enabled: false` blocks PDF extraction. For GitHub specifically, `githubClone.enabled: false` only skips clone/API specialization, and `githubPrIssue.enabled: false` only skips PR/issue specialization; neither setting unregisters `fetch_content` or blocks generic URL extraction. Pi restart is required for tool and command registration changes.
|
|
1075
1084
|
|
|
1076
|
-
Rate limits: Perplexity is capped at 10 requests/minute (client-side). Jina Search, TinyFish, Search1API, and Searchinfinity apply the plan limits documented by their APIs. Querit Search and Contents subscriptions are independent. Content fetches run 3 concurrent; direct HTTP fetches and Jina Reader use a 30s timeout by default, configurable together with `fetch.timeout` in seconds. Remote extraction fallbacks carry their own budgets and are not covered by that setting: Firecrawl 60s, Crawl4AI 60s, Kagi Extract 60s, Ollama Web Fetch 60s, Bright Data Web Unlocker 60s, TinyFish up to 150s, Gemini 120s, Datalab 120s (capped at 300s, rate-limited to 25 requests/minute on the free tier). `pdf.maxSizeMB` defaults to 20 and is capped at 50. `pdf.maxPages` defaults to 100 and limits every PDF provider to the first N pages.
|
|
1085
|
+
Rate limits: Perplexity is capped at 10 requests/minute (client-side). Jina Search, TinyFish, Search1API, and Searchinfinity apply the plan limits documented by their APIs. Querit Search and Contents subscriptions are independent. Content fetches run 3 concurrent; direct HTTP fetches and Jina Reader use a 30s timeout by default, configurable together with `fetch.timeout` in seconds. Remote extraction fallbacks carry their own budgets and are not covered by that setting: Firecrawl 60s, Crawl4AI 60s, Kagi Extract 60s, Ollama Web Fetch 60s, Bright Data Web Unlocker 60s, TinyFish up to 150s, Gemini 120s, Datalab 120s (capped at 300s, rate-limited to 25 requests/minute on the free tier), self-hosted PDF endpoint 120s (capped at 300s). `pdf.maxSizeMB` defaults to 20 and is capped at 50. `pdf.maxPages` defaults to 100 and limits every PDF provider to the first N pages.
|
|
1077
1086
|
|
|
1078
1087
|
## Limitations
|
|
1079
1088
|
|
|
@@ -112,6 +112,24 @@ function matchesDomainFilters(url: string, filters: NormalizedDomainFilters): bo
|
|
|
112
112
|
return !filters.blocked.some(domain => hostMatchesDomain(hostname, domain));
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
const HTML_ENTITIES: Record<string, string> = {
|
|
116
|
+
"&": "&", "<": "<", ">": ">", """: "\"", "'": "'", " ": " ",
|
|
117
|
+
"—": "—", "–": "–", "…": "…", "’": "’", "‘": "‘",
|
|
118
|
+
"”": "”", "“": "“", "·": "·", "•": "•", "°": "°",
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/** Brave marks matched terms with tags and escapes the rest. */
|
|
122
|
+
function stripHtml(value: string): string {
|
|
123
|
+
return value
|
|
124
|
+
.replace(/<[^>]*>/g, "")
|
|
125
|
+
.replace(/&(?:#(x?)([0-9a-f]+)|[a-z]+);/gi, (entity, hex: string | undefined, digits: string | undefined) => {
|
|
126
|
+
if (!digits) return HTML_ENTITIES[entity.toLowerCase()] ?? entity;
|
|
127
|
+
const code = Number.parseInt(digits, hex ? 16 : 10);
|
|
128
|
+
return code <= 0x10ffff && (code < 0xd800 || code > 0xdfff) ? String.fromCodePoint(code) : entity;
|
|
129
|
+
})
|
|
130
|
+
.trim();
|
|
131
|
+
}
|
|
132
|
+
|
|
115
133
|
export function isBraveAvailable(): boolean {
|
|
116
134
|
return hasCredentialSource({
|
|
117
135
|
provider: "Brave",
|
|
@@ -198,9 +216,9 @@ export async function searchWithBrave(
|
|
|
198
216
|
for (const item of data.web?.results ?? []) {
|
|
199
217
|
if (!item.url || !matchesDomainFilters(item.url, domainFilters)) continue;
|
|
200
218
|
results.push({
|
|
201
|
-
title: item.title || item.url,
|
|
219
|
+
title: stripHtml(item.title || "") || item.url,
|
|
202
220
|
url: item.url,
|
|
203
|
-
snippet: item.description || "",
|
|
221
|
+
snippet: stripHtml(item.description || ""),
|
|
204
222
|
});
|
|
205
223
|
if (results.length >= numResults) break;
|
|
206
224
|
}
|
|
@@ -195,7 +195,8 @@ export function findContent(
|
|
|
195
195
|
if (contained.length === 0) continue;
|
|
196
196
|
const prefix = range.start > 0 ? "…" : "";
|
|
197
197
|
const suffix = range.end < text.length ? "…" : "";
|
|
198
|
-
const snippet = `${prefix}${text.slice(range.start, range.end)
|
|
198
|
+
const snippet = `${prefix}${text.slice(range.start, range.end)
|
|
199
|
+
.replace(/[\uD800-\uDFFF]/gu, "\uFFFD").replace(/\s+/g, " ").trim()}${suffix}`;
|
|
199
200
|
const counts = contained
|
|
200
201
|
.map(result => `${overflow ? result.id : `\"${result.query}\"`} ×${result.count}`)
|
|
201
202
|
.join(", ");
|