@herbertgao/pi-extensions 2026.10.16 → 2026.10.18
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 +9 -7
- package/THIRD_PARTY_NOTICES.md +4 -0
- package/node_modules/@dietrichgebert/ponytail/.qoder-plugin/plugin.json +1 -1
- package/node_modules/@dietrichgebert/ponytail/hooks/band/metrics.ts +5 -11
- package/node_modules/@dietrichgebert/ponytail/hooks/band/register.tsx +69 -46
- package/node_modules/@dietrichgebert/ponytail/hooks/band/types.d.ts +0 -1
- package/node_modules/@dietrichgebert/ponytail/hooks/claude-codex-hooks.json +3 -3
- package/node_modules/@dietrichgebert/ponytail/hooks/copilot-hooks.json +2 -2
- package/node_modules/@dietrichgebert/ponytail/hooks/cursor-hooks.json +2 -2
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-activate.js +4 -3
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-map.js +4 -1
- package/node_modules/@dietrichgebert/ponytail/package.json +1 -1
- package/node_modules/@herbertgao/pi-impeccable/LICENSE +191 -0
- package/node_modules/@herbertgao/pi-impeccable/NOTICE.md +11 -0
- package/node_modules/@herbertgao/pi-impeccable/README.md +34 -0
- package/node_modules/@herbertgao/pi-impeccable/package.json +53 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/SKILL.md +89 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/adapt.md +318 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/adapt.native.md +58 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/android.md +46 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/animate.md +89 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/audit.md +139 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/audit.native.md +139 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/bolder.md +33 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/clarify.md +94 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/colorize.md +86 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/component-review.md +63 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/craft-floor.md +44 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/craft.md +5 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique.md +819 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/asset-producer.md +42 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/documenter.md +24 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/finish-reviewer.md +38 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/manual-edit-applier.md +92 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/delight.md +70 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/distill.md +111 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/doctor.md +54 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/document.md +416 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/extract.md +69 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/generate.md +101 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/harden.md +362 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/hooks.md +114 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/init.md +131 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/ios.md +51 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/layout.md +84 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/live-setup.md +104 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/live.md +325 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/mode-operate.md +21 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/mode-persuade.md +19 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/mode-read.md +21 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work.md +152 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/onboard.md +234 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/operate.md +61 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/optimize.md +257 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/overdrive.md +127 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/polish.md +105 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/quieter.md +99 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/region-map.md +26 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/routing.md +24 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/shape.md +59 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/typeset.md +90 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/visualize.md +47 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/VERSION +1 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/command-metadata.json +98 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/data/font-index-failures.json +121 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/data/font-index.json +1 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/engine-checksums.txt +9 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable +249 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable.cmd +278 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser-dom.js +320 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser-ignores.js +246 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser-session.js +183 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser.js +13645 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/modern-screenshot.umd.js +14 -0
- package/node_modules/@narumitw/pi-btw/README.md +3 -1
- package/node_modules/@narumitw/pi-btw/dist/index.ts +26 -5
- package/node_modules/@narumitw/pi-btw/dist/index.ts.map +2 -2
- package/node_modules/@narumitw/pi-btw/docs/core-alignment.md +40 -0
- package/node_modules/@narumitw/pi-btw/docs/workflows.md +3 -0
- package/node_modules/@narumitw/pi-btw/package.json +2 -2
- package/node_modules/@narumitw/pi-btw/src/btw.ts +31 -5
- package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +13 -0
- package/node_modules/pi-lens/CHANGELOG.md +83 -0
- package/node_modules/pi-lens/README.md +5 -1
- package/node_modules/pi-lens/dist/{chunk-JL6CXUMW.js → chunk-24BILSZW.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-S67UJDGQ.js → chunk-2TF6RXWB.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-ARD426WI.js → chunk-3F6BMY53.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-5ZR3APIM.js → chunk-3FRLWYBG.js} +26 -26
- package/node_modules/pi-lens/dist/{chunk-T7FTXGS3.js → chunk-3K2F6UDZ.js} +30 -30
- package/node_modules/pi-lens/dist/{chunk-HK6JVFZC.js → chunk-3YY7IXIL.js} +2 -2
- package/node_modules/pi-lens/dist/chunk-46TNM7XZ.js +88 -0
- package/node_modules/pi-lens/dist/{chunk-4AVZ3TG7.js → chunk-4L36HG27.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-PO45POGF.js → chunk-4LM3VAZH.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-UN4TEBWN.js → chunk-4LOE5R5P.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-KLQVC3XC.js → chunk-4YHYPW2G.js} +30 -7
- package/node_modules/pi-lens/dist/{chunk-W5LGKNET.js → chunk-4ZYJHQMB.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-W2V54OCL.js → chunk-6IR3ZYIB.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-FJIVKLPH.js → chunk-72OKUXSD.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-7RQXA5GG.js → chunk-75GAYVNO.js} +10 -9
- package/node_modules/pi-lens/dist/{chunk-V3APN3DY.js → chunk-7E2563GA.js} +12 -12
- package/node_modules/pi-lens/dist/{chunk-4WX4CTUE.js → chunk-7GLOLOSH.js} +25 -25
- package/node_modules/pi-lens/dist/{chunk-BWYQUPOS.js → chunk-ABPKUVA4.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-IPDG45G5.js → chunk-AKUUMGD5.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-Q6D6VMI4.js → chunk-ASUXV767.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-BM5GS6ZH.js → chunk-AWDSEDER.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-MA77RSFN.js → chunk-BZARLRJW.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-EVDGNG4F.js → chunk-CB4WHS4H.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-FA5LDARD.js → chunk-CCV2EU7T.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-U6OC3QEM.js → chunk-CE6VMBCB.js} +15 -15
- package/node_modules/pi-lens/dist/{chunk-AMXIUN2R.js → chunk-CPSR3AVL.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-SXGD4ANG.js → chunk-CTADOKYM.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-63RIVFQI.js → chunk-DH5JPM3K.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-MT6BVNFW.js → chunk-DPGEAHZT.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-4PCQCU47.js → chunk-DQZFQSR5.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-BHUWL2Y3.js → chunk-E7HJ56Y7.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-DQXSPYRI.js → chunk-EAOK7MIZ.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-2RLWJO5K.js → chunk-EKWX4WD3.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-WIZWZR4C.js → chunk-F7K5IBZG.js} +30 -28
- package/node_modules/pi-lens/dist/{chunk-VQH24FIP.js → chunk-FB5SCCPT.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-GZE7WOI4.js → chunk-FZKFVUEC.js} +438 -140
- package/node_modules/pi-lens/dist/{chunk-TIYGSODX.js → chunk-H7OR7DFZ.js} +15 -13
- package/node_modules/pi-lens/dist/{chunk-CJYKEW2L.js → chunk-HO6LWE2E.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-YSBHPOY6.js → chunk-HR3OJ3TH.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-CFRQMBGP.js → chunk-HWDAVBFU.js} +14 -14
- package/node_modules/pi-lens/dist/{chunk-2X4VLOCC.js → chunk-JJ2RRESP.js} +8 -5
- package/node_modules/pi-lens/dist/{chunk-YBSONGSZ.js → chunk-JMEKXFOL.js} +24 -24
- package/node_modules/pi-lens/dist/{chunk-MKVZQUEG.js → chunk-KDX35VXP.js} +69 -13
- package/node_modules/pi-lens/dist/{chunk-75SY4F24.js → chunk-KKCK636N.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-OLAWH5UQ.js → chunk-KPPJTH44.js} +2 -1
- package/node_modules/pi-lens/dist/{chunk-5APMQ2IJ.js → chunk-KW5JQPO5.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-SCIUNBPF.js → chunk-L3CMBQMH.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-GAACZY6R.js → chunk-L5JYIU47.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-2DDDCJDL.js → chunk-LBLBAFG3.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-NNKXDXXS.js → chunk-LLS45EWB.js} +8 -0
- package/node_modules/pi-lens/dist/{chunk-WQOIR3QY.js → chunk-LS3QJRUB.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-XCUHKYCQ.js → chunk-LSC3VADM.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-GMTFDAOK.js → chunk-LUBPZN36.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-DMSLNKF7.js → chunk-LV4UMYVH.js} +19 -19
- package/node_modules/pi-lens/dist/{chunk-XAIT2YGS.js → chunk-MB6PXBUA.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-AE37FEGH.js → chunk-MNJIXFX4.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-OJLTLYHB.js → chunk-MPKRJBPK.js} +30 -10
- package/node_modules/pi-lens/dist/{chunk-QGSTQH4D.js → chunk-N5WSK2K7.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-Z7IGUAXL.js → chunk-NA7SEXHE.js} +10 -6
- package/node_modules/pi-lens/dist/{chunk-UHGF5UT5.js → chunk-O4BJFESU.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-UCGQT677.js → chunk-OE5ZBP7F.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-KSR7RGQY.js → chunk-OXOI55RU.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-NDMCVUYK.js → chunk-PR6PO3ES.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-NIU2IPC5.js → chunk-PUZ3E2J4.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-2DMLM3ZO.js → chunk-QHSNL7B2.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-ZYNI26MI.js → chunk-QOE342SU.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-3WEPUD2V.js → chunk-R5MOQM2H.js} +98 -31
- package/node_modules/pi-lens/dist/{chunk-PPIBVH4R.js → chunk-RC2Z6K47.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-LEJOJDXL.js → chunk-RORGS5II.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-K2YGBXOA.js → chunk-RQS4QQSD.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-XQCSWV2G.js → chunk-RRV3FNNM.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-GTAI2J6U.js → chunk-SHLDT3OI.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-VPBIMOAQ.js → chunk-SNDXCFRS.js} +11 -9
- package/node_modules/pi-lens/dist/{chunk-Q4FCYCRE.js → chunk-T7A2HK2B.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-MN7MHUXQ.js → chunk-U5HPROLA.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-ZUUI3ZSA.js → chunk-U6VN4NVL.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-W5R5SABV.js → chunk-U7BD2QL7.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-P4QNXS6I.js → chunk-UF7RTZSO.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-A3YNG5KP.js → chunk-URCQWAQ4.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-FFL3A2VP.js → chunk-VUZWQ7UG.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-YRD4ISED.js → chunk-W4WP2ERB.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-OOU2WZZE.js → chunk-WDBICWH3.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-BI5LAQ3Y.js → chunk-WGRJOXED.js} +114 -148
- package/node_modules/pi-lens/dist/{chunk-ZQ6NZZTB.js → chunk-WME2OQST.js} +33 -0
- package/node_modules/pi-lens/dist/{chunk-DC4CFXM5.js → chunk-XT2HTCJ5.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-SJJYRZB4.js → chunk-Y7F7IEE3.js} +55 -23
- package/node_modules/pi-lens/dist/{chunk-2F47TQOA.js → chunk-YES5CACN.js} +29 -29
- package/node_modules/pi-lens/dist/{chunk-H7HTEQUZ.js → chunk-YHC2O2WO.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-Q3UZHW6N.js → chunk-YVHBNSME.js} +6 -10
- package/node_modules/pi-lens/dist/{chunk-3MYEA7QD.js → chunk-ZE3KXHS7.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-VG5JS5SW.js → chunk-ZGSJDWQU.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-5CV5ITZF.js → chunk-ZJTT47IG.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-Q4EMRFNA.js → chunk-ZMAUPOMG.js} +24 -24
- package/node_modules/pi-lens/dist/index.js +1925 -944
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +6 -6
- package/node_modules/pi-lens/dist/mcp/cli.js +30 -30
- package/node_modules/pi-lens/dist/mcp/server.js +707 -455
- package/node_modules/pi-lens/dist/mcp/worker.js +48 -48
- package/node_modules/pi-lens/dist/probes/installer.js +13 -13
- package/node_modules/pi-lens/docs/agent-tools.md +11 -3
- package/node_modules/pi-lens/docs/defect-shapes.md +15 -1
- package/node_modules/pi-lens/docs/dependencies.md +1 -0
- package/node_modules/pi-lens/docs/environment-variables.md +14 -0
- package/node_modules/pi-lens/docs/features.md +11 -1
- package/node_modules/pi-lens/docs/globalconfig.md +12 -1
- package/node_modules/pi-lens/docs/invariants/git-guard-host.md +34 -0
- package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +6 -0
- package/node_modules/pi-lens/docs/invariants/session-telemetry.md +42 -2
- package/node_modules/pi-lens/docs/lsp-capability-matrix.md +89 -45
- package/node_modules/pi-lens/docs/lsp-idle-eviction.md +3 -5
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +8 -1
- package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +7 -4
- package/node_modules/pi-lens/docs/pi-lens-subagent.md +7 -4
- package/node_modules/pi-lens/docs/schema/pi-lens-config-v1.json +23 -0
- package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
- package/node_modules/pi-lens/docs/settings.md +5 -0
- package/node_modules/pi-lens/docs/usage.md +5 -0
- package/node_modules/pi-lens/package.json +1 -1
- package/node_modules/pi-web-access/CHANGELOG.md +32 -1
- package/node_modules/pi-web-access/README.md +53 -15
- package/node_modules/pi-web-access/cloudflare-search.ts +237 -0
- package/node_modules/pi-web-access/curator-page.ts +12 -1
- package/node_modules/pi-web-access/curator-server.ts +3 -0
- package/node_modules/pi-web-access/dist/index.js +9450 -8642
- package/node_modules/pi-web-access/dist/mcp-cli.js +16742 -15954
- package/node_modules/pi-web-access/exa.ts +94 -20
- package/node_modules/pi-web-access/extract.ts +61 -9
- package/node_modules/pi-web-access/gemini-search.ts +17 -7
- package/node_modules/pi-web-access/index.ts +6 -0
- package/node_modules/pi-web-access/mcp-tool-definitions.ts +50 -34
- package/node_modules/pi-web-access/openai-search.ts +3 -1
- package/node_modules/pi-web-access/package.json +3 -2
- package/node_modules/pi-web-access/page-query.ts +13 -3
- package/node_modules/pi-web-access/pdf-extract.ts +1 -5
- package/node_modules/pi-web-access/perplexity.ts +2 -0
- package/node_modules/pi-web-access/searchapi.ts +202 -0
- package/node_modules/pi-web-access/source-check.ts +7 -0
- package/node_modules/pi-web-access/ssrf-protection.ts +25 -1
- package/node_modules/pi-web-access/summary-review.ts +21 -10
- package/node_modules/pi-web-access/tabstack.ts +289 -0
- package/node_modules/pi-web-access/utils.ts +79 -16
- package/node_modules/pi-web-access/web-tool-core.ts +10 -1
- package/node_modules/pi-web-access/xai-search.ts +3 -1
- package/package.json +9 -6
- package/node_modules/pi-lens/dist/chunk-G2B7F6ZU.js +0 -88
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { activityMonitor } from "./activity.ts";
|
|
3
|
+
import { hasCredentialSource, redactCredential, resolveCredential } from "./credential-source.ts";
|
|
4
|
+
import { normalizeDomain } from "./domain-filter-normalization.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 { fetchWithCredentialRedirects, getWebSearchConfigPath } from "./utils.ts";
|
|
9
|
+
|
|
10
|
+
// Cloudflare Web Search API (https://developers.cloudflare.com/web-search/): one endpoint that
|
|
11
|
+
// runs a query on Ceramic, Exa, or Linkup through an AI Gateway and returns one result shape.
|
|
12
|
+
const CONFIG_PATH = getWebSearchConfigPath();
|
|
13
|
+
const SEARCH_TIMEOUT_MS = 30_000;
|
|
14
|
+
const MAX_REQUEST_RESULTS = 10;
|
|
15
|
+
// The API rejects longer queries. String length counts UTF-16 units, which is never less than
|
|
16
|
+
// the Unicode character count, so a query that passes this check is not too long either way.
|
|
17
|
+
const MAX_QUERY_CHARS = 1024;
|
|
18
|
+
const MAX_SNIPPET_CHARS = 500;
|
|
19
|
+
const DEFAULT_GATEWAY_ID = "default";
|
|
20
|
+
export const CLOUDFLARE_SEARCH_PROVIDERS = ["ceramic", "exa", "linkup"] as const;
|
|
21
|
+
type CloudflareSearchProvider = typeof CLOUDFLARE_SEARCH_PROVIDERS[number];
|
|
22
|
+
|
|
23
|
+
interface WebSearchConfig {
|
|
24
|
+
cloudflareApiKey?: unknown;
|
|
25
|
+
cloudflareAccountId?: unknown;
|
|
26
|
+
cloudflareGatewayId?: unknown;
|
|
27
|
+
cloudflareSearchProvider?: unknown;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface CloudflareSearchItem {
|
|
31
|
+
url?: unknown;
|
|
32
|
+
title?: unknown;
|
|
33
|
+
description?: unknown;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let cachedConfig: WebSearchConfig | null = null;
|
|
37
|
+
|
|
38
|
+
function loadConfig(): WebSearchConfig {
|
|
39
|
+
if (cachedConfig) return cachedConfig;
|
|
40
|
+
if (!existsSync(CONFIG_PATH)) {
|
|
41
|
+
cachedConfig = {};
|
|
42
|
+
return cachedConfig;
|
|
43
|
+
}
|
|
44
|
+
let parsed: unknown;
|
|
45
|
+
// JSON parse errors can quote credentials from the file, so they are not echoed.
|
|
46
|
+
try { parsed = JSON.parse(readFileSync(CONFIG_PATH, "utf-8")); } catch { parsed = undefined; }
|
|
47
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error(`Invalid config in ${CONFIG_PATH}: expected a JSON object`);
|
|
48
|
+
cachedConfig = parsed as WebSearchConfig;
|
|
49
|
+
return cachedConfig;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function setting(envValue: string | undefined, configValue: unknown, name: string): string | undefined {
|
|
53
|
+
const value = envValue?.trim() ? envValue : configValue;
|
|
54
|
+
if (value === undefined || value === null || value === "") return undefined;
|
|
55
|
+
if (typeof value !== "string") throw new Error(`${name} in ${CONFIG_PATH} must be a string`);
|
|
56
|
+
return value.trim() || undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function accountId(): string | undefined {
|
|
60
|
+
return setting(process.env.CLOUDFLARE_ACCOUNT_ID, loadConfig().cloudflareAccountId, "cloudflareAccountId");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function gatewayId(): string {
|
|
64
|
+
return setting(process.env.CLOUDFLARE_GATEWAY_ID, loadConfig().cloudflareGatewayId, "cloudflareGatewayId") ?? DEFAULT_GATEWAY_ID;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function searchProvider(): CloudflareSearchProvider {
|
|
68
|
+
const value = setting(process.env.CLOUDFLARE_SEARCH_PROVIDER, loadConfig().cloudflareSearchProvider, "cloudflareSearchProvider") ?? "ceramic";
|
|
69
|
+
const provider = value.toLowerCase();
|
|
70
|
+
if (!(CLOUDFLARE_SEARCH_PROVIDERS as readonly string[]).includes(provider)) {
|
|
71
|
+
throw new Error(`cloudflareSearchProvider must be one of ${CLOUDFLARE_SEARCH_PROVIDERS.join(", ")}; got ${JSON.stringify(value)}`);
|
|
72
|
+
}
|
|
73
|
+
return provider as CloudflareSearchProvider;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function isCloudflareSearchAvailable(): boolean {
|
|
77
|
+
return !!accountId() && hasCredentialSource({ provider: "Cloudflare", configuredValue: loadConfig().cloudflareApiKey, environmentValue: process.env.CLOUDFLARE_API_KEY });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface DomainFilters {
|
|
81
|
+
include: string[];
|
|
82
|
+
exclude: string[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function parseDomainFilter(domainFilter: string[] | undefined): DomainFilters {
|
|
86
|
+
const filters: DomainFilters = { include: [], exclude: [] };
|
|
87
|
+
for (const raw of domainFilter ?? []) {
|
|
88
|
+
const domain = normalizeDomain(raw);
|
|
89
|
+
if (!domain) continue;
|
|
90
|
+
const target = raw.trim().startsWith("-") ? filters.exclude : filters.include;
|
|
91
|
+
if (!target.includes(domain)) target.push(domain);
|
|
92
|
+
}
|
|
93
|
+
return filters;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function passesDomainFilters(url: URL, filters: DomainFilters): boolean {
|
|
97
|
+
const hostname = url.hostname.toLowerCase();
|
|
98
|
+
const matches = (domain: string) => hostname === domain || hostname.endsWith(`.${domain}`);
|
|
99
|
+
if (filters.exclude.some(matches)) return false;
|
|
100
|
+
return filters.include.length === 0 || filters.include.some(matches);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// The API has no domain parameters. Ceramic documents `site:` with `OR`, so allowed domains go
|
|
104
|
+
// into its query; for every provider the returned results are filtered locally as well.
|
|
105
|
+
// A query over the limit fails here instead of being cut, since cutting can break a `site:` clause.
|
|
106
|
+
function buildQuery(query: string, provider: CloudflareSearchProvider, filters: DomainFilters): string {
|
|
107
|
+
const sites = provider === "ceramic" ? filters.include.map(domain => `site:${domain}`) : [];
|
|
108
|
+
const built = sites.length === 0 ? query : `${query} ${sites.length === 1 ? sites[0] : `(${sites.join(" OR ")})`}`;
|
|
109
|
+
if (built.length > MAX_QUERY_CHARS) {
|
|
110
|
+
throw new Error(`Cloudflare Web Search invalid request: the query is ${built.length} characters${sites.length > 0 ? " with domain filters" : ""}; Cloudflare Web Search accepts at most ${MAX_QUERY_CHARS}`);
|
|
111
|
+
}
|
|
112
|
+
return built;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function text(value: unknown): string {
|
|
116
|
+
return typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "";
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
120
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Error bodies come in three shapes (see cloudflare/agents packages/agents/src/web/search/source.ts):
|
|
124
|
+
// gateway `{ ok: false, error: { code, status } }`, validation `{ success: false, errors: [{ message }],
|
|
125
|
+
// messages: [{ message, path }] }`, and gateway setup `{ success: false, error: [{ message }], message }`.
|
|
126
|
+
function describeError(status: number, body: string): { status: number; detail: string } {
|
|
127
|
+
let parsed: unknown;
|
|
128
|
+
try { parsed = JSON.parse(body); } catch { return { status, detail: body }; }
|
|
129
|
+
if (!isRecord(parsed)) return { status, detail: body };
|
|
130
|
+
const error = parsed.error;
|
|
131
|
+
if (isRecord(error) && typeof error.code === "string") {
|
|
132
|
+
const errorStatus = typeof error.status === "number" ? error.status : status;
|
|
133
|
+
// Newer responses carry a readable `message` that says how to fix the problem.
|
|
134
|
+
if (text(error.message)) return { status: errorStatus, detail: `${error.code}: ${text(error.message)}` };
|
|
135
|
+
const hint = error.code === "web_search_payment_required"
|
|
136
|
+
? " (no AI Gateway credits and no provider key stored on the gateway)"
|
|
137
|
+
: error.code === "web_search_gateway_not_configured" ? " (create the AI Gateway or set cloudflareGatewayId)" : "";
|
|
138
|
+
return { status: errorStatus, detail: `${error.code}${hint}` };
|
|
139
|
+
}
|
|
140
|
+
const entries = [...(Array.isArray(parsed.errors) ? parsed.errors : []), ...(Array.isArray(error) ? error : [])];
|
|
141
|
+
const issues = Array.isArray(parsed.messages) ? parsed.messages : [];
|
|
142
|
+
const parts = [
|
|
143
|
+
...entries.map(entry => isRecord(entry) ? text(entry.message) : ""),
|
|
144
|
+
...issues.map(issue => {
|
|
145
|
+
if (!isRecord(issue) || !text(issue.message)) return "";
|
|
146
|
+
return Array.isArray(issue.path) && issue.path.length ? `${issue.path.join(".")}: ${text(issue.message)}` : text(issue.message);
|
|
147
|
+
}),
|
|
148
|
+
].filter(Boolean);
|
|
149
|
+
return { status, detail: parts.join("; ") || text(parsed.message) || body };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function parseItems(value: unknown): CloudflareSearchItem[] {
|
|
153
|
+
// The documented success body is `{ items, metadata }`; accept the v4 `{ result }` envelope too.
|
|
154
|
+
const body = isRecord(value) && isRecord(value.result) && !Array.isArray(value.items) ? value.result : value;
|
|
155
|
+
if (!isRecord(body) || !Array.isArray(body.items)) throw new Error("Cloudflare Web Search returned invalid response: expected items array");
|
|
156
|
+
return body.items as CloudflareSearchItem[];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// The API has no date filter, so `recencyFilter` is not applied.
|
|
160
|
+
export async function searchWithCloudflare(query: string, options: SearchOptions = {}): Promise<SearchResponse> {
|
|
161
|
+
const account = accountId();
|
|
162
|
+
if (!account) {
|
|
163
|
+
throw new Error(
|
|
164
|
+
"Cloudflare account ID not found. Set cloudflareAccountId in " + CONFIG_PATH + " or CLOUDFLARE_ACCOUNT_ID, " +
|
|
165
|
+
"with cloudflareApiKey or CLOUDFLARE_API_KEY (an API token with Workers AI Read and AI Gateway Read)",
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
const apiKey = await resolveCredential({ provider: "Cloudflare", configuredValue: loadConfig().cloudflareApiKey, environmentValue: process.env.CLOUDFLARE_API_KEY, signal: options.signal });
|
|
169
|
+
if (!apiKey) {
|
|
170
|
+
throw new Error(
|
|
171
|
+
"Cloudflare API key not found. Set cloudflareApiKey in " + CONFIG_PATH + " or CLOUDFLARE_API_KEY " +
|
|
172
|
+
"to an API token with Workers AI Read and AI Gateway Read",
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
const provider = searchProvider();
|
|
176
|
+
const numResults = normalizeSearchResultCount(options.numResults);
|
|
177
|
+
const filters = parseDomainFilter(options.domainFilter);
|
|
178
|
+
const hasDomainFilters = filters.include.length > 0 || filters.exclude.length > 0;
|
|
179
|
+
const body = {
|
|
180
|
+
query: buildQuery(query, provider, filters),
|
|
181
|
+
provider,
|
|
182
|
+
// Results are filtered locally when domains are set, so ask for the most the API allows.
|
|
183
|
+
limit: hasDomainFilters ? MAX_REQUEST_RESULTS : Math.min(MAX_REQUEST_RESULTS, numResults),
|
|
184
|
+
options: { gateway: { id: gatewayId() } },
|
|
185
|
+
};
|
|
186
|
+
const url = `https://api.cloudflare.com/client/v4/accounts/${encodeURIComponent(account)}/ai/websearch/`;
|
|
187
|
+
const activityId = activityMonitor.logStart({ type: "api", query });
|
|
188
|
+
const timeout = AbortSignal.timeout(SEARCH_TIMEOUT_MS);
|
|
189
|
+
let status = 0;
|
|
190
|
+
let items: CloudflareSearchItem[];
|
|
191
|
+
try {
|
|
192
|
+
const response = await fetchWithCredentialRedirects(url, {
|
|
193
|
+
method: "POST",
|
|
194
|
+
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", Accept: "application/json" },
|
|
195
|
+
body: JSON.stringify(body),
|
|
196
|
+
signal: options.signal ? AbortSignal.any([timeout, options.signal]) : timeout,
|
|
197
|
+
}, ["Authorization"]);
|
|
198
|
+
status = response.status;
|
|
199
|
+
if (!response.ok) {
|
|
200
|
+
const error = describeError(response.status, await response.text());
|
|
201
|
+
// The status stays in the message so searchRouting can classify quota and transient failures.
|
|
202
|
+
throw new Error(`Cloudflare Web Search error ${error.status}: ${redactCredential(error.detail, apiKey).slice(0, 300)}`);
|
|
203
|
+
}
|
|
204
|
+
// Syntax errors can quote the body, so they are not echoed.
|
|
205
|
+
const data = await response.json().catch((err: unknown) => { throw err instanceof SyntaxError ? new Error("Cloudflare Web Search returned invalid JSON") : err; });
|
|
206
|
+
items = parseItems(data);
|
|
207
|
+
} catch (err) {
|
|
208
|
+
// Node reports the deadline as "aborted due to timeout", which routing would treat as a cancellation.
|
|
209
|
+
if (!options.signal?.aborted && (timeout.aborted || (err instanceof Error && err.name === "TimeoutError"))) {
|
|
210
|
+
const message = `Cloudflare Web Search request timed out after ${SEARCH_TIMEOUT_MS / 1000}s`;
|
|
211
|
+
activityMonitor.logError(activityId, message);
|
|
212
|
+
throw new Error(message);
|
|
213
|
+
}
|
|
214
|
+
const message = redactCredential(err instanceof Error ? err.message : String(err), apiKey);
|
|
215
|
+
activityMonitor.logError(activityId, message);
|
|
216
|
+
if (err instanceof Error && err.message === message) throw err;
|
|
217
|
+
throw new Error(message);
|
|
218
|
+
}
|
|
219
|
+
activityMonitor.logComplete(activityId, status);
|
|
220
|
+
const results: SearchResponse["results"] = [];
|
|
221
|
+
const seen = new Set<string>();
|
|
222
|
+
for (const item of items) {
|
|
223
|
+
if (!isRecord(item) || typeof item.url !== "string") continue;
|
|
224
|
+
let resultUrl: URL;
|
|
225
|
+
try { resultUrl = new URL(item.url.trim()); } catch { continue; }
|
|
226
|
+
if (resultUrl.protocol !== "http:" && resultUrl.protocol !== "https:") continue;
|
|
227
|
+
if (!passesDomainFilters(resultUrl, filters) || seen.has(resultUrl.href)) continue;
|
|
228
|
+
seen.add(resultUrl.href);
|
|
229
|
+
results.push({
|
|
230
|
+
title: text(item.title) || resultUrl.href,
|
|
231
|
+
url: resultUrl.href,
|
|
232
|
+
snippet: text(item.description).slice(0, MAX_SNIPPET_CHARS),
|
|
233
|
+
});
|
|
234
|
+
if (results.length >= numResults) break;
|
|
235
|
+
}
|
|
236
|
+
return { answer: formatSearchResultsAsAnswer(results), results };
|
|
237
|
+
}
|
|
@@ -55,6 +55,9 @@ function buildProviderButtons(
|
|
|
55
55
|
{ value: "ceramic", label: "Ceramic", available: available.ceramic },
|
|
56
56
|
{ value: "linkup", label: "Linkup", available: available.linkup },
|
|
57
57
|
{ value: "ninerouter", label: "9router", available: available.ninerouter },
|
|
58
|
+
{ value: "cloudflare", label: "Cloudflare", available: available.cloudflare },
|
|
59
|
+
{ value: "searchapi", label: "SearchApi", available: available.searchapi },
|
|
60
|
+
{ value: "tabstack", label: "Tabstack", available: available.tabstack },
|
|
58
61
|
{ value: "deepseek", label: "DeepSeek", available: available.deepseek },
|
|
59
62
|
];
|
|
60
63
|
|
|
@@ -743,6 +746,11 @@ main {
|
|
|
743
746
|
background: rgba(166, 227, 161, 0.14);
|
|
744
747
|
border-color: rgba(166, 227, 161, 0.3);
|
|
745
748
|
}
|
|
749
|
+
.provider-tag.provider-tabstack {
|
|
750
|
+
color: #f5c2e7;
|
|
751
|
+
background: rgba(245, 194, 231, 0.14);
|
|
752
|
+
border-color: rgba(245, 194, 231, 0.3);
|
|
753
|
+
}
|
|
746
754
|
.provider-tag.provider-jina {
|
|
747
755
|
color: #f9e2af;
|
|
748
756
|
background: rgba(249, 226, 175, 0.14);
|
|
@@ -1482,7 +1490,7 @@ const SCRIPT = `(function() {
|
|
|
1482
1490
|
var token = DATA.sessionToken;
|
|
1483
1491
|
var timeoutSec = DATA.timeout;
|
|
1484
1492
|
var queries = Array.isArray(DATA.queries) ? DATA.queries : [];
|
|
1485
|
-
var providers = ["auto", "all", "openai", "exa", "brave", "parallel", "parallel-mcp", "tinyfish", "search1api", "searchinfinity", "querit", "tavily", "firecrawl", "jina", "serpdive", "kagi", "bocha", "ollama", "searxng", "degoog", "duckduckgo", "perplexity", "gemini", "kimi", "anysearch", "xcrawl", "xai", "mistral", "brightdata", "serpbase", "serpapi", "serper", "serply", "valyu", "baizhi", "you", "zai", "keenable", "ceramic", "deepseek", "linkup", "ninerouter"];
|
|
1493
|
+
var providers = ["auto", "all", "openai", "exa", "brave", "parallel", "parallel-mcp", "tinyfish", "search1api", "searchinfinity", "querit", "tavily", "firecrawl", "jina", "serpdive", "kagi", "bocha", "ollama", "searxng", "degoog", "duckduckgo", "perplexity", "gemini", "kimi", "anysearch", "xcrawl", "xai", "mistral", "brightdata", "serpbase", "serpapi", "serper", "serply", "valyu", "baizhi", "you", "zai", "keenable", "ceramic", "deepseek", "linkup", "ninerouter", "cloudflare", "searchapi", "tabstack"];
|
|
1486
1494
|
var availProviders = DATA.availableProviders && typeof DATA.availableProviders === "object" ? DATA.availableProviders : {};
|
|
1487
1495
|
var workflow = "summary-review";
|
|
1488
1496
|
var initialDefaultProvider = typeof DATA.defaultProvider === "string" ? DATA.defaultProvider : "exa";
|
|
@@ -1696,6 +1704,7 @@ const SCRIPT = `(function() {
|
|
|
1696
1704
|
if (provider === "searchinfinity") return "Searchinfinity";
|
|
1697
1705
|
if (provider === "querit") return "Querit";
|
|
1698
1706
|
if (provider === "tavily") return "Tavily";
|
|
1707
|
+
if (provider === "tabstack") return "Tabstack";
|
|
1699
1708
|
if (provider === "firecrawl") return "Firecrawl";
|
|
1700
1709
|
if (provider === "jina") return "Jina";
|
|
1701
1710
|
if (provider === "serpdive") return "SERPdive";
|
|
@@ -1726,6 +1735,8 @@ const SCRIPT = `(function() {
|
|
|
1726
1735
|
if (provider === "ceramic") return "Ceramic";
|
|
1727
1736
|
if (provider === "linkup") return "Linkup";
|
|
1728
1737
|
if (provider === "ninerouter") return "9router";
|
|
1738
|
+
if (provider === "cloudflare") return "Cloudflare";
|
|
1739
|
+
if (provider === "searchapi") return "SearchApi";
|
|
1729
1740
|
if (provider === "deepseek") return "DeepSeek";
|
|
1730
1741
|
return "Unknown";
|
|
1731
1742
|
}
|
|
@@ -285,6 +285,7 @@ export function startCuratorServer(
|
|
|
285
285
|
if (provider === "searchinfinity") return availableProviders.searchinfinity;
|
|
286
286
|
if (provider === "querit") return availableProviders.querit;
|
|
287
287
|
if (provider === "tavily") return availableProviders.tavily;
|
|
288
|
+
if (provider === "tabstack") return availableProviders.tabstack;
|
|
288
289
|
if (provider === "firecrawl") return availableProviders.firecrawl;
|
|
289
290
|
if (provider === "jina") return availableProviders.jina;
|
|
290
291
|
if (provider === "serpdive") return availableProviders.serpdive;
|
|
@@ -314,6 +315,8 @@ export function startCuratorServer(
|
|
|
314
315
|
if (provider === "ceramic") return availableProviders.ceramic;
|
|
315
316
|
if (provider === "linkup") return availableProviders.linkup;
|
|
316
317
|
if (provider === "ninerouter") return availableProviders.ninerouter;
|
|
318
|
+
if (provider === "cloudflare") return availableProviders.cloudflare;
|
|
319
|
+
if (provider === "searchapi") return availableProviders.searchapi;
|
|
317
320
|
if (provider === "deepseek") return availableProviders.deepseek;
|
|
318
321
|
return false;
|
|
319
322
|
}
|