@calmabacus/pi-web 1.2.1 → 1.2.3
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 +10 -10
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.js +1 -1
- package/.next/required-server-files.json +1 -1
- 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_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +4 -4
- package/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/api/app-update/route.js +1 -1
- package/.next/server/app/api/files/[...path]/route.js +1 -1
- package/.next/server/app/api/git/diff/route.js +1 -1
- package/.next/server/app/api/git/status/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/server/app/api/sessions/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +6 -6
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/index.segments/_full.segment.rsc +6 -6
- package/.next/server/app/index.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +5 -5
- package/.next/server/app/login.segments/_full.segment.rsc +5 -5
- package/.next/server/app/login.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +5 -5
- package/.next/server/app/page.js +23 -21
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +10 -10
- package/.next/server/chunks/2243.js +1 -1
- package/.next/server/chunks/6429.js +1 -1
- package/.next/server/chunks/8759.js +1 -1
- 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/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/1278-cee1a583acfdbbe3.js +1 -0
- package/.next/static/chunks/app/{layout-8107f92bf8c4f079.js → layout-27fe292fb4ac13b1.js} +1 -1
- package/.next/static/chunks/app/page-5fed5824645066c6.js +232 -0
- package/.next/static/css/491a0a5a0e53b1a3.css +1 -0
- package/.next/static/css/f8fa1f54e8c1b29d.css +1 -0
- package/.next/trace +7 -8
- package/.next/trace-build +1 -1
- package/package.json +1 -1
- package/.next/static/chunks/1278-91ec2ed874c311e1.js +0 -1
- package/.next/static/chunks/app/page-56d231db3c2bd0e6.js +0 -230
- package/.next/static/css/872801e009d6694b.css +0 -1
- package/.next/static/css/cafc50ea9d8ddb27.css +0 -1
- /package/.next/static/{BO6FXyBbTtC6cy9_zPHfY → bgANcYaziFYzUL8D6omlF}/_buildManifest.js +0 -0
- /package/.next/static/{BO6FXyBbTtC6cy9_zPHfY → bgANcYaziFYzUL8D6omlF}/_ssgManifest.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
1:"$Sreact.fragment"
|
|
2
2
|
2:I[57121,[],""]
|
|
3
3
|
3:I[74581,[],""]
|
|
4
|
-
4:I[57788,["7177","static/chunks/app/layout-
|
|
4
|
+
4:I[57788,["7177","static/chunks/app/layout-27fe292fb4ac13b1.js"],"PwaRegistration"]
|
|
5
5
|
5:I[90484,[],"OutletBoundary"]
|
|
6
6
|
6:"$Sreact.suspense"
|
|
7
7
|
9:I[90484,[],"ViewportBoundary"]
|
|
@@ -10,10 +10,10 @@ d:I[27123,[],"default",1]
|
|
|
10
10
|
:HL["/_next/static/media/7deddc85b7ffd1dc-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
|
|
11
11
|
:HL["/_next/static/media/ec14413c594b3356-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
|
|
12
12
|
:HL["/_next/static/css/88714c00e109ce28.css","style"]
|
|
13
|
-
:HL["/_next/static/css/
|
|
14
|
-
:HL["/_next/static/css/
|
|
13
|
+
:HL["/_next/static/css/f8fa1f54e8c1b29d.css","style"]
|
|
14
|
+
:HL["/_next/static/css/491a0a5a0e53b1a3.css","style"]
|
|
15
15
|
8:X
|
|
16
|
-
0:{"P":null,"c":["","_not-found"],"q":"","i":false,"f":[[["",{"children":["_not-found",{"children":["__PAGE__",{},"$undefined","$undefined",4608]},"$undefined","$undefined",4608]},"$undefined","$undefined",4624],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/88714c00e109ce28.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/
|
|
16
|
+
0:{"P":null,"c":["","_not-found"],"q":"","i":false,"f":[[["",{"children":["_not-found",{"children":["__PAGE__",{},"$undefined","$undefined",4608]},"$undefined","$undefined",4608]},"$undefined","$undefined",4624],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/88714c00e109ce28.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/f8fa1f54e8c1b29d.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","2",{"rel":"stylesheet","href":"/_next/static/css/491a0a5a0e53b1a3.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","translate":"no","className":"__variable_66b8ca notranslate","suppressHydrationWarning":true,"children":[["$","head",null,{"children":[["$","meta",null,{"name":"google","content":"notranslate"}],["$","script",null,{"dangerouslySetInnerHTML":{"__html":"(function(){try{if(localStorage.getItem(\"pi-web-sarasa-enabled\")===\"1\")document.documentElement.classList.add(\"sarasa-term-webfont\");var t=localStorage.getItem(\"pi-theme\");var dark=t===\"dark\"||((t==null||t===\"\"||t===\"auto\")&&window.matchMedia(\"(prefers-color-scheme: dark)\").matches);if(dark)document.documentElement.classList.add(\"dark\");var c=dark?\"#242424\":\"#f5f5f5\";var ms=document.querySelectorAll('meta[name=\"theme-color\"]');if(ms.length===0){var m=document.createElement(\"meta\");m.name=\"theme-color\";m.content=c;document.head.appendChild(m)}else{for(var i=0;i<ms.length;i++){ms[i].removeAttribute(\"media\");ms[i].content=c}}}catch(e){}})();"}}]]}],["$","body",null,{"translate":"no","className":"notranslate","suppressHydrationWarning":true,"children":[["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}],["$","$L4",null,{}]]}]]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],null,["$","$L5",null,{"children":["$","$6",null,{"name":"Next.MetadataOutlet","children":"$@7"}]}]]}],{},null,false,null]},null,false,"$8"]},null,false,null],["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L9",null,{"children":"$La"}],["$","div",null,{"hidden":true,"children":["$","$Lb",null,{"children":["$","$6",null,{"name":"Next.Metadata","children":"$Lc"}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}],false]],"m":"$undefined","G":["$d",[]],"S":true,"h":null,"r":"$undefined","s":"$undefined","a":"$undefined","l":"$undefined","p":"$undefined","d":"$undefined","b":"bgANcYaziFYzUL8D6omlF"}
|
|
17
17
|
8:C
|
|
18
18
|
a:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-content"}],["$","meta","2",{"name":"theme-color","content":"#f5f5f5"}]]
|
|
19
19
|
e:I[86869,[],"IconMark"]
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
b:I[57121,[],""]
|
|
8
8
|
c:I[74581,[],""]
|
|
9
9
|
:HL["/_next/static/css/88714c00e109ce28.css","style"]
|
|
10
|
-
:HL["/_next/static/css/
|
|
11
|
-
:HL["/_next/static/css/
|
|
10
|
+
:HL["/_next/static/css/f8fa1f54e8c1b29d.css","style"]
|
|
11
|
+
:HL["/_next/static/css/491a0a5a0e53b1a3.css","style"]
|
|
12
12
|
6:X
|
|
13
13
|
e:X
|
|
14
14
|
e:C
|
|
15
|
-
0:{"buildId":"
|
|
16
|
-
14:I[57788,["7177","static/chunks/app/layout-
|
|
15
|
+
0:{"buildId":"bgANcYaziFYzUL8D6omlF","data":[{"rsc":["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],null,["$","$L2",null,{"children":["$","$3",null,{"name":"Next.MetadataOutlet","children":"$@4"}]}]]}],"isPartial":"$@5","staleTime":"$6","varyParams":null},{"rsc":["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L7",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-content"}],["$","meta","2",{"name":"theme-color","content":"#f5f5f5"}]]}],["$","div",null,{"hidden":true,"children":["$","$L8",null,{"children":["$","$3",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"Pi Web"}],["$","meta","1",{"name":"description","content":"Pi Web interface for the pi coding agent"}],["$","meta","2",{"name":"application-name","content":"Pi Web"}],["$","link","3",{"rel":"manifest","href":"/manifest.webmanifest"}],["$","meta","4",{"name":"format-detection","content":"telephone=no"}],["$","meta","5",{"name":"mobile-web-app-capable","content":"yes"}],["$","meta","6",{"name":"apple-mobile-web-app-title","content":"Pi Web"}],["$","meta","7",{"name":"apple-mobile-web-app-status-bar-style","content":"black-translucent"}],["$","link","8",{"rel":"icon","href":"/favicon.svg?v=b1e5fdfb","type":"image/svg+xml"}],["$","link","9",{"rel":"icon","href":"/icons/icon-192.png?v=b1e5fdfb","sizes":"192x192","type":"image/png"}],["$","link","10",{"rel":"icon","href":"/favicon.ico?v=b1e5fdfb","sizes":"any"}],["$","link","11",{"rel":"apple-touch-icon","href":"/icons/apple-touch-icon.png?v=b1e5fdfb","sizes":"180x180","type":"image/png"}],["$","$L9","12",{}]]}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}],"isPartial":"$@a","staleTime":"$6","varyParams":null},{"rsc":["$","$1","c",{"children":[null,["$","$Lb",null,{"parallelRouterKey":"children","template":["$","$Lc",null,{}]}]]}],"isPartial":"$@d","staleTime":"$6","varyParams":"$e"},{"rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/88714c00e109ce28.css","precedence":"next"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/f8fa1f54e8c1b29d.css","precedence":"next"}],["$","link","2",{"rel":"stylesheet","href":"/_next/static/css/491a0a5a0e53b1a3.css","precedence":"next"}]],["$","html",null,{"lang":"en","translate":"no","className":"__variable_66b8ca notranslate","suppressHydrationWarning":true,"children":[["$","head",null,{"children":[["$","meta",null,{"name":"google","content":"notranslate"}],["$","script",null,{"dangerouslySetInnerHTML":{"__html":"(function(){try{if(localStorage.getItem(\"pi-web-sarasa-enabled\")===\"1\")document.documentElement.classList.add(\"sarasa-term-webfont\");var t=localStorage.getItem(\"pi-theme\");var dark=t===\"dark\"||((t==null||t===\"\"||t===\"auto\")&&window.matchMedia(\"(prefers-color-scheme: dark)\").matches);if(dark)document.documentElement.classList.add(\"dark\");var c=dark?\"#242424\":\"#f5f5f5\";var ms=document.querySelectorAll('meta[name=\"theme-color\"]');if(ms.length===0){var m=document.createElement(\"meta\");m.name=\"theme-color\";m.content=c;document.head.appendChild(m)}else{for(var i=0;i<ms.length;i++){ms[i].removeAttribute(\"media\");ms[i].content=c}}}catch(e){}})();"}}]]}],["$","body",null,{"translate":"no","className":"notranslate","suppressHydrationWarning":true,"children":["$Lf","$L10"]}]]}]]}],"isPartial":"$@11","staleTime":"$6","varyParams":null}],"isUpgradeableISRFallback":false,"a":"$@12","rootVaryParams":null,"needsRuntimeRequest":"$@13"}
|
|
16
|
+
14:I[57788,["7177","static/chunks/app/layout-27fe292fb4ac13b1.js"],"PwaRegistration"]
|
|
17
17
|
4:null
|
|
18
18
|
f:["$","$Lb",null,{"parallelRouterKey":"children","template":["$","$Lc",null,{}]}]
|
|
19
19
|
10:["$","$L14",null,{}]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
:HL["/_next/static/media/7deddc85b7ffd1dc-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
|
|
2
2
|
:HL["/_next/static/media/ec14413c594b3356-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
|
|
3
3
|
:HL["/_next/static/css/88714c00e109ce28.css","style"]
|
|
4
|
-
:HL["/_next/static/css/
|
|
5
|
-
:HL["/_next/static/css/
|
|
6
|
-
0:{"tree":{"name":"","param":null,"prefetchHints":4176,"slots":{"children":{"name":"_not-found","param":null,"prefetchHints":4192,"slots":{"children":{"name":"__PAGE__","param":null,"prefetchHints":4256,"slots":null}}}}},"staleTime":300,"buildId":"
|
|
4
|
+
:HL["/_next/static/css/f8fa1f54e8c1b29d.css","style"]
|
|
5
|
+
:HL["/_next/static/css/491a0a5a0e53b1a3.css","style"]
|
|
6
|
+
0:{"tree":{"name":"","param":null,"prefetchHints":4176,"slots":{"children":{"name":"_not-found","param":null,"prefetchHints":4192,"slots":{"children":{"name":"__PAGE__","param":null,"prefetchHints":4256,"slots":null}}}}},"staleTime":300,"buildId":"bgANcYaziFYzUL8D6omlF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=9183,a.ids=[9183],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{"use strict";a.exports=require("assert")},14566:a=>{"use strict";a.exports=require("node-pty")},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")},25076:(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/app-update/route",pathname:"/api/app-update",filename:"route",bundlePath:"app/api/app-update/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/app-update/route.ts",nextConfigOutput:"",userland:()=>c(62445),...{}}),{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/app-update/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{"use strict";a.exports=import("@earendil-works/pi-tui")},31421:a=>{"use strict";a.exports=require("node:child_process")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},57975:a=>{"use strict";a.exports=require("node:util")},62445:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GET:()=>o,POST:()=>p,dynamic:()=>g});var d=c(23211),e=c(43618);function f(a){return(0,e.valid)(a)===a&&null===(0,e.prerelease)(a)}let g="force-dynamic",h="1.2.1",i="1"===process.env.PI_WEB_SKIP_VERSION_CHECK,j="1"===process.env.PI_WEB_CAN_UPDATE&&"function"==typeof process.send,k={readonly:"sudo npm install -g @calmabacus/pi-web@latest"};function l(a){let b=k[process.env.PI_WEB_UPDATE_BLOCKED??""];return d.NextResponse.json({...a,canUpdate:j,...b?{manualCommand:b}:{}},{headers:{"Cache-Control":"no-store"}})}async function m(){let a=await fetch("https://registry.npmjs.org/@calmabacus%2Fpi-web/latest",{cache:"no-store",headers:{Accept:"application/json"},signal:AbortSignal.timeout(5e3)});if(!a.ok)throw Error(`npm registry returned HTTP ${a.status}`);let b=await a.json(),c="string"==typeof b.version?b.version:"",d=f(c)?`https://github.com/zhudatou630/pi-web/releases/tag/v${c}`:null;if(!d)throw Error("npm registry returned an invalid version");return{currentVersion:h,latestVersion:c,updateAvailable:f(c)&&f(h)&&(0,e.gt)(c,h),releaseUrl:d}}async function n(a){let b=globalThis.__piWebAppUpdateCache??={expiresAt:0};if(!a&&b.value&&b.expiresAt>Date.now())return b.value;b.inFlight||(b.inFlight=m().then(a=>(b.value=a,b.expiresAt=Date.now()+18e5,a)).finally(()=>{b.inFlight=void 0}));try{return await b.inFlight}catch(c){if(!a&&b.value)return b.value;throw c}}async function o(a){let b=new URL(a.url).searchParams;if(i||"1"===b.get("status"))return l({currentVersion:h,latestVersion:h,updateAvailable:!1,releaseUrl:""});try{return l(await n("1"===b.get("force")))}catch(a){return d.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:502})}}async function p(){if(!j||!process.connected)return d.NextResponse.json({error:"Use a writable npm global installation started with pi-web to update here."},{status:409});let[{hasAppUpdateBlockingSessions:a},{hasAppUpdateBlockingTerminals:b}]=await Promise.all([Promise.all([c.e(426),c.e(974),c.e(402),c.e(6759),c.e(2243),c.e(6429)]).then(c.bind(c,56429)),c.e(3968).then(c.bind(c,73968))]);return globalThis.__piWebUpdating?d.NextResponse.json({error:"Pi Web is already updating."},{status:409}):a()||b()?d.NextResponse.json({error:"Finish running Agent tasks and close terminal sessions before updating."},{status:409}):(globalThis.__piWebUpdating=!0,(0,d.after)(()=>{process.send({type:"pi-web:update"},a=>{a&&(globalThis.__piWebUpdating=!1,console.error("[pi-web] Could not request update:",a))})}),d.NextResponse.json({updating:!0},{status:202}))}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},72322:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/utils/pi-user-agent")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,3618],()=>b(b.s=25076));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=9183,a.ids=[9183],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{"use strict";a.exports=require("assert")},14566:a=>{"use strict";a.exports=require("node-pty")},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")},25076:(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/app-update/route",pathname:"/api/app-update",filename:"route",bundlePath:"app/api/app-update/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/app-update/route.ts",nextConfigOutput:"",userland:()=>c(62445),...{}}),{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/app-update/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{"use strict";a.exports=import("@earendil-works/pi-tui")},31421:a=>{"use strict";a.exports=require("node:child_process")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},57975:a=>{"use strict";a.exports=require("node:util")},62445:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GET:()=>o,POST:()=>p,dynamic:()=>g});var d=c(23211),e=c(43618);function f(a){return(0,e.valid)(a)===a&&null===(0,e.prerelease)(a)}let g="force-dynamic",h="1.2.3",i="1"===process.env.PI_WEB_SKIP_VERSION_CHECK,j="1"===process.env.PI_WEB_CAN_UPDATE&&"function"==typeof process.send,k={readonly:"sudo npm install -g @calmabacus/pi-web@latest"};function l(a){let b=k[process.env.PI_WEB_UPDATE_BLOCKED??""];return d.NextResponse.json({...a,canUpdate:j,...b?{manualCommand:b}:{}},{headers:{"Cache-Control":"no-store"}})}async function m(){let a=await fetch("https://registry.npmjs.org/@calmabacus%2Fpi-web/latest",{cache:"no-store",headers:{Accept:"application/json"},signal:AbortSignal.timeout(5e3)});if(!a.ok)throw Error(`npm registry returned HTTP ${a.status}`);let b=await a.json(),c="string"==typeof b.version?b.version:"",d=f(c)?`https://github.com/zhudatou630/pi-web/releases/tag/v${c}`:null;if(!d)throw Error("npm registry returned an invalid version");return{currentVersion:h,latestVersion:c,updateAvailable:f(c)&&f(h)&&(0,e.gt)(c,h),releaseUrl:d}}async function n(a){let b=globalThis.__piWebAppUpdateCache??={expiresAt:0};if(!a&&b.value&&b.expiresAt>Date.now())return b.value;b.inFlight||(b.inFlight=m().then(a=>(b.value=a,b.expiresAt=Date.now()+18e5,a)).finally(()=>{b.inFlight=void 0}));try{return await b.inFlight}catch(c){if(!a&&b.value)return b.value;throw c}}async function o(a){let b=new URL(a.url).searchParams;if(i||"1"===b.get("status"))return l({currentVersion:h,latestVersion:h,updateAvailable:!1,releaseUrl:""});try{return l(await n("1"===b.get("force")))}catch(a){return d.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:502})}}async function p(){if(!j||!process.connected)return d.NextResponse.json({error:"Use a writable npm global installation started with pi-web to update here."},{status:409});let[{hasAppUpdateBlockingSessions:a},{hasAppUpdateBlockingTerminals:b}]=await Promise.all([Promise.all([c.e(426),c.e(974),c.e(402),c.e(6759),c.e(2243),c.e(6429)]).then(c.bind(c,56429)),c.e(3968).then(c.bind(c,73968))]);return globalThis.__piWebUpdating?d.NextResponse.json({error:"Pi Web is already updating."},{status:409}):a()||b()?d.NextResponse.json({error:"Finish running Agent tasks and close terminal sessions before updating."},{status:409}):(globalThis.__piWebUpdating=!0,(0,d.after)(()=>{process.send({type:"pi-web:update"},a=>{a&&(globalThis.__piWebUpdating=!1,console.error("[pi-web] Could not request update:",a))})}),d.NextResponse.json({updating:!0},{status:202}))}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},72322:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/utils/pi-user-agent")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,3618],()=>b(b.s=25076));module.exports=c})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var a={};a.id=4037,a.ids=[4037],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1060:(a,b,c)=>{"use strict";c.d(b,{Ac:()=>
|
|
1
|
+
(()=>{var a={};a.id=4037,a.ids=[4037],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1060:(a,b,c)=>{"use strict";c.d(b,{Ac:()=>q,GO:()=>l,Kn:()=>g,X:()=>n,_4:()=>d,cV:()=>m,jL:()=>f,k2:()=>o,kv:()=>e,oC:()=>p});let d=262144,e=0xa00000,f=0xa00000,g="Binary file, preview not available",h={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif"},i={mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",opus:"audio/ogg",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",weba:"audio/webm"},j={mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",mov:"video/quicktime",ogv:"video/ogg"},k={pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};function l(a){return(a.replace(/\\/g,"/").split("/").pop()??"").toLowerCase().split(".").pop()??""}function m(a){return h[l(a)]??null}function n(a){return i[l(a)]??null}function o(a){return j[l(a)]??null}function p(a){return k[l(a)]??null}function q(a){let b=l(a);return"pdf"===b||"docx"===b?b:null}},1304:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>z,POST:()=>w});var e=c(23211),f=c(29021),g=c.n(f),h=c(33873),i=c.n(h),j=c(80547),k=c(1060),l=c(88473),m=c(65630),n=c(66544),o=c(55484),p=c(66829),q=c(58864),r=c(37688),s=a([j,m]);[j,m]=s.then?(await s)():s;let A=new Set(["node_modules",".git",".next","dist","build","__pycache__",".turbo",".cache","coverage",".pytest_cache",".mypy_cache","target","vendor",".DS_Store",".git"]),B=[".pyc"],C=new Set(["list","read","download","meta","preview","watch"]),D={ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",html:"html",htm:"html",css:"css",scss:"css",less:"css",json:"json",jsonl:"json",yaml:"yaml",yml:"yaml",toml:"toml",xml:"xml",md:"markdown",mdx:"markdown",markdown:"markdown",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"dockerfile",tf:"hcl",hcl:"hcl",env:"bash",gitignore:"bash",txt:"text",pdf:"pdf",docx:"word"};function t(a){let b=i().basename(a).toLowerCase();return"dockerfile"===b||b.startsWith("dockerfile.")?"dockerfile":".env"===b||b.startsWith(".env.")?"bash":"makefile"===b||"gnumakefile"===b?"makefile":D[b.split(".").pop()??""]??"text"}function u(a){return`${a.dev}:${a.ino}:${a.size}:${a.mtimeMs}:${a.ctimeMs}`}async function v(a){let b,c=(0,q.A_)(a),d=await (0,j.mc)();if(!(0,j.A$)(c,d))return{response:e.NextResponse.json({error:"Access denied"},{status:403})};try{b=g().statSync(c)}catch{return{response:e.NextResponse.json({error:"Upload directory not found"},{status:404})}}if(!b.isDirectory())return{response:e.NextResponse.json({error:"Upload target is not a directory"},{status:400})};let f=g().realpathSync(c),h=new Set;for(let a of d)try{h.add(g().realpathSync(a))}catch{}return(0,j.A$)(f,h)?{directory:f}:{response:e.NextResponse.json({error:"Access denied"},{status:403})}}async function w(a,{params:b}){if(!(0,n.EN)(a))return e.NextResponse.json({error:"Untrusted API request"},{status:403});try{let d,{path:f}=await b,g=await v(f);if("response"in g)return g.response;let{directory:h}=g,j=a.nextUrl.searchParams.get("type")??"upload";if("upload-check"===j){var c;let b=await a.json().catch(()=>null),d=(c=b?.fileNames,Array.isArray(c)&&c.every(a=>"string"==typeof a)?c:null);if(!d)return e.NextResponse.json({error:"fileNames must be an array of strings"},{status:400});let f=(0,o.SI)(d);if(f)return e.NextResponse.json({error:f},{status:400});return e.NextResponse.json((0,o.Gu)(h,d))}if("upload"!==j)return e.NextResponse.json({error:"Invalid upload request type"},{status:400});let k=(0,o.Ey)(a.nextUrl.searchParams.get("conflict"));if(!k)return e.NextResponse.json({error:"Invalid conflict strategy"},{status:400});try{d=await (0,p.s)(a,0x6500000)}catch(a){if(a instanceof p.H)return e.NextResponse.json({error:"Uploads must total 100MB or less"},{status:413});throw a}let l=d.getAll("files").filter(a=>"string"!=typeof a);if(l.some(a=>a.size>0x1900000))return e.NextResponse.json({error:"Each upload must be 25MB or smaller"},{status:413});if(l.reduce((a,b)=>a+b.size,0)>0x6400000)return e.NextResponse.json({error:"Uploads must total 100MB or less"},{status:413});let m=l.map(a=>a.name),n=(0,o.SI)(m);if(n)return e.NextResponse.json({error:n},{status:400});let q=(0,o.Gu)(h,m);if("error"===k&&q.conflicts.length>0)return e.NextResponse.json({error:"One or more files already exist",conflicts:q.conflicts,nonReplaceable:q.nonReplaceable},{status:409});let r=new Set(q.conflicts),s=new Set(q.nonReplaceable),t=[],u=[],w=[];for(let a of l){let b,c=i().join(h,a.name);if(r.has(a.name)&&"skip"===k){u.push(a.name);continue}if(r.has(a.name)&&s.has(a.name)){w.push({name:a.name,error:"Cannot replace a directory or symbolic link"});continue}try{b=Buffer.from(await a.arrayBuffer())}catch(b){w.push({name:a.name,error:b instanceof Error?b.message:String(b)});continue}try{(0,o.n2)(c,b,r.has(a.name)),t.push(a.name)}catch(b){w.push({name:a.name,error:b instanceof Error?b.message:String(b)})}}return e.NextResponse.json({uploaded:t,skipped:u,errors:w},{status:w.length>0?207:200})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}function x(a,b){let c=g().createReadStream(a,b),d=!1;return new ReadableStream({start(a){c.on("data",b=>{if(!d)try{a.enqueue(new Uint8Array(b))}catch{d=!0,c.destroy()}}),c.once("end",()=>{if(!d){d=!0;try{a.close()}catch{}}}),c.once("error",b=>{if(!d){d=!0;try{a.error(b)}catch{}}})},cancel(){d=!0,c.destroy()}})}function y(a,b,c,d,e=!1){let f={"Content-Type":c,"Cache-Control":"no-cache","Accept-Ranges":"bytes","Content-Disposition":function(a,b=!1){let c=i().basename(a),d=c.replace(/[^\x20-\x7E]|["\\;\r\n]/g,"_")||"download";return`${b?"attachment":"inline"}; filename="${d}"; filename*=UTF-8''${encodeURIComponent(c).replace(/[!'()*]/g,a=>`%${a.charCodeAt(0).toString(16).toUpperCase()}`)}`}(a,e),"X-Content-Type-Options":"nosniff"};if("image/svg+xml"===c&&(f["Content-Security-Policy"]="default-src 'none'; img-src data:; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'; frame-ancestors 'self'",f["Referrer-Policy"]="no-referrer"),!d)return new Response(x(a),{headers:{...f,"Content-Length":String(b.size)}});let g=/^bytes=(\d*)-(\d*)$/.exec(d);if(!g)return new Response(null,{status:416,headers:{...f,"Content-Range":`bytes */${b.size}`}});let h=g[1]?Number(g[1]):0,j=g[2]?Number(g[2]):b.size-1;if(!g[1]&&g[2]){let a=Number(g[2]);h=Math.max(b.size-a,0),j=b.size-1}if(!Number.isFinite(h)||!Number.isFinite(j)||h<0||j<h||h>=b.size)return new Response(null,{status:416,headers:{...f,"Content-Range":`bytes */${b.size}`}});let k=(j=Math.min(j,b.size-1))-h+1;return new Response(x(a,{start:h,end:j}),{status:206,headers:{...f,"Content-Length":String(k),"Content-Range":`bytes ${h}-${j}/${b.size}`}})}async function z(a,{params:b}){try{var d,f,h;let n,{path:o}=await b,p=(0,q.A_)(o),s=(d=a.nextUrl.searchParams.get("type")??"list",C.has(d)?d:null);if(!s)return e.NextResponse.json({error:"Invalid file request type"},{status:400});let v=a.nextUrl.searchParams.get("sessionId"),w=await (0,j.mc)(),x=(0,j.A$)(p,w),z=!x&&"list"!==s&&await (0,m.Iq)(p,v);if(!x&&!z)return e.NextResponse.json({error:"Access denied"},{status:403});try{n=g().statSync(p)}catch{if("watch"!==s)return e.NextResponse.json({error:"Not found"},{status:404})}let D=n?p:i().dirname(p);if(!z&&!(0,j.B7)(D,w))return e.NextResponse.json({error:"Access denied"},{status:403});if("read"===s){if(!n?.isFile())return e.NextResponse.json({error:"Not a file"},{status:400});let b=(0,k.cV)(p);if(b){if(n.size>k.kv)return e.NextResponse.json({error:"Image too large (>10MB)"},{status:413});return y(p,n,b,a.headers.get("range"))}let c=(0,k.X)(p);if(c)return y(p,n,c,a.headers.get("range"));let d=(0,k.k2)(p);if(d)return y(p,n,d,a.headers.get("range"));let f=(0,k.oC)(p);if(f)return y(p,n,f,a.headers.get("range"));let g=a.nextUrl.searchParams.get("offset");if(null!==g&&!/^\d+$/.test(g))return e.NextResponse.json({error:"Invalid text preview offset"},{status:400});let h=Number(g??0);if(!Number.isSafeInteger(h)||h>n.size)return e.NextResponse.json({error:"Invalid text preview offset"},{status:400});let i=(0,r.P)(p,n.size,h);if(0===h&&i.content.slice(0,8e3).includes("\0"))return e.NextResponse.json({error:k.Kn},{status:415});let j=t(p);return e.NextResponse.json({...i,language:j,size:n.size,version:u(n)})}if("download"===s){if(!n?.isFile())return e.NextResponse.json({error:"Not a file"},{status:400});let b=(0,k.cV)(p)||(0,k.X)(p)||(0,k.k2)(p)||(0,k.oC)(p)||"application/octet-stream";return y(p,n,b,a.headers.get("range"),!0)}if("meta"===s){if(!n?.isFile())return e.NextResponse.json({error:"Not a file"},{status:400});let a=(0,k.cV)(p),b=(0,k.X)(p),c=(0,k.k2)(p),d=(0,k.oC)(p);return e.NextResponse.json({size:n.size,version:u(n),language:t(p),mime:a||b||c||d||"text/plain",previewKind:(0,k.Ac)(p)})}if("preview"===s){if(!n?.isFile())return e.NextResponse.json({error:"Not a file"},{status:400});if("docx"!==(0,k.GO)(p))return e.NextResponse.json({error:"Preview not available for this file type"},{status:400});if(n.size>k.jL)return e.NextResponse.json({error:"DOCX too large for preview (>10MB)"},{status:413});let a=await c.e(3379).then(c.t.bind(c,53379,19)),b=(f=(await a.convertToHtml({path:p},{externalFileAccess:!1,convertImage:a.images.dataUri})).value,h=i().basename(p),`<!doctype html>
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var a={};a.id=2504,a.ids=[2504],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1060:(a,b,c)=>{"use strict";c.d(b,{Ac:()=>
|
|
1
|
+
(()=>{var a={};a.id=2504,a.ids=[2504],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1060:(a,b,c)=>{"use strict";c.d(b,{Ac:()=>q,GO:()=>l,Kn:()=>g,X:()=>n,_4:()=>d,cV:()=>m,jL:()=>f,k2:()=>o,kv:()=>e,oC:()=>p});let d=262144,e=0xa00000,f=0xa00000,g="Binary file, preview not available",h={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif"},i={mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",opus:"audio/ogg",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",weba:"audio/webm"},j={mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",mov:"video/quicktime",ogv:"video/ogg"},k={pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};function l(a){return(a.replace(/\\/g,"/").split("/").pop()??"").toLowerCase().split(".").pop()??""}function m(a){return h[l(a)]??null}function n(a){return i[l(a)]??null}function o(a){return j[l(a)]??null}function p(a){return k[l(a)]??null}function q(a){let b=l(a);return"pdf"===b||"docx"===b?b:null}},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33012:(a,b,c)=>{"use strict";c.d(b,{SQ:()=>z,$G:()=>v});var d=c(79646),e=c(29021),f=c.n(e),g=c(33873),h=c.n(g),i=c(28354),j=c(1060);let k=new Set(["DD","AU","UD","UA","DU","AA","UU"]);function l(a){let b=`${a.indexStatus}${a.worktreeStatus}`;return"??"===b?{status:"untracked",code:"U"}:k.has(b)||b.includes("U")?{status:"conflict",code:"C"}:b.includes("D")?{status:"deleted",code:"D"}:b.includes("R")||b.includes("C")?{status:"renamed",code:"R"}:b.includes("A")?{status:"added",code:"A"}:{status:"modified",code:"M"}}let m=(0,i.promisify)(d.execFile);async function n(a,b,c=8388608){let{stdout:d}=await m("git",["-C",a,...b],{timeout:1e4,maxBuffer:c,env:{...process.env,LC_ALL:"C"}});return d}async function o(a){try{return(await n(a,["rev-parse","--show-toplevel"])).trim()||null}catch{return null}}function p(a){try{return f().realpathSync(a)}catch{return h().resolve(a)}}function q(a){return".."===a||a.startsWith(`..${h().sep}`)||h().isAbsolute(a)}function r(a,b,c){let d=p(a),e=p(b),f=h().resolve(e,c),g=h().relative(d,f);if(q(g))return null;let i=a.replace(/[\\/]+$/,"")||a;return g&&"."!==g?`${i}/${g.split(h().sep).join("/")}`:i}function s(a){return a.split(h().sep).join("/")}async function t(a,b){let c=["status","--porcelain=v1","-z","--untracked-files=all"];return b&&c.push("--",b),function(a){let b=a.split("\0"),c=[];for(let a=0;a<b.length;a++){let d=b[a];if(!d||d.length<4||" "!==d[2])continue;let e=d[0],f=d[1],g={path:d.slice(3),indexStatus:e,worktreeStatus:f};("R"===e||"C"===e||"R"===f||"C"===f)&&(g.originalPath=b[++a]||void 0),c.push(g)}return c}(await n(a,c))}async function u(a,b){let c=s(h().relative(p(a),p(b)));try{let b=await n(a,["diff","--no-color","--no-ext-diff","--numstat","HEAD","--",c||"."]),d=0,e=0;for(let a of b.split(/\r?\n/)){if(!a)continue;let[b,c]=a.split(" ",2),f=Number(b),g=Number(c);Number.isInteger(f)&&(d+=f),Number.isInteger(g)&&(e+=g)}return{additions:d,deletions:e}}catch{return{additions:0,deletions:0}}}async function v(a){let b=await o(a);if(!b)return{isGitRepository:!1,repositoryRoot:null,files:[],additions:0,deletions:0};let[c,d]=await Promise.all([t(b),u(b,a)]),e=c.flatMap(c=>{let d=r(a,b,c.path),e=l(c);return!d&&c.originalPath&&(d=r(a,b,c.originalPath))?[{filePath:d,status:"deleted",code:"D",indexStatus:c.indexStatus,worktreeStatus:c.worktreeStatus}]:d?[{filePath:d,...e,indexStatus:c.indexStatus,worktreeStatus:c.worktreeStatus}]:[]}),g=e.reduce((a,b)=>a+("untracked"===b.status?function(a){try{let b=f().lstatSync(a);if(!b.isFile()||b.size>j._4)return 0;let c=f().readFileSync(a);if(w(c)||0===c.length)return 0;let d=c.toString("utf8");return d.endsWith("\n")?d.split("\n").length-1:d.split("\n").length}catch{return 0}}(b.filePath):0),0);return{isGitRepository:!0,repositoryRoot:b,files:e,additions:d.additions+g,deletions:d.deletions}}function w(a){return a.includes(0)}function x(a,b){let c=b.endsWith("\n"),d=b.split("\n");c&&d.pop();let e=d.map(a=>`+${a}`).join("\n"),f=!c&&d.length>0?"\n\":"";return`diff --git a/${a} b/${a}
|
|
2
2
|
new file mode 100644
|
|
3
3
|
--- /dev/null
|
|
4
4
|
+++ b/${a}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var a={};a.id=3507,a.ids=[3507],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1060:(a,b,c)=>{"use strict";c.d(b,{Ac:()=>
|
|
1
|
+
(()=>{var a={};a.id=3507,a.ids=[3507],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1060:(a,b,c)=>{"use strict";c.d(b,{Ac:()=>q,GO:()=>l,Kn:()=>g,X:()=>n,_4:()=>d,cV:()=>m,jL:()=>f,k2:()=>o,kv:()=>e,oC:()=>p});let d=262144,e=0xa00000,f=0xa00000,g="Binary file, preview not available",h={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif"},i={mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",opus:"audio/ogg",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",weba:"audio/webm"},j={mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",mov:"video/quicktime",ogv:"video/ogg"},k={pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};function l(a){return(a.replace(/\\/g,"/").split("/").pop()??"").toLowerCase().split(".").pop()??""}function m(a){return h[l(a)]??null}function n(a){return i[l(a)]??null}function o(a){return j[l(a)]??null}function p(a){return k[l(a)]??null}function q(a){let b=l(a);return"pdf"===b||"docx"===b?b:null}},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33012:(a,b,c)=>{"use strict";c.d(b,{SQ:()=>z,$G:()=>v});var d=c(79646),e=c(29021),f=c.n(e),g=c(33873),h=c.n(g),i=c(28354),j=c(1060);let k=new Set(["DD","AU","UD","UA","DU","AA","UU"]);function l(a){let b=`${a.indexStatus}${a.worktreeStatus}`;return"??"===b?{status:"untracked",code:"U"}:k.has(b)||b.includes("U")?{status:"conflict",code:"C"}:b.includes("D")?{status:"deleted",code:"D"}:b.includes("R")||b.includes("C")?{status:"renamed",code:"R"}:b.includes("A")?{status:"added",code:"A"}:{status:"modified",code:"M"}}let m=(0,i.promisify)(d.execFile);async function n(a,b,c=8388608){let{stdout:d}=await m("git",["-C",a,...b],{timeout:1e4,maxBuffer:c,env:{...process.env,LC_ALL:"C"}});return d}async function o(a){try{return(await n(a,["rev-parse","--show-toplevel"])).trim()||null}catch{return null}}function p(a){try{return f().realpathSync(a)}catch{return h().resolve(a)}}function q(a){return".."===a||a.startsWith(`..${h().sep}`)||h().isAbsolute(a)}function r(a,b,c){let d=p(a),e=p(b),f=h().resolve(e,c),g=h().relative(d,f);if(q(g))return null;let i=a.replace(/[\\/]+$/,"")||a;return g&&"."!==g?`${i}/${g.split(h().sep).join("/")}`:i}function s(a){return a.split(h().sep).join("/")}async function t(a,b){let c=["status","--porcelain=v1","-z","--untracked-files=all"];return b&&c.push("--",b),function(a){let b=a.split("\0"),c=[];for(let a=0;a<b.length;a++){let d=b[a];if(!d||d.length<4||" "!==d[2])continue;let e=d[0],f=d[1],g={path:d.slice(3),indexStatus:e,worktreeStatus:f};("R"===e||"C"===e||"R"===f||"C"===f)&&(g.originalPath=b[++a]||void 0),c.push(g)}return c}(await n(a,c))}async function u(a,b){let c=s(h().relative(p(a),p(b)));try{let b=await n(a,["diff","--no-color","--no-ext-diff","--numstat","HEAD","--",c||"."]),d=0,e=0;for(let a of b.split(/\r?\n/)){if(!a)continue;let[b,c]=a.split(" ",2),f=Number(b),g=Number(c);Number.isInteger(f)&&(d+=f),Number.isInteger(g)&&(e+=g)}return{additions:d,deletions:e}}catch{return{additions:0,deletions:0}}}async function v(a){let b=await o(a);if(!b)return{isGitRepository:!1,repositoryRoot:null,files:[],additions:0,deletions:0};let[c,d]=await Promise.all([t(b),u(b,a)]),e=c.flatMap(c=>{let d=r(a,b,c.path),e=l(c);return!d&&c.originalPath&&(d=r(a,b,c.originalPath))?[{filePath:d,status:"deleted",code:"D",indexStatus:c.indexStatus,worktreeStatus:c.worktreeStatus}]:d?[{filePath:d,...e,indexStatus:c.indexStatus,worktreeStatus:c.worktreeStatus}]:[]}),g=e.reduce((a,b)=>a+("untracked"===b.status?function(a){try{let b=f().lstatSync(a);if(!b.isFile()||b.size>j._4)return 0;let c=f().readFileSync(a);if(w(c)||0===c.length)return 0;let d=c.toString("utf8");return d.endsWith("\n")?d.split("\n").length-1:d.split("\n").length}catch{return 0}}(b.filePath):0),0);return{isGitRepository:!0,repositoryRoot:b,files:e,additions:d.additions+g,deletions:d.deletions}}function w(a){return a.includes(0)}function x(a,b){let c=b.endsWith("\n"),d=b.split("\n");c&&d.pop();let e=d.map(a=>`+${a}`).join("\n"),f=!c&&d.length>0?"\n\":"";return`diff --git a/${a} b/${a}
|
|
2
2
|
new file mode 100644
|
|
3
3
|
--- /dev/null
|
|
4
4
|
+++ b/${a}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=6849,a.ids=[6849],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},4896:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{a:()=>i});var e=c(75430),f=a([e]);function g(a){return a?"totalTokens"in a&&"number"==typeof a.totalTokens&&a.totalTokens>0?a.totalTokens:(a.input??0)+(a.output??0)+(a.cacheRead??0)+(a.cacheWrite??0):0}async function h(a,b,c){if(!b)return 0;try{let d=c??await (!globalThis.__piStaticModelRuntime&&(globalThis.__piStaticModelRuntime=e.ModelRuntime.create().catch(a=>{throw delete globalThis.__piStaticModelRuntime,a})),globalThis.__piStaticModelRuntime),f=d.getModel(a,b);if(f?.contextWindow&&f.contextWindow>0)return f.contextWindow;let g=d.getModels(),h=g.find(a=>a.id===b&&a.contextWindow>0);if(h?.contextWindow)return h.contextWindow;let i=g.find(a=>(a.id.endsWith(`/${b}`)||b.endsWith(`/${a.id}`))&&a.contextWindow>0);if(i?.contextWindow)return i.contextWindow;let j=b.toLowerCase();if(j.includes("gemini"))return 1048576;if(j.includes("claude-3-7")||j.includes("claude-sonnet-4")||j.includes("claude-opus-4"))return j.includes("opus-4-6")||j.includes("sonnet-4-6")?1e6:2e5;if(j.includes("gpt-4o")||j.includes("o1")||j.includes("o3"))return 128e3;if(j.includes("deepseek"))return 64e3}catch{}return 0}async function i(a,b,c){try{let d;if(Array.isArray(a))if(b){let c=new Map;for(let b of a)"id"in b&&"string"==typeof b.id&&c.set(b.id,b);let e=[],f=b;for(;f;){let a=c.get(f);if(!a)break;e.push(a),f="parentId"in a?a.parentId:void 0}e.reverse(),d=e}else d=a;else d="getBranch"in a&&"function"==typeof a.getBranch?b?a.getBranch(b):a.getBranch():"getEntries"in a&&"function"==typeof a.getEntries?a.getEntries()??[]:[];if(0===d.length)return null;let f=function(a){for(let b=a.length-1;b>=0;b--){let c=a[b];if("model_change"===c.type&&c.modelId)return{provider:c.provider||"",modelId:c.modelId};if("message"===c.type&&"assistant"===c.message.role&&c.message.model)return{provider:c.message.provider||"",modelId:c.message.model}}return null}(d),i=f?await h(f.provider,f.modelId,c):0,j=function(a){for(let b=a.length-1;b>=0;b--)if("compaction"===a[b].type)return a[b];return null}(d);if(j){let a=d.lastIndexOf(j),b=!1;for(let c=d.length-1;c>a;c--){let a=d[c];if("message"===a.type&&"assistant"===a.message.role){let c=a.message.usage;if(c&&g(c)>0){b=!0;break}}}if(!b)return i>0?{tokens:null,contextWindow:i,percent:null}:null}let k=(0,e.getLastAssistantUsage)(d),l=k?g(k):null;if(null===l&&i<=0)return null;let m=null!==l&&i>0?Math.min(100,Math.round(l/i*1e3)/10):null;return{tokens:l,contextWindow:i,percent:m}}catch{return null}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{"use strict";a.exports=require("assert")},14858:(a,b,c)=>{"use strict";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||"system"===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=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21906:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{CQ:()=>k,GW:()=>m,JS:()=>l});var e=c(55511),f=c(29021),g=c(33873),h=c(45902),i=c(7048),j=a([i]);function k(a){let b=(0,f.readFileSync)(a,"utf8"),c=b.split("\n"),d=c.map(a=>{if(!a.trim())return null;try{return JSON.parse(a)}catch{return null}}),e=d[0];if(e?.type!=="session"||"string"!=typeof e.id)return null;let g=d.slice(1).filter(a=>null!==a);return{path:a,pathKey:(0,h.$)(a),id:e.id,parentPath:"string"==typeof e.parentSession?e.parentSession:void 0,lines:c,entries:g,original:b,isSubagent:!!(0,i.$u)(g,e.id,a)}}function l(a,b,c){let d=[...a.lines],e=JSON.parse(d[0]);if(b?e.parentSession=b:delete e.parentSession,d[0]=JSON.stringify(e),a.isSubagent){if(!b||!c)throw Error("Cannot reparent a subagent without a valid parent session");for(let a=1;a<d.length;a+=1){let e;try{e=JSON.parse(d[a])}catch{continue}"custom"!==e.type||e.customType!==i.tP||"object"!=typeof e.data||null===e.data||Array.isArray(e.data)||(e.data={...e.data,parentSessionId:c,parentSessionPath:b},d[a]=JSON.stringify(e))}}return d.join("\n")}function m(a){let b=[];try{for(let c of a){if(!(0,f.existsSync)(c))continue;let a=(0,g.join)((0,g.dirname)(c),`.${(0,g.basename)(c)}-${(0,e.randomUUID)()}.deleting`);try{(0,f.renameSync)(c,a)}catch(a){if("ENOENT"===a.code)continue;throw a}b.push({original:c,staged:a})}}catch(a){for(let a of b.reverse())try{(0,f.renameSync)(a.staged,a.original)}catch{}throw a}for(let a of b)try{(0,f.unlinkSync)(a.staged)}catch{}}i=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{"use strict";a.exports=import("@earendil-works/pi-tui")},31421:a=>{"use strict";a.exports=require("node:child_process")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},57975:a=>{"use strict";a.exports=require("node:util")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},63406:(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]/route",pathname:"/api/sessions/[id]",filename:"route",bundlePath:"app/api/sessions/[id]/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/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)}}},72322:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/utils/pi-user-agent")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},88914:(a,b,c)=>{"use strict";function d(a,b){b&&(a.tokens.input+=b.input??0,a.tokens.output+=b.output??0,a.tokens.cacheRead+=b.cacheRead??0,a.tokens.cacheWrite+=b.cacheWrite??0,a.cost+=b.cost?.total??0)}function e(a){var b;let c={userMessages:0,assistantMessages:0,toolCalls:0,toolResults:0,totalMessages:0,tokens:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0},cost:0};for(let e of a){if("usage"===e.type||"compaction"===e.type||"branch_summary"===e.type){d(c,e.usage);continue}"message"===e.type&&(b=e.message,c.totalMessages+=1,"user"===b.role?c.userMessages+=1:"toolResult"===b.role?(c.toolResults+=1,d(c,b.usage)):"assistant"===b.role&&(c.assistantMessages+=1,Array.isArray(b.content)&&(c.toolCalls+=b.content.filter(a=>"toolCall"===a.type).length),d(c,b.usage)))}return c.tokens.total=c.tokens.input+c.tokens.output+c.tokens.cacheRead+c.tokens.cacheWrite,c}c.d(b,{P:()=>e})},89691:(a,b,c)=>{"use strict";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})},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{},98192:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>w,GET:()=>u,PATCH:()=>v});var e=c(23211),f=c(29021),g=c(33873),h=c(21906),i=c(75430),j=c(40402),k=c(45902),l=c(56429),m=c(14858),n=c(89691),o=c(88914),p=c(4896),q=c(7048),r=c(21560),s=c(8102),t=a([h,i,j,l,p,q]);async function u(a,{params:b}){let{id:c}=await b;try{let b,d="1"===new URL(a.url).searchParams.get("force"),g=function(a,b){let c=(0,l.getRpcSession)(a);if(!c?.isAlive())return;if(!b)return c;let d=c.sessionFile;if(!d||c.isRunning())return c;let e=(0,j.xL)(d);return e.overlongLine?(console.log(`[pi-web] session ${a} tail exceeds the probe window; rebuilding from the file`),(0,l.releaseRpcSessionForExternalWrite)(a)?void 0:c):!e.entryId||c.inner.sessionManager.getEntries().some(a=>a?.id===e.entryId)?c:(console.log(`[pi-web] session ${a} changed on disk; rebuilding from the file`),(0,l.releaseRpcSessionForExternalWrite)(a)?void 0:c)}(c,d),h=g?null:await (0,j.os)(c);if(!g&&!h)return e.NextResponse.json({error:"Session not found"},{status:404});let k=g?.inner.sessionManager??i.SessionManager.open(h),s=g?.sessionFile||k.getSessionFile()||h||"",t=k.getEntries(),u=k.getLeafId(),v=(0,m.y)(k.getTree()),w=new URL(a.url).searchParams,x=w.has("deferThinking"),y=w.has("deferMedia"),z=Number(w.get("tail")),A=Number.isFinite(z)&&z>0?Math.min(z,1e3):200,B=(0,j.Uv)(t,u,{deferThinking:x,deferToolResultImages:y,tail:A,sessionId:c}),C=(0,n.c)(t),D=(0,o.P)(t),E=g?.inner?.getContextUsage?.()??await (0,p.a)(k,u),F=k.getSessionName(),G=t.find(a=>"message"===a.type&&"user"===a.message.role),H=G?.type==="message"?G.message:void 0,I=k.getHeader(),J=I?.timestamp??new Date().toISOString();try{J=(0,f.statSync)(s).mtime.toISOString()}catch{}let K=I?.parentSession?await (0,j.u1)(I.parentSession):void 0,L=I?(0,q.$u)(t,I.id,s):null,M=L?await (0,l.getSubagentRun)(c):null,N=(0,q.ph)(t)?.tools??(0,r.dS)(t),O=I?(await (0,j.zH)([{path:s,id:I.id,cwd:I.cwd??"",name:F,created:I.timestamp,modified:J,messageCount:D.totalMessages,firstMessage:H?(b=H.content,"string"==typeof b?b:(Array.isArray(b)?b.find(a=>"text"===a.type)?.text??"":"")||"(no messages)"):"(no messages)",parentSessionId:K,...L?{relation:{kind:"subagent",parentSessionId:L.parentSessionId,profile:L.profile,description:L.description,status:M?.status??L.status}}:I.parentSession?{relation:{kind:"fork",...K?{originSessionId:K}:{}}}:{},transient:!s||!(0,f.existsSync)(s)}]))[0]:null;return e.NextResponse.json({sessionId:c,filePath:s,info:O,leafId:u,tree:v,context:B,stats:D,...E?{contextUsage:E}:{},totalActiveMs:C,...void 0!==N?{toolNames:N}:{}})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}async function v(a,{params:b}){let{id:c}=await b;try{let{name:b}=await a.json();if("string"!=typeof b)return e.NextResponse.json({error:"name is required"},{status:400});let d=await (0,j.os)(c);if(!d)return e.NextResponse.json({error:"Session not found"},{status:404});return i.SessionManager.open(d).appendSessionInfo(b.trim()),(0,j.mD)(),e.NextResponse.json({ok:!0})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}async function w(a,{params:b}){let{id:c}=await b;try{let a,b=await (0,j.os)(c);if(!b||!(0,f.existsSync)(b)){let a=(0,l.getRpcSession)(c);if(!a)return b&&(0,j.BR)(c),e.NextResponse.json({error:"Session not found"},{status:404});let d=a.sessionFile||b;if(await a.shutdown(),d)try{(0,f.unlinkSync)(d)}catch(a){if("ENOENT"!==a.code)throw a}return(0,j.BR)(c),(0,j.mD)(),e.NextResponse.json({ok:!0})}let d=(0,j.eP)(b)?.parentSession;if(d)try{a=(0,j.eP)(d)?.id}catch{a=void 0}let i=(0,k.$)(b),m=(0,g.dirname)(b),n=(0,f.readdirSync)(m).filter(a=>a.endsWith(".jsonl")).map(a=>(0,h.CQ)((0,g.join)(m,a))).filter(a=>null!==a),o=n.find(a=>a.pathKey===i);if(!o||o.id!==c)return e.NextResponse.json({error:"Session changed while preparing deletion"},{status:409});let p=new Map;for(let a of n){if(!a.parentPath)continue;let b=(0,k.$)(a.parentPath);p.set(b,[...p.get(b)??[],a])}let q=p.get(i)??[],r=new Set;if(!d){let a=q.filter(a=>a.isSubagent);for(;a.length>0;){let b=a.shift();r.has(b.pathKey)||(r.add(b.pathKey),a.push(...p.get(b.pathKey)??[]))}}let t=n.filter(a=>r.has(a.pathKey)),u=q.filter(a=>!r.has(a.pathKey));if(u.some(a=>a.isSubagent)&&(!d||!a))return e.NextResponse.json({error:"Cannot reparent subagent session"},{status:409});let v=[o,...t,...u],w=await (0,l.reserveRpcSessionFileMutation)(v.map(a=>a.id));if(!w)return e.NextResponse.json({error:"Session is busy"},{status:409});try{if(v.some(a=>{try{return(0,f.readFileSync)(a.path,"utf8")!==a.original}catch{return!0}}))return e.NextResponse.json({error:"Session changed while preparing deletion"},{status:409});let g=u.map(b=>({record:b,updated:(0,h.JS)(b,d,a)})),i=[];try{for(let{record:a,updated:b}of g)(0,s.$)(a.path,b),i.push(a);(0,h.GW)([b,...t.map(a=>a.path)])}catch(a){for(let a of i.reverse())try{(0,s.$)(a.path,a.original)}catch{}throw a}for(let a of((0,j.BR)(c),t))(0,j.BR)(a.id);return(0,j.mD)(),e.NextResponse.json({ok:!0})}finally{w()}}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}[h,i,j,l,p,q]=t.then?(await t)():t,d()}catch(a){d(a)}})}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,974,402,6759,2243,6429],()=>b(b.s=63406));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=6849,a.ids=[6849],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},4896:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{a:()=>i});var e=c(75430),f=a([e]);function g(a){return a?"totalTokens"in a&&"number"==typeof a.totalTokens&&a.totalTokens>0?a.totalTokens:(a.input??0)+(a.output??0)+(a.cacheRead??0)+(a.cacheWrite??0):0}async function h(a,b,c){if(!b)return 0;try{let d=c??await (!globalThis.__piStaticModelRuntime&&(globalThis.__piStaticModelRuntime=e.ModelRuntime.create().catch(a=>{throw delete globalThis.__piStaticModelRuntime,a})),globalThis.__piStaticModelRuntime),f=d.getModel(a,b);if(f?.contextWindow&&f.contextWindow>0)return f.contextWindow;let g=d.getModels(),h=g.find(a=>a.id===b&&a.contextWindow>0);if(h?.contextWindow)return h.contextWindow;let i=g.find(a=>(a.id.endsWith(`/${b}`)||b.endsWith(`/${a.id}`))&&a.contextWindow>0);if(i?.contextWindow)return i.contextWindow;let j=b.toLowerCase();if(j.includes("gemini"))return 1048576;if(j.includes("claude-3-7")||j.includes("claude-sonnet-4")||j.includes("claude-opus-4"))return j.includes("opus-4-6")||j.includes("sonnet-4-6")?1e6:2e5;if(j.includes("gpt-4o")||j.includes("o1")||j.includes("o3"))return 128e3;if(j.includes("deepseek"))return 64e3}catch{}return 0}async function i(a,b,c){try{let d;if(Array.isArray(a))if(b){let c=new Map;for(let b of a)"id"in b&&"string"==typeof b.id&&c.set(b.id,b);let e=[],f=b;for(;f;){let a=c.get(f);if(!a)break;e.push(a),f="parentId"in a?a.parentId:void 0}e.reverse(),d=e}else d=a;else d="getBranch"in a&&"function"==typeof a.getBranch?b?a.getBranch(b):a.getBranch():"getEntries"in a&&"function"==typeof a.getEntries?a.getEntries()??[]:[];if(0===d.length)return null;let f=function(a){for(let b=a.length-1;b>=0;b--){let c=a[b];if("model_change"===c.type&&c.modelId)return{provider:c.provider||"",modelId:c.modelId};if("message"===c.type&&"assistant"===c.message.role&&c.message.model)return{provider:c.message.provider||"",modelId:c.message.model}}return null}(d),i=f?await h(f.provider,f.modelId,c):0,j=function(a){for(let b=a.length-1;b>=0;b--)if("compaction"===a[b].type)return a[b];return null}(d);if(j){let a=d.lastIndexOf(j),b=!1;for(let c=d.length-1;c>a;c--){let a=d[c];if("message"===a.type&&"assistant"===a.message.role){let c=a.message.usage;if(c&&g(c)>0){b=!0;break}}}if(!b)return i>0?{tokens:null,contextWindow:i,percent:null}:null}let k=(0,e.getLastAssistantUsage)(d),l=k?g(k):null;if(null===l&&i<=0)return null;let m=null!==l&&i>0?Math.min(100,Math.round(l/i*1e3)/10):null;return{tokens:l,contextWindow:i,percent:m}}catch{return null}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{"use strict";a.exports=require("assert")},14858:(a,b,c)=>{"use strict";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||"system"===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=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21906:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{CQ:()=>k,GW:()=>m,JS:()=>l});var e=c(55511),f=c(29021),g=c(33873),h=c(45902),i=c(7048),j=a([i]);function k(a){let b=(0,f.readFileSync)(a,"utf8"),c=b.split("\n"),d=c.map(a=>{if(!a.trim())return null;try{return JSON.parse(a)}catch{return null}}),e=d[0];if(e?.type!=="session"||"string"!=typeof e.id)return null;let g=d.slice(1).filter(a=>null!==a);return{path:a,pathKey:(0,h.$)(a),id:e.id,parentPath:"string"==typeof e.parentSession?e.parentSession:void 0,lines:c,entries:g,original:b,isSubagent:!!(0,i.$u)(g,e.id,a)}}function l(a,b,c){let d=[...a.lines],e=JSON.parse(d[0]);if(b?e.parentSession=b:delete e.parentSession,d[0]=JSON.stringify(e),a.isSubagent){if(!b||!c)throw Error("Cannot reparent a subagent without a valid parent session");for(let a=1;a<d.length;a+=1){let e;try{e=JSON.parse(d[a])}catch{continue}"custom"!==e.type||e.customType!==i.tP||"object"!=typeof e.data||null===e.data||Array.isArray(e.data)||(e.data={...e.data,parentSessionId:c,parentSessionPath:b},d[a]=JSON.stringify(e))}}return d.join("\n")}function m(a){let b=[];try{for(let c of a){if(!(0,f.existsSync)(c))continue;let a=(0,g.join)((0,g.dirname)(c),`.${(0,g.basename)(c)}-${(0,e.randomUUID)()}.deleting`);try{(0,f.renameSync)(c,a)}catch(a){if("ENOENT"===a.code)continue;throw a}b.push({original:c,staged:a})}}catch(a){for(let a of b.reverse())try{(0,f.renameSync)(a.staged,a.original)}catch{}throw a}for(let a of b)try{(0,f.unlinkSync)(a.staged)}catch{}}i=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{"use strict";a.exports=import("@earendil-works/pi-tui")},31421:a=>{"use strict";a.exports=require("node:child_process")},33873:a=>{"use strict";a.exports=require("path")},33920:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Zg:()=>k,fi:()=>l});var e=c(29021),f=c(33873),g=c(75430),h=c(8102),i=a([g]);function j(a=(0,g.getAgentDir)()){return(0,f.join)(a,"pi-web","pinned-sessions.json")}function k(a=j()){let b;try{b=(0,e.readFileSync)(a,"utf8")}catch(a){if("ENOENT"===a.code)return[];throw a}let c=JSON.parse(b);return Array.isArray(c)?c.filter(a=>"string"==typeof a):[]}function l(a,b,c=j()){let d=k(c).filter(b=>b!==a);return b&&d.push(a),(0,e.mkdirSync)((0,f.dirname)(c),{recursive:!0}),(0,h.$)(c,JSON.stringify(d)),d}g=(i.then?(await i)():i)[0],d()}catch(a){d(a)}})},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},57975:a=>{"use strict";a.exports=require("node:util")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},63406:(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]/route",pathname:"/api/sessions/[id]",filename:"route",bundlePath:"app/api/sessions/[id]/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/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)}}},72322:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/utils/pi-user-agent")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},89691:(a,b,c)=>{"use strict";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})},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{},98192:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>x,GET:()=>v,PATCH:()=>w});var e=c(23211),f=c(29021),g=c(33873),h=c(21906),i=c(75430),j=c(40402),k=c(45902),l=c(56429),m=c(14858),n=c(89691),o=c(88914),p=c(4896),q=c(7048),r=c(21560),s=c(8102),t=c(33920),u=a([h,i,j,l,p,q,t]);async function v(a,{params:b}){let{id:c}=await b;try{let b,d="1"===new URL(a.url).searchParams.get("force"),g=function(a,b){let c=(0,l.getRpcSession)(a);if(!c?.isAlive())return;if(!b)return c;let d=c.sessionFile;if(!d||c.isRunning())return c;let e=(0,j.xL)(d);return e.overlongLine?(console.log(`[pi-web] session ${a} tail exceeds the probe window; rebuilding from the file`),(0,l.releaseRpcSessionForExternalWrite)(a)?void 0:c):!e.entryId||c.inner.sessionManager.getEntries().some(a=>a?.id===e.entryId)?c:(console.log(`[pi-web] session ${a} changed on disk; rebuilding from the file`),(0,l.releaseRpcSessionForExternalWrite)(a)?void 0:c)}(c,d),h=g?null:await (0,j.os)(c);if(!g&&!h)return e.NextResponse.json({error:"Session not found"},{status:404});let k=g?.inner.sessionManager??i.SessionManager.open(h),s=g?.sessionFile||k.getSessionFile()||h||"",t=k.getEntries(),u=k.getLeafId(),v=(0,m.y)(k.getTree()),w=new URL(a.url).searchParams,x=w.has("deferThinking"),y=w.has("deferMedia"),z=Number(w.get("tail")),A=Number.isFinite(z)&&z>0?Math.min(z,1e3):200,B=(0,j.Uv)(t,u,{deferThinking:x,deferToolResultImages:y,tail:A,sessionId:c}),C=(0,n.c)(t),D=(0,o.P)(t),E=g?.inner?.getContextUsage?.()??await (0,p.a)(k,u),F=k.getSessionName(),G=t.find(a=>"message"===a.type&&"user"===a.message.role),H=G?.type==="message"?G.message:void 0,I=k.getHeader(),J=I?.timestamp??new Date().toISOString();try{J=(0,f.statSync)(s).mtime.toISOString()}catch{}let K=I?.parentSession?await (0,j.u1)(I.parentSession):void 0,L=I?(0,q.$u)(t,I.id,s):null,M=L?await (0,l.getSubagentRun)(c):null,N=(0,q.ph)(t)?.tools??(0,r.dS)(t),O=I?(await (0,j.zH)([{path:s,id:I.id,cwd:I.cwd??"",name:F,created:I.timestamp,modified:J,messageCount:D.totalMessages,firstMessage:H?(b=H.content,"string"==typeof b?b:(Array.isArray(b)?b.find(a=>"text"===a.type)?.text??"":"")||"(no messages)"):"(no messages)",parentSessionId:K,...L?{relation:{kind:"subagent",parentSessionId:L.parentSessionId,profile:L.profile,description:L.description,status:M?.status??L.status}}:I.parentSession?{relation:{kind:"fork",...K?{originSessionId:K}:{}}}:{},transient:!s||!(0,f.existsSync)(s)}]))[0]:null;return e.NextResponse.json({sessionId:c,filePath:s,info:O,leafId:u,tree:v,context:B,stats:D,...E?{contextUsage:E}:{},totalActiveMs:C,...void 0!==N?{toolNames:N}:{}})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}async function w(a,{params:b}){let{id:c}=await b;try{let{name:b,pinned:d}=await a.json();if("string"!=typeof b&&"boolean"!=typeof d)return e.NextResponse.json({error:"name or pinned is required"},{status:400});let f=await (0,j.os)(c);if(!f)return e.NextResponse.json({error:"Session not found"},{status:404});return"boolean"==typeof d&&(0,t.fi)(c,d),"string"==typeof b&&i.SessionManager.open(f).appendSessionInfo(b.trim()),(0,j.mD)(),e.NextResponse.json({ok:!0})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}async function x(a,{params:b}){let{id:c}=await b;try{let a,b=await (0,j.os)(c);if(!b||!(0,f.existsSync)(b)){let a=(0,l.getRpcSession)(c);if(!a)return b&&(0,j.BR)(c),e.NextResponse.json({error:"Session not found"},{status:404});let d=a.sessionFile||b;if(await a.shutdown(),d)try{(0,f.unlinkSync)(d)}catch(a){if("ENOENT"!==a.code)throw a}return(0,j.BR)(c),(0,j.mD)(),e.NextResponse.json({ok:!0})}let d=(0,j.eP)(b)?.parentSession;if(d)try{a=(0,j.eP)(d)?.id}catch{a=void 0}let i=(0,k.$)(b),m=(0,g.dirname)(b),n=(0,f.readdirSync)(m).filter(a=>a.endsWith(".jsonl")).map(a=>(0,h.CQ)((0,g.join)(m,a))).filter(a=>null!==a),o=n.find(a=>a.pathKey===i);if(!o||o.id!==c)return e.NextResponse.json({error:"Session changed while preparing deletion"},{status:409});let p=new Map;for(let a of n){if(!a.parentPath)continue;let b=(0,k.$)(a.parentPath);p.set(b,[...p.get(b)??[],a])}let q=p.get(i)??[],r=new Set;if(!d){let a=q.filter(a=>a.isSubagent);for(;a.length>0;){let b=a.shift();r.has(b.pathKey)||(r.add(b.pathKey),a.push(...p.get(b.pathKey)??[]))}}let t=n.filter(a=>r.has(a.pathKey)),u=q.filter(a=>!r.has(a.pathKey));if(u.some(a=>a.isSubagent)&&(!d||!a))return e.NextResponse.json({error:"Cannot reparent subagent session"},{status:409});let v=[o,...t,...u],w=await (0,l.reserveRpcSessionFileMutation)(v.map(a=>a.id));if(!w)return e.NextResponse.json({error:"Session is busy"},{status:409});try{if(v.some(a=>{try{return(0,f.readFileSync)(a.path,"utf8")!==a.original}catch{return!0}}))return e.NextResponse.json({error:"Session changed while preparing deletion"},{status:409});let g=u.map(b=>({record:b,updated:(0,h.JS)(b,d,a)})),i=[];try{for(let{record:a,updated:b}of g)(0,s.$)(a.path,b),i.push(a);(0,h.GW)([b,...t.map(a=>a.path)])}catch(a){for(let a of i.reverse())try{(0,s.$)(a.path,a.original)}catch{}throw a}for(let a of((0,j.BR)(c),t))(0,j.BR)(a.id);return(0,j.mD)(),e.NextResponse.json({ok:!0})}finally{w()}}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}[h,i,j,l,p,q,t]=u.then?(await u)():u,d()}catch(a){d(a)}})}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,974,402,6759,2243,6429],()=>b(b.s=63406));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=1097,a.ids=[1097],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{"use strict";a.exports=require("assert")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{"use strict";a.exports=import("@earendil-works/pi-tui")},31421:a=>{"use strict";a.exports=require("node:child_process")},33873:a=>{"use strict";a.exports=require("path")},40228:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>i,dynamic:()=>j});var e=c(23211),f=c(40402),g=c(56429),h=a([f,g]);[f,g]=h.then?(await h)():h;let j="force-dynamic";async function i(a){try{let b="1"===new URL(a.url).searchParams.get("force"),c=(0,f.dQ)({force:b}),d=(0,f.bA)(),[h,i]=await Promise.all([c,(0,f.zH)((0,g.getRpcSessionInfos)())]),j=(0,f.O5)(h,i);return e.NextResponse.json({sessions:j,sessionListVersion:d,runningSessionIds:(0,g.getRunningRpcSessionIds)(),completionNotificationSuppressedSessionIds:(0,g.getCompletionNotificationSuppressedRpcSessionIds)()},{headers:{"Cache-Control":"no-store"}})}catch(a){return e.NextResponse.json({error:String(a)},{status:500,headers:{"Cache-Control":"no-store"}})}}d()}catch(a){d(a)}})},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},57975:a=>{"use strict";a.exports=require("node:util")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},68568:(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/route",pathname:"/api/sessions",filename:"route",bundlePath:"app/api/sessions/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/sessions/route.ts",nextConfigOutput:"",userland:()=>c(40228),...{}}),{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/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},72322:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/utils/pi-user-agent")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,974,402,6759,2243,6429],()=>b(b.s=68568));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=1097,a.ids=[1097],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{"use strict";a.exports=require("assert")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28802:a=>{"use strict";a.exports=import("@earendil-works/pi-ai")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{"use strict";a.exports=import("@earendil-works/pi-tui")},31421:a=>{"use strict";a.exports=require("node:child_process")},33873:a=>{"use strict";a.exports=require("path")},33920:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Zg:()=>k,fi:()=>l});var e=c(29021),f=c(33873),g=c(75430),h=c(8102),i=a([g]);function j(a=(0,g.getAgentDir)()){return(0,f.join)(a,"pi-web","pinned-sessions.json")}function k(a=j()){let b;try{b=(0,e.readFileSync)(a,"utf8")}catch(a){if("ENOENT"===a.code)return[];throw a}let c=JSON.parse(b);return Array.isArray(c)?c.filter(a=>"string"==typeof a):[]}function l(a,b,c=j()){let d=k(c).filter(b=>b!==a);return b&&d.push(a),(0,e.mkdirSync)((0,f.dirname)(c),{recursive:!0}),(0,h.$)(c,JSON.stringify(d)),d}g=(i.then?(await i)():i)[0],d()}catch(a){d(a)}})},40228:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>j,dynamic:()=>k});var e=c(23211),f=c(40402),g=c(56429),h=c(33920),i=a([f,g,h]);[f,g,h]=i.then?(await i)():i;let k="force-dynamic";async function j(a){try{let b="1"===new URL(a.url).searchParams.get("force"),c=(0,f.dQ)({force:b}),d=(0,f.bA)(),[i,j]=await Promise.all([c,(0,f.zH)((0,g.getRpcSessionInfos)())]),k=(0,f.O5)(i,j);return e.NextResponse.json({sessions:k,sessionListVersion:d,pinnedSessionIds:(0,h.Zg)(),runningSessionIds:(0,g.getRunningRpcSessionIds)(),completionNotificationSuppressedSessionIds:(0,g.getCompletionNotificationSuppressedRpcSessionIds)()},{headers:{"Cache-Control":"no-store"}})}catch(a){return e.NextResponse.json({error:String(a)},{status:500,headers:{"Cache-Control":"no-store"}})}}d()}catch(a){d(a)}})},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51181:a=>{"use strict";a.exports=require("web-push")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},55511:a=>{"use strict";a.exports=require("crypto")},57975:a=>{"use strict";a.exports=require("node:util")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},68568:(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/route",pathname:"/api/sessions",filename:"route",bundlePath:"app/api/sessions/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/zhujunshen/pi-web/app/api/sessions/route.ts",nextConfigOutput:"",userland:()=>c(40228),...{}}),{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/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},72322:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/utils/pi-user-agent")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80481:a=>{"use strict";a.exports=require("node:readline")},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,426,974,402,6759,2243,6429],()=>b(b.s=68568));module.exports=c})();
|