@calmabacus/pi-web 1.2.8 → 1.2.9
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +13 -11
- package/.next/build-manifest.json +2 -2
- package/.next/required-server-files.js +1 -1
- package/.next/required-server-files.json +1 -1
- package/.next/routes-manifest.json +14 -0
- package/.next/server/app/_global-error/page.js +2 -2
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +4 -4
- package/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/api/agent/[id]/bash-output/route.js +1 -1
- package/.next/server/app/api/agent/[id]/events/route.js +1 -1
- package/.next/server/app/api/agent/[id]/lease/route.js +1 -1
- package/.next/server/app/api/agent/[id]/route.js +1 -1
- package/.next/server/app/api/agent/new/route.js +1 -1
- package/.next/server/app/api/agent/running/route.js +1 -1
- package/.next/server/app/api/app-update/route.js +1 -1
- package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
- package/.next/server/app/api/auth/login/[provider]/route.js +2 -2
- package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
- package/.next/server/app/api/auth/providers/route.js +1 -1
- package/.next/server/app/api/cwd/browse/route.js +1 -1
- package/.next/server/app/api/cwd/validate/route.js +1 -1
- package/.next/server/app/api/default-cwd/route.js +1 -1
- package/.next/server/app/api/file-index/route.js +1 -1
- package/.next/server/app/api/files/[...path]/route.js +1 -1
- package/.next/server/app/api/git/diff/route.js +2 -2
- package/.next/server/app/api/git/status/route.js +1 -1
- package/.next/server/app/api/home/route.js +1 -1
- package/.next/server/app/api/image-generation/route.js +1 -1
- package/.next/server/app/api/image-generation/settings/connections/route.js +1 -1
- package/.next/server/app/api/image-generation/settings/route.js +1 -1
- package/.next/server/app/api/models/route.js +1 -1
- package/.next/server/app/api/models-config/catalog/route.js +1 -1
- package/.next/server/app/api/models-config/discover/route.js +1 -1
- package/.next/server/app/api/models-config/picker/route.js +1 -1
- package/.next/server/app/api/models-config/route.js +1 -1
- package/.next/server/app/api/models-config/runtime/route.js +1 -1
- package/.next/server/app/api/models-config/test/route.js +1 -1
- package/.next/server/app/api/plugins/check/route.js +1 -1
- package/.next/server/app/api/plugins/route.js +1 -1
- package/.next/server/app/api/project-overrides/route.js +1 -0
- package/.next/server/app/api/project-overrides/route.js.nft.json +1 -0
- package/.next/server/app/api/project-overrides/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/project-trust/route.js +1 -1
- package/.next/server/app/api/projects/route.js +1 -1
- package/.next/server/app/api/push/config/route.js +1 -1
- package/.next/server/app/api/push/subscribe/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/auto-name/route.js +2 -2
- package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/export/route.js +2 -2
- package/.next/server/app/api/sessions/[id]/outline/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/subagent-usage/route.js +1 -0
- package/.next/server/app/api/sessions/[id]/subagent-usage/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/[id]/subagent-usage/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/route.js +1 -1
- package/.next/server/app/api/sessions/search/route.js +1 -1
- package/.next/server/app/api/skills/check/route.js +1 -1
- package/.next/server/app/api/skills/check/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/install/route.js +1 -1
- package/.next/server/app/api/skills/route.js +2 -2
- package/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/search/route.js +1 -1
- package/.next/server/app/api/skills/update/route.js +1 -1
- package/.next/server/app/api/skills/update/route.js.nft.json +1 -1
- package/.next/server/app/api/subagents/[id]/route.js +1 -1
- package/.next/server/app/api/subagents/profiles/route.js +1 -1
- package/.next/server/app/api/subagents/settings/route.js +1 -1
- package/.next/server/app/api/terminal/[id]/events/route.js +1 -1
- package/.next/server/app/api/terminal/[id]/route.js +1 -1
- package/.next/server/app/api/terminal/route.js +1 -1
- package/.next/server/app/api/tools/settings/route.js +1 -1
- package/.next/server/app/api/usage/route.js +1 -1
- package/.next/server/app/api/web-auth/route.js +1 -1
- package/.next/server/app/api/worktrees/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +7 -7
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/index.segments/_full.segment.rsc +7 -7
- package/.next/server/app/index.segments/_tree.segment.rsc +4 -4
- package/.next/server/app/login/page.js +2 -2
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +5 -5
- package/.next/server/app/login.segments/_full.segment.rsc +5 -5
- package/.next/server/app/login.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +5 -5
- package/.next/server/app/manifest.webmanifest/route.js +2 -2
- package/.next/server/app/page.js +23 -22
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +13 -11
- package/.next/server/chunks/2243.js +1 -1
- package/.next/server/chunks/402.js +3 -2
- package/.next/server/chunks/4020.js +1 -0
- package/.next/server/chunks/6429.js +8 -6
- package/.next/server/chunks/7147.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware.js +4 -4
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/static/6f_3UIpNmHjU9Xn8SsAAi/_buildManifest.js +1 -0
- package/.next/static/chunks/2981-5abf1fdfdb963718.js +1 -0
- package/.next/static/chunks/app/_global-error/page-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/bash-output/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/events/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/lease/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/agent/new/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/agent/running/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/app-update/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/auth/login/[provider]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/auth/providers/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/cwd/browse/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/cwd/validate/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/default-cwd/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/file-index/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/files/[...path]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/git/diff/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/git/status/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/home/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/image-generation/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/image-generation/settings/connections/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/image-generation/settings/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/models/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/models-config/catalog/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/models-config/discover/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/models-config/picker/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/models-config/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/models-config/runtime/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/models-config/test/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/plugins/check/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/plugins/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/project-overrides/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/project-trust/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/projects/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/push/config/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/push/subscribe/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/context/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/export/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/outline/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/state/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/subagent-usage/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/search/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/skills/check/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/skills/install/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/skills/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/skills/search/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/skills/update/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/subagents/[id]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/subagents/profiles/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/subagents/settings/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/terminal/[id]/events/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/terminal/[id]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/terminal/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/tools/settings/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/usage/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/web-auth/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/worktrees/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/{layout-abd03353f2b87156.js → layout-2c4104276f105978.js} +1 -1
- package/.next/static/chunks/app/manifest.webmanifest/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/page-8a658c191630cbd4.js +213 -0
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-be5d61c3d2d00f10.js +1 -0
- package/.next/static/css/{f6c5c5c31909d266.css → 90f551ecf6f7f552.css} +1 -1
- package/.next/static/css/{1a6a041bd877a737.css → cdd9ca136f3e707d.css} +1 -1
- package/.next/static/css/eae95890104af950.css +1 -0
- package/.next/trace +9 -42
- package/.next/trace-build +1 -1
- package/.next/types/app/api/project-overrides/route.ts +353 -0
- package/.next/types/app/api/sessions/[id]/subagent-usage/route.ts +353 -0
- package/.next/types/routes.d.ts +3 -1
- package/.next/types/validator.ts +18 -0
- package/package.json +1 -1
- package/.next/static/JdASme3vlmmcq3bfLK3dJ/_buildManifest.js +0 -1
- package/.next/static/chunks/2981-3cdf8a2b6a7acda7.js +0 -1
- package/.next/static/chunks/app/_global-error/page-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/bash-output/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/events/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/lease/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/agent/new/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/agent/running/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/app-update/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/auth/login/[provider]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/auth/providers/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/cwd/browse/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/cwd/validate/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/default-cwd/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/file-index/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/files/[...path]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/git/diff/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/git/status/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/home/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/image-generation/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/image-generation/settings/connections/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/image-generation/settings/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/models/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/models-config/catalog/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/models-config/discover/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/models-config/picker/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/models-config/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/models-config/runtime/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/models-config/test/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/plugins/check/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/plugins/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/project-trust/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/projects/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/push/config/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/push/subscribe/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/context/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/export/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/outline/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/state/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/search/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/skills/check/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/skills/install/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/skills/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/skills/search/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/skills/update/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/subagents/[id]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/subagents/profiles/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/subagents/settings/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/terminal/[id]/events/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/terminal/[id]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/terminal/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/tools/settings/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/usage/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/web-auth/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/worktrees/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/manifest.webmanifest/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/page-3c870fe5f7505e28.js +0 -212
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-65c0cd7526c36b6b.js +0 -1
- package/.next/static/css/b121d2362092b3ab.css +0 -1
- /package/.next/static/{JdASme3vlmmcq3bfLK3dJ → 6f_3UIpNmHjU9Xn8SsAAi}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=9194,a.ids=[9194],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},17551:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{IX:()=>q,LB:()=>t,U$:()=>o,V6:()=>p});var e=c(73024),f=c(76760),g=c(75430),h=c(38894),i=c.n(h),j=c(8102),k=c(28967),l=a([g]);g=(l.then?(await l)():l)[0];let r=["input","output","cacheRead","cacheWrite"];function m(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function n(){return(0,f.join)((0,g.getAgentDir)(),"models.json")}let s=/,(\s*[}\]])/g;function o(a=n()){if(!(0,e.existsSync)(a))return{config:{providers:{}}};try{return{config:function(a){let b=JSON.parse(i()(a).replace(s,"$1"));if(!m(b))throw Error("Invalid models.json: expected an object");return b}((0,e.readFileSync)(a,"utf8"))}}catch(c){let b=c instanceof Error?c.message:String(c);return{config:{providers:{}},error:`Failed to read ${a}: ${b}`}}}function p(a=n()){return o(a).config}class t extends Error{constructor(){super("models.json could not be parsed; refusing to overwrite it"),this.name="ModelsConfigReadError"}}function q(a,b=n()){if((0,e.existsSync)(b)&&o(b).error)throw new t;let c=(0,f.dirname)(b);(0,e.existsSync)(c)||(0,e.mkdirSync)(c,{recursive:!0});let d=function(a){let b=structuredClone(a);if(!m(b.providers))return b;for(let a of Object.values(b.providers))if(m(a)&&Array.isArray(a.models))for(let b of a.models){if(!m(b)||!("cost"in b))continue;let a=function(a){if(!m(a))return;let b=r.filter(b=>void 0!==a[b]);if(0!==b.length&&!b.some(b=>"number"!=typeof a[b]||!Number.isFinite(a[b])))return Object.fromEntries([...Object.entries(a),...r.map(b=>[b,a[b]??0])])}(b.cost);a?b.cost=a:delete b.cost}return b}(function(a){if(!m(a.providers))return a;let b=Object.fromEntries(Object.entries(a.providers).map(([a,b])=>{if(!m(b)||!Array.isArray(b.models))return[a,b];let c=b.models.filter(a=>!m(a)||"string"!=typeof a.id||a.id.trim().length>0);return[a,{...b,models:c}]}));return{...a,providers:b}}(function(a){if(!m(a.providers))return a;let b=Object.fromEntries(Object.entries(a.providers).map(([a,b])=>{if(!m(b)||!m(b.modelOverrides)||!Array.isArray(b.models))return[a,b];let c={...b.modelOverrides};for(let a of b.models){let b=m(a)?a.id:void 0;if("string"!=typeof b||0===b.length)continue;let d=c[b];if(!m(d))continue;let e={};for(let[b,c]of Object.entries(d)){if("id"===b)continue;let d=a[b];if(void 0===d){e[b]=c;continue}let f=function(a,b){if(!m(a)||!m(b))return;let c=Object.fromEntries(Object.entries(a).filter(([a])=>void 0===b[a]));return Object.keys(c).length>0?c:void 0}(c,d);void 0!==f&&(e[b]=f)}Object.keys(e).length>0?c[b]=e:delete c[b]}let d={...b,modelOverrides:c};return 0===Object.keys(c).length&&delete d.modelOverrides,[a,d]}));return{...a,providers:b}}(a)));(0,j.$)(b,JSON.stringify(d,null,2)),(0,k.kn)()}d()}catch(a){d(a)}})},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},28967:(a,b,c)=>{"use strict";function d(){return globalThis.__piModelsCacheState||(globalThis.__piModelsCacheState={entries:new Map,inFlight:new Map,generation:0}),globalThis.__piModelsCacheState}function e(){let a=d();a.generation+=1,a.entries.clear(),a.inFlight.clear()}function f(a,b){return b?{...a,modelError:b}:a}function g(a){return{...a,modelError:"Model list is temporarily unavailable. Check your configuration and try again."}}function h(a,b){let c=d(),e=c.entries.get(a);if(e){if(e.expiresAt>Date.now())return Promise.resolve(e.data);c.entries.delete(a)}let f=c.inFlight.get(a);if(f)return f;let g=c.generation,h=Promise.resolve().then(b).then(b=>{if(c.generation===g&&c.inFlight.get(a)===h){let d=Date.now();for(let[a,b]of c.entries)b.expiresAt<=d&&c.entries.delete(a);for(;c.entries.size>=32;){let a=c.entries.keys().next().value;if(void 0===a)break;c.entries.delete(a)}c.entries.set(a,{data:b,expiresAt:d+6e4})}return b}).finally(()=>{c.inFlight.get(a)===h&&c.inFlight.delete(a)});return c.inFlight.set(a,h),h}c.d(b,{Fw:()=>g,Mx:()=>f,kn:()=>e,rC:()=>h})},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},38894:a=>{"use strict";let b=Symbol("singleComment"),c=Symbol("multiComment"),d=()=>"",e=(a,b,c)=>a.slice(b,c).replace(/\S/g," "),f=(a,b)=>{let c=b-1,d=0;for(;"\\"===a[c];)c-=1,d+=1;return!!(d%2)};a.exports=(a,g={})=>{if("string"!=typeof a)throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof a}\``);let h=!1===g.whitespace?d:e,i=!1,j=!1,k=0,l="";for(let d=0;d<a.length;d++){let e=a[d],g=a[d+1];if(!j&&'"'===e&&(f(a,d)||(i=!i)),!i)if(j||e+g!=="//")if(j===b&&e+g==="\r\n"){j=!1,l+=h(a,k,++d),k=d;continue}else if(j===b&&"\n"===e)j=!1,l+=h(a,k,d),k=d;else if(j||e+g!=="/*"){if(j===c&&e+g==="*/"){j=!1,l+=h(a,k,++d+1),k=d+1;continue}}else{l+=a.slice(k,d),k=d,j=c,d++;continue}else l+=a.slice(k,d),k=d,j=b,d++}return l+(j?h(a.slice(k)):a.slice(k))}},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},44873:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/models-config/runtime/route",pathname:"/api/models-config/runtime",filename:"route",bundlePath:"app/api/models-config/runtime/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/models-config/runtime/route.ts",nextConfigOutput:"",userland:()=>c(84573),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/models-config/runtime/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},68117:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$z:()=>n,Dk:()=>m,XZ:()=>l,tL:()=>o});var e=c(79748),f=c(33873),g=c(75430),h=c(28802),i=c(80547),j=c(72498),k=a([g,h,i,j]);async function l(a){let b=(0,f.resolve)(a);try{if(!(await (0,e.stat)(b)).isDirectory())return{error:`Not a directory: ${b}`,status:400}}catch{return{error:`Directory does not exist: ${b}`,status:400}}let c=await (0,i.mc)();return(0,i.B7)(b,c)?{cwd:b}:{error:"Access denied",status:403}}async function m(a){return a?l(a):{cwd:(0,g.getAgentDir)()}}async function n(a){let b=(0,g.getAgentDir)(),c=(0,j.Fk)(a,b);return(0,g.createAgentSessionServices)({cwd:a,agentDir:b,...c?{resourceLoaderReloadOptions:c}:{}})}async function o(){let a=(0,g.getAgentDir)();return(await g.ModelRuntime.create({credentials:new h.InMemoryCredentialStore,modelsPath:(0,f.join)(a,".pi-web-no-models.json"),modelsStorePath:(0,f.join)(a,"models-store.json"),allowModelNetwork:!1})).getModels().map(a=>`${a.provider}/${a.id}`)}[g,h,i,j]=k.then?(await k)():k,d()}catch(a){d(a)}})},72498:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Fk:()=>i,Y1:()=>g,er:()=>h});var e=c(75430),f=a([e]);function g(a,b){if(!(a&&(0,e.hasTrustRequiringProjectResources)(a)))return{requiresTrust:!1,trusted:!0};let c=new e.ProjectTrustStore(b);return{requiresTrust:!0,trusted:!0===c.get(a)}}function h(a,b){let c=g(a,b);return c.requiresTrust?(new e.ProjectTrustStore(b).set(a,!0),{requiresTrust:!0,trusted:!0}):c}function i(a,b){if(!g(a,b).requiresTrust)return;let c=new e.ProjectTrustStore(b);return{resolveProjectTrust:async()=>!0===c.get(a)}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},80547:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},84573:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>i,dynamic:()=>j});var e=c(23211),f=c(68117),g=c(17551),h=a([f,g]);[f,g]=h.then?(await h)():h;let j="force-dynamic";async function i(a){let b=new URL(a.url).searchParams.get("cwd");if(!b)return e.NextResponse.json({error:"cwd is required"},{status:400});let c=await (0,f.XZ)(b);if("error"in c)return e.NextResponse.json({error:c.error},{status:c.status});try{let a=(0,g.U$)(),b=await (0,f.$z)(c.cwd),[d,h]=await Promise.all([b.modelRuntime.getAvailable(),(0,f.tL)()]),i=Object.keys(a.config.providers??{}),j=h.filter(a=>i.includes(a.slice(0,a.indexOf("/")))),k=d.map(a=>({provider:a.provider,id:a.id,name:a.name,api:a.api,reasoning:a.reasoning,...a.thinkingLevelMap?{thinkingLevelMap:a.thinkingLevelMap}:{},input:a.input,contextWindow:a.contextWindow,maxTokens:a.maxTokens,cost:{input:a.cost?.input,output:a.cost?.output,cacheRead:a.cost?.cacheRead,cacheWrite:a.cost?.cacheWrite},...a.headers?{headers:a.headers}:{},...a.compat?{compat:a.compat}:{}})),l=[a.error,b.modelRuntime.getError()].filter(Boolean).join("\n\n");return e.NextResponse.json({catalog:k,builtIn:j,...l?{modelError:l}:{}})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,402],()=>b(b.s=44873));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=9194,a.ids=[9194],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},17551:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{IX:()=>q,LB:()=>t,U$:()=>o,V6:()=>p});var e=c(73024),f=c(76760),g=c(75430),h=c(38894),i=c.n(h),j=c(8102),k=c(28967),l=a([g]);g=(l.then?(await l)():l)[0];let r=["input","output","cacheRead","cacheWrite"];function m(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function n(){return(0,f.join)((0,g.getAgentDir)(),"models.json")}let s=/,(\s*[}\]])/g;function o(a=n()){if(!(0,e.existsSync)(a))return{config:{providers:{}}};try{return{config:function(a){let b=JSON.parse(i()(a).replace(s,"$1"));if(!m(b))throw Error("Invalid models.json: expected an object");return b}((0,e.readFileSync)(a,"utf8"))}}catch(c){let b=c instanceof Error?c.message:String(c);return{config:{providers:{}},error:`Failed to read ${a}: ${b}`}}}function p(a=n()){return o(a).config}class t extends Error{constructor(){super("models.json could not be parsed; refusing to overwrite it"),this.name="ModelsConfigReadError"}}function q(a,b=n()){if((0,e.existsSync)(b)&&o(b).error)throw new t;let c=(0,f.dirname)(b);(0,e.existsSync)(c)||(0,e.mkdirSync)(c,{recursive:!0});let d=function(a){let b=structuredClone(a);if(!m(b.providers))return b;for(let a of Object.values(b.providers))if(m(a)&&Array.isArray(a.models))for(let b of a.models){if(!m(b)||!("cost"in b))continue;let a=function(a){if(!m(a))return;let b=r.filter(b=>void 0!==a[b]);if(0!==b.length&&!b.some(b=>"number"!=typeof a[b]||!Number.isFinite(a[b])))return Object.fromEntries([...Object.entries(a),...r.map(b=>[b,a[b]??0])])}(b.cost);a?b.cost=a:delete b.cost}return b}(function(a){if(!m(a.providers))return a;let b=Object.fromEntries(Object.entries(a.providers).map(([a,b])=>{if(!m(b)||!Array.isArray(b.models))return[a,b];let c=b.models.filter(a=>!m(a)||"string"!=typeof a.id||a.id.trim().length>0);return[a,{...b,models:c}]}));return{...a,providers:b}}(function(a){if(!m(a.providers))return a;let b=Object.fromEntries(Object.entries(a.providers).map(([a,b])=>{if(!m(b)||!m(b.modelOverrides)||!Array.isArray(b.models))return[a,b];let c={...b.modelOverrides};for(let a of b.models){let b=m(a)?a.id:void 0;if("string"!=typeof b||0===b.length)continue;let d=c[b];if(!m(d))continue;let e={};for(let[b,c]of Object.entries(d)){if("id"===b)continue;let d=a[b];if(void 0===d){e[b]=c;continue}let f=function(a,b){if(!m(a)||!m(b))return;let c=Object.fromEntries(Object.entries(a).filter(([a])=>void 0===b[a]));return Object.keys(c).length>0?c:void 0}(c,d);void 0!==f&&(e[b]=f)}Object.keys(e).length>0?c[b]=e:delete c[b]}let d={...b,modelOverrides:c};return 0===Object.keys(c).length&&delete d.modelOverrides,[a,d]}));return{...a,providers:b}}(a)));(0,j.$)(b,JSON.stringify(d,null,2)),(0,k.kn)()}d()}catch(a){d(a)}})},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},23075:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/models-config/runtime/route",pathname:"/api/models-config/runtime",filename:"route",bundlePath:"app/api/models-config/runtime/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/models-config/runtime/route.ts",nextConfigOutput:"",userland:()=>c(84573),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/models-config/runtime/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},28967:(a,b,c)=>{"use strict";function d(){return globalThis.__piModelsCacheState||(globalThis.__piModelsCacheState={entries:new Map,inFlight:new Map,generation:0}),globalThis.__piModelsCacheState}function e(){let a=d();a.generation+=1,a.entries.clear(),a.inFlight.clear()}function f(a,b){return b?{...a,modelError:b}:a}function g(a){return{...a,modelError:"Model list is temporarily unavailable. Check your configuration and try again."}}function h(a,b){let c=d(),e=c.entries.get(a);if(e){if(e.expiresAt>Date.now())return Promise.resolve(e.data);c.entries.delete(a)}let f=c.inFlight.get(a);if(f)return f;let g=c.generation,h=Promise.resolve().then(b).then(b=>{if(c.generation===g&&c.inFlight.get(a)===h){let d=Date.now();for(let[a,b]of c.entries)b.expiresAt<=d&&c.entries.delete(a);for(;c.entries.size>=32;){let a=c.entries.keys().next().value;if(void 0===a)break;c.entries.delete(a)}c.entries.set(a,{data:b,expiresAt:d+6e4})}return b}).finally(()=>{c.inFlight.get(a)===h&&c.inFlight.delete(a)});return c.inFlight.set(a,h),h}c.d(b,{Fw:()=>g,Mx:()=>f,kn:()=>e,rC:()=>h})},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},38894:a=>{"use strict";let b=Symbol("singleComment"),c=Symbol("multiComment"),d=()=>"",e=(a,b,c)=>a.slice(b,c).replace(/\S/g," "),f=(a,b)=>{let c=b-1,d=0;for(;"\\"===a[c];)c-=1,d+=1;return!!(d%2)};a.exports=(a,g={})=>{if("string"!=typeof a)throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof a}\``);let h=!1===g.whitespace?d:e,i=!1,j=!1,k=0,l="";for(let d=0;d<a.length;d++){let e=a[d],g=a[d+1];if(!j&&'"'===e&&(f(a,d)||(i=!i)),!i)if(j||e+g!=="//")if(j===b&&e+g==="\r\n"){j=!1,l+=h(a,k,++d),k=d;continue}else if(j===b&&"\n"===e)j=!1,l+=h(a,k,d),k=d;else if(j||e+g!=="/*"){if(j===c&&e+g==="*/"){j=!1,l+=h(a,k,++d+1),k=d+1;continue}}else{l+=a.slice(k,d),k=d,j=c,d++;continue}else l+=a.slice(k,d),k=d,j=b,d++}return l+(j?h(a.slice(k)):a.slice(k))}},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},68117:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$z:()=>n,Dk:()=>m,XZ:()=>l,tL:()=>o});var e=c(79748),f=c(33873),g=c(75430),h=c(28802),i=c(80547),j=c(72498),k=a([g,h,i,j]);async function l(a){let b=(0,f.resolve)(a);try{if(!(await (0,e.stat)(b)).isDirectory())return{error:`Not a directory: ${b}`,status:400}}catch{return{error:`Directory does not exist: ${b}`,status:400}}let c=await (0,i.mc)();return(0,i.B7)(b,c)?{cwd:b}:{error:"Access denied",status:403}}async function m(a){return a?l(a):{cwd:(0,g.getAgentDir)()}}async function n(a){let b=(0,g.getAgentDir)(),c=(0,j.Fk)(a,b);return(0,g.createAgentSessionServices)({cwd:a,agentDir:b,...c?{resourceLoaderReloadOptions:c}:{}})}async function o(){let a=(0,g.getAgentDir)();return(await g.ModelRuntime.create({credentials:new h.InMemoryCredentialStore,modelsPath:(0,f.join)(a,".pi-web-no-models.json"),modelsStorePath:(0,f.join)(a,"models-store.json"),allowModelNetwork:!1})).getModels().map(a=>`${a.provider}/${a.id}`)}[g,h,i,j]=k.then?(await k)():k,d()}catch(a){d(a)}})},72498:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Fk:()=>i,Y1:()=>g,er:()=>h});var e=c(75430),f=a([e]);function g(a,b){if(!(a&&(0,e.hasTrustRequiringProjectResources)(a)))return{requiresTrust:!1,trusted:!0};let c=new e.ProjectTrustStore(b);return{requiresTrust:!0,trusted:!0===c.get(a)}}function h(a,b){let c=g(a,b);return c.requiresTrust?(new e.ProjectTrustStore(b).set(a,!0),{requiresTrust:!0,trusted:!0}):c}function i(a,b){if(!g(a,b).requiresTrust)return;let c=new e.ProjectTrustStore(b);return{resolveProjectTrust:async()=>!0===c.get(a)}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},80547:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},84573:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>i,dynamic:()=>j});var e=c(23211),f=c(68117),g=c(17551),h=a([f,g]);[f,g]=h.then?(await h)():h;let j="force-dynamic";async function i(a){let b=new URL(a.url).searchParams.get("cwd");if(!b)return e.NextResponse.json({error:"cwd is required"},{status:400});let c=await (0,f.XZ)(b);if("error"in c)return e.NextResponse.json({error:c.error},{status:c.status});try{let a=(0,g.U$)(),b=await (0,f.$z)(c.cwd),[d,h]=await Promise.all([b.modelRuntime.getAvailable(),(0,f.tL)()]),i=Object.keys(a.config.providers??{}),j=h.filter(a=>i.includes(a.slice(0,a.indexOf("/")))),k=d.map(a=>({provider:a.provider,id:a.id,name:a.name,api:a.api,reasoning:a.reasoning,...a.thinkingLevelMap?{thinkingLevelMap:a.thinkingLevelMap}:{},input:a.input,contextWindow:a.contextWindow,maxTokens:a.maxTokens,cost:{input:a.cost?.input,output:a.cost?.output,cacheRead:a.cost?.cacheRead,cacheWrite:a.cost?.cacheWrite},...a.headers?{headers:a.headers}:{},...a.compat?{compat:a.compat}:{}})),l=[a.error,b.modelRuntime.getError()].filter(Boolean).join("\n\n");return e.NextResponse.json({catalog:k,builtIn:j,...l?{modelError:l}:{}})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,402],()=>b(b.s=23075));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=8658,a.ids=[8658],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12773:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>p,dynamic:()=>q});var e=c(23211),f=c(29021),g=c(21820),h=c(33873),i=c(19821),j=c(75430),k=c(68117),l=c(26777),m=c(66544),n=a([i,j,k,l]);[i,j,k,l]=n.then?(await n)():n;let q="force-dynamic";function o(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}async function p(a){let b;if(!(0,m.EN)(a))return e.NextResponse.json({ok:!1,error:"Untrusted API request"},{status:403});if(!(0,m.E2)(a))return e.NextResponse.json({ok:!1,error:"Content-Type must be application/json"},{status:415});try{let c,d=await a.json(),m="string"==typeof d.providerName?d.providerName.trim():"";if(!m)return e.NextResponse.json({ok:!1,error:"providerName is required"},{status:400});if(!o(d.provider))return e.NextResponse.json({ok:!1,error:"provider is required"},{status:400});if(!o(d.model))return e.NextResponse.json({ok:!1,error:"model is required"},{status:400});let n="string"==typeof d.model.id?d.model.id.trim():"";if(!n)return e.NextResponse.json({ok:!1,error:"Model ID is required"},{status:400});let p=await (0,k.Dk)("string"==typeof d.cwd&&d.cwd.trim()?d.cwd.trim():null);if("error"in p)return e.NextResponse.json({ok:!1,error:p.error},{status:p.status});let q=(await (0,k.$z)(p.cwd)).modelRuntime,r=q.getRegisteredProviderConfig(m),s=q.getModel(m,n);b=(0,f.mkdtempSync)((0,h.join)((0,g.tmpdir)(),"pi-web-model-test-"));let t=(0,h.join)(b,"models.json");(0,f.writeFileSync)(t,JSON.stringify({providers:{[m]:{...d.provider,...(0,l.$$)(d.provider,r),models:[{...d.model,...(0,l.rm)(d.model,s),id:n}]}}},null,2),"utf8");let u=await j.ModelRuntime.create({modelsPath:t}),v=u.getError();if(v)return e.NextResponse.json({ok:!1,error:v});let w=u.getModel(m,n);if(!w)return e.NextResponse.json({ok:!1,error:`Model not found: ${m}/${n}`});let x=await u.getAuth(w);if(!x?.auth.apiKey)return e.NextResponse.json({ok:!1,error:`No API key found for "${m}"`});let y=new AbortController,z=setTimeout(()=>y.abort(),2e4),A=Date.now();try{let a=await (0,i.completeSimple)(w,{messages:[{role:"user",content:"Reply with OK only.",timestamp:Date.now()}]},{apiKey:x.auth.apiKey,headers:x.auth.headers,maxTokens:16,timeoutMs:2e4,maxRetries:0,cacheRetention:"none",signal:y.signal,onResponse:a=>{c=a.status}}),b=Date.now()-A;if("error"===a.stopReason||"aborted"===a.stopReason)return e.NextResponse.json({ok:!1,error:a.errorMessage??(y.signal.aborted?"Test timed out":"Model returned an error"),latencyMs:b,status:c});return e.NextResponse.json({ok:!0,latencyMs:b,status:c,responseText:a.content.filter(a=>"text"===a.type).map(a=>a.text).join("").slice(0,300)})}finally{clearTimeout(z)}}catch(a){return e.NextResponse.json({ok:!1,error:a instanceof Error?a.message:String(a)},{status:500})}finally{b&&(0,f.rmSync)(b,{recursive:!0,force:!0})}}d()}catch(a){d(a)}})},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},19821:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/compat")},21820:a=>{"use strict";a.exports=require("os")},26777:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$$:()=>j,rm:()=>k,uo:()=>m});var e=c(29021),f=c(21820),g=c(33873),h=c(75430),i=a([h]);function j(a,b){let c={};return!a.baseUrl&&b?.baseUrl&&(c.baseUrl=b.baseUrl),!a.api&&b?.api&&(c.api=b.api),!a.name&&b?.name&&(c.name=b.name),c}h=(i.then?(await i)():i)[0];let n=["api","baseUrl","name","contextWindow","maxTokens"];function k(a,b){return b?Object.fromEntries(n.filter(c=>void 0===a[c]&&void 0!==b[c]).map(a=>[a,b[a]])):{}}function l(a){return"object"!=typeof a||null===a||Array.isArray(a)?{}:Object.fromEntries(Object.entries(a).filter(a=>"string"==typeof a[1]))}async function m(a,b,c){let d;try{d=(0,e.mkdtempSync)((0,g.join)((0,f.tmpdir)(),"pi-web-model-discovery-"));let i=(0,g.join)(d,"models.json"),k="__pi_web_model_discovery__";(0,e.writeFileSync)(i,JSON.stringify({providers:{[a]:{...b,...j(b,c),models:[{id:k}]}}},null,2),"utf8");let m=await h.ModelRuntime.create({modelsPath:i}),n=m.getError();if(n)throw Error(n);let o=m.getModel(a,k);if(!o)throw Error(`Unable to load provider "${a}"`);let p=await m.getAuth(o);if(p)return{apiKey:p.auth.apiKey,headers:l(p.auth.headers)};return{headers:l(m.getCompatibilityRequestConfig(o).headers)}}finally{d&&(0,e.rmSync)(d,{recursive:!0,force:!0})}}d()}catch(a){d(a)}})},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;let c=e(b.hostname);return b.port?`${c}:${b.port}`:c}catch{return null}}function h(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function i(a){try{return new URL(a).origin}catch{return null}}function j(a,b=h()){return!!function(a,b=h()){let c=a.headers.get("host"),g=c?f(c):null;return!!g&&(!!("localhost"===g||g.endsWith(".localhost")||(0,d.isIP)(g))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===g}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c,d,e=a.headers.get("origin");if("cross-site"===a.headers.get("sec-fetch-site"))return!1;if(!e)return!0;let f=(b=new URL(a.url),(c=a.headers.get("host"))?i(`${b.protocol}//${c}`):null);if(null!==f&&i(e)===f)return!0;if("same-origin"!==a.headers.get("sec-fetch-site")||!a.headers.get("x-forwarded-proto"))return!1;let h=a.headers.get("host");if(!h)return!1;try{d=new URL(e).host}catch{return!1}let j=g(d);return null!==j&&j===g(h)}(a))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},68117:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$z:()=>n,Dk:()=>m,XZ:()=>l,tL:()=>o});var e=c(79748),f=c(33873),g=c(75430),h=c(28802),i=c(80547),j=c(72498),k=a([g,h,i,j]);async function l(a){let b=(0,f.resolve)(a);try{if(!(await (0,e.stat)(b)).isDirectory())return{error:`Not a directory: ${b}`,status:400}}catch{return{error:`Directory does not exist: ${b}`,status:400}}let c=await (0,i.mc)();return(0,i.B7)(b,c)?{cwd:b}:{error:"Access denied",status:403}}async function m(a){return a?l(a):{cwd:(0,g.getAgentDir)()}}async function n(a){let b=(0,g.getAgentDir)(),c=(0,j.Fk)(a,b);return(0,g.createAgentSessionServices)({cwd:a,agentDir:b,...c?{resourceLoaderReloadOptions:c}:{}})}async function o(){let a=(0,g.getAgentDir)();return(await g.ModelRuntime.create({credentials:new h.InMemoryCredentialStore,modelsPath:(0,f.join)(a,".pi-web-no-models.json"),modelsStorePath:(0,f.join)(a,"models-store.json"),allowModelNetwork:!1})).getModels().map(a=>`${a.provider}/${a.id}`)}[g,h,i,j]=k.then?(await k)():k,d()}catch(a){d(a)}})},70819:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/models-config/test/route",pathname:"/api/models-config/test",filename:"route",bundlePath:"app/api/models-config/test/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/models-config/test/route.ts",nextConfigOutput:"",userland:()=>c(12773),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/models-config/test/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},72498:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Fk:()=>i,Y1:()=>g,er:()=>h});var e=c(75430),f=a([e]);function g(a,b){if(!(a&&(0,e.hasTrustRequiringProjectResources)(a)))return{requiresTrust:!1,trusted:!0};let c=new e.ProjectTrustStore(b);return{requiresTrust:!0,trusted:!0===c.get(a)}}function h(a,b){let c=g(a,b);return c.requiresTrust?(new e.ProjectTrustStore(b).set(a,!0),{requiresTrust:!0,trusted:!0}):c}function i(a,b){if(!g(a,b).requiresTrust)return;let c=new e.ProjectTrustStore(b);return{resolveProjectTrust:async()=>!0===c.get(a)}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},80547:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,402],()=>b(b.s=70819));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=8658,a.ids=[8658],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},11705:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/models-config/test/route",pathname:"/api/models-config/test",filename:"route",bundlePath:"app/api/models-config/test/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/models-config/test/route.ts",nextConfigOutput:"",userland:()=>c(12773),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/models-config/test/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},12773:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>p,dynamic:()=>q});var e=c(23211),f=c(29021),g=c(21820),h=c(33873),i=c(19821),j=c(75430),k=c(68117),l=c(26777),m=c(66544),n=a([i,j,k,l]);[i,j,k,l]=n.then?(await n)():n;let q="force-dynamic";function o(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}async function p(a){let b;if(!(0,m.EN)(a))return e.NextResponse.json({ok:!1,error:"Untrusted API request"},{status:403});if(!(0,m.E2)(a))return e.NextResponse.json({ok:!1,error:"Content-Type must be application/json"},{status:415});try{let c,d=await a.json(),m="string"==typeof d.providerName?d.providerName.trim():"";if(!m)return e.NextResponse.json({ok:!1,error:"providerName is required"},{status:400});if(!o(d.provider))return e.NextResponse.json({ok:!1,error:"provider is required"},{status:400});if(!o(d.model))return e.NextResponse.json({ok:!1,error:"model is required"},{status:400});let n="string"==typeof d.model.id?d.model.id.trim():"";if(!n)return e.NextResponse.json({ok:!1,error:"Model ID is required"},{status:400});let p=await (0,k.Dk)("string"==typeof d.cwd&&d.cwd.trim()?d.cwd.trim():null);if("error"in p)return e.NextResponse.json({ok:!1,error:p.error},{status:p.status});let q=(await (0,k.$z)(p.cwd)).modelRuntime,r=q.getRegisteredProviderConfig(m),s=q.getModel(m,n);b=(0,f.mkdtempSync)((0,h.join)((0,g.tmpdir)(),"pi-web-model-test-"));let t=(0,h.join)(b,"models.json");(0,f.writeFileSync)(t,JSON.stringify({providers:{[m]:{...d.provider,...(0,l.$$)(d.provider,r),models:[{...d.model,...(0,l.rm)(d.model,s),id:n}]}}},null,2),"utf8");let u=await j.ModelRuntime.create({modelsPath:t}),v=u.getError();if(v)return e.NextResponse.json({ok:!1,error:v});let w=u.getModel(m,n);if(!w)return e.NextResponse.json({ok:!1,error:`Model not found: ${m}/${n}`});let x=await u.getAuth(w);if(!x?.auth.apiKey)return e.NextResponse.json({ok:!1,error:`No API key found for "${m}"`});let y=new AbortController,z=setTimeout(()=>y.abort(),2e4),A=Date.now();try{let a=await (0,i.completeSimple)(w,{messages:[{role:"user",content:"Reply with OK only.",timestamp:Date.now()}]},{apiKey:x.auth.apiKey,headers:x.auth.headers,maxTokens:16,timeoutMs:2e4,maxRetries:0,cacheRetention:"none",signal:y.signal,onResponse:a=>{c=a.status}}),b=Date.now()-A;if("error"===a.stopReason||"aborted"===a.stopReason)return e.NextResponse.json({ok:!1,error:a.errorMessage??(y.signal.aborted?"Test timed out":"Model returned an error"),latencyMs:b,status:c});return e.NextResponse.json({ok:!0,latencyMs:b,status:c,responseText:a.content.filter(a=>"text"===a.type).map(a=>a.text).join("").slice(0,300)})}finally{clearTimeout(z)}}catch(a){return e.NextResponse.json({ok:!1,error:a instanceof Error?a.message:String(a)},{status:500})}finally{b&&(0,f.rmSync)(b,{recursive:!0,force:!0})}}d()}catch(a){d(a)}})},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},19821:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/compat")},21820:a=>{"use strict";a.exports=require("os")},26777:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$$:()=>j,rm:()=>k,uo:()=>m});var e=c(29021),f=c(21820),g=c(33873),h=c(75430),i=a([h]);function j(a,b){let c={};return!a.baseUrl&&b?.baseUrl&&(c.baseUrl=b.baseUrl),!a.api&&b?.api&&(c.api=b.api),!a.name&&b?.name&&(c.name=b.name),c}h=(i.then?(await i)():i)[0];let n=["api","baseUrl","name","contextWindow","maxTokens"];function k(a,b){return b?Object.fromEntries(n.filter(c=>void 0===a[c]&&void 0!==b[c]).map(a=>[a,b[a]])):{}}function l(a){return"object"!=typeof a||null===a||Array.isArray(a)?{}:Object.fromEntries(Object.entries(a).filter(a=>"string"==typeof a[1]))}async function m(a,b,c){let d;try{d=(0,e.mkdtempSync)((0,g.join)((0,f.tmpdir)(),"pi-web-model-discovery-"));let i=(0,g.join)(d,"models.json"),k="__pi_web_model_discovery__";(0,e.writeFileSync)(i,JSON.stringify({providers:{[a]:{...b,...j(b,c),models:[{id:k}]}}},null,2),"utf8");let m=await h.ModelRuntime.create({modelsPath:i}),n=m.getError();if(n)throw Error(n);let o=m.getModel(a,k);if(!o)throw Error(`Unable to load provider "${a}"`);let p=await m.getAuth(o);if(p)return{apiKey:p.auth.apiKey,headers:l(p.auth.headers)};return{headers:l(m.getCompatibilityRequestConfig(o).headers)}}finally{d&&(0,e.rmSync)(d,{recursive:!0,force:!0})}}d()}catch(a){d(a)}})},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;let c=e(b.hostname);return b.port?`${c}:${b.port}`:c}catch{return null}}function h(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function i(a){try{return new URL(a).origin}catch{return null}}function j(a,b=h()){return!!function(a,b=h()){let c=a.headers.get("host"),g=c?f(c):null;return!!g&&(!!("localhost"===g||g.endsWith(".localhost")||(0,d.isIP)(g))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===g}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c,d,e=a.headers.get("origin");if("cross-site"===a.headers.get("sec-fetch-site"))return!1;if(!e)return!0;let f=(b=new URL(a.url),(c=a.headers.get("host"))?i(`${b.protocol}//${c}`):null);if(null!==f&&i(e)===f)return!0;if("same-origin"!==a.headers.get("sec-fetch-site")||!a.headers.get("x-forwarded-proto"))return!1;let h=a.headers.get("host");if(!h)return!1;try{d=new URL(e).host}catch{return!1}let j=g(d);return null!==j&&j===g(h)}(a))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},68117:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$z:()=>n,Dk:()=>m,XZ:()=>l,tL:()=>o});var e=c(79748),f=c(33873),g=c(75430),h=c(28802),i=c(80547),j=c(72498),k=a([g,h,i,j]);async function l(a){let b=(0,f.resolve)(a);try{if(!(await (0,e.stat)(b)).isDirectory())return{error:`Not a directory: ${b}`,status:400}}catch{return{error:`Directory does not exist: ${b}`,status:400}}let c=await (0,i.mc)();return(0,i.B7)(b,c)?{cwd:b}:{error:"Access denied",status:403}}async function m(a){return a?l(a):{cwd:(0,g.getAgentDir)()}}async function n(a){let b=(0,g.getAgentDir)(),c=(0,j.Fk)(a,b);return(0,g.createAgentSessionServices)({cwd:a,agentDir:b,...c?{resourceLoaderReloadOptions:c}:{}})}async function o(){let a=(0,g.getAgentDir)();return(await g.ModelRuntime.create({credentials:new h.InMemoryCredentialStore,modelsPath:(0,f.join)(a,".pi-web-no-models.json"),modelsStorePath:(0,f.join)(a,"models-store.json"),allowModelNetwork:!1})).getModels().map(a=>`${a.provider}/${a.id}`)}[g,h,i,j]=k.then?(await k)():k,d()}catch(a){d(a)}})},72498:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Fk:()=>i,Y1:()=>g,er:()=>h});var e=c(75430),f=a([e]);function g(a,b){if(!(a&&(0,e.hasTrustRequiringProjectResources)(a)))return{requiresTrust:!1,trusted:!0};let c=new e.ProjectTrustStore(b);return{requiresTrust:!0,trusted:!0===c.get(a)}}function h(a,b){let c=g(a,b);return c.requiresTrust?(new e.ProjectTrustStore(b).set(a,!0),{requiresTrust:!0,trusted:!0}):c}function i(a,b){if(!g(a,b).requiresTrust)return;let c=new e.ProjectTrustStore(b);return{resolveProjectTrust:async()=>!0===c.get(a)}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},80547:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,402],()=>b(b.s=11705));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=2403,a.ids=[2403],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},56615:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/check/route",pathname:"/api/plugins/check",filename:"route",bundlePath:"app/api/plugins/check/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/plugins/check/route.ts",nextConfigOutput:"",userland:()=>c(97982),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/check/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},65742:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Q:()=>t,t:()=>o});var e=c(79646),f=c(29021),g=c(33873),h=c(28354),i=c(75430),j=c(43618),k=c(72498),l=a([i,k]);[i,k]=l.then?(await l)():l;let u=(0,h.promisify)(e.execFile);function m(a){return"project"===a?"project":"global"}function n(a){if(!a.startsWith("npm:"))return;let b=a.slice(4).trim(),c=b.match(/^(@?[^@]+(?:\/[^@]+)?)(?:@(.+))?$/);return{name:c?.[1]??b,spec:b,version:c?.[2]}}function o(a){let b=n(a);return b?null===(0,j.valid)(b.version??""):!!(a.startsWith("git:")||/^(https?|ssh|git):\/\//i.test(a))&&!function(a){let b=a.startsWith("git:")?a.slice(4).trim():a.trim(),c=b.match(/^git@[^:]+:(.+)$/)?.[1];if(c)return c.includes("@");if(b.includes("://"))try{return new URL(b).pathname.replace(/^\/+/,"").includes("@")}catch{return!1}let d=b.indexOf("/");return d>=0&&b.slice(d+1).includes("@")}(a)}function p(a,b,c){let d=n(a.source);return{source:a.source,scope:m(a.scope),displayName:d?.name??a.source,type:d?"npm":"git",state:b,message:c}}async function q(a,b,c){let{stdout:d}=await u(a,b,{cwd:c.cwd,env:c.env?{...process.env,...c.env}:process.env,encoding:"utf8",timeout:1e4});return d}async function r(a,b,c,d){if(!a.installedPath||!(0,f.existsSync)(a.installedPath))return p(a,"error","Package is not installed.");let e=n(a.source);if(!e)return p(a,"unsupported");let[h="npm",...i]=c??[];if(!h)return p(a,"error","Invalid npmCommand.");let k=function(a){let b=JSON.parse((0,f.readFileSync)((0,g.join)(a,"package.json"),"utf8"));if("string"!=typeof b.version||!(0,j.valid)(b.version))throw Error("Installed package version is unavailable.");return b.version}(a.installedPath),l=await d(h,[...i,"view",e.spec,"version","--json"],{cwd:b}),m=e.version?(0,j.validRange)(e.version)??void 0:void 0,o=function(a,b){let c=JSON.parse(a.trim());if("string"==typeof c&&(0,j.valid)(c))return c;if(Array.isArray(c)){let a=c.filter(a=>"string"==typeof a&&null!==(0,j.valid)(a)),d=b?(0,j.maxSatisfying)(a,b):a.sort(j.rcompare)[0];if(d)return d}throw Error("Unexpected response from npm view.")}(l,m);return p(a,(0,j.gt)(o,k)?"update-available":"up-to-date")}async function s(a,b){if(!a.installedPath||!(0,f.existsSync)(a.installedPath))return p(a,"error","Package is not installed.");let c={cwd:a.installedPath,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}},d=(await b("git",["rev-parse","HEAD"],c)).trim(),e=await b("git",["rev-parse","--abbrev-ref","@{upstream}"],c).then(a=>a.trim()).catch(()=>""),g=e.startsWith("origin/")?`refs/heads/${e.slice(7)}`:"HEAD",h=await b("git",["ls-remote","origin",g],c),i=h.match(/^([0-9a-f]{40,64})\s+/m)?.[1];if(!i)throw Error(`Failed to determine remote ${g}.`);return p(a,d===i?"up-to-date":"update-available")}async function t(a,b,c={}){let d=c.packages,e=c.npmCommand;if(!d){let b=(0,i.getAgentDir)(),c=(0,k.Y1)(a,b),f=i.SettingsManager.create(a,b,{projectTrusted:c.trusted});d=new i.DefaultPackageManager({cwd:a,agentDir:b,settingsManager:f}).listConfiguredPackages(),e??=f.getNpmCommand()}let f=d.filter(a=>!b?.source||a.source===b.source&&m(a.scope)===b.scope),g=c.runCommand??q;return Promise.all(f.map(async b=>{if(!o(b.source))return p(b,"unsupported","Pinned or local packages cannot be checked automatically.");if(/^(1|true|yes)$/i.test(process.env.PI_OFFLINE??""))return p(b,"error","Update checks are disabled while PI_OFFLINE=1.");try{return n(b.source)?await r(b,a,e,g):await s(b,g)}catch(a){return p(b,"error",a instanceof Error?a.message:String(a))}}))}d()}catch(a){d(a)}})},72498:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Fk:()=>i,Y1:()=>g,er:()=>h});var e=c(75430),f=a([e]);function g(a,b){if(!(a&&(0,e.hasTrustRequiringProjectResources)(a)))return{requiresTrust:!1,trusted:!0};let c=new e.ProjectTrustStore(b);return{requiresTrust:!0,trusted:!0===c.get(a)}}function h(a,b){let c=g(a,b);return c.requiresTrust?(new e.ProjectTrustStore(b).set(a,!0),{requiresTrust:!0,trusted:!0}):c}function i(a,b){if(!g(a,b).requiresTrust)return;let c=new e.ProjectTrustStore(b);return{resolveProjectTrust:async()=>!0===c.get(a)}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},80547:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{},97982:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>i,dynamic:()=>j});var e=c(23211),f=c(80547),g=c(65742),h=a([f,g]);[f,g]=h.then?(await h)():h;let j="force-dynamic";async function i(a){try{let b=await a.json(),c="string"==typeof b.cwd?b.cwd:"";if(!c)return e.NextResponse.json({error:"cwd required"},{status:400});let d=await (0,f.mc)();if(!(0,f.B7)(c,d))return e.NextResponse.json({error:"Access denied"},{status:403});let h="string"==typeof b.source?b.source:void 0,i="global"===b.scope||"project"===b.scope?b.scope:void 0;if(h&&!i||!h&&i)return e.NextResponse.json({error:"source and scope must be provided together"},{status:400});let j=await (0,g.Q)(c,h&&i?{source:h,scope:i}:void 0);if(h&&i&&0===j.length)return e.NextResponse.json({error:"Configured package not found"},{status:404});return e.NextResponse.json({updates:j})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,3618,402],()=>b(b.s=56615));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=2403,a.ids=[2403],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},717:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/check/route",pathname:"/api/plugins/check",filename:"route",bundlePath:"app/api/plugins/check/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/plugins/check/route.ts",nextConfigOutput:"",userland:()=>c(97982),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/check/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},65742:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Q:()=>t,t:()=>o});var e=c(79646),f=c(29021),g=c(33873),h=c(28354),i=c(75430),j=c(43618),k=c(72498),l=a([i,k]);[i,k]=l.then?(await l)():l;let u=(0,h.promisify)(e.execFile);function m(a){return"project"===a?"project":"global"}function n(a){if(!a.startsWith("npm:"))return;let b=a.slice(4).trim(),c=b.match(/^(@?[^@]+(?:\/[^@]+)?)(?:@(.+))?$/);return{name:c?.[1]??b,spec:b,version:c?.[2]}}function o(a){let b=n(a);return b?null===(0,j.valid)(b.version??""):!!(a.startsWith("git:")||/^(https?|ssh|git):\/\//i.test(a))&&!function(a){let b=a.startsWith("git:")?a.slice(4).trim():a.trim(),c=b.match(/^git@[^:]+:(.+)$/)?.[1];if(c)return c.includes("@");if(b.includes("://"))try{return new URL(b).pathname.replace(/^\/+/,"").includes("@")}catch{return!1}let d=b.indexOf("/");return d>=0&&b.slice(d+1).includes("@")}(a)}function p(a,b,c){let d=n(a.source);return{source:a.source,scope:m(a.scope),displayName:d?.name??a.source,type:d?"npm":"git",state:b,message:c}}async function q(a,b,c){let{stdout:d}=await u(a,b,{cwd:c.cwd,env:c.env?{...process.env,...c.env}:process.env,encoding:"utf8",timeout:1e4});return d}async function r(a,b,c,d){if(!a.installedPath||!(0,f.existsSync)(a.installedPath))return p(a,"error","Package is not installed.");let e=n(a.source);if(!e)return p(a,"unsupported");let[h="npm",...i]=c??[];if(!h)return p(a,"error","Invalid npmCommand.");let k=function(a){let b=JSON.parse((0,f.readFileSync)((0,g.join)(a,"package.json"),"utf8"));if("string"!=typeof b.version||!(0,j.valid)(b.version))throw Error("Installed package version is unavailable.");return b.version}(a.installedPath),l=await d(h,[...i,"view",e.spec,"version","--json"],{cwd:b}),m=e.version?(0,j.validRange)(e.version)??void 0:void 0,o=function(a,b){let c=JSON.parse(a.trim());if("string"==typeof c&&(0,j.valid)(c))return c;if(Array.isArray(c)){let a=c.filter(a=>"string"==typeof a&&null!==(0,j.valid)(a)),d=b?(0,j.maxSatisfying)(a,b):a.sort(j.rcompare)[0];if(d)return d}throw Error("Unexpected response from npm view.")}(l,m);return p(a,(0,j.gt)(o,k)?"update-available":"up-to-date")}async function s(a,b){if(!a.installedPath||!(0,f.existsSync)(a.installedPath))return p(a,"error","Package is not installed.");let c={cwd:a.installedPath,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}},d=(await b("git",["rev-parse","HEAD"],c)).trim(),e=await b("git",["rev-parse","--abbrev-ref","@{upstream}"],c).then(a=>a.trim()).catch(()=>""),g=e.startsWith("origin/")?`refs/heads/${e.slice(7)}`:"HEAD",h=await b("git",["ls-remote","origin",g],c),i=h.match(/^([0-9a-f]{40,64})\s+/m)?.[1];if(!i)throw Error(`Failed to determine remote ${g}.`);return p(a,d===i?"up-to-date":"update-available")}async function t(a,b,c={}){let d=c.packages,e=c.npmCommand;if(!d){let b=(0,i.getAgentDir)(),c=(0,k.Y1)(a,b),f=i.SettingsManager.create(a,b,{projectTrusted:c.trusted});d=new i.DefaultPackageManager({cwd:a,agentDir:b,settingsManager:f}).listConfiguredPackages(),e??=f.getNpmCommand()}let f=d.filter(a=>!b?.source||a.source===b.source&&m(a.scope)===b.scope),g=c.runCommand??q;return Promise.all(f.map(async b=>{if(!o(b.source))return p(b,"unsupported","Pinned or local packages cannot be checked automatically.");if(/^(1|true|yes)$/i.test(process.env.PI_OFFLINE??""))return p(b,"error","Update checks are disabled while PI_OFFLINE=1.");try{return n(b.source)?await r(b,a,e,g):await s(b,g)}catch(a){return p(b,"error",a instanceof Error?a.message:String(a))}}))}d()}catch(a){d(a)}})},72498:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Fk:()=>i,Y1:()=>g,er:()=>h});var e=c(75430),f=a([e]);function g(a,b){if(!(a&&(0,e.hasTrustRequiringProjectResources)(a)))return{requiresTrust:!1,trusted:!0};let c=new e.ProjectTrustStore(b);return{requiresTrust:!0,trusted:!0===c.get(a)}}function h(a,b){let c=g(a,b);return c.requiresTrust?(new e.ProjectTrustStore(b).set(a,!0),{requiresTrust:!0,trusted:!0}):c}function i(a,b){if(!g(a,b).requiresTrust)return;let c=new e.ProjectTrustStore(b);return{resolveProjectTrust:async()=>!0===c.get(a)}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},80547:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{},97982:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>i,dynamic:()=>j});var e=c(23211),f=c(80547),g=c(65742),h=a([f,g]);[f,g]=h.then?(await h)():h;let j="force-dynamic";async function i(a){try{let b=await a.json(),c="string"==typeof b.cwd?b.cwd:"";if(!c)return e.NextResponse.json({error:"cwd required"},{status:400});let d=await (0,f.mc)();if(!(0,f.B7)(c,d))return e.NextResponse.json({error:"Access denied"},{status:403});let h="string"==typeof b.source?b.source:void 0,i="global"===b.scope||"project"===b.scope?b.scope:void 0;if(h&&!i||!h&&i)return e.NextResponse.json({error:"source and scope must be provided together"},{status:400});let j=await (0,g.Q)(c,h&&i?{source:h,scope:i}:void 0);if(h&&i&&0===j.length)return e.NextResponse.json({error:"Configured package not found"},{status:404});return e.NextResponse.json({updates:j})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,3618,402],()=>b(b.s=717));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=9742,a.ids=[9742],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},32493:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>w,POST:()=>x,dynamic:()=>y});var e=c(23211),f=c(29021),g=c(33873),h=c(75430),i=c(80547),j=c(66544),k=c(72498),l=c(65742),m=a([h,i,k,l]);[h,i,k,l]=m.then?(await m)():m;let y="force-dynamic";function n(){return{extensions:0,skills:0,prompts:0,themes:0}}function o(a){return"project"===a?"project":"global"}function p(a,b){return`${b}\0${a}`}function q(a){return"string"==typeof a?a:a.source}function r(a){return"string"!=typeof a&&Array.isArray(a.extensions)&&0===a.extensions.length&&Array.isArray(a.skills)&&0===a.skills.length&&Array.isArray(a.prompts)&&0===a.prompts.length&&Array.isArray(a.themes)&&0===a.themes.length}function s(a,b,c,d){let e="project"===c?a.getProjectSettings().packages??[]:a.getGlobalSettings().packages??[],f=!1,g=e.map(a=>q(a)!==b?a:(f=!0,d)?{..."string"==typeof a?{source:a}:a,extensions:[],skills:[],prompts:[],themes:[]}:q(a));return!!f&&("project"===c?a.setProjectPackages(g):a.setPackages(g),!0)}function t(a,b){var c,d;let e,f;return{kind:b,name:(c=a.path,d=b,e=(0,g.basename)(c),f=(0,g.extname)(e),"skill"===d&&"skill.md"===e.toLowerCase()?(0,g.basename)((0,g.dirname)(c)):("extension"===d||"theme"===d||"prompt"===d)&&f?"extension"===d&&/^index\.(ts|js)$/.test(e)?(0,g.basename)((0,g.dirname)(c)):e.slice(0,-f.length):e),path:a.path,relativePath:function(a){let b=a.metadata.baseDir;if(!b)return a.path;let c=(0,g.relative)(b,a.path);return c&&!c.startsWith("..")?c:a.path}(a)}}function u(a,b,c,d,e){if(!a.enabled||"package"!==a.metadata.origin)return;let f=a.metadata.source,g=o(a.metadata.scope),h=p(f,g),i=c.get(h)??n();i[b]+=1,e[b]+=1,c.set(h,i);let j=d.get(h)??[];j.push(t(a,"extensions"===b?"extension":"skills"===b?"skill":"prompts"===b?"prompt":"theme")),d.set(h,j)}async function v(a){let b=(0,h.getAgentDir)(),c=(0,k.Y1)(a,b),d=h.SettingsManager.create(a,b,{projectTrusted:c.trusted}),e=new h.DefaultPackageManager({cwd:a,agentDir:b,settingsManager:d}),i=[],j=new Map,m=new Map,s=[],v=n(),w=function(a){let b=new Map;for(let c of a.getGlobalSettings().packages??[])b.set(p(q(c),"global"),r(c));for(let c of a.getProjectSettings().packages??[])b.set(p(q(c),"project"),r(c));return b}(d);try{let a=await e.resolve(async a=>(i.push({type:"warning",source:a,message:"Package is configured but not installed yet."}),"skip"));({countsByPackage:j,resourcesByPackage:m,standaloneExtensions:s,totals:v}=function(a){let b=new Map,c=new Map,d=n();for(let e of a.extensions)u(e,"extensions",b,c,d);for(let e of a.skills)u(e,"skills",b,c,d);for(let e of a.prompts)u(e,"prompts",b,c,d);for(let e of a.themes)u(e,"themes",b,c,d);let e=a.extensions.filter(a=>"top-level"===a.metadata.origin).map(a=>({...t(a,"extension"),kind:"extension",scope:o(a.metadata.scope),enabled:a.enabled}));return d.extensions+=e.filter(a=>a.enabled).length,{countsByPackage:b,resourcesByPackage:c,standaloneExtensions:e,totals:d}}(a))}catch(a){i.push({type:"error",message:a instanceof Error?a.message:String(a)})}return{packages:e.listConfiguredPackages().map(a=>{let b=o(a.scope),c=p(a.source,b),d=w.get(c)??!1,e=j.get(c)??n(),h=m.get(c)??[],k=e.extensions+e.skills+e.prompts+e.themes,q=function(a){if(!a)return{};try{let b=(0,f.statSync)(a).isDirectory()?(0,g.join)(a,"package.json"):(0,g.join)((0,g.dirname)(a),"package.json");if(!(0,f.existsSync)(b))return{};let c=JSON.parse((0,f.readFileSync)(b,"utf8"));return{packageName:"string"==typeof c.name?c.name:void 0,version:"string"==typeof c.version?c.version:void 0}}catch{return{}}}(a.installedPath);return a.installedPath||i.push({type:"warning",source:a.source,message:"Configured package path was not found."}),{source:a.source,scope:b,canCheckForUpdates:(0,l.t)(a.source),filtered:a.filtered,disabled:d,installedPath:a.installedPath,packageName:q.packageName,version:q.version,configuredVersion:function(a){let b=a.startsWith("npm:")?a.slice(4):void 0;if(b){let a=b.lastIndexOf("@"),c=b.startsWith("@")?b.indexOf("/",1):0;return a>c&&b.slice(a+1)||void 0}if(a.startsWith("git:")||/^[a-z]+:\/\//.test(a)){let b=a.lastIndexOf("@"),c=a.lastIndexOf("/"),d=a.lastIndexOf(":");if(b>Math.max(c,d))return a.slice(b+1)||void 0}}(a.source),counts:e,resources:h,status:d?"disabled":k>0?"loaded":a.installedPath?"installed":"missing"}}),standaloneExtensions:s,totals:v,diagnostics:i,projectResourcesLoaded:c.trusted}}async function w(a){let{searchParams:b}=new URL(a.url),c=b.get("cwd");if(!c)return e.NextResponse.json({error:"cwd required"},{status:400});try{let a=await (0,i.mc)();if(!(0,i.B7)(c,a))return e.NextResponse.json({error:"Access denied"},{status:403});return e.NextResponse.json(await v(c))}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}async function x(a){if(!(0,j.EN)(a))return e.NextResponse.json({error:"Untrusted API request"},{status:403});if(!(0,j.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});try{var b;let c=await a.json();if(!c.cwd)return e.NextResponse.json({error:"cwd required"},{status:400});if(!c.action)return e.NextResponse.json({error:"action required"},{status:400});let d=await (0,i.mc)();if(!(0,i.B7)(c.cwd,d))return e.NextResponse.json({error:"Access denied"},{status:403});let f=(0,h.getAgentDir)(),g=(0,k.Y1)(c.cwd,f),j=h.SettingsManager.create(c.cwd,f,{projectTrusted:g.trusted}),l=(b=c.scope,"project"===b?"project":"global");if("project"===l&&!g.trusted)return e.NextResponse.json({error:"Project resources must be trusted before modifying project plugins"},{status:403});let m=new h.DefaultPackageManager({cwd:c.cwd,agentDir:f,settingsManager:j}),n=c.source?.trim(),o="project"===l;if("install"===c.action){if(!n)return e.NextResponse.json({error:"source required"},{status:400});await m.installAndPersist(n,{local:o})}else if("remove"===c.action){if(!n)return e.NextResponse.json({error:"source required"},{status:400});await m.removeAndPersist(n,{local:o})}else if("update"===c.action){if(!n&&!g.trusted&&m.listConfiguredPackages().some(a=>"project"===a.scope))return e.NextResponse.json({error:"Project resources must be trusted before updating project plugins"},{status:403});await m.update(n)}else if("disable"===c.action){if(!n)return e.NextResponse.json({error:"source required"},{status:400});s(j,n,l,!0),await j.flush()}else{if("enable"!==c.action)return e.NextResponse.json({error:`Unsupported action: ${c.action}`},{status:400});if(!n)return e.NextResponse.json({error:"source required"},{status:400});s(j,n,l,!1),await j.flush()}return e.NextResponse.json(await v(c.cwd))}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},65742:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Q:()=>t,t:()=>o});var e=c(79646),f=c(29021),g=c(33873),h=c(28354),i=c(75430),j=c(43618),k=c(72498),l=a([i,k]);[i,k]=l.then?(await l)():l;let u=(0,h.promisify)(e.execFile);function m(a){return"project"===a?"project":"global"}function n(a){if(!a.startsWith("npm:"))return;let b=a.slice(4).trim(),c=b.match(/^(@?[^@]+(?:\/[^@]+)?)(?:@(.+))?$/);return{name:c?.[1]??b,spec:b,version:c?.[2]}}function o(a){let b=n(a);return b?null===(0,j.valid)(b.version??""):!!(a.startsWith("git:")||/^(https?|ssh|git):\/\//i.test(a))&&!function(a){let b=a.startsWith("git:")?a.slice(4).trim():a.trim(),c=b.match(/^git@[^:]+:(.+)$/)?.[1];if(c)return c.includes("@");if(b.includes("://"))try{return new URL(b).pathname.replace(/^\/+/,"").includes("@")}catch{return!1}let d=b.indexOf("/");return d>=0&&b.slice(d+1).includes("@")}(a)}function p(a,b,c){let d=n(a.source);return{source:a.source,scope:m(a.scope),displayName:d?.name??a.source,type:d?"npm":"git",state:b,message:c}}async function q(a,b,c){let{stdout:d}=await u(a,b,{cwd:c.cwd,env:c.env?{...process.env,...c.env}:process.env,encoding:"utf8",timeout:1e4});return d}async function r(a,b,c,d){if(!a.installedPath||!(0,f.existsSync)(a.installedPath))return p(a,"error","Package is not installed.");let e=n(a.source);if(!e)return p(a,"unsupported");let[h="npm",...i]=c??[];if(!h)return p(a,"error","Invalid npmCommand.");let k=function(a){let b=JSON.parse((0,f.readFileSync)((0,g.join)(a,"package.json"),"utf8"));if("string"!=typeof b.version||!(0,j.valid)(b.version))throw Error("Installed package version is unavailable.");return b.version}(a.installedPath),l=await d(h,[...i,"view",e.spec,"version","--json"],{cwd:b}),m=e.version?(0,j.validRange)(e.version)??void 0:void 0,o=function(a,b){let c=JSON.parse(a.trim());if("string"==typeof c&&(0,j.valid)(c))return c;if(Array.isArray(c)){let a=c.filter(a=>"string"==typeof a&&null!==(0,j.valid)(a)),d=b?(0,j.maxSatisfying)(a,b):a.sort(j.rcompare)[0];if(d)return d}throw Error("Unexpected response from npm view.")}(l,m);return p(a,(0,j.gt)(o,k)?"update-available":"up-to-date")}async function s(a,b){if(!a.installedPath||!(0,f.existsSync)(a.installedPath))return p(a,"error","Package is not installed.");let c={cwd:a.installedPath,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}},d=(await b("git",["rev-parse","HEAD"],c)).trim(),e=await b("git",["rev-parse","--abbrev-ref","@{upstream}"],c).then(a=>a.trim()).catch(()=>""),g=e.startsWith("origin/")?`refs/heads/${e.slice(7)}`:"HEAD",h=await b("git",["ls-remote","origin",g],c),i=h.match(/^([0-9a-f]{40,64})\s+/m)?.[1];if(!i)throw Error(`Failed to determine remote ${g}.`);return p(a,d===i?"up-to-date":"update-available")}async function t(a,b,c={}){let d=c.packages,e=c.npmCommand;if(!d){let b=(0,i.getAgentDir)(),c=(0,k.Y1)(a,b),f=i.SettingsManager.create(a,b,{projectTrusted:c.trusted});d=new i.DefaultPackageManager({cwd:a,agentDir:b,settingsManager:f}).listConfiguredPackages(),e??=f.getNpmCommand()}let f=d.filter(a=>!b?.source||a.source===b.source&&m(a.scope)===b.scope),g=c.runCommand??q;return Promise.all(f.map(async b=>{if(!o(b.source))return p(b,"unsupported","Pinned or local packages cannot be checked automatically.");if(/^(1|true|yes)$/i.test(process.env.PI_OFFLINE??""))return p(b,"error","Update checks are disabled while PI_OFFLINE=1.");try{return n(b.source)?await r(b,a,e,g):await s(b,g)}catch(a){return p(b,"error",a instanceof Error?a.message:String(a))}}))}d()}catch(a){d(a)}})},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;let c=e(b.hostname);return b.port?`${c}:${b.port}`:c}catch{return null}}function h(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function i(a){try{return new URL(a).origin}catch{return null}}function j(a,b=h()){return!!function(a,b=h()){let c=a.headers.get("host"),g=c?f(c):null;return!!g&&(!!("localhost"===g||g.endsWith(".localhost")||(0,d.isIP)(g))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===g}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c,d,e=a.headers.get("origin");if("cross-site"===a.headers.get("sec-fetch-site"))return!1;if(!e)return!0;let f=(b=new URL(a.url),(c=a.headers.get("host"))?i(`${b.protocol}//${c}`):null);if(null!==f&&i(e)===f)return!0;if("same-origin"!==a.headers.get("sec-fetch-site")||!a.headers.get("x-forwarded-proto"))return!1;let h=a.headers.get("host");if(!h)return!1;try{d=new URL(e).host}catch{return!1}let j=g(d);return null!==j&&j===g(h)}(a))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},72498:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Fk:()=>i,Y1:()=>g,er:()=>h});var e=c(75430),f=a([e]);function g(a,b){if(!(a&&(0,e.hasTrustRequiringProjectResources)(a)))return{requiresTrust:!1,trusted:!0};let c=new e.ProjectTrustStore(b);return{requiresTrust:!0,trusted:!0===c.get(a)}}function h(a,b){let c=g(a,b);return c.requiresTrust?(new e.ProjectTrustStore(b).set(a,!0),{requiresTrust:!0,trusted:!0}):c}function i(a,b){if(!g(a,b).requiresTrust)return;let c=new e.ProjectTrustStore(b);return{resolveProjectTrust:async()=>!0===c.get(a)}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},77173:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/route",pathname:"/api/plugins",filename:"route",bundlePath:"app/api/plugins/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/plugins/route.ts",nextConfigOutput:"",userland:()=>c(32493),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},80547:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,3618,402],()=>b(b.s=77173));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=9742,a.ids=[9742],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10559:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/route",pathname:"/api/plugins",filename:"route",bundlePath:"app/api/plugins/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/plugins/route.ts",nextConfigOutput:"",userland:()=>c(32493),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},32493:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>w,POST:()=>x,dynamic:()=>y});var e=c(23211),f=c(29021),g=c(33873),h=c(75430),i=c(44250),j=c(80547),k=c(66544),l=c(72498),m=c(65742),n=a([h,i,j,l,m]);[h,i,j,l,m]=n.then?(await n)():n;let y="force-dynamic";function o(){return{extensions:0,skills:0,prompts:0,themes:0}}function p(a){return"project"===a?"project":"global"}function q(a,b){return`${b}\0${a}`}function r(a){return"string"==typeof a?a:a.source}function s(a){return"string"!=typeof a&&Array.isArray(a.extensions)&&0===a.extensions.length&&Array.isArray(a.skills)&&0===a.skills.length&&Array.isArray(a.prompts)&&0===a.prompts.length&&Array.isArray(a.themes)&&0===a.themes.length}function t(a,b,c,d){let e="project"===c?a.getProjectSettings().packages??[]:a.getGlobalSettings().packages??[],f=!1,g=e.map(a=>r(a)!==b?a:(f=!0,d)?{..."string"==typeof a?{source:a}:a,extensions:[],skills:[],prompts:[],themes:[]}:r(a));return!!f&&("project"===c?a.setProjectPackages(g):a.setPackages(g),!0)}let z={extensions:"extension",skills:"skill",prompts:"prompt",themes:"theme"};function u(a){var b,c;let d,e,f=z[a.type],h=a.metadata.baseDir,i=h?(0,g.relative)(h,a.path):"";return{kind:f,name:(b=a.path,c=f,d=(0,g.basename)(b),e=(0,g.extname)(d),"skill"===c&&"skill.md"===d.toLowerCase()?(0,g.basename)((0,g.dirname)(b)):("extension"===c||"theme"===c||"prompt"===c)&&e?"extension"===c&&/^index\.(ts|js)$/.test(d)?(0,g.basename)((0,g.dirname)(b)):d.slice(0,-e.length):d),path:a.path,relativePath:i&&!i.startsWith("..")?i:a.path,enabled:a.enabled,projectOverride:a.override}}async function v(a){let b=(0,h.getAgentDir)(),c=(0,l.Y1)(a,b),d=h.SettingsManager.create(a,b,{projectTrusted:c.trusted}),e=new h.DefaultPackageManager({cwd:a,agentDir:b,settingsManager:d}),j=[],k=new Set,n=new Map,t=new Map,v=[],w=o(),x=function(a){let b=new Map;for(let c of a.getGlobalSettings().packages??[])b.set(q(r(c),"global"),s(c));for(let c of a.getProjectSettings().packages??[])b.set(q(r(c),"project"),s(c));return b}(d);try{let{resources:c}=await (0,i.oZ)(a,b,async a=>(k.has(a)||(k.add(a),j.push({type:"warning",source:a,message:"Package is configured but not installed yet."})),"skip"));for(let a of c){var y,z;if("top-level"===a.owner.origin){if("extensions"!==a.type)continue;v.push({...u(a),kind:"extension",scope:p(a.owner.scope)}),a.enabled&&(w.extensions+=1);continue}let b=q(a.owner.source,p(a.owner.scope)),c=t.get(b)??[];if(c.push(u(a)),t.set(b,c),!a.enabled)continue;let d=n.get(b)??o();y=a.type,d[y]+=1,z=a.type,w[z]+=1,n.set(b,d)}}catch(a){j.push({type:"error",message:a instanceof Error?a.message:String(a)})}let A=new Set((c.trusted?d.getProjectSettings().packages??[]:[]).filter(a=>"object"==typeof a&&!1===a.autoload).map(r));return{packages:e.listConfiguredPackages().filter(a=>!("project"===a.scope&&A.has(a.source))).map(a=>{let b,c=p(a.scope),d=q(a.source,c),e=x.get(d)??!1,h=n.get(d)??o(),i=t.get(d)??[],k=h.extensions+h.skills+h.prompts+h.themes,l=function(a){if(!a)return{};try{let b=(0,f.statSync)(a).isDirectory()?(0,g.join)(a,"package.json"):(0,g.join)((0,g.dirname)(a),"package.json");if(!(0,f.existsSync)(b))return{};let c=JSON.parse((0,f.readFileSync)(b,"utf8"));return{packageName:"string"==typeof c.name?c.name:void 0,version:"string"==typeof c.version?c.version:void 0}}catch{return{}}}(a.installedPath);return a.installedPath||j.push({type:"warning",source:a.source,message:"Configured package path was not found."}),{source:a.source,scope:c,canCheckForUpdates:(0,m.t)(a.source),filtered:a.filtered,disabled:e,installedPath:a.installedPath,packageName:l.packageName,version:l.version,configuredVersion:function(a){let b=a.startsWith("npm:")?a.slice(4):void 0;if(b){let a=b.lastIndexOf("@"),c=b.startsWith("@")?b.indexOf("/",1):0;return a>c&&b.slice(a+1)||void 0}if(a.startsWith("git:")||/^[a-z]+:\/\//.test(a)){let b=a.lastIndexOf("@"),c=a.lastIndexOf("/"),d=a.lastIndexOf(":");if(b>Math.max(c,d))return a.slice(b+1)||void 0}}(a.source),counts:h,resources:i,projectOverride:(b=new Set(i.map(a=>a.projectOverride)),0===b.size?"inherit":1===b.size?[...b][0]:"mixed"),status:e||0===k&&i.length>0?"disabled":k>0?"loaded":a.installedPath?"installed":"missing"}}),standaloneExtensions:v,totals:w,diagnostics:j,projectResourcesLoaded:c.trusted}}async function w(a){let{searchParams:b}=new URL(a.url),c=b.get("cwd");if(!c)return e.NextResponse.json({error:"cwd required"},{status:400});try{let a=await (0,j.mc)();if(!(0,j.B7)(c,a))return e.NextResponse.json({error:"Access denied"},{status:403});return e.NextResponse.json(await v(c))}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}async function x(a){if(!(0,k.EN)(a))return e.NextResponse.json({error:"Untrusted API request"},{status:403});if(!(0,k.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});try{var b;let c=await a.json();if(!c.cwd)return e.NextResponse.json({error:"cwd required"},{status:400});if(!c.action)return e.NextResponse.json({error:"action required"},{status:400});let d=await (0,j.mc)();if(!(0,j.B7)(c.cwd,d))return e.NextResponse.json({error:"Access denied"},{status:403});let f=(0,h.getAgentDir)(),g=(0,l.Y1)(c.cwd,f),i=h.SettingsManager.create(c.cwd,f,{projectTrusted:g.trusted}),k=(b=c.scope,"project"===b?"project":"global");if("project"===k&&!g.trusted)return e.NextResponse.json({error:"Project resources must be trusted before modifying project plugins"},{status:403});let m=new h.DefaultPackageManager({cwd:c.cwd,agentDir:f,settingsManager:i}),n=c.source?.trim(),o="project"===k;if("install"===c.action){if(!n)return e.NextResponse.json({error:"source required"},{status:400});await m.installAndPersist(n,{local:o})}else if("remove"===c.action){if(!n)return e.NextResponse.json({error:"source required"},{status:400});await m.removeAndPersist(n,{local:o})}else if("update"===c.action){if(!n&&!g.trusted&&m.listConfiguredPackages().some(a=>"project"===a.scope))return e.NextResponse.json({error:"Project resources must be trusted before updating project plugins"},{status:403});await m.update(n)}else if("disable"===c.action){if(!n)return e.NextResponse.json({error:"source required"},{status:400});t(i,n,k,!0),await i.flush()}else{if("enable"!==c.action)return e.NextResponse.json({error:`Unsupported action: ${c.action}`},{status:400});if(!n)return e.NextResponse.json({error:"source required"},{status:400});t(i,n,k,!1),await i.flush()}return e.NextResponse.json(await v(c.cwd))}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})},33873:a=>{"use strict";a.exports=require("path")},44250:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Iz:()=>F,Lz:()=>w,Rx:()=>x,oZ:()=>v});var e=c(48161),f=c(76760),g=c(75430),h=c(72498),i=c(24923),j=a([g,h]);[g,h]=j.then?(await j)():j;let x=["extensions","skills","prompts","themes"],y=(a,b)=>`${a}:${(0,i.rX)(b)}`,z=a=>/^[!+-]/.test(a)?a.slice(1):a,A=a=>"string"==typeof a?a:a.source,B=a=>"project"===a.metadata.scope?"project":"user",C=a=>!/^(npm|git|github|http|https|ssh):/.test(a.trim()),D=(a,b)=>(0,f.resolve)(a,b.trim().replace(/^~(?=$|[/\\])/,(0,e.homedir)()));function k(a,b){return"project"===b?(0,f.join)(a.cwd,g.CONFIG_DIR_NAME):a.agentDir}function l(a,b,c,d,e){return b===d||!!C(b)&&!!C(d)&&D(k(a,c),b)===D(k(a,e),d)}function m(a){return[...a.sm.getProjectSettings().packages??[]]}function n(a){return(0,f.relative)(a.metadata.baseDir??(0,f.dirname)(a.path),a.path)}function o(a,b){return"project"!==B(b)?b.path:(0,f.relative)(b.metadata.baseDir??k(a,"project"),b.path)}function p(a,b){let c=new Set([o(a,b),b.path,(0,f.relative)(k(a,"project"),b.path)]);return b.metadata.baseDir&&c.add((0,f.relative)(b.metadata.baseDir,b.path)),c}function q(a,b,c){if(0===a.length&&c)return"unload";let d="inherit";for(let c of a)b.has(z(c))&&(d=c.startsWith("!")||c.startsWith("-")?"unload":"load");return d}function r(a,b){return m(a).find(c=>l(a,b.metadata.source,B(b),A(c),"project"))}let E=a=>/^[+-]/.test(a);function s(a,b){if("top-level"===b.metadata.origin)return(a.sm.getProjectSettings()[b.type]??[]).every(a=>E(a)||!a.startsWith("!")&&!/[*?[{]/.test(a));let c=r(a,b);return void 0===c||"object"==typeof c&&!1===c.autoload&&x.every(a=>(c[a]??[]).every(E))}function t(a){return x.flatMap(b=>a[b].map(a=>({type:b,...a})))}async function u(a,b,c){let d=(0,h.Y1)(a,b),e=g.SettingsManager.create(a,b,{projectTrusted:!1}),f=await new g.DefaultPackageManager({cwd:a,agentDir:b,settingsManager:e}).resolve(c),i=g.SettingsManager.create(a,b,{projectTrusted:d.trusted}),j=d.trusted?await new g.DefaultPackageManager({cwd:a,agentDir:b,settingsManager:i}).resolve(c):f,k=new Map(t(f).map(a=>[y(a.type,a.path),a]));return{ctx:{sm:i,cwd:a,agentDir:b,inherited:k},trust:d,items:t(j)}}async function v(a,b,c=async()=>"skip"){let{ctx:d,trust:e,items:f}=await u(a,b,c);return{resources:f.map(a=>{let b=d.inherited.get(y(a.type,a.path));return{type:a.type,path:a.path,enabled:a.enabled,metadata:a.metadata,owner:b?.metadata??a.metadata,globalEnabled:b?b.enabled:null,override:e.trusted?function(a,b){if("top-level"===b.metadata.origin)return q(a.sm.getProjectSettings()[b.type]??[],p(a,b),!1);let c=r(a,b);if("object"!=typeof c)return"inherit";let d=c[b.type];return void 0===d?"inherit":q(d,new Set([n(b)]),!1!==c.autoload)}(d,a):"inherit",editable:!e.trusted||s(d,a)}}),trusted:e.trusted}}class F extends Error{}async function w(a,b,c,d){let{ctx:e,trust:i,items:j}=await u(a,b,async()=>"skip");if(!i.trusted)throw new F("Project resources must be trusted before changing project overrides");let q=e.sm.drainErrors()[0];if(q)throw Error(`Cannot read ${q.path??`${q.scope} settings`}: ${q.error.message}`);let r=new Set(c.map(a=>y(a.type,a.path)));for(let a of j){let b=y(a.type,a.path);if(!r.has(b))continue;if(!s(e,a))throw Error(`Project settings entry for ${a.path} is hand-written; edit ${g.CONFIG_DIR_NAME}/settings.json directly`);let c=e.inherited.get(b)?.enabled??("user"!==B(a)||a.enabled),h=d===c?"inherit":d?"load":"unload";"top-level"===a.metadata.origin?function(a,b,c){let d=a.sm.getProjectSettings()[b.type]??[],e="user"===B(b)||a.inherited.has(y(b.type,b.path)),f=e?b.path:o(a,b),g=p(a,b),h=d.filter(a=>!(/^[!+-]/.test(a)&&g.has(z(a)))&&!("inherit"===c&&e&&z(a)===f));"inherit"!==c&&(e&&!h.includes(f)&&h.push(f),h.push(`${"load"===c?"+":"-"}${f}`)),"extensions"===b.type?a.sm.setProjectExtensionPaths(h):"skills"===b.type?a.sm.setProjectSkillPaths(h):"prompts"===b.type?a.sm.setProjectPromptTemplatePaths(h):a.sm.setProjectThemePaths(h)}(e,a,h):function(a,b,c){let d=m(a),e=d.findIndex(c=>l(a,b.metadata.source,B(b),A(c),"project"));if(-1===e){if("inherit"===c)return;let g=b.metadata.source;d.push({source:C(g)?(0,f.relative)(k(a,"project"),D(k(a,B(b)),g))||".":g,autoload:!1}),e=d.length-1}let g={...d[e]};d[e]=g;let h=n(b),i=(g[b.type]??[]).filter(a=>z(a)!==h);"inherit"!==c&&i.push(`${"load"===c?"+":"-"}${h}`),g[b.type]=i.length>0?i:void 0,x.some(a=>void 0!==g[a])||d.splice(e,1),a.sm.setProjectPackages(d)}(e,a,h)}await e.sm.flush();let t=e.sm.drainErrors()[0];if(t)throw Error(`Cannot write ${t.path??"project settings"}: ${t.error.message}`);!i.requiresTrust&&(0,g.hasTrustRequiringProjectResources)(a)&&(0,h.er)(a,b)}d()}catch(a){d(a)}})},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},65742:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Q:()=>t,t:()=>o});var e=c(79646),f=c(29021),g=c(33873),h=c(28354),i=c(75430),j=c(43618),k=c(72498),l=a([i,k]);[i,k]=l.then?(await l)():l;let u=(0,h.promisify)(e.execFile);function m(a){return"project"===a?"project":"global"}function n(a){if(!a.startsWith("npm:"))return;let b=a.slice(4).trim(),c=b.match(/^(@?[^@]+(?:\/[^@]+)?)(?:@(.+))?$/);return{name:c?.[1]??b,spec:b,version:c?.[2]}}function o(a){let b=n(a);return b?null===(0,j.valid)(b.version??""):!!(a.startsWith("git:")||/^(https?|ssh|git):\/\//i.test(a))&&!function(a){let b=a.startsWith("git:")?a.slice(4).trim():a.trim(),c=b.match(/^git@[^:]+:(.+)$/)?.[1];if(c)return c.includes("@");if(b.includes("://"))try{return new URL(b).pathname.replace(/^\/+/,"").includes("@")}catch{return!1}let d=b.indexOf("/");return d>=0&&b.slice(d+1).includes("@")}(a)}function p(a,b,c){let d=n(a.source);return{source:a.source,scope:m(a.scope),displayName:d?.name??a.source,type:d?"npm":"git",state:b,message:c}}async function q(a,b,c){let{stdout:d}=await u(a,b,{cwd:c.cwd,env:c.env?{...process.env,...c.env}:process.env,encoding:"utf8",timeout:1e4});return d}async function r(a,b,c,d){if(!a.installedPath||!(0,f.existsSync)(a.installedPath))return p(a,"error","Package is not installed.");let e=n(a.source);if(!e)return p(a,"unsupported");let[h="npm",...i]=c??[];if(!h)return p(a,"error","Invalid npmCommand.");let k=function(a){let b=JSON.parse((0,f.readFileSync)((0,g.join)(a,"package.json"),"utf8"));if("string"!=typeof b.version||!(0,j.valid)(b.version))throw Error("Installed package version is unavailable.");return b.version}(a.installedPath),l=await d(h,[...i,"view",e.spec,"version","--json"],{cwd:b}),m=e.version?(0,j.validRange)(e.version)??void 0:void 0,o=function(a,b){let c=JSON.parse(a.trim());if("string"==typeof c&&(0,j.valid)(c))return c;if(Array.isArray(c)){let a=c.filter(a=>"string"==typeof a&&null!==(0,j.valid)(a)),d=b?(0,j.maxSatisfying)(a,b):a.sort(j.rcompare)[0];if(d)return d}throw Error("Unexpected response from npm view.")}(l,m);return p(a,(0,j.gt)(o,k)?"update-available":"up-to-date")}async function s(a,b){if(!a.installedPath||!(0,f.existsSync)(a.installedPath))return p(a,"error","Package is not installed.");let c={cwd:a.installedPath,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}},d=(await b("git",["rev-parse","HEAD"],c)).trim(),e=await b("git",["rev-parse","--abbrev-ref","@{upstream}"],c).then(a=>a.trim()).catch(()=>""),g=e.startsWith("origin/")?`refs/heads/${e.slice(7)}`:"HEAD",h=await b("git",["ls-remote","origin",g],c),i=h.match(/^([0-9a-f]{40,64})\s+/m)?.[1];if(!i)throw Error(`Failed to determine remote ${g}.`);return p(a,d===i?"up-to-date":"update-available")}async function t(a,b,c={}){let d=c.packages,e=c.npmCommand;if(!d){let b=(0,i.getAgentDir)(),c=(0,k.Y1)(a,b),f=i.SettingsManager.create(a,b,{projectTrusted:c.trusted});d=new i.DefaultPackageManager({cwd:a,agentDir:b,settingsManager:f}).listConfiguredPackages(),e??=f.getNpmCommand()}let f=d.filter(a=>!b?.source||a.source===b.source&&m(a.scope)===b.scope),g=c.runCommand??q;return Promise.all(f.map(async b=>{if(!o(b.source))return p(b,"unsupported","Pinned or local packages cannot be checked automatically.");if(/^(1|true|yes)$/i.test(process.env.PI_OFFLINE??""))return p(b,"error","Update checks are disabled while PI_OFFLINE=1.");try{return n(b.source)?await r(b,a,e,g):await s(b,g)}catch(a){return p(b,"error",a instanceof Error?a.message:String(a))}}))}d()}catch(a){d(a)}})},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;let c=e(b.hostname);return b.port?`${c}:${b.port}`:c}catch{return null}}function h(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function i(a){try{return new URL(a).origin}catch{return null}}function j(a,b=h()){return!!function(a,b=h()){let c=a.headers.get("host"),g=c?f(c):null;return!!g&&(!!("localhost"===g||g.endsWith(".localhost")||(0,d.isIP)(g))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===g}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c,d,e=a.headers.get("origin");if("cross-site"===a.headers.get("sec-fetch-site"))return!1;if(!e)return!0;let f=(b=new URL(a.url),(c=a.headers.get("host"))?i(`${b.protocol}//${c}`):null);if(null!==f&&i(e)===f)return!0;if("same-origin"!==a.headers.get("sec-fetch-site")||!a.headers.get("x-forwarded-proto"))return!1;let h=a.headers.get("host");if(!h)return!1;try{d=new URL(e).host}catch{return!1}let j=g(d);return null!==j&&j===g(h)}(a))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},72498:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Fk:()=>i,Y1:()=>g,er:()=>h});var e=c(75430),f=a([e]);function g(a,b){if(!(a&&(0,e.hasTrustRequiringProjectResources)(a)))return{requiresTrust:!1,trusted:!0};let c=new e.ProjectTrustStore(b);return{requiresTrust:!0,trusted:!0===c.get(a)}}function h(a,b){let c=g(a,b);return c.requiresTrust?(new e.ProjectTrustStore(b).set(a,!0),{requiresTrust:!0,trusted:!0}):c}function i(a,b){if(!g(a,b).requiresTrust)return;let c=new e.ProjectTrustStore(b);return{resolveProjectTrust:async()=>!0===c.get(a)}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},80547:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,3618,402],()=>b(b.s=10559));module.exports=c})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var a={};a.id=3237,a.ids=[3237],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44250:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Iz:()=>F,Lz:()=>w,Rx:()=>x,oZ:()=>v});var e=c(48161),f=c(76760),g=c(75430),h=c(72498),i=c(24923),j=a([g,h]);[g,h]=j.then?(await j)():j;let x=["extensions","skills","prompts","themes"],y=(a,b)=>`${a}:${(0,i.rX)(b)}`,z=a=>/^[!+-]/.test(a)?a.slice(1):a,A=a=>"string"==typeof a?a:a.source,B=a=>"project"===a.metadata.scope?"project":"user",C=a=>!/^(npm|git|github|http|https|ssh):/.test(a.trim()),D=(a,b)=>(0,f.resolve)(a,b.trim().replace(/^~(?=$|[/\\])/,(0,e.homedir)()));function k(a,b){return"project"===b?(0,f.join)(a.cwd,g.CONFIG_DIR_NAME):a.agentDir}function l(a,b,c,d,e){return b===d||!!C(b)&&!!C(d)&&D(k(a,c),b)===D(k(a,e),d)}function m(a){return[...a.sm.getProjectSettings().packages??[]]}function n(a){return(0,f.relative)(a.metadata.baseDir??(0,f.dirname)(a.path),a.path)}function o(a,b){return"project"!==B(b)?b.path:(0,f.relative)(b.metadata.baseDir??k(a,"project"),b.path)}function p(a,b){let c=new Set([o(a,b),b.path,(0,f.relative)(k(a,"project"),b.path)]);return b.metadata.baseDir&&c.add((0,f.relative)(b.metadata.baseDir,b.path)),c}function q(a,b,c){if(0===a.length&&c)return"unload";let d="inherit";for(let c of a)b.has(z(c))&&(d=c.startsWith("!")||c.startsWith("-")?"unload":"load");return d}function r(a,b){return m(a).find(c=>l(a,b.metadata.source,B(b),A(c),"project"))}let E=a=>/^[+-]/.test(a);function s(a,b){if("top-level"===b.metadata.origin)return(a.sm.getProjectSettings()[b.type]??[]).every(a=>E(a)||!a.startsWith("!")&&!/[*?[{]/.test(a));let c=r(a,b);return void 0===c||"object"==typeof c&&!1===c.autoload&&x.every(a=>(c[a]??[]).every(E))}function t(a){return x.flatMap(b=>a[b].map(a=>({type:b,...a})))}async function u(a,b,c){let d=(0,h.Y1)(a,b),e=g.SettingsManager.create(a,b,{projectTrusted:!1}),f=await new g.DefaultPackageManager({cwd:a,agentDir:b,settingsManager:e}).resolve(c),i=g.SettingsManager.create(a,b,{projectTrusted:d.trusted}),j=d.trusted?await new g.DefaultPackageManager({cwd:a,agentDir:b,settingsManager:i}).resolve(c):f,k=new Map(t(f).map(a=>[y(a.type,a.path),a]));return{ctx:{sm:i,cwd:a,agentDir:b,inherited:k},trust:d,items:t(j)}}async function v(a,b,c=async()=>"skip"){let{ctx:d,trust:e,items:f}=await u(a,b,c);return{resources:f.map(a=>{let b=d.inherited.get(y(a.type,a.path));return{type:a.type,path:a.path,enabled:a.enabled,metadata:a.metadata,owner:b?.metadata??a.metadata,globalEnabled:b?b.enabled:null,override:e.trusted?function(a,b){if("top-level"===b.metadata.origin)return q(a.sm.getProjectSettings()[b.type]??[],p(a,b),!1);let c=r(a,b);if("object"!=typeof c)return"inherit";let d=c[b.type];return void 0===d?"inherit":q(d,new Set([n(b)]),!1!==c.autoload)}(d,a):"inherit",editable:!e.trusted||s(d,a)}}),trusted:e.trusted}}class F extends Error{}async function w(a,b,c,d){let{ctx:e,trust:i,items:j}=await u(a,b,async()=>"skip");if(!i.trusted)throw new F("Project resources must be trusted before changing project overrides");let q=e.sm.drainErrors()[0];if(q)throw Error(`Cannot read ${q.path??`${q.scope} settings`}: ${q.error.message}`);let r=new Set(c.map(a=>y(a.type,a.path)));for(let a of j){let b=y(a.type,a.path);if(!r.has(b))continue;if(!s(e,a))throw Error(`Project settings entry for ${a.path} is hand-written; edit ${g.CONFIG_DIR_NAME}/settings.json directly`);let c=e.inherited.get(b)?.enabled??("user"!==B(a)||a.enabled),h=d===c?"inherit":d?"load":"unload";"top-level"===a.metadata.origin?function(a,b,c){let d=a.sm.getProjectSettings()[b.type]??[],e="user"===B(b)||a.inherited.has(y(b.type,b.path)),f=e?b.path:o(a,b),g=p(a,b),h=d.filter(a=>!(/^[!+-]/.test(a)&&g.has(z(a)))&&!("inherit"===c&&e&&z(a)===f));"inherit"!==c&&(e&&!h.includes(f)&&h.push(f),h.push(`${"load"===c?"+":"-"}${f}`)),"extensions"===b.type?a.sm.setProjectExtensionPaths(h):"skills"===b.type?a.sm.setProjectSkillPaths(h):"prompts"===b.type?a.sm.setProjectPromptTemplatePaths(h):a.sm.setProjectThemePaths(h)}(e,a,h):function(a,b,c){let d=m(a),e=d.findIndex(c=>l(a,b.metadata.source,B(b),A(c),"project"));if(-1===e){if("inherit"===c)return;let g=b.metadata.source;d.push({source:C(g)?(0,f.relative)(k(a,"project"),D(k(a,B(b)),g))||".":g,autoload:!1}),e=d.length-1}let g={...d[e]};d[e]=g;let h=n(b),i=(g[b.type]??[]).filter(a=>z(a)!==h);"inherit"!==c&&i.push(`${"load"===c?"+":"-"}${h}`),g[b.type]=i.length>0?i:void 0,x.some(a=>void 0!==g[a])||d.splice(e,1),a.sm.setProjectPackages(d)}(e,a,h)}await e.sm.flush();let t=e.sm.drainErrors()[0];if(t)throw Error(`Cannot write ${t.path??"project settings"}: ${t.error.message}`);!i.requiresTrust&&(0,g.hasTrustRequiringProjectResources)(a)&&(0,h.er)(a,b)}d()}catch(a){d(a)}})},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},60104:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>n,POST:()=>o,dynamic:()=>p});var e=c(23211),f=c(33873),g=c(75430),h=c(92632),i=c(80547),j=c(66544),k=c(44250),l=a([g,h,i,k]);[g,h,i,k]=l.then?(await l)():l;let p="force-dynamic";async function m(a){return(0,i.B7)(a,await (0,i.mc)())}async function n(a){let b=new URL(a.url).searchParams.get("cwd");if(!b)return e.NextResponse.json({error:"cwd required"},{status:400});try{if(!await m(b))return e.NextResponse.json({error:"Access denied"},{status:403});let[{resources:a,trusted:c},d]=await Promise.all([(0,k.oZ)(b,(0,g.getAgentDir)()),(0,h.U)(b)]),i=new Map;for(let b of a){let{origin:a,scope:c,source:d}=b.owner,e="project"===c?"project":"global",g="package"===a?`package\0${e}\0${d}`:`top-level\0${e}`,h=i.get(g);!h&&(h={key:g,origin:a,scope:e,source:d,label:"package"===a?d.startsWith("npm:")?d.slice(4).replace(/@[^@/]+$/,""):(0,f.basename)(d.replace(/@[^@/]+$/,"").replace(/\.git$/,""))||d:"",items:[]},i.set(g,h));h.items.push({type:b.type,path:b.path,name:function(a){let b=(0,f.basename)(a);if("SKILL.md"===b||/^index\.(ts|js)$/.test(b))return(0,f.basename)((0,f.dirname)(a));let c=(0,f.extname)(b);return c?b.slice(0,-c.length):b}(b.path),enabled:b.enabled,globalEnabled:b.globalEnabled,overridden:"inherit"!==b.override,editable:b.editable})}return e.NextResponse.json({projectResourcesLoaded:c,groups:[...i.values()],sync:{kind:d.kind,otherWorktrees:d.dirs.length-1}})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}async function o(a){if(!(0,j.EN)(a))return e.NextResponse.json({error:"Untrusted API request"},{status:403});if(!(0,j.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});try{let b=await a.json();if(!b.cwd)return e.NextResponse.json({error:"cwd required"},{status:400});if("boolean"!=typeof b.enabled)return e.NextResponse.json({error:"enabled required"},{status:400});let c=(b.targets??[]).filter(a=>k.Rx.includes(a?.type)&&"string"==typeof a.path);if(0===c.length)return e.NextResponse.json({error:"targets required"},{status:400});if(!await m(b.cwd))return e.NextResponse.json({error:"Access denied"},{status:403});let d=(0,g.getAgentDir)(),{dirs:f}=await (0,h.U)(b.cwd);await (0,k.Lz)(b.cwd,d,c,b.enabled);let i=[];for(let a of f.slice(1))try{await (0,k.Lz)(a,d,c,b.enabled)}catch(b){i.push({path:a,error:b instanceof Error?b.message:String(b)})}return e.NextResponse.json({ok:!0,failures:i})}catch(a){if(a instanceof k.Iz)return e.NextResponse.json({error:a.message},{status:403});return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;let c=e(b.hostname);return b.port?`${c}:${b.port}`:c}catch{return null}}function h(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function i(a){try{return new URL(a).origin}catch{return null}}function j(a,b=h()){return!!function(a,b=h()){let c=a.headers.get("host"),g=c?f(c):null;return!!g&&(!!("localhost"===g||g.endsWith(".localhost")||(0,d.isIP)(g))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===g}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c,d,e=a.headers.get("origin");if("cross-site"===a.headers.get("sec-fetch-site"))return!1;if(!e)return!0;let f=(b=new URL(a.url),(c=a.headers.get("host"))?i(`${b.protocol}//${c}`):null);if(null!==f&&i(e)===f)return!0;if("same-origin"!==a.headers.get("sec-fetch-site")||!a.headers.get("x-forwarded-proto"))return!1;let h=a.headers.get("host");if(!h)return!1;try{d=new URL(e).host}catch{return!1}let j=g(d);return null!==j&&j===g(h)}(a))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},72498:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Fk:()=>i,Y1:()=>g,er:()=>h});var e=c(75430),f=a([e]);function g(a,b){if(!(a&&(0,e.hasTrustRequiringProjectResources)(a)))return{requiresTrust:!1,trusted:!0};let c=new e.ProjectTrustStore(b);return{requiresTrust:!0,trusted:!0===c.get(a)}}function h(a,b){let c=g(a,b);return c.requiresTrust?(new e.ProjectTrustStore(b).set(a,!0),{requiresTrust:!0,trusted:!0}):c}function i(a,b){if(!g(a,b).requiresTrust)return;let c=new e.ProjectTrustStore(b);return{resolveProjectTrust:async()=>!0===c.get(a)}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},80547:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},86397:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/project-overrides/route",pathname:"/api/project-overrides",filename:"route",bundlePath:"app/api/project-overrides/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/project-overrides/route.ts",nextConfigOutput:"",userland:()=>c(60104),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/project-overrides/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},92632:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{E:()=>l,U:()=>k});var e=c(33873),f=c(58864),g=c(44250),h=c(24923),i=a([g]);g=(i.then?(await i)():i)[0];let m=(0,e.join)(".pi","settings.json");async function j(a){try{return await (0,h.$Y)(a,["ls-files","--error-unmatch","--",m]),!0}catch{return!1}}async function k(a){let b;try{b=(0,f.gB)(await (0,h.$Y)(a,["rev-parse","--show-toplevel"]))}catch{return{kind:"none",dirs:[a]}}if(!(0,f.Eb)(b,(0,h.rX)(a)))return{kind:"subdirectory",dirs:[a]};if(await j(a))return{kind:"tracked",dirs:[a]};let c=(await (0,h.P9)(a)).map(a=>a.path).filter(a=>!(0,f.Eb)(a,b));return{kind:"worktrees",dirs:[a,...c]}}async function l(a,b,c){if(await j(a))return;let{resources:d}=await (0,g.oZ)(a,c),e=d.filter(a=>"inherit"!==a.override);for(let a of[!0,!1]){let d=e.filter(b=>b.enabled===a);d.length>0&&await (0,g.Lz)(b,c,d,a)}}d()}catch(a){d(a)}})},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,402],()=>b(b.s=86397));module.exports=c})();
|