@calmabacus/pi-web 1.2.8 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +13 -11
- package/.next/build-manifest.json +2 -2
- package/.next/required-server-files.js +1 -1
- package/.next/required-server-files.json +1 -1
- package/.next/routes-manifest.json +14 -0
- package/.next/server/app/_global-error/page.js +2 -2
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +4 -4
- package/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/api/agent/[id]/bash-output/route.js +1 -1
- package/.next/server/app/api/agent/[id]/events/route.js +1 -1
- package/.next/server/app/api/agent/[id]/lease/route.js +1 -1
- package/.next/server/app/api/agent/[id]/route.js +1 -1
- package/.next/server/app/api/agent/new/route.js +1 -1
- package/.next/server/app/api/agent/running/route.js +1 -1
- package/.next/server/app/api/app-update/route.js +1 -1
- package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
- package/.next/server/app/api/auth/login/[provider]/route.js +2 -2
- package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
- package/.next/server/app/api/auth/providers/route.js +1 -1
- package/.next/server/app/api/cwd/browse/route.js +1 -1
- package/.next/server/app/api/cwd/validate/route.js +1 -1
- package/.next/server/app/api/default-cwd/route.js +1 -1
- package/.next/server/app/api/file-index/route.js +1 -1
- package/.next/server/app/api/files/[...path]/route.js +1 -1
- package/.next/server/app/api/git/diff/route.js +2 -2
- package/.next/server/app/api/git/status/route.js +1 -1
- package/.next/server/app/api/home/route.js +1 -1
- package/.next/server/app/api/image-generation/route.js +1 -1
- package/.next/server/app/api/image-generation/settings/connections/route.js +1 -1
- package/.next/server/app/api/image-generation/settings/route.js +1 -1
- package/.next/server/app/api/models/route.js +1 -1
- package/.next/server/app/api/models-config/catalog/route.js +1 -1
- package/.next/server/app/api/models-config/discover/route.js +1 -1
- package/.next/server/app/api/models-config/picker/route.js +1 -1
- package/.next/server/app/api/models-config/route.js +1 -1
- package/.next/server/app/api/models-config/runtime/route.js +1 -1
- package/.next/server/app/api/models-config/test/route.js +1 -1
- package/.next/server/app/api/plugins/check/route.js +1 -1
- package/.next/server/app/api/plugins/route.js +1 -1
- package/.next/server/app/api/project-overrides/route.js +1 -0
- package/.next/server/app/api/project-overrides/route.js.nft.json +1 -0
- package/.next/server/app/api/project-overrides/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/project-trust/route.js +1 -1
- package/.next/server/app/api/projects/route.js +1 -1
- package/.next/server/app/api/push/config/route.js +1 -1
- package/.next/server/app/api/push/subscribe/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/auto-name/route.js +2 -2
- package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/export/route.js +2 -2
- package/.next/server/app/api/sessions/[id]/outline/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/subagent-usage/route.js +1 -0
- package/.next/server/app/api/sessions/[id]/subagent-usage/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/[id]/subagent-usage/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/route.js +1 -1
- package/.next/server/app/api/sessions/search/route.js +1 -1
- package/.next/server/app/api/skills/check/route.js +1 -1
- package/.next/server/app/api/skills/check/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/install/route.js +1 -1
- package/.next/server/app/api/skills/route.js +2 -2
- package/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/search/route.js +1 -1
- package/.next/server/app/api/skills/update/route.js +1 -1
- package/.next/server/app/api/skills/update/route.js.nft.json +1 -1
- package/.next/server/app/api/subagents/[id]/route.js +1 -1
- package/.next/server/app/api/subagents/profiles/route.js +1 -1
- package/.next/server/app/api/subagents/settings/route.js +1 -1
- package/.next/server/app/api/terminal/[id]/events/route.js +1 -1
- package/.next/server/app/api/terminal/[id]/route.js +1 -1
- package/.next/server/app/api/terminal/route.js +1 -1
- package/.next/server/app/api/tools/settings/route.js +1 -1
- package/.next/server/app/api/usage/route.js +1 -1
- package/.next/server/app/api/web-auth/route.js +1 -1
- package/.next/server/app/api/worktrees/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +7 -7
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/index.segments/_full.segment.rsc +7 -7
- package/.next/server/app/index.segments/_tree.segment.rsc +4 -4
- package/.next/server/app/login/page.js +2 -2
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +5 -5
- package/.next/server/app/login.segments/_full.segment.rsc +5 -5
- package/.next/server/app/login.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +5 -5
- package/.next/server/app/manifest.webmanifest/route.js +2 -2
- package/.next/server/app/page.js +23 -22
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +13 -11
- package/.next/server/chunks/2243.js +1 -1
- package/.next/server/chunks/402.js +3 -2
- package/.next/server/chunks/4020.js +1 -0
- package/.next/server/chunks/6429.js +8 -6
- package/.next/server/chunks/7147.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware.js +4 -4
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/static/6f_3UIpNmHjU9Xn8SsAAi/_buildManifest.js +1 -0
- package/.next/static/chunks/2981-5abf1fdfdb963718.js +1 -0
- package/.next/static/chunks/app/_global-error/page-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/bash-output/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/events/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/lease/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/agent/new/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/agent/running/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/app-update/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/auth/login/[provider]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/auth/providers/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/cwd/browse/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/cwd/validate/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/default-cwd/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/file-index/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/files/[...path]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/git/diff/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/git/status/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/home/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/image-generation/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/image-generation/settings/connections/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/image-generation/settings/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/models/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/models-config/catalog/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/models-config/discover/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/models-config/picker/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/models-config/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/models-config/runtime/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/models-config/test/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/plugins/check/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/plugins/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/project-overrides/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/project-trust/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/projects/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/push/config/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/push/subscribe/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/context/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/export/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/outline/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/state/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/subagent-usage/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/sessions/search/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/skills/check/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/skills/install/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/skills/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/skills/search/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/skills/update/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/subagents/[id]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/subagents/profiles/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/subagents/settings/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/terminal/[id]/events/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/terminal/[id]/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/terminal/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/tools/settings/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/usage/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/web-auth/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/api/worktrees/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/{layout-abd03353f2b87156.js → layout-2c4104276f105978.js} +1 -1
- package/.next/static/chunks/app/manifest.webmanifest/route-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/app/page-8a658c191630cbd4.js +213 -0
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-be5d61c3d2d00f10.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-be5d61c3d2d00f10.js +1 -0
- package/.next/static/css/{f6c5c5c31909d266.css → 90f551ecf6f7f552.css} +1 -1
- package/.next/static/css/{1a6a041bd877a737.css → cdd9ca136f3e707d.css} +1 -1
- package/.next/static/css/eae95890104af950.css +1 -0
- package/.next/trace +9 -42
- package/.next/trace-build +1 -1
- package/.next/types/app/api/project-overrides/route.ts +353 -0
- package/.next/types/app/api/sessions/[id]/subagent-usage/route.ts +353 -0
- package/.next/types/routes.d.ts +3 -1
- package/.next/types/validator.ts +18 -0
- package/package.json +1 -1
- package/.next/static/JdASme3vlmmcq3bfLK3dJ/_buildManifest.js +0 -1
- package/.next/static/chunks/2981-3cdf8a2b6a7acda7.js +0 -1
- package/.next/static/chunks/app/_global-error/page-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/bash-output/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/events/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/lease/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/agent/new/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/agent/running/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/app-update/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/auth/login/[provider]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/auth/providers/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/cwd/browse/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/cwd/validate/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/default-cwd/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/file-index/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/files/[...path]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/git/diff/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/git/status/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/home/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/image-generation/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/image-generation/settings/connections/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/image-generation/settings/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/models/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/models-config/catalog/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/models-config/discover/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/models-config/picker/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/models-config/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/models-config/runtime/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/models-config/test/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/plugins/check/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/plugins/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/project-trust/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/projects/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/push/config/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/push/subscribe/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/context/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/export/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/outline/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/state/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/sessions/search/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/skills/check/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/skills/install/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/skills/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/skills/search/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/skills/update/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/subagents/[id]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/subagents/profiles/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/subagents/settings/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/terminal/[id]/events/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/terminal/[id]/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/terminal/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/tools/settings/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/usage/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/web-auth/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/api/worktrees/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/manifest.webmanifest/route-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/app/page-3c870fe5f7505e28.js +0 -212
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-65c0cd7526c36b6b.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-65c0cd7526c36b6b.js +0 -1
- package/.next/static/css/b121d2362092b3ab.css +0 -1
- /package/.next/static/{JdASme3vlmmcq3bfLK3dJ → 6f_3UIpNmHjU9Xn8SsAAi}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/api/project-overrides/route"]={"moduleLoading":{"prefix":"/_next/"},"ssrModuleMapping":{},"edgeSSRModuleMapping":{},"clientModules":{},"entryCSSFiles":{"/home/zhujunshen/pi-web/app/api/project-overrides/route":[]},"rscModuleMapping":{},"edgeRscModuleMapping":{}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=1960,a.ids=[1960],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},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")},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")},12412:a=>{"use strict";a.exports=require("assert")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},24979:(a,b,c)=>{"use strict";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.B7)(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.hasBusyRpcSessionForCwd)(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.kn)(),await (0,l.destroyRpcSessionsForCwd)(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=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{"use strict";a.exports=import("@earendil-works/pi-tui")},31421:a=>{"use strict";a.exports=require("node:child_process")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},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")},72322:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/utils/pi-user-agent")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},80547:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")},96265:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/project-trust/route",pathname:"/api/project-trust",filename:"route",bundlePath:"app/api/project-trust/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/project-trust/route.ts",nextConfigOutput:"",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)}}},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,974,402,6759,2243,6429],()=>b(b.s=96265));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=1960,a.ids=[1960],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},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")},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")},12412:a=>{"use strict";a.exports=require("assert")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},24979:(a,b,c)=>{"use strict";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.B7)(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.hasBusyRpcSessionForCwd)(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.kn)(),await (0,l.destroyRpcSessionsForCwd)(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=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{"use strict";a.exports=import("@earendil-works/pi-tui")},31421:a=>{"use strict";a.exports=require("node:child_process")},31523:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/project-trust/route",pathname:"/api/project-trust",filename:"route",bundlePath:"app/api/project-trust/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/project-trust/route.ts",nextConfigOutput:"",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)}}},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},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")},72322:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/utils/pi-user-agent")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},80547:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,974,402,6759,2243,6429],()=>b(b.s=31523));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=64,a.ids=[64],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4479:(a,b,c)=>{"use strict";function d(a){return a.projectKey??a.projectRoot??a.cwd}c.d(b,{_:()=>d})},4573:a=>{"use strict";a.exports=require("node:buffer")},6093:(a,b,c)=>{"use strict";c.d(b,{EL:()=>e});let d=a=>String(a).padStart(2,"0"),e=a=>`${a.getFullYear()}-${d(a.getMonth()+1)}-${d(a.getDate())}`},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")},12412:a=>{"use strict";a.exports=require("assert")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21906:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{CQ:()=>l,GW:()=>n,JS:()=>m});var e=c(55511),f=c(29021),g=c(33873),h=c(45902),i=c(7048),j=c(74313),k=a([i,j]);function l(a){let b=(0,f.readFileSync)(a,"utf8"),c=b.split("\n"),d=c.map(a=>{if(!a.trim())return null;try{return JSON.parse(a)}catch{return null}}),e=d[0];if(e?.type!=="session"||"string"!=typeof e.id)return null;let g=d.slice(1).filter(a=>null!==a);return{path:a,pathKey:(0,h.$)(a),id:e.id,parentPath:"string"==typeof e.parentSession?e.parentSession:void 0,lines:c,entries:g,original:b,isSubagent:!!(0,i.$u)(g,e.id,a)}}function m(a,b,c){let d=[...a.lines],e=JSON.parse(d[0]);if(b?e.parentSession=b:delete e.parentSession,d[0]=JSON.stringify(e),a.isSubagent){if(!b||!c)throw Error("Cannot reparent a subagent without a valid parent session");for(let a=1;a<d.length;a+=1){let e;try{e=JSON.parse(d[a])}catch{continue}"custom"!==e.type||e.customType!==i.tP||"object"!=typeof e.data||null===e.data||Array.isArray(e.data)||(e.data={...e.data,parentSessionId:c,parentSessionPath:b},d[a]=JSON.stringify(e))}}return d.join("\n")}function n(a){try{(0,j.H2)(a)}catch{}let b=[];try{for(let c of a){if(!(0,f.existsSync)(c))continue;let a=(0,g.join)((0,g.dirname)(c),`.${(0,g.basename)(c)}-${(0,e.randomUUID)()}.deleting`);try{(0,f.renameSync)(c,a)}catch(a){if("ENOENT"===a.code)continue;throw a}b.push({original:c,staged:a})}}catch(a){for(let a of b.reverse())try{(0,f.renameSync)(a.staged,a.original)}catch{}throw a}for(let a of b)try{(0,f.unlinkSync)(a.staged)}catch{}}[i,j]=k.then?(await k)():k,d()}catch(a){d(a)}})},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{"use strict";a.exports=import("@earendil-works/pi-tui")},31421:a=>{"use strict";a.exports=require("node:child_process")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},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")},72322:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/utils/pi-user-agent")},73024:a=>{"use strict";a.exports=require("node:fs")},74313:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{H2:()=>w,O6:()=>n,o7:()=>v,xh:()=>u});var e=c(29021),f=c(79748),g=c(33873),h=c(75430),i=c(8102),j=c(45902),k=c(6093),l=a([h]);function m(a){let b,c=a.split("\n");try{b=JSON.parse(c[0])}catch{return{cwd:"",rows:[]}}let d="string"==typeof b.cwd?b.cwd:"",e=Date.parse(b.timestamp??"");if(!Number.isFinite(e))return{cwd:d,rows:[]};let f=new Map;for(let a of c){let b;if(!a.includes('"usage"'))continue;try{b=JSON.parse(a)}catch{continue}let c=b.message,d=c?.usage;if(c?.role!=="assistant"||!d)continue;let g="number"==typeof c.timestamp?c.timestamp:Date.parse(b.timestamp??"");if(!Number.isFinite(g)||g<e)continue;let h=new Date(g),i=(0,k.EL)(h),j=h.getHours(),l=String(c.provider??""),m=String(c.model??""),n=`${i}\0${j}\0${l}\0${m}`,o=f.get(n);o||(o={day:i,hour:j,provider:l,model:m,messages:0,input:0,output:0,cacheRead:0,cacheWrite:0,recordedCost:0},f.set(n,o)),o.messages+=1,o.input+=d.input??0,o.output+=d.output??0,o.cacheRead+=d.cacheRead??0,o.cacheWrite+=d.cacheWrite??0,o.recordedCost+=d.cost?.total??0}return{cwd:d,rows:[...f.values()]}}function n(a,b,c){let d=new Map,e=new Map;for(let f of a){let a=c(f.cwd);for(let c of f.rows){let f=`${c.provider}\0${c.model}`;d.has(f)||d.set(f,b(c.provider,c.model));let g=d.get(f),h=c.hour??null,i=c.model.slice(c.model.lastIndexOf("/")+1),j=`${c.day}\0${h}\0${i}\0${a}`,k=e.get(j);k||(k={day:c.day,hour:h,model:i,project:a,messages:0,input:0,output:0,cacheRead:0,cacheWrite:0,cost:0,unpriced:0},e.set(j,k)),k.messages+=c.messages,k.input+=c.input,k.output+=c.output,k.cacheRead+=c.cacheRead,k.cacheWrite+=c.cacheWrite,k.cost+=g?(c.input*g.input+c.output*g.output+c.cacheRead*g.cacheRead+c.cacheWrite*g.cacheWrite)/1e6:c.recordedCost,g||0!==c.recordedCost||(k.unpriced+=c.messages)}}return[...e.values()]}function o(){return(0,g.join)((0,h.getAgentDir)(),"pi-web-usage-cache.json")}function p(){try{let a=JSON.parse((0,e.readFileSync)(o(),"utf8"));if(!a.files)return new Map;if(2===a.version)return new Map(Object.entries(a.files));if(1===a.version)return new Map(Object.entries(a.files).map(([a,{size:b,mtimeMs:c,rows:d}])=>[a,{size:b,mtimeMs:c,rows:d}]))}catch{}return new Map}function q(){return globalThis.__piUsageCache??=p()}function r(a){for(let[b,c]of p())a.has(b)||a.set(b,c);(0,i.$)(o(),JSON.stringify({version:2,files:Object.fromEntries(a)}))}h=(l.then?(await l)():l)[0];let x=(a,b,c)=>void 0!==a&&void 0!==a.cwd&&a.size===b&&a.mtimeMs===c;async function s(){let a=(0,g.join)((0,h.getAgentDir)(),"sessions");try{return(await (0,f.readdir)(a,{recursive:!0})).filter(a=>a.endsWith(".jsonl")).map(b=>(0,g.join)(a,b))}catch{return[]}}async function t(a,b){let c=q(),d=(await Promise.all((await s()).map(async a=>{try{let{size:b,mtimeMs:c}=await (0,f.stat)(a);return{path:a,key:(0,j.$)(a),size:b,mtimeMs:c}}catch{return null}}))).filter(a=>null!==a&&!x(c.get(a.key),a.size,a.mtimeMs));for(let e of(a.total=d.length,b(),d)){try{c.set(e.key,{size:e.size,mtimeMs:e.mtimeMs,...m(await (0,f.readFile)(e.path,"utf8"))})}catch{}a.done+=1}d.length>0&&r(c)}function u(){let a;if(globalThis.__piUsageScanState)return globalThis.__piUsageScanState;let b={done:0,total:0,planned:new Promise(b=>{a=b}),promise:Promise.resolve()};return b.promise=t(b,a).finally(()=>{a(),globalThis.__piUsageScanState=void 0}),globalThis.__piUsageScanState=b}function v(){return[...q().values()].map(a=>({cwd:a.cwd??"",rows:a.rows}))}function w(a){let b=q(),c=!1;for(let d of a){if(!(0,e.existsSync)(d))continue;let a=(0,j.$)(d),{size:f,mtimeMs:g}=(0,e.statSync)(d);x(b.get(a),f,g)||(b.set(a,{size:f,mtimeMs:g,...m((0,e.readFileSync)(d,"utf8"))}),c=!0)}c&&r(b)}d()}catch(a){d(a)}})},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},81115:a=>{"use strict";a.exports=require("constants")},84187:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>m});var e=c(23211),f=c(29021),g=c(40402),h=c(56429),i=c(4479),j=c(8102),k=c(21906),l=a([g,h,k]);async function m(a){let{projectKey:b}=await a.json().catch(()=>({}));if("string"!=typeof b||!b)return e.NextResponse.json({error:"projectKey is required"},{status:400});try{let a=await (0,g.dQ)({force:!0}),c=a.filter(a=>(0,i._)(a)===b&&(0,f.existsSync)(a.path));if(0===c.length)return e.NextResponse.json({error:"Project not found"},{status:404});let d=new Set(c.map(a=>a.id)),l=a.filter(a=>!d.has(a.id)&&a.parentSessionId&&d.has(a.parentSessionId)&&(0,f.existsSync)(a.path)),m=a=>{let b=(0,k.CQ)(a);if(!b)throw Error(`Unreadable session file: ${a}`);return b},n=c.map(a=>m(a.path)),o=l.map(a=>m(a.path));if(o.some(a=>a.isSubagent))return e.NextResponse.json({error:"A subagent outside this project depends on it"},{status:409});let p=[...n,...o],q=await (0,h.reserveRpcSessionFileMutation)(p.map(a=>a.id));if(!q)return e.NextResponse.json({error:"A session in this project is running"},{status:409});try{if(p.some(a=>{try{return(0,f.readFileSync)(a.path,"utf8")!==a.original}catch{return!0}}))return e.NextResponse.json({error:"Sessions changed while preparing deletion"},{status:409});let a=o.map(a=>({record:a,updated:(0,k.JS)(a,void 0,void 0)})),b=[];try{for(let{record:c,updated:d}of a)(0,j.$)(c.path,d),b.push(c);(0,k.GW)(n.map(a=>a.path))}catch(a){for(let a of b.reverse())try{(0,j.$)(a.path,a.original)}catch{}throw a}for(let a of n)(0,g.BR)(a.id);return(0,g.mD)(),e.NextResponse.json({deletedSessionIds:n.map(a=>a.id)})}finally{q()}}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}[g,h,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")},96467:(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/projects/route",pathname:"/api/projects",filename:"route",bundlePath:"app/api/projects/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/projects/route.ts",nextConfigOutput:"",userland:()=>c(84187),...{}}),{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/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,426,974,402,6759,2243,6429],()=>b(b.s=96467));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=64,a.ids=[64],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4479:(a,b,c)=>{"use strict";function d(a){return a.projectKey??a.projectRoot??a.cwd}c.d(b,{_:()=>d})},4573:a=>{"use strict";a.exports=require("node:buffer")},6093:(a,b,c)=>{"use strict";c.d(b,{EL:()=>e});let d=a=>String(a).padStart(2,"0"),e=a=>`${a.getFullYear()}-${d(a.getMonth()+1)}-${d(a.getDate())}`},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")},12412:a=>{"use strict";a.exports=require("assert")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21906:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{CQ:()=>l,GW:()=>n,JS:()=>m});var e=c(55511),f=c(29021),g=c(33873),h=c(45902),i=c(7048),j=c(74313),k=a([i,j]);function l(a){let b=(0,f.readFileSync)(a,"utf8"),c=b.split("\n"),d=c.map(a=>{if(!a.trim())return null;try{return JSON.parse(a)}catch{return null}}),e=d[0];if(e?.type!=="session"||"string"!=typeof e.id)return null;let g=d.slice(1).filter(a=>null!==a);return{path:a,pathKey:(0,h.$)(a),id:e.id,parentPath:"string"==typeof e.parentSession?e.parentSession:void 0,lines:c,entries:g,original:b,isSubagent:!!(0,i.$u)(g,e.id,a)}}function m(a,b,c){let d=[...a.lines],e=JSON.parse(d[0]);if(b?e.parentSession=b:delete e.parentSession,d[0]=JSON.stringify(e),a.isSubagent){if(!b||!c)throw Error("Cannot reparent a subagent without a valid parent session");for(let a=1;a<d.length;a+=1){let e;try{e=JSON.parse(d[a])}catch{continue}"custom"!==e.type||e.customType!==i.tP||"object"!=typeof e.data||null===e.data||Array.isArray(e.data)||(e.data={...e.data,parentSessionId:c,parentSessionPath:b},d[a]=JSON.stringify(e))}}return d.join("\n")}function n(a){try{(0,j.H2)(a)}catch{}let b=[];try{for(let c of a){if(!(0,f.existsSync)(c))continue;let a=(0,g.join)((0,g.dirname)(c),`.${(0,g.basename)(c)}-${(0,e.randomUUID)()}.deleting`);try{(0,f.renameSync)(c,a)}catch(a){if("ENOENT"===a.code)continue;throw a}b.push({original:c,staged:a})}}catch(a){for(let a of b.reverse())try{(0,f.renameSync)(a.staged,a.original)}catch{}throw a}for(let a of b)try{(0,f.unlinkSync)(a.staged)}catch{}}[i,j]=k.then?(await k)():k,d()}catch(a){d(a)}})},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{"use strict";a.exports=import("@earendil-works/pi-tui")},31421:a=>{"use strict";a.exports=require("node:child_process")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},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")},72322:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/utils/pi-user-agent")},73024:a=>{"use strict";a.exports=require("node:fs")},73065:(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/projects/route",pathname:"/api/projects",filename:"route",bundlePath:"app/api/projects/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/projects/route.ts",nextConfigOutput:"",userland:()=>c(84187),...{}}),{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/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)}}},74313:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{H2:()=>w,O6:()=>n,o7:()=>v,xh:()=>u});var e=c(29021),f=c(79748),g=c(33873),h=c(75430),i=c(8102),j=c(45902),k=c(6093),l=a([h]);function m(a){let b,c=a.split("\n");try{b=JSON.parse(c[0])}catch{return{cwd:"",rows:[]}}let d="string"==typeof b.cwd?b.cwd:"",e=Date.parse(b.timestamp??"");if(!Number.isFinite(e))return{cwd:d,rows:[]};let f=new Map;for(let a of c){let b;if(!a.includes('"usage"'))continue;try{b=JSON.parse(a)}catch{continue}let c=b.message,d=c?.usage;if(c?.role!=="assistant"||!d)continue;let g="number"==typeof c.timestamp?c.timestamp:Date.parse(b.timestamp??"");if(!Number.isFinite(g)||g<e)continue;let h=new Date(g),i=(0,k.EL)(h),j=h.getHours(),l=String(c.provider??""),m=String(c.model??""),n=`${i}\0${j}\0${l}\0${m}`,o=f.get(n);o||(o={day:i,hour:j,provider:l,model:m,messages:0,input:0,output:0,cacheRead:0,cacheWrite:0,recordedCost:0},f.set(n,o)),o.messages+=1,o.input+=d.input??0,o.output+=d.output??0,o.cacheRead+=d.cacheRead??0,o.cacheWrite+=d.cacheWrite??0,o.recordedCost+=d.cost?.total??0}return{cwd:d,rows:[...f.values()]}}function n(a,b,c){let d=new Map,e=new Map;for(let f of a){let a=c(f.cwd);for(let c of f.rows){let f=`${c.provider}\0${c.model}`;d.has(f)||d.set(f,b(c.provider,c.model));let g=d.get(f),h=c.hour??null,i=c.model.slice(c.model.lastIndexOf("/")+1),j=`${c.day}\0${h}\0${i}\0${a}`,k=e.get(j);k||(k={day:c.day,hour:h,model:i,project:a,messages:0,input:0,output:0,cacheRead:0,cacheWrite:0,cost:0,unpriced:0},e.set(j,k)),k.messages+=c.messages,k.input+=c.input,k.output+=c.output,k.cacheRead+=c.cacheRead,k.cacheWrite+=c.cacheWrite,k.cost+=g?(c.input*g.input+c.output*g.output+c.cacheRead*g.cacheRead+c.cacheWrite*g.cacheWrite)/1e6:c.recordedCost,g||0!==c.recordedCost||(k.unpriced+=c.messages)}}return[...e.values()]}function o(){return(0,g.join)((0,h.getAgentDir)(),"pi-web-usage-cache.json")}function p(){try{let a=JSON.parse((0,e.readFileSync)(o(),"utf8"));if(!a.files)return new Map;if(2===a.version)return new Map(Object.entries(a.files));if(1===a.version)return new Map(Object.entries(a.files).map(([a,{size:b,mtimeMs:c,rows:d}])=>[a,{size:b,mtimeMs:c,rows:d}]))}catch{}return new Map}function q(){return globalThis.__piUsageCache??=p()}function r(a){for(let[b,c]of p())a.has(b)||a.set(b,c);(0,i.$)(o(),JSON.stringify({version:2,files:Object.fromEntries(a)}))}h=(l.then?(await l)():l)[0];let x=(a,b,c)=>void 0!==a&&void 0!==a.cwd&&a.size===b&&a.mtimeMs===c;async function s(){let a=(0,g.join)((0,h.getAgentDir)(),"sessions");try{return(await (0,f.readdir)(a,{recursive:!0})).filter(a=>a.endsWith(".jsonl")).map(b=>(0,g.join)(a,b))}catch{return[]}}async function t(a,b){let c=q(),d=(await Promise.all((await s()).map(async a=>{try{let{size:b,mtimeMs:c}=await (0,f.stat)(a);return{path:a,key:(0,j.$)(a),size:b,mtimeMs:c}}catch{return null}}))).filter(a=>null!==a&&!x(c.get(a.key),a.size,a.mtimeMs));for(let e of(a.total=d.length,b(),d)){try{c.set(e.key,{size:e.size,mtimeMs:e.mtimeMs,...m(await (0,f.readFile)(e.path,"utf8"))})}catch{}a.done+=1}d.length>0&&r(c)}function u(){let a;if(globalThis.__piUsageScanState)return globalThis.__piUsageScanState;let b={done:0,total:0,planned:new Promise(b=>{a=b}),promise:Promise.resolve()};return b.promise=t(b,a).finally(()=>{a(),globalThis.__piUsageScanState=void 0}),globalThis.__piUsageScanState=b}function v(){return[...q().values()].map(a=>({cwd:a.cwd??"",rows:a.rows}))}function w(a){let b=q(),c=!1;for(let d of a){if(!(0,e.existsSync)(d))continue;let a=(0,j.$)(d),{size:f,mtimeMs:g}=(0,e.statSync)(d);x(b.get(a),f,g)||(b.set(a,{size:f,mtimeMs:g,...m((0,e.readFileSync)(d,"utf8"))}),c=!0)}c&&r(b)}d()}catch(a){d(a)}})},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},81115:a=>{"use strict";a.exports=require("constants")},84187:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>m});var e=c(23211),f=c(29021),g=c(40402),h=c(56429),i=c(4479),j=c(8102),k=c(21906),l=a([g,h,k]);async function m(a){let{projectKey:b}=await a.json().catch(()=>({}));if("string"!=typeof b||!b)return e.NextResponse.json({error:"projectKey is required"},{status:400});try{let a=await (0,g.dQ)({force:!0}),c=a.filter(a=>(0,i._)(a)===b&&(0,f.existsSync)(a.path));if(0===c.length)return e.NextResponse.json({error:"Project not found"},{status:404});let d=new Set(c.map(a=>a.id)),l=a.filter(a=>!d.has(a.id)&&a.parentSessionId&&d.has(a.parentSessionId)&&(0,f.existsSync)(a.path)),m=a=>{let b=(0,k.CQ)(a);if(!b)throw Error(`Unreadable session file: ${a}`);return b},n=c.map(a=>m(a.path)),o=l.map(a=>m(a.path));if(o.some(a=>a.isSubagent))return e.NextResponse.json({error:"A subagent outside this project depends on it"},{status:409});let p=[...n,...o],q=await (0,h.reserveRpcSessionFileMutation)(p.map(a=>a.id));if(!q)return e.NextResponse.json({error:"A session in this project is running"},{status:409});try{if(p.some(a=>{try{return(0,f.readFileSync)(a.path,"utf8")!==a.original}catch{return!0}}))return e.NextResponse.json({error:"Sessions changed while preparing deletion"},{status:409});let a=o.map(a=>({record:a,updated:(0,k.JS)(a,void 0,void 0)})),b=[];try{for(let{record:c,updated:d}of a)(0,j.$)(c.path,d),b.push(c);(0,k.GW)(n.map(a=>a.path))}catch(a){for(let a of b.reverse())try{(0,j.$)(a.path,a.original)}catch{}throw a}for(let a of n)(0,g.BR)(a.id);return(0,g.mD)(),e.NextResponse.json({deletedSessionIds:n.map(a=>a.id)})}finally{q()}}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}[g,h,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,974,402,6759,2243,6429],()=>b(b.s=73065));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=1124,a.ids=[1124],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},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")},
|
|
1
|
+
(()=>{var a={};a.id=1124,a.ids=[1124],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},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")},10897:(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/push/config/route",pathname:"/api/push/config",filename:"route",bundlePath:"app/api/push/config/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/push/config/route.ts",nextConfigOutput:"",userland:()=>c(64834),...{}}),{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/push/config/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)}}},19225:(a,b,c)=>{"use strict";a.exports=c(44870)},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64834:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>g,dynamic:()=>h});var e=c(92243),f=a([e]);e=(f.then?(await f)():f)[0];let h="force-dynamic";async function g(){let a=await (0,e.HR)();return Response.json({publicKey:a})}d()}catch(a){d(a)}})},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},92280:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(28208),e=c(47617),f=c(62018);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,426,402,2243],()=>b(b.s=10897));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=243,a.ids=[243],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},4742:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>g,dynamic:()=>h});var e=c(92243),f=a([e]);e=(f.then?(await f)():f)[0];let h="force-dynamic";async function g(a){let b;try{b=await a.json()}catch{return Response.json({error:"Invalid JSON body"},{status:400})}if(!function(a){if("object"!=typeof a||null===a||"string"!=typeof a.endpoint||!/^https:\/\//.test(a.endpoint))return!1;let b=a.keys;return"object"==typeof b&&null!==b&&"string"==typeof b.p256dh&&b.p256dh.length>0&&"string"==typeof b.auth&&b.auth.length>0}(b.subscription))return Response.json({error:"Invalid push subscription"},{status:400});let c="zh-CN"===b.locale?"zh-CN":"en";return await (0,e.hO)({endpoint:b.subscription.endpoint,keys:b.subscription.keys,locale:c}),Response.json({ok:!0})}d()}catch(a){d(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")},19225:(a,b,c)=>{"use strict";a.exports=c(44870)},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},
|
|
1
|
+
(()=>{var a={};a.id=243,a.ids=[243],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},4742:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>g,dynamic:()=>h});var e=c(92243),f=a([e]);e=(f.then?(await f)():f)[0];let h="force-dynamic";async function g(a){let b;try{b=await a.json()}catch{return Response.json({error:"Invalid JSON body"},{status:400})}if(!function(a){if("object"!=typeof a||null===a||"string"!=typeof a.endpoint||!/^https:\/\//.test(a.endpoint))return!1;let b=a.keys;return"object"==typeof b&&null!==b&&"string"==typeof b.p256dh&&b.p256dh.length>0&&"string"==typeof b.auth&&b.auth.length>0}(b.subscription))return Response.json({error:"Invalid push subscription"},{status:400});let c="zh-CN"===b.locale?"zh-CN":"en";return await (0,e.hO)({endpoint:b.subscription.endpoint,keys:b.subscription.keys,locale:c}),Response.json({ok:!0})}d()}catch(a){d(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")},19225:(a,b,c)=>{"use strict";a.exports=c(44870)},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},57563:(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/push/subscribe/route",pathname:"/api/push/subscribe",filename:"route",bundlePath:"app/api/push/subscribe/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/push/subscribe/route.ts",nextConfigOutput:"",userland:()=>c(4742),...{}}),{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/push/subscribe/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},92280:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(28208),e=c(47617),f=c(62018);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,426,402,2243],()=>b(b.s=57563));module.exports=c})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var a={};a.id=2835,a.ids=[2835],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},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")},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")},12412:a=>{"use strict";a.exports=require("assert")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},25846:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>j});var e=c(23211),f=c(79495),g=c(56429),h=c(40402),i=a([f,g,h]);async function j(a,{params:b}){let{id:c}=await b;try{let a=(0,g.getRpcSession)(c),b=a?.sessionFile||await (0,h.os)(c);if(!a?.isAlive()&&!b)return e.NextResponse.json({error:"Session not found"},{status:404});let{session:d}=a?.isAlive()?{session:a}:await (0,g.startRpcSession)(c,b,void 0);await d.waitUntilReady?.();let i=await (0,f.gp)(d.inner);if(!d.isAlive())return e.NextResponse.json({error:"The session was closed while its title was being generated. Please try again."},{status:409});return d.inner.setSessionName(i.title),(0,h.mD)(),e.NextResponse.json({title:i.title,usage:i.usage??null})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}[f,g,h]=i.then?(await i)():i,d()}catch(a){d(a)}})},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{"use strict";a.exports=import("@earendil-works/pi-tui")},31421:a=>{"use strict";a.exports=require("node:child_process")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},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")},72322:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/utils/pi-user-agent")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},79495:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{gp:()=>g});var e=c(86123),f=a([e]);e=(f.then?(await f)():f)[0];let h=`Create a concise title for this session based on the conversation above.
|
|
1
|
+
(()=>{var a={};a.id=2835,a.ids=[2835],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},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")},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")},12412:a=>{"use strict";a.exports=require("assert")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},25846:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>j});var e=c(23211),f=c(79495),g=c(56429),h=c(40402),i=a([f,g,h]);async function j(a,{params:b}){let{id:c}=await b;try{let a=(0,g.getRpcSession)(c),b=a?.sessionFile||await (0,h.os)(c);if(!a?.isAlive()&&!b)return e.NextResponse.json({error:"Session not found"},{status:404});let{session:d}=a?.isAlive()?{session:a}:await (0,g.startRpcSession)(c,b,void 0);await d.waitUntilReady?.();let i=await (0,f.gp)(d.inner);if(!d.isAlive())return e.NextResponse.json({error:"The session was closed while its title was being generated. Please try again."},{status:409});return d.inner.setSessionName(i.title),(0,h.mD)(),e.NextResponse.json({title:i.title,usage:i.usage??null})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}[f,g,h]=i.then?(await i)():i,d()}catch(a){d(a)}})},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{"use strict";a.exports=import("@earendil-works/pi-tui")},31421:a=>{"use strict";a.exports=require("node:child_process")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},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")},67649:(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/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:"/home/zhujunshen/pi-web/app/api/sessions/[id]/auto-name/route.ts",nextConfigOutput:"",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)}}},72322:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/utils/pi-user-agent")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},79495:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{gp:()=>g});var e=c(86123),f=a([e]);e=(f.then?(await f)():f)[0];let h=`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.
|
|
@@ -7,4 +7,4 @@ Requirements:
|
|
|
7
7
|
- Do not call any tools.
|
|
8
8
|
- Return only the title as plain text, with no quotes, label, markdown, or explanation.`;async function g(a){var b;let c,d,f=a.agent;await f.waitForIdle();let 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:g});continue}if("toolResult"===e.role){b?.delete(e.toolCallId)&&c.push(e);continue}b=void 0,c.push(e)}return c}(f.state.messages),i=g.length;if(!g.some(a=>"user"===a.role||"compactionSummary"===a.role))throw Error("The session has no user messages to name");let j={initialState:{systemPrompt:(c=(b=f).state).systemPrompt,model:c.model,thinkingLevel:c.thinkingLevel,tools:c.tools.map(a=>({...a,execute:async()=>{throw Error("Tools cannot be executed while generating a session title")}})),messages:c.messages},convertToLlm:b.convertToLlm,transformContext:b.transformContext,streamFn:b.streamFunction,getApiKey:b.getApiKey,onPayload:b.onPayload,onResponse:b.onResponse,steeringMode:b.steeringMode,followUpMode:b.followUpMode,sessionId:b.sessionId,thinkingBudgets:b.thinkingBudgets,transport:b.transport,maxRetryDelayMs:b.maxRetryDelayMs,toolExecution:b.toolExecution};j.initialState.messages=g;let k=g.at(-1)?.role==="user";k&&(j.initialState.messages=function(a){let b=a.at(-1);if(!b||"user"!==b.role)return a;let c="string"==typeof b.content?`${b.content}
|
|
9
9
|
|
|
10
|
-
${h}`:[...b.content,{type:"text",text:h}];return[...a.slice(0,-1),{...b,content:c}]}(g));let l=new e.Agent(j),m=k?l.continue():l.prompt(h);try{await Promise.race([m,new Promise((a,b)=>{d=setTimeout(()=>{l.abort(),b(Error("Session title generation timed out"))},9e4)})])}catch(a){throw l.abort(),await m.catch(()=>{}),a}finally{d&&clearTimeout(d)}let n=l.state.messages.slice(i);for(let a=n.length-1;a>=0;a--){let b=n[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(),!/[\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=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},81115:a=>{"use strict";a.exports=require("constants")},86123:a=>{"use strict";a.exports=import("@earendil-works/pi-agent-core")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{}
|
|
10
|
+
${h}`:[...b.content,{type:"text",text:h}];return[...a.slice(0,-1),{...b,content:c}]}(g));let l=new e.Agent(j),m=k?l.continue():l.prompt(h);try{await Promise.race([m,new Promise((a,b)=>{d=setTimeout(()=>{l.abort(),b(Error("Session title generation timed out"))},9e4)})])}catch(a){throw l.abort(),await m.catch(()=>{}),a}finally{d&&clearTimeout(d)}let n=l.state.messages.slice(i);for(let a=n.length-1;a>=0;a--){let b=n[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(),!/[\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=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},81115:a=>{"use strict";a.exports=require("constants")},86123:a=>{"use strict";a.exports=import("@earendil-works/pi-agent-core")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,974,402,6759,2243,6429],()=>b(b.s=67649));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=6709,a.ids=[6709],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},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")},6004:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>j});var e=c(23211),f=c(75430),g=c(40402),h=c(56429),i=a([f,g,h]);async function j(a,{params:b}){let{id:c}=await b,d=new URL(a.url),i=d.searchParams.get("leafId")??void 0,k=d.searchParams.has("deferThinking"),l=d.searchParams.has("deferMedia"),m=Number(d.searchParams.get("tail")),n=Number.isFinite(m)&&m>0?Math.min(m,1e3):200,o=d.searchParams.get("before")??void 0;try{let a=(0,h.getRpcSession)(c),b=a?.isAlive()?a:void 0,d=b?null:await (0,g.os)(c);if(!b&&!d)return e.NextResponse.json({error:"Session not found"},{status:404});let j=b?.inner.sessionManager??f.SessionManager.open(d),m=(0,g.Uv)(j.getEntries(),o??i,{deferThinking:k,deferToolResultImages:l,tail:n,excludeLeaf:!!o,sessionId:c});return e.NextResponse.json({context:m,tail:n,before:o??null})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}[f,g,h]=i.then?(await i)():i,d()}catch(a){d(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")},12412:a=>{"use strict";a.exports=require("assert")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{"use strict";a.exports=import("@earendil-works/pi-tui")},31421:a=>{"use strict";a.exports=require("node:child_process")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},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")},72322:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/utils/pi-user-agent")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94683:(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/sessions/[id]/context/route",pathname:"/api/sessions/[id]/context",filename:"route",bundlePath:"app/api/sessions/[id]/context/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/sessions/[id]/context/route.ts",nextConfigOutput:"",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)}}},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,974,402,6759,2243,6429],()=>b(b.s=94683));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=6709,a.ids=[6709],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},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")},6004:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>j});var e=c(23211),f=c(75430),g=c(40402),h=c(56429),i=a([f,g,h]);async function j(a,{params:b}){let{id:c}=await b,d=new URL(a.url),i=d.searchParams.get("leafId")??void 0,k=d.searchParams.has("deferThinking"),l=d.searchParams.has("deferMedia"),m=Number(d.searchParams.get("tail")),n=Number.isFinite(m)&&m>0?Math.min(m,1e3):200,o=d.searchParams.get("before")??void 0;try{let a=(0,h.getRpcSession)(c),b=a?.isAlive()?a:void 0,d=b?null:await (0,g.os)(c);if(!b&&!d)return e.NextResponse.json({error:"Session not found"},{status:404});let j=b?.inner.sessionManager??f.SessionManager.open(d),m=(0,g.Uv)(j.getEntries(),o??i,{deferThinking:k,deferToolResultImages:l,tail:n,excludeLeaf:!!o,sessionId:c});return e.NextResponse.json({context:m,tail:n,before:o??null})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}[f,g,h]=i.then?(await i)():i,d()}catch(a){d(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")},12412:a=>{"use strict";a.exports=require("assert")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},19889:(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/sessions/[id]/context/route",pathname:"/api/sessions/[id]/context",filename:"route",bundlePath:"app/api/sessions/[id]/context/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/sessions/[id]/context/route.ts",nextConfigOutput:"",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)}}},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{"use strict";a.exports=import("@earendil-works/pi-tui")},31421:a=>{"use strict";a.exports=require("node:child_process")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},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")},72322:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/utils/pi-user-agent")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,974,402,6759,2243,6429],()=>b(b.s=19889));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=8429,a.ids=[8429],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")},12180:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>h});var e=c(23211),f=c(40402),g=a([f]);async function h(a,{params:b}){let{id:c,entryId:d}=await b,g=new URL(a.url).searchParams.get("blockIndex"),i=null===g?NaN:Number(g);if(!Number.isSafeInteger(i)||i<0)return e.NextResponse.json({error:"Valid blockIndex is required"},{status:400});try{let a=await (0,f.os)(c);if(!a)return e.NextResponse.json({error:"Session not found"},{status:404});let b=(0,f.DK)(a).find(a=>a.id===d);if(!b||"message"!==b.type||"assistant"!==b.message.role)return e.NextResponse.json({error:"Assistant message not found"},{status:404});let g=b.message.content[i];if(!g||"thinking"!==g.type)return e.NextResponse.json({error:"Thinking block not found"},{status:404});return e.NextResponse.json({thinking:g.thinking})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}f=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},
|
|
1
|
+
(()=>{var a={};a.id=8429,a.ids=[8429],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")},12180:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>h});var e=c(23211),f=c(40402),g=a([f]);async function h(a,{params:b}){let{id:c,entryId:d}=await b,g=new URL(a.url).searchParams.get("blockIndex"),i=null===g?NaN:Number(g);if(!Number.isSafeInteger(i)||i<0)return e.NextResponse.json({error:"Valid blockIndex is required"},{status:400});try{let a=await (0,f.os)(c);if(!a)return e.NextResponse.json({error:"Session not found"},{status:404});let b=(0,f.DK)(a).find(a=>a.id===d);if(!b||"message"!==b.type||"assistant"!==b.message.role)return e.NextResponse.json({error:"Assistant message not found"},{status:404});let g=b.message.content[i];if(!g||"thinking"!==g.type)return e.NextResponse.json({error:"Thinking block not found"},{status:404});return e.NextResponse.json({thinking:g.thinking})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}f=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},47939:(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/sessions/[id]/entries/[entryId]/thinking/route",pathname:"/api/sessions/[id]/entries/[entryId]/thinking",filename:"route",bundlePath:"app/api/sessions/[id]/entries/[entryId]/thinking/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/sessions/[id]/entries/[entryId]/thinking/route.ts",nextConfigOutput:"",userland:()=>c(12180),...{}}),{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]/entries/[entryId]/thinking/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,402],()=>b(b.s=47939));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=8539,a.ids=[8539],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")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},70623:(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/sessions/[id]/entries/[entryId]/tool-result-image/route",pathname:"/api/sessions/[id]/entries/[entryId]/tool-result-image",filename:"route",bundlePath:"app/api/sessions/[id]/entries/[entryId]/tool-result-image/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route.ts",nextConfigOutput:"",userland:()=>c(88250),...{}}),{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]/entries/[entryId]/tool-result-image/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")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},88250:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>j});var e=c(23211),f=c(40402),g=c(79535),h=a([f]);function i(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}async function j(a,{params:b}){let{id:c,entryId:d}=await b,h=new URL(a.url).searchParams.get("blockIndex"),k=null===h?NaN:Number(h);if(!Number.isSafeInteger(k)||k<0)return e.NextResponse.json({error:"Valid blockIndex is required"},{status:400});try{var l;let a=await (0,f.os)(c);if(!a)return e.NextResponse.json({error:"Session not found"},{status:404});let b=(0,f.DK)(a).find(a=>a.id===d);if(!b||"message"!==b.type||"toolResult"!==b.message.role)return e.NextResponse.json({error:"Tool result not found"},{status:404});let h=(l=b.message.content[k],i(l)&&"image"===l.type?"string"==typeof l.data&&"string"==typeof l.mimeType?{data:l.data,mime:l.mimeType}:i(l.source)&&"base64"===l.source.type&&"string"==typeof l.source.data&&"string"==typeof l.source.media_type?{data:l.source.data,mime:l.source.media_type}:null:null);if(!h)return e.NextResponse.json({error:"Tool result image not found"},{status:404});if(!g.N.has(h.mime))return e.NextResponse.json({error:"Unsupported image type"},{status:415});let j=function(a){if(0===a.length||a.length>Math.ceil(4*g.c/3)+4||a.length%4!=0||!/^[A-Za-z0-9+/]*={0,2}$/.test(a))return null;let b=Buffer.from(a,"base64");return 0===b.length||b.length>g.c?null:new Uint8Array(b)}(h.data);if(!j)return e.NextResponse.json({error:"Invalid or oversized image data"},{status:413});let m=new ArrayBuffer(j.byteLength);return new Uint8Array(m).set(j),new Response(m,{headers:{"Content-Type":h.mime,"Content-Length":String(j.byteLength),"Cache-Control":"private, no-cache","X-Content-Type-Options":"nosniff"}})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}f=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},96487:()=>{}};var b=require("../../../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,402],()=>b(b.s=70623));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=8539,a.ids=[8539],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")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46309:(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/sessions/[id]/entries/[entryId]/tool-result-image/route",pathname:"/api/sessions/[id]/entries/[entryId]/tool-result-image",filename:"route",bundlePath:"app/api/sessions/[id]/entries/[entryId]/tool-result-image/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route.ts",nextConfigOutput:"",userland:()=>c(88250),...{}}),{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]/entries/[entryId]/tool-result-image/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},88250:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>j});var e=c(23211),f=c(40402),g=c(79535),h=a([f]);function i(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}async function j(a,{params:b}){let{id:c,entryId:d}=await b,h=new URL(a.url).searchParams.get("blockIndex"),k=null===h?NaN:Number(h);if(!Number.isSafeInteger(k)||k<0)return e.NextResponse.json({error:"Valid blockIndex is required"},{status:400});try{var l;let a=await (0,f.os)(c);if(!a)return e.NextResponse.json({error:"Session not found"},{status:404});let b=(0,f.DK)(a).find(a=>a.id===d);if(!b||"message"!==b.type||"toolResult"!==b.message.role)return e.NextResponse.json({error:"Tool result not found"},{status:404});let h=(l=b.message.content[k],i(l)&&"image"===l.type?"string"==typeof l.data&&"string"==typeof l.mimeType?{data:l.data,mime:l.mimeType}:i(l.source)&&"base64"===l.source.type&&"string"==typeof l.source.data&&"string"==typeof l.source.media_type?{data:l.source.data,mime:l.source.media_type}:null:null);if(!h)return e.NextResponse.json({error:"Tool result image not found"},{status:404});if(!g.N.has(h.mime))return e.NextResponse.json({error:"Unsupported image type"},{status:415});let j=function(a){if(0===a.length||a.length>Math.ceil(4*g.c/3)+4||a.length%4!=0||!/^[A-Za-z0-9+/]*={0,2}$/.test(a))return null;let b=Buffer.from(a,"base64");return 0===b.length||b.length>g.c?null:new Uint8Array(b)}(h.data);if(!j)return e.NextResponse.json({error:"Invalid or oversized image data"},{status:413});let m=new ArrayBuffer(j.byteLength);return new Uint8Array(m).set(j),new Response(m,{headers:{"Content-Type":h.mime,"Content-Length":String(j.byteLength),"Cache-Control":"private, no-cache","X-Content-Type-Options":"nosniff"}})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}f=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},96487:()=>{}};var b=require("../../../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,402],()=>b(b.s=46309));module.exports=c})();
|