@henlii/pidance 0.2.10 → 0.2.12
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 +14 -14
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- 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/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.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 +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/about/route.js +1 -1
- package/.next/server/app/api/agent/[id]/route.js +1 -1
- package/.next/server/app/api/file-index/route.js +1 -1
- package/.next/server/app/api/files/[...path]/route.js +2 -2
- package/.next/server/app/api/models/route.js +1 -1
- package/.next/server/app/api/preferences/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
- package/.next/server/app/api/update/apply/route.js +1 -1
- package/.next/server/app/api/update/check/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +4 -4
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/page.js +14 -14
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +14 -14
- package/.next/server/chunks/188.js +1 -1
- package/.next/server/chunks/5582.js +1 -1
- package/.next/server/chunks/7594.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/9780-56542826d7f3fa4a.js +1 -0
- package/.next/static/chunks/app/page-6d9852f2f02a308b.js +25 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/.next/static/chunks/9780-4a41b8eb0d1bf4d7.js +0 -1
- package/.next/static/chunks/app/page-23a2414f1ac5d31a.js +0 -25
- /package/.next/static/{MxU3iOKNmD00N9yv-13tC → MVakkXp9Z6ytY57whIONN}/_buildManifest.js +0 -0
- /package/.next/static/{MxU3iOKNmD00N9yv-13tC → MVakkXp9Z6ytY57whIONN}/_ssgManifest.js +0 -0
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
3:I[90484,[],"MetadataBoundary"]
|
|
4
4
|
4:"$Sreact.suspense"
|
|
5
5
|
5:I[86869,[],"IconMark"]
|
|
6
|
-
0:{"rsc":["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"Pidance"}],["$","meta","1",{"name":"description","content":"Open-source web client for the Pi coding agent"}],["$","link","2",{"rel":"icon","href":"/brand/pidance-logo.png"}],["$","link","3",{"rel":"apple-touch-icon","href":"/brand/pidance-logo.png"}],["$","$L5","4",{}]]}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}],"isPartial":false,"staleTime":300,"varyParams":null,"buildId":"
|
|
6
|
+
0:{"rsc":["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"Pidance"}],["$","meta","1",{"name":"description","content":"Open-source web client for the Pi coding agent"}],["$","link","2",{"rel":"icon","href":"/brand/pidance-logo.png"}],["$","link","3",{"rel":"apple-touch-icon","href":"/brand/pidance-logo.png"}],["$","$L5","4",{}]]}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}],"isPartial":false,"staleTime":300,"varyParams":null,"buildId":"MVakkXp9Z6ytY57whIONN"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
1:"$Sreact.fragment"
|
|
2
|
-
2:I[99780,["9780","static/chunks/9780-
|
|
2
|
+
2:I[99780,["9780","static/chunks/9780-56542826d7f3fa4a.js","7177","static/chunks/app/layout-88764b4be2728d3f.js"],"I18nProvider"]
|
|
3
3
|
3:I[57121,[],""]
|
|
4
4
|
4:I[74581,[],""]
|
|
5
5
|
:HL["/_next/static/css/88714c00e109ce28.css","style"]
|
|
6
6
|
:HL["/_next/static/css/b890757d9e0dd456.css","style"]
|
|
7
|
-
0:{"rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/88714c00e109ce28.css","precedence":"next"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/b890757d9e0dd456.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{var r=document.documentElement,m=localStorage.getItem(\"pi-theme\"),s=localStorage.getItem(\"pi-theme-style\");if(m!==\"light\"&&m!==\"dark\"&&m!==\"system\")m=\"light\";if(s!==\"fusion\"&&s!==\"chamber\")s=\"chamber\";var d=m===\"dark\"||(m===\"system\"&&matchMedia(\"(prefers-color-scheme: dark)\").matches);r.classList.toggle(\"dark\",d);r.dataset.themeMode=m;r.dataset.themeStyle=s}catch(e){}})();"}}]]}],["$","body",null,{"translate":"no","className":"notranslate","style":{"height":"100dvh","display":"flex","flexDirection":"column"},"children":["$","$L2",null,{"children":["$","$L3",null,{"parallelRouterKey":"children","template":["$","$L4",null,{}]}]}]}]]}]]}],"isPartial":false,"staleTime":300,"varyParams":null,"buildId":"
|
|
7
|
+
0:{"rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/88714c00e109ce28.css","precedence":"next"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/b890757d9e0dd456.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{var r=document.documentElement,m=localStorage.getItem(\"pi-theme\"),s=localStorage.getItem(\"pi-theme-style\");if(m!==\"light\"&&m!==\"dark\"&&m!==\"system\")m=\"light\";if(s!==\"fusion\"&&s!==\"chamber\")s=\"chamber\";var d=m===\"dark\"||(m===\"system\"&&matchMedia(\"(prefers-color-scheme: dark)\").matches);r.classList.toggle(\"dark\",d);r.dataset.themeMode=m;r.dataset.themeStyle=s}catch(e){}})();"}}]]}],["$","body",null,{"translate":"no","className":"notranslate","style":{"height":"100dvh","display":"flex","flexDirection":"column"},"children":["$","$L2",null,{"children":["$","$L3",null,{"parallelRouterKey":"children","template":["$","$L4",null,{}]}]}]}]]}]]}],"isPartial":false,"staleTime":300,"varyParams":null,"buildId":"MVakkXp9Z6ytY57whIONN"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
1:"$Sreact.fragment"
|
|
2
2
|
2:I[90484,[],"OutletBoundary"]
|
|
3
3
|
3:"$Sreact.suspense"
|
|
4
|
-
0:{"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":false,"staleTime":300,"varyParams":null,"buildId":"
|
|
4
|
+
0:{"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":false,"staleTime":300,"varyParams":null,"buildId":"MVakkXp9Z6ytY57whIONN"}
|
|
5
5
|
4:null
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
2:I[57121,[],""]
|
|
3
3
|
3:I[74581,[],""]
|
|
4
4
|
4:[]
|
|
5
|
-
0:{"rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"isPartial":false,"staleTime":300,"varyParams":"$W4","buildId":"
|
|
5
|
+
0:{"rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"isPartial":false,"staleTime":300,"varyParams":"$W4","buildId":"MVakkXp9Z6ytY57whIONN"}
|
|
@@ -2,4 +2,4 @@
|
|
|
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
4
|
:HL["/_next/static/css/b890757d9e0dd456.css","style"]
|
|
5
|
-
0:{"tree":{"name":"","param":null,"prefetchHints":16,"slots":{"children":{"name":"_not-found","param":null,"prefetchHints":0,"slots":{"children":{"name":"__PAGE__","param":null,"prefetchHints":0,"slots":null}}}}},"staleTime":300,"buildId":"
|
|
5
|
+
0:{"tree":{"name":"","param":null,"prefetchHints":16,"slots":{"children":{"name":"_not-found","param":null,"prefetchHints":0,"slots":{"children":{"name":"__PAGE__","param":null,"prefetchHints":0,"slots":null}}}}},"staleTime":300,"buildId":"MVakkXp9Z6ytY57whIONN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=1273,a.ids=[1273],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},79941:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>H,patchFetch:()=>G,routeModule:()=>C,serverHooks:()=>F,workAsyncStorage:()=>D,workUnitAsyncStorage:()=>E});var d={};c.r(d),c.d(d,{GET:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(89477),w=c(86697),x=c(23211);let y="Pidance";function z(a){let b=a.trim();if(!b)return null;let c=b;return c.startsWith("git+")&&(c=c.slice(4)),c.startsWith("git://")&&(c=`https://${c.slice(6)}`),c.endsWith(".git")&&(c=c.slice(0,-4)),c||null}function A(a){let b=a&&"object"==typeof a?a:{},c="string"==typeof b.name&&b.name.trim()?b.name.trim():y,d="string"==typeof b.version&&b.version.trim()?b.version.trim():"0.0.0",e="string"==typeof b.homepage&&b.homepage.trim()?b.homepage.trim():null,f=function(a){if("string"==typeof a)return z(a);if(a&&"object"==typeof a&&"url"in a){let b=a.url;if("string"==typeof b)return z(b)}return null}(b.repository);return{name:"@henlii/pidance"===c?y:c,version:d,piSdkVersion:function(a,b){for(let c of["dependencies","optionalDependencies"]){let d=a[c];if(!d||"object"!=typeof d)continue;let e=d[b];if("string"==typeof e&&e.trim())return e.trim().replace(/^[=v]/,"")}return null}(b,"@earendil-works/pi-coding-agent"),homepage:e,repository:f}}async function B(){try{let a=(0,w.join)(process.cwd(),"node_modules","@henlii","pidance","package.json"),b=(0,v.existsSync)(a)?a:(0,w.join)(process.cwd(),"package.json"),c=(0,v.readFileSync)(b,"utf8"),d=JSON.parse(c),e=A(d);return x.NextResponse.json(e,{headers:{"Cache-Control":"no-store"}})}catch{let a=A({name:"@henlii/pidance",version:"0.2.
|
|
1
|
+
(()=>{var a={};a.id=1273,a.ids=[1273],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},79941:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>H,patchFetch:()=>G,routeModule:()=>C,serverHooks:()=>F,workAsyncStorage:()=>D,workUnitAsyncStorage:()=>E});var d={};c.r(d),c.d(d,{GET:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(89477),w=c(86697),x=c(23211);let y="Pidance";function z(a){let b=a.trim();if(!b)return null;let c=b;return c.startsWith("git+")&&(c=c.slice(4)),c.startsWith("git://")&&(c=`https://${c.slice(6)}`),c.endsWith(".git")&&(c=c.slice(0,-4)),c||null}function A(a){let b=a&&"object"==typeof a?a:{},c="string"==typeof b.name&&b.name.trim()?b.name.trim():y,d="string"==typeof b.version&&b.version.trim()?b.version.trim():"0.0.0",e="string"==typeof b.homepage&&b.homepage.trim()?b.homepage.trim():null,f=function(a){if("string"==typeof a)return z(a);if(a&&"object"==typeof a&&"url"in a){let b=a.url;if("string"==typeof b)return z(b)}return null}(b.repository);return{name:"@henlii/pidance"===c?y:c,version:d,piSdkVersion:function(a,b){for(let c of["dependencies","optionalDependencies"]){let d=a[c];if(!d||"object"!=typeof d)continue;let e=d[b];if("string"==typeof e&&e.trim())return e.trim().replace(/^[=v]/,"")}return null}(b,"@earendil-works/pi-coding-agent"),homepage:e,repository:f}}async function B(){try{let a=(0,w.join)(process.cwd(),"node_modules","@henlii","pidance","package.json"),b=(0,v.existsSync)(a)?a:(0,w.join)(process.cwd(),"package.json"),c=(0,v.readFileSync)(b,"utf8"),d=JSON.parse(c),e=A(d);return x.NextResponse.json(e,{headers:{"Cache-Control":"no-store"}})}catch{let a=A({name:"@henlii/pidance",version:"0.2.12",homepage:"https://github.com/henlii/pidance#readme",repository:{type:"git",url:"git+https://github.com/henlii/pidance.git"}});return x.NextResponse.json(a,{headers:{"Cache-Control":"no-store"}})}}let C=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/about/route",pathname:"/api/about",filename:"route",bundlePath:"app/api/about/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/about/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:D,workUnitAsyncStorage:E,serverHooks:F}=C;function G(){return(0,g.patchFetch)({workAsyncStorage:D,workUnitAsyncStorage:E})}async function H(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),C.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/about/route";"/index"===d&&(d="/");let e=await C.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:z,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(A.dynamicRoutes[I]||A.routes[F]),K=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!z){let a=!!A.routes[F],b=A.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||C.isDev||z||(L="/index"===(L=F)?"/":L);let M=!0===C.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==B?void 0:B.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await C.getIncrementalCache(a,x,A,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>C.onRequestError(a,b,d,e,B)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>C.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await C.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,B),b}},k=await C.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),z&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await C.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,B),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{"use strict";a.exports=require("node:path")},89477:a=>{"use strict";a.exports=require("node:fs")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=79941));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var a={};a.id=5221,a.ids=[5221],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},716:a=>{a.exports=require("node:crypto")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4984:a=>{a.exports=require("readline")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66376:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(79256),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/agent/[id]/route",pathname:"/api/agent/[id]",filename:"route",bundlePath:"app/api/agent/[id]/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/agent/[id]/route.ts",nextConfigOutput:"",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/agent/[id]/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!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(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},79256:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>i,POST:()=>h});var e=c(23211),f=c(37594),g=a([f]);async function h(a,{params:b}){let{id:c}=await b;try{await (0,f.Yz)(c,f.mB.isReadOnly);let b=await a.json(),d=await f.mB.send(c,b);return e.NextResponse.json({success:!0,data:d})}catch(b){let a=b instanceof Error?b.message:String(b);return e.NextResponse.json({error:a},{status:(0,f.Md)(b)})}}async function i(a,{params:b}){let{id:c}=await b;try{if(await f.mB.isReadOnly(c))return e.NextResponse.json({running:!1,readOnly:!0});let a=f.mB.getLiveSession(c);if(!a)return e.NextResponse.json({running:!1
|
|
1
|
+
"use strict";(()=>{var a={};a.id=5221,a.ids=[5221],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},716:a=>{a.exports=require("node:crypto")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4984:a=>{a.exports=require("readline")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66376:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(79256),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/agent/[id]/route",pathname:"/api/agent/[id]",filename:"route",bundlePath:"app/api/agent/[id]/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/agent/[id]/route.ts",nextConfigOutput:"",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/agent/[id]/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!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(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},79256:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>i,POST:()=>h});var e=c(23211),f=c(37594),g=a([f]);async function h(a,{params:b}){let{id:c}=await b;try{await (0,f.Yz)(c,f.mB.isReadOnly);let b=await a.json(),d=await f.mB.send(c,b);return e.NextResponse.json({success:!0,data:d})}catch(b){let a=b instanceof Error?b.message:String(b);return e.NextResponse.json({error:a},{status:(0,f.Md)(b)})}}async function i(a,{params:b}){let{id:c}=await b;try{if(await f.mB.isReadOnly(c))return e.NextResponse.json({running:!1,readOnly:!0});let a=f.mB.getLiveSession(c);if(!a)return e.NextResponse.json({running:!1});let b=await a.send({type:"get_state"});return e.NextResponse.json({running:!0,state:b})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}f=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{a.exports=require("node:path")},89477:a=>{a.exports=require("node:fs")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582,7594],()=>b(b.s=66376));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var a={};a.id=7067,a.ids=[7067],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},716:a=>{a.exports=require("node:crypto")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4984:a=>{a.exports=require("readline")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},17393:(a,b,c)=>{function d(a){let b=0;for(let c=0;c<a.length;c++)"/"===a[c]&&b++;return b}function e(a){let b=new Set;for(let c of a){let a=c.indexOf("/");for(;-1!==a;)b.add(c.slice(0,a)),a=c.indexOf("/",a+1)}let c=[];for(let a of b)c.push({path:a,isDir:!0});for(let b of a)b&&c.push({path:b,isDir:!1});return c.sort((a,b)=>d(a.path)-d(b.path)||a.path.localeCompare(b.path)),c}function f(a,b){if(!a)return!0;let c=0;for(let d=0;d<b.length&&c<a.length;d++)b[d]===a[c]&&c++;return c===a.length}function g(a,b,c=20){let e=b.toLowerCase();if(!e)return a.slice(0,c);let h=[];for(let b of a){let a=function(a,b){let c=a.path.toLowerCase(),d=0;if(b.includes("/"))c===b?d=100:c.startsWith(b)?d=80:c.includes(b)?d=50:f(b,c)&&(d=10);else{let a=c.lastIndexOf("/"),e=-1===a?c:c.slice(a+1);e===b?d=100:e.startsWith(b)?d=80:e.includes(b)?d=50:c.includes(b)?d=30:f(b,c)&&(d=10)}return a.isDir&&d>0&&(d+=10),d}(b,e);a>0&&h.push({entry:b,score:a})}return h.sort((a,b)=>b.score-a.score||d(a.entry.path)-d(b.entry.path)||a.entry.path.localeCompare(b.entry.path)),h.slice(0,c).map(a=>a.entry)}c.d(b,{R7:()=>g,Yh:()=>e})},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},40084:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(74974),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/file-index/route",pathname:"/api/file-index",filename:"route",bundlePath:"app/api/file-index/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/file-index/route.ts",nextConfigOutput:"",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/file-index/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!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(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},69835:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Lj:()=>p,Md:()=>o,eq:()=>l,ki:()=>n,qo:()=>k,uF:()=>m});var e=c(29021),f=c(33873),g=c(55511),h=c(60396),i=c(80547),j=a([i]);i=(j.then?(await j)():j)[0];let o=0x1900000,p=0x6400000;function k(a=(0,h.$M)()){return(0,i.Nw)((0,f.join)(a,"pidance-attachments"))}function l(a=(0,h.$M)()){let b=k(a);return(0,e.existsSync)(b)||(0,e.mkdirSync)(b,{recursive:!0,mode:448}),(0,i.wz)(b),b}function m(a){let b=(a.replace(/\\/g,"/").split("/").pop()??"file").replace(/\0/g,"").replace(/^\.+/,"").trim()||"file";if(b.length<=180)return b;let c=b.lastIndexOf(".");if(c>0&&b.length-c<=20){let a=b.slice(c);return b.slice(0,180-a.length)+a}return b.slice(0,180)}function n(a,b,c=(0,h.$M)()){let d=l(c),j=function(a,b=Date.now()){let c=m(a),d=new Date(b).toISOString().replace(/[:.]/g,"-"),e=(0,g.randomUUID)().slice(0,8);return`${d}_${e}_${c}`}(a),k=(0,f.join)(d,j);return(0,e.writeFileSync)(k,b,{flag:"wx",mode:384}),{path:(0,i.Nw)(k),name:m(a),storedName:j,size:b.length}}d()}catch(a){d(a)}})},74974:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>p});var e=c(23211),f=c(79646),g=c(28354),h=c(29021),i=c.n(h),j=c(33873),k=c.n(j),l=c(80547),m=c(17393),n=a([l]);l=(n.then?(await n)():n)[0];let q=(0,g.promisify)(f.execFile),r=new Set(["node_modules",".git",".next","dist","build","__pycache__",".turbo",".cache","coverage",".pytest_cache",".mypy_cache","target","vendor",".DS_Store"]),s=[".pyc"];async function o(a){try{let{stdout:b}=await q("git",["-C",a,"ls-files","--cached","--others","--exclude-standard","-z"],{timeout:1e4,maxBuffer:0x4000000,env:{...process.env,LC_ALL:"C"}}),c=b.split("\0").filter(Boolean);if(c.length>2e5)return{files:c.slice(0,2e5),hardTruncated:!0};return{files:c,hardTruncated:!1}}catch{return null}}async function p(a){try{let b,c=a.nextUrl.searchParams.get("cwd")?.trim()??"";if(!c||!c.startsWith("/")&&!(0,l.uK)(c))return e.NextResponse.json({error:"cwd must be an absolute path"},{status:400});let d=a.nextUrl.searchParams.get("q")?.slice(0,500)??"",f=await (0,l.mc)();if(!(0,l.A$)(c,f))return e.NextResponse.json({error:"Access denied"},{status:403});try{b=i().statSync(c)}catch{return e.NextResponse.json({error:"Directory not found"},{status:404})}if(!b.isDirectory())return e.NextResponse.json({error:"Not a directory"},{status:400});let g=(globalThis.__piFileIndexCache||(globalThis.__piFileIndexCache=new Map),globalThis.__piFileIndexCache),h=Date.now(),j=g.get(c);if(!j||j.expiresAt<=h){let a=await o(c)??function(a){let b=[],c=[{abs:a,rel:"",depth:0}];for(;c.length>0;){let a,{abs:d,rel:e,depth:f}=c.shift();try{a=i().readdirSync(d,{withFileTypes:!0})}catch{continue}for(let g of a){if(r.has(g.name)||s.some(a=>g.name.endsWith(a)))continue;let a=e?`${e}/${g.name}`:g.name;if(g.isDirectory())f+1<=8&&c.push({abs:k().join(d,g.name),rel:a,depth:f+1});else if(g.isFile()){if(b.length>=5e4)return{files:b,hardTruncated:!0};b.push(a)}}}return{files:b,hardTruncated:!1}}(c);for(let[a,b]of g)b.expiresAt<=h&&g.delete(a);g.size>=20&&g.clear(),j={listing:a,expiresAt:h+6e4},g.set(c,j)}if(d)return j.entries??=(0,m.Yh)(j.listing.files),e.NextResponse.json({matches:(0,m.R7)(j.entries,d)});let{files:n,hardTruncated:p}=j.listing;return e.NextResponse.json({files:n.slice(0,5e3),truncated:p||n.length>5e3})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>q,Nw:()=>j.Nw,mc:()=>p,uK:()=>o,wz:()=>k.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(60396),j=c(50593),k=c(25252),l=c(69835),m=c(40402),n=a([l,m]);[l,m]=n.then?(await n)():n;let r=/^[a-zA-Z]:[\\/]/;function o(a){return r.test(a)||a.startsWith("\\\\")||a.startsWith("//")}async function p(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,m.dQ)(),d=function(a){let b=new Set;for(let c of a)!0!==c.readOnly&&c.cwd&&b.add((0,j.Nw)(c.cwd)),!0!==c.readOnly&&c.projectRoot&&b.add((0,j.Nw)(c.projectRoot));return b}(c);try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,j.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,k.HM)())d.add(a);try{d.add((0,l.qo)((0,i.$M)()))}catch{}return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function q(a,b){for(let c of b){let b=o(a)||o(c),d=b?h().win32:h(),e=b?"\\":h().sep,f=d.resolve(a),g=d.resolve(c),i=b?f.toLowerCase():f,j=b?g.toLowerCase():g,k=j.endsWith(e)?j:j+e;if(i===j||i.startsWith(k))return!0}return!1}d()}catch(a){d(a)}})},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{a.exports=require("node:path")},89477:a=>{a.exports=require("node:fs")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582],()=>b(b.s=40084));module.exports=c})();
|
|
1
|
+
"use strict";(()=>{var a={};a.id=7067,a.ids=[7067],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},716:a=>{a.exports=require("node:crypto")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4984:a=>{a.exports=require("readline")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},40084:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(74974),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/file-index/route",pathname:"/api/file-index",filename:"route",bundlePath:"app/api/file-index/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/file-index/route.ts",nextConfigOutput:"",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/file-index/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!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(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},69835:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Lj:()=>p,Md:()=>o,eq:()=>l,ki:()=>n,qo:()=>k,uF:()=>m});var e=c(29021),f=c(33873),g=c(55511),h=c(60396),i=c(80547),j=a([i]);i=(j.then?(await j)():j)[0];let o=0x1900000,p=0x6400000;function k(a=(0,h.$M)()){return(0,i.Nw)((0,f.join)(a,"pidance-attachments"))}function l(a=(0,h.$M)()){let b=k(a);return(0,e.existsSync)(b)||(0,e.mkdirSync)(b,{recursive:!0,mode:448}),(0,i.wz)(b),b}function m(a){let b=(a.replace(/\\/g,"/").split("/").pop()??"file").replace(/\0/g,"").replace(/^\.+/,"").trim()||"file";if(b.length<=180)return b;let c=b.lastIndexOf(".");if(c>0&&b.length-c<=20){let a=b.slice(c);return b.slice(0,180-a.length)+a}return b.slice(0,180)}function n(a,b,c=(0,h.$M)()){let d=l(c),j=function(a,b=Date.now()){let c=m(a),d=new Date(b).toISOString().replace(/[:.]/g,"-"),e=(0,g.randomUUID)().slice(0,8);return`${d}_${e}_${c}`}(a),k=(0,f.join)(d,j);return(0,e.writeFileSync)(k,b,{flag:"wx",mode:384}),{path:(0,i.Nw)(k),name:m(a),storedName:j,size:b.length}}d()}catch(a){d(a)}})},74974:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>k});var e=c(23211),f=c(29021),g=c.n(f),h=c(80547),i=c(82494),j=a([h]);async function k(a){try{let b,c=a.nextUrl.searchParams.get("cwd")?.trim()??"";if(!c||!c.startsWith("/")&&!(0,h.uK)(c))return e.NextResponse.json({error:"cwd must be an absolute path"},{status:400});let d=a.nextUrl.searchParams.get("q")?.slice(0,500)??"",f=await (0,h.mc)();if(!(0,h.A$)(c,f))return e.NextResponse.json({error:"Access denied"},{status:403});try{b=g().statSync(c)}catch{return e.NextResponse.json({error:"Directory not found"},{status:404})}if(!b.isDirectory())return e.NextResponse.json({error:"Not a directory"},{status:400});return e.NextResponse.json(await (0,i.Z)(c,d))}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}h=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>q,Nw:()=>j.Nw,mc:()=>p,uK:()=>o,wz:()=>k.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(60396),j=c(50593),k=c(25252),l=c(69835),m=c(40402),n=a([l,m]);[l,m]=n.then?(await n)():n;let r=/^[a-zA-Z]:[\\/]/;function o(a){return r.test(a)||a.startsWith("\\\\")||a.startsWith("//")}async function p(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,m.dQ)(),d=function(a){let b=new Set;for(let c of a)!0!==c.readOnly&&c.cwd&&b.add((0,j.Nw)(c.cwd)),!0!==c.readOnly&&c.projectRoot&&b.add((0,j.Nw)(c.projectRoot));return b}(c);try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,j.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,k.HM)())d.add(a);try{d.add((0,l.qo)((0,i.$M)()))}catch{}return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function q(a,b){for(let c of b){let b=o(a)||o(c),d=b?h().win32:h(),e=b?"\\":h().sep,f=d.resolve(a),g=d.resolve(c),i=b?f.toLowerCase():f,j=b?g.toLowerCase():g,k=j.endsWith(e)?j:j+e;if(i===j||i.startsWith(k))return!0}return!1}d()}catch(a){d(a)}})},82494:(a,b,c)=>{c.d(b,{Z:()=>p});var d=c(79646),e=c(28354),f=c(29021),g=c.n(f),h=c(33873),i=c.n(h);function j(a){let b=0;for(let c=0;c<a.length;c++)"/"===a[c]&&b++;return b}function k(a,b){if(!a)return!0;let c=0;for(let d=0;d<b.length&&c<a.length;d++)b[d]===a[c]&&c++;return c===a.length}let l=(0,e.promisify)(d.execFile),m=new Set(["node_modules",".git",".next","dist","build","__pycache__",".turbo",".cache","coverage",".pytest_cache",".mypy_cache","target","vendor",".DS_Store"]),n=[".pyc"];async function o(a){try{let{stdout:b}=await l("git",["-C",a,"ls-files","--cached","--others","--exclude-standard","-z"],{timeout:1e4,maxBuffer:0x4000000,env:{...process.env,LC_ALL:"C"}}),c=b.split("\0").filter(Boolean);if(c.length>2e5)return{files:c.slice(0,2e5),hardTruncated:!0};return{files:c,hardTruncated:!1}}catch{return null}}async function p(a,b){let c=(globalThis.__piFileIndexCache||(globalThis.__piFileIndexCache=new Map),globalThis.__piFileIndexCache),d=Date.now(),e=c.get(a);if(!e||e.expiresAt<=d){let b=await o(a)??function(a){let b=[],c=[{abs:a,rel:"",depth:0}];for(;c.length>0;){let a,{abs:d,rel:e,depth:f}=c.shift();try{a=g().readdirSync(d,{withFileTypes:!0})}catch{continue}for(let g of a){if(m.has(g.name)||n.some(a=>g.name.endsWith(a)))continue;let a=e?`${e}/${g.name}`:g.name;if(g.isDirectory())f+1<=8&&c.push({abs:i().join(d,g.name),rel:a,depth:f+1});else if(g.isFile()){if(b.length>=5e4)return{files:b,hardTruncated:!0};b.push(a)}}}return{files:b,hardTruncated:!1}}(a);for(let[a,b]of c)b.expiresAt<=d&&c.delete(a);c.size>=20&&c.clear(),e={listing:b,expiresAt:d+6e4},c.set(a,e)}if(b)return e.entries??=function(a){let b=new Set;for(let c of a){let a=c.indexOf("/");for(;-1!==a;)b.add(c.slice(0,a)),a=c.indexOf("/",a+1)}let c=[];for(let a of b)c.push({path:a,isDir:!0});for(let b of a)b&&c.push({path:b,isDir:!1});return c.sort((a,b)=>j(a.path)-j(b.path)||a.path.localeCompare(b.path)),c}(e.listing.files),{matches:function(a,b,c=20){let d=b.toLowerCase();if(!d)return a.slice(0,c);let e=[];for(let b of a){let a=function(a,b){let c=a.path.toLowerCase(),d=0;if(b.includes("/"))c===b?d=100:c.startsWith(b)?d=80:c.includes(b)?d=50:k(b,c)&&(d=10);else{let a=c.lastIndexOf("/"),e=-1===a?c:c.slice(a+1);e===b?d=100:e.startsWith(b)?d=80:e.includes(b)?d=50:c.includes(b)?d=30:k(b,c)&&(d=10)}return a.isDir&&d>0&&(d+=10),d}(b,d);a>0&&e.push({entry:b,score:a})}return e.sort((a,b)=>b.score-a.score||j(a.entry.path)-j(b.entry.path)||a.entry.path.localeCompare(b.entry.path)),e.slice(0,c).map(a=>a.entry)}(e.entries,b)};let{files:f,hardTruncated:h}=e.listing;return{files:f.slice(0,5e3),truncated:h||f.length>5e3}}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{a.exports=require("node:path")},89477:a=>{a.exports=require("node:fs")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582],()=>b(b.s=40084));module.exports=c})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var a={};a.id=4037,a.ids=[4037],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},400:(a,b,c)=>{c.d(b,{OJ:()=>o,Sk:()=>j,j0:()=>m});var d=c(89477),e=c.n(d),f=c(86697),g=c.n(f),h=c(716);let i="true"===process.env.SAVE_FSYNC;class j extends Error{constructor(a,b){super(b),this.code=a}}function k(a){return(a.split(/[\\/]+/).filter(Boolean).pop()??"").startsWith(".pi-save-")?"目标路径包含受保护名称":null}function l(a){return/^[a-zA-Z]:[\\/]/.test(a)||a.startsWith("\\\\")||a.startsWith("//")}function m(a,b,c=l(a)||l(b)){let d=c?g().win32:g(),e=d.resolve(a),f=d.resolve(b),h=c?e.toLowerCase():e,i=c?f.toLowerCase():f;return h!==i&&h.startsWith(i.endsWith(d.sep)?i:i+d.sep)}function n(a,b){let c=a?.code;if("ENOENT"===c)throw new j("not-found",b);if("EACCES"===c||"EPERM"===c)throw new j("forbidden","文件访问被拒绝");throw a}function o(a){let b,c,d,{target:f,cwd:l,allowedRoots:o,content:p,baseline:q}=a,r=k(f);if(r)throw new j("forbidden",r);let s=function(a,b){if(!Number.isFinite(b?.mtimeMs)||b.mtimeMs<0||!Number.isFinite(b?.size)||b.size<0)throw new j("bad-request","保存请求格式无效");for(let b=0;b<a.length;b+=1){let c=a.charCodeAt(b);if(c>=55296&&c<=57343){if(c<=56319&&b+1<a.length&&a.charCodeAt(b+1)>=56320&&57343>=a.charCodeAt(b+1)){b+=1;continue}throw new j("bad-request","内容包含不可逆 UTF-8 字符")}}return Buffer.from(a,"utf8")}(p,q),t=a.isAllowed??((a,b)=>[...b].some(b=>a===b||a.startsWith(`${b}/`)||a.startsWith(`${b}\\`)));if(!t(f,o))throw new j("forbidden","目标不在授权目录内");try{b=e().lstatSync(f)}catch(a){return n(a,"目标文件不存在")}if(b.isSymbolicLink())throw new j("forbidden","目标不能是符号链接");if(!b.isFile())throw new j("bad-request","目标不是常规文件");try{if(e().realpathSync(l),c=e().realpathSync(f),d=new Set([...o].map(a=>e().realpathSync(a))),k(c)||!t(c,d))throw new j("forbidden","目标不在授权目录内");for(let a=g().dirname(f);m(a,l);a=g().dirname(a))if(e().lstatSync(a).isSymbolicLink())throw new j("forbidden","目标父目录不能是符号链接")}catch(a){if(a instanceof j)throw a;return n(a,"目标路径不存在")}try{e().statSync(c)}catch(a){return n(a,"目标文件不存在")}let u=g().dirname(c),v=g().join(u,`.pi-save-${process.pid}-${(0,h.randomUUID)()}`);try{if(e().writeFileSync(v,s,{flag:"wx",mode:4095&b.mode}),e().chmodSync(v,4095&b.mode),i){let a=e().openSync(v,"r+");try{e().fsyncSync(a)}finally{e().closeSync(a)}}e().renameSync(v,c)}catch(a){try{e().unlinkSync(v)}catch{}return n(a,"保存目标不存在")}let w=e().statSync(c);return{path:f,size:w.size,mtimeMs:w.mtimeMs}}},716:a=>{a.exports=require("node:crypto")},1060:(a,b,c)=>{c.d(b,{Ac:()=>n,GO:()=>j,X:()=>l,_4:()=>d,cV:()=>k,jL:()=>f,kv:()=>e,oC:()=>m});let d=262144,e=0xa00000,f=0xa00000,g={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"},h={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"},i={pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};function j(a){return(a.replace(/\\/g,"/").split("/").pop()??"").toLowerCase().split(".").pop()??""}function k(a){return g[j(a)]??null}function l(a){return h[j(a)]??null}function m(a){return i[j(a)]??null}function n(a){let b=j(a);return"pdf"===b||"docx"===b?b:null}},1304:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>B,POST:()=>x});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(60601),o=c(54968),p=c(93089),q=c(55484),r=a([j,m,o,p]);[j,m,o,p]=r.then?(await r)():r;let C=new Set(["node_modules",".git",".next","dist","build","__pycache__",".turbo",".cache","coverage",".pytest_cache",".mypy_cache","target","vendor",".DS_Store",".git"]),D=[".pyc"],E=new Set(["list","read","download","meta","preview","watch"]),F={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",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 s(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":F[b.split(".").pop()??""]??"text"}function t(a){let b=a.join("/"),c=(0,j.Nw)(b);return(0,j.uK)(c)?c:"/"+b.replace(/^\/+/,"")}async function u(a){let b,c=t(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})}}function v(a,b){if(!a||"object"!=typeof a)return null;let c=a[b];return"string"==typeof c?c:null}function w(a){return a instanceof p.nf?e.NextResponse.json({error:a.message},{status:(0,p.LO)(a.code)}):e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}async function x(a,{params:b}){try{let{path:d}=await b,f=a.nextUrl.searchParams.get("type")??"upload";if("save"===f){let b=t(d);return(0,o.$)(a,b)}if("create-file"===f||"create-dir"===f||"rename"===f){let b=await (0,j.mc)(),c=await a.json().catch(()=>null);try{if("rename"===f){let a=t(d),f=v(c,"newName");if(!f)return e.NextResponse.json({error:"newName is required"},{status:400});let g=(0,p.xO)(a,f,b);return e.NextResponse.json({path:g.path,name:g.name})}let a=t(d),g=v(c,"name");if(!g)return e.NextResponse.json({error:"name is required"},{status:400});let h="create-file"===f?(0,p.wp)(a,g,b):(0,p.c1)(a,g,b);return e.NextResponse.json({path:h.path,name:h.name},{status:201})}catch(a){return w(a)}}let h=await u(d);if("response"in h)return h.response;let{directory:k}=h;if("upload-check"===f){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,q.SI)(d);if(f)return e.NextResponse.json({error:f},{status:400});return e.NextResponse.json((0,q.Gu)(k,d))}if("upload"!==f)return e.NextResponse.json({error:"Invalid upload request type"},{status:400});let l=(0,q.Ey)(a.nextUrl.searchParams.get("conflict"));if(!l)return e.NextResponse.json({error:"Invalid conflict strategy"},{status:400});let m=Number(a.headers.get("content-length"));if(Number.isFinite(m)&&m>0x6900000)return e.NextResponse.json({error:"Uploads must total 100MB or less"},{status:413});let n=(await a.formData()).getAll("files").filter(a=>"string"!=typeof a);if(n.some(a=>a.size>0x1900000))return e.NextResponse.json({error:"Each upload must be 25MB or smaller"},{status:413});if(n.reduce((a,b)=>a+b.size,0)>0x6400000)return e.NextResponse.json({error:"Uploads must total 100MB or less"},{status:413});let r=n.map(a=>a.name),s=(0,q.SI)(r);if(s)return e.NextResponse.json({error:s},{status:400});let x=(0,q.Gu)(k,r);if("error"===l&&x.conflicts.length>0)return e.NextResponse.json({error:"One or more files already exist",conflicts:x.conflicts,nonReplaceable:x.nonReplaceable},{status:409});let y=new Set(x.conflicts),z=new Set(x.nonReplaceable),A=[],B=[],C=[];for(let a of n){let b,c=i().join(k,a.name);if(y.has(a.name)&&"skip"===l){B.push(a.name);continue}if(y.has(a.name)&&z.has(a.name)){C.push({name:a.name,error:"Cannot replace a directory or symbolic link"});continue}try{b=Buffer.from(await a.arrayBuffer())}catch(b){C.push({name:a.name,error:b instanceof Error?b.message:String(b)});continue}if(y.has(a.name))try{g().unlinkSync(c)}catch(b){C.push({name:a.name,error:b instanceof Error?b.message:String(b)});continue}try{g().writeFileSync(c,b,{flag:"wx"}),A.push(a.name)}catch(b){C.push({name:a.name,error:b instanceof Error?b.message:String(b)})}}return e.NextResponse.json({uploaded:A,skipped:B,errors:C},{status:C.length>0?207:200})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}function y(a,b){let c=(0,n.fu)(a),d=g().createReadStream(a,{fd:c,autoClose:!0,...b??{}}),e=!1;return new ReadableStream({start(a){d.on("data",b=>{if(!e)try{a.enqueue(new Uint8Array(b))}catch{e=!0,d.destroy()}}),d.once("end",()=>{if(!e){e=!0;try{a.close()}catch{}}}),d.once("error",b=>{if(!e){e=!0;try{a.error(b)}catch{}}})},cancel(){e=!0,d.destroy()}})}function z(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()}`)}`}function A(a,b,c,d,e=!1){let f={"Content-Type":c,"Cache-Control":"no-cache","Accept-Ranges":"bytes","Content-Disposition":z(a,e)};if(!d)return new Response(y(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,i=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),i=b.size-1}if(!Number.isFinite(h)||!Number.isFinite(i)||h<0||i<h||h>=b.size)return new Response(null,{status:416,headers:{...f,"Content-Range":`bytes */${b.size}`}});let j=(i=Math.min(i,b.size-1))-h+1;return new Response(y(a,{start:h,end:i}),{status:206,headers:{...f,"Content-Length":String(j),"Content-Range":`bytes ${h}-${i}/${b.size}`}})}async function B(a,{params:b}){try{var d,f,h;let o,q,{path:r}=await b,u=t(r),v=(d=a.nextUrl.searchParams.get("type")??"list",E.has(d)?d:null);if(!v)return e.NextResponse.json({error:"Invalid file request type"},{status:400});let x=a.nextUrl.searchParams.get("sessionId"),y=await (0,j.mc)(),B=(0,j.A$)(u,y),F=!B&&"list"!==v&&await (0,m.Iq)(u,x);if(!B&&!F)return e.NextResponse.json({error:"Access denied"},{status:403});let G=(0,n.iM)(u,y);if("not-found"===G.kind)return e.NextResponse.json({error:"Not found"},{status:404});if("ok"===G.kind)o=G.realPath,q=G.stat;else{if("denied"===G.kind||!F||!(0,n.hI)(u,G.realPath))return e.NextResponse.json({error:"Access denied"},{status:403});o=G.realPath,q=G.stat}if("read"===v){if(!q.isFile())return e.NextResponse.json({error:"Not a file"},{status:400});let b=(0,k.cV)(o);if(b){if(q.size>k.kv)return e.NextResponse.json({error:"Image too large (>10MB)"},{status:413});return A(o,q,b,a.headers.get("range"))}let c=(0,k.X)(o);if(c)return A(o,q,c,a.headers.get("range"));let d=(0,k.oC)(o);if(d)return A(o,q,d,a.headers.get("range"));if(q.size>k._4)return e.NextResponse.json({error:"File too large for preview (>256KB)"},{status:413});let f=(0,n.fu)(o);try{let a=g().readFileSync(f,"utf-8"),b=s(o);return e.NextResponse.json({content:a,language:b,size:q.size,mtimeMs:q.mtimeMs})}finally{g().closeSync(f)}}if("download"===v){if(q.isDirectory())try{let a=(0,p.Wd)(o),b=`${i().basename(o)||"folder"}.tar.gz`;return new Response(a,{headers:{"Content-Type":"application/gzip","Content-Disposition":z(b,!0),"Cache-Control":"no-cache"}})}catch(a){return w(a)}if(!q.isFile())return e.NextResponse.json({error:"Not a file"},{status:400});let b=(0,k.cV)(o)||(0,k.X)(o)||(0,k.oC)(o)||"application/octet-stream";return A(o,q,b,a.headers.get("range"),!0)}if("meta"===v){if(!q.isFile())return e.NextResponse.json({error:"Not a file"},{status:400});let a=(0,k.cV)(o),b=(0,k.X)(o),c=(0,k.oC)(o);return e.NextResponse.json({size:q.size,mtimeMs:q.mtimeMs,language:s(o),mime:a||b||c||"text/plain",previewKind:(0,k.Ac)(o)})}if("preview"===v){if(!q.isFile())return e.NextResponse.json({error:"Not a file"},{status:400});if("docx"!==(0,k.GO)(o))return e.NextResponse.json({error:"Preview not available for this file type"},{status:400});if(q.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:o},{externalFileAccess:!1,convertImage:a.images.dataUri})).value,h=i().basename(o),`<!doctype html>
|
|
1
|
+
"use strict";(()=>{var a={};a.id=4037,a.ids=[4037],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},400:(a,b,c)=>{c.d(b,{OJ:()=>o,Sk:()=>j,j0:()=>m});var d=c(89477),e=c.n(d),f=c(86697),g=c.n(f),h=c(716);let i="true"===process.env.SAVE_FSYNC;class j extends Error{constructor(a,b){super(b),this.code=a}}function k(a){return(a.split(/[\\/]+/).filter(Boolean).pop()??"").startsWith(".pi-save-")?"目标路径包含受保护名称":null}function l(a){return/^[a-zA-Z]:[\\/]/.test(a)||a.startsWith("\\\\")||a.startsWith("//")}function m(a,b,c=l(a)||l(b)){let d=c?g().win32:g(),e=d.resolve(a),f=d.resolve(b),h=c?e.toLowerCase():e,i=c?f.toLowerCase():f;return h!==i&&h.startsWith(i.endsWith(d.sep)?i:i+d.sep)}function n(a,b){let c=a?.code;if("ENOENT"===c)throw new j("not-found",b);if("EACCES"===c||"EPERM"===c)throw new j("forbidden","文件访问被拒绝");throw a}function o(a){let b,c,d,{target:f,cwd:l,allowedRoots:o,content:p,baseline:q}=a,r=k(f);if(r)throw new j("forbidden",r);let s=function(a,b){if(!Number.isFinite(b?.mtimeMs)||b.mtimeMs<0||!Number.isFinite(b?.size)||b.size<0)throw new j("bad-request","保存请求格式无效");for(let b=0;b<a.length;b+=1){let c=a.charCodeAt(b);if(c>=55296&&c<=57343){if(c<=56319&&b+1<a.length&&a.charCodeAt(b+1)>=56320&&57343>=a.charCodeAt(b+1)){b+=1;continue}throw new j("bad-request","内容包含不可逆 UTF-8 字符")}}return Buffer.from(a,"utf8")}(p,q),t=a.isAllowed??((a,b)=>[...b].some(b=>a===b||a.startsWith(`${b}/`)||a.startsWith(`${b}\\`)));if(!t(f,o))throw new j("forbidden","目标不在授权目录内");try{b=e().lstatSync(f)}catch(a){return n(a,"目标文件不存在")}if(b.isSymbolicLink())throw new j("forbidden","目标不能是符号链接");if(!b.isFile())throw new j("bad-request","目标不是常规文件");try{if(e().realpathSync(l),c=e().realpathSync(f),d=new Set([...o].map(a=>e().realpathSync(a))),k(c)||!t(c,d))throw new j("forbidden","目标不在授权目录内");for(let a=g().dirname(f);m(a,l);a=g().dirname(a))if(e().lstatSync(a).isSymbolicLink())throw new j("forbidden","目标父目录不能是符号链接")}catch(a){if(a instanceof j)throw a;return n(a,"目标路径不存在")}try{e().statSync(c)}catch(a){return n(a,"目标文件不存在")}let u=g().dirname(c),v=g().join(u,`.pi-save-${process.pid}-${(0,h.randomUUID)()}`);try{if(e().writeFileSync(v,s,{flag:"wx",mode:4095&b.mode}),e().chmodSync(v,4095&b.mode),i){let a=e().openSync(v,"r+");try{e().fsyncSync(a)}finally{e().closeSync(a)}}e().renameSync(v,c)}catch(a){try{e().unlinkSync(v)}catch{}return n(a,"保存目标不存在")}let w=e().statSync(c);return{path:f,size:w.size,mtimeMs:w.mtimeMs}}},716:a=>{a.exports=require("node:crypto")},1060:(a,b,c)=>{c.d(b,{Ac:()=>n,GO:()=>j,X:()=>l,_4:()=>d,cV:()=>k,jL:()=>f,kv:()=>e,oC:()=>m});let d=262144,e=0xa00000,f=0xa00000,g={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"},h={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"},i={pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};function j(a){return(a.replace(/\\/g,"/").split("/").pop()??"").toLowerCase().split(".").pop()??""}function k(a){return g[j(a)]??null}function l(a){return h[j(a)]??null}function m(a){return i[j(a)]??null}function n(a){let b=j(a);return"pdf"===b||"docx"===b?b:null}},1304:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>B,POST:()=>x});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(60601),o=c(54968),p=c(93089),q=c(55484),r=a([j,m,o,p]);[j,m,o,p]=r.then?(await r)():r;let C=new Set(["node_modules",".git",".next","dist","build","__pycache__",".turbo",".cache","coverage",".pytest_cache",".mypy_cache","target","vendor",".DS_Store",".git"]),D=[".pyc"],E=new Set(["list","read","download","meta","preview","watch"]),F={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",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 s(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":F[b.split(".").pop()??""]??"text"}function t(a){let b=a.join("/"),c=(0,j.Nw)(b);return(0,j.uK)(c)?c:"/"+b.replace(/^\/+/,"")}async function u(a){let b,c=t(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})}}function v(a,b){if(!a||"object"!=typeof a)return null;let c=a[b];return"string"==typeof c?c:null}function w(a){return a instanceof p.nf?e.NextResponse.json({error:a.message},{status:(0,p.LO)(a.code)}):e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}async function x(a,{params:b}){try{let{path:d}=await b,f=a.nextUrl.searchParams.get("type")??"upload";if("save"===f){let b=t(d);return(0,o.$)(a,b)}if("create-file"===f||"create-dir"===f||"rename"===f||"move"===f||"copy"===f){let b=await (0,j.mc)(),c=await a.json().catch(()=>null);try{if("rename"===f){let a=t(d),f=v(c,"newName");if(!f)return e.NextResponse.json({error:"newName is required"},{status:400});let g=(0,p.xO)(a,f,b);return e.NextResponse.json({path:g.path,name:g.name})}if("move"===f||"copy"===f){let a=t(d),g=v(c,"targetDirectory");if(!g)return e.NextResponse.json({error:"targetDirectory is required"},{status:400});let h="move"===f?(0,p.cb)(a,g,b):(0,p.ox)(a,g,b);return e.NextResponse.json({path:h.path,name:h.name})}let a=t(d),g=v(c,"name");if(!g)return e.NextResponse.json({error:"name is required"},{status:400});let h="create-file"===f?(0,p.wp)(a,g,b):(0,p.c1)(a,g,b);return e.NextResponse.json({path:h.path,name:h.name},{status:201})}catch(a){return w(a)}}let h=await u(d);if("response"in h)return h.response;let{directory:k}=h;if("upload-check"===f){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,q.SI)(d);if(f)return e.NextResponse.json({error:f},{status:400});return e.NextResponse.json((0,q.Gu)(k,d))}if("upload"!==f)return e.NextResponse.json({error:"Invalid upload request type"},{status:400});let l=(0,q.Ey)(a.nextUrl.searchParams.get("conflict"));if(!l)return e.NextResponse.json({error:"Invalid conflict strategy"},{status:400});let m=Number(a.headers.get("content-length"));if(Number.isFinite(m)&&m>0x6900000)return e.NextResponse.json({error:"Uploads must total 100MB or less"},{status:413});let n=(await a.formData()).getAll("files").filter(a=>"string"!=typeof a);if(n.some(a=>a.size>0x1900000))return e.NextResponse.json({error:"Each upload must be 25MB or smaller"},{status:413});if(n.reduce((a,b)=>a+b.size,0)>0x6400000)return e.NextResponse.json({error:"Uploads must total 100MB or less"},{status:413});let r=n.map(a=>a.name),s=(0,q.SI)(r);if(s)return e.NextResponse.json({error:s},{status:400});let x=(0,q.Gu)(k,r);if("error"===l&&x.conflicts.length>0)return e.NextResponse.json({error:"One or more files already exist",conflicts:x.conflicts,nonReplaceable:x.nonReplaceable},{status:409});let y=new Set(x.conflicts),z=new Set(x.nonReplaceable),A=[],B=[],C=[];for(let a of n){let b,c=i().join(k,a.name);if(y.has(a.name)&&"skip"===l){B.push(a.name);continue}if(y.has(a.name)&&z.has(a.name)){C.push({name:a.name,error:"Cannot replace a directory or symbolic link"});continue}try{b=Buffer.from(await a.arrayBuffer())}catch(b){C.push({name:a.name,error:b instanceof Error?b.message:String(b)});continue}if(y.has(a.name))try{g().unlinkSync(c)}catch(b){C.push({name:a.name,error:b instanceof Error?b.message:String(b)});continue}try{g().writeFileSync(c,b,{flag:"wx"}),A.push(a.name)}catch(b){C.push({name:a.name,error:b instanceof Error?b.message:String(b)})}}return e.NextResponse.json({uploaded:A,skipped:B,errors:C},{status:C.length>0?207:200})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}function y(a,b){let c=(0,n.fu)(a),d=g().createReadStream(a,{fd:c,autoClose:!0,...b??{}}),e=!1;return new ReadableStream({start(a){d.on("data",b=>{if(!e)try{a.enqueue(new Uint8Array(b))}catch{e=!0,d.destroy()}}),d.once("end",()=>{if(!e){e=!0;try{a.close()}catch{}}}),d.once("error",b=>{if(!e){e=!0;try{a.error(b)}catch{}}})},cancel(){e=!0,d.destroy()}})}function z(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()}`)}`}function A(a,b,c,d,e=!1){let f={"Content-Type":c,"Cache-Control":"no-cache","Accept-Ranges":"bytes","Content-Disposition":z(a,e)};if(!d)return new Response(y(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,i=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),i=b.size-1}if(!Number.isFinite(h)||!Number.isFinite(i)||h<0||i<h||h>=b.size)return new Response(null,{status:416,headers:{...f,"Content-Range":`bytes */${b.size}`}});let j=(i=Math.min(i,b.size-1))-h+1;return new Response(y(a,{start:h,end:i}),{status:206,headers:{...f,"Content-Length":String(j),"Content-Range":`bytes ${h}-${i}/${b.size}`}})}async function B(a,{params:b}){try{var d,f,h;let o,q,{path:r}=await b,u=t(r),v=(d=a.nextUrl.searchParams.get("type")??"list",E.has(d)?d:null);if(!v)return e.NextResponse.json({error:"Invalid file request type"},{status:400});let x=a.nextUrl.searchParams.get("sessionId"),y=await (0,j.mc)(),B=(0,j.A$)(u,y),F=!B&&"list"!==v&&await (0,m.Iq)(u,x);if(!B&&!F)return e.NextResponse.json({error:"Access denied"},{status:403});let G=(0,n.iM)(u,y);if("not-found"===G.kind)return e.NextResponse.json({error:"Not found"},{status:404});if("ok"===G.kind)o=G.realPath,q=G.stat;else{if("denied"===G.kind||!F||!(0,n.hI)(u,G.realPath))return e.NextResponse.json({error:"Access denied"},{status:403});o=G.realPath,q=G.stat}if("read"===v){if(!q.isFile())return e.NextResponse.json({error:"Not a file"},{status:400});let b=(0,k.cV)(o);if(b){if(q.size>k.kv)return e.NextResponse.json({error:"Image too large (>10MB)"},{status:413});return A(o,q,b,a.headers.get("range"))}let c=(0,k.X)(o);if(c)return A(o,q,c,a.headers.get("range"));let d=(0,k.oC)(o);if(d)return A(o,q,d,a.headers.get("range"));if(q.size>k._4)return e.NextResponse.json({error:"File too large for preview (>256KB)"},{status:413});let f=(0,n.fu)(o);try{let a=g().readFileSync(f,"utf-8"),b=s(o);return e.NextResponse.json({content:a,language:b,size:q.size,mtimeMs:q.mtimeMs})}finally{g().closeSync(f)}}if("download"===v){if(q.isDirectory())try{let a=(0,p.Wd)(o),b=`${i().basename(o)||"folder"}.tar.gz`;return new Response(a,{headers:{"Content-Type":"application/gzip","Content-Disposition":z(b,!0),"Cache-Control":"no-cache"}})}catch(a){return w(a)}if(!q.isFile())return e.NextResponse.json({error:"Not a file"},{status:400});let b=(0,k.cV)(o)||(0,k.X)(o)||(0,k.oC)(o)||"application/octet-stream";return A(o,q,b,a.headers.get("range"),!0)}if("meta"===v){if(!q.isFile())return e.NextResponse.json({error:"Not a file"},{status:400});let a=(0,k.cV)(o),b=(0,k.X)(o),c=(0,k.oC)(o);return e.NextResponse.json({size:q.size,mtimeMs:q.mtimeMs,language:s(o),mime:a||b||c||"text/plain",previewKind:(0,k.Ac)(o)})}if("preview"===v){if(!q.isFile())return e.NextResponse.json({error:"Not a file"},{status:400});if("docx"!==(0,k.GO)(o))return e.NextResponse.json({error:"Preview not available for this file type"},{status:400});if(q.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:o},{externalFileAccess:!1,convertImage:a.images.dataUri})).value,h=i().basename(o),`<!doctype html>
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
@@ -46,4 +46,4 @@ ${f}
|
|
|
46
46
|
</html>`);return new Response(b,{headers:{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-cache","Content-Security-Policy":"default-src 'none'; img-src data:; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'; frame-ancestors 'self'","Referrer-Policy":"no-referrer","X-Content-Type-Options":"nosniff"}})}if("watch"===v){if(!q.isFile())return e.NextResponse.json({error:"Not a file"},{status:400});let a=null,b=q.mtimeMs,c=q.size,d=new ReadableStream({start(d){let e=(a,b)=>{let c=`event: ${a}
|
|
47
47
|
data: ${JSON.stringify(b)}
|
|
48
48
|
|
|
49
|
-
`;try{d.enqueue(new TextEncoder().encode(c))}catch{}};e("connected",{filePath:u});try{(a=g().watch(o,()=>{try{let a=g().statSync(o);if(a.mtimeMs===b&&a.size===c)return;b=a.mtimeMs,c=a.size,e("change",{mtime:a.mtime.toISOString(),size:a.size})}catch{e("change",{mtime:new Date().toISOString(),size:0})}})).on("error",()=>{try{d.close()}catch{}})}catch{e("error",{message:"Failed to watch file"}),d.close()}},cancel(){try{a?.close()}catch{}}});return new Response(d,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}})}if(!q.isDirectory())return e.NextResponse.json({error:"Not a directory"},{status:400});let H=g().readdirSync(o,{withFileTypes:!0}).filter(a=>!C.has(a.name)&&!D.some(b=>a.name.endsWith(b))).flatMap(a=>{let b=(0,l.w)(a,i().join(o,a.name));return null===b?[]:[{name:a.name,isDir:b,size:0,modified:""}]}).sort((a,b)=>a.isDir!==b.isDir?a.isDir?-1:1:a.name.localeCompare(b.name));return e.NextResponse.json({entries:H,path:u})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},1932:a=>{a.exports=require("url")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4984:a=>{a.exports=require("readline")},6954:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(1304),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/files/[...path]/route",pathname:"/api/files/[...path]",filename:"route",bundlePath:"app/api/files/[...path]/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/files/[...path]/route.ts",nextConfigOutput:"",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/files/[...path]/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!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(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},26238:a=>{a.exports=require("node:stream")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},49180:(a,b,c)=>{c.d(b,{ah:()=>f,iX:()=>h,j1:()=>i});var d=c(50593);let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function f(a){return!!a&&e.test(a)}function g(a){return/[A-Za-z0-9._~+%@/\\:-]/.test(a)}function h(a,b){for(let c of b){let b=[];if(!function a(b,c){if("string"==typeof b)return void c.push(b);if(b&&"object"==typeof b){if(Array.isArray(b)){for(let d of b)a(d,c);return}for(let d of Object.values(b))a(d,c)}}(c,b),b.some(b=>(function(a,b){let c=(0,d.Nw)(b),e=c.startsWith("/")?[c,`file://${c}`]:[c];for(let b of new Set([(0,d.Nw)(a),(0,d.Nw)((0,d.ex)(a))]))for(let a of e){let c=b.indexOf(a);for(;-1!==c;){let d=0===c?"":b[c-1],e=c+a.length;if((0===c||!g(d))&&function(a,b){if(b>=a.length)return!0;let c=a[b];return":"===c?/\d/.test(a[b+1]??""):!g(c)}(b,e))return!0;c=b.indexOf(a,c+1)}}return!1})(b,a)))return!0}return!1}function i(a,b){return b.some(b=>"message"===b.type&&"bashExecution"===b.message.role&&b.message.fullOutputPath===a)}},54968:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{$:()=>l});var e=c(23211),f=c(80547),g=c(1060),h=c(400),i=c(40402),j=c(37594),k=a([f,i,j]);[f,i,j]=k.then?(await k)():k;let m={resolveSessionPath:i.os,requireWritableSession:j.Yz,isReadOnly:j.mB.isReadOnly,readSessionHeader:i.eP,getAllowedFileRoots:f.mc,saveFile:h.OJ,isFilePathAllowed:f.A$,getBinaryMime:a=>(0,g.cV)(a)||(0,g.X)(a)||(0,g.oC)(a)};async function l(a,b,c={}){let d={...m,...c};try{let c=(0,f.Nw)(b);if(!c.startsWith("/")&&!(0,f.uK)(c))return e.NextResponse.json({error:"Save target must be absolute"},{status:400});let g=a.nextUrl.searchParams.get("sessionId");if(!g)return e.NextResponse.json({error:"sessionId is required"},{status:400});let h=await a.json().catch(()=>null);if("string"!=typeof h?.content||"number"!=typeof h.baseline?.mtimeMs||!Number.isFinite(h.baseline.mtimeMs)||h.baseline.mtimeMs<0||"number"!=typeof h.baseline?.size||!Number.isFinite(h.baseline.size)||h.baseline.size<0)return e.NextResponse.json({error:"Invalid save request"},{status:400});let i=await d.resolveSessionPath(g);if(!i)return e.NextResponse.json({error:"Session not found"},{status:404});try{await d.requireWritableSession(g,d.isReadOnly)}catch(a){if(a instanceof j.C9)return e.NextResponse.json({error:a.message},{status:403});throw a}let k=d.readSessionHeader(i);if(!k?.cwd)return e.NextResponse.json({error:"Session cwd not found"},{status:404});let l={target:b,cwd:k.cwd,sourceSessionId:g,allowedRoots:await d.getAllowedFileRoots(),content:h.content,baseline:{mtimeMs:h.baseline.mtimeMs,size:h.baseline.size},isAllowed:d.isFilePathAllowed,getBinaryMime:d.getBinaryMime},m=d.saveFile(l);return e.NextResponse.json({success:!0,...m})}catch(a){if(a instanceof h.Sk){let b={"bad-request":400,forbidden:403,"not-found":404,conflict:409,"too-large":413}[a.code];return"conflict"===a.code?e.NextResponse.json({error:"File changed externally",baseline:JSON.parse(a.message)},{status:b}):e.NextResponse.json({error:a.message},{status:b})}return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})},55484:(a,b,c)=>{c.d(b,{Ey:()=>i,Gu:()=>k,SI:()=>j});var d=c(29021),e=c.n(d),f=c(33873),g=c.n(f);let h=new Set(["error","overwrite","skip"]);function i(a){let b=a??"error";return h.has(b)?b:null}function j(a){if(0===a.length)return"No files selected";let b=new Set;for(let c of a){if(!c||"."===c||".."===c||c.includes("\0"))return`Invalid file name: ${c||"(empty)"}`;if(c.includes("/")||c.includes("\\")||g().basename(c)!==c)return`File names must not contain a path: ${c}`;if(b.has(c))return`Duplicate file name in upload: ${c}`;b.add(c)}return null}function k(a,b){let c=[],d=[];for(let f of b){let b,h=g().join(a,f);try{b=e().lstatSync(h)}catch(a){if("ENOENT"===a.code)continue;throw a}c.push(f),(!b.isFile()||b.isSymbolicLink())&&d.push(f)}return{conflicts:c,nonReplaceable:d}}},55511:a=>{a.exports=require("crypto")},60601:(a,b,c)=>{c.d(b,{fu:()=>m,hI:()=>l,iM:()=>j});var d=c(89477),e=c.n(d),f=c(86697),g=c.n(f),h=c(400);function i(a){let b=a?.code;return"ENOENT"===b||"ENOTDIR"===b}function j(a,b){let c,d;try{c=e().realpathSync(a)}catch(a){if(i(a))return{kind:"not-found"};return{kind:"denied"}}try{d=e().statSync(c)}catch(a){if(i(a))return{kind:"not-found"};return{kind:"denied"}}let f=!1;for(let a of b){let b;try{b=e().realpathSync(a)}catch{continue}if(f=!0,c===b||(0,h.j0)(c,b))return{kind:"ok",realPath:c,stat:d}}return f?{kind:"outside-roots",realPath:c,stat:d}:{kind:"denied"}}function k(a){return"win32"===process.platform?a.toLowerCase():a}function l(a,b){try{return k(g().resolve(a))===k(b)}catch{return!1}}function m(a){let b="number"==typeof e().constants.O_NOFOLLOW?e().constants.O_NOFOLLOW:0,c=e().openSync(a,e().constants.O_RDONLY|b);try{if(!e().fstatSync(c).isFile())throw Error("Read path is not a regular file");return c}catch(a){try{e().closeSync(c)}catch{}throw a}}},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},65630:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Iq:()=>h,jV:()=>i});var e=c(40402),f=c(49180),g=a([e]);async function h(a,b){if(!(0,f.ah)(b))return!1;try{let c=await (0,e.os)(b);if(!c)return!1;return(0,f.iX)(a,(0,e.DK)(c))}catch{return!1}}async function i(a,b){if(!(0,f.ah)(b))return!1;try{let c=await (0,e.os)(b);if(!c)return!1;return(0,f.j1)(a,(0,e.DK)(c))}catch{return!1}}e=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},79428:a=>{a.exports=require("buffer")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{a.exports=require("node:path")},88473:(a,b,c)=>{c.d(b,{w:()=>f});var d=c(29021),e=c.n(d);function f(a,b){if(a.isDirectory())return!0;if(a.isFile())return!1;try{return e().statSync(b).isDirectory()}catch{return null}}},89477:a=>{a.exports=require("node:fs")},93089:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{LO:()=>v,Wd:()=>u,c1:()=>s,nf:()=>x,wp:()=>r,xO:()=>t});var e=c(89477),f=c.n(e),g=c(86697),h=c.n(g),i=c(95398),j=c(26238),k=c(80547),l=a([k]);k=(l.then?(await l)():l)[0];let w=new Set([".git",".pi",".next","node_modules","dist","build","coverage","__pycache__",".pytest_cache",".mypy_cache",".turbo",".cache","target","vendor"]);class x extends Error{constructor(a,b){super(b),this.code=a}}function m(a){return a instanceof Set?a:new Set(a)}function n(a){return!a||"."===a||".."===a||a.includes("\0")?"Invalid name":a.includes("/")||a.includes("\\")||h().basename(a)!==a?"Name must not contain a path":w.has(a)||a.startsWith(".pi-save-")?"Protected name is not allowed":".env"===a||a.startsWith(".env.")&&".env.example"!==a?"Environment files are not allowed":null}function o(a,b){let c=a?.code;if("ENOENT"===c)throw new x("not-found",b);if("EACCES"===c||"EPERM"===c)throw new x("forbidden","Access denied");if("EEXIST"===c)throw new x("conflict","Already exists");throw a}function p(a){let b=new Set;for(let c of m(a))try{b.add(f().realpathSync(c))}catch{}return b}function q(a,b){let c,d;if(!(0,k.A$)(a,m(b)))throw new x("forbidden","Access denied");try{c=f().statSync(a)}catch(a){return o(a,"Directory not found")}if(!c.isDirectory())throw new x("bad-request","Target is not a directory");try{d=f().realpathSync(a)}catch(a){return o(a,"Directory not found")}if(!(0,k.A$)(d,p(b)))throw new x("forbidden","Access denied");return d}function r(a,b,c){let d=n(b);if(d)throw new x("bad-request",d);let e=q(a,c),g=h().join(e,b);if(!(0,k.A$)(g,p(c)))throw new x("forbidden","Access denied");try{f().writeFileSync(g,Buffer.alloc(0),{flag:"wx",mode:420})}catch(a){return o(a,"Failed to create file")}return{path:g,name:b}}function s(a,b,c){let d=n(b);if(d)throw new x("bad-request",d);let e=q(a,c),g=h().join(e,b);if(!(0,k.A$)(g,p(c)))throw new x("forbidden","Access denied");try{f().mkdirSync(g,{recursive:!1,mode:493})}catch(a){return o(a,"Failed to create directory")}return{path:g,name:b}}function t(a,b,c){let d,e,g=n(b);if(g)throw new x("bad-request",g);let i=m(c);if(!(0,k.A$)(a,i))throw new x("forbidden","Access denied");try{d=f().lstatSync(a)}catch(a){return o(a,"Not found")}if(d.isSymbolicLink())throw new x("forbidden","Symbolic links are not allowed");try{e=f().realpathSync(a)}catch(a){return o(a,"Not found")}let j=p(c);if(!(0,k.A$)(e,j))throw new x("forbidden","Access denied");let l=h().dirname(e);!function(a,b){let c=a;for(;;){let a;try{a=f().lstatSync(c)}catch(a){return o(a,"Path not found")}if(a.isSymbolicLink())throw new x("forbidden","Symbolic links are not allowed");if(c===b)break;let d=h().dirname(c);if(d===c)break;c=d}}(l,l);let q=h().join(l,b);if(q===e)return{path:e,name:b};if(!(0,k.A$)(q,j))throw new x("forbidden","Access denied");if(f().existsSync(q))throw new x("conflict","Already exists");try{f().renameSync(e,q)}catch(a){return o(a,"Rename failed")}return{path:q,name:b}}function u(a){let b=h().dirname(a),c=h().basename(a),d=(0,i.spawn)("tar",["-czf","-","-C",b,c],{stdio:["ignore","pipe","pipe"]});if(!d.stdout)throw d.kill(),new x("bad-request","Failed to start archive");return d.stderr?.resume(),d.on("error",()=>{}),j.Readable.toWeb(d.stdout)}function v(a){switch(a){case"bad-request":return 400;case"forbidden":return 403;case"not-found":return 404;case"conflict":return 409;default:return 500}}d()}catch(a){d(a)}})},94735:a=>{a.exports=require("events")},95398:a=>{a.exports=require("node:child_process")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582,7594],()=>b(b.s=6954));module.exports=c})();
|
|
49
|
+
`;try{d.enqueue(new TextEncoder().encode(c))}catch{}};e("connected",{filePath:u});try{(a=g().watch(o,()=>{try{let a=g().statSync(o);if(a.mtimeMs===b&&a.size===c)return;b=a.mtimeMs,c=a.size,e("change",{mtime:a.mtime.toISOString(),size:a.size})}catch{e("change",{mtime:new Date().toISOString(),size:0})}})).on("error",()=>{try{d.close()}catch{}})}catch{e("error",{message:"Failed to watch file"}),d.close()}},cancel(){try{a?.close()}catch{}}});return new Response(d,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}})}if(!q.isDirectory())return e.NextResponse.json({error:"Not a directory"},{status:400});let H=g().readdirSync(o,{withFileTypes:!0}).filter(a=>!C.has(a.name)&&!D.some(b=>a.name.endsWith(b))).flatMap(a=>{let b=(0,l.w)(a,i().join(o,a.name));return null===b?[]:[{name:a.name,isDir:b,size:0,modified:""}]}).sort((a,b)=>a.isDir!==b.isDir?a.isDir?-1:1:a.name.localeCompare(b.name));return e.NextResponse.json({entries:H,path:u})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},1932:a=>{a.exports=require("url")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4984:a=>{a.exports=require("readline")},6954:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(1304),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/files/[...path]/route",pathname:"/api/files/[...path]",filename:"route",bundlePath:"app/api/files/[...path]/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/files/[...path]/route.ts",nextConfigOutput:"",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/files/[...path]/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!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(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},26238:a=>{a.exports=require("node:stream")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},49180:(a,b,c)=>{c.d(b,{ah:()=>f,iX:()=>h,j1:()=>i});var d=c(50593);let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function f(a){return!!a&&e.test(a)}function g(a){return/[A-Za-z0-9._~+%@/\\:-]/.test(a)}function h(a,b){for(let c of b){let b=[];if(!function a(b,c){if("string"==typeof b)return void c.push(b);if(b&&"object"==typeof b){if(Array.isArray(b)){for(let d of b)a(d,c);return}for(let d of Object.values(b))a(d,c)}}(c,b),b.some(b=>(function(a,b){let c=(0,d.Nw)(b),e=c.startsWith("/")?[c,`file://${c}`]:[c];for(let b of new Set([(0,d.Nw)(a),(0,d.Nw)((0,d.ex)(a))]))for(let a of e){let c=b.indexOf(a);for(;-1!==c;){let d=0===c?"":b[c-1],e=c+a.length;if((0===c||!g(d))&&function(a,b){if(b>=a.length)return!0;let c=a[b];return":"===c?/\d/.test(a[b+1]??""):!g(c)}(b,e))return!0;c=b.indexOf(a,c+1)}}return!1})(b,a)))return!0}return!1}function i(a,b){return b.some(b=>"message"===b.type&&"bashExecution"===b.message.role&&b.message.fullOutputPath===a)}},54968:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{$:()=>l});var e=c(23211),f=c(80547),g=c(1060),h=c(400),i=c(40402),j=c(37594),k=a([f,i,j]);[f,i,j]=k.then?(await k)():k;let m={resolveSessionPath:i.os,requireWritableSession:j.Yz,isReadOnly:j.mB.isReadOnly,readSessionHeader:i.eP,getAllowedFileRoots:f.mc,saveFile:h.OJ,isFilePathAllowed:f.A$,getBinaryMime:a=>(0,g.cV)(a)||(0,g.X)(a)||(0,g.oC)(a)};async function l(a,b,c={}){let d={...m,...c};try{let c=(0,f.Nw)(b);if(!c.startsWith("/")&&!(0,f.uK)(c))return e.NextResponse.json({error:"Save target must be absolute"},{status:400});let g=a.nextUrl.searchParams.get("sessionId");if(!g)return e.NextResponse.json({error:"sessionId is required"},{status:400});let h=await a.json().catch(()=>null);if("string"!=typeof h?.content||"number"!=typeof h.baseline?.mtimeMs||!Number.isFinite(h.baseline.mtimeMs)||h.baseline.mtimeMs<0||"number"!=typeof h.baseline?.size||!Number.isFinite(h.baseline.size)||h.baseline.size<0)return e.NextResponse.json({error:"Invalid save request"},{status:400});let i=await d.resolveSessionPath(g);if(!i)return e.NextResponse.json({error:"Session not found"},{status:404});try{await d.requireWritableSession(g,d.isReadOnly)}catch(a){if(a instanceof j.C9)return e.NextResponse.json({error:a.message},{status:403});throw a}let k=d.readSessionHeader(i);if(!k?.cwd)return e.NextResponse.json({error:"Session cwd not found"},{status:404});let l={target:b,cwd:k.cwd,sourceSessionId:g,allowedRoots:await d.getAllowedFileRoots(),content:h.content,baseline:{mtimeMs:h.baseline.mtimeMs,size:h.baseline.size},isAllowed:d.isFilePathAllowed,getBinaryMime:d.getBinaryMime},m=d.saveFile(l);return e.NextResponse.json({success:!0,...m})}catch(a){if(a instanceof h.Sk){let b={"bad-request":400,forbidden:403,"not-found":404,conflict:409,"too-large":413}[a.code];return"conflict"===a.code?e.NextResponse.json({error:"File changed externally",baseline:JSON.parse(a.message)},{status:b}):e.NextResponse.json({error:a.message},{status:b})}return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})},55484:(a,b,c)=>{c.d(b,{Ey:()=>i,Gu:()=>k,SI:()=>j});var d=c(29021),e=c.n(d),f=c(33873),g=c.n(f);let h=new Set(["error","overwrite","skip"]);function i(a){let b=a??"error";return h.has(b)?b:null}function j(a){if(0===a.length)return"No files selected";let b=new Set;for(let c of a){if(!c||"."===c||".."===c||c.includes("\0"))return`Invalid file name: ${c||"(empty)"}`;if(c.includes("/")||c.includes("\\")||g().basename(c)!==c)return`File names must not contain a path: ${c}`;if(b.has(c))return`Duplicate file name in upload: ${c}`;b.add(c)}return null}function k(a,b){let c=[],d=[];for(let f of b){let b,h=g().join(a,f);try{b=e().lstatSync(h)}catch(a){if("ENOENT"===a.code)continue;throw a}c.push(f),(!b.isFile()||b.isSymbolicLink())&&d.push(f)}return{conflicts:c,nonReplaceable:d}}},55511:a=>{a.exports=require("crypto")},60601:(a,b,c)=>{c.d(b,{fu:()=>m,hI:()=>l,iM:()=>j});var d=c(89477),e=c.n(d),f=c(86697),g=c.n(f),h=c(400);function i(a){let b=a?.code;return"ENOENT"===b||"ENOTDIR"===b}function j(a,b){let c,d;try{c=e().realpathSync(a)}catch(a){if(i(a))return{kind:"not-found"};return{kind:"denied"}}try{d=e().statSync(c)}catch(a){if(i(a))return{kind:"not-found"};return{kind:"denied"}}let f=!1;for(let a of b){let b;try{b=e().realpathSync(a)}catch{continue}if(f=!0,c===b||(0,h.j0)(c,b))return{kind:"ok",realPath:c,stat:d}}return f?{kind:"outside-roots",realPath:c,stat:d}:{kind:"denied"}}function k(a){return"win32"===process.platform?a.toLowerCase():a}function l(a,b){try{return k(g().resolve(a))===k(b)}catch{return!1}}function m(a){let b="number"==typeof e().constants.O_NOFOLLOW?e().constants.O_NOFOLLOW:0,c=e().openSync(a,e().constants.O_RDONLY|b);try{if(!e().fstatSync(c).isFile())throw Error("Read path is not a regular file");return c}catch(a){try{e().closeSync(c)}catch{}throw a}}},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},65630:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Iq:()=>h,jV:()=>i});var e=c(40402),f=c(49180),g=a([e]);async function h(a,b){if(!(0,f.ah)(b))return!1;try{let c=await (0,e.os)(b);if(!c)return!1;return(0,f.iX)(a,(0,e.DK)(c))}catch{return!1}}async function i(a,b){if(!(0,f.ah)(b))return!1;try{let c=await (0,e.os)(b);if(!c)return!1;return(0,f.j1)(a,(0,e.DK)(c))}catch{return!1}}e=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},79428:a=>{a.exports=require("buffer")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{a.exports=require("node:path")},88473:(a,b,c)=>{c.d(b,{w:()=>f});var d=c(29021),e=c.n(d);function f(a,b){if(a.isDirectory())return!0;if(a.isFile())return!1;try{return e().statSync(b).isDirectory()}catch{return null}}},89477:a=>{a.exports=require("node:fs")},93089:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{LO:()=>y,Wd:()=>x,c1:()=>t,cb:()=>v,nf:()=>A,ox:()=>w,wp:()=>s,xO:()=>u});var e=c(89477),f=c.n(e),g=c(86697),h=c.n(g),i=c(95398),j=c(26238),k=c(80547),l=a([k]);k=(l.then?(await l)():l)[0];let z=new Set([".git",".pi",".next","node_modules","dist","build","coverage","__pycache__",".pytest_cache",".mypy_cache",".turbo",".cache","target","vendor"]);class A extends Error{constructor(a,b){super(b),this.code=a}}function m(a){return a instanceof Set?a:new Set(a)}function n(a){return!a||"."===a||".."===a||a.includes("\0")?"Invalid name":a.includes("/")||a.includes("\\")||h().basename(a)!==a?"Name must not contain a path":z.has(a)||a.startsWith(".pi-save-")?"Protected name is not allowed":".env"===a||a.startsWith(".env.")&&".env.example"!==a?"Environment files are not allowed":null}function o(a,b){let c=a?.code;if("ENOENT"===c)throw new A("not-found",b);if("EACCES"===c||"EPERM"===c)throw new A("forbidden","Access denied");if("EEXIST"===c)throw new A("conflict","Already exists");throw a}function p(a){let b=new Set;for(let c of m(a))try{b.add(f().realpathSync(c))}catch{}return b}function q(a,b){let c,d;if(!(0,k.A$)(a,m(b)))throw new A("forbidden","Access denied");try{c=f().statSync(a)}catch(a){return o(a,"Directory not found")}if(!c.isDirectory())throw new A("bad-request","Target is not a directory");try{d=f().realpathSync(a)}catch(a){return o(a,"Directory not found")}if(!(0,k.A$)(d,p(b)))throw new A("forbidden","Access denied");return d}function r(a,b){let c=a;for(;;){let a;try{a=f().lstatSync(c)}catch(a){return o(a,"Path not found")}if(a.isSymbolicLink())throw new A("forbidden","Symbolic links are not allowed");if(c===b)break;let d=h().dirname(c);if(d===c)break;c=d}}function s(a,b,c){let d=n(b);if(d)throw new A("bad-request",d);let e=q(a,c),g=h().join(e,b);if(!(0,k.A$)(g,p(c)))throw new A("forbidden","Access denied");try{f().writeFileSync(g,Buffer.alloc(0),{flag:"wx",mode:420})}catch(a){return o(a,"Failed to create file")}return{path:g,name:b}}function t(a,b,c){let d=n(b);if(d)throw new A("bad-request",d);let e=q(a,c),g=h().join(e,b);if(!(0,k.A$)(g,p(c)))throw new A("forbidden","Access denied");try{f().mkdirSync(g,{recursive:!1,mode:493})}catch(a){return o(a,"Failed to create directory")}return{path:g,name:b}}function u(a,b,c){let d,e,g=n(b);if(g)throw new A("bad-request",g);let i=m(c);if(!(0,k.A$)(a,i))throw new A("forbidden","Access denied");try{d=f().lstatSync(a)}catch(a){return o(a,"Not found")}if(d.isSymbolicLink())throw new A("forbidden","Symbolic links are not allowed");try{e=f().realpathSync(a)}catch(a){return o(a,"Not found")}let j=p(c);if(!(0,k.A$)(e,j))throw new A("forbidden","Access denied");let l=h().dirname(e);r(l,l);let q=h().join(l,b);if(q===e)return{path:e,name:b};if(!(0,k.A$)(q,j))throw new A("forbidden","Access denied");if(f().existsSync(q))throw new A("conflict","Already exists");try{f().renameSync(e,q)}catch(a){return o(a,"Rename failed")}return{path:q,name:b}}function v(a,b,c){let d,e,g=m(c),i=p(c);if(!(0,k.A$)(a,g))throw new A("forbidden","Access denied");try{d=f().lstatSync(a)}catch(a){return o(a,"Not found")}if(d.isSymbolicLink())throw new A("forbidden","Symbolic links are not allowed");try{e=f().realpathSync(a)}catch(a){return o(a,"Not found")}if(!(0,k.A$)(e,i))throw new A("forbidden","Access denied");r(h().dirname(e),e);let j=q(b,c),l=h().join(j,h().basename(e));if(l===e)return{path:e,name:h().basename(e)};if(!(0,k.A$)(l,i))throw new A("forbidden","Access denied");if(d.isDirectory()){let a=h().relative(e,j);if(""===a||!a.startsWith("..")&&".."!==a&&!h().isAbsolute(a))throw new A("bad-request","Cannot move a directory into itself")}if(f().existsSync(l))throw new A("conflict","Already exists");try{f().renameSync(e,l)}catch(a){return o(a,"Move failed")}return{path:l,name:h().basename(l)}}function w(a,b,c){let d,e,g=m(c),i=p(c);if(!(0,k.A$)(a,g))throw new A("forbidden","Access denied");try{d=f().lstatSync(a)}catch(a){return o(a,"Not found")}if(d.isSymbolicLink())throw new A("forbidden","Symbolic links are not allowed");try{e=f().realpathSync(a)}catch(a){return o(a,"Not found")}if(!(0,k.A$)(e,i))throw new A("forbidden","Access denied");r(h().dirname(e),e);let j=q(b,c),l=h().join(j,h().basename(e));if(l===e)throw new A("bad-request","Cannot copy onto itself");if(!(0,k.A$)(l,i))throw new A("forbidden","Access denied");if(f().existsSync(l))throw new A("conflict","Already exists");try{d.isDirectory()?f().cpSync(e,l,{recursive:!0,dereference:!1}):f().copyFileSync(e,l,f().constants.COPYFILE_EXCL)}catch(a){return o(a,"Copy failed")}return{path:l,name:h().basename(l)}}function x(a){let b=h().dirname(a),c=h().basename(a),d=(0,i.spawn)("tar",["-czf","-","-C",b,c],{stdio:["ignore","pipe","pipe"]});if(!d.stdout)throw d.kill(),new A("bad-request","Failed to start archive");return d.stderr?.resume(),d.on("error",()=>{}),j.Readable.toWeb(d.stdout)}function y(a){switch(a){case"bad-request":return 400;case"forbidden":return 403;case"not-found":return 404;case"conflict":return 409;default:return 500}}d()}catch(a){d(a)}})},94735:a=>{a.exports=require("events")},95398:a=>{a.exports=require("node:child_process")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582,7594],()=>b(b.s=6954));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=552,a.ids=[552],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},15770:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>Q,patchFetch:()=>P,routeModule:()=>L,serverHooks:()=>O,workAsyncStorage:()=>M,workUnitAsyncStorage:()=>N});var d={};c.r(d),c.d(d,{GET:()=>K,dynamic:()=>D});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(79748),w=c(33873),x=c(60396),y=c(17924),z=c(28967),A=c(8106),B=c(21182),C=c(92395);let D="force-dynamic",E=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function F(a,b){return E.compare(a.name||a.id,b.name||b.id)||E.compare(a.provider,b.provider)||E.compare(a.id,b.id)}let G=new Set(["off","minimal","low","medium","high","xhigh","max"]);function H(a){let b=a.trim(),c=b.lastIndexOf(":");if(-1===c)return b;let d=b.substring(c+1);return G.has(d)?b.substring(0,c):b}async function I(a){let b=(0,x.Mc)(),c=(0,x.pA)(),d=(0,x.CZ)(),e=(0,C.wq)(c),f=Array.isArray(e.enabledModels)?e.enabledModels:void 0,g=(0,A.js)(b),h={};for(let a of(0,y.yN)(d))h[a]=(0,y.gb)(a,{authPath:d,modelsPath:b});for(let a of g)void 0===h[a.provider]&&(h[a.provider]=(0,y.gb)(a.provider,{authPath:d,modelsPath:b}));let i=await (0,B.v1)(),j=(0,A.kp)(g,i,h),k=(0,A.cJ)(j,{settingsPath:c,authConfigured:h}),l=function(a,b){if(!b||0===b.length)return a;let c=new Set(b.map(H).filter(Boolean)),d=a.filter(a=>c.has(`${a.provider}/${a.id}`)||c.has(a.id));return d.length>0?d:a}(k.modelList,f),m=new Set(l.map(a=>`${a.provider}:${a.id}`)),n={},o={},p={};for(let a of l){let b=`${a.provider}:${a.id}`;n[b]=k.models[b]??a.name,k.thinkingLevels[b]&&(o[b]=k.thinkingLevels[b]),k.thinkingLevelMaps[b]&&(p[b]=k.thinkingLevelMaps[b])}let q=k.defaultModel;return q&&!m.has(`${q.provider}:${q.modelId}`)&&(q=null),{models:n,modelList:[...l].sort(F),defaultModel:q,thinkingLevels:o,thinkingLevelMaps:p,authConfigured:k.authConfigured}}let J={models:{},modelList:[],defaultModel:null,thinkingLevels:{},thinkingLevelMaps:{},authConfigured:{}};async function K(a){let b,c=new URL(a.url).searchParams.get("cwd")||process.cwd(),d=(0,w.resolve)(c);try{b=await (0,v.stat)(d)}catch{return Response.json({error:`Directory does not exist: ${d}`},{status:400})}if(!b.isDirectory())return Response.json({error:`Not a directory: ${d}`},{status:400});try{return Response.json(await (0,z.rC)(d,()=>I(d)))}catch{return Response.json(J)}}let L=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/models/route",pathname:"/api/models",filename:"route",bundlePath:"app/api/models/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/models/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:M,workUnitAsyncStorage:N,serverHooks:O}=L;function P(){return(0,g.patchFetch)({workAsyncStorage:M,workUnitAsyncStorage:N})}async function Q(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),L.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/models/route";"/index"===d&&(d="/");let e=await L.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:z,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,resolvedPathname:E,clientReferenceManifest:F,serverActionsManifest:G}=e,H=(0,k.normalizeAppPath)(d),I=!!(A.dynamicRoutes[H]||A.routes[E]),J=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(I&&!z){let a=!!A.routes[E],b=A.dynamicRoutes[H];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await J();throw new t.NoFallbackError}}let K=null;!I||L.isDev||z||(K="/index"===(K=E)?"/":K);let M=!0===L.isDev||!I,N=I&&!M;G&&F&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:F,serverActionsManifest:G});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==B?void 0:B.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await L.getIncrementalCache(a,x,A,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>L.onRequestError(a,b,d,e,B)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>L.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&C&&D&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!I)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await L.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),b}},k=await L.handleResponse({req:a,nextConfig:x,cacheKey:K,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!I)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",C?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),z&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&I||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await L.onRequestError(a,b,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),I)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},19225:(a,b,c)=>{"use strict";a.exports=c(44870)},21182:(a,b,c)=>{"use strict";c.d(b,{v1:()=>i});var d=c(89477),e=c(86697),f=c(73127);let g=null,h=null;async function i(){return g||h||(h=(async()=>{try{let a=function(a=process.cwd()){let b=a;for(let a=0;a<10;a++){for(let a of[(0,e.join)(b,"node_modules","@earendil-works","pi-coding-agent","node_modules","@earendil-works","pi-ai","dist","providers","all.js"),(0,e.join)(b,"node_modules","@earendil-works","pi-ai","dist","providers","all.js")])if((0,d.existsSync)(a))return a;let a=(0,e.dirname)(b);if(a===b)break;b=a}return null}();if(!a)return g=[];let b=(0,f.pathToFileURL)(a).href,h=null;try{h=await c(98279)(b)}catch{h=null}if(!h||"function"!=typeof h.builtinProviders&&"function"!=typeof h.getBuiltinProviders){let a=Function("u","return import(u)");h=await a(b)}return g=function(a){let b=("function"==typeof a.builtinProviders?a.builtinProviders():null)??("function"==typeof a.getBuiltinProviders?a.getBuiltinProviders():null)??[],c=[];for(let a of b)if(a&&"string"==typeof a.id&&a.id)for(let b of("function"==typeof a.getModels?a.getModels():[])??[]){let d=function(a,b){var c;let d="string"==typeof a.id?a.id:"";if(!d)return null;let e="string"==typeof a.name&&a.name?a.name:d,f="string"==typeof a.provider&&a.provider?a.provider:b,g="object"!=typeof(c=a.thinkingLevelMap)||null===c||Array.isArray(c)?void 0:a.thinkingLevelMap;return{id:d,name:e,provider:f,reasoning:!0===a.reasoning,...g?{thinkingLevelMap:g}:{},..."number"==typeof a.contextWindow&&Number.isFinite(a.contextWindow)?{contextWindow:a.contextWindow}:{},..."number"==typeof a.maxTokens&&Number.isFinite(a.maxTokens)?{maxTokens:a.maxTokens}:{}}}(b,a.id);d&&c.push(d)}return c}(h)}catch{return g=[]}finally{h=null}})())}},28967:(a,b,c)=>{"use strict";function d(){return globalThis.__piModelsCacheState||(globalThis.__piModelsCacheState={entries:new Map,inFlight:new Map,generation:0}),globalThis.__piModelsCacheState}function e(){let a=d();a.generation+=1,a.entries.clear(),a.inFlight.clear(),globalThis.__piModelRuntimeCache?.runtimes.clear()}function f(a,b){let c=d(),e=c.entries.get(a);if(e){if(e.expiresAt>Date.now())return Promise.resolve(e.data);c.entries.delete(a)}let f=c.inFlight.get(a);if(f)return f;let g=c.generation,h=Promise.resolve().then(b).then(b=>{if(c.generation===g&&c.inFlight.get(a)===h){let d=Date.now();for(let[a,b]of c.entries)b.expiresAt<=d&&c.entries.delete(a);for(;c.entries.size>=32;){let a=c.entries.keys().next().value;if(void 0===a)break;c.entries.delete(a)}c.entries.set(a,{data:b,expiresAt:d+6e4})}return b}).finally(()=>{c.inFlight.get(a)===h&&c.inFlight.delete(a)});return c.inFlight.set(a,h),h}c.d(b,{kn:()=>e,rC:()=>f})},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{"use strict";a.exports=require("crypto")},62228:a=>{"use strict";a.exports=require("node:os")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73127:a=>{"use strict";a.exports=require("node:url")},79748:a=>{"use strict";a.exports=require("fs/promises")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{"use strict";a.exports=require("node:path")},89477:a=>{"use strict";a.exports=require("node:fs")},92280:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(28208),e=c(47617),f=c(62018);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},98279:a=>{function b(a){return Promise.resolve().then(()=>{var b=Error("Cannot find module '"+a+"'");throw b.code="MODULE_NOT_FOUND",b})}b.keys=()=>[],b.resolve=b,b.id=98279,a.exports=b}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,981],()=>b(b.s=15770));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=552,a.ids=[552],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},15770:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>P,patchFetch:()=>O,routeModule:()=>K,serverHooks:()=>N,workAsyncStorage:()=>L,workUnitAsyncStorage:()=>M});var d={};c.r(d),c.d(d,{GET:()=>J,dynamic:()=>C});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(33873),w=c(60396),x=c(17924),y=c(28967),z=c(8106),A=c(21182),B=c(92395);let C="force-dynamic",D=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function E(a,b){return D.compare(a.name||a.id,b.name||b.id)||D.compare(a.provider,b.provider)||D.compare(a.id,b.id)}let F=new Set(["off","minimal","low","medium","high","xhigh","max"]);function G(a){let b=a.trim(),c=b.lastIndexOf(":");if(-1===c)return b;let d=b.substring(c+1);return F.has(d)?b.substring(0,c):b}async function H(a){let b=(0,w.Mc)(),c=(0,w.pA)(),d=(0,w.CZ)(),e=(0,B.wq)(c),f=Array.isArray(e.enabledModels)?e.enabledModels:void 0,g=(0,z.js)(b),h={};for(let a of(0,x.yN)(d))h[a]=(0,x.gb)(a,{authPath:d,modelsPath:b});for(let a of g)void 0===h[a.provider]&&(h[a.provider]=(0,x.gb)(a.provider,{authPath:d,modelsPath:b}));let i=await (0,A.v1)(),j=(0,z.kp)(g,i,h),k=(0,z.cJ)(j,{settingsPath:c,authConfigured:h}),l=function(a,b){if(!b||0===b.length)return a;let c=new Set(b.map(G).filter(Boolean)),d=a.filter(a=>c.has(`${a.provider}/${a.id}`)||c.has(a.id));return d.length>0?d:a}(k.modelList,f),m=new Set(l.map(a=>`${a.provider}:${a.id}`)),n={},o={},p={};for(let a of l){let b=`${a.provider}:${a.id}`;n[b]=k.models[b]??a.name,k.thinkingLevels[b]&&(o[b]=k.thinkingLevels[b]),k.thinkingLevelMaps[b]&&(p[b]=k.thinkingLevelMaps[b])}let q=k.defaultModel;return q&&!m.has(`${q.provider}:${q.modelId}`)&&(q=null),{models:n,modelList:[...l].sort(E),defaultModel:q,thinkingLevels:o,thinkingLevelMaps:p,authConfigured:k.authConfigured}}let I={models:{},modelList:[],defaultModel:null,thinkingLevels:{},thinkingLevelMaps:{},authConfigured:{}};async function J(a){let b=new URL(a.url).searchParams.get("cwd")||process.cwd(),c=(0,v.resolve)(b);try{return Response.json(await (0,y.rC)(c,()=>H(c)))}catch{return Response.json(I)}}let K=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/models/route",pathname:"/api/models",filename:"route",bundlePath:"app/api/models/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/models/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:L,workUnitAsyncStorage:M,serverHooks:N}=K;function O(){return(0,g.patchFetch)({workAsyncStorage:L,workUnitAsyncStorage:M})}async function P(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),K.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/models/route";"/index"===d&&(d="/");let e=await K.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:z,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,resolvedPathname:E,clientReferenceManifest:F,serverActionsManifest:G}=e,H=(0,k.normalizeAppPath)(d),I=!!(A.dynamicRoutes[H]||A.routes[E]),J=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(I&&!z){let a=!!A.routes[E],b=A.dynamicRoutes[H];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await J();throw new t.NoFallbackError}}let L=null;!I||K.isDev||z||(L="/index"===(L=E)?"/":L);let M=!0===K.isDev||!I,N=I&&!M;G&&F&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:F,serverActionsManifest:G});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==B?void 0:B.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await K.getIncrementalCache(a,x,A,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>K.onRequestError(a,b,d,e,B)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>K.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&C&&D&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!I)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await K.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),b}},k=await K.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!I)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",C?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),z&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&I||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await K.onRequestError(a,b,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),I)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},19225:(a,b,c)=>{"use strict";a.exports=c(44870)},21182:(a,b,c)=>{"use strict";c.d(b,{v1:()=>i});var d=c(89477),e=c(86697),f=c(73127);let g=null,h=null;async function i(){return g||h||(h=(async()=>{try{let a=function(a=process.cwd()){let b=a;for(let a=0;a<10;a++){for(let a of[(0,e.join)(b,"node_modules","@earendil-works","pi-coding-agent","node_modules","@earendil-works","pi-ai","dist","providers","all.js"),(0,e.join)(b,"node_modules","@earendil-works","pi-ai","dist","providers","all.js")])if((0,d.existsSync)(a))return a;let a=(0,e.dirname)(b);if(a===b)break;b=a}return null}();if(!a)return g=[];let b=(0,f.pathToFileURL)(a).href,h=null;try{h=await c(98279)(b)}catch{h=null}if(!h||"function"!=typeof h.builtinProviders&&"function"!=typeof h.getBuiltinProviders){let a=Function("u","return import(u)");h=await a(b)}return g=function(a){let b=("function"==typeof a.builtinProviders?a.builtinProviders():null)??("function"==typeof a.getBuiltinProviders?a.getBuiltinProviders():null)??[],c=[];for(let a of b)if(a&&"string"==typeof a.id&&a.id)for(let b of("function"==typeof a.getModels?a.getModels():[])??[]){let d=function(a,b){var c;let d="string"==typeof a.id?a.id:"";if(!d)return null;let e="string"==typeof a.name&&a.name?a.name:d,f="string"==typeof a.provider&&a.provider?a.provider:b,g="object"!=typeof(c=a.thinkingLevelMap)||null===c||Array.isArray(c)?void 0:a.thinkingLevelMap;return{id:d,name:e,provider:f,reasoning:!0===a.reasoning,...g?{thinkingLevelMap:g}:{},..."number"==typeof a.contextWindow&&Number.isFinite(a.contextWindow)?{contextWindow:a.contextWindow}:{},..."number"==typeof a.maxTokens&&Number.isFinite(a.maxTokens)?{maxTokens:a.maxTokens}:{}}}(b,a.id);d&&c.push(d)}return c}(h)}catch{return g=[]}finally{h=null}})())}},28967:(a,b,c)=>{"use strict";function d(){return globalThis.__piModelsCacheState||(globalThis.__piModelsCacheState={entries:new Map,inFlight:new Map,generation:0}),globalThis.__piModelsCacheState}function e(){let a=d();a.generation+=1,a.entries.clear(),a.inFlight.clear(),globalThis.__piModelRuntimeCache?.runtimes.clear()}function f(a,b){let c=d(),e=c.entries.get(a);if(e){if(e.expiresAt>Date.now())return Promise.resolve(e.data);c.entries.delete(a)}let f=c.inFlight.get(a);if(f)return f;let g=c.generation,h=Promise.resolve().then(b).then(b=>{if(c.generation===g&&c.inFlight.get(a)===h){let d=Date.now();for(let[a,b]of c.entries)b.expiresAt<=d&&c.entries.delete(a);for(;c.entries.size>=32;){let a=c.entries.keys().next().value;if(void 0===a)break;c.entries.delete(a)}c.entries.set(a,{data:b,expiresAt:d+6e4})}return b}).finally(()=>{c.inFlight.get(a)===h&&c.inFlight.delete(a)});return c.inFlight.set(a,h),h}c.d(b,{kn:()=>e,rC:()=>f})},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{"use strict";a.exports=require("crypto")},62228:a=>{"use strict";a.exports=require("node:os")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73127:a=>{"use strict";a.exports=require("node:url")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{"use strict";a.exports=require("node:path")},89477:a=>{"use strict";a.exports=require("node:fs")},92280:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(28208),e=c(47617),f=c(62018);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},98279:a=>{function b(a){return Promise.resolve().then(()=>{var b=Error("Cannot find module '"+a+"'");throw b.code="MODULE_NOT_FOUND",b})}b.keys=()=>[],b.resolve=b,b.id=98279,a.exports=b}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,981],()=>b(b.s=15770));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=9560,a.ids=[9560],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},60396:(a,b,c)=>{"use strict";c.d(b,{$M:()=>f,CZ:()=>h,Mc:()=>g,pA:()=>i});var d=c(62228),e=c(86697);function f(a=process.env){let b=a.PI_CODING_AGENT_DIR?.trim();if(b)return"~"===b?(0,d.homedir)():b.startsWith("~/")||b.startsWith("~\\")?(0,e.join)((0,d.homedir)(),b.slice(2)):b;return(0,e.join)((0,d.homedir)(),".pi","agent")}function g(a=process.env){return(0,e.join)(f(a),"models.json")}function h(a=process.env){return(0,e.join)(f(a),"auth.json")}function i(a=process.env){return(0,e.join)(f(a),"settings.json")}},62228:a=>{"use strict";a.exports=require("node:os")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{"use strict";a.exports=require("node:path")},88586:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>
|
|
1
|
+
(()=>{var a={};a.id=9560,a.ids=[9560],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},60396:(a,b,c)=>{"use strict";c.d(b,{$M:()=>f,CZ:()=>h,Mc:()=>g,pA:()=>i});var d=c(62228),e=c(86697);function f(a=process.env){let b=a.PI_CODING_AGENT_DIR?.trim();if(b)return"~"===b?(0,d.homedir)():b.startsWith("~/")||b.startsWith("~\\")?(0,e.join)((0,d.homedir)(),b.slice(2)):b;return(0,e.join)((0,d.homedir)(),".pi","agent")}function g(a=process.env){return(0,e.join)(f(a),"models.json")}function h(a=process.env){return(0,e.join)(f(a),"auth.json")}function i(a=process.env){return(0,e.join)(f(a),"settings.json")}},62228:a=>{"use strict";a.exports=require("node:os")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},68524:(a,b,c)=>{"use strict";c.d(b,{IB:()=>j,fu:()=>k,ql:()=>l,rV:()=>i,xP:()=>m});var d=c(89477),e=c(86697),f=c(60396);function g(a=(0,f.$M)()){return(0,e.join)(a,"pidance-preferences.json")}function h(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function i(a=(0,f.$M)()){let b=g(a);if(!(0,d.existsSync)(b))return{};try{let a=JSON.parse((0,d.readFileSync)(b,"utf8"));return h(a)?a:{}}catch{return{}}}function j(a,b=(0,f.$M)()){let c=g(b),h=(0,e.dirname)(c);(0,d.existsSync)(h)||(0,d.mkdirSync)(h,{recursive:!0,mode:448});let i=`${c}.${process.pid}.${Date.now()}.tmp`;try{(0,d.writeFileSync)(i,JSON.stringify(a,null,2),{flag:"wx",mode:384}),(0,d.renameSync)(i,c)}catch(a){try{(0,d.unlinkSync)(i)}catch{}throw a}}function k(a,b){let c={...a};for(let[a,d]of Object.entries(b))h(d)&&h(c[a])?c[a]={...c[a],...d}:c[a]=d;return c}function l(a,b){let c=b.split("."),d=a;for(let a of c){if("object"!=typeof d||null===d)return;d=d[a]}return d}function m(a,b,c=(0,f.$M)()){let d=i(c);!function(a,b,c){let d=b.split("."),e=a;for(let a=0;a<d.length-1;a++){let b=d[a],c=e[b];("object"!=typeof c||null===c||Array.isArray(c))&&(e[b]={}),e=e[b]}let f=d[d.length-1];null==c?delete e[f]:e[f]=c}(d,a,b),j(d,c)}},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{"use strict";a.exports=require("node:path")},88586:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>F,patchFetch:()=>E,routeModule:()=>A,serverHooks:()=>D,workAsyncStorage:()=>B,workUnitAsyncStorage:()=>C});var d={};c.r(d),c.d(d,{GET:()=>y,PUT:()=>z,dynamic:()=>x});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(23211),w=c(68524);let x="force-dynamic";async function y(){try{return v.NextResponse.json({prefs:(0,w.rV)()},{headers:{"Cache-Control":"no-store"}})}catch(a){return v.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}async function z(a){try{let b=(await a.json().catch(()=>({}))).prefs;if("object"!=typeof b||null===b||Array.isArray(b))return v.NextResponse.json({error:"prefs must be a JSON object"},{status:400});let c=JSON.stringify(b);if(Buffer.byteLength(c,"utf8")>1e6)return v.NextResponse.json({error:"preferences exceed 1000000 bytes"},{status:413});let d=(0,w.rV)();return(0,w.IB)((0,w.fu)(d,b)),v.NextResponse.json({ok:!0})}catch(a){return v.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}let A=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/preferences/route",pathname:"/api/preferences",filename:"route",bundlePath:"app/api/preferences/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/preferences/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:B,workUnitAsyncStorage:C,serverHooks:D}=A;function E(){return(0,g.patchFetch)({workAsyncStorage:B,workUnitAsyncStorage:C})}async function F(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),A.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/preferences/route";"/index"===d&&(d="/");let e=await A.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:z,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!z){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||A.isDev||z||(L="/index"===(L=F)?"/":L);let M=!0===A.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await A.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>A.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>A.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await A.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await A.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),z&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await A.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},89477:a=>{"use strict";a.exports=require("node:fs")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=88586));module.exports=c})();
|