@qt4798/pi-web 0.18.17 → 0.18.20
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 +28 -27
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +6 -6
- package/.next/required-server-files.js +1 -1
- package/.next/required-server-files.json +1 -1
- package/.next/routes-manifest.json +6 -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.js.nft.json +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 +18 -17
- package/.next/server/app/_not-found.segments/_full.segment.rsc +18 -17
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +8 -7
- 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 +2 -2
- 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/events/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/combined/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/backup/export/route.js +1 -1
- package/.next/server/app/api/backup/import/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/events/route.js +2 -2
- package/.next/server/app/api/features/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 +1 -1
- package/.next/server/app/api/git/push/route.js +2 -2
- package/.next/server/app/api/git/stash/route.js +1 -1
- package/.next/server/app/api/git/status/route.js +2 -2
- package/.next/server/app/api/home/route.js +1 -1
- package/.next/server/app/api/import/discover/route.js +1 -1
- package/.next/server/app/api/import/execute/route.js +1 -1
- package/.next/server/app/api/import/status/route.js +1 -1
- package/.next/server/app/api/logs/route.js +1 -1
- package/.next/server/app/api/mcp/restart/route.js +1 -1
- package/.next/server/app/api/mcp/route.js +2 -2
- package/.next/server/app/api/models/enabled/route.js +1 -1
- package/.next/server/app/api/models/refresh/route.js +1 -1
- package/.next/server/app/api/models/route.js +1 -1
- package/.next/server/app/api/models-config/builtin/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/import/route.js +1 -1
- package/.next/server/app/api/models-config/route.js +1 -1
- package/.next/server/app/api/models-config/test/route.js +1 -1
- package/.next/server/app/api/modes/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-aliases/route.js +1 -1
- package/.next/server/app/api/project-trust/route.js +1 -1
- package/.next/server/app/api/projects/visibility/route.js +1 -1
- package/.next/server/app/api/provider-usage/query/route.js +1 -1
- package/.next/server/app/api/proxy/route.js +1 -1
- package/.next/server/app/api/proxy/test/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]/details/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 +1 -1
- package/.next/server/app/api/sessions/[id]/queue-recovery/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/route.js +1 -1
- package/.next/server/app/api/sessions/search/route.js +1 -1
- package/.next/server/app/api/settings/appearance/route.js +1 -1
- package/.next/server/app/api/settings/default-model/route.js +1 -0
- package/.next/server/app/api/settings/default-model/route.js.nft.json +1 -0
- package/.next/server/app/api/settings/default-model/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/settings/title-model/route.js +1 -1
- package/.next/server/app/api/skills/check/route.js +1 -1
- package/.next/server/app/api/skills/install/route.js +1 -1
- package/.next/server/app/api/skills/route.js +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/snippets/[id]/route.js +1 -1
- package/.next/server/app/api/snippets/route.js +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/tasks/[id]/[action]/route.js +1 -1
- package/.next/server/app/api/tasks/[id]/changed-files/route.js +2 -2
- package/.next/server/app/api/tasks/[id]/diff/route.js +2 -2
- package/.next/server/app/api/tasks/[id]/events/route.js +1 -1
- package/.next/server/app/api/tasks/[id]/route.js +1 -1
- package/.next/server/app/api/tasks/batch/route.js +1 -1
- package/.next/server/app/api/tasks/events/route.js +1 -1
- package/.next/server/app/api/tasks/route.js +1 -1
- package/.next/server/app/api/tasks/settings/route.js +1 -1
- package/.next/server/app/api/tasks/templates/route.js +1 -1
- package/.next/server/app/api/terminal/[id]/events/route.js +2 -2
- 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/themes/[name]/route.js +1 -1
- package/.next/server/app/api/themes/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/themes/route.js +1 -1
- package/.next/server/app/api/themes/route.js.nft.json +1 -1
- package/.next/server/app/api/tools/extension-tools/route.js +2 -2
- 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/vision-config/route.js +2 -2
- 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/icon.ico/route.js +1 -1
- package/.next/server/app/icon.png/route.js +1 -1
- package/.next/server/app/icon.svg/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +18 -17
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +12 -11
- package/.next/server/app/index.segments/_full.segment.rsc +18 -17
- package/.next/server/app/index.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/login/page.js +1 -1
- package/.next/server/app/login/page.js.nft.json +1 -1
- 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 +22 -21
- package/.next/server/app/login.segments/_full.segment.rsc +22 -21
- package/.next/server/app/login.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +9 -8
- package/.next/server/app/page.js +16 -8
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +28 -27
- package/.next/server/chunks/3379.js +1 -1
- package/.next/server/chunks/406.js +1 -0
- package/.next/server/chunks/5437.js +1 -1
- package/.next/server/chunks/574.js +1 -0
- package/.next/server/chunks/7774.js +9 -9
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware.js +2 -2
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/T89_IZy4CFsNs9juWQAB8/_buildManifest.js +1 -0
- package/.next/static/chunks/5170-642bc0cfa4eeb3ab.js +1 -0
- package/.next/static/chunks/{2787-8d358343705fcc68.js → 5713-2dbdd3004c5f9a77.js} +9 -1
- package/.next/static/chunks/6908-11441b31185ab998.js +1 -0
- package/.next/static/chunks/914-8d3afa4f09f892ef.js +1 -0
- package/.next/static/chunks/app/{api/agent/[id]/bash-output/route-8b1369cbf4e0a858.js → _global-error/page-a1928c6c9b36dae8.js} +1 -1
- package/.next/static/chunks/app/api/agent/[id]/{events/route-8b1369cbf4e0a858.js → bash-output/route-a1928c6c9b36dae8.js} +1 -1
- package/.next/static/chunks/app/api/agent/[id]/{lease/route-8b1369cbf4e0a858.js → events/route-a1928c6c9b36dae8.js} +1 -1
- package/.next/static/chunks/app/{_global-error/page-8b1369cbf4e0a858.js → api/agent/[id]/lease/route-a1928c6c9b36dae8.js} +1 -1
- package/.next/static/chunks/app/api/agent/[id]/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/agent/new/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/agent/running/events/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/agent/running/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/app-update/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/auth/combined/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/auth/login/[provider]/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/auth/providers/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/backup/export/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/backup/import/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/cwd/browse/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/cwd/validate/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/default-cwd/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/events/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/features/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/file-index/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/files/[...path]/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/git/diff/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/git/push/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/git/stash/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/git/status/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/home/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/import/discover/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/import/execute/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/import/status/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/logs/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/mcp/restart/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/mcp/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/models/enabled/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/models/refresh/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/models/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/models-config/builtin/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/models-config/catalog/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/models-config/discover/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/models-config/import/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/models-config/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/models-config/test/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/modes/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/plugins/check/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/plugins/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/project-aliases/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/project-trust/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/projects/visibility/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/provider-usage/query/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/proxy/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/proxy/test/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/context/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/details/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/export/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/queue-recovery/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/state/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/sessions/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/sessions/search/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/settings/appearance/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/settings/default-model/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/settings/title-model/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/skills/check/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/skills/install/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/skills/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/skills/search/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/skills/update/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/snippets/[id]/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/snippets/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/subagents/[id]/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/subagents/profiles/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/subagents/settings/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/tasks/[id]/[action]/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/tasks/[id]/changed-files/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/tasks/[id]/diff/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/tasks/[id]/events/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/tasks/[id]/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/tasks/batch/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/tasks/events/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/tasks/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/tasks/settings/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/tasks/templates/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/terminal/[id]/events/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/terminal/[id]/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/terminal/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/themes/[name]/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/themes/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/tools/extension-tools/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/tools/settings/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/usage/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/vision-config/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/web-auth/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/api/worktrees/route-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/app/layout-afb53143cd8a858f.js +1 -0
- package/.next/static/chunks/app/page-0719669235375381.js +237 -0
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-a1928c6c9b36dae8.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-a1928c6c9b36dae8.js +1 -0
- package/.next/static/css/34f1ad830f772bb3.css +1 -0
- package/.next/static/css/35d4358355f4c1f8.css +1 -0
- package/.next/trace +191 -10
- package/.next/trace-build +1 -1
- package/.next/types/app/api/settings/default-model/route.ts +353 -0
- package/.next/types/routes.d.ts +2 -1
- package/.next/types/validator.ts +9 -0
- package/lib/theme/openchamber/claude.json +41 -0
- package/package.json +2 -1
- package/.next/server/chunks/8526.js +0 -1
- package/.next/static/chunks/5170-3e328b87bd2a2070.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/agent/new/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/agent/running/events/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/agent/running/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/app-update/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/auth/combined/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/auth/login/[provider]/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/auth/providers/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/backup/export/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/backup/import/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/cwd/browse/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/cwd/validate/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/default-cwd/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/events/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/features/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/file-index/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/files/[...path]/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/git/diff/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/git/push/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/git/stash/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/git/status/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/home/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/import/discover/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/import/execute/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/import/status/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/logs/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/mcp/restart/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/mcp/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/models/enabled/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/models/refresh/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/models/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/models-config/builtin/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/models-config/catalog/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/models-config/discover/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/models-config/import/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/models-config/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/models-config/test/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/modes/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/plugins/check/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/plugins/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/project-aliases/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/project-trust/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/projects/visibility/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/provider-usage/query/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/proxy/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/proxy/test/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/context/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/details/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/export/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/queue-recovery/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/state/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/sessions/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/sessions/search/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/settings/appearance/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/settings/title-model/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/skills/check/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/skills/install/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/skills/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/skills/search/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/skills/update/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/snippets/[id]/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/snippets/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/subagents/[id]/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/subagents/profiles/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/subagents/settings/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/tasks/[id]/[action]/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/tasks/[id]/changed-files/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/tasks/[id]/diff/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/tasks/[id]/events/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/tasks/[id]/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/tasks/batch/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/tasks/events/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/tasks/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/tasks/settings/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/tasks/templates/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/terminal/[id]/events/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/terminal/[id]/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/terminal/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/themes/[name]/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/themes/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/tools/extension-tools/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/tools/settings/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/usage/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/vision-config/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/web-auth/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/api/worktrees/route-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/app/layout-5719770bb4c2db1c.js +0 -1
- package/.next/static/chunks/app/page-6b5795ae7025b0c8.js +0 -237
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-8b1369cbf4e0a858.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-8b1369cbf4e0a858.js +0 -1
- package/.next/static/css/5a620688241e1a56.css +0 -1
- package/.next/static/css/e149bb7a6998690b.css +0 -1
- package/.next/static/mslUe4ixem7kBr-584kNK/_buildManifest.js +0 -1
- /package/.next/static/{mslUe4ixem7kBr-584kNK → T89_IZy4CFsNs9juWQAB8}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var a={};a.id=1960,a.ids=[1960],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},24979:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>o,POST:()=>p,dynamic:()=>q});var e=c(79748),f=c(33873),g=c(23211),h=c(75430),i=c(80547),j=c(28967),k=c(72498),l=c(56429),m=a([h,i,k,l]);[h,i,k,l]=m.then?(await m)():m;let q="force-dynamic";async function n(a){if("string"!=typeof a||!a.trim())return{response:g.NextResponse.json({error:"cwd required"},{status:400})};let b=(0,f.resolve)(a);try{if(!(await (0,e.stat)(b)).isDirectory())return{response:g.NextResponse.json({error:"cwd must be a directory"},{status:400})}}catch{return{response:g.NextResponse.json({error:"Directory does not exist"},{status:400})}}let c=await (0,i.mc)();return(0,i.A$)(b,c)?{cwd:b}:{response:g.NextResponse.json({error:"Access denied"},{status:403})}}async function o(a){let b=await n(new URL(a.url).searchParams.get("cwd"));return"response"in b?b.response:g.NextResponse.json((0,k.Y1)(b.cwd,(0,h.getAgentDir)()))}async function p(a){try{let b=await a.json(),c=await n(b.cwd);if("response"in c)return c.response;let d=(0,h.getAgentDir)();if(!(0,k.Y1)(c.cwd,d).requiresTrust)return g.NextResponse.json({error:"This project has no resources that require trust"},{status:409});if((0,l._I)(c.cwd))return g.NextResponse.json({error:"Wait for the active session to finish before trusting this project"},{status:409});let e=(0,k.er)(c.cwd,d);return(0,j.k)(),await (0,l.oA)(c.cwd),g.NextResponse.json(e)}catch(a){return g.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},31421:a=>{a.exports=require("node:child_process")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80481:a=>{a.exports=require("node:readline")},80547:(a,b,c)=>{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.o4)(a,b)}function p(a,b){return(0,j.xk)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},81115:a=>{a.exports=require("constants")},83758:(a,b,c)=>{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-trust/route",pathname:"/api/project-trust",filename:"route",bundlePath:"app/api/project-trust/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/project-trust/route.ts",nextConfigOutput:"standalone",userland:()=>c(24979),...{}}),{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-trust/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=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{a.exports=require("events")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,974,426,5138,5582,8904,6429],()=>b(b.s=83758));module.exports=c})();
|
|
1
|
+
"use strict";(()=>{var a={};a.id=1960,a.ids=[1960],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},24979:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>o,POST:()=>p,dynamic:()=>q});var e=c(79748),f=c(33873),g=c(23211),h=c(75430),i=c(80547),j=c(28967),k=c(72498),l=c(56429),m=a([h,i,k,l]);[h,i,k,l]=m.then?(await m)():m;let q="force-dynamic";async function n(a){if("string"!=typeof a||!a.trim())return{response:g.NextResponse.json({error:"cwd required"},{status:400})};let b=(0,f.resolve)(a);try{if(!(await (0,e.stat)(b)).isDirectory())return{response:g.NextResponse.json({error:"cwd must be a directory"},{status:400})}}catch{return{response:g.NextResponse.json({error:"Directory does not exist"},{status:400})}}let c=await (0,i.mc)();return(0,i.A$)(b,c)?{cwd:b}:{response:g.NextResponse.json({error:"Access denied"},{status:403})}}async function o(a){let b=await n(new URL(a.url).searchParams.get("cwd"));return"response"in b?b.response:g.NextResponse.json((0,k.Y1)(b.cwd,(0,h.getAgentDir)()))}async function p(a){try{let b=await a.json(),c=await n(b.cwd);if("response"in c)return c.response;let d=(0,h.getAgentDir)();if(!(0,k.Y1)(c.cwd,d).requiresTrust)return g.NextResponse.json({error:"This project has no resources that require trust"},{status:409});if((0,l._I)(c.cwd))return g.NextResponse.json({error:"Wait for the active session to finish before trusting this project"},{status:409});let e=(0,k.er)(c.cwd,d);return(0,j.k)(),await (0,l.oA)(c.cwd),g.NextResponse.json(e)}catch(a){return g.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},31421:a=>{a.exports=require("node:child_process")},33873:a=>{a.exports=require("path")},36789:(a,b,c)=>{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-trust/route",pathname:"/api/project-trust",filename:"route",bundlePath:"app/api/project-trust/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/project-trust/route.ts",nextConfigOutput:"standalone",userland:()=>c(24979),...{}}),{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-trust/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)}}},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80481:a=>{a.exports=require("node:readline")},80547:(a,b,c)=>{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.o4)(a,b)}function p(a,b){return(0,j.xk)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},81115:a=>{a.exports=require("constants")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{a.exports=require("events")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,974,426,5138,5582,8904,6429],()=>b(b.s=36789));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var a={};a.id=9647,a.ids=[9647],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},27250:(a,b,c)=>{c.d(b,{Cb:()=>j,lF:()=>i,pZ:()=>k});var d=c(76760),e=c(74244),f=c(20495);function g(a){return(0,d.join)(a,"project-visibility.json")}function h(a){let b={hidden:{}};if(!a||"object"!=typeof a||Array.isArray(a))return b;let c=a.hidden;if(!c||"object"!=typeof c||Array.isArray(c))return b;for(let[a,d]of Object.entries(c))!(!a||!d||"object"!=typeof d||Array.isArray(d))&&"string"==typeof d.path&&d.path&&(b.hidden[a]={path:d.path,name:"string"==typeof d.name?d.name:"",hiddenAt:"string"==typeof d.hiddenAt?d.hiddenAt:""});return b}function i(a){return Object.entries((0,f.j)(g(a),h).hidden).map(([a,b])=>({key:a,...b}))}async function j(a,b,c){let i=(0,e.z)((0,d.resolve)(b)),{value:j}=await (0,f._)(g(a),h,a=>a.hidden[i]?{value:a,changed:!1}:{value:{hidden:{...a.hidden,[i]:{path:(0,d.resolve)(b),name:c.trim(),hiddenAt:new Date().toISOString()}}}});return j}async function k(a,b){let c=(0,e.z)((0,d.resolve)(b)),{value:i}=await (0,f._)(g(a),h,a=>{if(!(c in a.hidden))return{value:a,changed:!1};let b={...a.hidden};return delete b[c],{value:{hidden:b}}});return i}},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},31421:a=>{a.exports=require("node:child_process")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{c.d(b,{E2:()=>l,EN:()=>k});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}}let j=new Set(["POST","PUT","PATCH","DELETE"]);function k(a,b=h()){if(!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))return!1;if(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))return!0;if(!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))){if(j.has((a.method??"GET").toUpperCase())){let b=a.headers.get("host"),c=b?f(b):null;return null!==c&&!!("localhost"===c||c.endsWith(".localhost")||/^127\./.test(c)||"::1"===c||"[::1]"===c)}return!0}return function(a){let b,c,d;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let e=a.headers.get("origin");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||function(a,b,c){let d,e;try{d=new URL(a),e=new URL(b)}catch{return!1}if(d.protocol!==e.protocol||d.hostname.toLowerCase()!==e.hostname.toLowerCase())return!1;if(!d.port)return"same-origin"===c;let f=e.port||("https:"===e.protocol?"443":"80");return d.port===f}(e,f,a.headers.get("sec-fetch-site"))))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 l(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},69980:(a,b,c)=>{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/projects/visibility/route",pathname:"/api/projects/visibility",filename:"route",bundlePath:"app/api/projects/visibility/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/projects/visibility/route.ts",nextConfigOutput:"standalone",userland:()=>c(88026),...{}}),{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/projects/visibility/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)}}},73024:a=>{a.exports=require("node:fs")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},77598:a=>{a.exports=require("node:crypto")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80481:a=>{a.exports=require("node:readline")},81115:a=>{a.exports=require("constants")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},88026:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>l,POST:()=>m,dynamic:()=>n});var e=c(23211),f=c(33873),g=c(75430),h=c(27250),i=c(56429),j=c(66544),k=a([g,i]);[g,i]=k.then?(await k)():k;let n="force-dynamic";async function l(){return e.NextResponse.json({hidden:(0,h.lF)((0,g.getAgentDir)())})}async function m(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(),{action:c,projectRoot:d}=b;if("hide"!==c&&"unhide"!==c||"string"!=typeof d||!d.trim())return e.NextResponse.json({error:"action ('hide'|'unhide') and projectRoot are required"},{status:400});let j=(0,g.getAgentDir)();if("hide"===c){let a="string"==typeof b.name&&b.name.trim()?b.name:(0,f.basename)(d.trim());await (0,h.Cb)(j,d.trim(),a)}else await (0,h.pZ)(j,d.trim());return(0,i.iP)("project_visibility_changed",d.trim(),{action:c}),e.NextResponse.json({hidden:(0,h.lF)(j)})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},94735:a=>{a.exports=require("events")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,974,426,5138,5582,8904,6429],()=>b(b.s=69980));module.exports=c})();
|
|
1
|
+
"use strict";(()=>{var a={};a.id=9647,a.ids=[9647],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},27250:(a,b,c)=>{c.d(b,{Cb:()=>j,lF:()=>i,pZ:()=>k});var d=c(76760),e=c(74244),f=c(20495);function g(a){return(0,d.join)(a,"project-visibility.json")}function h(a){let b={hidden:{}};if(!a||"object"!=typeof a||Array.isArray(a))return b;let c=a.hidden;if(!c||"object"!=typeof c||Array.isArray(c))return b;for(let[a,d]of Object.entries(c))!(!a||!d||"object"!=typeof d||Array.isArray(d))&&"string"==typeof d.path&&d.path&&(b.hidden[a]={path:d.path,name:"string"==typeof d.name?d.name:"",hiddenAt:"string"==typeof d.hiddenAt?d.hiddenAt:""});return b}function i(a){return Object.entries((0,f.j)(g(a),h).hidden).map(([a,b])=>({key:a,...b}))}async function j(a,b,c){let i=(0,e.z)((0,d.resolve)(b)),{value:j}=await (0,f._)(g(a),h,a=>a.hidden[i]?{value:a,changed:!1}:{value:{hidden:{...a.hidden,[i]:{path:(0,d.resolve)(b),name:c.trim(),hiddenAt:new Date().toISOString()}}}});return j}async function k(a,b){let c=(0,e.z)((0,d.resolve)(b)),{value:i}=await (0,f._)(g(a),h,a=>{if(!(c in a.hidden))return{value:a,changed:!1};let b={...a.hidden};return delete b[c],{value:{hidden:b}}});return i}},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},31421:a=>{a.exports=require("node:child_process")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},63419:(a,b,c)=>{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/projects/visibility/route",pathname:"/api/projects/visibility",filename:"route",bundlePath:"app/api/projects/visibility/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/projects/visibility/route.ts",nextConfigOutput:"standalone",userland:()=>c(88026),...{}}),{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/projects/visibility/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)}}},66544:(a,b,c)=>{c.d(b,{E2:()=>l,EN:()=>k});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}}let j=new Set(["POST","PUT","PATCH","DELETE"]);function k(a,b=h()){if(!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))return!1;if(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))return!0;if(!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))){if(j.has((a.method??"GET").toUpperCase())){let b=a.headers.get("host"),c=b?f(b):null;return null!==c&&!!("localhost"===c||c.endsWith(".localhost")||/^127\./.test(c)||"::1"===c||"[::1]"===c)}return!0}return function(a){let b,c,d;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let e=a.headers.get("origin");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||function(a,b,c){let d,e;try{d=new URL(a),e=new URL(b)}catch{return!1}if(d.protocol!==e.protocol||d.hostname.toLowerCase()!==e.hostname.toLowerCase())return!1;if(!d.port)return"same-origin"===c;let f=e.port||("https:"===e.protocol?"443":"80");return d.port===f}(e,f,a.headers.get("sec-fetch-site"))))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 l(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},73024:a=>{a.exports=require("node:fs")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},77598:a=>{a.exports=require("node:crypto")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80481:a=>{a.exports=require("node:readline")},81115:a=>{a.exports=require("constants")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},88026:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>l,POST:()=>m,dynamic:()=>n});var e=c(23211),f=c(33873),g=c(75430),h=c(27250),i=c(56429),j=c(66544),k=a([g,i]);[g,i]=k.then?(await k)():k;let n="force-dynamic";async function l(){return e.NextResponse.json({hidden:(0,h.lF)((0,g.getAgentDir)())})}async function m(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(),{action:c,projectRoot:d}=b;if("hide"!==c&&"unhide"!==c||"string"!=typeof d||!d.trim())return e.NextResponse.json({error:"action ('hide'|'unhide') and projectRoot are required"},{status:400});let j=(0,g.getAgentDir)();if("hide"===c){let a="string"==typeof b.name&&b.name.trim()?b.name:(0,f.basename)(d.trim());await (0,h.Cb)(j,d.trim(),a)}else await (0,h.pZ)(j,d.trim());return(0,i.iP)("project_visibility_changed",d.trim(),{action:c}),e.NextResponse.json({hidden:(0,h.lF)(j)})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},94735:a=>{a.exports=require("events")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,974,426,5138,5582,8904,6429],()=>b(b.s=63419));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=5322,a.ids=[5322],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")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},30853:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{H5:()=>h,eX:()=>f.e});var e=c(75430),f=c(83202),g=a([e]);e=(g.then?(await g)():g)[0];let t={"openai-codex":"https://chatgpt.com/backend-api/wham/usage",deepseek:"https://api.deepseek.com/user/balance",openrouter:"https://openrouter.ai/api/v1/key",moonshotai:"https://api.moonshot.ai/v1/users/me/balance","moonshotai-cn":"https://api.moonshot.cn/v1/users/me/balance",minimax:"https://api.minimax.io","minimax-cn":"https://api.minimaxi.com","vercel-ai-gateway":"https://ai-gateway.vercel.sh/v1/credits","opencode-go":"https://opencode.ai/zen/go/v1/usage"},u={"openai-codex":"OpenAI Codex",deepseek:"DeepSeek",openrouter:"OpenRouter",moonshotai:"Moonshot AI","moonshotai-cn":"Moonshot AI CN",minimax:"MiniMax","minimax-cn":"MiniMax CN","vercel-ai-gateway":"Vercel AI Gateway","opencode-go":"OpenCode Go"},v={moonshotai:"USD","moonshotai-cn":"CNY",minimax:"USD","minimax-cn":"CNY"};async function h(a){let b,c=await e.ModelRuntime.create({refreshOnCreate:!1}),d=c.getProvider(a),f=d?.baseUrl??d?.getModels()[0]?.baseUrl;if(!d||!j(a,f))return{providerId:a,status:"query-failed",message:"The provider usage query failed."};try{b=await c.getAuth(a)}catch{return{providerId:a,status:"auth-unavailable",message:"Provider authentication is unavailable."}}if(!b)return{providerId:a,status:"auth-unavailable",message:"Connect this provider before querying usage."};try{let c=await i(a,b.auth),d=Date.now();return{providerId:a,status:"ready",report:function(a,b,c){switch(a){case"openai-codex":return function(a,b){let c=[],d=(a,b,d)=>{for(let[e,f]of[["primary",a.primary_window],["secondary",a.secondary_window]]){let a=m(f),g=o(a?.used_percent);if(void 0===g)continue;let h=o(a?.limit_window_seconds);c.push({id:`${d}:${e}`,label:function(a){if(!a||a<=0)return"Limit";let b=Math.ceil(a/60);return b>=10080?"Weekly":b>=60?`${Math.round(b/60)}h`:`${b}m`}(h),..."codex"===d?{}:{groupLabel:b},used:s(g),remaining:100-s(g),limit:100,unit:"percent",...h&&h>0?{windowMinutes:Math.ceil(h/60)}:{},...void 0!==o(a?.reset_at)?{resetsAt:o(a?.reset_at)}:{}})}},e=m(a.rate_limit);e&&d(e,"Codex","codex"),(Array.isArray(a.additional_rate_limits)?a.additional_rate_limits:[]).forEach((a,b)=>{let c=m(a),e=m(c?.rate_limit);e&&d(e,n(c?.limit_name)??`Limit ${b+1}`,n(c?.metered_feature)??`additional-${b}`)});let f=[],g=m(a.credits);if(g?.unlimited===!0?f.push({id:"credits",label:"Credits",value:"Unlimited"}):void 0!==o(g?.balance)&&f.push({id:"credits",label:"Credits",value:o(g?.balance),unit:"count"}),!c.length&&!f.length)throw Error("Codex returned no usage data.");return{providerId:"openai-codex",providerName:u["openai-codex"],capturedAt:b,buckets:c,metrics:f}}(b,c);case"deepseek":return function(a,b){let c=[{id:"availability",label:"API calls",value:!0===a.is_available?"Available":"Unavailable"}],d=Array.isArray(a.balance_infos)?a.balance_infos:[];for(let a of d){let b=m(a),d=b?.currency==="CNY"||b?.currency==="USD"?b.currency:void 0;if(d)for(let[a,e,f]of[["total","Total balance","total_balance"],["granted","Granted balance","granted_balance"],["topped-up","Topped-up balance","topped_up_balance"]]){let g=r(b?.[f]);void 0!==g&&c.push({id:`${d.toLowerCase()}-${a}`,label:e,value:g,unit:"currency",currency:d})}}if(0===d.length)throw Error("DeepSeek returned no balance data.");return{providerId:"deepseek",providerName:u.deepseek,capturedAt:b,buckets:[],metrics:c}}(b,c);case"openrouter":return function(a,b){let c=m(a.data);if(!c)throw Error("OpenRouter returned no key data.");let d=[],e=p(c.limit),f=p(c.limit_remaining);void 0!==e&&d.push({id:"key-limit",label:"Key limit",limit:e,...void 0!==f?{remaining:f,used:Math.max(0,e-f)}:{},unit:"currency",currency:"USD",...n(c.limit_reset)?{period:n(c.limit_reset)}:{}});let g=[];for(let[a,b,d]of[["daily","Usage today","usage_daily"],["weekly","Usage this week","usage_weekly"],["monthly","Usage this month","usage_monthly"],["total","All-time usage","usage"]]){let e=p(c[d]);void 0!==e&&g.push({id:a,label:b,value:e,unit:"currency",currency:"USD"})}if(!d.length&&!g.length)throw Error("OpenRouter returned no usage data.");return{providerId:"openrouter",providerName:u.openrouter,capturedAt:b,buckets:d,metrics:g}}(b,c);case"vercel-ai-gateway":var d=b,e=c;let f=r(d.balance),g=r(d.total_used);if(void 0===f&&void 0===g)throw Error("Vercel returned no credit data.");return{providerId:"vercel-ai-gateway",providerName:u["vercel-ai-gateway"],capturedAt:e,buckets:[],metrics:[...void 0!==f?[{id:"balance",label:"Credit balance",value:f,unit:"currency",currency:"USD"}]:[],...void 0!==g?[{id:"spent",label:"Lifetime spend",value:g,unit:"currency",currency:"USD"}]:[]]};case"moonshotai":case"moonshotai-cn":var h=a,i=b,j=c;let l=m(i.data);if(0!==i.code||!0!==i.status||!l)throw Error("Moonshot returned an unsuccessful response.");let q=[["available","Available balance",l.available_balance],["voucher","Voucher balance",l.voucher_balance],["cash","Cash balance",l.cash_balance]].flatMap(([a,b,c])=>{let d=o(c);return void 0===d?[]:[{id:String(a),label:String(b),value:String(d),unit:"currency",currency:v[h]}]});if(!q.length)throw Error("Moonshot returned no balance data.");return{providerId:h,providerName:u[h],capturedAt:j,buckets:[],metrics:q};case"opencode-go":return function(a,b){let c=m(a.usage)??a,d={rolling:"Rolling",weekly:"Weekly",monthly:"Monthly"},e=[];for(let[a,b]of Object.entries(c)){let c=m(b);if(!c)continue;let f=p(c.percent??c.usagePercent??c.usage_percent);if(void 0===f)continue;let g=function(a){if("number"==typeof a&&Number.isFinite(a))return Math.floor(a>=1e12?a/1e3:a);if("string"!=typeof a||!a.trim())return;let b=Date.parse(a);return Number.isFinite(b)?Math.floor(b/1e3):void 0}(c.resetsAt??c.resetAt??c.resets_at??c.reset_at);e.push({id:a,label:d[a]??a,used:s(f),remaining:100-s(f),limit:100,unit:"percent",...void 0!==g?{resetsAt:g}:{}})}if(!e.length)throw Error("OpenCode Go returned no usage data.");return{providerId:"opencode-go",providerName:u["opencode-go"],capturedAt:b,buckets:e,metrics:[]}}(b,c);case"minimax":case"minimax-cn":return function(a,b,c){let d=m(b.base_resp);if(d&&0!==d.status_code)throw Error("MiniMax returned an unsuccessful response.");if(Array.isArray(b.model_remains)){let d=[];for(let[a,c]of b.model_remains.entries()){let b=m(c);if(!b)continue;let e=n(b.model_name)??`Quota ${a+1}`;k(d,b,e,"interval","current_interval_remaining_percent","current_interval_usage_count","current_interval_total_count","end_time","start_time"),k(d,b,e,"weekly","current_weekly_remaining_percent","current_weekly_usage_count","current_weekly_total_count","weekly_end_time","weekly_start_time")}if(!d.length)throw Error("MiniMax returned no quota data.");return{providerId:a,providerName:u[a],capturedAt:c,buckets:d,metrics:[]}}let e=[["available","Available balance",b.available_amount],["cash","Cash balance",b.cash_balance],["voucher","Voucher balance",b.voucher_balance],["credit","Credit balance",b.credit_balance]].flatMap(([b,c,d])=>{let e=r(d);return void 0===e?[]:[{id:String(b),label:String(c),value:e,unit:"currency",currency:v[a]}]});if(!e.length)throw Error("MiniMax returned no balance data.");return{providerId:a,providerName:u[a],capturedAt:c,buckets:[],metrics:e}}(a,b,c)}}(a,c,d)}}catch{return{providerId:a,status:"query-failed",message:"The provider usage query failed."}}}async function i(a,b){if(b.baseUrl&&!j(a,b.baseUrl))throw Error("A custom provider origin cannot be used for official usage queries.");let c=new Headers;for(let[a,d]of Object.entries(b.headers??{}))"string"==typeof d&&c.set(a,d);!c.has("authorization")&&b.apiKey&&c.set("Authorization",`Bearer ${b.apiKey}`);let d=t[a];if("minimax"===a||"minimax-cn"===a){var e;let a,f=(e=c.get("authorization"),a=e?.match(/^Bearer\s+(.+)$/i),a?.[1]??b.apiKey);d+=f?.startsWith("sk-api-")?"/account/query_balance":"/v1/token_plan/remains"}let f=await fetch(d,{headers:c,redirect:"error",signal:AbortSignal.timeout(15e3)}),g=await f.text();if(g.length>65536)throw Error("Usage response was too large.");if(!f.ok)throw Error(`Usage endpoint returned ${f.status}.`);let h=JSON.parse(g);if(!l(h))throw Error("Usage response was not an object.");return h}function j(a,b){if(!b)return!1;try{return new URL(b).origin===new URL(t[a]).origin}catch{return!1}}function k(a,b,c,d,e,f,g,h,i){let j=o(b[`${"interval"===d?"current_interval":"current_weekly"}_status`]),k=o(b[h]),l=o(b[i]),m=p(b[e]);if(3===j)return void a.push({id:`${c}:${d}`,label:"weekly"===d?"Weekly":"Rolling",groupLabel:c,remaining:100,unit:"percent",period:"Unlimited"});let n=q(b[g]),r=q(b[f]);if(void 0===n&&void 0===m)return;let t=void 0!==k&&void 0!==l?Math.max(1,Math.round((k-l)/6e4)):void 0,u=void 0!==k?Math.floor(k/1e3):void 0;if(n&&void 0!==r){let b=r;if(void 0!==m){let a=r/n*100,c=(n-r)/n*100;Math.abs(c-m)<Math.abs(a-m)&&(b=n-r)}a.push({id:`${c}:${d}`,label:"weekly"===d?"Weekly":"Rolling",groupLabel:c,used:n-b,remaining:b,limit:n,unit:"count",...t?{windowMinutes:t}:{},...u?{resetsAt:u}:{}});return}a.push({id:`${c}:${d}`,label:"weekly"===d?"Weekly":"Rolling",groupLabel:c,used:100-s(m),remaining:s(m),limit:100,unit:"percent",...t?{windowMinutes:t}:{},...u?{resetsAt:u}:{}})}function l(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function m(a){return l(a)?a:void 0}function n(a){if("string"==typeof a)return a.replace(/[\u0000-\u001f\u007f]/gu,"").trim().slice(0,80)||void 0}function o(a){return"number"==typeof a&&Number.isFinite(a)?a:"string"==typeof a&&a.trim()&&Number.isFinite(Number(a))?Number(a):void 0}function p(a){let b=o(a);return void 0!==b&&b>=0?b:void 0}function q(a){let b=p(a);return void 0!==b&&Number.isSafeInteger(b)?b:void 0}function r(a){return"number"==typeof a&&Number.isFinite(a)?String(a):"string"==typeof a&&/^-?(?:0|[1-9]\d*)(?:\.\d+)?$/u.test(a)&&a.length<=64?a:void 0}function s(a){return Math.min(100,Math.max(0,a))}d()}catch(a){d(a)}})},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},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:()=>l,EN:()=>k});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}}let j=new Set(["POST","PUT","PATCH","DELETE"]);function k(a,b=h()){if(!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))return!1;if(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))return!0;if(!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))){if(j.has((a.method??"GET").toUpperCase())){let b=a.headers.get("host"),c=b?f(b):null;return null!==c&&!!("localhost"===c||c.endsWith(".localhost")||/^127\./.test(c)||"::1"===c||"[::1]"===c)}return!0}return function(a){let b,c,d;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let e=a.headers.get("origin");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||function(a,b,c){let d,e;try{d=new URL(a),e=new URL(b)}catch{return!1}if(d.protocol!==e.protocol||d.hostname.toLowerCase()!==e.hostname.toLowerCase())return!1;if(!d.port)return"same-origin"===c;let f=e.port||("https:"===e.protocol?"443":"80");return d.port===f}(e,f,a.headers.get("sec-fetch-site"))))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 l(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76617:(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(66544),g=c(30853),h=a([g]);g=(h.then?(await h)():h)[0];let j="force-dynamic";async function i(a){let b;if(!(0,f.EN)(a))return e.NextResponse.json({error:"Untrusted API request"},{status:403});if(!(0,f.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});try{b=await a.json()}catch{return e.NextResponse.json({error:"Invalid JSON"},{status:400})}let c="string"==typeof b.providerId?b.providerId:"";if(!(0,g.eX)(c))return e.NextResponse.json({error:"Unsupported provider"},{status:400});try{let a=await (0,g.H5)(c);return e.NextResponse.json(a)}catch{return e.NextResponse.json({providerId:c,status:"query-failed",message:"The provider usage query failed."})}}d()}catch(a){d(a)}})},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},83202:(a,b,c)=>{"use strict";c.d(b,{e:()=>e});let d=["openai-codex","deepseek","openrouter","moonshotai","moonshotai-cn","minimax","minimax-cn","vercel-ai-gateway","opencode-go"];function e(a){return d.includes(a)}},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},90810:(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/provider-usage/query/route",pathname:"/api/provider-usage/query",filename:"route",bundlePath:"app/api/provider-usage/query/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/provider-usage/query/route.ts",nextConfigOutput:"standalone",userland:()=>c(76617),...{}}),{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/provider-usage/query/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)}}},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=90810));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=5322,a.ids=[5322],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},2545:(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/provider-usage/query/route",pathname:"/api/provider-usage/query",filename:"route",bundlePath:"app/api/provider-usage/query/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/provider-usage/query/route.ts",nextConfigOutput:"standalone",userland:()=>c(76617),...{}}),{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/provider-usage/query/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")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},30853:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{H5:()=>h,eX:()=>f.e});var e=c(75430),f=c(83202),g=a([e]);e=(g.then?(await g)():g)[0];let t={"openai-codex":"https://chatgpt.com/backend-api/wham/usage",deepseek:"https://api.deepseek.com/user/balance",openrouter:"https://openrouter.ai/api/v1/key",moonshotai:"https://api.moonshot.ai/v1/users/me/balance","moonshotai-cn":"https://api.moonshot.cn/v1/users/me/balance",minimax:"https://api.minimax.io","minimax-cn":"https://api.minimaxi.com","vercel-ai-gateway":"https://ai-gateway.vercel.sh/v1/credits","opencode-go":"https://opencode.ai/zen/go/v1/usage"},u={"openai-codex":"OpenAI Codex",deepseek:"DeepSeek",openrouter:"OpenRouter",moonshotai:"Moonshot AI","moonshotai-cn":"Moonshot AI CN",minimax:"MiniMax","minimax-cn":"MiniMax CN","vercel-ai-gateway":"Vercel AI Gateway","opencode-go":"OpenCode Go"},v={moonshotai:"USD","moonshotai-cn":"CNY",minimax:"USD","minimax-cn":"CNY"};async function h(a){let b,c=await e.ModelRuntime.create({refreshOnCreate:!1}),d=c.getProvider(a),f=d?.baseUrl??d?.getModels()[0]?.baseUrl;if(!d||!j(a,f))return{providerId:a,status:"query-failed",message:"The provider usage query failed."};try{b=await c.getAuth(a)}catch{return{providerId:a,status:"auth-unavailable",message:"Provider authentication is unavailable."}}if(!b)return{providerId:a,status:"auth-unavailable",message:"Connect this provider before querying usage."};try{let c=await i(a,b.auth),d=Date.now();return{providerId:a,status:"ready",report:function(a,b,c){switch(a){case"openai-codex":return function(a,b){let c=[],d=(a,b,d)=>{for(let[e,f]of[["primary",a.primary_window],["secondary",a.secondary_window]]){let a=m(f),g=o(a?.used_percent);if(void 0===g)continue;let h=o(a?.limit_window_seconds);c.push({id:`${d}:${e}`,label:function(a){if(!a||a<=0)return"Limit";let b=Math.ceil(a/60);return b>=10080?"Weekly":b>=60?`${Math.round(b/60)}h`:`${b}m`}(h),..."codex"===d?{}:{groupLabel:b},used:s(g),remaining:100-s(g),limit:100,unit:"percent",...h&&h>0?{windowMinutes:Math.ceil(h/60)}:{},...void 0!==o(a?.reset_at)?{resetsAt:o(a?.reset_at)}:{}})}},e=m(a.rate_limit);e&&d(e,"Codex","codex"),(Array.isArray(a.additional_rate_limits)?a.additional_rate_limits:[]).forEach((a,b)=>{let c=m(a),e=m(c?.rate_limit);e&&d(e,n(c?.limit_name)??`Limit ${b+1}`,n(c?.metered_feature)??`additional-${b}`)});let f=[],g=m(a.credits);if(g?.unlimited===!0?f.push({id:"credits",label:"Credits",value:"Unlimited"}):void 0!==o(g?.balance)&&f.push({id:"credits",label:"Credits",value:o(g?.balance),unit:"count"}),!c.length&&!f.length)throw Error("Codex returned no usage data.");return{providerId:"openai-codex",providerName:u["openai-codex"],capturedAt:b,buckets:c,metrics:f}}(b,c);case"deepseek":return function(a,b){let c=[{id:"availability",label:"API calls",value:!0===a.is_available?"Available":"Unavailable"}],d=Array.isArray(a.balance_infos)?a.balance_infos:[];for(let a of d){let b=m(a),d=b?.currency==="CNY"||b?.currency==="USD"?b.currency:void 0;if(d)for(let[a,e,f]of[["total","Total balance","total_balance"],["granted","Granted balance","granted_balance"],["topped-up","Topped-up balance","topped_up_balance"]]){let g=r(b?.[f]);void 0!==g&&c.push({id:`${d.toLowerCase()}-${a}`,label:e,value:g,unit:"currency",currency:d})}}if(0===d.length)throw Error("DeepSeek returned no balance data.");return{providerId:"deepseek",providerName:u.deepseek,capturedAt:b,buckets:[],metrics:c}}(b,c);case"openrouter":return function(a,b){let c=m(a.data);if(!c)throw Error("OpenRouter returned no key data.");let d=[],e=p(c.limit),f=p(c.limit_remaining);void 0!==e&&d.push({id:"key-limit",label:"Key limit",limit:e,...void 0!==f?{remaining:f,used:Math.max(0,e-f)}:{},unit:"currency",currency:"USD",...n(c.limit_reset)?{period:n(c.limit_reset)}:{}});let g=[];for(let[a,b,d]of[["daily","Usage today","usage_daily"],["weekly","Usage this week","usage_weekly"],["monthly","Usage this month","usage_monthly"],["total","All-time usage","usage"]]){let e=p(c[d]);void 0!==e&&g.push({id:a,label:b,value:e,unit:"currency",currency:"USD"})}if(!d.length&&!g.length)throw Error("OpenRouter returned no usage data.");return{providerId:"openrouter",providerName:u.openrouter,capturedAt:b,buckets:d,metrics:g}}(b,c);case"vercel-ai-gateway":var d=b,e=c;let f=r(d.balance),g=r(d.total_used);if(void 0===f&&void 0===g)throw Error("Vercel returned no credit data.");return{providerId:"vercel-ai-gateway",providerName:u["vercel-ai-gateway"],capturedAt:e,buckets:[],metrics:[...void 0!==f?[{id:"balance",label:"Credit balance",value:f,unit:"currency",currency:"USD"}]:[],...void 0!==g?[{id:"spent",label:"Lifetime spend",value:g,unit:"currency",currency:"USD"}]:[]]};case"moonshotai":case"moonshotai-cn":var h=a,i=b,j=c;let l=m(i.data);if(0!==i.code||!0!==i.status||!l)throw Error("Moonshot returned an unsuccessful response.");let q=[["available","Available balance",l.available_balance],["voucher","Voucher balance",l.voucher_balance],["cash","Cash balance",l.cash_balance]].flatMap(([a,b,c])=>{let d=o(c);return void 0===d?[]:[{id:String(a),label:String(b),value:String(d),unit:"currency",currency:v[h]}]});if(!q.length)throw Error("Moonshot returned no balance data.");return{providerId:h,providerName:u[h],capturedAt:j,buckets:[],metrics:q};case"opencode-go":return function(a,b){let c=m(a.usage)??a,d={rolling:"Rolling",weekly:"Weekly",monthly:"Monthly"},e=[];for(let[a,b]of Object.entries(c)){let c=m(b);if(!c)continue;let f=p(c.percent??c.usagePercent??c.usage_percent);if(void 0===f)continue;let g=function(a){if("number"==typeof a&&Number.isFinite(a))return Math.floor(a>=1e12?a/1e3:a);if("string"!=typeof a||!a.trim())return;let b=Date.parse(a);return Number.isFinite(b)?Math.floor(b/1e3):void 0}(c.resetsAt??c.resetAt??c.resets_at??c.reset_at);e.push({id:a,label:d[a]??a,used:s(f),remaining:100-s(f),limit:100,unit:"percent",...void 0!==g?{resetsAt:g}:{}})}if(!e.length)throw Error("OpenCode Go returned no usage data.");return{providerId:"opencode-go",providerName:u["opencode-go"],capturedAt:b,buckets:e,metrics:[]}}(b,c);case"minimax":case"minimax-cn":return function(a,b,c){let d=m(b.base_resp);if(d&&0!==d.status_code)throw Error("MiniMax returned an unsuccessful response.");if(Array.isArray(b.model_remains)){let d=[];for(let[a,c]of b.model_remains.entries()){let b=m(c);if(!b)continue;let e=n(b.model_name)??`Quota ${a+1}`;k(d,b,e,"interval","current_interval_remaining_percent","current_interval_usage_count","current_interval_total_count","end_time","start_time"),k(d,b,e,"weekly","current_weekly_remaining_percent","current_weekly_usage_count","current_weekly_total_count","weekly_end_time","weekly_start_time")}if(!d.length)throw Error("MiniMax returned no quota data.");return{providerId:a,providerName:u[a],capturedAt:c,buckets:d,metrics:[]}}let e=[["available","Available balance",b.available_amount],["cash","Cash balance",b.cash_balance],["voucher","Voucher balance",b.voucher_balance],["credit","Credit balance",b.credit_balance]].flatMap(([b,c,d])=>{let e=r(d);return void 0===e?[]:[{id:String(b),label:String(c),value:e,unit:"currency",currency:v[a]}]});if(!e.length)throw Error("MiniMax returned no balance data.");return{providerId:a,providerName:u[a],capturedAt:c,buckets:[],metrics:e}}(a,b,c)}}(a,c,d)}}catch{return{providerId:a,status:"query-failed",message:"The provider usage query failed."}}}async function i(a,b){if(b.baseUrl&&!j(a,b.baseUrl))throw Error("A custom provider origin cannot be used for official usage queries.");let c=new Headers;for(let[a,d]of Object.entries(b.headers??{}))"string"==typeof d&&c.set(a,d);!c.has("authorization")&&b.apiKey&&c.set("Authorization",`Bearer ${b.apiKey}`);let d=t[a];if("minimax"===a||"minimax-cn"===a){var e;let a,f=(e=c.get("authorization"),a=e?.match(/^Bearer\s+(.+)$/i),a?.[1]??b.apiKey);d+=f?.startsWith("sk-api-")?"/account/query_balance":"/v1/token_plan/remains"}let f=await fetch(d,{headers:c,redirect:"error",signal:AbortSignal.timeout(15e3)}),g=await f.text();if(g.length>65536)throw Error("Usage response was too large.");if(!f.ok)throw Error(`Usage endpoint returned ${f.status}.`);let h=JSON.parse(g);if(!l(h))throw Error("Usage response was not an object.");return h}function j(a,b){if(!b)return!1;try{return new URL(b).origin===new URL(t[a]).origin}catch{return!1}}function k(a,b,c,d,e,f,g,h,i){let j=o(b[`${"interval"===d?"current_interval":"current_weekly"}_status`]),k=o(b[h]),l=o(b[i]),m=p(b[e]);if(3===j)return void a.push({id:`${c}:${d}`,label:"weekly"===d?"Weekly":"Rolling",groupLabel:c,remaining:100,unit:"percent",period:"Unlimited"});let n=q(b[g]),r=q(b[f]);if(void 0===n&&void 0===m)return;let t=void 0!==k&&void 0!==l?Math.max(1,Math.round((k-l)/6e4)):void 0,u=void 0!==k?Math.floor(k/1e3):void 0;if(n&&void 0!==r){let b=r;if(void 0!==m){let a=r/n*100,c=(n-r)/n*100;Math.abs(c-m)<Math.abs(a-m)&&(b=n-r)}a.push({id:`${c}:${d}`,label:"weekly"===d?"Weekly":"Rolling",groupLabel:c,used:n-b,remaining:b,limit:n,unit:"count",...t?{windowMinutes:t}:{},...u?{resetsAt:u}:{}});return}a.push({id:`${c}:${d}`,label:"weekly"===d?"Weekly":"Rolling",groupLabel:c,used:100-s(m),remaining:s(m),limit:100,unit:"percent",...t?{windowMinutes:t}:{},...u?{resetsAt:u}:{}})}function l(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function m(a){return l(a)?a:void 0}function n(a){if("string"==typeof a)return a.replace(/[\u0000-\u001f\u007f]/gu,"").trim().slice(0,80)||void 0}function o(a){return"number"==typeof a&&Number.isFinite(a)?a:"string"==typeof a&&a.trim()&&Number.isFinite(Number(a))?Number(a):void 0}function p(a){let b=o(a);return void 0!==b&&b>=0?b:void 0}function q(a){let b=p(a);return void 0!==b&&Number.isSafeInteger(b)?b:void 0}function r(a){return"number"==typeof a&&Number.isFinite(a)?String(a):"string"==typeof a&&/^-?(?:0|[1-9]\d*)(?:\.\d+)?$/u.test(a)&&a.length<=64?a:void 0}function s(a){return Math.min(100,Math.max(0,a))}d()}catch(a){d(a)}})},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},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:()=>l,EN:()=>k});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}}let j=new Set(["POST","PUT","PATCH","DELETE"]);function k(a,b=h()){if(!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))return!1;if(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))return!0;if(!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))){if(j.has((a.method??"GET").toUpperCase())){let b=a.headers.get("host"),c=b?f(b):null;return null!==c&&!!("localhost"===c||c.endsWith(".localhost")||/^127\./.test(c)||"::1"===c||"[::1]"===c)}return!0}return function(a){let b,c,d;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let e=a.headers.get("origin");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||function(a,b,c){let d,e;try{d=new URL(a),e=new URL(b)}catch{return!1}if(d.protocol!==e.protocol||d.hostname.toLowerCase()!==e.hostname.toLowerCase())return!1;if(!d.port)return"same-origin"===c;let f=e.port||("https:"===e.protocol?"443":"80");return d.port===f}(e,f,a.headers.get("sec-fetch-site"))))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 l(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76617:(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(66544),g=c(30853),h=a([g]);g=(h.then?(await h)():h)[0];let j="force-dynamic";async function i(a){let b;if(!(0,f.EN)(a))return e.NextResponse.json({error:"Untrusted API request"},{status:403});if(!(0,f.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});try{b=await a.json()}catch{return e.NextResponse.json({error:"Invalid JSON"},{status:400})}let c="string"==typeof b.providerId?b.providerId:"";if(!(0,g.eX)(c))return e.NextResponse.json({error:"Unsupported provider"},{status:400});try{let a=await (0,g.H5)(c);return e.NextResponse.json(a)}catch{return e.NextResponse.json({providerId:c,status:"query-failed",message:"The provider usage query failed."})}}d()}catch(a){d(a)}})},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},83202:(a,b,c)=>{"use strict";c.d(b,{e:()=>e});let d=["openai-codex","deepseek","openrouter","moonshotai","moonshotai-cn","minimax","minimax-cn","vercel-ai-gateway","opencode-go"];function e(a){return d.includes(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],()=>b(b.s=2545));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=2246,a.ids=[2246],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},643:a=>{"use strict";a.exports=require("node:perf_hooks")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},8102:(a,b,c)=>{"use strict";c.d(b,{$:()=>g});var d=c(55511),e=c(29021),f=c(33873);function g(a,b){let c=(0,f.dirname)(a),g=(0,f.join)(c,`.${(0,f.basename)(a)}-${(0,d.randomUUID)()}.tmp`),h=!1;try{(0,e.writeFileSync)(g,b,{encoding:"utf8",flag:"wx",mode:384,flush:!0}),(0,e.renameSync)(g,a)}catch(a){throw h=!0,a}finally{try{(0,e.unlinkSync)(g)}catch(a){if("ENOENT"!==a.code&&!h)throw a}}}},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},9153:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>k,GET:()=>i,PUT:()=>j,dynamic:()=>l});var e=c(23211),f=c(87831),g=c(44757),h=a([f]);f=(h.then?(await h)():h)[0];let l="force-dynamic";async function i(){let{password:a,...b}=(0,f.li)();return e.NextResponse.json({...b,hasPassword:!!a})}async function j(a){try{let b=await a.json(),c=(0,f.li)(),d={enabled:"boolean"==typeof b.enabled?b.enabled:c.enabled,protocol:["http","https","socks5"].includes(b.protocol)?b.protocol:c.protocol,host:"string"==typeof b.host?b.host:c.host,port:"number"==typeof b.port?b.port:c.port,username:"string"==typeof b.username?b.username:c.username,password:"string"==typeof b.password?b.password:c.password,noProxy:"string"==typeof b.noProxy?b.noProxy:c.noProxy};if(d.enabled){if(!d.host||!d.host.trim())return e.NextResponse.json({error:"Host is required when proxy is enabled"},{status:400});if(!Number.isInteger(d.port)||d.port<1||d.port>65535)return e.NextResponse.json({error:"Port must be between 1 and 65535"},{status:400});if(!["http","https","socks5"].includes(d.protocol))return e.NextResponse.json({error:"Protocol must be http, https, or socks5"},{status:400})}return(0,f.IA)(d),(0,f.m4)(d),(0,g.rt)(),e.NextResponse.json({success:!0})}catch(b){let a=b instanceof Error?b.message:String(b);return e.NextResponse.json({error:a},{status:500})}}async function k(){try{let a={...(0,f.li)(),enabled:!1};return(0,f.IA)(a),(0,f.m4)(a),(0,g.rt)(),e.NextResponse.json({success:!0})}catch(b){let a=b instanceof Error?b.message:String(b);return e.NextResponse.json({error:a},{status:500})}}d()}catch(a){d(a)}})},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},16698:a=>{"use strict";a.exports=require("node:async_hooks")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},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")},32467:a=>{"use strict";a.exports=require("node:http2")},33873:a=>{"use strict";a.exports=require("path")},34589:a=>{"use strict";a.exports=require("node:assert")},37067:a=>{"use strict";a.exports=require("node:http")},37540:a=>{"use strict";a.exports=require("node:console")},37830:a=>{"use strict";a.exports=require("node:stream/web")},38522:a=>{"use strict";a.exports=require("node:zlib")},40610:a=>{"use strict";a.exports=require("node:dns")},41692:a=>{"use strict";a.exports=require("node:tls")},41792:a=>{"use strict";a.exports=require("node:querystring")},44757:(a,b,c)=>{"use strict";c.d(b,{rt:()=>m});var d=c(78474);c(48161),c(76760),c(73136);var e=c(47774),f=c(73024);f.constants.O_RDONLY,f.constants.O_NONBLOCK;let g=globalThis,h=()=>{},i=null;function j(a){return a instanceof d.EventEmitter&&d.EventEmitter.prototype.on.call(a,"error",h),a}function k(a,b){return j(new e.Kj(a,b))}function l(a,b){return 1===b.connections?k(a,b):j(new e.bC(a,{...b,factory:k}))}function m(a=3e5){g.__piWebHttpDispatcherConfigured=!1,function(a=3e5){var b;let c;if(g.__piWebHttpDispatcherConfigured)return;let d=function a(b){if("string"==typeof b){let c=b.trim();if("disabled"===c.toLowerCase())return 0;if(0===c.length)return;return a(Number(c))}if("number"==typeof b&&Number.isFinite(b)&&!(b<0))return Math.floor(b)}(a);if(void 0===d)throw Error(`Invalid HTTP idle timeout: ${String(a)}`);b=j(new e.J2({allowH2:!1,bodyTimeout:d,headersTimeout:d,clientFactory:k,factory:l})),e.bj(b),c=i,i=b,c&&c.close().catch(()=>{}),g.__piWebHttpDispatcherConfigured=!0}(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")},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},55511:a=>{"use strict";a.exports=require("crypto")},57075:a=>{"use strict";a.exports=require("node:stream")},57975:a=>{"use strict";a.exports=require("node:util")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},68358:(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/proxy/route",pathname:"/api/proxy",filename:"route",bundlePath:"app/api/proxy/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/proxy/route.ts",nextConfigOutput:"standalone",userland:()=>c(9153),...{}}),{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/proxy/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)}}},73024:a=>{"use strict";a.exports=require("node:fs")},73136:a=>{"use strict";a.exports=require("node:url")},73429:a=>{"use strict";a.exports=require("node:util/types")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},75919:a=>{"use strict";a.exports=require("node:worker_threads")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},78474:a=>{"use strict";a.exports=require("node:events")},80099:a=>{"use strict";a.exports=require("node:sqlite")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87831:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{IA:()=>m,iV:()=>n,li:()=>l,m4:()=>o});var e=c(29021),f=c(33873),g=c(75430),h=c(8102),i=a([g]);g=(i.then?(await i)():i)[0];let p="proxy",q=["http","https","socks5"];function j(){return(0,f.join)((0,g.getAgentDir)(),"settings.json")}function k(){let a=j();if(!(0,e.existsSync)(a))return{};try{let b=JSON.parse((0,e.readFileSync)(a,"utf8"));return null===b||"object"!=typeof b||Array.isArray(b)?{}:b}catch{return{}}}function l(){let a=k()[p],b={enabled:!1,protocol:"http",host:"127.0.0.1",port:7890,username:"",password:"",noProxy:"localhost,127.0.0.1,.local"};if(!a||"object"!=typeof a||Array.isArray(a))return b;let c=q.includes(a.protocol)?a.protocol:b.protocol,d=Number(a.port),e=Number.isInteger(d)&&d>=1&&d<=65535;return{enabled:"boolean"==typeof a.enabled?a.enabled:b.enabled,protocol:c,host:"string"==typeof a.host&&a.host.length>0?a.host:b.host,port:e?d:b.port,username:"string"==typeof a.username?a.username:"",password:"string"==typeof a.password?a.password:"",noProxy:"string"==typeof a.noProxy?a.noProxy:b.noProxy}}function m(a){let b=k();b[p]=a,(0,h.$)(j(),JSON.stringify(b,null,2))}function n(a){if(!a.enabled||!a.host||!a.port)return null;let b="";if(a.username){let c=encodeURIComponent(a.username);b=a.password?`${c}:${encodeURIComponent(a.password)}@`:`${c}@`}return`${a.protocol}://${b}${a.host}:${a.port}`}function o(a){let b=n(a);b?(process.env.HTTP_PROXY=b,process.env.HTTPS_PROXY=b,process.env.NO_PROXY=a.noProxy||""):(delete process.env.HTTP_PROXY,delete process.env.HTTPS_PROXY,process.env.NO_PROXY="")}d()}catch(a){d(a)}})},87997:a=>{"use strict";a.exports=require("node:timers")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,7774],()=>b(b.s=68358));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=2246,a.ids=[2246],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},643:a=>{"use strict";a.exports=require("node:perf_hooks")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},8102:(a,b,c)=>{"use strict";c.d(b,{$:()=>g});var d=c(55511),e=c(29021),f=c(33873);function g(a,b){let c=(0,f.dirname)(a),g=(0,f.join)(c,`.${(0,f.basename)(a)}-${(0,d.randomUUID)()}.tmp`),h=!1;try{(0,e.writeFileSync)(g,b,{encoding:"utf8",flag:"wx",mode:384,flush:!0}),(0,e.renameSync)(g,a)}catch(a){throw h=!0,a}finally{try{(0,e.unlinkSync)(g)}catch(a){if("ENOENT"!==a.code&&!h)throw a}}}},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},9153:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>k,GET:()=>i,PUT:()=>j,dynamic:()=>l});var e=c(23211),f=c(87831),g=c(44757),h=a([f]);f=(h.then?(await h)():h)[0];let l="force-dynamic";async function i(){let{password:a,...b}=(0,f.li)();return e.NextResponse.json({...b,hasPassword:!!a})}async function j(a){try{let b=await a.json(),c=(0,f.li)(),d={enabled:"boolean"==typeof b.enabled?b.enabled:c.enabled,protocol:["http","https","socks5"].includes(b.protocol)?b.protocol:c.protocol,host:"string"==typeof b.host?b.host:c.host,port:"number"==typeof b.port?b.port:c.port,username:"string"==typeof b.username?b.username:c.username,password:"string"==typeof b.password?b.password:c.password,noProxy:"string"==typeof b.noProxy?b.noProxy:c.noProxy};if(d.enabled){if(!d.host||!d.host.trim())return e.NextResponse.json({error:"Host is required when proxy is enabled"},{status:400});if(!Number.isInteger(d.port)||d.port<1||d.port>65535)return e.NextResponse.json({error:"Port must be between 1 and 65535"},{status:400});if(!["http","https","socks5"].includes(d.protocol))return e.NextResponse.json({error:"Protocol must be http, https, or socks5"},{status:400})}return(0,f.IA)(d),(0,f.m4)(d),(0,g.rt)(),e.NextResponse.json({success:!0})}catch(b){let a=b instanceof Error?b.message:String(b);return e.NextResponse.json({error:a},{status:500})}}async function k(){try{let a={...(0,f.li)(),enabled:!1};return(0,f.IA)(a),(0,f.m4)(a),(0,g.rt)(),e.NextResponse.json({success:!0})}catch(b){let a=b instanceof Error?b.message:String(b);return e.NextResponse.json({error:a},{status:500})}}d()}catch(a){d(a)}})},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},16698:a=>{"use strict";a.exports=require("node:async_hooks")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},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")},32467:a=>{"use strict";a.exports=require("node:http2")},33873:a=>{"use strict";a.exports=require("path")},34589:a=>{"use strict";a.exports=require("node:assert")},37067:a=>{"use strict";a.exports=require("node:http")},37540:a=>{"use strict";a.exports=require("node:console")},37830:a=>{"use strict";a.exports=require("node:stream/web")},38522:a=>{"use strict";a.exports=require("node:zlib")},39053:(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/proxy/route",pathname:"/api/proxy",filename:"route",bundlePath:"app/api/proxy/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/proxy/route.ts",nextConfigOutput:"standalone",userland:()=>c(9153),...{}}),{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/proxy/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)}}},40610:a=>{"use strict";a.exports=require("node:dns")},41692:a=>{"use strict";a.exports=require("node:tls")},41792:a=>{"use strict";a.exports=require("node:querystring")},44757:(a,b,c)=>{"use strict";c.d(b,{rt:()=>m});var d=c(78474);c(48161),c(76760),c(73136);var e=c(47774),f=c(73024);f.constants.O_RDONLY,f.constants.O_NONBLOCK;let g=globalThis,h=()=>{},i=null;function j(a){return a instanceof d.EventEmitter&&d.EventEmitter.prototype.on.call(a,"error",h),a}function k(a,b){return j(new e.Kj(a,b))}function l(a,b){return 1===b.connections?k(a,b):j(new e.bC(a,{...b,factory:k}))}function m(a=3e5){g.__piWebHttpDispatcherConfigured=!1,function(a=3e5){var b;let c;if(g.__piWebHttpDispatcherConfigured)return;let d=function a(b){if("string"==typeof b){let c=b.trim();if("disabled"===c.toLowerCase())return 0;if(0===c.length)return;return a(Number(c))}if("number"==typeof b&&Number.isFinite(b)&&!(b<0))return Math.floor(b)}(a);if(void 0===d)throw Error(`Invalid HTTP idle timeout: ${String(a)}`);b=j(new e.J2({allowH2:!1,bodyTimeout:d,headersTimeout:d,clientFactory:k,factory:l})),e.bj(b),c=i,i=b,c&&c.close().catch(()=>{}),g.__piWebHttpDispatcherConfigured=!0}(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")},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},55511:a=>{"use strict";a.exports=require("crypto")},57075:a=>{"use strict";a.exports=require("node:stream")},57975:a=>{"use strict";a.exports=require("node:util")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{"use strict";a.exports=require("node:fs")},73136:a=>{"use strict";a.exports=require("node:url")},73429:a=>{"use strict";a.exports=require("node:util/types")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},75919:a=>{"use strict";a.exports=require("node:worker_threads")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},78474:a=>{"use strict";a.exports=require("node:events")},80099:a=>{"use strict";a.exports=require("node:sqlite")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87831:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{IA:()=>m,iV:()=>n,li:()=>l,m4:()=>o});var e=c(29021),f=c(33873),g=c(75430),h=c(8102),i=a([g]);g=(i.then?(await i)():i)[0];let p="proxy",q=["http","https","socks5"];function j(){return(0,f.join)((0,g.getAgentDir)(),"settings.json")}function k(){let a=j();if(!(0,e.existsSync)(a))return{};try{let b=JSON.parse((0,e.readFileSync)(a,"utf8"));return null===b||"object"!=typeof b||Array.isArray(b)?{}:b}catch{return{}}}function l(){let a=k()[p],b={enabled:!1,protocol:"http",host:"127.0.0.1",port:7890,username:"",password:"",noProxy:"localhost,127.0.0.1,.local"};if(!a||"object"!=typeof a||Array.isArray(a))return b;let c=q.includes(a.protocol)?a.protocol:b.protocol,d=Number(a.port),e=Number.isInteger(d)&&d>=1&&d<=65535;return{enabled:"boolean"==typeof a.enabled?a.enabled:b.enabled,protocol:c,host:"string"==typeof a.host&&a.host.length>0?a.host:b.host,port:e?d:b.port,username:"string"==typeof a.username?a.username:"",password:"string"==typeof a.password?a.password:"",noProxy:"string"==typeof a.noProxy?a.noProxy:b.noProxy}}function m(a){let b=k();b[p]=a,(0,h.$)(j(),JSON.stringify(b,null,2))}function n(a){if(!a.enabled||!a.host||!a.port)return null;let b="";if(a.username){let c=encodeURIComponent(a.username);b=a.password?`${c}:${encodeURIComponent(a.password)}@`:`${c}@`}return`${a.protocol}://${b}${a.host}:${a.port}`}function o(a){let b=n(a);b?(process.env.HTTP_PROXY=b,process.env.HTTPS_PROXY=b,process.env.NO_PROXY=a.noProxy||""):(delete process.env.HTTP_PROXY,delete process.env.HTTPS_PROXY,process.env.NO_PROXY="")}d()}catch(a){d(a)}})},87997:a=>{"use strict";a.exports=require("node:timers")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,7774],()=>b(b.s=39053));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=1225,a.ids=[1225],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},643:a=>{"use strict";a.exports=require("node:perf_hooks")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},8102:(a,b,c)=>{"use strict";c.d(b,{$:()=>g});var d=c(55511),e=c(29021),f=c(33873);function g(a,b){let c=(0,f.dirname)(a),g=(0,f.join)(c,`.${(0,f.basename)(a)}-${(0,d.randomUUID)()}.tmp`),h=!1;try{(0,e.writeFileSync)(g,b,{encoding:"utf8",flag:"wx",mode:384,flush:!0}),(0,e.renameSync)(g,a)}catch(a){throw h=!0,a}finally{try{(0,e.unlinkSync)(g)}catch(a){if("ENOENT"!==a.code&&!h)throw a}}}},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")},16698:a=>{"use strict";a.exports=require("node:async_hooks")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},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")},32467:a=>{"use strict";a.exports=require("node:http2")},33873:a=>{"use strict";a.exports=require("path")},34589:a=>{"use strict";a.exports=require("node:assert")},37067:a=>{"use strict";a.exports=require("node:http")},37540:a=>{"use strict";a.exports=require("node:console")},37830:a=>{"use strict";a.exports=require("node:stream/web")},38522:a=>{"use strict";a.exports=require("node:zlib")},40610:a=>{"use strict";a.exports=require("node:dns")},41692:a=>{"use strict";a.exports=require("node:tls")},41792:a=>{"use strict";a.exports=require("node:querystring")},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")},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},55511:a=>{"use strict";a.exports=require("crypto")},57075:a=>{"use strict";a.exports=require("node:stream")},57975:a=>{"use strict";a.exports=require("node:util")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73136:a=>{"use strict";a.exports=require("node:url")},73429:a=>{"use strict";a.exports=require("node:util/types")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},75919:a=>{"use strict";a.exports=require("node:worker_threads")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},78474:a=>{"use strict";a.exports=require("node:events")},80099:a=>{"use strict";a.exports=require("node:sqlite")},80924:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>j,dynamic:()=>k});var e=c(23211),f=c(78474),g=c(87831),h=c(47774),i=a([g]);g=(i.then?(await i)():i)[0];let k="force-dynamic";async function j(){let a=(0,g.li)();if(!a.enabled)return e.NextResponse.json({success:!1,error:"Proxy is disabled"},{status:400});if(!(0,g.iV)(a))return e.NextResponse.json({success:!1,error:"Proxy URL is invalid (missing host or port)"},{status:400});let b=Date.now();try{let a=new h.J2({allowH2:!1,bodyTimeout:1e4,headersTimeout:1e4});a instanceof f.EventEmitter&&f.EventEmitter.prototype.on.call(a,"error",()=>{});let c=new AbortController,d=setTimeout(()=>c.abort(),1e4);try{let{statusCode:d,body:f}=await h.Em("https://api.github.com",{dispatcher:a,signal:c.signal,headers:{"User-Agent":"pi-web-proxy-test"}}),g=await f.text();if(d>=400){let a=g.slice(0,200);return e.NextResponse.json({success:!1,error:`HTTP ${d}${a?": "+a:""}`,latencyMs:Date.now()-b})}let i=Date.now()-b;return e.NextResponse.json({success:!0,latencyMs:i,status:d})}finally{clearTimeout(d)}}catch(c){let a=c instanceof Error?c.message:String(c);return c instanceof DOMException&&"TimeoutError"===c.name&&(a="Test timed out after 10000ms"),e.NextResponse.json({success:!1,error:a,latencyMs:Date.now()-b})}}d()}catch(a){d(a)}})},82364:(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/proxy/test/route",pathname:"/api/proxy/test",filename:"route",bundlePath:"app/api/proxy/test/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/proxy/test/route.ts",nextConfigOutput:"standalone",userland:()=>c(80924),...{}}),{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/proxy/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)}}},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87831:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{IA:()=>m,iV:()=>n,li:()=>l,m4:()=>o});var e=c(29021),f=c(33873),g=c(75430),h=c(8102),i=a([g]);g=(i.then?(await i)():i)[0];let p="proxy",q=["http","https","socks5"];function j(){return(0,f.join)((0,g.getAgentDir)(),"settings.json")}function k(){let a=j();if(!(0,e.existsSync)(a))return{};try{let b=JSON.parse((0,e.readFileSync)(a,"utf8"));return null===b||"object"!=typeof b||Array.isArray(b)?{}:b}catch{return{}}}function l(){let a=k()[p],b={enabled:!1,protocol:"http",host:"127.0.0.1",port:7890,username:"",password:"",noProxy:"localhost,127.0.0.1,.local"};if(!a||"object"!=typeof a||Array.isArray(a))return b;let c=q.includes(a.protocol)?a.protocol:b.protocol,d=Number(a.port),e=Number.isInteger(d)&&d>=1&&d<=65535;return{enabled:"boolean"==typeof a.enabled?a.enabled:b.enabled,protocol:c,host:"string"==typeof a.host&&a.host.length>0?a.host:b.host,port:e?d:b.port,username:"string"==typeof a.username?a.username:"",password:"string"==typeof a.password?a.password:"",noProxy:"string"==typeof a.noProxy?a.noProxy:b.noProxy}}function m(a){let b=k();b[p]=a,(0,h.$)(j(),JSON.stringify(b,null,2))}function n(a){if(!a.enabled||!a.host||!a.port)return null;let b="";if(a.username){let c=encodeURIComponent(a.username);b=a.password?`${c}:${encodeURIComponent(a.password)}@`:`${c}@`}return`${a.protocol}://${b}${a.host}:${a.port}`}function o(a){let b=n(a);b?(process.env.HTTP_PROXY=b,process.env.HTTPS_PROXY=b,process.env.NO_PROXY=a.noProxy||""):(delete process.env.HTTP_PROXY,delete process.env.HTTPS_PROXY,process.env.NO_PROXY="")}d()}catch(a){d(a)}})},87997:a=>{"use strict";a.exports=require("node:timers")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,7774],()=>b(b.s=82364));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=1225,a.ids=[1225],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},643:a=>{"use strict";a.exports=require("node:perf_hooks")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},8102:(a,b,c)=>{"use strict";c.d(b,{$:()=>g});var d=c(55511),e=c(29021),f=c(33873);function g(a,b){let c=(0,f.dirname)(a),g=(0,f.join)(c,`.${(0,f.basename)(a)}-${(0,d.randomUUID)()}.tmp`),h=!1;try{(0,e.writeFileSync)(g,b,{encoding:"utf8",flag:"wx",mode:384,flush:!0}),(0,e.renameSync)(g,a)}catch(a){throw h=!0,a}finally{try{(0,e.unlinkSync)(g)}catch(a){if("ENOENT"!==a.code&&!h)throw a}}}},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")},16698:a=>{"use strict";a.exports=require("node:async_hooks")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},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")},32467:a=>{"use strict";a.exports=require("node:http2")},33873:a=>{"use strict";a.exports=require("path")},34589:a=>{"use strict";a.exports=require("node:assert")},37067:a=>{"use strict";a.exports=require("node:http")},37540:a=>{"use strict";a.exports=require("node:console")},37830:a=>{"use strict";a.exports=require("node:stream/web")},38522:a=>{"use strict";a.exports=require("node:zlib")},40610:a=>{"use strict";a.exports=require("node:dns")},41692:a=>{"use strict";a.exports=require("node:tls")},41792:a=>{"use strict";a.exports=require("node:querystring")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46363:(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/proxy/test/route",pathname:"/api/proxy/test",filename:"route",bundlePath:"app/api/proxy/test/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/proxy/test/route.ts",nextConfigOutput:"standalone",userland:()=>c(80924),...{}}),{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/proxy/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)}}},51455:a=>{"use strict";a.exports=require("node:fs/promises")},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},55511:a=>{"use strict";a.exports=require("crypto")},57075:a=>{"use strict";a.exports=require("node:stream")},57975:a=>{"use strict";a.exports=require("node:util")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73136:a=>{"use strict";a.exports=require("node:url")},73429:a=>{"use strict";a.exports=require("node:util/types")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},75919:a=>{"use strict";a.exports=require("node:worker_threads")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},78474:a=>{"use strict";a.exports=require("node:events")},80099:a=>{"use strict";a.exports=require("node:sqlite")},80924:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>j,dynamic:()=>k});var e=c(23211),f=c(78474),g=c(87831),h=c(47774),i=a([g]);g=(i.then?(await i)():i)[0];let k="force-dynamic";async function j(){let a=(0,g.li)();if(!a.enabled)return e.NextResponse.json({success:!1,error:"Proxy is disabled"},{status:400});if(!(0,g.iV)(a))return e.NextResponse.json({success:!1,error:"Proxy URL is invalid (missing host or port)"},{status:400});let b=Date.now();try{let a=new h.J2({allowH2:!1,bodyTimeout:1e4,headersTimeout:1e4});a instanceof f.EventEmitter&&f.EventEmitter.prototype.on.call(a,"error",()=>{});let c=new AbortController,d=setTimeout(()=>c.abort(),1e4);try{let{statusCode:d,body:f}=await h.Em("https://api.github.com",{dispatcher:a,signal:c.signal,headers:{"User-Agent":"pi-web-proxy-test"}}),g=await f.text();if(d>=400){let a=g.slice(0,200);return e.NextResponse.json({success:!1,error:`HTTP ${d}${a?": "+a:""}`,latencyMs:Date.now()-b})}let i=Date.now()-b;return e.NextResponse.json({success:!0,latencyMs:i,status:d})}finally{clearTimeout(d)}}catch(c){let a=c instanceof Error?c.message:String(c);return c instanceof DOMException&&"TimeoutError"===c.name&&(a="Test timed out after 10000ms"),e.NextResponse.json({success:!1,error:a,latencyMs:Date.now()-b})}}d()}catch(a){d(a)}})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87831:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{IA:()=>m,iV:()=>n,li:()=>l,m4:()=>o});var e=c(29021),f=c(33873),g=c(75430),h=c(8102),i=a([g]);g=(i.then?(await i)():i)[0];let p="proxy",q=["http","https","socks5"];function j(){return(0,f.join)((0,g.getAgentDir)(),"settings.json")}function k(){let a=j();if(!(0,e.existsSync)(a))return{};try{let b=JSON.parse((0,e.readFileSync)(a,"utf8"));return null===b||"object"!=typeof b||Array.isArray(b)?{}:b}catch{return{}}}function l(){let a=k()[p],b={enabled:!1,protocol:"http",host:"127.0.0.1",port:7890,username:"",password:"",noProxy:"localhost,127.0.0.1,.local"};if(!a||"object"!=typeof a||Array.isArray(a))return b;let c=q.includes(a.protocol)?a.protocol:b.protocol,d=Number(a.port),e=Number.isInteger(d)&&d>=1&&d<=65535;return{enabled:"boolean"==typeof a.enabled?a.enabled:b.enabled,protocol:c,host:"string"==typeof a.host&&a.host.length>0?a.host:b.host,port:e?d:b.port,username:"string"==typeof a.username?a.username:"",password:"string"==typeof a.password?a.password:"",noProxy:"string"==typeof a.noProxy?a.noProxy:b.noProxy}}function m(a){let b=k();b[p]=a,(0,h.$)(j(),JSON.stringify(b,null,2))}function n(a){if(!a.enabled||!a.host||!a.port)return null;let b="";if(a.username){let c=encodeURIComponent(a.username);b=a.password?`${c}:${encodeURIComponent(a.password)}@`:`${c}@`}return`${a.protocol}://${b}${a.host}:${a.port}`}function o(a){let b=n(a);b?(process.env.HTTP_PROXY=b,process.env.HTTPS_PROXY=b,process.env.NO_PROXY=a.noProxy||""):(delete process.env.HTTP_PROXY,delete process.env.HTTPS_PROXY,process.env.NO_PROXY="")}d()}catch(a){d(a)}})},87997:a=>{"use strict";a.exports=require("node:timers")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,7774],()=>b(b.s=46363));module.exports=c})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var a={};a.id=2835,a.ids=[2835],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},25846:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>o,POST:()=>n});var e=c(23211),f=c(79495),g=c(67936),h=c(67264),i=c(66544),j=c(7859),k=c(56429),l=c(40402),m=a([f,j,k,l]);async function n(a,{params:b}){if(!(0,i.EN)(a))return e.NextResponse.json({error:"Access denied"},{status:403});let{id:c}=await b,d=await (0,l.os)(c);if(!d)return e.NextResponse.json({error:"Session not found"},{status:404});let m=()=>{(0,g.$P)(c)};a.signal.addEventListener("abort",m,{once:!0});try{let a=await (0,g.oY)(c,async a=>{let b=(0,k.A4)(c),{session:e,created:g}=b?.isAlive()?{session:b,created:!1}:await (0,k.OF)(c,d,void 0);try{let b=function(a){let b=(0,j.YB)();if(!b)return;let c=b.indexOf("/");if(!(c<=0)&&c!==b.length-1)return a.modelRuntime.getModel(b.slice(0,c),b.slice(c+1))}(e.inner),c=await (0,f.gp)(e.inner,b,a);if(!e.isAlive())throw Error("The session was closed while its title was being generated. Please try again.");let d=(0,h.CS)(c.title);return e.inner.setSessionName(d),(0,l.mD)(),{title:d,usage:c.usage??null}}finally{g&&e.isAlive()&&!e.isRunning()&&!e.hasSubscribers()&&(await Promise.race([e.shutdown(),new Promise(a=>setTimeout(a,5e3))]).catch(()=>{}),e.isAlive()&&e.destroy())}});return e.NextResponse.json(a)}catch(a){return a instanceof g.uA?e.NextResponse.json({error:a.message,code:a.code},{status:"title_queue_full"===a.code?429:409}):a instanceof Error&&"AbortError"===a.name?e.NextResponse.json({error:a.message,code:"title_generation_cancelled"},{status:409}):e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}finally{a.signal.removeEventListener("abort",m)}}async function o(a,{params:b}){if(!(0,i.EN)(a))return e.NextResponse.json({error:"Access denied"},{status:403});let{id:c}=await b;return e.NextResponse.json({cancelled:(0,g.$P)(c)})}[f,j,k,l]=m.then?(await m)():m,d()}catch(a){d(a)}})},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},31421:a=>{a.exports=require("node:child_process")},32668:(a,b,c)=>{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/sessions/[id]/auto-name/route",pathname:"/api/sessions/[id]/auto-name",filename:"route",bundlePath:"app/api/sessions/[id]/auto-name/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/sessions/[id]/auto-name/route.ts",nextConfigOutput:"standalone",userland:()=>c(25846),...{}}),{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/sessions/[id]/auto-name/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)}}},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{c.d(b,{E2:()=>l,EN:()=>k});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}}let j=new Set(["POST","PUT","PATCH","DELETE"]);function k(a,b=h()){if(!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))return!1;if(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))return!0;if(!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))){if(j.has((a.method??"GET").toUpperCase())){let b=a.headers.get("host"),c=b?f(b):null;return null!==c&&!!("localhost"===c||c.endsWith(".localhost")||/^127\./.test(c)||"::1"===c||"[::1]"===c)}return!0}return function(a){let b,c,d;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let e=a.headers.get("origin");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||function(a,b,c){let d,e;try{d=new URL(a),e=new URL(b)}catch{return!1}if(d.protocol!==e.protocol||d.hostname.toLowerCase()!==e.hostname.toLowerCase())return!1;if(!d.port)return"same-origin"===c;let f=e.port||("https:"===e.protocol?"443":"80");return d.port===f}(e,f,a.headers.get("sec-fetch-site"))))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 l(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},67936:(a,b,c)=>{c.d(b,{$P:()=>j,oY:()=>i,uA:()=>d});class d extends Error{constructor(a,b){super(a),this.code=b,this.name="SessionTitleTaskError"}}function e(){return globalThis.__piSessionTitleCoordinator??={active:0,tasks:new Map,queue:[]}}function f(){return new d("Session title generation was cancelled","title_generation_cancelled")}function g(a){let b=e();if(a.controller.signal.aborted){b.tasks.delete(a.sessionId),a.reject(f()),h();return}a.state="running",b.active+=1,a.execute(a.controller.signal).then(a.resolve,a.reject).finally(()=>{let b;(b=e()).tasks.get(a.sessionId)===a&&b.tasks.delete(a.sessionId),b.active=Math.max(0,b.active-1),h()})}function h(){let a=e();for(;a.active<2&&a.queue.length>0;){let b=a.queue.shift();b&&g(b)}}function i(a,b){let c,f,h=e(),i=h.tasks.get(a);if(i)return i.promise;if(h.active>=2&&h.queue.length>=20)throw new d("Too many session title requests are waiting","title_queue_full");let j=new Promise((a,b)=>{c=a,f=b}),k={sessionId:a,controller:new AbortController,execute:b,promise:j,resolve:c,reject:f,state:"queued"};return h.tasks.set(a,k),h.active<2?g(k):h.queue.push(k),j}function j(a){let b=e(),c=b.tasks.get(a);if(!c)return!1;if(c.controller.abort(),"queued"===c.state){let d=b.queue.indexOf(c);d>=0&&b.queue.splice(d,1),b.tasks.delete(a),c.reject(f()),h()}return!0}},73024:a=>{a.exports=require("node:fs")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},77598:a=>{a.exports=require("node:crypto")},79495:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{gp:()=>l});var e=c(86123),f=c(67264),g=a([e]);e=(g.then?(await g)():g)[0];let m=`Create a concise title for this session based on the conversation above.
|
|
1
|
+
"use strict";(()=>{var a={};a.id=2835,a.ids=[2835],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},25846:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>o,POST:()=>n});var e=c(23211),f=c(79495),g=c(67936),h=c(67264),i=c(66544),j=c(7859),k=c(56429),l=c(40402),m=a([f,j,k,l]);async function n(a,{params:b}){if(!(0,i.EN)(a))return e.NextResponse.json({error:"Access denied"},{status:403});let{id:c}=await b,d=await (0,l.os)(c);if(!d)return e.NextResponse.json({error:"Session not found"},{status:404});let m=()=>{(0,g.$P)(c)};a.signal.addEventListener("abort",m,{once:!0});try{let a=await (0,g.oY)(c,async a=>{let b=(0,k.A4)(c),{session:e,created:g}=b?.isAlive()?{session:b,created:!1}:await (0,k.OF)(c,d,void 0);try{let b=function(a){let b=(0,j.YB)();if(!b)return;let c=b.indexOf("/");if(!(c<=0)&&c!==b.length-1)return a.modelRuntime.getModel(b.slice(0,c),b.slice(c+1))}(e.inner),c=await (0,f.gp)(e.inner,b,a);if(!e.isAlive())throw Error("The session was closed while its title was being generated. Please try again.");let d=(0,h.CS)(c.title);return e.inner.setSessionName(d),(0,l.mD)(),{title:d,usage:c.usage??null}}finally{g&&e.isAlive()&&!e.isRunning()&&!e.hasSubscribers()&&(await Promise.race([e.shutdown(),new Promise(a=>setTimeout(a,5e3))]).catch(()=>{}),e.isAlive()&&e.destroy())}});return e.NextResponse.json(a)}catch(a){return a instanceof g.uA?e.NextResponse.json({error:a.message,code:a.code},{status:"title_queue_full"===a.code?429:409}):a instanceof Error&&"AbortError"===a.name?e.NextResponse.json({error:a.message,code:"title_generation_cancelled"},{status:409}):e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}finally{a.signal.removeEventListener("abort",m)}}async function o(a,{params:b}){if(!(0,i.EN)(a))return e.NextResponse.json({error:"Access denied"},{status:403});let{id:c}=await b;return e.NextResponse.json({cancelled:(0,g.$P)(c)})}[f,j,k,l]=m.then?(await m)():m,d()}catch(a){d(a)}})},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},31421:a=>{a.exports=require("node:child_process")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{c.d(b,{E2:()=>l,EN:()=>k});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}}let j=new Set(["POST","PUT","PATCH","DELETE"]);function k(a,b=h()){if(!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))return!1;if(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))return!0;if(!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))){if(j.has((a.method??"GET").toUpperCase())){let b=a.headers.get("host"),c=b?f(b):null;return null!==c&&!!("localhost"===c||c.endsWith(".localhost")||/^127\./.test(c)||"::1"===c||"[::1]"===c)}return!0}return function(a){let b,c,d;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let e=a.headers.get("origin");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||function(a,b,c){let d,e;try{d=new URL(a),e=new URL(b)}catch{return!1}if(d.protocol!==e.protocol||d.hostname.toLowerCase()!==e.hostname.toLowerCase())return!1;if(!d.port)return"same-origin"===c;let f=e.port||("https:"===e.protocol?"443":"80");return d.port===f}(e,f,a.headers.get("sec-fetch-site"))))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 l(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},67936:(a,b,c)=>{c.d(b,{$P:()=>j,oY:()=>i,uA:()=>d});class d extends Error{constructor(a,b){super(a),this.code=b,this.name="SessionTitleTaskError"}}function e(){return globalThis.__piSessionTitleCoordinator??={active:0,tasks:new Map,queue:[]}}function f(){return new d("Session title generation was cancelled","title_generation_cancelled")}function g(a){let b=e();if(a.controller.signal.aborted){b.tasks.delete(a.sessionId),a.reject(f()),h();return}a.state="running",b.active+=1,a.execute(a.controller.signal).then(a.resolve,a.reject).finally(()=>{let b;(b=e()).tasks.get(a.sessionId)===a&&b.tasks.delete(a.sessionId),b.active=Math.max(0,b.active-1),h()})}function h(){let a=e();for(;a.active<2&&a.queue.length>0;){let b=a.queue.shift();b&&g(b)}}function i(a,b){let c,f,h=e(),i=h.tasks.get(a);if(i)return i.promise;if(h.active>=2&&h.queue.length>=20)throw new d("Too many session title requests are waiting","title_queue_full");let j=new Promise((a,b)=>{c=a,f=b}),k={sessionId:a,controller:new AbortController,execute:b,promise:j,resolve:c,reject:f,state:"queued"};return h.tasks.set(a,k),h.active<2?g(k):h.queue.push(k),j}function j(a){let b=e(),c=b.tasks.get(a);if(!c)return!1;if(c.controller.abort(),"queued"===c.state){let d=b.queue.indexOf(c);d>=0&&b.queue.splice(d,1),b.tasks.delete(a),c.reject(f()),h()}return!0}},73024:a=>{a.exports=require("node:fs")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},77598:a=>{a.exports=require("node:crypto")},79495:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{gp:()=>l});var e=c(86123),f=c(67264),g=a([e]);e=(g.then?(await g)():g)[0];let m=`Create a concise title for this session based on the conversation above.
|
|
2
2
|
|
|
3
3
|
Requirements:
|
|
4
4
|
- Match the primary language used by the user.
|
|
@@ -8,4 +8,4 @@ Requirements:
|
|
|
8
8
|
- Return only the title as plain text, with no quotes, label, markdown, or explanation.`;function h(a){let b=a.content;if(!Array.isArray(b))return a;let c=i(b);return c===b?a:{...a,content:c}}function i(a){let b=!1,c=a.map(a=>"text"===a.type&&"string"!=typeof a.text?(b=!0,{...a,text:""}):a);return b?c:a}function j(){let a=Error("Session title generation was cancelled");return a.name="AbortError",a}async function k(a,b){let c,d;if(b?.aborted)throw j();try{await Promise.race([a.waitForIdle(),new Promise(a=>{c=setTimeout(a,1e4)}),...b?[new Promise((a,c)=>{d=()=>c(j()),b.addEventListener("abort",d,{once:!0})})]:[]])}finally{c&&clearTimeout(c),b&&d&&b.removeEventListener("abort",d)}}async function l(a,b,c){var d,g;let l,n,o,p,q=a.agent;await k(q,c);let r=q.state.messages,s=function(a){if(a.length<=40)return a;let b=a.length-40,c=a.slice(b);if(c.some(a=>"user"===a.role||"custom"===a.role&&"compaction"===a.customType))return c;for(let d=b-1;d>=0;d--){let b=a[d];if("user"===b.role||"custom"===b.role&&"compaction"===b.customType)return[b,...c.slice(1)]}return c}(r),t=(g=function(a){let b,c=[];for(let d=0;d<a.length;d++){let e=a[d];if("assistant"===e.role){let f=new Set;for(let b=d+1;b<a.length;b++){let c=a[b];if("toolResult"!==c.role)break;f.add(c.toolCallId)}b=new Set;let g=e.content.filter(a=>"toolCall"!==a.type||!!f.has(a.id)&&(b.add(a.id),!0));g.length>0&&c.push({...e,content:i(g)});continue}if("toolResult"===e.role){b?.delete(e.toolCallId)&&c.push(h(e));continue}b=void 0,c.push(h(e))}return c}(s),p=Math.max(0,8e3-m.length-32),[...g].reverse().map(a=>{let b=a.content;if("string"==typeof b){let c=p>0?b.slice(Math.max(0,b.length-p)):"";return p=Math.max(0,p-c.length),c===b?a:{...a,content:c}}if(!Array.isArray(b))return a;let c=!1,d=[...b].reverse().map(a=>{if(!a||"object"!=typeof a||"text"!==a.type)return a;let b="string"==typeof a.text?a.text:"",d=b.length>600?`${b.slice(0,600)}
|
|
9
9
|
…[truncated]`:b,e=p>0?d.slice(Math.max(0,d.length-p)):"";return p=Math.max(0,p-e.length),e!==b&&(c=!0),c||e!==b?{...a,text:e}:a}).reverse();return c?{...a,content:d}:a}).reverse()),u=t.length;if(!t.some(a=>"user"===a.role||"custom"===a.role&&"compaction"===a.customType))throw Error("The session has no user messages to name");let v=(l=(d=q).state,{initialState:{systemPrompt:void 0,model:l.model,thinkingLevel:l.thinkingLevel,tools:l.tools.map(a=>({...a,execute:async()=>{throw Error("Tools cannot be executed while generating a session title")}})),messages:l.messages},convertToLlm:d.convertToLlm,transformContext:d.transformContext,streamFn:d.streamFunction,getApiKey:d.getApiKey,onPayload:d.onPayload,onResponse:d.onResponse,steeringMode:d.steeringMode,followUpMode:d.followUpMode,sessionId:d.sessionId,thinkingBudgets:d.thinkingBudgets,transport:d.transport,maxRetryDelayMs:d.maxRetryDelayMs,toolExecution:d.toolExecution});b&&(v.initialState.model=b),v.initialState.messages=t;let w=t.at(-1)?.role==="user";w&&(v.initialState.messages=function(a){let b=a.at(-1);if(!b||"user"!==b.role)return a;let c="string"==typeof b.content?`${b.content}
|
|
10
10
|
|
|
11
|
-
${m}`:[...b.content,{type:"text",text:m}];return[...a.slice(0,-1),{...b,content:c}]}(t));let x=new e.Agent(v),y=w?x.continue():x.prompt(m);try{await Promise.race([y,new Promise((a,b)=>{n=setTimeout(()=>b(Error("Session title generation timed out")),8e4)}),...c?[new Promise((a,b)=>{o=()=>b(j()),c.addEventListener("abort",o,{once:!0})})]:[]])}catch(a){throw x.abort(),y.catch(()=>{}),await Promise.race([y.catch(()=>{}),new Promise(a=>setTimeout(a,5e3))]),a}finally{n&&clearTimeout(n),c&&o&&c.removeEventListener("abort",o)}let z=x.state.messages.slice(u);for(let a=z.length-1;a>=0;a--){let b=z[a];if("assistant"!==b.role)continue;if("error"===b.stopReason)throw Error(b.errorMessage||"The title model request failed");let c=b.content.filter(a=>"text"===a.type).map(a=>a.text).join("\n").trim();if(c)return{title:function(a){let b=a.trim(),c=b.match(/^```(?:json|text)?\s*([\s\S]*?)\s*```$/i);if(c&&(b=c[1].trim()),b.startsWith("{"))try{let a=JSON.parse(b);"string"==typeof a.title&&(b=a.title.trim())}catch{}if(b=(b=b.split(/\r?\n/,1)[0]??"").replace(/^(?:session\s+title|title|标题)\s*[::-]\s*/i,""),b=(b=(function(a){for(let[b,c]of[['"','"'],["'","'"],["`","`"],["“","”"],["「","」"],["『","』"]])if(a.startsWith(b)&&a.endsWith(c)&&a.length>b.length+c.length)return a.slice(b.length,-c.length).trim();return a})(b).replace(/\s+/g," ").trim()).replace(/[。.!]+$/u,"").trim(),b=(0,f.CS)(b),!/[\p{L}\p{N}]/u.test(b))throw Error("The model did not return a usable session title");let d=Array.from(b);return d.length>80&&(b=d.slice(0,80).join("").trim()),b}(c),...b.usage?{usage:{input:b.usage.input,output:b.usage.output,cacheRead:b.usage.cacheRead,cacheWrite:b.usage.cacheWrite,total:b.usage.totalTokens}}:{}}}throw Error("The model did not return a session title")}d()}catch(a){d(a)}})},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80481:a=>{a.exports=require("node:readline")},81115:a=>{a.exports=require("constants")},86123:a=>{a.exports=import("@earendil-works/pi-agent-core")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{a.exports=require("events")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,974,426,5138,5582,8904,6429],()=>b(b.s=
|
|
11
|
+
${m}`:[...b.content,{type:"text",text:m}];return[...a.slice(0,-1),{...b,content:c}]}(t));let x=new e.Agent(v),y=w?x.continue():x.prompt(m);try{await Promise.race([y,new Promise((a,b)=>{n=setTimeout(()=>b(Error("Session title generation timed out")),8e4)}),...c?[new Promise((a,b)=>{o=()=>b(j()),c.addEventListener("abort",o,{once:!0})})]:[]])}catch(a){throw x.abort(),y.catch(()=>{}),await Promise.race([y.catch(()=>{}),new Promise(a=>setTimeout(a,5e3))]),a}finally{n&&clearTimeout(n),c&&o&&c.removeEventListener("abort",o)}let z=x.state.messages.slice(u);for(let a=z.length-1;a>=0;a--){let b=z[a];if("assistant"!==b.role)continue;if("error"===b.stopReason)throw Error(b.errorMessage||"The title model request failed");let c=b.content.filter(a=>"text"===a.type).map(a=>a.text).join("\n").trim();if(c)return{title:function(a){let b=a.trim(),c=b.match(/^```(?:json|text)?\s*([\s\S]*?)\s*```$/i);if(c&&(b=c[1].trim()),b.startsWith("{"))try{let a=JSON.parse(b);"string"==typeof a.title&&(b=a.title.trim())}catch{}if(b=(b=b.split(/\r?\n/,1)[0]??"").replace(/^(?:session\s+title|title|标题)\s*[::-]\s*/i,""),b=(b=(function(a){for(let[b,c]of[['"','"'],["'","'"],["`","`"],["“","”"],["「","」"],["『","』"]])if(a.startsWith(b)&&a.endsWith(c)&&a.length>b.length+c.length)return a.slice(b.length,-c.length).trim();return a})(b).replace(/\s+/g," ").trim()).replace(/[。.!]+$/u,"").trim(),b=(0,f.CS)(b),!/[\p{L}\p{N}]/u.test(b))throw Error("The model did not return a usable session title");let d=Array.from(b);return d.length>80&&(b=d.slice(0,80).join("").trim()),b}(c),...b.usage?{usage:{input:b.usage.input,output:b.usage.output,cacheRead:b.usage.cacheRead,cacheWrite:b.usage.cacheWrite,total:b.usage.totalTokens}}:{}}}throw Error("The model did not return a session title")}d()}catch(a){d(a)}})},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80481:a=>{a.exports=require("node:readline")},81115:a=>{a.exports=require("constants")},86123:a=>{a.exports=import("@earendil-works/pi-agent-core")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},88507:(a,b,c)=>{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/sessions/[id]/auto-name/route",pathname:"/api/sessions/[id]/auto-name",filename:"route",bundlePath:"app/api/sessions/[id]/auto-name/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/sessions/[id]/auto-name/route.ts",nextConfigOutput:"standalone",userland:()=>c(25846),...{}}),{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/sessions/[id]/auto-name/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)}}},94735:a=>{a.exports=require("events")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,974,426,5138,5582,8904,6429],()=>b(b.s=88507));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var a={};a.id=6709,a.ids=[6709],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},6004:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>i});var e=c(23211),f=c(40402),g=c(56429),h=a([f,g]);async function i(a,{params:b}){let{id:c}=await b,d=new URL(a.url),h=d.searchParams.get("leafId")??void 0,j=d.searchParams.has("deferThinking"),k=d.searchParams.has("deferMedia"),l=Number(d.searchParams.get("tail")),m=Number.isFinite(l)&&l>0?Math.min(l,1e3):50,n=d.searchParams.get("before")??void 0;try{let a=(0,g.A4)(c),b=a?.isAlive()?a:void 0,d=b?null:await (0,f.os)(c);if(!b&&!d)return e.NextResponse.json({error:"Session not found"},{status:404});let i=b?.inner.sessionManager??(d?(0,f.D5)(d):void 0);if(!i)return e.NextResponse.json({error:"Session not found"},{status:404});let l=(0,f.Uv)(i.getEntries(),n??h,{deferThinking:j,deferToolResultImages:k,tail:m,excludeLeaf:!!n,sessionId:c});return e.NextResponse.json({context:l,tail:m,before:n??null})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}[f,g]=h.then?(await h)():h,d()}catch(a){d(a)}})},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},31421:a=>{a.exports=require("node:child_process")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},
|
|
1
|
+
"use strict";(()=>{var a={};a.id=6709,a.ids=[6709],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},6004:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>i});var e=c(23211),f=c(40402),g=c(56429),h=a([f,g]);async function i(a,{params:b}){let{id:c}=await b,d=new URL(a.url),h=d.searchParams.get("leafId")??void 0,j=d.searchParams.has("deferThinking"),k=d.searchParams.has("deferMedia"),l=Number(d.searchParams.get("tail")),m=Number.isFinite(l)&&l>0?Math.min(l,1e3):50,n=d.searchParams.get("before")??void 0;try{let a=(0,g.A4)(c),b=a?.isAlive()?a:void 0,d=b?null:await (0,f.os)(c);if(!b&&!d)return e.NextResponse.json({error:"Session not found"},{status:404});let i=b?.inner.sessionManager??(d?(0,f.D5)(d):void 0);if(!i)return e.NextResponse.json({error:"Session not found"},{status:404});let l=(0,f.Uv)(i.getEntries(),n??h,{deferThinking:j,deferToolResultImages:k,tail:m,excludeLeaf:!!n,sessionId:c});return e.NextResponse.json({context:l,tail:m,before:n??null})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}[f,g]=h.then?(await h)():h,d()}catch(a){d(a)}})},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},31421:a=>{a.exports=require("node:child_process")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},68299:(a,b,c)=>{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/sessions/[id]/context/route",pathname:"/api/sessions/[id]/context",filename:"route",bundlePath:"app/api/sessions/[id]/context/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/sessions/[id]/context/route.ts",nextConfigOutput:"standalone",userland:()=>c(6004),...{}}),{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/sessions/[id]/context/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)}}},73024:a=>{a.exports=require("node:fs")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80481:a=>{a.exports=require("node:readline")},81115:a=>{a.exports=require("constants")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{a.exports=require("events")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,974,426,5138,5582,8904,6429],()=>b(b.s=68299));module.exports=c})();
|