@baique/pi-web-sky 0.1.31 → 0.1.32
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 +8 -7
- 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 +6 -0
- package/.next/server/app/_global-error/page.js +2 -2
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/agent/[id]/bash-output/route.js +2 -2
- package/.next/server/app/api/agent/[id]/events/route.js +2 -2
- 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/all-providers/route.js +1 -1
- package/.next/server/app/api/auth/api-key/[provider]/route.js +2 -2
- package/.next/server/app/api/auth/login/[provider]/route.js +3 -3
- package/.next/server/app/api/auth/logout/[provider]/route.js +2 -2
- 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 +2 -2
- package/.next/server/app/api/default-cwd/route.js +2 -2
- package/.next/server/app/api/file-index/route.js +2 -2
- package/.next/server/app/api/files/[...path]/route.js +2 -2
- package/.next/server/app/api/git/diff/route.js +2 -2
- package/.next/server/app/api/git/status/route.js +2 -2
- package/.next/server/app/api/home/route.js +1 -1
- package/.next/server/app/api/mcp/route.js +2 -2
- package/.next/server/app/api/models/route.js +2 -2
- 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/route.js +1 -1
- package/.next/server/app/api/models-config/test/route.js +1 -1
- package/.next/server/app/api/plugins/route.js +2 -2
- package/.next/server/app/api/project-trust/route.js +1 -1
- package/.next/server/app/api/quota/route.js +1 -1
- package/.next/server/app/api/search/route.js +2 -2
- 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 +2 -2
- package/.next/server/app/api/sessions/[id]/export/route.js +2 -2
- 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]/todos/route.js +1 -1
- package/.next/server/app/api/sessions/route.js +1 -1
- package/.next/server/app/api/skills/check/route.js +1 -1
- package/.next/server/app/api/skills/install/route.js +2 -2
- package/.next/server/app/api/skills/route.js +2 -2
- 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/tasks/[id]/route.js +1 -1
- package/.next/server/app/api/tasks/reorder/route.js +30 -0
- package/.next/server/app/api/tasks/reorder/route.js.nft.json +1 -0
- package/.next/server/app/api/tasks/reorder/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/tasks/route.js +2 -2
- package/.next/server/app/api/terminal/[id]/events/route.js +3 -3
- package/.next/server/app/api/terminal/[id]/route.js +2 -2
- package/.next/server/app/api/terminal/route.js +2 -2
- package/.next/server/app/api/worktrees/route.js +2 -2
- package/.next/server/app/favicon.ico/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +4 -4
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/manifest.webmanifest/route.js +2 -2
- package/.next/server/app/page.js +8 -8
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +8 -7
- package/.next/server/chunks/1457.js +2 -2
- package/.next/server/chunks/2404.js +2 -2
- package/.next/server/chunks/3379.js +1 -1
- package/.next/server/chunks/7513.js +2 -2
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/static/chunks/app/_global-error/page-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/bash-output/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/events/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/agent/new/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/agent/running/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/app-update/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/auth/all-providers/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/auth/login/[provider]/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/auth/providers/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/cwd/browse/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/cwd/validate/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/default-cwd/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/file-index/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/files/[...path]/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/git/diff/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/git/status/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/home/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/mcp/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/models/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/models-config/catalog/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/models-config/discover/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/models-config/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/models-config/test/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/plugins/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/project-trust/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/quota/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/search/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/context/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/export/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/state/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/todos/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/sessions/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/skills/check/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/skills/install/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/skills/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/skills/search/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/skills/update/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/tasks/[id]/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/tasks/reorder/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/tasks/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/terminal/[id]/events/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/terminal/[id]/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/terminal/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/api/worktrees/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/{layout-f85cabff4c2af8dc.js → layout-44c2a1db46fb38f3.js} +1 -1
- package/.next/static/chunks/app/manifest.webmanifest/route-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/app/page-255f2073b07c4d6f.js +89 -0
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-11d96eed20d5efa5.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-11d96eed20d5efa5.js +1 -0
- package/.next/static/qwmfKj7b5-4hr-C6kFkRA/_buildManifest.js +1 -0
- package/.next/trace +7 -8
- package/.next/trace-build +1 -1
- package/.next/types/app/api/tasks/reorder/route.ts +353 -0
- package/.next/types/routes.d.ts +2 -1
- package/.next/types/validator.ts +9 -0
- package/package.json +1 -1
- package/.next/static/0q1SOOo5-fPs13_IN4vdq/_buildManifest.js +0 -1
- package/.next/static/chunks/app/_global-error/page-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/bash-output/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/events/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/agent/new/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/agent/running/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/app-update/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/auth/all-providers/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/auth/login/[provider]/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/auth/providers/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/cwd/browse/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/cwd/validate/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/default-cwd/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/file-index/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/files/[...path]/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/git/diff/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/git/status/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/home/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/mcp/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/models/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/models-config/catalog/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/models-config/discover/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/models-config/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/models-config/test/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/plugins/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/project-trust/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/quota/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/search/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/context/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/export/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/state/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/todos/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/sessions/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/skills/check/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/skills/install/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/skills/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/skills/search/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/skills/update/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/tasks/[id]/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/tasks/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/terminal/[id]/events/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/terminal/[id]/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/terminal/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/api/worktrees/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/manifest.webmanifest/route-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/app/page-e2c8f01336cc4d05.js +0 -89
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-9217583a4a003fdc.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-9217583a4a003fdc.js +0 -1
- /package/.next/static/{0q1SOOo5-fPs13_IN4vdq → qwmfKj7b5-4hr-C6kFkRA}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=9822,a.ids=[9822],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")},14715:(a,b,c)=>{"use strict";c.d(b,{SW:()=>g,_T:()=>h});let d=[[9,12],[14,18]];function e(a){return new Date(a.getTime()+288e5)}function f(a){let b=a.getUTCDay();return b>=1&&b<=5}function g(a){let b=e(a);if(!f(b))return!1;let c=b.getUTCHours();return d.some(([a,b])=>c>=a&&c<b)}function h(a){let b=[];for(let c=0;c<8;c++){let g=e(a);if(g.setUTCDate(g.getUTCDate()+c),f(g))for(let[c,e]of d)for(let d of[c,e]){let c=new Date(g);c.setUTCHours(d,0,0,0);let e=c.getTime()-288e5;e>a.getTime()&&b.push(e)}}return new Date(0===b.length?a.getTime()+864e5:Math.min(...b))}},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55609:(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/quota/route",pathname:"/api/quota",filename:"route",bundlePath:"app/api/quota/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/quota/route.ts",nextConfigOutput:"",userland:()=>c(62957),...{}}),{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/quota/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)}}},62957:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>o,dynamic:()=>p});var e=c(23211),f=c(73024),g=c(76760),h=c(75430),i=c(66544),j=c(14715),k=a([h]);h=(k.then?(await k)():k)[0];let p="force-dynamic",q=new Map;function l(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}class r extends Error{constructor(a){super(`HTTP ${a}`),this.status=a}}async function m(a,b){let c=await fetch(a,{headers:{Authorization:`Bearer ${b}`,Accept:"application/json"},signal:AbortSignal.timeout(1e4),cache:"no-store"});if(!c.ok)throw new r(c.status);return c.json()}async function n(a){let b=function(a){try{let b=JSON.parse((0,f.readFileSync)((0,g.join)((0,h.getAgentDir)(),"auth.json"),"utf-8"));if(!l(b))return null;let c=b[a];if(!l(c))return null;if("string"==typeof c.key&&c.key)return c.key;if("oauth"===c.type&&"string"==typeof c.access&&c.access)return c.access}catch{}return null}(a);if(!b)throw Error("no credential for provider");if("opencode-go"===a)return function(a){if(!l(a)||!l(a.usage))throw Error("ocg usage: unexpected shape");let b=a.usage,c=[];for(let[a,d]of[["rolling","5h"],["weekly","周"],["monthly","月"]]){let e=b[a];if(!l(e))continue;let f="number"==typeof e.percent?e.percent:"number"==typeof e.usagePercent?e.usagePercent:null;null!=f&&c.push({label:d,percent:f,status:"string"==typeof e.status?e.status:"unknown",resetsAt:"string"==typeof e.resetsAt?e.resetsAt:"number"==typeof e.resetInSec?new Date(Date.now()+1e3*e.resetInSec).toISOString():""})}if(0===c.length)throw Error("ocg usage: no usable window");return{kind:"usage",windows:c}}(await m("https://opencode.ai/zen/go/v1/usage",b));if("deepseek"===a){var c=await m("https://api.deepseek.com/user/balance",b);if(!l(c)||!Array.isArray(c.balance_infos))throw Error("ds balance: unexpected shape");let a=c.balance_infos.find(l);if(!a||"string"!=typeof a.total_balance)throw Error("ds balance: no balance_infos entry");let d=new Date;return{kind:"balance",currency:"string"==typeof a.currency?a.currency:"",totalBalance:a.total_balance,isPeak:(0,j.SW)(d),nextSwitchAt:(0,j._T)(d).toISOString()}}if("commandcode"===a){let a="https://api.commandcode.ai",c=await m(`${a}/alpha/whoami`,b),d=l(c.org)&&"string"==typeof c.org.id?c.org.id:null,e=d?`?orgId=${encodeURIComponent(d)}`:"",[f,g]=await Promise.all([m(`${a}/alpha/billing/credits${e}`,b),m(`${a}/alpha/usage/summary${e}`,b)]);return function(a){if(!l(a)||!l(a.credits))throw Error("cc credits: unexpected shape");let b=a.credits,c="number"==typeof b.monthlyCredits?b.monthlyCredits:0,d=l(a.summary)?a.summary:l(a.usage)&&l(a.usage.summary)?a.usage.summary:null,e=d&&"number"==typeof d.totalCost?d.totalCost:0,f=c+e,g=[],h=l(a.windowLimits)?a.windowLimits:null;for(let[a,b]of[["fiveHour","5h"],["weekly","周"]]){let c=h&&l(h[a])?h[a]:null;if(!c)continue;let d="number"==typeof c.used?c.used:0,e="number"==typeof c.cap?c.cap:0;e>0&&g.push({label:b,percent:Math.round(d/e*100),status:"ok",resetsAt:function(a){if("number"==typeof a&&Number.isFinite(a)&&a>0)return new Date(a>=1e12?a:1e3*a).toISOString();if("string"==typeof a&&a.trim()){let b=/^\d+$/.test(a.trim())?Number(a.trim()):Date.parse(a.trim());if(Number.isFinite(b)&&b>0)return new Date(b>=1e12?b:1e3*b).toISOString()}return""}(c.resetAt)})}if(f>0&&g.push({label:"月",percent:Math.min(100,Math.max(0,Math.round(e/f*100))),status:"ok",resetsAt:""}),0===g.length)throw Error("cc credits: no window limit");return{kind:"usage",windows:g}}({...f,summary:g})}throw Error(`unsupported provider: ${a}`)}async function o(a){if(!(0,i.EN)(a))return e.NextResponse.json({ok:!1,error:"Untrusted API request"},{status:403});let b=new URL(a.url).searchParams.get("provider")?.trim()??"";if(!b)return e.NextResponse.json({ok:!1,error:"provider is required"},{status:400});let c=q.get(b);if(c&&Date.now()-c.at<3e4)return e.NextResponse.json({ok:!0,quota:c.data});try{let a=await n(b);return q.set(b,{at:Date.now(),data:a}),e.NextResponse.json({ok:!0,quota:a})}catch(d){if(c)return e.NextResponse.json({ok:!0,quota:c.data});let a=d instanceof r?d.status:null,b=d instanceof Error?d.message:String(d);return e.NextResponse.json({ok:!1,error:b,status:a},{status:502})}}d()}catch(a){d(a)}})},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>j,EN:()=>i});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).hostname}catch{return null}}function i(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c,d=a.headers.get("origin");if("cross-site"===a.headers.get("sec-fetch-site"))return!1;if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?function(a){try{return new URL(a).origin}catch{return null}}(`${b.protocol}//${c}`):null);if(!e)return!1;let f=h(d),g=h(e);return null!==f&&f===g}(a))}function j(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=55609));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=9822,a.ids=[9822],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")},14715:(a,b,c)=>{"use strict";c.d(b,{SW:()=>g,_T:()=>h});let d=[[9,12],[14,18]];function e(a){return new Date(a.getTime()+288e5)}function f(a){let b=a.getUTCDay();return b>=1&&b<=5}function g(a){let b=e(a);if(!f(b))return!1;let c=b.getUTCHours();return d.some(([a,b])=>c>=a&&c<b)}function h(a){let b=[];for(let c=0;c<8;c++){let g=e(a);if(g.setUTCDate(g.getUTCDate()+c),f(g))for(let[c,e]of d)for(let d of[c,e]){let c=new Date(g);c.setUTCHours(d,0,0,0);let e=c.getTime()-288e5;e>a.getTime()&&b.push(e)}}return new Date(0===b.length?a.getTime()+864e5:Math.min(...b))}},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55133:(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/quota/route",pathname:"/api/quota",filename:"route",bundlePath:"app/api/quota/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/quota/route.ts",nextConfigOutput:"",userland:()=>c(62957),...{}}),{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/quota/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)}}},62957:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>o,dynamic:()=>p});var e=c(23211),f=c(73024),g=c(76760),h=c(75430),i=c(66544),j=c(14715),k=a([h]);h=(k.then?(await k)():k)[0];let p="force-dynamic",q=new Map;function l(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}class r extends Error{constructor(a){super(`HTTP ${a}`),this.status=a}}async function m(a,b){let c=await fetch(a,{headers:{Authorization:`Bearer ${b}`,Accept:"application/json"},signal:AbortSignal.timeout(1e4),cache:"no-store"});if(!c.ok)throw new r(c.status);return c.json()}async function n(a){let b=function(a){try{let b=JSON.parse((0,f.readFileSync)((0,g.join)((0,h.getAgentDir)(),"auth.json"),"utf-8"));if(!l(b))return null;let c=b[a];if(!l(c))return null;if("string"==typeof c.key&&c.key)return c.key;if("oauth"===c.type&&"string"==typeof c.access&&c.access)return c.access}catch{}return null}(a);if(!b)throw Error("no credential for provider");if("opencode-go"===a)return function(a){if(!l(a)||!l(a.usage))throw Error("ocg usage: unexpected shape");let b=a.usage,c=[];for(let[a,d]of[["rolling","5h"],["weekly","周"],["monthly","月"]]){let e=b[a];if(!l(e))continue;let f="number"==typeof e.percent?e.percent:"number"==typeof e.usagePercent?e.usagePercent:null;null!=f&&c.push({label:d,percent:f,status:"string"==typeof e.status?e.status:"unknown",resetsAt:"string"==typeof e.resetsAt?e.resetsAt:"number"==typeof e.resetInSec?new Date(Date.now()+1e3*e.resetInSec).toISOString():""})}if(0===c.length)throw Error("ocg usage: no usable window");return{kind:"usage",windows:c}}(await m("https://opencode.ai/zen/go/v1/usage",b));if("deepseek"===a){var c=await m("https://api.deepseek.com/user/balance",b);if(!l(c)||!Array.isArray(c.balance_infos))throw Error("ds balance: unexpected shape");let a=c.balance_infos.find(l);if(!a||"string"!=typeof a.total_balance)throw Error("ds balance: no balance_infos entry");let d=new Date;return{kind:"balance",currency:"string"==typeof a.currency?a.currency:"",totalBalance:a.total_balance,isPeak:(0,j.SW)(d),nextSwitchAt:(0,j._T)(d).toISOString()}}if("commandcode"===a){let a="https://api.commandcode.ai",c=await m(`${a}/alpha/whoami`,b),d=l(c.org)&&"string"==typeof c.org.id?c.org.id:null,e=d?`?orgId=${encodeURIComponent(d)}`:"",[f,g]=await Promise.all([m(`${a}/alpha/billing/credits${e}`,b),m(`${a}/alpha/usage/summary${e}`,b)]);return function(a){if(!l(a)||!l(a.credits))throw Error("cc credits: unexpected shape");let b=a.credits,c="number"==typeof b.monthlyCredits?b.monthlyCredits:0,d=l(a.summary)?a.summary:l(a.usage)&&l(a.usage.summary)?a.usage.summary:null,e=d&&"number"==typeof d.totalCost?d.totalCost:0,f=c+e,g=[],h=l(a.windowLimits)?a.windowLimits:null;for(let[a,b]of[["fiveHour","5h"],["weekly","周"]]){let c=h&&l(h[a])?h[a]:null;if(!c)continue;let d="number"==typeof c.used?c.used:0,e="number"==typeof c.cap?c.cap:0;e>0&&g.push({label:b,percent:Math.round(d/e*100),status:"ok",resetsAt:function(a){if("number"==typeof a&&Number.isFinite(a)&&a>0)return new Date(a>=1e12?a:1e3*a).toISOString();if("string"==typeof a&&a.trim()){let b=/^\d+$/.test(a.trim())?Number(a.trim()):Date.parse(a.trim());if(Number.isFinite(b)&&b>0)return new Date(b>=1e12?b:1e3*b).toISOString()}return""}(c.resetAt)})}if(f>0&&g.push({label:"月",percent:Math.min(100,Math.max(0,Math.round(e/f*100))),status:"ok",resetsAt:""}),0===g.length)throw Error("cc credits: no window limit");return{kind:"usage",windows:g}}({...f,summary:g})}throw Error(`unsupported provider: ${a}`)}async function o(a){if(!(0,i.EN)(a))return e.NextResponse.json({ok:!1,error:"Untrusted API request"},{status:403});let b=new URL(a.url).searchParams.get("provider")?.trim()??"";if(!b)return e.NextResponse.json({ok:!1,error:"provider is required"},{status:400});let c=q.get(b);if(c&&Date.now()-c.at<3e4)return e.NextResponse.json({ok:!0,quota:c.data});try{let a=await n(b);return q.set(b,{at:Date.now(),data:a}),e.NextResponse.json({ok:!0,quota:a})}catch(d){if(c)return e.NextResponse.json({ok:!0,quota:c.data});let a=d instanceof r?d.status:null,b=d instanceof Error?d.message:String(d);return e.NextResponse.json({ok:!1,error:b,status:a},{status:502})}}d()}catch(a){d(a)}})},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>j,EN:()=>i});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).hostname}catch{return null}}function i(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c,d=a.headers.get("origin");if("cross-site"===a.headers.get("sec-fetch-site"))return!1;if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?function(a){try{return new URL(a).origin}catch{return null}}(`${b.protocol}//${c}`):null);if(!e)return!1;let f=h(d),g=h(e);return null!==f&&f===g}(a))}function j(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=55133));module.exports=c})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var a={};a.id=6202,a.ids=[6202],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")},19139:(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/search/route",pathname:"/api/search",filename:"route",bundlePath:"app/api/search/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/search/route.ts",nextConfigOutput:"",userland:()=>c(22991),...{}}),{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/search/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)}}},21820:a=>{"use strict";a.exports=require("os")},22991:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GET:()=>l,dynamic:()=>k});var d=c(23211),e=c(29021),f=c(66737);function g(a,b){if("string"==typeof a)return a;if(!Array.isArray(a))return"";let c=[];for(let d of a)if(d&&"object"==typeof d)if("text"===d.type&&"string"==typeof d.text)c.push(d.text);else if("thinking"===d.type&&"string"==typeof d.thinking)c.push(d.thinking);else if("toolCall"===d.type&&"string"==typeof d.toolName){let a="";try{a=JSON.stringify(d.input??{})}catch{a=""}c.push(`[tool:${d.toolName}] ${a.slice(0,500)}`)}else"image"!==d.type||b||c.push("[image]");return c.join("\n")}async function h(a){let b=a;if(!b){let{listAllSessions:a}=await c.e(402).then(c.bind(c,40402));b=await a()}let d=(0,f.Lf)(),h=new Map(d.prepare("SELECT session_id, mtime FROM search_state").all().map(a=>[a.session_id,a.mtime])),i=new Set,j=!1,k=d.prepare("INSERT INTO search_state (session_id, mtime, title) VALUES (?, ?, ?) ON CONFLICT(session_id) DO UPDATE SET mtime = excluded.mtime, title = excluded.title"),l=d.prepare("INSERT INTO session_search (session_id, title, body) VALUES (?, ?, ?)"),m=d.prepare("DELETE FROM session_search WHERE session_id = ?");for(let a of b){if(i.add(a.id),h.get(a.id)===a.modified)continue;let{title:b,body:c}=function(a){let b=(a.name||(a.firstMessage||"").slice(0,200)).slice(0,400),c=[],d=0,f=()=>262144-d,h=a=>{if(d>=262144)return;let b=c.length;!function(a,b,c){let d="string"==typeof b?b.trim():"";if(!d)return;let e=c();a.push(d.length<=e?d:d.slice(0,e))}(c,a,f),d+=c.slice(b).join("\n").length},i=[];try{i=function(a){let b=(0,e.readFileSync)(a,"utf8"),c=[];for(let a of b.split("\n"))if(a.trim())try{let b=JSON.parse(a);b&&"string"==typeof b.type&&c.push(b)}catch{}return c}(a.path)}catch{}for(let a of i)if("message"===a.type&&a.message){let{role:b,content:c}=a.message;if("user"===b)h(g(c,!1));else if("assistant"===b)h(g(c,!1));else if("toolResult"===b){let a=g(c,!0);h(a.length>600?a.slice(0,600):a)}else"bashExecution"===b&&("string"==typeof a.message?.command&&h(`> ${a.message.command}`),"string"==typeof a.message?.output&&h(a.message.output.slice(0,4096)))}else if("compaction"===a.type&&"string"==typeof a.summary)h(a.summary);else if("custom_message"===a.type){let b=a.content;"string"==typeof b&&h(b)}return{title:b,body:c.join("\n")}}(a);d.exec("BEGIN");try{m.run(a.id),(c||b)&&l.run(a.id,b,c),k.run(a.id,a.modified,b),d.exec("COMMIT")}catch(a){throw d.exec("ROLLBACK"),a}j=!0}d.exec("BEGIN");try{for(let a of h.keys())i.has(a)||(m.run(a),d.prepare("DELETE FROM search_state WHERE session_id = ?").run(a),j=!0);d.exec("COMMIT")}catch(a){throw d.exec("ROLLBACK"),a}return{indexing:j}}async function i(a,b=30,c){let d,e=a.trim();if(!e)return{indexing:!1,results:[]};let g=c??await j(),k=await h(g),l=Math.min(Math.max(b,1),50),m=(0,f.Lf)(),n=new Map(g.map(a=>[a.id,a])),o=new Set;if(e.length>=3){let a=`"${e.replace(/"/g,'""')}"`;for(let b of(d=m.prepare("SELECT session_id, ifnull(snippet(session_search, 2, '[', ']', '…', 12), '') AS snip FROM session_search WHERE session_search MATCH ? LIMIT ?").all(a,l),m.prepare("SELECT session_id FROM session_search WHERE title MATCH ?").all(a)))o.add(b.session_id)}else{let a=`%${e}%`;for(let b of(d=m.prepare("SELECT session_id, '' AS snip FROM session_search WHERE title LIKE ? OR body LIKE ? LIMIT ?").all(a,a,l),m.prepare("SELECT session_id FROM session_search WHERE title LIKE ?").all(a)))o.add(b.session_id)}let p=[];for(let a of d){let b=n.get(a.session_id);b&&p.push({session:b,titleMatch:o.has(a.session_id),snippet:a.snip??""})}return p.sort((a,b)=>Number(b.titleMatch)-Number(a.titleMatch)||b.session.modified.localeCompare(a.session.modified)),{indexing:k.indexing,results:p}}async function j(){let{listAllSessions:a}=await c.e(402).then(c.bind(c,40402));return a()}let k="force-dynamic";async function l(a){try{let b=new URL(a.url).searchParams,c=b.get("q")??"",e=Number(b.get("limit")),f=Number.isFinite(e)&&e>0?Math.round(e):30,{indexing:g,results:h}=await i(c,f);return d.NextResponse.json({indexing:g,results:h},{headers:{"Cache-Control":"no-store"}})}catch(a){return d.NextResponse.json({error:String(a)},{status:500,headers:{"Cache-Control":"no-store"}})}}},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")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66737:(a,b,c)=>{"use strict";c.d(b,{Lf:()=>g});var d=c(80099),e=c(21820),f=c(33873);function g(){if(globalThis.__piWebDb)return globalThis.__piWebDb;let a=new d.DatabaseSync((0,f.join)(function(){let a=process.env.PI_CODING_AGENT_DIR;if(a){let b=a.startsWith("~")?(0,f.join)((0,e.homedir)(),a.slice(1)):a;return(0,f.normalize)(b)}return(0,f.join)((0,e.homedir)(),".pi","agent")}(),"pi-web.db"));return a.exec("PRAGMA journal_mode = WAL;"),a.exec("PRAGMA foreign_keys = ON;"),function(a){for(let b of(a.exec(`
|
|
1
|
+
(()=>{var a={};a.id=6202,a.ids=[6202],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},22991:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GET:()=>l,dynamic:()=>k});var d=c(23211),e=c(29021),f=c(66737);function g(a,b){if("string"==typeof a)return a;if(!Array.isArray(a))return"";let c=[];for(let d of a)if(d&&"object"==typeof d)if("text"===d.type&&"string"==typeof d.text)c.push(d.text);else if("thinking"===d.type&&"string"==typeof d.thinking)c.push(d.thinking);else if("toolCall"===d.type&&"string"==typeof d.toolName){let a="";try{a=JSON.stringify(d.input??{})}catch{a=""}c.push(`[tool:${d.toolName}] ${a.slice(0,500)}`)}else"image"!==d.type||b||c.push("[image]");return c.join("\n")}async function h(a){let b=a;if(!b){let{listAllSessions:a}=await c.e(402).then(c.bind(c,40402));b=await a()}let d=(0,f.Lf)(),h=new Map(d.prepare("SELECT session_id, mtime FROM search_state").all().map(a=>[a.session_id,a.mtime])),i=new Set,j=!1,k=d.prepare("INSERT INTO search_state (session_id, mtime, title) VALUES (?, ?, ?) ON CONFLICT(session_id) DO UPDATE SET mtime = excluded.mtime, title = excluded.title"),l=d.prepare("INSERT INTO session_search (session_id, title, body) VALUES (?, ?, ?)"),m=d.prepare("DELETE FROM session_search WHERE session_id = ?");for(let a of b){if(i.add(a.id),h.get(a.id)===a.modified)continue;let{title:b,body:c}=function(a){let b=(a.name||(a.firstMessage||"").slice(0,200)).slice(0,400),c=[],d=0,f=()=>262144-d,h=a=>{if(d>=262144)return;let b=c.length;!function(a,b,c){let d="string"==typeof b?b.trim():"";if(!d)return;let e=c();a.push(d.length<=e?d:d.slice(0,e))}(c,a,f),d+=c.slice(b).join("\n").length},i=[];try{i=function(a){let b=(0,e.readFileSync)(a,"utf8"),c=[];for(let a of b.split("\n"))if(a.trim())try{let b=JSON.parse(a);b&&"string"==typeof b.type&&c.push(b)}catch{}return c}(a.path)}catch{}for(let a of i)if("message"===a.type&&a.message){let{role:b,content:c}=a.message;if("user"===b)h(g(c,!1));else if("assistant"===b)h(g(c,!1));else if("toolResult"===b){let a=g(c,!0);h(a.length>600?a.slice(0,600):a)}else"bashExecution"===b&&("string"==typeof a.message?.command&&h(`> ${a.message.command}`),"string"==typeof a.message?.output&&h(a.message.output.slice(0,4096)))}else if("compaction"===a.type&&"string"==typeof a.summary)h(a.summary);else if("custom_message"===a.type){let b=a.content;"string"==typeof b&&h(b)}return{title:b,body:c.join("\n")}}(a);d.exec("BEGIN");try{m.run(a.id),(c||b)&&l.run(a.id,b,c),k.run(a.id,a.modified,b),d.exec("COMMIT")}catch(a){throw d.exec("ROLLBACK"),a}j=!0}d.exec("BEGIN");try{for(let a of h.keys())i.has(a)||(m.run(a),d.prepare("DELETE FROM search_state WHERE session_id = ?").run(a),j=!0);d.exec("COMMIT")}catch(a){throw d.exec("ROLLBACK"),a}return{indexing:j}}async function i(a,b=30,c){let d,e=a.trim();if(!e)return{indexing:!1,results:[]};let g=c??await j(),k=await h(g),l=Math.min(Math.max(b,1),50),m=(0,f.Lf)(),n=new Map(g.map(a=>[a.id,a])),o=new Set;if(e.length>=3){let a=`"${e.replace(/"/g,'""')}"`;for(let b of(d=m.prepare("SELECT session_id, ifnull(snippet(session_search, 2, '[', ']', '…', 12), '') AS snip FROM session_search WHERE session_search MATCH ? LIMIT ?").all(a,l),m.prepare("SELECT session_id FROM session_search WHERE title MATCH ?").all(a)))o.add(b.session_id)}else{let a=`%${e}%`;for(let b of(d=m.prepare("SELECT session_id, '' AS snip FROM session_search WHERE title LIKE ? OR body LIKE ? LIMIT ?").all(a,a,l),m.prepare("SELECT session_id FROM session_search WHERE title LIKE ?").all(a)))o.add(b.session_id)}let p=[];for(let a of d){let b=n.get(a.session_id);b&&p.push({session:b,titleMatch:o.has(a.session_id),snippet:a.snip??""})}return p.sort((a,b)=>Number(b.titleMatch)-Number(a.titleMatch)||b.session.modified.localeCompare(a.session.modified)),{indexing:k.indexing,results:p}}async function j(){let{listAllSessions:a}=await c.e(402).then(c.bind(c,40402));return a()}let k="force-dynamic";async function l(a){try{let b=new URL(a.url).searchParams,c=b.get("q")??"",e=Number(b.get("limit")),f=Number.isFinite(e)&&e>0?Math.round(e):30,{indexing:g,results:h}=await i(c,f);return d.NextResponse.json({indexing:g,results:h},{headers:{"Cache-Control":"no-store"}})}catch(a){return d.NextResponse.json({error:String(a)},{status:500,headers:{"Cache-Control":"no-store"}})}}},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")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66737:(a,b,c)=>{"use strict";c.d(b,{Lf:()=>g});var d=c(80099),e=c(21820),f=c(33873);function g(){var a;if(globalThis.__piWebDb)return globalThis.__piWebDb;let b=new d.DatabaseSync((0,f.join)(function(){let a=process.env.PI_CODING_AGENT_DIR;if(a){let b=a.startsWith("~")?(0,f.join)((0,e.homedir)(),a.slice(1)):a;return(0,f.normalize)(b)}return(0,f.join)((0,e.homedir)(),".pi","agent")}(),"pi-web.db"));return b.exec("PRAGMA journal_mode = WAL;"),b.exec("PRAGMA foreign_keys = ON;"),(a=b).exec(`
|
|
2
2
|
CREATE TABLE IF NOT EXISTS tasks (
|
|
3
3
|
id TEXT PRIMARY KEY,
|
|
4
4
|
project_key TEXT NOT NULL,
|
|
@@ -27,4 +27,4 @@
|
|
|
27
27
|
body,
|
|
28
28
|
tokenize = 'trigram'
|
|
29
29
|
);
|
|
30
|
-
`),["ALTER TABLE tasks ADD COLUMN pinned INTEGER NOT NULL DEFAULT 0;","ALTER TABLE session_meta ADD COLUMN pinned INTEGER NOT NULL DEFAULT 0;"]
|
|
30
|
+
`),function(a){let b=a.prepare("PRAGMA user_version").get().user_version;for(let c of h)if(!(c.version<=b)){a.exec("BEGIN");try{for(let b of c.statements)try{a.exec(b)}catch(b){let a=b instanceof Error?b.message:String(b);if(!/duplicate column name/i.test(a))throw b}a.exec(`PRAGMA user_version = ${c.version}`),a.exec("COMMIT"),b=c.version}catch(b){throw a.exec("ROLLBACK"),b}}}(a),globalThis.__piWebDb=b,b}let h=[{version:1,name:"pinned columns",statements:["ALTER TABLE tasks ADD COLUMN pinned INTEGER NOT NULL DEFAULT 0;","ALTER TABLE session_meta ADD COLUMN pinned INTEGER NOT NULL DEFAULT 0;"]},{version:2,name:"tasks.sort_order",statements:["ALTER TABLE tasks ADD COLUMN sort_order INTEGER NOT NULL DEFAULT 0;"]}]},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")},80099:a=>{"use strict";a.exports=require("node:sqlite")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},93031:(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/search/route",pathname:"/api/search",filename:"route",bundlePath:"app/api/search/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/search/route.ts",nextConfigOutput:"",userland:()=>c(22991),...{}}),{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/search/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=93031));module.exports=c})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var a={};a.id=2835,a.ids=[2835],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},
|
|
1
|
+
"use strict";(()=>{var a={};a.id=2835,a.ids=[2835],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},25846:(a,b,c)=>{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=await (0,h.os)(c);if(!a)return e.NextResponse.json({error:"Session not found"},{status:404});let b=(0,g.A4)(c),{session:d}=b?.isAlive()?{session:b}:await (0,g.OF)(c,a,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)}})},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},49891:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/auto-name/route",pathname:"/api/sessions/[id]/auto-name",filename:"route",bundlePath:"app/api/sessions/[id]/auto-name/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/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)}}},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},79495:(a,b,c)=>{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=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80099:a=>{a.exports=require("node:sqlite")},86123:a=>{a.exports=import("@earendil-works/pi-agent-core")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,402,1457],()=>b(b.s=
|
|
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=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80099:a=>{a.exports=require("node:sqlite")},86123:a=>{a.exports=import("@earendil-works/pi-agent-core")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,402,1457],()=>b(b.s=49891));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var a={};a.id=6709,a.ids=[6709],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},6004:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>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"),k="null"===i?null:i??void 0,l=d.searchParams.has("deferThinking"),m=d.searchParams.has("deferMedia"),n=Number(d.searchParams.get("tail")),o=Number.isFinite(n)&&n>0?Math.min(n,1e3):50,p=d.searchParams.get("before")??void 0;try{let a=(0,h.A4)(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 i=b?.inner.sessionManager??f.SessionManager.open(d),j=(0,g.Uv)(i.getEntries(),p??k,{deferThinking:l,deferToolResultImages:m,tail:o,excludeLeaf:!!p}),n=(0,g.B6)(i.getEntries(),p??k??null,o,!!p);return e.NextResponse.json({context:j,tail:o,before:p??null,hasMore:n})}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=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},
|
|
1
|
+
"use strict";(()=>{var a={};a.id=6709,a.ids=[6709],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},6004:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>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"),k="null"===i?null:i??void 0,l=d.searchParams.has("deferThinking"),m=d.searchParams.has("deferMedia"),n=Number(d.searchParams.get("tail")),o=Number.isFinite(n)&&n>0?Math.min(n,1e3):50,p=d.searchParams.get("before")??void 0;try{let a=(0,h.A4)(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 i=b?.inner.sessionManager??f.SessionManager.open(d),j=(0,g.Uv)(i.getEntries(),p??k,{deferThinking:l,deferToolResultImages:m,tail:o,excludeLeaf:!!p}),n=(0,g.B6)(i.getEntries(),p??k??null,o,!!p);return e.NextResponse.json({context:j,tail:o,before:p??null,hasMore:n})}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=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},67367:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/context/route",pathname:"/api/sessions/[id]/context",filename:"route",bundlePath:"app/api/sessions/[id]/context/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/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)}}},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80099:a=>{a.exports=require("node:sqlite")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,402,1457],()=>b(b.s=67367));module.exports=c})();
|
|
@@ -1,4 +1,4 @@
|
|
|
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")},21820:a=>{"use strict";a.exports=require("os")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},
|
|
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")},21820:a=>{"use strict";a.exports=require("os")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66737:(a,b,c)=>{"use strict";c.d(b,{Lf:()=>g});var d=c(80099),e=c(21820),f=c(33873);function g(){var a;if(globalThis.__piWebDb)return globalThis.__piWebDb;let b=new d.DatabaseSync((0,f.join)(function(){let a=process.env.PI_CODING_AGENT_DIR;if(a){let b=a.startsWith("~")?(0,f.join)((0,e.homedir)(),a.slice(1)):a;return(0,f.normalize)(b)}return(0,f.join)((0,e.homedir)(),".pi","agent")}(),"pi-web.db"));return b.exec("PRAGMA journal_mode = WAL;"),b.exec("PRAGMA foreign_keys = ON;"),(a=b).exec(`
|
|
2
2
|
CREATE TABLE IF NOT EXISTS tasks (
|
|
3
3
|
id TEXT PRIMARY KEY,
|
|
4
4
|
project_key TEXT NOT NULL,
|
|
@@ -27,4 +27,4 @@
|
|
|
27
27
|
body,
|
|
28
28
|
tokenize = 'trigram'
|
|
29
29
|
);
|
|
30
|
-
`),["ALTER TABLE tasks ADD COLUMN pinned INTEGER NOT NULL DEFAULT 0;","ALTER TABLE session_meta ADD COLUMN pinned INTEGER NOT NULL DEFAULT 0;"]
|
|
30
|
+
`),function(a){let b=a.prepare("PRAGMA user_version").get().user_version;for(let c of h)if(!(c.version<=b)){a.exec("BEGIN");try{for(let b of c.statements)try{a.exec(b)}catch(b){let a=b instanceof Error?b.message:String(b);if(!/duplicate column name/i.test(a))throw b}a.exec(`PRAGMA user_version = ${c.version}`),a.exec("COMMIT"),b=c.version}catch(b){throw a.exec("ROLLBACK"),b}}}(a),globalThis.__piWebDb=b,b}let h=[{version:1,name:"pinned columns",statements:["ALTER TABLE tasks ADD COLUMN pinned INTEGER NOT NULL DEFAULT 0;","ALTER TABLE session_meta ADD COLUMN pinned INTEGER NOT NULL DEFAULT 0;"]},{version:2,name:"tasks.sort_order",statements:["ALTER TABLE tasks ADD COLUMN sort_order INTEGER NOT NULL DEFAULT 0;"]}]},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")},80099:a=>{"use strict";a.exports=require("node:sqlite")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},92377:(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/wa/project/pi-web-sky/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)}}},96487:()=>{}};var b=require("../../../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,402],()=>b(b.s=92377));module.exports=c})();
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
}
|
|
52
52
|
containsActive.set(node, has);
|
|
53
53
|
}
|
|
54
|
-
}`));return new Response(e,{headers:{"Content-Type":"text/html; charset=utf-8","Content-Disposition":(b=k.replace(/[^\x20-\x7E]|["\\;\r\n]/g,"_")||"session.html",`${d?"inline":"attachment"}; filename="${b}"; filename*=UTF-8''${encodeURIComponent(k).replace(/[!'()*]/g,a=>`%${a.charCodeAt(0).toString(16).toUpperCase()}`)}`),"Cache-Control":"no-cache","Content-Security-Policy":"frame-ancestors 'none'","X-Content-Type-Options":"nosniff","X-Frame-Options":"DENY"}})}finally{(0,g.rmSync)(n,{force:!0})}}catch(a){return l.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},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")},
|
|
54
|
+
}`));return new Response(e,{headers:{"Content-Type":"text/html; charset=utf-8","Content-Disposition":(b=k.replace(/[^\x20-\x7E]|["\\;\r\n]/g,"_")||"session.html",`${d?"inline":"attachment"}; filename="${b}"; filename*=UTF-8''${encodeURIComponent(k).replace(/[!'()*]/g,a=>`%${a.charCodeAt(0).toString(16).toUpperCase()}`)}`),"Cache-Control":"no-cache","Content-Security-Policy":"frame-ancestors 'none'","X-Content-Type-Options":"nosniff","X-Frame-Options":"DENY"}})}finally{(0,g.rmSync)(n,{force:!0})}}catch(a){return l.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},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")},66737:(a,b,c)=>{"use strict";c.d(b,{Lf:()=>g});var d=c(80099),e=c(21820),f=c(33873);function g(){var a;if(globalThis.__piWebDb)return globalThis.__piWebDb;let b=new d.DatabaseSync((0,f.join)(function(){let a=process.env.PI_CODING_AGENT_DIR;if(a){let b=a.startsWith("~")?(0,f.join)((0,e.homedir)(),a.slice(1)):a;return(0,f.normalize)(b)}return(0,f.join)((0,e.homedir)(),".pi","agent")}(),"pi-web.db"));return b.exec("PRAGMA journal_mode = WAL;"),b.exec("PRAGMA foreign_keys = ON;"),(a=b).exec(`
|
|
55
55
|
CREATE TABLE IF NOT EXISTS tasks (
|
|
56
56
|
id TEXT PRIMARY KEY,
|
|
57
57
|
project_key TEXT NOT NULL,
|
|
@@ -80,4 +80,4 @@
|
|
|
80
80
|
body,
|
|
81
81
|
tokenize = 'trigram'
|
|
82
82
|
);
|
|
83
|
-
`),["ALTER TABLE tasks ADD COLUMN pinned INTEGER NOT NULL DEFAULT 0;","ALTER TABLE session_meta ADD COLUMN pinned INTEGER NOT NULL DEFAULT 0;"]
|
|
83
|
+
`),function(a){let b=a.prepare("PRAGMA user_version").get().user_version;for(let c of h)if(!(c.version<=b)){a.exec("BEGIN");try{for(let b of c.statements)try{a.exec(b)}catch(b){let a=b instanceof Error?b.message:String(b);if(!/duplicate column name/i.test(a))throw b}a.exec(`PRAGMA user_version = ${c.version}`),a.exec("COMMIT"),b=c.version}catch(b){throw a.exec("ROLLBACK"),b}}}(a),globalThis.__piWebDb=b,b}let h=[{version:1,name:"pinned columns",statements:["ALTER TABLE tasks ADD COLUMN pinned INTEGER NOT NULL DEFAULT 0;","ALTER TABLE session_meta ADD COLUMN pinned INTEGER NOT NULL DEFAULT 0;"]},{version:2,name:"tasks.sort_order",statements:["ALTER TABLE tasks ADD COLUMN sort_order INTEGER NOT NULL DEFAULT 0;"]}]},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},78335:()=>{},79405:a=>{function b(a){return Promise.resolve().then(()=>{var b=Error("Cannot find module '"+a+"'");throw b.code="MODULE_NOT_FOUND",b})}b.keys=()=>[],b.resolve=b,b.id=79405,a.exports=b},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80099:a=>{"use strict";a.exports=require("node:sqlite")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87711:(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]/export/route",pathname:"/api/sessions/[id]/export",filename:"route",bundlePath:"app/api/sessions/[id]/export/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/sessions/[id]/export/route.ts",nextConfigOutput:"",userland:()=>c(39421),...{}}),{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]/export/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,402],()=>b(b.s=87711));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var a={};a.id=6849,a.ids=[6849],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14858:(a,b,c)=>{function d(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function e(a,b){if("string"!=typeof b||a.length>40)return a;let c=b.replace(/\s+/g," ").trim();if(!c)return a;let d=a?" ":"",e=a+d;if(e.length>=41)return e.slice(0,41);let f=41-e.length;return e+c.slice(0,f)}function f(a){if("message"!==a.type||!d(a.message)||"string"!=typeof a.message.role)return;let b=a.message.content,c="",f=!1;if("string"==typeof b)c=e(c,b);else if(Array.isArray(b)){for(let a of b)if(d(a)&&("image"===a.type&&(f=!0),"text"===a.type&&(c=e(c,a.text)),c.length>40))break}c.length>40?c=c.slice(0,40)+"…":c||(c=f?"[image]":"assistant"===a.message.role?"[assistant]":"message");let g="user"===a.message.role||"assistant"===a.message.role?a.message.role:void 0;return{...g?{role:g}:{},text:c}}function g(a){let b=new Set,c=new Set(a),d=new Set,e=[...a];for(;e.length>0;){let a=e.pop();if(!d.has(a))for(let f of(d.add(a),(c.has(a)||1!==a.children.length)&&b.add(a),a.children))e.push(f)}let g=(a,b,c)=>({...a,children:[],...b?.length?{compressedEntryIds:b}:{},...c?{branchPreview:c}:{}}),h=a.map(a=>g(a,void 0,f(a.entry))),i=a.map((a,b)=>({source:a,projected:h[b],depth:1})),j=(a,c)=>{let d=[{node:a,compressedEntryIds:[],branchPreview:void 0}],e=new Set;for(;d.length>0;){let{node:a,compressedEntryIds:h,branchPreview:i}=d.pop();if(e.has(a))continue;e.add(a);let j=i??f(a.entry);b.has(a)&&c.children.push(g(a,h,j));for(let c=a.children.length-1;c>=0;c--)d.push({node:a.children[c],compressedEntryIds:b.has(a)?[]:[...h,a.entry.id],branchPreview:b.has(a)?void 0:j})}};for(;i.length>0;){let{source:a,projected:c,depth:d}=i.pop();for(let e of a.children){let a=e;if(d>=200){j(a,c);continue}let h=[],k=f(a.entry);for(;!b.has(a)&&1===a.children.length;)h.push(a.entry.id),a=a.children[0],k??=f(a.entry);if(!b.has(a))continue;let l=g(a,h,k);c.children.push(l),i.push({source:a,projected:l,depth:d+1})}}return h}c.d(b,{y:()=>g})},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},68964:(a,b,c)=>{c.d(b,{R6:()=>o,UT:()=>j,Vk:()=>i,fi:()=>n,gQ:()=>f,lC:()=>k,mE:()=>m,vq:()=>l});var d=c(55511),e=c(66737);function f(a){return(0,e.Lf)().prepare("SELECT session_id FROM session_meta WHERE task_id = ? ORDER BY pinned DESC, updated DESC, rowid DESC").all(a).map(a=>a.session_id)}function g(a){return(0,e.Lf)().prepare("SELECT id, project_key AS projectKey, name, created, updated, pinned FROM tasks WHERE id = ?").get(a)}function h(a){var b;return{...a,pinned:1===a.pinned,sessionIds:f(a.id),pinnedSessionIds:(b=a.id,(0,e.Lf)().prepare("SELECT session_id FROM session_meta WHERE task_id = ? AND pinned = 1").all(b).map(a=>a.session_id))}}function i(a){return(0,e.Lf)().prepare("SELECT id, project_key AS projectKey, name, created, updated, pinned FROM tasks WHERE project_key = ? ORDER BY pinned DESC, updated DESC, created DESC").all(a).map(h)}function j(a,b){let c=b.trim();if(!a)throw Error("projectKey is required");if(!c)throw Error("name must not be empty");let f=(0,d.randomUUID)(),g=Date.now();return(0,e.Lf)().prepare("INSERT INTO tasks (id, project_key, name, created, updated) VALUES (?, ?, ?, ?, ?)").run(f,a,c,g,g),{id:f,projectKey:a,name:c,created:g,updated:g,pinned:!1,sessionIds:[],pinnedSessionIds:[]}}function k(a,b){let c=(0,e.Lf)();if(!g(a))return null;c.exec("BEGIN");try{if(void 0!==b.name){let d=b.name.trim();if(!d)throw Error("name must not be empty");c.prepare("UPDATE tasks SET name = ?, updated = ? WHERE id = ?").run(d,Date.now(),a)}if(void 0!==b.pinned&&c.prepare("UPDATE tasks SET pinned = ?, updated = ? WHERE id = ?").run(+!!b.pinned,Date.now(),a),void 0!==b.sessionIds){let d=new Set(f(a)),e=new Set(b.sessionIds),g=Date.now(),h=c.prepare("INSERT INTO session_meta (session_id, task_id, updated) VALUES (?, ?, ?) ON CONFLICT(session_id) DO UPDATE SET task_id = excluded.task_id, updated = excluded.updated"),i=c.prepare("UPDATE session_meta SET task_id = NULL, updated = ? WHERE session_id = ?");for(let c of b.sessionIds)d.has(c)||h.run(c,a,g);for(let a of d)e.has(a)||i.run(g,a);c.prepare("UPDATE tasks SET updated = ? WHERE id = ?").run(g,a)}c.exec("COMMIT")}catch(a){throw c.exec("ROLLBACK"),a}return h(g(a))}function l(a){let b=(0,e.Lf)();b.exec("BEGIN");try{b.prepare("UPDATE session_meta SET task_id = NULL, updated = ? WHERE task_id = ?").run(Date.now(),a),b.prepare("DELETE FROM tasks WHERE id = ?").run(a),b.exec("COMMIT")}catch(a){throw b.exec("ROLLBACK"),a}}function m(a,b){let c=(0,e.Lf)();if(!g(b))return!1;let d=Date.now();c.exec("BEGIN");try{c.prepare("INSERT INTO session_meta (session_id, task_id, updated) VALUES (?, ?, ?) ON CONFLICT(session_id) DO UPDATE SET task_id = excluded.task_id, updated = excluded.updated").run(a,b,d),c.prepare("UPDATE tasks SET updated = ? WHERE id = ?").run(d,b),c.exec("COMMIT")}catch(a){throw c.exec("ROLLBACK"),a}return!0}function n(a,b){(0,e.Lf)().prepare("INSERT INTO session_meta (session_id, task_id, updated, pinned) VALUES (?, NULL, ?, ?) ON CONFLICT(session_id) DO UPDATE SET pinned = excluded.pinned").run(a,Date.now(),+!!b)}function o(a){(0,e.Lf)().prepare("DELETE FROM session_meta WHERE session_id = ?").run(a)}},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80099:a=>{a.exports=require("node:sqlite")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},89691:(a,b,c)=>{function d(a){let b,c=0;for(let e of a){var d;if("message"!==(d=e.type)&&"compaction"!==d&&"branch_summary"!==d&&"custom_message"!==d)continue;let a=Date.parse(e.timestamp);if(!Number.isFinite(a))continue;let f="message"===e.type?e.message?.role:void 0;if("user"===f||"bashExecution"===f){b=a;continue}void 0!==b&&a>b&&(c+=a-b),b=a}return c}c.d(b,{c:()=>d})},96323:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/route",pathname:"/api/sessions/[id]",filename:"route",bundlePath:"app/api/sessions/[id]/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/sessions/[id]/route.ts",nextConfigOutput:"",userland:()=>c(98192),...{}}),{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]/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)}}},98192:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>r,GET:()=>p,PATCH:()=>q});var e=c(23211),f=c(29021),g=c(33873),h=c(75430),i=c(40402),j=c(45902),k=c(56429),l=c(14858),m=c(89691),n=c(68964),o=a([h,i,k]);async function p(a,{params:b}){let{id:c}=await b;try{let b,d=(0,k.A4)(c),g=d?.isAlive()?d:void 0,j=g?null:await (0,i.os)(c);if(!g&&!j)return e.NextResponse.json({error:"Session not found"},{status:404});let n=g?.inner.sessionManager??h.SessionManager.open(j),o=g?.sessionFile||n.getSessionFile()||j||"",p=n.getEntries(),q=n.getLeafId(),r=(0,l.y)(n.getTree()),s=new URL(a.url).searchParams,t=s.has("deferThinking"),u=s.has("deferMedia"),v=Number(s.get("tail")),w=Number.isFinite(v)&&v>0?Math.min(v,1e3):50,x=(0,i.Uv)(p,q,{deferThinking:t,deferToolResultImages:u,tail:w}),y=(0,i.B6)(p,q,w),z=(0,m.c)(p),A=n.getHeader(),B=A?.timestamp??new Date().toISOString();try{B=(0,f.statSync)(o).mtime.toISOString()}catch{}let C=A?.parentSession?await (0,i.u1)(A.parentSession):void 0,D=A?{path:o,id:A.id,cwd:A.cwd??"",name:n.getSessionName(),created:A.timestamp,modified:B,messageCount:x.messages.length,firstMessage:x.messages.find(a=>"user"===a.role)?(b=x.messages.find(a=>"user"===a.role).content,"string"==typeof b?b:(Array.isArray(b)?b.find(a=>"text"===a.type)?.text??"":"")||"(no messages)"):"(no messages)",parentSessionId:C,transient:!o||!(0,f.existsSync)(o)}:null;return e.NextResponse.json({sessionId:c,filePath:o,info:D,leafId:q,tree:r,context:x,totalActiveMs:z,hasMore:y})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}async function q(a,{params:b}){let{id:c}=await b;try{let b=await a.json().catch(()=>({})),d=await (0,i.os)(c);if(!d)return e.NextResponse.json({error:"Session not found"},{status:404});if(void 0!==b.name){if("string"!=typeof b.name)return e.NextResponse.json({error:"name must be a string"},{status:400});return h.SessionManager.open(d).appendSessionInfo(b.name.trim()),(0,i.mD)(),e.NextResponse.json({ok:!0})}if(void 0!==b.pinned){if("boolean"!=typeof b.pinned)return e.NextResponse.json({error:"pinned must be a boolean"},{status:400});return(0,n.fi)(c,b.pinned),(0,i.mD)(),e.NextResponse.json({ok:!0})}return e.NextResponse.json({error:"name or pinned is required"},{status:400})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}async function r(a,{params:b}){let{id:c}=await b;try{let a=await (0,i.os)(c);if(!a)return e.NextResponse.json({error:"Session not found"},{status:404});let b=(0,i.eP)(a)?.parentSession,d=(0,j.$)(a),h=(0,g.dirname)(a);try{for(let a of(0,f.readdirSync)(h).filter(a=>a.endsWith(".jsonl")&&(0,j.$)((0,g.join)(h,a))!==d)){let c=(0,g.join)(h,a);try{let a=(0,f.readFileSync)(c,"utf8").split("\n"),e=JSON.parse(a[0]);"session"===e.type&&e.parentSession&&(0,j.$)(e.parentSession)===d&&(e.parentSession=b,a[0]=JSON.stringify(e),(0,f.writeFileSync)(c,a.join("\n")))}catch{}}}catch{}return await (0,k.A4)(c)?.shutdown(),(0,f.unlinkSync)(a),(0,i.BR)(c),(0,i.mD)(),(0,n.R6)(c),e.NextResponse.json({ok:!0})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}[h,i,k]=o.then?(await o)():o,d()}catch(a){d(a)}})}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,402,1457],()=>b(b.s=96323));module.exports=c})();
|
|
1
|
+
"use strict";(()=>{var a={};a.id=6849,a.ids=[6849],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14858:(a,b,c)=>{function d(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function e(a,b){if("string"!=typeof b||a.length>40)return a;let c=b.replace(/\s+/g," ").trim();if(!c)return a;let d=a?" ":"",e=a+d;if(e.length>=41)return e.slice(0,41);let f=41-e.length;return e+c.slice(0,f)}function f(a){if("message"!==a.type||!d(a.message)||"string"!=typeof a.message.role)return;let b=a.message.content,c="",f=!1;if("string"==typeof b)c=e(c,b);else if(Array.isArray(b)){for(let a of b)if(d(a)&&("image"===a.type&&(f=!0),"text"===a.type&&(c=e(c,a.text)),c.length>40))break}c.length>40?c=c.slice(0,40)+"…":c||(c=f?"[image]":"assistant"===a.message.role?"[assistant]":"message");let g="user"===a.message.role||"assistant"===a.message.role?a.message.role:void 0;return{...g?{role:g}:{},text:c}}function g(a){let b=new Set,c=new Set(a),d=new Set,e=[...a];for(;e.length>0;){let a=e.pop();if(!d.has(a))for(let f of(d.add(a),(c.has(a)||1!==a.children.length)&&b.add(a),a.children))e.push(f)}let g=(a,b,c)=>({...a,children:[],...b?.length?{compressedEntryIds:b}:{},...c?{branchPreview:c}:{}}),h=a.map(a=>g(a,void 0,f(a.entry))),i=a.map((a,b)=>({source:a,projected:h[b],depth:1})),j=(a,c)=>{let d=[{node:a,compressedEntryIds:[],branchPreview:void 0}],e=new Set;for(;d.length>0;){let{node:a,compressedEntryIds:h,branchPreview:i}=d.pop();if(e.has(a))continue;e.add(a);let j=i??f(a.entry);b.has(a)&&c.children.push(g(a,h,j));for(let c=a.children.length-1;c>=0;c--)d.push({node:a.children[c],compressedEntryIds:b.has(a)?[]:[...h,a.entry.id],branchPreview:b.has(a)?void 0:j})}};for(;i.length>0;){let{source:a,projected:c,depth:d}=i.pop();for(let e of a.children){let a=e;if(d>=200){j(a,c);continue}let h=[],k=f(a.entry);for(;!b.has(a)&&1===a.children.length;)h.push(a.entry.id),a=a.children[0],k??=f(a.entry);if(!b.has(a))continue;let l=g(a,h,k);c.children.push(l),i.push({source:a,projected:l,depth:d+1})}}return h}c.d(b,{y:()=>g})},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},62471:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/route",pathname:"/api/sessions/[id]",filename:"route",bundlePath:"app/api/sessions/[id]/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/sessions/[id]/route.ts",nextConfigOutput:"",userland:()=>c(98192),...{}}),{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]/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=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},68964:(a,b,c)=>{c.d(b,{Me:()=>l,R6:()=>p,UT:()=>j,Vk:()=>i,fi:()=>o,gQ:()=>f,lC:()=>k,mE:()=>n,vq:()=>m});var d=c(55511),e=c(66737);function f(a){return(0,e.Lf)().prepare("SELECT session_id FROM session_meta WHERE task_id = ? ORDER BY pinned DESC, updated DESC, rowid DESC").all(a).map(a=>a.session_id)}function g(a){return(0,e.Lf)().prepare("SELECT id, project_key AS projectKey, name, created, updated, pinned, sort_order AS sortOrder FROM tasks WHERE id = ?").get(a)}function h(a){var b;return{...a,pinned:1===a.pinned,sessionIds:f(a.id),pinnedSessionIds:(b=a.id,(0,e.Lf)().prepare("SELECT session_id FROM session_meta WHERE task_id = ? AND pinned = 1").all(b).map(a=>a.session_id))}}function i(a){return(0,e.Lf)().prepare("SELECT id, project_key AS projectKey, name, created, updated, pinned, sort_order AS sortOrder FROM tasks WHERE project_key = ? ORDER BY pinned DESC, sort_order, created, rowid").all(a).map(h)}function j(a,b){let c=b.trim();if(!a)throw Error("projectKey is required");if(!c)throw Error("name must not be empty");let f=(0,d.randomUUID)(),g=Date.now();return(0,e.Lf)().prepare("INSERT INTO tasks (id, project_key, name, created, updated, sort_order) VALUES (?, ?, ?, ?, ?, ?)").run(f,a,c,g,g,g),{id:f,projectKey:a,name:c,created:g,updated:g,pinned:!1,sortOrder:g,sessionIds:[],pinnedSessionIds:[]}}function k(a,b){let c=(0,e.Lf)();if(!g(a))return null;c.exec("BEGIN");try{if(void 0!==b.name){let d=b.name.trim();if(!d)throw Error("name must not be empty");c.prepare("UPDATE tasks SET name = ?, updated = ? WHERE id = ?").run(d,Date.now(),a)}if(void 0!==b.pinned&&c.prepare("UPDATE tasks SET pinned = ?, updated = ? WHERE id = ?").run(+!!b.pinned,Date.now(),a),void 0!==b.sortOrder&&c.prepare("UPDATE tasks SET sort_order = ?, updated = ? WHERE id = ?").run(b.sortOrder,Date.now(),a),void 0!==b.sessionIds){let d=new Set(f(a)),e=new Set(b.sessionIds),g=Date.now(),h=c.prepare("INSERT INTO session_meta (session_id, task_id, updated) VALUES (?, ?, ?) ON CONFLICT(session_id) DO UPDATE SET task_id = excluded.task_id, updated = excluded.updated"),i=c.prepare("UPDATE session_meta SET task_id = NULL, updated = ? WHERE session_id = ?");for(let c of b.sessionIds)d.has(c)||h.run(c,a,g);for(let a of d)e.has(a)||i.run(g,a);c.prepare("UPDATE tasks SET updated = ? WHERE id = ?").run(g,a)}c.exec("COMMIT")}catch(a){throw c.exec("ROLLBACK"),a}return h(g(a))}function l(a,b){let c=(0,e.Lf)();if(0===b.length)return i(a);c.exec("BEGIN");try{let d=c.prepare("UPDATE tasks SET sort_order = ?, updated = ? WHERE id = ? AND project_key = ?");b.forEach((b,c)=>{let e=d.run(c,Date.now(),b,a);if(0===e.changes)throw Error(`task ${b} does not belong to project ${a}`)}),c.exec("COMMIT")}catch(a){throw c.exec("ROLLBACK"),a}return i(a)}function m(a){let b=(0,e.Lf)();b.exec("BEGIN");try{b.prepare("UPDATE session_meta SET task_id = NULL, updated = ? WHERE task_id = ?").run(Date.now(),a),b.prepare("DELETE FROM tasks WHERE id = ?").run(a),b.exec("COMMIT")}catch(a){throw b.exec("ROLLBACK"),a}}function n(a,b){let c=(0,e.Lf)();if(!g(b))return!1;let d=Date.now();c.exec("BEGIN");try{c.prepare("INSERT INTO session_meta (session_id, task_id, updated) VALUES (?, ?, ?) ON CONFLICT(session_id) DO UPDATE SET task_id = excluded.task_id, updated = excluded.updated").run(a,b,d),c.prepare("UPDATE tasks SET updated = ? WHERE id = ?").run(d,b),c.exec("COMMIT")}catch(a){throw c.exec("ROLLBACK"),a}return!0}function o(a,b){(0,e.Lf)().prepare("INSERT INTO session_meta (session_id, task_id, updated, pinned) VALUES (?, NULL, ?, ?) ON CONFLICT(session_id) DO UPDATE SET pinned = excluded.pinned").run(a,Date.now(),+!!b)}function p(a){(0,e.Lf)().prepare("DELETE FROM session_meta WHERE session_id = ?").run(a)}},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80099:a=>{a.exports=require("node:sqlite")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},89691:(a,b,c)=>{function d(a){let b,c=0;for(let e of a){var d;if("message"!==(d=e.type)&&"compaction"!==d&&"branch_summary"!==d&&"custom_message"!==d)continue;let a=Date.parse(e.timestamp);if(!Number.isFinite(a))continue;let f="message"===e.type?e.message?.role:void 0;if("user"===f||"bashExecution"===f){b=a;continue}void 0!==b&&a>b&&(c+=a-b),b=a}return c}c.d(b,{c:()=>d})},98192:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>r,GET:()=>p,PATCH:()=>q});var e=c(23211),f=c(29021),g=c(33873),h=c(75430),i=c(40402),j=c(45902),k=c(56429),l=c(14858),m=c(89691),n=c(68964),o=a([h,i,k]);async function p(a,{params:b}){let{id:c}=await b;try{let b,d=(0,k.A4)(c),g=d?.isAlive()?d:void 0,j=g?null:await (0,i.os)(c);if(!g&&!j)return e.NextResponse.json({error:"Session not found"},{status:404});let n=g?.inner.sessionManager??h.SessionManager.open(j),o=g?.sessionFile||n.getSessionFile()||j||"",p=n.getEntries(),q=n.getLeafId(),r=(0,l.y)(n.getTree()),s=new URL(a.url).searchParams,t=s.has("deferThinking"),u=s.has("deferMedia"),v=Number(s.get("tail")),w=Number.isFinite(v)&&v>0?Math.min(v,1e3):50,x=(0,i.Uv)(p,q,{deferThinking:t,deferToolResultImages:u,tail:w}),y=(0,i.B6)(p,q,w),z=(0,m.c)(p),A=n.getHeader(),B=A?.timestamp??new Date().toISOString();try{B=(0,f.statSync)(o).mtime.toISOString()}catch{}let C=A?.parentSession?await (0,i.u1)(A.parentSession):void 0,D=A?{path:o,id:A.id,cwd:A.cwd??"",name:n.getSessionName(),created:A.timestamp,modified:B,messageCount:x.messages.length,firstMessage:x.messages.find(a=>"user"===a.role)?(b=x.messages.find(a=>"user"===a.role).content,"string"==typeof b?b:(Array.isArray(b)?b.find(a=>"text"===a.type)?.text??"":"")||"(no messages)"):"(no messages)",parentSessionId:C,transient:!o||!(0,f.existsSync)(o)}:null;return e.NextResponse.json({sessionId:c,filePath:o,info:D,leafId:q,tree:r,context:x,totalActiveMs:z,hasMore:y})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}async function q(a,{params:b}){let{id:c}=await b;try{let b=await a.json().catch(()=>({})),d=await (0,i.os)(c);if(!d)return e.NextResponse.json({error:"Session not found"},{status:404});if(void 0!==b.name){if("string"!=typeof b.name)return e.NextResponse.json({error:"name must be a string"},{status:400});return h.SessionManager.open(d).appendSessionInfo(b.name.trim()),(0,i.mD)(),e.NextResponse.json({ok:!0})}if(void 0!==b.pinned){if("boolean"!=typeof b.pinned)return e.NextResponse.json({error:"pinned must be a boolean"},{status:400});return(0,n.fi)(c,b.pinned),(0,i.mD)(),e.NextResponse.json({ok:!0})}return e.NextResponse.json({error:"name or pinned is required"},{status:400})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}async function r(a,{params:b}){let{id:c}=await b;try{let a=await (0,i.os)(c);if(!a)return e.NextResponse.json({error:"Session not found"},{status:404});let b=(0,i.eP)(a)?.parentSession,d=(0,j.$)(a),h=(0,g.dirname)(a);try{for(let a of(0,f.readdirSync)(h).filter(a=>a.endsWith(".jsonl")&&(0,j.$)((0,g.join)(h,a))!==d)){let c=(0,g.join)(h,a);try{let a=(0,f.readFileSync)(c,"utf8").split("\n"),e=JSON.parse(a[0]);"session"===e.type&&e.parentSession&&(0,j.$)(e.parentSession)===d&&(e.parentSession=b,a[0]=JSON.stringify(e),(0,f.writeFileSync)(c,a.join("\n")))}catch{}}}catch{}return await (0,k.A4)(c)?.shutdown(),(0,f.unlinkSync)(a),(0,i.BR)(c),(0,i.mD)(),(0,n.R6)(c),e.NextResponse.json({ok:!0})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}[h,i,k]=o.then?(await o)():o,d()}catch(a){d(a)}})}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,402,1457],()=>b(b.s=62471));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var a={};a.id=3943,a.ids=[3943],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},33873:a=>{a.exports=require("path")},
|
|
1
|
+
"use strict";(()=>{var a={};a.id=3943,a.ids=[3943],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80099:a=>{a.exports=require("node:sqlite")},83931:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/state/route",pathname:"/api/sessions/[id]/state",filename:"route",bundlePath:"app/api/sessions/[id]/state/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/sessions/[id]/state/route.ts",nextConfigOutput:"",userland:()=>c(87230),...{}}),{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]/state/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87230:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>i});var e=c(23211),f=c(56429),g=c(40402),h=a([f,g]);async function i(a,{params:b}){let{id:c}=await b;try{let a=(0,f.A4)(c);if(a?.isAlive()){let b=await a.send({type:"get_state"});return e.NextResponse.json({running:!0,state:b})}if(!await (0,g.os)(c))return e.NextResponse.json({error:"Session not found"},{status:404});return e.NextResponse.json({running:!1})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}[f,g]=h.then?(await h)():h,d()}catch(a){d(a)}})}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,402,1457],()=>b(b.s=83931));module.exports=c})();
|