{"_id":"@aizigao/pi-proxy-fetch","_rev":"8-2eacf30c874f525dce31ea16513a6f2d","name":"@aizigao/pi-proxy-fetch","dist-tags":{"latest":"1.0.3"},"versions":{"0.1.0":{"name":"@aizigao/pi-proxy-fetch","version":"0.1.0","keywords":["pi-package","pi-extension","proxy","fetch","undici"],"license":"MIT","_id":"@aizigao/pi-proxy-fetch@0.1.0","maintainers":[{"name":"aizigao","email":"weixiangzhe@live.com"}],"homepage":"https://github.com/aizigao/pi-proxy-fetch#readme","bugs":{"url":"https://github.com/aizigao/pi-proxy-fetch/issues"},"pi":{"extensions":["./index.ts"]},"dist":{"shasum":"a6fd9fe782dc4d357188403a1be613f4f45f82e8","tarball":"https://registry.npmjs.org/@aizigao/pi-proxy-fetch/-/pi-proxy-fetch-0.1.0.tgz","fileCount":4,"integrity":"sha512-7BgGypjdE9c7QeQrFhnJIuTW37ewHdswEwWAKzkokGgNCT4hchl+S4wDresZ9+7r7BHKF7lxQN7q+GjdpLaTOQ==","signatures":[{"sig":"MEYCIQCo/w162OvDKb9b1hV+0zkN9pfXwT9qmjMK6oKaxdSysAIhANGV14vDMGPtyy9gxwf1GzbFtAHIdvKhz638/nrgRwRo","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14803},"type":"module","engines":{"node":">=20"},"gitHead":"a2b83db9e0cdf0c94587ffe03b7916dcc31d2436","scripts":{"lint":"eslint .","check":"tsc --noEmit","lint:fix":"eslint . --fix"},"_npmUser":{"name":"aizigao","email":"weixiangzhe@live.com"},"repository":{"url":"git+https://github.com/aizigao/pi-proxy-fetch.git","type":"git"},"_npmVersion":"10.9.4","description":"Pi extension package that routes globalThis.fetch through direct, proxy, or fallback behavior based on hostname rules.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"undici":"^7.16.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.1","@eslint/js":"^9.39.1","typescript":"^5.9.3","@types/node":"^24.10.1","typescript-eslint":"^8.46.4","@earendil-works/pi-coding-agent":"*"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-proxy-fetch_0.1.0_1779273450305_0.6422310036551855","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@aizigao/pi-proxy-fetch","version":"0.1.1","keywords":["pi-package","pi-extension","proxy","fetch","undici"],"license":"MIT","_id":"@aizigao/pi-proxy-fetch@0.1.1","maintainers":[{"name":"aizigao","email":"weixiangzhe@live.com"}],"homepage":"https://github.com/aizigao/pi-proxy-fetch#readme","bugs":{"url":"https://github.com/aizigao/pi-proxy-fetch/issues"},"pi":{"extensions":["./index.ts"]},"dist":{"shasum":"7def4b850b0ed48a2355596da30a05fe1ef79f4d","tarball":"https://registry.npmjs.org/@aizigao/pi-proxy-fetch/-/pi-proxy-fetch-0.1.1.tgz","fileCount":4,"integrity":"sha512-kqLBaYpELTPwidcjXX5F5VZrVaOCAjVEup0nkLHL6aA6Ey7KcTvwIoOD0nHHye38N/ZrF8nR9Hhof+BwQQNi1A==","signatures":[{"sig":"MEQCIGIvypedAP8vgXuEimFTK3avlQ+1HDO9spNjiZQzK9bDAiBsCOxyvofzWPnF8qBBoUF+SMuYB9QCNF8GT6kA2WS3nA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14296},"type":"module","engines":{"node":">=20"},"gitHead":"a3e4f57ffbb69d7cacbf318212f1df86a970380d","scripts":{"lint":"eslint .","check":"tsc --noEmit","lint:fix":"eslint . --fix"},"_npmUser":{"name":"aizigao","email":"weixiangzhe@live.com"},"repository":{"url":"git+https://github.com/aizigao/pi-proxy-fetch.git","type":"git"},"_npmVersion":"10.9.4","description":"Pi extension package that routes globalThis.fetch through direct, proxy, or fallback behavior based on hostname rules.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"undici":"^7.16.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.1","@eslint/js":"^9.39.1","typescript":"^5.9.3","@types/node":"^24.10.1","typescript-eslint":"^8.46.4","@earendil-works/pi-coding-agent":"*"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-proxy-fetch_0.1.1_1779273861651_0.6915449445177719","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@aizigao/pi-proxy-fetch","version":"0.1.2","keywords":["pi-package","pi-extension","proxy","fetch","undici"],"license":"MIT","_id":"@aizigao/pi-proxy-fetch@0.1.2","maintainers":[{"name":"aizigao","email":"weixiangzhe@live.com"}],"homepage":"https://github.com/aizigao/pi-proxy-fetch#readme","bugs":{"url":"https://github.com/aizigao/pi-proxy-fetch/issues"},"pi":{"extensions":["./index.ts"]},"dist":{"shasum":"f7fed4d72303929f727b76b0a89eb2fd5d34ed01","tarball":"https://registry.npmjs.org/@aizigao/pi-proxy-fetch/-/pi-proxy-fetch-0.1.2.tgz","fileCount":4,"integrity":"sha512-2NHUhy3dIp+V3OzDdNz7rindVtwHtP+Vq3bFhs8Z9g7z3mmgLI1PcE5uVdU4/8XUfZAL5T4RDfPJ1EQYY6FIyw==","signatures":[{"sig":"MEUCIFfU2x+WMMG+w5HOWj+g2b63eENyy5PkSNKq1FcQS8anAiEApTJ7a0Ui0ReUML9e7i/8Pv0a2YJD+y24IV4WerqTJ6o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14567},"type":"module","engines":{"node":">=20"},"gitHead":"8c37962ed4a8ff1fa1e926fe79ac65919f075654","scripts":{"lint":"eslint .","check":"tsc --noEmit","lint:fix":"eslint . --fix"},"_npmUser":{"name":"aizigao","email":"weixiangzhe@live.com"},"repository":{"url":"git+https://github.com/aizigao/pi-proxy-fetch.git","type":"git"},"_npmVersion":"10.9.4","description":"Pi extension package that routes globalThis.fetch through direct, proxy, or fallback behavior based on hostname rules.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"undici":"^7.16.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.1","@eslint/js":"^9.39.1","typescript":"^5.9.3","@types/node":"^24.10.1","typescript-eslint":"^8.46.4","@earendil-works/pi-coding-agent":"*"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-proxy-fetch_0.1.2_1779418924730_0.8193377299049449","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@aizigao/pi-proxy-fetch","version":"0.2.0","keywords":["pi-package","pi-extension","proxy","fetch","undici"],"license":"MIT","_id":"@aizigao/pi-proxy-fetch@0.2.0","maintainers":[{"name":"aizigao","email":"weixiangzhe@live.com"}],"homepage":"https://github.com/aizigao/pi-proxy-fetch#readme","bugs":{"url":"https://github.com/aizigao/pi-proxy-fetch/issues"},"pi":{"extensions":["./index.ts"]},"dist":{"shasum":"44f7b572b20848ce63e158b409bbb436ebb1aeda","tarball":"https://registry.npmjs.org/@aizigao/pi-proxy-fetch/-/pi-proxy-fetch-0.2.0.tgz","fileCount":4,"integrity":"sha512-DAmIevsmhwe/c497NpNNfGh0MIGLOccr1VNoMxpkDiD7vLRp1BCQkLZy6BPXdHyw9a5Ss7fplJqbHDCq5U/BgQ==","signatures":[{"sig":"MEUCIQDcuKVk/E4JAyiA51Heu5K4R5WJWIixUqGgLrvnHi3DAQIgSx+XQeKJtEBkDFl/Jgp+RnTvz5Sj5W5GpMSiLV/LT2I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15133},"type":"module","engines":{"node":">=20"},"gitHead":"9766d02d5762db252e3a5edad071409f9a78827e","scripts":{"lint":"eslint .","check":"tsc --noEmit","lint:fix":"eslint . --fix"},"_npmUser":{"name":"aizigao","email":"weixiangzhe@live.com"},"repository":{"url":"git+https://github.com/aizigao/pi-proxy-fetch.git","type":"git"},"_npmVersion":"10.9.4","description":"Pi extension package that routes globalThis.fetch through direct, proxy, or fallback behavior based on hostname rules.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"undici":"^7.16.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.1","@eslint/js":"^9.39.1","typescript":"^5.9.3","@types/node":"^24.10.1","typescript-eslint":"^8.46.4","@earendil-works/pi-coding-agent":"*"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-proxy-fetch_0.2.0_1780101592109_0.5282563990668783","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@aizigao/pi-proxy-fetch","version":"1.0.0","keywords":["pi-package","pi-extension","proxy","fetch","undici"],"license":"MIT","_id":"@aizigao/pi-proxy-fetch@1.0.0","maintainers":[{"name":"aizigao","email":"weixiangzhe@live.com"}],"homepage":"https://github.com/aizigao/pi-proxy-fetch#readme","bugs":{"url":"https://github.com/aizigao/pi-proxy-fetch/issues"},"pi":{"image":"./assets/readme-cover.png","extensions":["./index.ts"]},"dist":{"shasum":"d4b2c09a7513b9191cc33c75b0e8659b518f676f","tarball":"https://registry.npmjs.org/@aizigao/pi-proxy-fetch/-/pi-proxy-fetch-1.0.0.tgz","fileCount":10,"integrity":"sha512-hVdd9GVLRB1+7LMP7GliYz6fT/zRmwEJjgSPKSJRQeQwfYV4vDrb47cP5Pn4k8WFvZgodYXTgUVQ87SJ8Y6z3w==","signatures":[{"sig":"MEUCIHG0BKsULmGolyTFEJyORzM1WWGQ2pMHuSwMqSCvB8b2AiEA7RsjGYy6HANa7Tf2zB449S5tshUdnfX3FgKtKxrFdcU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":176672},"type":"module","engines":{"node":">=20"},"gitHead":"f7c97c157472245565b6720477a0fe6f8cdcb988","scripts":{"lint":"eslint .","check":"tsc --noEmit","schema":"node scripts/generate-schema.js","lint:fix":"eslint . --fix","postinstall":"node scripts/setup-hooks.js"},"_npmUser":{"name":"aizigao","email":"weixiangzhe@live.com"},"repository":{"url":"git+https://github.com/aizigao/pi-proxy-fetch.git","type":"git"},"_npmVersion":"10.9.4","description":"Pi extension package that routes globalThis.fetch through direct, proxy, or fallback behavior based on hostname rules.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"undici":"^7.16.0","@aizigao/pi-fetch-pipeline":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.1","@eslint/js":"^9.39.1","typescript":"^5.9.3","@types/node":"^24.10.1","typescript-eslint":"^8.46.4","@earendil-works/pi-coding-agent":"*"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-proxy-fetch_1.0.0_1780221986194_0.0396653907861626","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@aizigao/pi-proxy-fetch","version":"1.0.1","keywords":["pi-package","pi-extension","proxy","fetch","undici"],"license":"MIT","_id":"@aizigao/pi-proxy-fetch@1.0.1","maintainers":[{"name":"aizigao","email":"weixiangzhe@live.com"}],"homepage":"https://github.com/aizigao/pi-proxy-fetch#readme","bugs":{"url":"https://github.com/aizigao/pi-proxy-fetch/issues"},"pi":{"image":"./assets/readme-cover.png","extensions":["./index.ts"]},"dist":{"shasum":"059ff79f5004be0deaffd4aa819bfb3d23e590f5","tarball":"https://registry.npmjs.org/@aizigao/pi-proxy-fetch/-/pi-proxy-fetch-1.0.1.tgz","fileCount":10,"integrity":"sha512-UPrdFhEGTbY0o5n0cxkwZ/zMSGskCMdz+pvTes2JAZz4mjga14VK9nFC2bSfZtcCe4yLT3QLAXl6vNnVxmjjvQ==","signatures":[{"sig":"MEQCIGjd0lBuE+okHed/ykZdX/HYnxtJMFvcMDg+TB8qkeEzAiBWFmnWgqyivt9MfgM+An+xFYc0peF/L9NB227mhXJpRg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":176622},"type":"module","engines":{"node":">=20"},"gitHead":"9d55d5b4c9eef98b31f89d9c20c2c9f1d686b68e","scripts":{"lint":"eslint .","check":"tsc --noEmit","schema":"node scripts/generate-schema.js","lint:fix":"eslint . --fix"},"_npmUser":{"name":"aizigao","email":"weixiangzhe@live.com"},"repository":{"url":"git+https://github.com/aizigao/pi-proxy-fetch.git","type":"git"},"_npmVersion":"10.9.4","description":"Pi extension package that routes globalThis.fetch through direct, proxy, or fallback behavior based on hostname rules.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"undici":"^7.16.0","@aizigao/pi-fetch-pipeline":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.1","@eslint/js":"^9.39.1","typescript":"^5.9.3","@types/node":"^24.10.1","typescript-eslint":"^8.46.4","@earendil-works/pi-coding-agent":"*"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-proxy-fetch_1.0.1_1780222102907_0.06220344337474981","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@aizigao/pi-proxy-fetch","version":"1.0.2","keywords":["pi-package","pi-extension","proxy","fetch","undici"],"license":"MIT","_id":"@aizigao/pi-proxy-fetch@1.0.2","maintainers":[{"name":"aizigao","email":"weixiangzhe@live.com"}],"homepage":"https://github.com/aizigao/pi-proxy-fetch#readme","bugs":{"url":"https://github.com/aizigao/pi-proxy-fetch/issues"},"pi":{"image":"./assets/readme-cover.png","extensions":["./index.ts"]},"dist":{"shasum":"3cc3e5d2433c1953794ca12d8254d242f696dbb6","tarball":"https://registry.npmjs.org/@aizigao/pi-proxy-fetch/-/pi-proxy-fetch-1.0.2.tgz","fileCount":10,"integrity":"sha512-EoNDSa/DC1Rv36tZsOvMtwfHHFjvPSmzFxKVFvhgHAhjoR1QrKuGZ4LgUB2piUyiOJ2rc1JmgrNh7Hi8YzPAgA==","signatures":[{"sig":"MEUCIQC3BjhmGRK2uufX3bAVQRw/XfFV3jjFM+LzgxpQJZJNDgIgDtmnr1MLGPkMuZM5EOHTUKF5VBYtWhPbxWaEDzqOt2k=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":176674},"type":"module","engines":{"node":">=20"},"gitHead":"511cdce2ffd91bd2212d51c2f46adc5ae5abdafb","scripts":{"lint":"eslint .","check":"tsc --noEmit","schema":"node scripts/generate-schema.js","lint:fix":"eslint . --fix"},"_npmUser":{"name":"aizigao","email":"weixiangzhe@live.com"},"repository":{"url":"git+https://github.com/aizigao/pi-proxy-fetch.git","type":"git"},"_npmVersion":"10.9.4","description":"Pi extension package that routes globalThis.fetch through direct, proxy, or fallback behavior based on hostname rules.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"undici":"^7.16.0","@aizigao/pi-fetch-pipeline":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.1","@eslint/js":"^9.39.1","typescript":"^5.9.3","@types/node":"^24.10.1","typescript-eslint":"^8.46.4","@earendil-works/pi-coding-agent":"*"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-proxy-fetch_1.0.2_1781591312599_0.489877970331281","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@aizigao/pi-proxy-fetch","version":"1.0.3","description":"Pi extension package that routes globalThis.fetch through direct, proxy, or fallback behavior based on hostname rules.","type":"module","license":"MIT","homepage":"https://github.com/aizigao/pi-proxy-fetch#readme","repository":{"type":"git","url":"git+https://github.com/aizigao/pi-proxy-fetch.git"},"bugs":{"url":"https://github.com/aizigao/pi-proxy-fetch/issues"},"keywords":["pi-package","pi-extension","proxy","fetch","undici"],"engines":{"node":">=20"},"publishConfig":{"access":"public"},"scripts":{"check":"tsc --noEmit","lint":"eslint .","lint:fix":"eslint . --fix","schema":"node scripts/generate-schema.js"},"pi":{"extensions":["./index.ts"],"image":"./assets/readme-cover.png"},"dependencies":{"@aizigao/pi-fetch-pipeline":"^1.0.0","undici":"^7.16.0"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"devDependencies":{"@earendil-works/pi-coding-agent":"*","@eslint/js":"^9.39.1","@types/node":"^24.10.1","eslint":"^9.39.1","typescript":"^5.9.3","typescript-eslint":"^8.46.4"},"gitHead":"77117f2864b67f31ecbe529874a3dadc5a707333","_id":"@aizigao/pi-proxy-fetch@1.0.3","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-VtE8xrvbtFGEn4A54OYqvJSIqOa2Zb5yzXYC3u9KfsYjDOnaeckfJ3qdQQYOehBGUiLw3MI1kbvOGL+GMYkzQg==","shasum":"d3139f5ffe6f990783c9ec7fe8541ff93369b12a","tarball":"https://registry.npmjs.org/@aizigao/pi-proxy-fetch/-/pi-proxy-fetch-1.0.3.tgz","fileCount":10,"unpackedSize":176674,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGkaBR8v5GSbdWFe8Zu2oE152HKjfQuUMb9u/ltqhWRVAiEAzI8JKHEjwo8rtgKIXI4c4/yUifJqCMq3SSYEDz0T8GM="}]},"_npmUser":{"name":"aizigao","email":"weixiangzhe@live.com"},"directories":{},"maintainers":[{"name":"aizigao","email":"weixiangzhe@live.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-proxy-fetch_1.0.3_1788186209994_0.840358294352574"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-20T10:37:30.126Z","modified":"2026-08-31T14:23:30.283Z","0.1.0":"2026-05-20T10:37:30.434Z","0.1.1":"2026-05-20T10:44:21.790Z","0.1.2":"2026-05-22T03:02:04.855Z","0.2.0":"2026-05-30T00:39:52.246Z","1.0.0":"2026-05-31T10:06:26.375Z","1.0.1":"2026-05-31T10:08:23.085Z","1.0.2":"2026-06-16T06:28:32.753Z","1.0.3":"2026-08-31T14:23:30.144Z"},"bugs":{"url":"https://github.com/aizigao/pi-proxy-fetch/issues"},"license":"MIT","homepage":"https://github.com/aizigao/pi-proxy-fetch#readme","keywords":["pi-package","pi-extension","proxy","fetch","undici"],"repository":{"type":"git","url":"git+https://github.com/aizigao/pi-proxy-fetch.git"},"description":"Pi extension package that routes globalThis.fetch through direct, proxy, or fallback behavior based on hostname rules.","maintainers":[{"name":"aizigao","email":"weixiangzhe@live.com"}],"readme":"# @aizigao/pi-proxy-fetch\n\n[![npm version](https://img.shields.io/npm/v/%40aizigao%2Fpi-proxy-fetch)](https://www.npmjs.com/package/@aizigao/pi-proxy-fetch)\n\nChinese: [`README-CN.md`](https://github.com/aizigao/pi-proxy-fetch/blob/master/README-CN.md)\n\nA Pi extension package that patches `globalThis.fetch` inside a Pi session and routes requests through SwitchyOmega-style `switchRules` and proxy profiles.\n\n## Features\n\n- **Multiple profiles**: define multiple proxy servers such as Clash or Whistle\n- **autoSwitch**: match requests by rules and route them to a target profile\n- **Built-in targets**: `direct` and `system` (`http_proxy` / `HTTP_PROXY` env)\n- **Remote rule lists**: `ruleListURL` downloads a local cached rule file and participates in matching\n- **Custom CA cert**: `proxy_server` supports optional `caCertPath` for tools like Whistle\n- **Interactive menu**: switch profiles, toggle enable/disable, inspect stats, refresh rule lists, reload config\n\n## Requirements\n\n- Node.js 20+\n- Pi coding agent installed\n\n## Installation\n\n```bash\npi install npm:@aizigao/pi-proxy-fetch\n```\n\n## npm package\n\n- Package: `@aizigao/pi-proxy-fetch`\n- npm: https://www.npmjs.com/package/@aizigao/pi-proxy-fetch\n\n## Configuration\n\nRecommended project-local config: `./.pi/proxy.json`\n\nGlobal config is also supported: `~/.pi/agent/proxy.json`\n\nIf neither config exists, a default global config is created at `~/.pi/agent/proxy.json`.\n\n```json\n{\n  \"$schema\": \"https://raw.githubusercontent.com/aizigao/pi-proxy-fetch/master/schema.json\",\n  \"version\": 1,\n  \"enabled\": true,\n  \"profileName\": \"auto-switch\",\n  \"profileConfig\": [\n    {\n      \"name\": \"my-clash\",\n      \"type\": \"proxy_server\",\n      \"server\": \"socks5://127.0.0.1:7890\"\n    },\n    {\n      \"name\": \"whistle\",\n      \"type\": \"proxy_server\",\n      \"server\": \"http://127.0.0.1:8899\",\n      \"caCertPath\": \"~/.WhistleAppData/.whistle/certs/root.crt\"\n    },\n    {\n      \"name\": \"auto-switch\",\n      \"type\": \"autoSwitch\",\n      \"ruleListURL\": \"https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt\",\n      \"switchRules\": [\n        {\n          \"note\": \"OpenAI direct\",\n          \"conditions\": [\n            { \"type\": \"host\", \"pattern\": \"api.openai.com\" }\n          ],\n          \"profileName\": \"direct\"\n        },\n        {\n          \"note\": \"Anthropic direct\",\n          \"conditions\": [\n            { \"type\": \"host\", \"pattern\": \"api.anthropic.com\" }\n          ],\n          \"profileName\": \"direct\"\n        },\n        {\n          \"note\": \"GitHub via Clash\",\n          \"conditions\": [\n            { \"type\": \"host\", \"pattern\": \"*.github.com\" }\n          ],\n          \"profileName\": \"my-clash\"\n        },\n        {\n          \"note\": \"Google via Clash\",\n          \"conditions\": [\n            { \"type\": \"url\", \"pattern\": \"*://*.google.com/*\" }\n          ],\n          \"profileName\": \"my-clash\"\n        }\n      ]\n    }\n  ]\n}\n```\n\n## Config path priority\n\n1. `./.pi/proxy.json` (project-local, preferred)\n2. `~/.pi/agent/proxy.json` (global)\n\n> Only configs with `version: 1` are treated as the current format. If the file is not the current format, the current file is backed up as `proxy.bak.json` and a default config is generated.\n\n## Top-level fields\n\n| Field | Type | Description |\n|---|---|---|\n| `version` | `1` | Current config schema version |\n| `enabled` | `boolean` | Master on/off switch. `false` bypasses all proxy logic |\n| `profileName` | `string` | Active profile name. Reserved values: `direct`, `system`; custom names must match `^[A-Za-z_-]+$` |\n| `profileConfig` | `Profile[]` | Profile list |\n\n## `proxy_server` fields\n\n| Field | Type | Description |\n|---|---|---|\n| `name` | `string` | Profile name; must match `^[A-Za-z_-]+$` |\n| `type` | `\"proxy_server\"` | Fixed value |\n| `server` | `string` | Required proxy URL, e.g. `socks5://127.0.0.1:7890` |\n| `caCertPath` | `string?` | Optional CA certificate path, useful for Whistle-style self-signed proxies |\n\n## `autoSwitch` fields\n\n| Field | Type | Description |\n|---|---|---|\n| `name` | `string` | Profile name; must match `^[A-Za-z_-]+$` |\n| `type` | `\"autoSwitch\"` | Fixed value |\n| `ruleListURL` | `string?` | Remote rule list URL |\n| `switchRules` | `SwitchRule[]` | Local rules |\n\n## `SwitchRule` fields\n\n| Field | Type | Description |\n|---|---|---|\n| `note` | `string?` | Note |\n| `conditions` | `Condition[]?` | Condition list with **OR** logic; empty means always match |\n| `profileName` | `string` | Target profile. Reserved: `direct`, `system`; custom names must match `^[A-Za-z_-]+$` |\n\n## `Condition` fields\n\n| Field | Type | Description |\n|---|---|---|\n| `type` | `host` / `url` / `regex` / `disabled` | Condition type |\n| `pattern` | `string?` | Match pattern |\n\n## Condition types\n\n| `type` | Matches | Notes |\n|---|---|---|\n| `host` | request hostname | Supports `*` / `?`; `*.example.com` matches both `example.com` and subdomains; `**.example.com` matches subdomains only |\n| `url` | full request URL | Supports `*` / `?`; no special `*.` behavior |\n| `regex` | full request URL | JavaScript regular expression |\n| `disabled` | - | Never matches |\n\n> If no rule matches, the request goes direct by default. No explicit catch-all rule is required.\n\n## `ruleListURL` behavior\n\n- `ruleListURL` is useful when you want to reuse a remote ruleset such as gfwlist / AutoProxy\n- Project configs save downloaded content next to the project config file\n- Global configs save downloaded content under `~/.pi/agent`\n- Filename format:\n\n```text\nproxy-rulelist-file--{profile_name_safe}.txt\n```\n\nExample:\n\n```text\n./.pi/proxy-rulelist-file--auto_switch.txt\n~/.pi/agent/proxy-rulelist-file--auto_switch.txt\n```\n\nBehavior:\n\n- On `session_start`, if the local file already exists, it is loaded directly\n- If the local file is missing, it is downloaded once automatically\n- You can also refresh it manually from the `/proxy` menu via **Refresh rule list files**\n- Downloaded remote rules are merged into memory at runtime only and are not written back into your original `switchRules`\n- Profile switching, reload, and menu actions never directly rewrite your original rules\n\n## Commands\n\nRun inside Pi:\n\n```text\n/proxy            # open interactive menu\n/proxy stats      # show stats\n/proxy reload     # reload config\n/proxy name       # switch directly to a profile\n```\n\nThe `/proxy` menu includes:\n\n- Select profile\n- Enable/Disable proxy\n- Show stats\n- Refresh rule list files\n- Reload config\n\n## Development\n\n```bash\nnpm install\nnpm run check\nnpm run lint\nnpm run schema\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}