@herbertgao/pi-extensions 2026.11.11 → 2026.11.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +10 -10
- package/THIRD_PARTY_NOTICES.md +3 -3
- package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +10 -0
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +3 -4
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +3 -4
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/core.ts +22 -15
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/index.ts +22 -8
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +0 -29
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/prompt-editor.ts +5 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +60 -39
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +3 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +0 -40
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-parse.ts +4 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +21 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/format.ts +15 -0
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
- package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-impeccable/README.md +2 -2
- package/node_modules/@herbertgao/pi-impeccable/package.json +4 -4
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/SKILL.md +2 -2
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/adapt.md +1 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/animate.md +17 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique-rubric.md +496 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique.md +12 -504
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/motion-reviewer.md +29 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/hooks.md +3 -3
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work-comp.md +24 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work-world.md +20 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work.md +5 -34
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/typeset.md +6 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/VERSION +1 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/engine-checksums.txt +5 -5
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser.js +17 -18
- package/node_modules/pi-antigravity/README.md +58 -9
- package/node_modules/pi-antigravity/docs/reader-guarantees.md +35 -0
- package/node_modules/pi-antigravity/package.json +15 -6
- package/node_modules/pi-antigravity/src/client/client.ts +63 -14
- package/node_modules/pi-antigravity/src/client/enterprise.ts +150 -0
- package/node_modules/pi-antigravity/src/client/index.ts +1 -0
- package/node_modules/pi-antigravity/src/diagnostics/diagnostics.ts +7 -0
- package/node_modules/pi-antigravity/src/features/generate-image.ts +56 -2
- package/node_modules/pi-antigravity/src/features/read-url-content.ts +124 -0
- package/node_modules/pi-antigravity/src/image/image.ts +16 -2
- package/node_modules/pi-antigravity/src/index.ts +145 -2
- package/node_modules/pi-antigravity/src/models/discovery.ts +3 -4
- package/node_modules/pi-antigravity/src/models/grouping.ts +39 -15
- package/node_modules/pi-antigravity/src/models/models.ts +126 -14
- package/node_modules/pi-antigravity/src/stream/stream.ts +189 -30
- package/node_modules/pi-antigravity/src/types/types.ts +30 -1
- package/node_modules/pi-antigravity/src/usage/usage.ts +58 -0
- package/node_modules/pi-antigravity/src/utils/address.ts +180 -0
- package/node_modules/pi-antigravity/src/utils/credits.ts +149 -0
- package/node_modules/pi-antigravity/src/utils/html.ts +31 -0
- package/node_modules/pi-antigravity/src/utils/index.ts +2 -0
- package/node_modules/pi-antigravity/src/utils/security.ts +172 -13
- package/node_modules/pi-antigravity/src/utils/text.ts +66 -0
- package/node_modules/pi-antigravity/src/utils/util.ts +5 -4
- package/node_modules/pi-antigravity/src/web-fetch/document.ts +83 -0
- package/node_modules/pi-antigravity/src/web-fetch/fences.ts +24 -0
- package/node_modules/pi-antigravity/src/web-fetch/header.ts +97 -0
- package/node_modules/pi-antigravity/src/web-fetch/index.ts +3 -0
- package/node_modules/pi-antigravity/src/web-fetch/inspect.ts +328 -0
- package/node_modules/pi-antigravity/src/web-fetch/limits.ts +4 -0
- package/node_modules/pi-antigravity/src/web-fetch/markdown.ts +744 -0
- package/node_modules/pi-antigravity/src/web-fetch/mdn.ts +164 -0
- package/node_modules/pi-antigravity/src/web-fetch/media.ts +11 -0
- package/node_modules/pi-antigravity/src/web-fetch/metadata.ts +9 -0
- package/node_modules/pi-antigravity/src/web-fetch/representation.ts +93 -0
- package/node_modules/pi-antigravity/src/web-fetch/save.ts +71 -0
- package/node_modules/pi-antigravity/src/web-fetch/sites.ts +138 -0
- package/node_modules/pi-antigravity/src/web-fetch/vendor.d.ts +9 -0
- package/node_modules/pi-antigravity/src/web-fetch/web-fetch.ts +957 -0
- package/node_modules/pi-antigravity/tsconfig.json +2 -2
- package/node_modules/pi-commandcode-provider/CHANGELOG.md +10 -0
- package/node_modules/pi-commandcode-provider/README.md +2 -2
- package/node_modules/pi-commandcode-provider/package.json +1 -1
- package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +15 -9
- package/node_modules/pi-commandcode-provider/src/oauth.ts +69 -12
- package/node_modules/pi-lens/CHANGELOG-USER.md +6 -6
- package/node_modules/pi-lens/CHANGELOG.md +172 -0
- package/node_modules/pi-lens/README.md +103 -217
- package/node_modules/pi-lens/dist/{chunk-KXDQD34C.js → chunk-27JQHK7Y.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-W6VLB6LL.js → chunk-2APSZHHI.js} +61 -3
- package/node_modules/pi-lens/dist/{chunk-5EEWCJG7.js → chunk-2H5GHZKC.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-TS5EIWEF.js → chunk-2H7NFZ4Q.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-6GWCYEP7.js → chunk-37IDWT6O.js} +64 -16
- package/node_modules/pi-lens/dist/{chunk-OEPWTSUG.js → chunk-3PAS2ERX.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-ET3DSSFZ.js → chunk-3PO4YYOX.js} +9 -17
- package/node_modules/pi-lens/dist/{chunk-C6V2DSZZ.js → chunk-3QXFUP6T.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-HWMNTQBJ.js → chunk-3TSMQZG6.js} +32 -11
- package/node_modules/pi-lens/dist/{chunk-QY6J2FTK.js → chunk-4DAHGU3V.js} +15 -14
- package/node_modules/pi-lens/dist/{chunk-PCREZ4HJ.js → chunk-4IZZEN63.js} +33 -34
- package/node_modules/pi-lens/dist/{chunk-OYXD2MOM.js → chunk-5HBQL7DH.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-B4FAFEBP.js → chunk-5JB4WENL.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-5YJXF2IS.js +56 -0
- package/node_modules/pi-lens/dist/{chunk-GHATCG2A.js → chunk-6CFSDLHE.js} +22 -18
- package/node_modules/pi-lens/dist/{chunk-FVQKX5KI.js → chunk-6E5QLMWI.js} +24 -22
- package/node_modules/pi-lens/dist/{chunk-AVBEPUCD.js → chunk-6GLMMGCX.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-YTXFNCVN.js → chunk-74AMPWNC.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-K2GV34T2.js → chunk-7CLWC2UH.js} +26 -37
- package/node_modules/pi-lens/dist/{chunk-MOEWCPMC.js → chunk-7DPXUPRF.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-7BEADGAZ.js → chunk-7U36VQL6.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-PPYUBO6Y.js → chunk-7WKVCZI4.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-ILC2B7IJ.js → chunk-7ZVTFLCC.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-IT7MFVGP.js → chunk-ADYQRETD.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-NCDH2JB7.js → chunk-ARTYCUGF.js} +25 -10
- package/node_modules/pi-lens/dist/{chunk-Z6WTLVUL.js → chunk-AXAR5ZW2.js} +225 -104
- package/node_modules/pi-lens/dist/{chunk-PK3GDU4M.js → chunk-AZG5UJYY.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-NRVWLTOY.js → chunk-B2OXE4AH.js} +60 -21
- package/node_modules/pi-lens/dist/{chunk-ORYQGVC3.js → chunk-B42AIWPJ.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-IC4L65U7.js → chunk-BBSDJTOV.js} +12 -13
- package/node_modules/pi-lens/dist/{chunk-HJWF7CGW.js → chunk-BKWFDWYM.js} +16 -16
- package/node_modules/pi-lens/dist/{chunk-D2ZYRI7M.js → chunk-C5PLBTNR.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-SRXYSLMW.js → chunk-CQY2HEH7.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-7424ANRU.js → chunk-CXQYK4YT.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-HYR25MV3.js → chunk-CZJGAOKL.js} +8 -7
- package/node_modules/pi-lens/dist/{chunk-DIIDMDZU.js → chunk-DCA2MXVQ.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-K2LD6YNH.js → chunk-DFKOA74L.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-AYDE7RFV.js → chunk-DI4AZZNY.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-6EXGCXM5.js → chunk-G53LBDNU.js} +99 -5
- package/node_modules/pi-lens/dist/chunk-GCSDF5IE.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-5KLRCUDT.js → chunk-H5API74E.js} +6 -6
- package/node_modules/pi-lens/dist/chunk-HBX55MWO.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-JRSS6KM4.js → chunk-HIJ4CHFF.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-3MHY4BQY.js → chunk-HIRBC72R.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-F7AMFFVK.js → chunk-HRLF35WL.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-HSTN27NR.js → chunk-I2FYOZNW.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-5FDUKJZO.js → chunk-I3NZVAMN.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-NZINZCHB.js → chunk-INBK3HIT.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-PXGVB2CY.js → chunk-J2ZB5MDS.js} +20 -18
- package/node_modules/pi-lens/dist/{chunk-HYDJUVOE.js → chunk-JGUDT5KD.js} +4 -4
- package/node_modules/pi-lens/dist/chunk-JOIKBUQN.js +88 -0
- package/node_modules/pi-lens/dist/{chunk-AZXTLZHE.js → chunk-K4Z7MK6T.js} +169 -165
- package/node_modules/pi-lens/dist/{chunk-WTSQKJAR.js → chunk-K7O6AHSJ.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-S6ZQFPOX.js → chunk-KNJH6WJQ.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-SUIZOCSY.js → chunk-KNSOA43J.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-3QMLB4TI.js → chunk-KXGTLAUW.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-OHEUOWYT.js → chunk-KZ732ZVW.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-G3LR6V6N.js → chunk-L6BDRYUK.js} +19 -17
- package/node_modules/pi-lens/dist/{chunk-OVPR3GQ6.js → chunk-LGH2HHZG.js} +24 -6
- package/node_modules/pi-lens/dist/{chunk-3R3Z54J7.js → chunk-LOEJFTF2.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-HGEE5LDW.js → chunk-LQQNFCQJ.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-LVLPA32Q.js +810 -0
- package/node_modules/pi-lens/dist/chunk-M2YMBT5G.js +73 -0
- package/node_modules/pi-lens/dist/{chunk-Z2W5YJBW.js → chunk-MJRGPEQ5.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-3EIZMRXI.js → chunk-MOAVEPC4.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-TOOXNL6M.js → chunk-NGNBJIUO.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-AGEQRJ5A.js → chunk-NHA5K226.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-YLW26OHX.js → chunk-NNEQOC3U.js} +31 -59
- package/node_modules/pi-lens/dist/{chunk-ZWZD4TJ5.js → chunk-O2MHF7QM.js} +35 -36
- package/node_modules/pi-lens/dist/{chunk-PTJXMYRY.js → chunk-OLWGYBYT.js} +15 -16
- package/node_modules/pi-lens/dist/{chunk-JKAVKTMY.js → chunk-OZQQ3AIR.js} +17 -20
- package/node_modules/pi-lens/dist/{chunk-6JLNZ6DP.js → chunk-P5MSLVUW.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-OF2YGDUE.js → chunk-PFJLYRO3.js} +37 -38
- package/node_modules/pi-lens/dist/chunk-PKWEBMCA.js +2957 -0
- package/node_modules/pi-lens/dist/{chunk-JLMS7EMD.js → chunk-PPQHMSPH.js} +16 -15
- package/node_modules/pi-lens/dist/{chunk-6EIV3H7O.js → chunk-PQF6YGYB.js} +12 -5
- package/node_modules/pi-lens/dist/{chunk-VU2PRGRI.js → chunk-PQXUZYTQ.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-MV6ST2KT.js → chunk-Q7J3JYJ2.js} +13 -12
- package/node_modules/pi-lens/dist/{chunk-BMMRLJA4.js → chunk-QE5DJ7MX.js} +27 -10
- package/node_modules/pi-lens/dist/{chunk-IZ36G463.js → chunk-QE7BJQ6K.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-E5SSUV2A.js → chunk-QMWKSYWB.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-QJ4T73J5.js → chunk-QV3JPCMK.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-3PMLYGJN.js → chunk-R4L7KZ7R.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-7ZVEFWOE.js → chunk-RIH3UBK4.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-T5EGSBM2.js → chunk-RJ3APNIP.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-AAIVSSUU.js → chunk-S6MCMD27.js} +35 -12
- package/node_modules/pi-lens/dist/{chunk-SF7KSXB5.js → chunk-SCU62JLX.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-FDLGJFAE.js → chunk-SDYLT45T.js} +3 -3
- package/node_modules/pi-lens/dist/chunk-TFKN5EIR.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-Y7XMKBFP.js → chunk-TKOFTLGB.js} +34 -26
- package/node_modules/pi-lens/dist/chunk-TQWRH25U.js +35 -0
- package/node_modules/pi-lens/dist/{chunk-DZSQXG66.js → chunk-TWEOJE3D.js} +277 -62
- package/node_modules/pi-lens/dist/{chunk-R67WQ5RY.js → chunk-UN72ZAJ5.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-AD7JDEI6.js → chunk-UNP6Y4JV.js} +16 -16
- package/node_modules/pi-lens/dist/{chunk-D6ANA6YU.js → chunk-VGRGW4UL.js} +63 -55
- package/node_modules/pi-lens/dist/{chunk-DFAY7JUN.js → chunk-VSQT6IHZ.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-7T64QA5D.js → chunk-VWEBZ2JV.js} +39 -38
- package/node_modules/pi-lens/dist/{chunk-HRQTYU2T.js → chunk-W26QZ3OM.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-2HWVG3IM.js → chunk-XDNWR7SG.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-75TVYCQW.js → chunk-XSC3BCN3.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-ME6MF2N2.js → chunk-YCR6ZYTE.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-LD7SXICE.js → chunk-ZI7YHV6I.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-E3PNZDPH.js → chunk-ZQSSO7LO.js} +33 -1
- package/node_modules/pi-lens/dist/{chunk-T6PPK3T6.js → chunk-ZULZS2I6.js} +385 -407
- package/node_modules/pi-lens/dist/index.js +6508 -5413
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +9 -9
- package/node_modules/pi-lens/dist/mcp/cli.js +39 -38
- package/node_modules/pi-lens/dist/mcp/server.js +602 -345
- package/node_modules/pi-lens/dist/mcp/worker.js +57 -58
- package/node_modules/pi-lens/dist/probes/installer.js +19 -17
- package/node_modules/pi-lens/docs/architecture.md +113 -0
- package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +2 -2
- package/node_modules/pi-lens/docs/ci.md +18 -4
- package/node_modules/pi-lens/docs/defect-shapes.md +41 -3
- package/node_modules/pi-lens/docs/dependencies.md +10 -10
- package/node_modules/pi-lens/docs/features.md +3 -3
- package/node_modules/pi-lens/docs/invariants/dispatch-runners.md +13 -1
- package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +19 -0
- package/node_modules/pi-lens/docs/language-coverage.md +39 -0
- package/node_modules/pi-lens/docs/lsp-capability-matrix.md +10 -4
- package/node_modules/pi-lens/docs/lsp-idle-eviction.md +1 -1
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +4 -0
- package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +1 -1
- package/node_modules/pi-lens/docs/pi-lens-reviewer.md +4 -5
- package/node_modules/pi-lens/docs/pi-lens-subagent.md +5 -2
- package/node_modules/pi-lens/docs/prose-standard.md +112 -0
- package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
- package/node_modules/pi-lens/docs/usage.md +50 -0
- package/node_modules/pi-lens/package.json +1 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/array-callback-return-js-test.yml +23 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/array-callback-return-test.yml +23 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-js-test.yml +8 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-test.yml +8 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-js-test.yml +16 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-test.yml +16 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/array-callback-return-js.yml +8 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/array-callback-return.yml +8 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-negation-in-equality-check-js.yml +17 -5
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-negation-in-equality-check.yml +17 -5
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-throwing-call-js.yml +8 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-throwing-call.yml +8 -1
- package/node_modules/pi-lens/rules/tree-sitter-queries/typescript/ts-react-antipatterns.yml +8 -0
- package/node_modules/pi-web-access/CHANGELOG.md +29 -0
- package/node_modules/pi-web-access/README.md +35 -15
- package/node_modules/pi-web-access/anysearch.ts +7 -3
- package/node_modules/pi-web-access/autom.ts +196 -0
- package/node_modules/pi-web-access/cloro.ts +254 -0
- package/node_modules/pi-web-access/curator-page.ts +7 -1
- package/node_modules/pi-web-access/curator-server.ts +3 -0
- package/node_modules/pi-web-access/dist/index.js +12931 -12111
- package/node_modules/pi-web-access/dist/mcp-cli.js +1188 -416
- package/node_modules/pi-web-access/domain-filter-normalization.ts +30 -0
- package/node_modules/pi-web-access/duckduckgo-rate-limit.ts +144 -34
- package/node_modules/pi-web-access/duckduckgo.ts +11 -3
- package/node_modules/pi-web-access/extract.ts +60 -4
- package/node_modules/pi-web-access/gemini-search.ts +25 -5
- package/node_modules/pi-web-access/index.ts +9 -1
- package/node_modules/pi-web-access/package.json +2 -2
- package/node_modules/pi-web-access/page-query.ts +12 -3
- package/node_modules/pi-web-access/specstream.ts +276 -0
- package/node_modules/pi-web-access/tool-activation.ts +21 -6
- package/node_modules/pi-web-access/utils.ts +4 -0
- package/node_modules/pi-web-access/video-extract.ts +2 -2
- package/node_modules/pi-web-access/web-tool-core.ts +24 -5
- package/node_modules/pi-web-access/youtube-extract.ts +2 -2
- package/package.json +10 -7
- package/node_modules/pi-lens/dist/chunk-3VWEZ6H2.js +0 -72
- package/node_modules/pi-lens/dist/chunk-7KWI5UHL.js +0 -28
- package/node_modules/pi-lens/dist/chunk-7M64NTAK.js +0 -38
- package/node_modules/pi-lens/dist/chunk-BEIPWPVR.js +0 -1037
- package/node_modules/pi-lens/dist/chunk-D7OEGXDX.js +0 -2417
- package/node_modules/pi-lens/dist/chunk-KUDUKKQE.js +0 -89
- package/node_modules/pi-lens/dist/chunk-TM3A3K7T.js +0 -28
- package/node_modules/pi-lens/dist/chunk-VD7MQFEV.js +0 -56
- package/node_modules/pi-lens/dist/chunk-YLHJWAQS.js +0 -256
- package/node_modules/pi-lens/dist/chunk-YULIERZW.js +0 -27
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { activityMonitor } from "./activity.ts";
|
|
3
|
+
import { normalizeDomain } from "./domain-filter-normalization.ts";
|
|
4
|
+
import type { ExtractedContent, ExtractOptions } from "./extract.ts";
|
|
5
|
+
import type { SearchOptions, SearchResponse } from "./perplexity.ts";
|
|
6
|
+
import { formatSearchResultsAsAnswer } from "./search-answer-formatting.ts";
|
|
7
|
+
import { normalizeSearchResultCount } from "./search-result-count-normalization.ts";
|
|
8
|
+
import { hasCredentialSource, redactCredential, resolveCredential } from "./credential-source.ts";
|
|
9
|
+
import { fetchWithCredentialRedirects, getWebSearchConfigPath, resolveProviderApiUrl } from "./utils.ts";
|
|
10
|
+
|
|
11
|
+
// SpecStream Search API (GET /v1/web-search, $5 per 1,000 searches) and Extract API
|
|
12
|
+
// (POST /v1/extract, $0.80 per 1,000 pages): https://specstream.ai/search-api and https://specstream.ai/extract-api
|
|
13
|
+
const SPECSTREAM_SEARCH_URL = "https://api.specstream.ai/v1/web-search";
|
|
14
|
+
const SPECSTREAM_EXTRACT_URL = "https://api.specstream.ai/v1/extract";
|
|
15
|
+
const CONFIG_PATH = getWebSearchConfigPath();
|
|
16
|
+
const SEARCH_TIMEOUT_MS = 60_000;
|
|
17
|
+
const EXTRACT_TIMEOUT_MS = 60_000;
|
|
18
|
+
const MAX_QUERY_CHARS = 2_000;
|
|
19
|
+
|
|
20
|
+
interface WebSearchConfig {
|
|
21
|
+
specstreamBaseUrl?: unknown;
|
|
22
|
+
specstreamApiKey?: unknown;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface SpecStreamSource {
|
|
26
|
+
url?: unknown;
|
|
27
|
+
title?: unknown;
|
|
28
|
+
snippet?: unknown;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface SpecStreamExtractResult {
|
|
32
|
+
url?: unknown;
|
|
33
|
+
status?: unknown;
|
|
34
|
+
title?: unknown;
|
|
35
|
+
text?: unknown;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let cachedConfig: WebSearchConfig | null = null;
|
|
39
|
+
|
|
40
|
+
function loadConfig(): WebSearchConfig {
|
|
41
|
+
if (cachedConfig) return cachedConfig;
|
|
42
|
+
if (!existsSync(CONFIG_PATH)) {
|
|
43
|
+
cachedConfig = {};
|
|
44
|
+
return cachedConfig;
|
|
45
|
+
}
|
|
46
|
+
const raw = readFileSync(CONFIG_PATH, "utf-8");
|
|
47
|
+
let parsed: unknown;
|
|
48
|
+
try {
|
|
49
|
+
parsed = JSON.parse(raw);
|
|
50
|
+
} catch (err) {
|
|
51
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
52
|
+
throw new Error(`Failed to parse ${CONFIG_PATH}: ${message}`);
|
|
53
|
+
}
|
|
54
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
55
|
+
throw new Error(`Invalid config in ${CONFIG_PATH}: expected a JSON object`);
|
|
56
|
+
}
|
|
57
|
+
cachedConfig = parsed as WebSearchConfig;
|
|
58
|
+
return cachedConfig;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function getApiKey(signal?: AbortSignal): Promise<string | null> {
|
|
62
|
+
return resolveCredential({
|
|
63
|
+
provider: "SpecStream",
|
|
64
|
+
configuredValue: loadConfig().specstreamApiKey,
|
|
65
|
+
environmentValue: process.env.SPECSTREAM_API_KEY,
|
|
66
|
+
signal,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function requireApiKey(signal?: AbortSignal): Promise<string> {
|
|
71
|
+
const apiKey = await getApiKey(signal);
|
|
72
|
+
if (!apiKey) {
|
|
73
|
+
throw new Error(
|
|
74
|
+
"SpecStream API key not found. Either:\n" +
|
|
75
|
+
` 1. Create ${CONFIG_PATH} with { "specstreamApiKey": "your-key" }\n` +
|
|
76
|
+
" 2. Set SPECSTREAM_API_KEY environment variable\n" +
|
|
77
|
+
"Get a key at https://specstream.ai",
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return apiKey;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface DomainFilters {
|
|
84
|
+
include: string[];
|
|
85
|
+
exclude: string[];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function parseDomainFilter(domainFilter: string[] | undefined): DomainFilters {
|
|
89
|
+
const filters: DomainFilters = { include: [], exclude: [] };
|
|
90
|
+
for (const raw of domainFilter ?? []) {
|
|
91
|
+
const domain = normalizeDomain(raw);
|
|
92
|
+
if (!domain) continue;
|
|
93
|
+
const target = raw.trim().startsWith("-") ? filters.exclude : filters.include;
|
|
94
|
+
if (!target.includes(domain)) target.push(domain);
|
|
95
|
+
}
|
|
96
|
+
return filters;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function passesDomainFilters(url: URL, filters: DomainFilters): boolean {
|
|
100
|
+
if (filters.include.length === 0 && filters.exclude.length === 0) return true;
|
|
101
|
+
const hostname = url.hostname.toLowerCase();
|
|
102
|
+
const matches = (domain: string) => hostname === domain || hostname.endsWith(`.${domain}`);
|
|
103
|
+
if (filters.exclude.some(matches)) return false;
|
|
104
|
+
return filters.include.length === 0 || filters.include.some(matches);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function errorMessage(err: unknown): string {
|
|
108
|
+
return err instanceof Error ? err.message : String(err);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function invalidResponse(message: string): Error {
|
|
112
|
+
return new Error(`SpecStream returned invalid response: ${message}`);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function redactError(err: unknown, apiKey: string): Error {
|
|
116
|
+
const message = errorMessage(err);
|
|
117
|
+
const redactedMessage = redactCredential(message, apiKey);
|
|
118
|
+
if (redactedMessage === message && err instanceof Error) return err;
|
|
119
|
+
const redactedError = new Error(redactedMessage);
|
|
120
|
+
if (err instanceof Error) redactedError.name = err.name;
|
|
121
|
+
return redactedError;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function readJson(response: Response): Promise<unknown> {
|
|
125
|
+
try {
|
|
126
|
+
return await response.json();
|
|
127
|
+
} catch (err) {
|
|
128
|
+
// Only a parse failure is invalid JSON; a dropped connection or timeout keeps its own classification.
|
|
129
|
+
if (!(err instanceof SyntaxError)) throw err;
|
|
130
|
+
throw new Error(`SpecStream returned invalid JSON: ${errorMessage(err)}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// The API wraps every reply as { data, error }. A body without the wrapper is read as it is.
|
|
135
|
+
function unwrapEnvelope(value: unknown): Record<string, unknown> {
|
|
136
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw invalidResponse("expected an object envelope");
|
|
137
|
+
const envelope = value as Record<string, unknown>;
|
|
138
|
+
const data = envelope.data;
|
|
139
|
+
if (data && typeof data === "object" && !Array.isArray(data)) return data as Record<string, unknown>;
|
|
140
|
+
const error = envelope.error;
|
|
141
|
+
if (data === null && error && typeof error === "object") {
|
|
142
|
+
const message = (error as Record<string, unknown>).message;
|
|
143
|
+
throw new Error(`SpecStream error: ${typeof message === "string" && message ? message : "request failed"}`);
|
|
144
|
+
}
|
|
145
|
+
return envelope;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function parseSearchResponse(value: unknown): SpecStreamSource[] {
|
|
149
|
+
const data = unwrapEnvelope(value);
|
|
150
|
+
if (!Array.isArray(data.sources)) throw invalidResponse("expected sources array");
|
|
151
|
+
return data.sources as SpecStreamSource[];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function parseExtractResponse(value: unknown): SpecStreamExtractResult[] {
|
|
155
|
+
const data = unwrapEnvelope(value);
|
|
156
|
+
if (!Array.isArray(data.results)) throw invalidResponse("expected results array");
|
|
157
|
+
return data.results as SpecStreamExtractResult[];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function isSpecStreamAvailable(): boolean {
|
|
161
|
+
return hasCredentialSource({ provider: "SpecStream", configuredValue: loadConfig().specstreamApiKey, environmentValue: process.env.SPECSTREAM_API_KEY });
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// The search reply lists the pages it read in rank order.
|
|
165
|
+
export async function searchWithSpecStream(query: string, options: SearchOptions = {}): Promise<SearchResponse> {
|
|
166
|
+
const apiKey = await requireApiKey(options.signal);
|
|
167
|
+
const numResults = normalizeSearchResultCount(options.numResults);
|
|
168
|
+
const filters = parseDomainFilter(options.domainFilter);
|
|
169
|
+
const endpoint = new URL(resolveProviderApiUrl("specstream", SPECSTREAM_SEARCH_URL, loadConfig().specstreamBaseUrl));
|
|
170
|
+
endpoint.searchParams.set("q", query.slice(0, MAX_QUERY_CHARS));
|
|
171
|
+
const activityId = activityMonitor.logStart({ type: "api", query });
|
|
172
|
+
const timeoutSignal = AbortSignal.timeout(SEARCH_TIMEOUT_MS);
|
|
173
|
+
let response: Response;
|
|
174
|
+
let entries: SpecStreamSource[];
|
|
175
|
+
try {
|
|
176
|
+
response = await fetchWithCredentialRedirects(endpoint.toString(), {
|
|
177
|
+
method: "GET",
|
|
178
|
+
headers: {
|
|
179
|
+
Accept: "application/json",
|
|
180
|
+
Authorization: `Bearer ${apiKey}`,
|
|
181
|
+
"User-Agent": "pi-web-access",
|
|
182
|
+
},
|
|
183
|
+
signal: options.signal ? AbortSignal.any([timeoutSignal, options.signal]) : timeoutSignal,
|
|
184
|
+
}, ["Authorization"]);
|
|
185
|
+
if (!response.ok) {
|
|
186
|
+
const errorText = await response.text();
|
|
187
|
+
throw new Error(`SpecStream error ${response.status}: ${redactCredential(errorText, apiKey).slice(0, 300)}`);
|
|
188
|
+
}
|
|
189
|
+
entries = parseSearchResponse(await readJson(response));
|
|
190
|
+
} catch (err) {
|
|
191
|
+
if (options.signal?.aborted) {
|
|
192
|
+
activityMonitor.logComplete(activityId, 0);
|
|
193
|
+
throw new Error("Aborted");
|
|
194
|
+
}
|
|
195
|
+
const providerTimeout = timeoutSignal.aborted || (err instanceof Error && err.name === "TimeoutError");
|
|
196
|
+
const outgoing = providerTimeout
|
|
197
|
+
? new Error(`SpecStream request timed out after ${Math.round(SEARCH_TIMEOUT_MS / 1000)}s`)
|
|
198
|
+
: redactError(err, apiKey);
|
|
199
|
+
activityMonitor.logError(activityId, redactCredential(errorMessage(outgoing), apiKey));
|
|
200
|
+
throw outgoing;
|
|
201
|
+
}
|
|
202
|
+
activityMonitor.logComplete(activityId, response.status);
|
|
203
|
+
const results: SearchResponse["results"] = [];
|
|
204
|
+
for (const entry of entries) {
|
|
205
|
+
if (!entry || typeof entry !== "object") continue;
|
|
206
|
+
if (typeof entry.url !== "string" || !entry.url) continue;
|
|
207
|
+
let resultUrl: URL;
|
|
208
|
+
try {
|
|
209
|
+
resultUrl = new URL(entry.url);
|
|
210
|
+
} catch {
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
if (resultUrl.protocol !== "http:" && resultUrl.protocol !== "https:") continue;
|
|
214
|
+
if (!passesDomainFilters(resultUrl, filters)) continue;
|
|
215
|
+
results.push({
|
|
216
|
+
title: typeof entry.title === "string" && entry.title.trim() ? entry.title.trim() : `Source ${results.length + 1}`,
|
|
217
|
+
url: resultUrl.href,
|
|
218
|
+
snippet: typeof entry.snippet === "string" ? entry.snippet : "",
|
|
219
|
+
});
|
|
220
|
+
if (results.length >= numResults) break;
|
|
221
|
+
}
|
|
222
|
+
return { answer: formatSearchResultsAsAnswer(results), results };
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Extract reads a page live and returns its main text as markdown. A page with no text is not charged.
|
|
226
|
+
export async function extractWithSpecStream(
|
|
227
|
+
url: string,
|
|
228
|
+
signal?: AbortSignal,
|
|
229
|
+
options: ExtractOptions = {},
|
|
230
|
+
): Promise<ExtractedContent | null> {
|
|
231
|
+
const apiKey = await requireApiKey(signal);
|
|
232
|
+
const timeoutMs = typeof options.timeoutMs === "number" && Number.isFinite(options.timeoutMs)
|
|
233
|
+
? Math.max(1, Math.floor(options.timeoutMs))
|
|
234
|
+
: EXTRACT_TIMEOUT_MS;
|
|
235
|
+
const activityId = activityMonitor.logStart({ type: "fetch", url });
|
|
236
|
+
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
237
|
+
try {
|
|
238
|
+
const response = await fetchWithCredentialRedirects(resolveProviderApiUrl("specstream", SPECSTREAM_EXTRACT_URL, loadConfig().specstreamBaseUrl), {
|
|
239
|
+
method: "POST",
|
|
240
|
+
headers: {
|
|
241
|
+
Accept: "application/json",
|
|
242
|
+
Authorization: `Bearer ${apiKey}`,
|
|
243
|
+
"Content-Type": "application/json",
|
|
244
|
+
"User-Agent": "pi-web-access",
|
|
245
|
+
},
|
|
246
|
+
body: JSON.stringify({ urls: [url], format: "markdown" }),
|
|
247
|
+
signal: signal ? AbortSignal.any([timeoutSignal, signal]) : timeoutSignal,
|
|
248
|
+
}, ["Authorization"]);
|
|
249
|
+
if (!response.ok) {
|
|
250
|
+
const errorText = await response.text();
|
|
251
|
+
throw new Error(`SpecStream Extract error ${response.status}: ${redactCredential(errorText, apiKey).slice(0, 300)}`);
|
|
252
|
+
}
|
|
253
|
+
const [result] = parseExtractResponse(await readJson(response));
|
|
254
|
+
if (!result || typeof result !== "object") throw invalidResponse("expected one result for the URL");
|
|
255
|
+
activityMonitor.logComplete(activityId, response.status);
|
|
256
|
+
if (result.status !== "ok") {
|
|
257
|
+
if (result.status === "failed" || result.status === "blocked") {
|
|
258
|
+
throw new Error(`SpecStream Extract could not read the page: ${String(result.status)}`);
|
|
259
|
+
}
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
const content = typeof result.text === "string" ? result.text.trim() : "";
|
|
263
|
+
if (!content) return null;
|
|
264
|
+
return { url, title: typeof result.title === "string" ? result.title.trim() : "", content, error: null };
|
|
265
|
+
} catch (err) {
|
|
266
|
+
if (signal?.aborted) {
|
|
267
|
+
activityMonitor.logComplete(activityId, 0);
|
|
268
|
+
throw err;
|
|
269
|
+
}
|
|
270
|
+
const outgoing = timeoutSignal.aborted
|
|
271
|
+
? new Error(`SpecStream Extract request timed out after ${Math.round(timeoutMs / 1000)}s`)
|
|
272
|
+
: redactError(err, apiKey);
|
|
273
|
+
activityMonitor.logError(activityId, redactCredential(errorMessage(outgoing), apiKey));
|
|
274
|
+
throw outgoing;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
@@ -121,28 +121,43 @@ export function registerWebToolActivation(pi: ExtensionAPI, tools: ReadonlyArray
|
|
|
121
121
|
// A resumed transcript that declared its tools without the loader keeps that set; adding the
|
|
122
122
|
// loader there would record a mid-conversation tool change the user never asked for (#462).
|
|
123
123
|
let loaderSelected = true;
|
|
124
|
-
function selectFromSession(ctx: ExtensionContext):
|
|
125
|
-
if (!loaderAvailable()) return;
|
|
124
|
+
function selectFromSession(ctx: ExtensionContext): boolean {
|
|
125
|
+
if (!loaderAvailable()) return false;
|
|
126
126
|
try {
|
|
127
127
|
const messages = buildSessionContext(ctx.sessionManager.getBranch()).messages;
|
|
128
128
|
const declared = transcriptToolNames(messages);
|
|
129
|
-
// "auto" decides
|
|
129
|
+
// "auto" decides only for a session with no messages; recorded sessions keep their tools.
|
|
130
130
|
const eager = mode === "auto" && !declared && messages.length === 0 && !addsToolsWithoutCheckpoint(ctx.model);
|
|
131
131
|
// Sessions from before transcript tool declarations keep every web tool; fresh ones start with none.
|
|
132
132
|
const recorded = declared ?? new Set(messages.length > 0 || eager ? names : []);
|
|
133
133
|
loaderSelected = !eager && (!declared || declared.has(LOADER_NAME));
|
|
134
134
|
const others = pi.getActiveTools().filter(name => name !== LOADER_NAME && !names.includes(name));
|
|
135
135
|
pi.setActiveTools([...new Set([...others, ...names.filter(name => recorded.has(name)), ...(loaderSelected ? [LOADER_NAME] : [])])]);
|
|
136
|
+
return true;
|
|
136
137
|
} catch (error) {
|
|
137
138
|
if (!warned) {
|
|
138
139
|
warned = true;
|
|
139
|
-
console.warn(`[pi-web-access]
|
|
140
|
+
console.warn(`[pi-web-access] Web tool activation setup failed; keeping the current tool selection: ${error instanceof Error ? error.message : String(error)}`);
|
|
140
141
|
}
|
|
142
|
+
return false;
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
145
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
+
// Pi declares the first tools with the first request, so until agent_start a model switch decides again,
|
|
147
|
+
// unless the web tools were changed since the last decision.
|
|
148
|
+
let undeclared: string | undefined;
|
|
149
|
+
const activationState = () => [LOADER_NAME, ...names].map(name => pi.getActiveTools().includes(name)).join();
|
|
150
|
+
function decide(ctx: ExtensionContext): void {
|
|
151
|
+
undeclared = selectFromSession(ctx) ? activationState() : undefined;
|
|
152
|
+
}
|
|
153
|
+
pi.on("session_start", (_event, ctx) => decide(ctx));
|
|
154
|
+
pi.on("session_tree", (_event, ctx) => decide(ctx));
|
|
155
|
+
pi.on("agent_start", () => { undeclared = undefined; });
|
|
156
|
+
pi.on("model_select", (_event, ctx) => {
|
|
157
|
+
if (mode === "auto" && ctx.isIdle() && undeclared !== undefined && undeclared === activationState()
|
|
158
|
+
&& loaderSelected !== addsToolsWithoutCheckpoint(ctx.model)
|
|
159
|
+
&& buildSessionContext(ctx.sessionManager.getBranch()).messages.length === 0) decide(ctx);
|
|
160
|
+
});
|
|
146
161
|
pi.on("before_agent_start", () => {
|
|
147
162
|
if (!loaderSelected || !loaderAvailable() || pi.getActiveTools().includes(LOADER_NAME)) return;
|
|
148
163
|
try {
|
|
@@ -258,6 +258,10 @@ export function trimErrorText(text: string): string {
|
|
|
258
258
|
return text.replace(/\s+/g, " ").trim().slice(0, 200);
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
+
// Fit frames in 2000×2000 like Pi's tool-result images, so answer mode, which sends frames to another
|
|
262
|
+
// model without that resize, never uploads full 4K frames. Smaller frames are not enlarged.
|
|
263
|
+
export const FRAME_SCALE_FILTER = "scale=w='min(2000,iw)':h='min(2000,ih)':force_original_aspect_ratio=decrease";
|
|
264
|
+
|
|
261
265
|
export function mapFfmpegError(err: unknown): string {
|
|
262
266
|
const { code, stderr, message } = readExecError(err);
|
|
263
267
|
if (code === "ENOENT") return "ffmpeg is not installed. Install with: brew install ffmpeg";
|
|
@@ -7,7 +7,7 @@ import { canAttachImages } from "./feature-config.ts";
|
|
|
7
7
|
import { isGeminiWebAvailable, queryWithCookies } from "./gemini-web.ts";
|
|
8
8
|
import { queryGeminiApiWithVideo, getApiKey, fetchGeminiApi, getVersionedApiBase, getUploadBase, redactGeminiApiResponse, rewriteUploadUrlOrigin } from "./gemini-api.ts";
|
|
9
9
|
import { extractHeadingTitle, type ExtractedContent, type ExtractOptions, type FrameResult } from "./extract.ts";
|
|
10
|
-
import { readExecError, trimErrorText, mapFfmpegError, getWebSearchConfigPath } from "./utils.ts";
|
|
10
|
+
import { readExecError, trimErrorText, mapFfmpegError, getWebSearchConfigPath, FRAME_SCALE_FILTER } from "./utils.ts";
|
|
11
11
|
|
|
12
12
|
const CONFIG_PATH = getWebSearchConfigPath();
|
|
13
13
|
|
|
@@ -212,7 +212,7 @@ export async function extractVideoFrame(filePath: string, seconds: number = 1):
|
|
|
212
212
|
try {
|
|
213
213
|
const buffer = execFileSync("ffmpeg", [
|
|
214
214
|
"-ss", String(seconds), "-i", filePath,
|
|
215
|
-
"-frames:v", "1", "-f", "image2pipe", "-vcodec", "mjpeg", "pipe:1",
|
|
215
|
+
"-frames:v", "1", "-vf", FRAME_SCALE_FILTER, "-f", "image2pipe", "-vcodec", "mjpeg", "pipe:1",
|
|
216
216
|
], { maxBuffer: 5 * 1024 * 1024, timeout: 10000, stdio: ["pipe", "pipe", "pipe"] });
|
|
217
217
|
if (buffer.length === 0) return { error: "ffmpeg failed: empty output" };
|
|
218
218
|
return { data: buffer.toString("base64"), mimeType: "image/jpeg" };
|
|
@@ -81,6 +81,13 @@ export interface WebSearchConfig {
|
|
|
81
81
|
outcrawlBaseUrl?: unknown;
|
|
82
82
|
sofyaApiKey?: unknown;
|
|
83
83
|
sofyaBaseUrl?: unknown;
|
|
84
|
+
cloroApiKey?: unknown;
|
|
85
|
+
cloroBaseUrl?: unknown;
|
|
86
|
+
cloroMode?: unknown;
|
|
87
|
+
automApiKey?: unknown;
|
|
88
|
+
automBaseUrl?: unknown;
|
|
89
|
+
specstreamApiKey?: unknown;
|
|
90
|
+
specstreamBaseUrl?: unknown;
|
|
84
91
|
tabstackBaseUrl?: unknown;
|
|
85
92
|
tabstackApiKey?: unknown;
|
|
86
93
|
tabstackResearchMode?: unknown;
|
|
@@ -547,6 +554,8 @@ export interface PageAnswerRequest {
|
|
|
547
554
|
pageText: string;
|
|
548
555
|
sourceUrl: string;
|
|
549
556
|
model?: string;
|
|
557
|
+
/** Video frames or a fetched image, sent to the answer model as image input. */
|
|
558
|
+
images?: Array<{ data: string; mimeType: string; label?: string }>;
|
|
550
559
|
}
|
|
551
560
|
|
|
552
561
|
/** Everything that differs between hosts. Pi supplies session persistence, background
|
|
@@ -1051,11 +1060,12 @@ export function createWebToolCore(host: WebToolCoreHost): WebToolCoreInstance {
|
|
|
1051
1060
|
...(authFetchProfile ? { authFetchProfile } : {}),
|
|
1052
1061
|
};
|
|
1053
1062
|
const fetchResults = await fetchAllContent(urlList, signal, fetchOptions(requestOptions, options.proxy));
|
|
1054
|
-
//
|
|
1055
|
-
// A text result that merely attaches a thumbnail
|
|
1056
|
-
|
|
1063
|
+
// Image-as-payload results (direct images, video frames) set mimeType and/or frames. Answer mode sends
|
|
1064
|
+
// them to the answer model; extract rejects them. A text result that merely attaches a thumbnail
|
|
1065
|
+
// (YouTube analysis) is answered as text.
|
|
1066
|
+
const textResults = mode === "extract"
|
|
1057
1067
|
? fetchResults.map(result => !result.error && (result.mimeType?.startsWith("image/") || result.frames?.length)
|
|
1058
|
-
? { ...result, error:
|
|
1068
|
+
? { ...result, error: "Field extraction requires textual fetched content" }
|
|
1059
1069
|
: result)
|
|
1060
1070
|
: fetchResults;
|
|
1061
1071
|
const presentedResults = mode === "answer"
|
|
@@ -1063,13 +1073,22 @@ export function createWebToolCore(host: WebToolCoreHost): WebToolCoreInstance {
|
|
|
1063
1073
|
if (result.error) return result;
|
|
1064
1074
|
try {
|
|
1065
1075
|
if (!host.answerFromPage) throw new Error("this host cannot answer from fetched pages");
|
|
1076
|
+
const images = result.frames?.length
|
|
1077
|
+
? result.frames.map(frame => ({ data: frame.data, mimeType: frame.mimeType, label: `Frame at ${frame.timestamp}` }))
|
|
1078
|
+
: result.mimeType?.startsWith("image/") && result.thumbnail
|
|
1079
|
+
? [{ ...result.thumbnail, label: result.title }]
|
|
1080
|
+
: undefined;
|
|
1066
1081
|
const answer = await host.answerFromPage({
|
|
1067
1082
|
question: options.prompt!,
|
|
1068
1083
|
pageText: result.content,
|
|
1069
1084
|
sourceUrl: result.url,
|
|
1070
1085
|
...(options.answerModel ? { model: options.answerModel } : {}),
|
|
1086
|
+
...(images ? { images } : {}),
|
|
1071
1087
|
}, ctx, signal);
|
|
1072
|
-
return { ...result, content: answer.text };
|
|
1088
|
+
if (!images) return { ...result, content: answer.text };
|
|
1089
|
+
// The answer replaces the images; the agent does not also receive them.
|
|
1090
|
+
const { frames: _frames, thumbnail: _thumbnail, ...rest } = result;
|
|
1091
|
+
return { ...rest, content: answer.text };
|
|
1073
1092
|
} catch (err) {
|
|
1074
1093
|
return { ...result, error: `Page answer failed: ${err instanceof Error ? err.message : String(err)}` };
|
|
1075
1094
|
}
|
|
@@ -6,7 +6,7 @@ import { isGeminiWebAvailable, queryWithCookies } from "./gemini-web.ts";
|
|
|
6
6
|
import { isGeminiApiAvailableWithVideo, queryGeminiApiWithVideo } from "./gemini-api.ts";
|
|
7
7
|
import { askPerplexity, isPerplexityAvailable } from "./perplexity.ts";
|
|
8
8
|
import { extractHeadingTitle, type ExtractedContent, type FrameResult, type VideoFrame } from "./extract.ts";
|
|
9
|
-
import { formatSeconds, readExecError, isTimeoutError, trimErrorText, mapFfmpegError, getWebSearchConfigPath } from "./utils.ts";
|
|
9
|
+
import { formatSeconds, readExecError, isTimeoutError, trimErrorText, mapFfmpegError, getWebSearchConfigPath, FRAME_SCALE_FILTER } from "./utils.ts";
|
|
10
10
|
|
|
11
11
|
const CONFIG_PATH = getWebSearchConfigPath();
|
|
12
12
|
|
|
@@ -175,7 +175,7 @@ async function extractFrameFromStream(streamUrl: string, seconds: number): Promi
|
|
|
175
175
|
try {
|
|
176
176
|
const buffer = execFileSync("ffmpeg", [
|
|
177
177
|
"-ss", String(seconds), "-i", streamUrl,
|
|
178
|
-
"-frames:v", "1", "-f", "image2pipe", "-vcodec", "mjpeg", "pipe:1",
|
|
178
|
+
"-frames:v", "1", "-vf", FRAME_SCALE_FILTER, "-f", "image2pipe", "-vcodec", "mjpeg", "pipe:1",
|
|
179
179
|
], { maxBuffer: 5 * 1024 * 1024, timeout: 30000, stdio: ["pipe", "pipe", "pipe"] });
|
|
180
180
|
if (buffer.length === 0) return { error: "ffmpeg failed: empty output" };
|
|
181
181
|
return { data: buffer.toString("base64"), mimeType: "image/jpeg" };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herbertgao/pi-extensions",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.12",
|
|
4
4
|
"description": "Aggregate installer for HerbertGao-maintained Pi extensions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"extensions",
|
|
@@ -41,12 +41,13 @@
|
|
|
41
41
|
"@dietrichgebert/ponytail": "5.3.3",
|
|
42
42
|
"@herbertgao/pi-agency": "0.1.3",
|
|
43
43
|
"@herbertgao/pi-bark": "0.2.2",
|
|
44
|
-
"@herbertgao/pi-cc-extensions": "1.0.
|
|
45
|
-
"@herbertgao/pi-impeccable": "0.
|
|
44
|
+
"@herbertgao/pi-cc-extensions": "1.0.20-local.1",
|
|
45
|
+
"@herbertgao/pi-impeccable": "0.5.0",
|
|
46
46
|
"@herbertgao/pi-subagents": "0.25.0-local.1",
|
|
47
47
|
"@herbertgao/sol-pi": "0.4.3",
|
|
48
48
|
"@juicesharp/rpiv-ask-user-question": "2.15.0",
|
|
49
49
|
"@juicesharp/rpiv-config": "^2.15.0",
|
|
50
|
+
"@mixmark-io/domino": "^2.2.0",
|
|
50
51
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
51
52
|
"@mozilla/readability": "^0.6.0",
|
|
52
53
|
"@napi-rs/keyring": "^2.1.0",
|
|
@@ -72,16 +73,17 @@
|
|
|
72
73
|
"minimatch": "^11.0.4",
|
|
73
74
|
"nanoid": "^5.0.0",
|
|
74
75
|
"p-limit": "^6.1.0",
|
|
75
|
-
"pi-antigravity": "0.
|
|
76
|
-
"pi-commandcode-provider": "0.8.
|
|
77
|
-
"pi-lens": "4.
|
|
76
|
+
"pi-antigravity": "0.14.0",
|
|
77
|
+
"pi-commandcode-provider": "0.8.4",
|
|
78
|
+
"pi-lens": "4.5.0",
|
|
78
79
|
"pi-next-cue": "1.0.8",
|
|
79
80
|
"pi-provider-qoder": "0.6.12",
|
|
80
81
|
"pi-typesafe": "0.14.0",
|
|
81
|
-
"pi-web-access": "0.
|
|
82
|
+
"pi-web-access": "0.48.0",
|
|
82
83
|
"pidusage": "^4.0.1",
|
|
83
84
|
"promise.try": "^2.0.1",
|
|
84
85
|
"turndown": "^7.2.0",
|
|
86
|
+
"turndown-plugin-gfm": "^1.0.2",
|
|
85
87
|
"unbash": "4.0.10",
|
|
86
88
|
"undici": "^8.11.2",
|
|
87
89
|
"unpdf": "^1.6.2",
|
|
@@ -154,6 +156,7 @@
|
|
|
154
156
|
"./node_modules/pi-web-access/dist",
|
|
155
157
|
"./node_modules/pi-antigravity/src/index.ts",
|
|
156
158
|
"./node_modules/pi-antigravity/src/features/google-search.ts",
|
|
159
|
+
"./node_modules/pi-antigravity/src/features/read-url-content.ts",
|
|
157
160
|
"./node_modules/pi-antigravity/src/features/generate-image.ts",
|
|
158
161
|
"./node_modules/pi-provider-qoder/dist/index.js",
|
|
159
162
|
"./node_modules/pi-commandcode-provider/index.ts",
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
adaptLspService,
|
|
4
|
-
getLSPService,
|
|
5
|
-
groupFilesByPrimaryServer,
|
|
6
|
-
hasAuxiliaryLspPublishedForRoot,
|
|
7
|
-
notifyExternalFileChange,
|
|
8
|
-
peekLSPService,
|
|
9
|
-
resetLSPService,
|
|
10
|
-
resyncGitChangedFiles,
|
|
11
|
-
runPerServerGroups
|
|
12
|
-
} from "./chunk-DZSQXG66.js";
|
|
13
|
-
import "./chunk-DFAY7JUN.js";
|
|
14
|
-
import "./chunk-XIMYZ3JA.js";
|
|
15
|
-
import "./chunk-Z6WTLVUL.js";
|
|
16
|
-
import "./chunk-PPYUBO6Y.js";
|
|
17
|
-
import "./chunk-5EEWCJG7.js";
|
|
18
|
-
import "./chunk-QJ4T73J5.js";
|
|
19
|
-
import "./chunk-YLW26OHX.js";
|
|
20
|
-
import "./chunk-HGEE5LDW.js";
|
|
21
|
-
import "./chunk-NCDH2JB7.js";
|
|
22
|
-
import "./chunk-HYDJUVOE.js";
|
|
23
|
-
import "./chunk-7424ANRU.js";
|
|
24
|
-
import "./chunk-SUIZOCSY.js";
|
|
25
|
-
import "./chunk-6GWCYEP7.js";
|
|
26
|
-
import "./chunk-Z54ZSOBZ.js";
|
|
27
|
-
import "./chunk-7M64NTAK.js";
|
|
28
|
-
import "./chunk-E3PNZDPH.js";
|
|
29
|
-
import "./chunk-6HWVI6MI.js";
|
|
30
|
-
import "./chunk-PK3GDU4M.js";
|
|
31
|
-
import "./chunk-6JLNZ6DP.js";
|
|
32
|
-
import "./chunk-IT7MFVGP.js";
|
|
33
|
-
import "./chunk-AYDE7RFV.js";
|
|
34
|
-
import "./chunk-HWMNTQBJ.js";
|
|
35
|
-
import "./chunk-ZRQMENT4.js";
|
|
36
|
-
import "./chunk-2BEMIWEW.js";
|
|
37
|
-
import "./chunk-IJYGIDF4.js";
|
|
38
|
-
import "./chunk-NRVWLTOY.js";
|
|
39
|
-
import "./chunk-YLHJWAQS.js";
|
|
40
|
-
import "./chunk-OVPR3GQ6.js";
|
|
41
|
-
import "./chunk-3QMLB4TI.js";
|
|
42
|
-
import "./chunk-UYXV5NIS.js";
|
|
43
|
-
import "./chunk-AVBEPUCD.js";
|
|
44
|
-
import "./chunk-75TVYCQW.js";
|
|
45
|
-
import "./chunk-KXDQD34C.js";
|
|
46
|
-
import "./chunk-3PMLYGJN.js";
|
|
47
|
-
import "./chunk-YTXFNCVN.js";
|
|
48
|
-
import "./chunk-ET3DSSFZ.js";
|
|
49
|
-
import "./chunk-B4FAFEBP.js";
|
|
50
|
-
import "./chunk-QYF5S6P6.js";
|
|
51
|
-
import "./chunk-SRXYSLMW.js";
|
|
52
|
-
import "./chunk-6EIV3H7O.js";
|
|
53
|
-
import "./chunk-3R3Z54J7.js";
|
|
54
|
-
import "./chunk-CIA7X2PZ.js";
|
|
55
|
-
import "./chunk-HRQTYU2T.js";
|
|
56
|
-
import "./chunk-AGEQRJ5A.js";
|
|
57
|
-
import "./chunk-S26LC76R.js";
|
|
58
|
-
import "./chunk-K2GV34T2.js";
|
|
59
|
-
import "./chunk-LJDODBBZ.js";
|
|
60
|
-
import "./chunk-WLD6BGON.js";
|
|
61
|
-
import "./chunk-NXL4FFQQ.js";
|
|
62
|
-
export {
|
|
63
|
-
adaptLspService,
|
|
64
|
-
getLSPService,
|
|
65
|
-
groupFilesByPrimaryServer,
|
|
66
|
-
hasAuxiliaryLspPublishedForRoot,
|
|
67
|
-
notifyExternalFileChange,
|
|
68
|
-
peekLSPService,
|
|
69
|
-
resetLSPService,
|
|
70
|
-
resyncGitChangedFiles,
|
|
71
|
-
runPerServerGroups
|
|
72
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
importFactProvider,
|
|
4
|
-
importFactsApplyTo
|
|
5
|
-
} from "./chunk-3MHY4BQY.js";
|
|
6
|
-
import "./chunk-OHEUOWYT.js";
|
|
7
|
-
import "./chunk-6GWCYEP7.js";
|
|
8
|
-
import "./chunk-Z54ZSOBZ.js";
|
|
9
|
-
import "./chunk-7M64NTAK.js";
|
|
10
|
-
import "./chunk-E3PNZDPH.js";
|
|
11
|
-
import "./chunk-AYDE7RFV.js";
|
|
12
|
-
import "./chunk-AVBEPUCD.js";
|
|
13
|
-
import "./chunk-ET3DSSFZ.js";
|
|
14
|
-
import "./chunk-SRXYSLMW.js";
|
|
15
|
-
import "./chunk-6EIV3H7O.js";
|
|
16
|
-
import "./chunk-3R3Z54J7.js";
|
|
17
|
-
import "./chunk-CIA7X2PZ.js";
|
|
18
|
-
import "./chunk-HRQTYU2T.js";
|
|
19
|
-
import "./chunk-AGEQRJ5A.js";
|
|
20
|
-
import "./chunk-S26LC76R.js";
|
|
21
|
-
import "./chunk-K2GV34T2.js";
|
|
22
|
-
import "./chunk-LJDODBBZ.js";
|
|
23
|
-
import "./chunk-WLD6BGON.js";
|
|
24
|
-
import "./chunk-NXL4FFQQ.js";
|
|
25
|
-
export {
|
|
26
|
-
importFactProvider,
|
|
27
|
-
importFactsApplyTo
|
|
28
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
getGlobalPiLensDir
|
|
4
|
-
} from "./chunk-ET3DSSFZ.js";
|
|
5
|
-
import {
|
|
6
|
-
getTurnId
|
|
7
|
-
} from "./chunk-K2GV34T2.js";
|
|
8
|
-
import {
|
|
9
|
-
BoundedFifoMap
|
|
10
|
-
} from "./chunk-WLD6BGON.js";
|
|
11
|
-
|
|
12
|
-
// dist/clients/custom-rule-locations.js
|
|
13
|
-
import * as path from "node:path";
|
|
14
|
-
function getUserRuleRoot() {
|
|
15
|
-
return path.join(getGlobalPiLensDir(), "rules");
|
|
16
|
-
}
|
|
17
|
-
var RULE_CORPUS_CYCLE_ENTRIES = 16;
|
|
18
|
-
var ruleCorpusCycleFingerprints = new BoundedFifoMap(RULE_CORPUS_CYCLE_ENTRIES);
|
|
19
|
-
var cycleSlot;
|
|
20
|
-
function ruleCorpusFingerprintForCycle(family, root, compute, force = false) {
|
|
21
|
-
const cycle = getTurnId();
|
|
22
|
-
if (!force && cycleSlot !== void 0 && cycleSlot.cycle === cycle && cycleSlot.family === family && cycleSlot.root === root) {
|
|
23
|
-
return cycleSlot.fingerprint;
|
|
24
|
-
}
|
|
25
|
-
const key = `${cycle}\0${family}\0${root}`;
|
|
26
|
-
let fingerprint = force ? void 0 : ruleCorpusCycleFingerprints.get(key);
|
|
27
|
-
if (fingerprint === void 0) {
|
|
28
|
-
fingerprint = compute(root);
|
|
29
|
-
ruleCorpusCycleFingerprints.set(key, fingerprint);
|
|
30
|
-
}
|
|
31
|
-
cycleSlot = { cycle, family, root, fingerprint };
|
|
32
|
-
return fingerprint;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export {
|
|
36
|
-
getUserRuleRoot,
|
|
37
|
-
ruleCorpusFingerprintForCycle
|
|
38
|
-
};
|