@surething/cockpit 1.0.231 → 1.0.232
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-prod/BUILD_ID +1 -1
- package/.next-prod/app-path-routes-manifest.json +1 -1
- package/.next-prod/build-manifest.json +2 -2
- package/.next-prod/prerender-manifest.json +3 -3
- package/.next-prod/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/_global-error.html +1 -1
- package/.next-prod/server/app/_global-error.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/_not-found.html +2 -2
- package/.next-prod/server/app/_not-found.rsc +3 -3
- package/.next-prod/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/.next-prod/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/.next-prod/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next-prod/server/app/api/chat/deepseek/route.js +1 -1
- package/.next-prod/server/app/api/chat/route.js +1 -1
- package/.next-prod/server/app/api/project-state/route.js +2 -2
- package/.next-prod/server/app/api/scheduled-tasks/route.js +1 -1
- package/.next-prod/server/app/api/session/[sessionId]/history/route.js +1 -1
- package/.next-prod/server/app/api/session-by-path/route.js +1 -1
- package/.next-prod/server/app/m/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/project/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/review/[id]/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app-paths-manifest.json +1 -1
- package/.next-prod/server/chunks/4257.js +3 -3
- package/.next-prod/server/chunks/8916.js +1 -1
- package/.next-prod/server/chunks/9658.js +14 -4
- package/.next-prod/server/middleware-build-manifest.js +1 -1
- package/.next-prod/server/pages/404.html +2 -2
- package/.next-prod/server/pages/500.html +1 -1
- package/.next-prod/server/server-reference-manifest.json +1 -1
- package/.next-prod/static/chunks/217-4f8250a204080159.js +15 -0
- package/.next-prod/static/chunks/{2576-439565bf051dc1ba.js → 2576-6420f6bad0b8ffb3.js} +13 -13
- package/.next-prod/static/chunks/6784-8a99d051f03bb100.js +0 -0
- package/.next-prod/static/chunks/{9428-5c287b255a9831e6.js → 9428-ffc16bc24c6e0da1.js} +7 -7
- package/.next-prod/static/chunks/app/{layout-03c738d41e660f72.js → layout-ac2f1f67df01cc89.js} +1 -1
- package/.next-prod/static/chunks/app/page-1f0a6f49656a4c52.js +1 -0
- package/.next-prod/static/chunks/app/project/page-1f0a6f49656a4c52.js +1 -0
- package/.next-prod/static/css/2a854655f4108c3a.css +1 -0
- package/.next-prod/trace +13 -13
- package/.next-prod/trace-build +1 -1
- package/dist/scheduledTasks.mjs +46 -24
- package/package.json +1 -1
- package/.next-prod/static/chunks/217-a25b84ad39cf73ed.js +0 -5
- package/.next-prod/static/chunks/6784-b644510a0e060aac.js +0 -0
- package/.next-prod/static/chunks/app/page-677439ad5fd63732.js +0 -1
- package/.next-prod/static/chunks/app/project/page-677439ad5fd63732.js +0 -1
- package/.next-prod/static/css/ee516fc73c03aa88.css +0 -1
- /package/.next-prod/static/{eirTPmw6oXFp3wKgUVcXn → Z3Em1C_kM7x4RjcH7E7v2}/_buildManifest.js +0 -0
- /package/.next-prod/static/{eirTPmw6oXFp3wKgUVcXn → Z3Em1C_kM7x4RjcH7E7v2}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var a={};a.id=276,a.ids=[276],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{a.exports=require("url")},4573:a=>{a.exports=require("node:buffer")},4984:a=>{a.exports=require("readline")},9716:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>e.L});var e=c(21161),f=a([e]);e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},14566:a=>{a.exports=require("node-pty")},14985:a=>{a.exports=require("dns")},19771:a=>{a.exports=require("process")},19879:a=>{a.exports=import("@anthropic-ai/claude-agent-sdk")},21161:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{L:()=>j});var e=c(89705),f=c(72891),g=c(83633),h=c(30816),i=a([f,h]);[f,h]=i.then?(await i)():i;let j=(0,f.RL)(a=>e.JkU(function*(){let b=yield*(0,f.k9)(a),c=yield*e.ivC(()=>(0,g.T)(h.m,b,a));return c.ok?Response.json({runKey:c.runKey,sessionId:c.sessionId}):new Response(JSON.stringify({error:c.error}),{status:c.status,headers:{"Content-Type":"application/json"}})}));d()}catch(a){d(a)}})},21820:a=>{a.exports=require("os")},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")},30816:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{m:()=>k});var e=c(7939),f=c(79830),g=c(46122),h=c(90136),i=a([g]);g=(i.then?(await i)():i)[0];let j=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),k={name:"claude",runner:{async run(a){let{mode:b,engine:c}=a.params;"pty"!==b||c&&"claude"!==c&&"claude2"!==c?await (0,g.M)(a,function(a){let{engine:b,permissionMode:c}=a.params,d="plan"===c;return(c,f)=>({...f&&{resume:f},...a.cwd&&{cwd:a.cwd},settingSources:["user","project","local"],permissionMode:d?"plan":"bypassPermissions",...!d&&{allowDangerouslySkipPermissions:!0},...d&&{canUseTool:async(a,b,c)=>(function(a,b,c){if("ExitPlanMode"===a)return{behavior:"deny",message:"Plan presented to the user. There is no approval dialog to click in this environment — the user approves by turning off Plan mode (via the plan card button) and resending, which then executes. Do not ask the user to confirm in a popup; stop here.",interrupt:!0};if(j.has(a)){let d=[b.file_path,b.notebook_path,b.path,c?.blockedPath].find(a=>"string"==typeof a);return d&&/(^|\/)\.claude\/plans\//.test(d)?{behavior:"allow",updatedInput:b}:{behavior:"deny",message:`Plan mode is read-only and this environment has no approval dialog, so "${a}"${d?` on ${d}`:""} can't run. Only writes under .claude/plans/ are allowed. Capture the intended changes in your plan instead of editing files now.`}}return{behavior:"allow",updatedInput:b}})(a,b,c)},includePartialMessages:!0,abortController:c,..."claude2"===b&&{env:{...process.env,CLAUDE_CONFIG_DIR:e.h9}}})}(a)):await (0,h.u)(a)},resolveTitle:(a,b)=>(0,f.Pn)(a,b)}};d()}catch(a){d(a)}})},33873:a=>{a.exports=require("path")},34631:a=>{a.exports=require("tls")},41204:a=>{a.exports=require("string_decoder")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46122:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{M:()=>h});var e=c(19879),f=a([e]);function g(a){let b=new AbortController;return a.signal.aborted?b.abort():a.signal.addEventListener("abort",()=>b.abort(),{once:!0}),b}async function h(a,b){let c,d=!!(a.images&&a.images.length>0),f=[];if(a.images)for(let b of a.images)f.push({type:"image",source:{type:"base64",media_type:b.media_type,data:b.data}});a.prompt&&f.push({type:"text",text:a.prompt});let h=g(a),i=b(h,a.sessionId);if(d){let b=async function*(){yield{type:"user",message:{role:"user",content:f},parent_tool_use_id:null,session_id:a.sessionId||`session-${a.currentKey()}`}}();c=(0,e.query)({prompt:b,options:i})}else c=(0,e.query)({prompt:a.prompt,options:i});let j=c;for(let c=0;c<=1;c++){let c=!1;for await(let b of j){if(a.signal.aborted)break;"system"===b.type&&"init"===b.subtype&&b.session_id&&a.rekey(b.session_id),"result"===b.type&&(c=!0),a.emit(b)}if(c||a.signal.aborted)break;let d=g(a),f=a.currentKey();j=(0,e.query)({prompt:"continue",options:{...b(d,f),resume:f}})}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},51181:a=>{a.exports=require("web-push")},53053:a=>{a.exports=require("node:diagnostics_channel")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},66136:a=>{a.exports=require("timers")},74075:a=>{a.exports=require("zlib")},79428:a=>{a.exports=require("buffer")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},83997:a=>{a.exports=require("tty")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86984:(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(9716),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/chat/route",pathname:"/api/chat",filename:"route",bundlePath:"app/api/chat/route"},distDir:".next-prod",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/cockpit/cockpit/src/app/api/chat/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/chat/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)}})},90136:(a,b,c)=>{c.d(b,{u:()=>e});var d=c(3863);async function e(a){let b=a.currentKey(),c=!!a.sessionId,e=a.prompt??"";a.emit({type:"system",subtype:"init",session_id:b}),a.rekey(b);let f=await (0,d.FP)({cwd:a.cwd||process.cwd(),prompt:e,sessionId:b,resume:c,...a.images&&a.images.length>0&&{images:a.images.map(a=>({media_type:a.media_type,data:a.data}))},...a.params.ptyCols&&{cols:a.params.ptyCols},...a.params.ptyRows&&{rows:a.params.ptyRows},signal:a.signal,onJsonlLine:c=>{for(let d of function(a,b){let c=[],d=a.message?.content;if("assistant"===a.type&&Array.isArray(d)){let a=d.filter(a=>"text"===a.type&&a.text).map(a=>a.text).join("");a&&c.push({type:"stream_event",session_id:b,event:{type:"content_block_delta",delta:{type:"text_delta",text:a}}});let e=d.filter(a=>"tool_use"===a.type);return e.length>0&&c.push({type:"assistant",session_id:b,message:{role:"assistant",content:e}}),c}if("user"===a.type&&Array.isArray(d)){let a=d.filter(a=>"tool_result"===a.type&&a.tool_use_id);a.length>0&&c.push({type:"user",session_id:b,message:{role:"user",content:a}})}return c}(c,b))a.emit(d)},onPtyData:b=>a.emit({type:"pty_output",data:b}),onStuck:()=>a.emit({type:"pty_notice",level:"warning",messageKey:"chat.ptyStuck"}),onQuestionEsc:()=>a.emit({type:"pty_notice",level:"warning",messageKey:"chat.ptyQuestionEsc"})});f.crashed&&a.emit({type:"pty_notice",level:"error",terminal:!0,messageKey:"chat.ptyCrash",params:{error:f.crashError}}),f.timedOut&&a.emit({type:"pty_notice",level:"warning",terminal:!0,messageKey:"chat.ptyTimedOut"}),a.emit({type:"result",subtype:"success",session_id:b,usage:void 0})}},91645:a=>{a.exports=require("net")},94735:a=>{a.exports=require("events")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,7184,304,7003,9830,3633,3863],()=>b(b.s=86984));module.exports=c})();
|
|
1
|
+
"use strict";(()=>{var a={};a.id=276,a.ids=[276],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{a.exports=require("url")},4573:a=>{a.exports=require("node:buffer")},4984:a=>{a.exports=require("readline")},9716:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>e.L});var e=c(21161),f=a([e]);e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},14566:a=>{a.exports=require("node-pty")},14985:a=>{a.exports=require("dns")},19771:a=>{a.exports=require("process")},19879:a=>{a.exports=import("@anthropic-ai/claude-agent-sdk")},21161:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{L:()=>j});var e=c(89705),f=c(72891),g=c(83633),h=c(30816),i=a([f,h]);[f,h]=i.then?(await i)():i;let j=(0,f.RL)(a=>e.JkU(function*(){let b=yield*(0,f.k9)(a),c=yield*e.ivC(()=>(0,g.T)(h.m,b,a));return c.ok?Response.json({runKey:c.runKey,sessionId:c.sessionId}):new Response(JSON.stringify({error:c.error}),{status:c.status,headers:{"Content-Type":"application/json"}})}));d()}catch(a){d(a)}})},21820:a=>{a.exports=require("os")},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")},30816:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{m:()=>k});var e=c(7939),f=c(79830),g=c(46122),h=c(90136),i=a([g]);g=(i.then?(await i)():i)[0];let j=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),k={name:"claude",runner:{async run(a){let{mode:b,engine:c}=a.params;"pty"!==b||c&&"claude"!==c&&"claude2"!==c?await (0,g.M)(a,function(a){let{engine:b,permissionMode:c}=a.params,d="plan"===c;return(c,f)=>({...f&&{resume:f},...a.cwd&&{cwd:a.cwd},settingSources:["user","project","local"],permissionMode:d?"plan":"bypassPermissions",...!d&&{allowDangerouslySkipPermissions:!0},...d&&{canUseTool:async(a,b,c)=>(function(a,b,c){if("ExitPlanMode"===a)return{behavior:"deny",message:"Plan presented to the user. There is no approval dialog to click in this environment — the user approves by turning off Plan mode (via the plan card button) and resending, which then executes. Do not ask the user to confirm in a popup; stop here.",interrupt:!0};if(j.has(a)){let d=[b.file_path,b.notebook_path,b.path,c?.blockedPath].find(a=>"string"==typeof a);return d&&/(^|\/)\.claude\/plans\//.test(d)?{behavior:"allow",updatedInput:b}:{behavior:"deny",message:`Plan mode is read-only and this environment has no approval dialog, so "${a}"${d?` on ${d}`:""} can't run. Only writes under .claude/plans/ are allowed. Capture the intended changes in your plan instead of editing files now.`}}return{behavior:"allow",updatedInput:b}})(a,b,c)},includePartialMessages:!0,abortController:c,..."claude2"===b&&{env:{...process.env,CLAUDE_CONFIG_DIR:e.h9}}})}(a)):await (0,h.u)(a)},resolveTitle:(a,b)=>(0,f.Pn)(a,b)}};d()}catch(a){d(a)}})},33873:a=>{a.exports=require("path")},34631:a=>{a.exports=require("tls")},41204:a=>{a.exports=require("string_decoder")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46122:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{M:()=>g});var e=c(19879),f=a([e]);async function g(a,b){let c=!!(a.images&&a.images.length>0),d=[];if(a.images)for(let b of a.images)d.push({type:"image",source:{type:"base64",media_type:b.media_type,data:b.data}});a.prompt&&d.push({type:"text",text:a.prompt});let f=c?d:a.prompt??"",g=new Set,h=()=>{};a.signal.aborted||a.signal.addEventListener("abort",()=>h(),{once:!0});for(let c=0;c<=1;c++){let d=!1,i=new Promise(a=>{h=()=>{d||(d=!0,a())}});a.signal.aborted&&h();let j=c>0,k={type:"user",message:{role:"user",content:j?"continue":f},parent_tool_use_id:null,session_id:a.sessionId||`session-${a.currentKey()}`},l=async function*(){yield k,await i}(),m=function(a){let b=new AbortController;return a.signal.aborted?b.abort():a.signal.addEventListener("abort",()=>b.abort(),{once:!0}),b}(a),n=j?a.currentKey():a.sessionId,o=j?{...b(m,n),resume:n}:b(m,a.sessionId),p=(0,e.query)({prompt:l,options:o}),q=!1;for await(let b of p){if(a.signal.aborted){h();break}"system"===b.type&&"init"===b.subtype&&b.session_id&&a.rekey(b.session_id),"system"===b.type&&"task_started"===b.subtype&&b.task_id&&g.add(b.task_id),"system"===b.type&&"task_notification"===b.subtype&&b.task_id&&g.delete(b.task_id),"result"===b.type&&(q=!0),a.emit(b),"result"===b.type&&0===g.size&&h()}if(h(),q||a.signal.aborted)break}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},51181:a=>{a.exports=require("web-push")},53053:a=>{a.exports=require("node:diagnostics_channel")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},66136:a=>{a.exports=require("timers")},74075:a=>{a.exports=require("zlib")},79428:a=>{a.exports=require("buffer")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},83997:a=>{a.exports=require("tty")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86984:(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(9716),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/chat/route",pathname:"/api/chat",filename:"route",bundlePath:"app/api/chat/route"},distDir:".next-prod",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/cockpit/cockpit/src/app/api/chat/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/chat/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)}})},90136:(a,b,c)=>{c.d(b,{u:()=>e});var d=c(3863);async function e(a){let b=a.currentKey(),c=!!a.sessionId,e=a.prompt??"";a.emit({type:"system",subtype:"init",session_id:b}),a.rekey(b);let f=await (0,d.FP)({cwd:a.cwd||process.cwd(),prompt:e,sessionId:b,resume:c,...a.images&&a.images.length>0&&{images:a.images.map(a=>({media_type:a.media_type,data:a.data}))},...a.params.ptyCols&&{cols:a.params.ptyCols},...a.params.ptyRows&&{rows:a.params.ptyRows},signal:a.signal,onJsonlLine:c=>{for(let d of function(a,b){let c=[],d=a.message?.content;if("assistant"===a.type&&Array.isArray(d)){let a=d.filter(a=>"text"===a.type&&a.text).map(a=>a.text).join("");a&&c.push({type:"stream_event",session_id:b,event:{type:"content_block_delta",delta:{type:"text_delta",text:a}}});let e=d.filter(a=>"tool_use"===a.type);return e.length>0&&c.push({type:"assistant",session_id:b,message:{role:"assistant",content:e}}),c}if("user"===a.type&&Array.isArray(d)){let a=d.filter(a=>"tool_result"===a.type&&a.tool_use_id);a.length>0&&c.push({type:"user",session_id:b,message:{role:"user",content:a}})}return c}(c,b))a.emit(d)},onPtyData:b=>a.emit({type:"pty_output",data:b}),onStuck:()=>a.emit({type:"pty_notice",level:"warning",messageKey:"chat.ptyStuck"}),onQuestionEsc:()=>a.emit({type:"pty_notice",level:"warning",messageKey:"chat.ptyQuestionEsc"})});f.crashed&&a.emit({type:"pty_notice",level:"error",terminal:!0,messageKey:"chat.ptyCrash",params:{error:f.crashError}}),f.timedOut&&a.emit({type:"pty_notice",level:"warning",terminal:!0,messageKey:"chat.ptyTimedOut"}),a.emit({type:"result",subtype:"success",session_id:b,usage:void 0})}},91645:a=>{a.exports=require("net")},94735:a=>{a.exports=require("events")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,7184,304,7003,9830,3633,3863],()=>b(b.s=86984));module.exports=c})();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(()=>{var a={};a.id=2865,a.ids=[2865],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},4573:a=>{"use strict";a.exports=require("node:buffer")},6361:(a,b,c)=>{"use strict";let{EMPTY_BUFFER:d}=c(17165),e=Buffer[Symbol.species];function f(a,b,c,d,e){for(let f=0;f<e;f++)c[d+f]=a[f]^b[3&f]}function g(a,b){for(let c=0;c<a.length;c++)a[c]^=b[3&c]}function h(a){let b;return(h.readOnly=!0,Buffer.isBuffer(a))?a:(a instanceof ArrayBuffer?b=new e(a):ArrayBuffer.isView(a)?b=new e(a.buffer,a.byteOffset,a.byteLength):(b=Buffer.from(a),h.readOnly=!1),b)}if(a.exports={concat:function(a,b){if(0===a.length)return d;if(1===a.length)return a[0];let c=Buffer.allocUnsafe(b),f=0;for(let b=0;b<a.length;b++){let d=a[b];c.set(d,f),f+=d.length}return f<b?new e(c.buffer,c.byteOffset,f):c},mask:f,toArrayBuffer:function(a){return a.length===a.buffer.byteLength?a.buffer:a.buffer.slice(a.byteOffset,a.byteOffset+a.length)},toBuffer:h,unmask:g},!process.env.WS_NO_BUFFER_UTIL)try{let b=c(39727);a.exports.mask=function(a,c,d,e,g){g<48?f(a,c,d,e,g):b.mask(a,c,d,e,g)},a.exports.unmask=function(a,c){a.length<32?g(a,c):b.unmask(a,c)}}catch(a){}},7939:(a,b,c)=>{"use strict";c.d(b,{$A:()=>M,A0:()=>X,An:()=>$,BF:()=>I,Ct:()=>Q,Eu:()=>H,Ex:()=>u,GB:()=>r,JE:()=>Z,JY:()=>L,Ki:()=>C,Kk:()=>R,Kv:()=>j,LN:()=>k,Mx:()=>D,N9:()=>ac,O0:()=>B,Sr:()=>J,Tb:()=>s,Ux:()=>ab,Wd:()=>Y,aO:()=>m,at:()=>y,ec:()=>o,eg:()=>V,h9:()=>x,i4:()=>G,iK:()=>p,im:()=>T,iy:()=>P,jp:()=>t,lT:()=>z,lq:()=>F,ls:()=>K,mT:()=>w,n6:()=>n,oK:()=>O,oZ:()=>S,of:()=>E,po:()=>N,tP:()=>q,th:()=>v,v4:()=>l,vI:()=>W,yw:()=>U});var d=c(21820),e=c(33873),f=c(79748),g=c(29021),h=c(79646);let i=(0,d.homedir)(),j=process.env.COCKPIT_HOME?(0,e.resolve)(process.env.COCKPIT_HOME.replace(/^~(?=$|\/)/,i)):(0,e.join)(i,".cockpit"),k=(0,e.join)(j,"projects"),l=(0,e.join)(j,"state.json"),m=(0,e.join)(j,"pinned-sessions.json"),n=(0,e.join)(j,"push-subscriptions.json"),o=(0,e.join)(j,"note.md"),p=(0,e.join)(j,"scheduled-tasks.json"),q=(0,e.join)(j,"settings.json"),r=(0,e.join)(j,"skills.json"),s=(0,e.join)(j,"review"),t=(0,e.join)(s,"_signal");function u(){try{(0,g.existsSync)(s)||(0,g.mkdirSync)(s,{recursive:!0}),(0,g.writeFileSync)(t,Date.now().toString())}catch{}}let v=(0,e.join)(i,".claude"),w=(0,e.join)(v,"projects"),x=(0,e.join)(i,".claude2"),y=(0,e.join)(x,"projects"),z=(0,e.join)(j,"deepseek"),A=(0,e.join)(z,"projects");function B(a){return a.replace(/[/.]/g,"-")}function C(a){return(0,e.join)(k,B(a))}function D(a){return(0,e.join)(C(a),"session.json")}function E(a){return(0,e.join)(C(a),"recent-files.json")}function F(a){return(0,e.join)(C(a),"expanded-paths.json")}function G(a){return(0,e.join)(C(a),"comments.json")}function H(a){return(0,e.join)(C(a),"services.json")}function I(a){return(0,e.join)(C(a),"note.md")}function J(a,b){return(0,e.join)(C(a),`terminal-history-${b}.jsonl`)}function K(a,b){return(0,e.join)(C(a),`terminal-output-${b}.txt`)}function L(a,b){let c=b?`terminal-env-${b}.json`:"terminal-env-global.json";return(0,e.join)(C(a),c)}function M(){return(0,e.join)(j,"terminal-aliases.json")}function N(){return(0,e.join)(j,"services.json")}function O(a){return(0,e.join)(C(a),"project-settings.json")}function P(a,b){return(0,e.join)(C(a),`terminal-bubble-order-${b}.json`)}function Q(a){return(0,e.join)(s,`${a}.json`)}function R(a,b){return(0,e.join)((0,e.join)(w,B(a)),`${b}.jsonl`)}function S(a,b){return(0,e.join)((0,e.join)(y,B(a)),`${b}.jsonl`)}function T(a,b){return(0,e.join)((0,e.join)(A,B(a)),`${b}.jsonl`)}function U(a,b){return(0,e.join)((0,e.join)(j,"ollama-sessions",B(a)),`${b}.jsonl`)}function V(a){let b=(0,e.join)(i,".codex","sessions");if(!(0,g.existsSync)(b))return null;try{let c=(0,h.execSync)(`find ${JSON.stringify(b)} -name "*${a}.jsonl" -type f 2>/dev/null`,{encoding:"utf8",timeout:3e3}).trim();if(c)return c.split("\n")[0]}catch{}return null}function W(a){let b=(0,e.join)(i,".kimi","sessions");if(!(0,g.existsSync)(b))return null;try{for(let c of(0,g.readdirSync)(b)){let d=(0,e.join)(b,c,a,"context.jsonl");if((0,g.existsSync)(d))return d}}catch{}return null}async function X(a){(0,g.existsSync)(a)||await (0,f.mkdir)(a,{recursive:!0})}async function Y(a){let b=(0,e.join)(a,"..");await X(b)}async function Z(a,b){try{let b=await (0,f.readFile)(a,"utf-8");return JSON.parse(b)}catch{return b}}async function $(a,b){await Y(a),await (0,f.writeFile)(a,JSON.stringify(b,null,2),"utf-8")}let _=globalThis,aa=_.__cockpitFileLocks??(_.__cockpitFileLocks=new Map);function ab(a,b){let c=(aa.get(a)??Promise.resolve()).then(b),d=c.then(()=>{},()=>{});return aa.set(a,d),d.then(()=>{aa.get(a)===d&&aa.delete(a)}),c}function ac(a,b,c){return ab(a,async()=>{let d=await Z(a,b),e=await c(d);return await $(a,e),e})}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{"use strict";a.exports=require("assert")},13259:(a,b,c)=>{"use strict";let{Writable:d}=c(27910),e=c(88634),{BINARY_TYPES:f,EMPTY_BUFFER:g,kStatusCode:h,kWebSocket:i}=c(17165),{concat:j,toArrayBuffer:k,unmask:l}=c(6361),{isValidStatusCode:m,isValidUTF8:n}=c(97861),o=Buffer[Symbol.species];class p extends d{constructor(a={}){super(),this._allowSynchronousEvents=void 0===a.allowSynchronousEvents||a.allowSynchronousEvents,this._binaryType=a.binaryType||f[0],this._extensions=a.extensions||{},this._isServer=!!a.isServer,this._maxPayload=0|a.maxPayload,this._skipUTF8Validation=!!a.skipUTF8Validation,this[i]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(a,b,c){if(8===this._opcode&&0==this._state)return c();this._bufferedBytes+=a.length,this._buffers.push(a),this.startLoop(c)}consume(a){if(this._bufferedBytes-=a,a===this._buffers[0].length)return this._buffers.shift();if(a<this._buffers[0].length){let b=this._buffers[0];return this._buffers[0]=new o(b.buffer,b.byteOffset+a,b.length-a),new o(b.buffer,b.byteOffset,a)}let b=Buffer.allocUnsafe(a);do{let c=this._buffers[0],d=b.length-a;a>=c.length?b.set(this._buffers.shift(),d):(b.set(new Uint8Array(c.buffer,c.byteOffset,a),d),this._buffers[0]=new o(c.buffer,c.byteOffset+a,c.length-a)),a-=c.length}while(a>0);return b}startLoop(a){this._loop=!0;do switch(this._state){case 0:this.getInfo(a);break;case 1:this.getPayloadLength16(a);break;case 2:this.getPayloadLength64(a);break;case 3:this.getMask();break;case 4:this.getData(a);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||a()}getInfo(a){if(this._bufferedBytes<2){this._loop=!1;return}let b=this.consume(2);if((48&b[0])!=0)return void a(this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3"));let c=(64&b[0])==64;if(c&&!this._extensions[e.extensionName])return void a(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._fin=(128&b[0])==128,this._opcode=15&b[0],this._payloadLength=127&b[1],0===this._opcode){if(c)return void a(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(!this._fragmented)return void a(this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE"));this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return void a(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));this._compressed=c}else{if(!(this._opcode>7)||!(this._opcode<11))return void a(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));if(!this._fin)return void a(this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN"));if(c)return void a(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._payloadLength>125||8===this._opcode&&1===this._payloadLength)return void a(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"))}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=(128&b[1])==128,this._isServer){if(!this._masked)return void a(this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK"))}else if(this._masked)return void a(this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK"));126===this._payloadLength?this._state=1:127===this._payloadLength?this._state=2:this.haveLength(a)}getPayloadLength16(a){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(a)}getPayloadLength64(a){if(this._bufferedBytes<8){this._loop=!1;return}let b=this.consume(8),c=b.readUInt32BE(0);c>2097151?a(this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=0x100000000*c+b.readUInt32BE(4),this.haveLength(a))}haveLength(a){this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)?a(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH")):this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(a){let b=g;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}b=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!=0&&l(b,this._mask)}if(this._opcode>7)return void this.controlMessage(b,a);if(this._compressed){this._state=5,this.decompress(b,a);return}b.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(b)),this.dataMessage(a)}decompress(a,b){this._extensions[e.extensionName].decompress(a,this._fin,(a,c)=>{if(a)return b(a);if(c.length){if(this._messageLength+=c.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return void b(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(c)}this.dataMessage(b),0===this._state&&this.startLoop(b)})}dataMessage(a){if(!this._fin){this._state=0;return}let b=this._messageLength,c=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let d;d="nodebuffer"===this._binaryType?j(c,b):"arraybuffer"===this._binaryType?k(j(c,b)):"blob"===this._binaryType?new Blob(c):c,this._allowSynchronousEvents?(this.emit("message",d,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",d,!0),this._state=0,this.startLoop(a)}))}else{let d=j(c,b);if(!this._skipUTF8Validation&&!n(d))return void a(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));5===this._state||this._allowSynchronousEvents?(this.emit("message",d,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",d,!1),this._state=0,this.startLoop(a)}))}}controlMessage(a,b){if(8===this._opcode){if(0===a.length)this._loop=!1,this.emit("conclude",1005,g),this.end();else{let c=a.readUInt16BE(0);if(!m(c))return void b(this.createError(RangeError,`invalid status code ${c}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE"));let d=new o(a.buffer,a.byteOffset+2,a.length-2);if(!this._skipUTF8Validation&&!n(d))return void b(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));this._loop=!1,this.emit("conclude",c,d),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(9===this._opcode?"ping":"pong",a),this._state=0):(this._state=6,setImmediate(()=>{this.emit(9===this._opcode?"ping":"pong",a),this._state=0,this.startLoop(b)}))}createError(a,b,c,d,e){this._loop=!1,this._errored=!0;let f=new a(c?`Invalid WebSocket frame: ${b}`:b);return Error.captureStackTrace(f,this.createError),f.code=e,f[h]=d,f}}a.exports=p},14985:a=>{"use strict";a.exports=require("dns")},17165:a=>{"use strict";let b=["nodebuffer","arraybuffer","fragments"],c="u">typeof Blob;c&&b.push("blob"),a.exports={BINARY_TYPES:b,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:c,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},19771:a=>{"use strict";a.exports=require("process")},19879:a=>{"use strict";a.exports=import("@anthropic-ai/claude-agent-sdk")},21820:a=>{"use strict";a.exports=require("os")},24509:(a,b,c)=>{"use strict";let{tokenChars:d}=c(97861);function e(a,b,c){void 0===a[b]?a[b]=[c]:a[b].push(c)}a.exports={format:function(a){return Object.keys(a).map(b=>{let c=a[b];return Array.isArray(c)||(c=[c]),c.map(a=>[b].concat(Object.keys(a).map(b=>{let c=a[b];return Array.isArray(c)||(c=[c]),c.map(a=>!0===a?b:`${b}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")},parse:function(a){let b,c,f=Object.create(null),g=Object.create(null),h=!1,i=!1,j=!1,k=-1,l=-1,m=-1,n=0;for(;n<a.length;n++)if(l=a.charCodeAt(n),void 0===b)if(-1===m&&1===d[l])-1===k&&(k=n);else if(0!==n&&(32===l||9===l))-1===m&&-1!==k&&(m=n);else if(59===l||44===l){if(-1===k)throw SyntaxError(`Unexpected character at index ${n}`);-1===m&&(m=n);let c=a.slice(k,m);44===l?(e(f,c,g),g=Object.create(null)):b=c,k=m=-1}else throw SyntaxError(`Unexpected character at index ${n}`);else if(void 0===c)if(-1===m&&1===d[l])-1===k&&(k=n);else if(32===l||9===l)-1===m&&-1!==k&&(m=n);else if(59===l||44===l){if(-1===k)throw SyntaxError(`Unexpected character at index ${n}`);-1===m&&(m=n),e(g,a.slice(k,m),!0),44===l&&(e(f,b,g),g=Object.create(null),b=void 0),k=m=-1}else if(61===l&&-1!==k&&-1===m)c=a.slice(k,n),k=m=-1;else throw SyntaxError(`Unexpected character at index ${n}`);else if(i){if(1!==d[l])throw SyntaxError(`Unexpected character at index ${n}`);-1===k?k=n:h||(h=!0),i=!1}else if(j)if(1===d[l])-1===k&&(k=n);else if(34===l&&-1!==k)j=!1,m=n;else if(92===l)i=!0;else throw SyntaxError(`Unexpected character at index ${n}`);else if(34===l&&61===a.charCodeAt(n-1))j=!0;else if(-1===m&&1===d[l])-1===k&&(k=n);else if(-1!==k&&(32===l||9===l))-1===m&&(m=n);else if(59===l||44===l){if(-1===k)throw SyntaxError(`Unexpected character at index ${n}`);-1===m&&(m=n);let d=a.slice(k,m);h&&(d=d.replace(/\\/g,""),h=!1),e(g,c,d),44===l&&(e(f,b,g),g=Object.create(null),b=void 0),c=void 0,k=m=-1}else throw SyntaxError(`Unexpected character at index ${n}`);if(-1===k||j||32===l||9===l)throw SyntaxError("Unexpected end of input");-1===m&&(m=n);let o=a.slice(k,m);return void 0===b?e(f,o,g):(void 0===c?e(g,o,!0):h?e(g,c,o.replace(/\\/g,"")):e(g,c,o),e(f,b,g)),f}}},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},34631:a=>{"use strict";a.exports=require("tls")},38573:(a,b,c)=>{"use strict";c.d(b,{d:()=>g}),c(82146),c(24509),c(88634),c(13259),c(53455),c(72786);var d=c(80123);c(54351);let e=globalThis,f=e.__cockpitGlobalStateClients??(e.__cockpitGlobalStateClients=new Set);function g(a){let b=JSON.stringify(a);for(let a of f)a.readyState===d.OPEN&&a.send(b)}},39727:()=>{},41204:a=>{"use strict";a.exports=require("string_decoder")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},47990:()=>{},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},53455:(a,b,c)=>{"use strict";let d,{Duplex:e}=c(27910),{randomFillSync:f}=c(55511),{types:{isUint8Array:g}}=c(28354),h=c(88634),{EMPTY_BUFFER:i,kWebSocket:j,NOOP:k}=c(17165),{isBlob:l,isValidStatusCode:m}=c(97861),{mask:n,toBuffer:o}=c(6361),p=Symbol("kByteLength"),q=Buffer.alloc(4),r=8192;class s{constructor(a,b,c){this._extensions=b||{},c&&(this._generateMask=c,this._maskBuffer=Buffer.alloc(4)),this._socket=a,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=k,this[j]=void 0}static frame(a,b){let c,e,g=!1,h=2,i=!1;b.mask&&(c=b.maskBuffer||q,b.generateMask?b.generateMask(c):(8192===r&&(void 0===d&&(d=Buffer.alloc(8192)),f(d,0,8192),r=0),c[0]=d[r++],c[1]=d[r++],c[2]=d[r++],c[3]=d[r++]),i=(c[0]|c[1]|c[2]|c[3])==0,h=6),"string"==typeof a?e=(!b.mask||i)&&void 0!==b[p]?b[p]:(a=Buffer.from(a)).length:(e=a.length,g=b.mask&&b.readOnly&&!i);let j=e;e>=65536?(h+=8,j=127):e>125&&(h+=2,j=126);let k=Buffer.allocUnsafe(g?e+h:h);return(k[0]=b.fin?128|b.opcode:b.opcode,b.rsv1&&(k[0]|=64),k[1]=j,126===j?k.writeUInt16BE(e,2):127===j&&(k[2]=k[3]=0,k.writeUIntBE(e,4,6)),b.mask)?(k[1]|=128,k[h-4]=c[0],k[h-3]=c[1],k[h-2]=c[2],k[h-1]=c[3],i)?[k,a]:g?(n(a,c,k,h,e),[k]):(n(a,c,a,0,e),[k,a]):[k,a]}close(a,b,c,d){let e;if(void 0===a)e=i;else if("number"==typeof a&&m(a))if(void 0!==b&&b.length){let c=Buffer.byteLength(b);if(c>123)throw RangeError("The message must not be greater than 123 bytes");if((e=Buffer.allocUnsafe(2+c)).writeUInt16BE(a,0),"string"==typeof b)e.write(b,2);else if(g(b))e.set(b,2);else throw TypeError("Second argument must be a string or a Uint8Array")}else(e=Buffer.allocUnsafe(2)).writeUInt16BE(a,0);else throw TypeError("First argument must be a valid error code number");let f={[p]:e.length,fin:!0,generateMask:this._generateMask,mask:c,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};0!==this._state?this.enqueue([this.dispatch,e,!1,f,d]):this.sendFrame(s.frame(e,f),d)}ping(a,b,c){let d,e;if("string"==typeof a?(d=Buffer.byteLength(a),e=!1):l(a)?(d=a.size,e=!1):(d=(a=o(a)).length,e=o.readOnly),d>125)throw RangeError("The data size must not be greater than 125 bytes");let f={[p]:d,fin:!0,generateMask:this._generateMask,mask:b,maskBuffer:this._maskBuffer,opcode:9,readOnly:e,rsv1:!1};l(a)?0!==this._state?this.enqueue([this.getBlobData,a,!1,f,c]):this.getBlobData(a,!1,f,c):0!==this._state?this.enqueue([this.dispatch,a,!1,f,c]):this.sendFrame(s.frame(a,f),c)}pong(a,b,c){let d,e;if("string"==typeof a?(d=Buffer.byteLength(a),e=!1):l(a)?(d=a.size,e=!1):(d=(a=o(a)).length,e=o.readOnly),d>125)throw RangeError("The data size must not be greater than 125 bytes");let f={[p]:d,fin:!0,generateMask:this._generateMask,mask:b,maskBuffer:this._maskBuffer,opcode:10,readOnly:e,rsv1:!1};l(a)?0!==this._state?this.enqueue([this.getBlobData,a,!1,f,c]):this.getBlobData(a,!1,f,c):0!==this._state?this.enqueue([this.dispatch,a,!1,f,c]):this.sendFrame(s.frame(a,f),c)}send(a,b,c){let d,e,f=this._extensions[h.extensionName],g=b.binary?2:1,i=b.compress;"string"==typeof a?(d=Buffer.byteLength(a),e=!1):l(a)?(d=a.size,e=!1):(d=(a=o(a)).length,e=o.readOnly),this._firstFragment?(this._firstFragment=!1,i&&f&&f.params[f._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(i=d>=f._threshold),this._compress=i):(i=!1,g=0),b.fin&&(this._firstFragment=!0);let j={[p]:d,fin:b.fin,generateMask:this._generateMask,mask:b.mask,maskBuffer:this._maskBuffer,opcode:g,readOnly:e,rsv1:i};l(a)?0!==this._state?this.enqueue([this.getBlobData,a,this._compress,j,c]):this.getBlobData(a,this._compress,j,c):0!==this._state?this.enqueue([this.dispatch,a,this._compress,j,c]):this.dispatch(a,this._compress,j,c)}getBlobData(a,b,c,d){this._bufferedBytes+=c[p],this._state=2,a.arrayBuffer().then(a=>{if(this._socket.destroyed){let a=Error("The socket was closed while the blob was being read");process.nextTick(t,this,a,d);return}this._bufferedBytes-=c[p];let e=o(a);b?this.dispatch(e,b,c,d):(this._state=0,this.sendFrame(s.frame(e,c),d),this.dequeue())}).catch(a=>{process.nextTick(u,this,a,d)})}dispatch(a,b,c,d){if(!b)return void this.sendFrame(s.frame(a,c),d);let e=this._extensions[h.extensionName];this._bufferedBytes+=c[p],this._state=1,e.compress(a,c.fin,(a,b)=>{this._socket.destroyed?t(this,Error("The socket was closed while data was being compressed"),d):(this._bufferedBytes-=c[p],this._state=0,c.readOnly=!1,this.sendFrame(s.frame(b,c),d),this.dequeue())})}dequeue(){for(;0===this._state&&this._queue.length;){let a=this._queue.shift();this._bufferedBytes-=a[3][p],Reflect.apply(a[0],this,a.slice(1))}}enqueue(a){this._bufferedBytes+=a[3][p],this._queue.push(a)}sendFrame(a,b){2===a.length?(this._socket.cork(),this._socket.write(a[0]),this._socket.write(a[1],b),this._socket.uncork()):this._socket.write(a[0],b)}}function t(a,b,c){"function"==typeof c&&c(b);for(let c=0;c<a._queue.length;c++){let d=a._queue[c],e=d[d.length-1];"function"==typeof e&&e(b)}}function u(a,b,c){t(a,b,c),a.onerror(b)}a.exports=s},54351:(a,b,c)=>{"use strict";let d=c(94735),e=c(81630),{Duplex:f}=c(27910),{createHash:g}=c(55511),h=c(24509),i=c(88634),j=c(72786),k=c(80123),{CLOSE_TIMEOUT:l,GUID:m,kWebSocket:n}=c(17165),o=/^[+/0-9A-Za-z]{22}==$/;class p extends d{constructor(a,b){if(super(),null==(a={allowSynchronousEvents:!0,autoPong:!0,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:l,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:k,...a}).port&&!a.server&&!a.noServer||null!=a.port&&(a.server||a.noServer)||a.server&&a.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=a.port?(this._server=e.createServer((a,b)=>{let c=e.STATUS_CODES[426];b.writeHead(426,{"Content-Length":c.length,"Content-Type":"text/plain"}),b.end(c)}),this._server.listen(a.port,a.host,a.backlog,b)):a.server&&(this._server=a.server),this._server){const a=this.emit.bind(this,"connection");this._removeListeners=function(a,b){for(let c of Object.keys(b))a.on(c,b[c]);return function(){for(let c of Object.keys(b))a.removeListener(c,b[c])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(b,c,d)=>{this.handleUpgrade(b,c,d,a)}})}!0===a.perMessageDeflate&&(a.perMessageDeflate={}),a.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=a,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(a){if(2===this._state){a&&this.once("close",()=>{a(Error("The server is not running"))}),process.nextTick(q,this);return}if(a&&this.once("close",a),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(q,this);else{let a=this._server;this._removeListeners(),this._removeListeners=this._server=null,a.close(()=>{q(this)})}}shouldHandle(a){if(this.options.path){let b=a.url.indexOf("?");if((-1!==b?a.url.slice(0,b):a.url)!==this.options.path)return!1}return!0}handleUpgrade(a,b,c,d){b.on("error",r);let e=a.headers["sec-websocket-key"],f=a.headers.upgrade,g=+a.headers["sec-websocket-version"];if("GET"!==a.method)return void t(this,a,b,405,"Invalid HTTP method");if(void 0===f||"websocket"!==f.toLowerCase())return void t(this,a,b,400,"Invalid Upgrade header");if(void 0===e||!o.test(e))return void t(this,a,b,400,"Missing or invalid Sec-WebSocket-Key header");if(13!==g&&8!==g)return void t(this,a,b,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});if(!this.shouldHandle(a))return void s(b,400);let k=a.headers["sec-websocket-protocol"],l=new Set;if(void 0!==k)try{l=j.parse(k)}catch(c){t(this,a,b,400,"Invalid Sec-WebSocket-Protocol header");return}let m=a.headers["sec-websocket-extensions"],n={};if(this.options.perMessageDeflate&&void 0!==m){let c=new i({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let a=h.parse(m);a[i.extensionName]&&(c.accept(a[i.extensionName]),n[i.extensionName]=c)}catch(c){t(this,a,b,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let f={origin:a.headers[`${8===g?"sec-websocket-origin":"origin"}`],secure:!!(a.socket.authorized||a.socket.encrypted),req:a};if(2===this.options.verifyClient.length)return void this.options.verifyClient(f,(f,g,h,i)=>{if(!f)return s(b,g||401,h,i);this.completeUpgrade(n,e,l,a,b,c,d)});if(!this.options.verifyClient(f))return s(b,401)}this.completeUpgrade(n,e,l,a,b,c,d)}completeUpgrade(a,b,c,d,e,f,j){if(!e.readable||!e.writable)return e.destroy();if(e[n])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return s(e,503);let k=g("sha1").update(b+m).digest("base64"),l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${k}`],o=new this.options.WebSocket(null,void 0,this.options);if(c.size){let a=this.options.handleProtocols?this.options.handleProtocols(c,d):c.values().next().value;a&&(l.push(`Sec-WebSocket-Protocol: ${a}`),o._protocol=a)}if(a[i.extensionName]){let b=a[i.extensionName].params,c=h.format({[i.extensionName]:[b]});l.push(`Sec-WebSocket-Extensions: ${c}`),o._extensions=a}this.emit("headers",l,d),e.write(l.concat("\r\n").join("\r\n")),e.removeListener("error",r),o.setSocket(e,f,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(o),o.on("close",()=>{this.clients.delete(o),this._shouldEmitClose&&!this.clients.size&&process.nextTick(q,this)})),j(o,d)}}function q(a){a._state=2,a.emit("close")}function r(){this.destroy()}function s(a,b,c,d){c=c||e.STATUS_CODES[b],d={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(c),...d},a.once("finish",a.destroy),a.end(`HTTP/1.1 ${b} ${e.STATUS_CODES[b]}\r
|
|
2
|
-
`+Object.keys(d).map(a=>`${a}: ${d[a]}`).join("\r\n")+"\r\n\r\n"+c)}function t(a,b,c,d,e,f){if(a.listenerCount("wsClientError")){let d=Error(e);Error.captureStackTrace(d,t),a.emit("wsClientError",d,c,b)}else s(c,d,e,f)}a.exports=p},55511:a=>{"use strict";a.exports=require("crypto")},55591:a=>{"use strict";a.exports=require("https")},58336:(a,b,c)=>{"use strict";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(62105),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/project-state/route",pathname:"/api/project-state",filename:"route",bundlePath:"app/api/project-state/route"},distDir:".next-prod",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/cockpit/cockpit/src/app/api/project-state/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/project-state/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)}})},62105:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>k,POST:()=>l});var e=c(89705),f=c(7939),g=c(72891),h=c(770),i=c(38573),j=a([g]);g=(j.then?(await j)():j)[0];let k=(0,g.RL)(a=>e.JkU(function*(){let b=new URL(a.url).searchParams.get("cwd");if(!b)return yield*e.fJG(new h.yI({field:"cwd",reason:"missing"}));let c=(0,f.Mx)(b),d=yield*e.$mh({try:()=>(0,f.JE)(c,{sessions:[]}),catch:a=>new h.uU({path:c,op:"read",cause:a})});return(0,g.ok)(d)})),l=(0,g.RL)(a=>e.JkU(function*(){let b=yield*(0,g.k9)(a);if(!b.cwd)return yield*e.fJG(new h.yI({field:"cwd",reason:"missing"}));if(!Array.isArray(b.sessions))return yield*e.fJG(new h.yI({field:"sessions",reason:"must be array"}));let c=b.cwd,d=b.sessions,j=b.closedSessionIds??[],k=(0,f.Mx)(c),l=yield*e.$mh({try:()=>(0,f.Ux)(k,async()=>{let a=await (0,f.JE)(k,{sessions:[]}),c=new Set(j),e=[];for(let b of[...a.sessions,...d])c.has(b)||e.includes(b)||e.push(b);let g=new Set(e),h=(a,b)=>{let c={...a??{},...b??{}};for(let a of Object.keys(c))g.has(a)||delete c[a];return c},i=h(a.engines,b.engines),l=h(a.ollamaModels,b.ollamaModels),m=h(a.deepseekModels,b.deepseekModels),n=h(a.chatModes,b.chatModes),o=h(a.planModes,b.planModes),p=b.activeSessionId??a.activeSessionId,q={sessions:e,...p&&g.has(p)?{activeSessionId:p}:{},...Object.keys(i).length?{engines:i}:{},...Object.keys(l).length?{ollamaModels:l}:{},...Object.keys(m).length?{deepseekModels:m}:{},...Object.keys(n).length?{chatModes:n}:{},...Object.keys(o).length?{planModes:o}:{}};return await (0,f.An)(k,q),q}),catch:a=>new h.uU({path:k,op:"write",cause:a})});return yield*e.OH5(()=>(0,i.d)({type:"project-state-changed",cwd:c,closedSessionIds:j})),(0,g.ok)(l)}));d()}catch(a){d(a)}})},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{"use strict";a.exports=import("pg")},66136:a=>{"use strict";a.exports=require("timers")},72786:(a,b,c)=>{"use strict";let{tokenChars:d}=c(97861);a.exports={parse:function(a){let b=new Set,c=-1,e=-1,f=0;for(;f<a.length;f++){let g=a.charCodeAt(f);if(-1===e&&1===d[g])-1===c&&(c=f);else if(0!==f&&(32===g||9===g))-1===e&&-1!==c&&(e=f);else if(44===g){if(-1===c)throw SyntaxError(`Unexpected character at index ${f}`);-1===e&&(e=f);let d=a.slice(c,e);if(b.has(d))throw SyntaxError(`The "${d}" subprotocol is duplicated`);b.add(d),c=e=-1}else throw SyntaxError(`Unexpected character at index ${f}`)}if(-1===c||-1!==e)throw SyntaxError("Unexpected end of input");let g=a.slice(c,f);if(b.has(g))throw SyntaxError(`The "${g}" subprotocol is duplicated`);return b.add(g),b}}},72891:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{OZ:()=>o,RL:()=>n,k9:()=>p,ok:()=>l});var e=c(37625),f=c(52693),g=c(18412),h=c(89705),i=c(94506),j=c(770),k=a([i]);i=(k.then?(await k)():k)[0];let l=(a,b=200)=>new Response(JSON.stringify(a),{status:b,headers:{"content-type":"application/json"}}),m=a=>{let b=e.od(a);if(f.Ru(b)){let a=b.value,c=(0,j.Sh)(a);return new Response(JSON.stringify({error:(a=>{let b=a.message;if("string"==typeof b&&b.length>0)return b;let c=a.cause;if(c instanceof Error&&c.message.length>0)return c.message;switch(a._tag){case"ValidationError":return`Invalid ${a.field}: ${a.reason}`;case"NotFoundError":return`${a.resource} not found: ${a.id}`;case"PermissionError":return`Permission denied: ${a.action} on ${a.resource}`;case"DBError":return`${a.db} ${a.op} failed`;case"FSError":return`${a.op} ${a.path} failed`;case"WSError":return`${a.proto} ${a.kind} failed`;case"AgentError":return`${a.provider} ${a.kind} failed`;default:return a._tag}})(a),tag:a._tag}),{status:c,headers:{"content-type":"application/json"}})}return console.error("[handler] uncaught defect:\n"+e.j9(a)),new Response(JSON.stringify({error:"Internal Server Error",tag:"InternalError"}),{status:500,headers:{"content-type":"application/json"}})},n=a=>async b=>{let c=await i.s9.runPromiseExit(a(b));return g.YW(c,{onFailure:a=>m(a),onSuccess:a=>a})},o=a=>async(b,c)=>{let d=await c.params,e=await i.s9.runPromiseExit(a(b,d));return g.YW(e,{onFailure:a=>m(a),onSuccess:a=>a})},p=a=>h.$mh({try:()=>a.json(),catch:()=>new j.yI({field:"body",reason:"invalid JSON"})});d()}catch(a){d(a)}})},74075:a=>{"use strict";a.exports=require("zlib")},78900:(a,b,c)=>{"use strict";let{kForOnEventAttribute:d,kListener:e}=c(17165),f=Symbol("kCode"),g=Symbol("kData"),h=Symbol("kError"),i=Symbol("kMessage"),j=Symbol("kReason"),k=Symbol("kTarget"),l=Symbol("kType"),m=Symbol("kWasClean");class n{constructor(a){this[k]=null,this[l]=a}get target(){return this[k]}get type(){return this[l]}}Object.defineProperty(n.prototype,"target",{enumerable:!0}),Object.defineProperty(n.prototype,"type",{enumerable:!0});class o extends n{constructor(a,b={}){super(a),this[f]=void 0===b.code?0:b.code,this[j]=void 0===b.reason?"":b.reason,this[m]=void 0!==b.wasClean&&b.wasClean}get code(){return this[f]}get reason(){return this[j]}get wasClean(){return this[m]}}Object.defineProperty(o.prototype,"code",{enumerable:!0}),Object.defineProperty(o.prototype,"reason",{enumerable:!0}),Object.defineProperty(o.prototype,"wasClean",{enumerable:!0});class p extends n{constructor(a,b={}){super(a),this[h]=void 0===b.error?null:b.error,this[i]=void 0===b.message?"":b.message}get error(){return this[h]}get message(){return this[i]}}Object.defineProperty(p.prototype,"error",{enumerable:!0}),Object.defineProperty(p.prototype,"message",{enumerable:!0});class q extends n{constructor(a,b={}){super(a),this[g]=void 0===b.data?null:b.data}get data(){return this[g]}}function r(a,b,c){"object"==typeof a&&a.handleEvent?a.handleEvent.call(a,c):a.call(b,c)}Object.defineProperty(q.prototype,"data",{enumerable:!0}),a.exports={CloseEvent:o,ErrorEvent:p,Event:n,EventTarget:{addEventListener(a,b,c={}){let f;for(let f of this.listeners(a))if(!c[d]&&f[e]===b&&!f[d])return;if("message"===a)f=function(a,c){let d=new q("message",{data:c?a:a.toString()});d[k]=this,r(b,this,d)};else if("close"===a)f=function(a,c){let d=new o("close",{code:a,reason:c.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});d[k]=this,r(b,this,d)};else if("error"===a)f=function(a){let c=new p("error",{error:a,message:a.message});c[k]=this,r(b,this,c)};else{if("open"!==a)return;f=function(){let a=new n("open");a[k]=this,r(b,this,a)}}f[d]=!!c[d],f[e]=b,c.once?this.once(a,f):this.on(a,f)},removeEventListener(a,b){for(let c of this.listeners(a))if(c[e]===b&&!c[d]){this.removeListener(a,c);break}}},MessageEvent:q}},79428:a=>{"use strict";a.exports=require("buffer")},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80123:(a,b,c)=>{"use strict";let d=c(94735),e=c(55591),f=c(81630),g=c(91645),h=c(34631),{randomBytes:i,createHash:j}=c(55511),{Duplex:k,Readable:l}=c(27910),{URL:m}=c(1932),n=c(88634),o=c(13259),p=c(53455),{isBlob:q}=c(97861),{BINARY_TYPES:r,CLOSE_TIMEOUT:s,EMPTY_BUFFER:t,GUID:u,kForOnEventAttribute:v,kListener:w,kStatusCode:x,kWebSocket:y,NOOP:z}=c(17165),{EventTarget:{addEventListener:A,removeEventListener:B}}=c(78900),{format:C,parse:D}=c(24509),{toBuffer:E}=c(6361),F=Symbol("kAborted"),G=[8,13],H=["CONNECTING","OPEN","CLOSING","CLOSED"],I=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class J extends d{constructor(a,b,c){super(),this._binaryType=r[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=t,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=J.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==a?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===b?b=[]:Array.isArray(b)||("object"==typeof b&&null!==b?(c=b,b=[]):b=[b]),function a(b,c,d,g){let h,k,l,o,p={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:s,protocolVersion:G[1],maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...g,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(b._autoPong=p.autoPong,b._closeTimeout=p.closeTimeout,!G.includes(p.protocolVersion))throw RangeError(`Unsupported protocol version: ${p.protocolVersion} (supported versions: ${G.join(", ")})`);if(c instanceof m)h=c;else try{h=new m(c)}catch{throw SyntaxError(`Invalid URL: ${c}`)}"http:"===h.protocol?h.protocol="ws:":"https:"===h.protocol&&(h.protocol="wss:"),b._url=h.href;let q="wss:"===h.protocol,r="ws+unix:"===h.protocol;if("ws:"===h.protocol||q||r?r&&!h.pathname?k="The URL's pathname is empty":h.hash&&(k="The URL contains a fragment identifier"):k='The URL\'s protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"',k){let a=SyntaxError(k);if(0!==b._redirects)return void K(b,a);throw a}let t=q?443:80,v=i(16).toString("base64"),w=q?e.request:f.request,x=new Set;if(p.createConnection=p.createConnection||(q?M:L),p.defaultPort=p.defaultPort||t,p.port=h.port||t,p.host=h.hostname.startsWith("[")?h.hostname.slice(1,-1):h.hostname,p.headers={...p.headers,"Sec-WebSocket-Version":p.protocolVersion,"Sec-WebSocket-Key":v,Connection:"Upgrade",Upgrade:"websocket"},p.path=h.pathname+h.search,p.timeout=p.handshakeTimeout,p.perMessageDeflate&&(l=new n({...p.perMessageDeflate,isServer:!1,maxPayload:p.maxPayload}),p.headers["Sec-WebSocket-Extensions"]=C({[n.extensionName]:l.offer()})),d.length){for(let a of d){if("string"!=typeof a||!I.test(a)||x.has(a))throw SyntaxError("An invalid or duplicated subprotocol was specified");x.add(a)}p.headers["Sec-WebSocket-Protocol"]=d.join(",")}if(p.origin&&(p.protocolVersion<13?p.headers["Sec-WebSocket-Origin"]=p.origin:p.headers.Origin=p.origin),(h.username||h.password)&&(p.auth=`${h.username}:${h.password}`),r){let a=p.path.split(":");p.socketPath=a[0],p.path=a[1]}if(p.followRedirects){if(0===b._redirects){b._originalIpc=r,b._originalSecure=q,b._originalHostOrSocketPath=r?p.socketPath:h.host;let a=g&&g.headers;if(g={...g,headers:{}},a)for(let[b,c]of Object.entries(a))g.headers[b.toLowerCase()]=c}else if(0===b.listenerCount("redirect")){let a=r?!!b._originalIpc&&p.socketPath===b._originalHostOrSocketPath:!b._originalIpc&&h.host===b._originalHostOrSocketPath;a&&(!b._originalSecure||q)||(delete p.headers.authorization,delete p.headers.cookie,a||delete p.headers.host,p.auth=void 0)}p.auth&&!g.headers.authorization&&(g.headers.authorization="Basic "+Buffer.from(p.auth).toString("base64")),o=b._req=w(p),b._redirects&&b.emit("redirect",b.url,o)}else o=b._req=w(p);p.timeout&&o.on("timeout",()=>{N(b,o,"Opening handshake has timed out")}),o.on("error",a=>{null===o||o[F]||(o=b._req=null,K(b,a))}),o.on("response",e=>{let f=e.headers.location,h=e.statusCode;if(f&&p.followRedirects&&h>=300&&h<400){let e;if(++b._redirects>p.maxRedirects)return void N(b,o,"Maximum redirects exceeded");o.abort();try{e=new m(f,c)}catch(a){K(b,SyntaxError(`Invalid URL: ${f}`));return}a(b,e,d,g)}else b.emit("unexpected-response",o,e)||N(b,o,`Unexpected server response: ${e.statusCode}`)}),o.on("upgrade",(a,c,d)=>{let e;if(b.emit("upgrade",a),b.readyState!==J.CONNECTING)return;o=b._req=null;let f=a.headers.upgrade;if(void 0===f||"websocket"!==f.toLowerCase())return void N(b,c,"Invalid Upgrade header");let g=j("sha1").update(v+u).digest("base64");if(a.headers["sec-websocket-accept"]!==g)return void N(b,c,"Invalid Sec-WebSocket-Accept header");let h=a.headers["sec-websocket-protocol"];if(void 0!==h?x.size?x.has(h)||(e="Server sent an invalid subprotocol"):e="Server sent a subprotocol but none was requested":x.size&&(e="Server sent no subprotocol"),e)return void N(b,c,e);h&&(b._protocol=h);let i=a.headers["sec-websocket-extensions"];if(void 0!==i){let a;if(!l)return void N(b,c,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");try{a=D(i)}catch(a){N(b,c,"Invalid Sec-WebSocket-Extensions header");return}let d=Object.keys(a);if(1!==d.length||d[0]!==n.extensionName)return void N(b,c,"Server indicated an extension that was not requested");try{l.accept(a[n.extensionName])}catch(a){N(b,c,"Invalid Sec-WebSocket-Extensions header");return}b._extensions[n.extensionName]=l}b.setSocket(c,d,{allowSynchronousEvents:p.allowSynchronousEvents,generateMask:p.generateMask,maxPayload:p.maxPayload,skipUTF8Validation:p.skipUTF8Validation})}),p.finishRequest?p.finishRequest(o,b):o.end()}(this,a,b,c)):(this._autoPong=c.autoPong,this._closeTimeout=c.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(a){r.includes(a)&&(this._binaryType=a,this._receiver&&(this._receiver._binaryType=a))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(a,b,c){let d=new o({allowSynchronousEvents:c.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:c.maxPayload,skipUTF8Validation:c.skipUTF8Validation}),e=new p(a,this._extensions,c.generateMask);this._receiver=d,this._sender=e,this._socket=a,d[y]=this,e[y]=this,a[y]=this,d.on("conclude",P),d.on("drain",Q),d.on("error",R),d.on("message",T),d.on("ping",U),d.on("pong",V),e.onerror=X,a.setTimeout&&a.setTimeout(0),a.setNoDelay&&a.setNoDelay(),b.length>0&&a.unshift(b),a.on("close",Z),a.on("data",$),a.on("end",_),a.on("error",aa),this._readyState=J.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=J.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[n.extensionName]&&this._extensions[n.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=J.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(a,b){if(this.readyState!==J.CLOSED){if(this.readyState===J.CONNECTING)return void N(this,this._req,"WebSocket was closed before the connection was established");if(this.readyState===J.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=J.CLOSING,this._sender.close(a,b,!this._isServer,a=>{!a&&(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Y(this)}}pause(){this.readyState!==J.CONNECTING&&this.readyState!==J.CLOSED&&(this._paused=!0,this._socket.pause())}ping(a,b,c){if(this.readyState===J.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof a?(c=a,a=b=void 0):"function"==typeof b&&(c=b,b=void 0),"number"==typeof a&&(a=a.toString()),this.readyState!==J.OPEN)?O(this,a,c):(void 0===b&&(b=!this._isServer),this._sender.ping(a||t,b,c))}pong(a,b,c){if(this.readyState===J.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof a?(c=a,a=b=void 0):"function"==typeof b&&(c=b,b=void 0),"number"==typeof a&&(a=a.toString()),this.readyState!==J.OPEN)?O(this,a,c):(void 0===b&&(b=!this._isServer),this._sender.pong(a||t,b,c))}resume(){this.readyState!==J.CONNECTING&&this.readyState!==J.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(a,b,c){if(this.readyState===J.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof b&&(c=b,b={}),"number"==typeof a&&(a=a.toString()),this.readyState!==J.OPEN)return void O(this,a,c);let d={binary:"string"!=typeof a,mask:!this._isServer,compress:!0,fin:!0,...b};this._extensions[n.extensionName]||(d.compress=!1),this._sender.send(a||t,d,c)}terminate(){if(this.readyState!==J.CLOSED){if(this.readyState===J.CONNECTING)return void N(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=J.CLOSING,this._socket.destroy())}}}function K(a,b){a._readyState=J.CLOSING,a._errorEmitted=!0,a.emit("error",b),a.emitClose()}function L(a){return a.path=a.socketPath,g.connect(a)}function M(a){return a.path=void 0,a.servername||""===a.servername||(a.servername=g.isIP(a.host)?"":a.host),h.connect(a)}function N(a,b,c){a._readyState=J.CLOSING;let d=Error(c);Error.captureStackTrace(d,N),b.setHeader?(b[F]=!0,b.abort(),b.socket&&!b.socket.destroyed&&b.socket.destroy(),process.nextTick(K,a,d)):(b.destroy(d),b.once("error",a.emit.bind(a,"error")),b.once("close",a.emitClose.bind(a)))}function O(a,b,c){if(b){let c=q(b)?b.size:E(b).length;a._socket?a._sender._bufferedBytes+=c:a._bufferedAmount+=c}if(c){let b=Error(`WebSocket is not open: readyState ${a.readyState} (${H[a.readyState]})`);process.nextTick(c,b)}}function P(a,b){let c=this[y];c._closeFrameReceived=!0,c._closeMessage=b,c._closeCode=a,void 0!==c._socket[y]&&(c._socket.removeListener("data",$),process.nextTick(W,c._socket),1005===a?c.close():c.close(a,b))}function Q(){let a=this[y];a.isPaused||a._socket.resume()}function R(a){let b=this[y];void 0!==b._socket[y]&&(b._socket.removeListener("data",$),process.nextTick(W,b._socket),b.close(a[x])),b._errorEmitted||(b._errorEmitted=!0,b.emit("error",a))}function S(){this[y].emitClose()}function T(a,b){this[y].emit("message",a,b)}function U(a){let b=this[y];b._autoPong&&b.pong(a,!this._isServer,z),b.emit("ping",a)}function V(a){this[y].emit("pong",a)}function W(a){a.resume()}function X(a){let b=this[y];b.readyState!==J.CLOSED&&(b.readyState===J.OPEN&&(b._readyState=J.CLOSING,Y(b)),this._socket.end(),b._errorEmitted||(b._errorEmitted=!0,b.emit("error",a)))}function Y(a){a._closeTimer=setTimeout(a._socket.destroy.bind(a._socket),a._closeTimeout)}function Z(){let a=this[y];if(this.removeListener("close",Z),this.removeListener("data",$),this.removeListener("end",_),a._readyState=J.CLOSING,!this._readableState.endEmitted&&!a._closeFrameReceived&&!a._receiver._writableState.errorEmitted&&0!==this._readableState.length){let b=this.read(this._readableState.length);a._receiver.write(b)}a._receiver.end(),this[y]=void 0,clearTimeout(a._closeTimer),a._receiver._writableState.finished||a._receiver._writableState.errorEmitted?a.emitClose():(a._receiver.on("error",S),a._receiver.on("finish",S))}function $(a){this[y]._receiver.write(a)||this.pause()}function _(){let a=this[y];a._readyState=J.CLOSING,a._receiver.end(),this.end()}function aa(){let a=this[y];this.removeListener("error",aa),this.on("error",z),a&&(a._readyState=J.CLOSING,this.destroy())}Object.defineProperty(J,"CONNECTING",{enumerable:!0,value:H.indexOf("CONNECTING")}),Object.defineProperty(J.prototype,"CONNECTING",{enumerable:!0,value:H.indexOf("CONNECTING")}),Object.defineProperty(J,"OPEN",{enumerable:!0,value:H.indexOf("OPEN")}),Object.defineProperty(J.prototype,"OPEN",{enumerable:!0,value:H.indexOf("OPEN")}),Object.defineProperty(J,"CLOSING",{enumerable:!0,value:H.indexOf("CLOSING")}),Object.defineProperty(J.prototype,"CLOSING",{enumerable:!0,value:H.indexOf("CLOSING")}),Object.defineProperty(J,"CLOSED",{enumerable:!0,value:H.indexOf("CLOSED")}),Object.defineProperty(J.prototype,"CLOSED",{enumerable:!0,value:H.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(a=>{Object.defineProperty(J.prototype,a,{enumerable:!0})}),["open","error","close","message"].forEach(a=>{Object.defineProperty(J.prototype,`on${a}`,{enumerable:!0,get(){for(let b of this.listeners(a))if(b[v])return b[w];return null},set(b){for(let b of this.listeners(a))if(b[v]){this.removeListener(a,b);break}"function"==typeof b&&this.addEventListener(a,b,{[v]:!0})}})}),J.prototype.addEventListener=A,J.prototype.removeEventListener=B,a.exports=J},81630:a=>{"use strict";a.exports=require("http")},82146:(a,b,c)=>{"use strict";c(80123);let{Duplex:d}=c(27910);function e(a){a.emit("close")}function f(){!this.destroyed&&this._writableState.finished&&this.destroy()}function g(a){this.removeListener("error",g),this.destroy(),0===this.listenerCount("error")&&this.emit("error",a)}a.exports=function(a,b){let c=!0,h=new d({...b,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return a.on("message",function(b,c){let d=!c&&h._readableState.objectMode?b.toString():b;h.push(d)||a.pause()}),a.once("error",function(a){h.destroyed||(c=!1,h.destroy(a))}),a.once("close",function(){h.destroyed||h.push(null)}),h._destroy=function(b,d){if(a.readyState===a.CLOSED){d(b),process.nextTick(e,h);return}let f=!1;a.once("error",function(a){f=!0,d(a)}),a.once("close",function(){f||d(b),process.nextTick(e,h)}),c&&a.terminate()},h._final=function(b){a.readyState===a.CONNECTING?a.once("open",function(){h._final(b)}):null!==a._socket&&(a._socket._writableState.finished?(b(),h._readableState.endEmitted&&h.destroy()):(a._socket.once("finish",function(){b()}),a.close()))},h._read=function(){a.isPaused&&a.resume()},h._write=function(b,c,d){a.readyState===a.CONNECTING?a.once("open",function(){h._write(b,c,d)}):a.send(b,d)},h.on("end",f),h.on("error",g),h}},83997:a=>{"use strict";a.exports=require("tty")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},88634:(a,b,c)=>{"use strict";let d,e=c(74075),f=c(6361),g=c(89672),{kStatusCode:h}=c(17165),i=Buffer[Symbol.species],j=Buffer.from([0,0,255,255]),k=Symbol("permessage-deflate"),l=Symbol("total-length"),m=Symbol("callback"),n=Symbol("buffers"),o=Symbol("error");class p{constructor(a){this._options=a||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._maxPayload=0|this._options.maxPayload,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,d||(d=new g(void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10))}static get extensionName(){return"permessage-deflate"}offer(){let a={};return this._options.serverNoContextTakeover&&(a.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(a.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(a.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?a.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(a.client_max_window_bits=!0),a}accept(a){return a=this.normalizeParams(a),this.params=this._isServer?this.acceptAsServer(a):this.acceptAsClient(a),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let a=this._deflate[m];this._deflate.close(),this._deflate=null,a&&a(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(a){let b=this._options,c=a.find(a=>(!1!==b.serverNoContextTakeover||!a.server_no_context_takeover)&&(!a.server_max_window_bits||!1!==b.serverMaxWindowBits&&("number"!=typeof b.serverMaxWindowBits||!(b.serverMaxWindowBits>a.server_max_window_bits)))&&("number"!=typeof b.clientMaxWindowBits||!!a.client_max_window_bits));if(!c)throw Error("None of the extension offers can be accepted");return b.serverNoContextTakeover&&(c.server_no_context_takeover=!0),b.clientNoContextTakeover&&(c.client_no_context_takeover=!0),"number"==typeof b.serverMaxWindowBits&&(c.server_max_window_bits=b.serverMaxWindowBits),"number"==typeof b.clientMaxWindowBits?c.client_max_window_bits=b.clientMaxWindowBits:(!0===c.client_max_window_bits||!1===b.clientMaxWindowBits)&&delete c.client_max_window_bits,c}acceptAsClient(a){let b=a[0];if(!1===this._options.clientNoContextTakeover&&b.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(b.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&b.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(b.client_max_window_bits=this._options.clientMaxWindowBits);return b}normalizeParams(a){return a.forEach(a=>{Object.keys(a).forEach(b=>{let c=a[b];if(c.length>1)throw Error(`Parameter "${b}" must have only a single value`);if(c=c[0],"client_max_window_bits"===b){if(!0!==c){let a=+c;if(!Number.isInteger(a)||a<8||a>15)throw TypeError(`Invalid value for parameter "${b}": ${c}`);c=a}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${b}": ${c}`)}else if("server_max_window_bits"===b){let a=+c;if(!Number.isInteger(a)||a<8||a>15)throw TypeError(`Invalid value for parameter "${b}": ${c}`);c=a}else if("client_no_context_takeover"===b||"server_no_context_takeover"===b){if(!0!==c)throw TypeError(`Invalid value for parameter "${b}": ${c}`)}else throw Error(`Unknown parameter "${b}"`);a[b]=c})}),a}decompress(a,b,c){d.add(d=>{this._decompress(a,b,(a,b)=>{d(),c(a,b)})})}compress(a,b,c){d.add(d=>{this._compress(a,b,(a,b)=>{d(),c(a,b)})})}_decompress(a,b,c){let d=this._isServer?"client":"server";if(!this._inflate){let a=`${d}_max_window_bits`,b="number"!=typeof this.params[a]?e.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=e.createInflateRaw({...this._options.zlibInflateOptions,windowBits:b}),this._inflate[k]=this,this._inflate[l]=0,this._inflate[n]=[],this._inflate.on("error",s),this._inflate.on("data",r)}this._inflate[m]=c,this._inflate.write(a),b&&this._inflate.write(j),this._inflate.flush(()=>{let a=this._inflate[o];if(a){this._inflate.close(),this._inflate=null,c(a);return}let e=f.concat(this._inflate[n],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[n]=[],b&&this.params[`${d}_no_context_takeover`]&&this._inflate.reset()),c(null,e)})}_compress(a,b,c){let d=this._isServer?"server":"client";if(!this._deflate){let a=`${d}_max_window_bits`,b="number"!=typeof this.params[a]?e.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=e.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:b}),this._deflate[l]=0,this._deflate[n]=[],this._deflate.on("data",q)}this._deflate[m]=c,this._deflate.write(a),this._deflate.flush(e.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=f.concat(this._deflate[n],this._deflate[l]);b&&(a=new i(a.buffer,a.byteOffset,a.length-4)),this._deflate[m]=null,this._deflate[l]=0,this._deflate[n]=[],b&&this.params[`${d}_no_context_takeover`]&&this._deflate.reset(),c(null,a)})}}function q(a){this[n].push(a),this[l]+=a.length}function r(a){(this[l]+=a.length,this[k]._maxPayload<1||this[l]<=this[k]._maxPayload)?this[n].push(a):(this[o]=RangeError("Max payload size exceeded"),this[o].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[o][h]=1009,this.removeListener("data",r),this.reset())}function s(a){(this[k]._inflate=null,this[o])?this[m](this[o]):(a[h]=1007,this[m](a))}a.exports=p},89672:a=>{"use strict";let b=Symbol("kDone"),c=Symbol("kRun");class d{constructor(a){this[b]=()=>{this.pending--,this[c]()},this.concurrency=a||1/0,this.jobs=[],this.pending=0}add(a){this.jobs.push(a),this[c]()}[c](){if(this.pending!==this.concurrency&&this.jobs.length){let a=this.jobs.shift();this.pending++,a(this[b])}}}a.exports=d},91645:a=>{"use strict";a.exports=require("net")},94735:a=>{"use strict";a.exports=require("events")},97861:(a,b,c)=>{"use strict";let{isUtf8:d}=c(79428),{hasBlob:e}=c(17165);function f(a){let b=a.length,c=0;for(;c<b;)if((128&a[c])==0)c++;else if((224&a[c])==192){if(c+1===b||(192&a[c+1])!=128||(254&a[c])==192)return!1;c+=2}else if((240&a[c])==224){if(c+2>=b||(192&a[c+1])!=128||(192&a[c+2])!=128||224===a[c]&&(224&a[c+1])==128||237===a[c]&&(224&a[c+1])==160)return!1;c+=3}else{if((248&a[c])!=240||c+3>=b||(192&a[c+1])!=128||(192&a[c+2])!=128||(192&a[c+3])!=128||240===a[c]&&(240&a[c+1])==128||244===a[c]&&a[c+1]>143||a[c]>244)return!1;c+=4}return!0}if(a.exports={isBlob:function(a){return e&&"object"==typeof a&&"function"==typeof a.arrayBuffer&&"string"==typeof a.type&&"function"==typeof a.stream&&("Blob"===a[Symbol.toStringTag]||"File"===a[Symbol.toStringTag])},isValidStatusCode:function(a){return a>=1e3&&a<=1014&&1004!==a&&1005!==a&&1006!==a||a>=3e3&&a<=4999},isValidUTF8:f,tokenChars:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0]},d)a.exports.isValidUTF8=function(a){return a.length<24?f(a):d(a)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let b=c(47990);a.exports.isValidUTF8=function(a){return a.length<32?f(a):b(a)}}catch(a){}}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,7184,304],()=>b(b.s=58336));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=2865,a.ids=[2865],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{"use strict";a.exports=require("url")},4573:a=>{"use strict";a.exports=require("node:buffer")},6361:(a,b,c)=>{"use strict";let{EMPTY_BUFFER:d}=c(17165),e=Buffer[Symbol.species];function f(a,b,c,d,e){for(let f=0;f<e;f++)c[d+f]=a[f]^b[3&f]}function g(a,b){for(let c=0;c<a.length;c++)a[c]^=b[3&c]}function h(a){let b;return(h.readOnly=!0,Buffer.isBuffer(a))?a:(a instanceof ArrayBuffer?b=new e(a):ArrayBuffer.isView(a)?b=new e(a.buffer,a.byteOffset,a.byteLength):(b=Buffer.from(a),h.readOnly=!1),b)}if(a.exports={concat:function(a,b){if(0===a.length)return d;if(1===a.length)return a[0];let c=Buffer.allocUnsafe(b),f=0;for(let b=0;b<a.length;b++){let d=a[b];c.set(d,f),f+=d.length}return f<b?new e(c.buffer,c.byteOffset,f):c},mask:f,toArrayBuffer:function(a){return a.length===a.buffer.byteLength?a.buffer:a.buffer.slice(a.byteOffset,a.byteOffset+a.length)},toBuffer:h,unmask:g},!process.env.WS_NO_BUFFER_UTIL)try{let b=c(39727);a.exports.mask=function(a,c,d,e,g){g<48?f(a,c,d,e,g):b.mask(a,c,d,e,g)},a.exports.unmask=function(a,c){a.length<32?g(a,c):b.unmask(a,c)}}catch(a){}},7939:(a,b,c)=>{"use strict";c.d(b,{$A:()=>M,A0:()=>X,An:()=>$,BF:()=>I,Ct:()=>Q,Eu:()=>H,Ex:()=>u,GB:()=>r,JE:()=>Z,JY:()=>L,Ki:()=>C,Kk:()=>R,Kv:()=>j,LN:()=>k,Mx:()=>D,N9:()=>ac,O0:()=>B,Sr:()=>J,Tb:()=>s,Ux:()=>ab,Wd:()=>Y,aO:()=>m,at:()=>y,ec:()=>o,eg:()=>V,h9:()=>x,i4:()=>G,iK:()=>p,im:()=>T,iy:()=>P,jp:()=>t,lT:()=>z,lq:()=>F,ls:()=>K,mT:()=>w,n6:()=>n,oK:()=>O,oZ:()=>S,of:()=>E,po:()=>N,tP:()=>q,th:()=>v,v4:()=>l,vI:()=>W,yw:()=>U});var d=c(21820),e=c(33873),f=c(79748),g=c(29021),h=c(79646);let i=(0,d.homedir)(),j=process.env.COCKPIT_HOME?(0,e.resolve)(process.env.COCKPIT_HOME.replace(/^~(?=$|\/)/,i)):(0,e.join)(i,".cockpit"),k=(0,e.join)(j,"projects"),l=(0,e.join)(j,"state.json"),m=(0,e.join)(j,"pinned-sessions.json"),n=(0,e.join)(j,"push-subscriptions.json"),o=(0,e.join)(j,"note.md"),p=(0,e.join)(j,"scheduled-tasks.json"),q=(0,e.join)(j,"settings.json"),r=(0,e.join)(j,"skills.json"),s=(0,e.join)(j,"review"),t=(0,e.join)(s,"_signal");function u(){try{(0,g.existsSync)(s)||(0,g.mkdirSync)(s,{recursive:!0}),(0,g.writeFileSync)(t,Date.now().toString())}catch{}}let v=(0,e.join)(i,".claude"),w=(0,e.join)(v,"projects"),x=(0,e.join)(i,".claude2"),y=(0,e.join)(x,"projects"),z=(0,e.join)(j,"deepseek"),A=(0,e.join)(z,"projects");function B(a){return a.replace(/[/.]/g,"-")}function C(a){return(0,e.join)(k,B(a))}function D(a){return(0,e.join)(C(a),"session.json")}function E(a){return(0,e.join)(C(a),"recent-files.json")}function F(a){return(0,e.join)(C(a),"expanded-paths.json")}function G(a){return(0,e.join)(C(a),"comments.json")}function H(a){return(0,e.join)(C(a),"services.json")}function I(a){return(0,e.join)(C(a),"note.md")}function J(a,b){return(0,e.join)(C(a),`terminal-history-${b}.jsonl`)}function K(a,b){return(0,e.join)(C(a),`terminal-output-${b}.txt`)}function L(a,b){let c=b?`terminal-env-${b}.json`:"terminal-env-global.json";return(0,e.join)(C(a),c)}function M(){return(0,e.join)(j,"terminal-aliases.json")}function N(){return(0,e.join)(j,"services.json")}function O(a){return(0,e.join)(C(a),"project-settings.json")}function P(a,b){return(0,e.join)(C(a),`terminal-bubble-order-${b}.json`)}function Q(a){return(0,e.join)(s,`${a}.json`)}function R(a,b){return(0,e.join)((0,e.join)(w,B(a)),`${b}.jsonl`)}function S(a,b){return(0,e.join)((0,e.join)(y,B(a)),`${b}.jsonl`)}function T(a,b){return(0,e.join)((0,e.join)(A,B(a)),`${b}.jsonl`)}function U(a,b){return(0,e.join)((0,e.join)(j,"ollama-sessions",B(a)),`${b}.jsonl`)}function V(a){let b=(0,e.join)(i,".codex","sessions");if(!(0,g.existsSync)(b))return null;try{let c=(0,h.execSync)(`find ${JSON.stringify(b)} -name "*${a}.jsonl" -type f 2>/dev/null`,{encoding:"utf8",timeout:3e3}).trim();if(c)return c.split("\n")[0]}catch{}return null}function W(a){let b=(0,e.join)(i,".kimi","sessions");if(!(0,g.existsSync)(b))return null;try{for(let c of(0,g.readdirSync)(b)){let d=(0,e.join)(b,c,a,"context.jsonl");if((0,g.existsSync)(d))return d}}catch{}return null}async function X(a){(0,g.existsSync)(a)||await (0,f.mkdir)(a,{recursive:!0})}async function Y(a){let b=(0,e.join)(a,"..");await X(b)}async function Z(a,b){try{let b=await (0,f.readFile)(a,"utf-8");return JSON.parse(b)}catch{return b}}async function $(a,b){await Y(a),await (0,f.writeFile)(a,JSON.stringify(b,null,2),"utf-8")}let _=globalThis,aa=_.__cockpitFileLocks??(_.__cockpitFileLocks=new Map);function ab(a,b){let c=(aa.get(a)??Promise.resolve()).then(b),d=c.then(()=>{},()=>{});return aa.set(a,d),d.then(()=>{aa.get(a)===d&&aa.delete(a)}),c}function ac(a,b,c){return ab(a,async()=>{let d=await Z(a,b),e=await c(d);return await $(a,e),e})}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{"use strict";a.exports=require("assert")},13259:(a,b,c)=>{"use strict";let{Writable:d}=c(27910),e=c(88634),{BINARY_TYPES:f,EMPTY_BUFFER:g,kStatusCode:h,kWebSocket:i}=c(17165),{concat:j,toArrayBuffer:k,unmask:l}=c(6361),{isValidStatusCode:m,isValidUTF8:n}=c(97861),o=Buffer[Symbol.species];class p extends d{constructor(a={}){super(),this._allowSynchronousEvents=void 0===a.allowSynchronousEvents||a.allowSynchronousEvents,this._binaryType=a.binaryType||f[0],this._extensions=a.extensions||{},this._isServer=!!a.isServer,this._maxBufferedChunks=0|a.maxBufferedChunks,this._maxFragments=0|a.maxFragments,this._maxPayload=0|a.maxPayload,this._skipUTF8Validation=!!a.skipUTF8Validation,this[i]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(a,b,c){return 8===this._opcode&&0==this._state?c():this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks?void c(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS")):void(this._bufferedBytes+=a.length,this._buffers.push(a),this.startLoop(c))}consume(a){if(this._bufferedBytes-=a,a===this._buffers[0].length)return this._buffers.shift();if(a<this._buffers[0].length){let b=this._buffers[0];return this._buffers[0]=new o(b.buffer,b.byteOffset+a,b.length-a),new o(b.buffer,b.byteOffset,a)}let b=Buffer.allocUnsafe(a);do{let c=this._buffers[0],d=b.length-a;a>=c.length?b.set(this._buffers.shift(),d):(b.set(new Uint8Array(c.buffer,c.byteOffset,a),d),this._buffers[0]=new o(c.buffer,c.byteOffset+a,c.length-a)),a-=c.length}while(a>0);return b}startLoop(a){this._loop=!0;do switch(this._state){case 0:this.getInfo(a);break;case 1:this.getPayloadLength16(a);break;case 2:this.getPayloadLength64(a);break;case 3:this.getMask();break;case 4:this.getData(a);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||a()}getInfo(a){if(this._bufferedBytes<2){this._loop=!1;return}let b=this.consume(2);if((48&b[0])!=0)return void a(this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3"));let c=(64&b[0])==64;if(c&&!this._extensions[e.extensionName])return void a(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._fin=(128&b[0])==128,this._opcode=15&b[0],this._payloadLength=127&b[1],0===this._opcode){if(c)return void a(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(!this._fragmented)return void a(this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE"));this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return void a(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));this._compressed=c}else{if(!(this._opcode>7)||!(this._opcode<11))return void a(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));if(!this._fin)return void a(this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN"));if(c)return void a(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._payloadLength>125||8===this._opcode&&1===this._payloadLength)return void a(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"))}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=(128&b[1])==128,this._isServer){if(!this._masked)return void a(this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK"))}else if(this._masked)return void a(this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK"));126===this._payloadLength?this._state=1:127===this._payloadLength?this._state=2:this.haveLength(a)}getPayloadLength16(a){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(a)}getPayloadLength64(a){if(this._bufferedBytes<8){this._loop=!1;return}let b=this.consume(8),c=b.readUInt32BE(0);c>2097151?a(this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=0x100000000*c+b.readUInt32BE(4),this.haveLength(a))}haveLength(a){this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)?a(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH")):this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(a){let b=g;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}b=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!=0&&l(b,this._mask)}if(this._opcode>7)return void this.controlMessage(b,a);if(this._compressed){this._state=5,this.decompress(b,a);return}if(b.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments)return void a(this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));this._messageLength=this._totalPayloadLength,this._fragments.push(b)}this.dataMessage(a)}decompress(a,b){this._extensions[e.extensionName].decompress(a,this._fin,(a,c)=>{if(a)return b(a);if(c.length){if(this._messageLength+=c.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return void b(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));if(this._maxFragments>0&&this._fragments.length>=this._maxFragments)return void b(this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));this._fragments.push(c)}this.dataMessage(b),0===this._state&&this.startLoop(b)})}dataMessage(a){if(!this._fin){this._state=0;return}let b=this._messageLength,c=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let d;d="nodebuffer"===this._binaryType?j(c,b):"arraybuffer"===this._binaryType?k(j(c,b)):"blob"===this._binaryType?new Blob(c):c,this._allowSynchronousEvents?(this.emit("message",d,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",d,!0),this._state=0,this.startLoop(a)}))}else{let d=j(c,b);if(!this._skipUTF8Validation&&!n(d))return void a(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));5===this._state||this._allowSynchronousEvents?(this.emit("message",d,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",d,!1),this._state=0,this.startLoop(a)}))}}controlMessage(a,b){if(8===this._opcode){if(0===a.length)this._loop=!1,this.emit("conclude",1005,g),this.end();else{let c=a.readUInt16BE(0);if(!m(c))return void b(this.createError(RangeError,`invalid status code ${c}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE"));let d=new o(a.buffer,a.byteOffset+2,a.length-2);if(!this._skipUTF8Validation&&!n(d))return void b(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));this._loop=!1,this.emit("conclude",c,d),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(9===this._opcode?"ping":"pong",a),this._state=0):(this._state=6,setImmediate(()=>{this.emit(9===this._opcode?"ping":"pong",a),this._state=0,this.startLoop(b)}))}createError(a,b,c,d,e){this._loop=!1,this._errored=!0;let f=new a(c?`Invalid WebSocket frame: ${b}`:b);return Error.captureStackTrace(f,this.createError),f.code=e,f[h]=d,f}}a.exports=p},14985:a=>{"use strict";a.exports=require("dns")},17165:a=>{"use strict";let b=["nodebuffer","arraybuffer","fragments"],c="u">typeof Blob;c&&b.push("blob"),a.exports={BINARY_TYPES:b,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:c,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},19771:a=>{"use strict";a.exports=require("process")},19879:a=>{"use strict";a.exports=import("@anthropic-ai/claude-agent-sdk")},21820:a=>{"use strict";a.exports=require("os")},24509:(a,b,c)=>{"use strict";let{tokenChars:d}=c(97861);function e(a,b,c){void 0===a[b]?a[b]=[c]:a[b].push(c)}a.exports={format:function(a){return Object.keys(a).map(b=>{let c=a[b];return Array.isArray(c)||(c=[c]),c.map(a=>[b].concat(Object.keys(a).map(b=>{let c=a[b];return Array.isArray(c)||(c=[c]),c.map(a=>!0===a?b:`${b}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")},parse:function(a){let b,c,f=Object.create(null),g=Object.create(null),h=!1,i=!1,j=!1,k=-1,l=-1,m=-1,n=0;for(;n<a.length;n++)if(l=a.charCodeAt(n),void 0===b)if(-1===m&&1===d[l])-1===k&&(k=n);else if(0!==n&&(32===l||9===l))-1===m&&-1!==k&&(m=n);else if(59===l||44===l){if(-1===k)throw SyntaxError(`Unexpected character at index ${n}`);-1===m&&(m=n);let c=a.slice(k,m);44===l?(e(f,c,g),g=Object.create(null)):b=c,k=m=-1}else throw SyntaxError(`Unexpected character at index ${n}`);else if(void 0===c)if(-1===m&&1===d[l])-1===k&&(k=n);else if(32===l||9===l)-1===m&&-1!==k&&(m=n);else if(59===l||44===l){if(-1===k)throw SyntaxError(`Unexpected character at index ${n}`);-1===m&&(m=n),e(g,a.slice(k,m),!0),44===l&&(e(f,b,g),g=Object.create(null),b=void 0),k=m=-1}else if(61===l&&-1!==k&&-1===m)c=a.slice(k,n),k=m=-1;else throw SyntaxError(`Unexpected character at index ${n}`);else if(i){if(1!==d[l])throw SyntaxError(`Unexpected character at index ${n}`);-1===k?k=n:h||(h=!0),i=!1}else if(j)if(1===d[l])-1===k&&(k=n);else if(34===l&&-1!==k)j=!1,m=n;else if(92===l)i=!0;else throw SyntaxError(`Unexpected character at index ${n}`);else if(34===l&&61===a.charCodeAt(n-1))j=!0;else if(-1===m&&1===d[l])-1===k&&(k=n);else if(-1!==k&&(32===l||9===l))-1===m&&(m=n);else if(59===l||44===l){if(-1===k)throw SyntaxError(`Unexpected character at index ${n}`);-1===m&&(m=n);let d=a.slice(k,m);h&&(d=d.replace(/\\/g,""),h=!1),e(g,c,d),44===l&&(e(f,b,g),g=Object.create(null),b=void 0),c=void 0,k=m=-1}else throw SyntaxError(`Unexpected character at index ${n}`);if(-1===k||j||32===l||9===l)throw SyntaxError("Unexpected end of input");-1===m&&(m=n);let o=a.slice(k,m);return void 0===b?e(f,o,g):(void 0===c?e(g,o,!0):h?e(g,c,o.replace(/\\/g,"")):e(g,c,o),e(f,b,g)),f}}},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},34631:a=>{"use strict";a.exports=require("tls")},38573:(a,b,c)=>{"use strict";c.d(b,{d:()=>g}),c(82146),c(24509),c(88634),c(13259),c(53455),c(72786);var d=c(80123);c(54351);let e=globalThis,f=e.__cockpitGlobalStateClients??(e.__cockpitGlobalStateClients=new Set);function g(a){let b=JSON.stringify(a);for(let a of f)a.readyState===d.OPEN&&a.send(b)}},39727:()=>{},41204:a=>{"use strict";a.exports=require("string_decoder")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},47990:()=>{},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},53455:(a,b,c)=>{"use strict";let d,{Duplex:e}=c(27910),{randomFillSync:f}=c(55511),{types:{isUint8Array:g}}=c(28354),h=c(88634),{EMPTY_BUFFER:i,kWebSocket:j,NOOP:k}=c(17165),{isBlob:l,isValidStatusCode:m}=c(97861),{mask:n,toBuffer:o}=c(6361),p=Symbol("kByteLength"),q=Buffer.alloc(4),r=8192;class s{constructor(a,b,c){this._extensions=b||{},c&&(this._generateMask=c,this._maskBuffer=Buffer.alloc(4)),this._socket=a,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=k,this[j]=void 0}static frame(a,b){let c,e,g=!1,h=2,i=!1;b.mask&&(c=b.maskBuffer||q,b.generateMask?b.generateMask(c):(8192===r&&(void 0===d&&(d=Buffer.alloc(8192)),f(d,0,8192),r=0),c[0]=d[r++],c[1]=d[r++],c[2]=d[r++],c[3]=d[r++]),i=(c[0]|c[1]|c[2]|c[3])==0,h=6),"string"==typeof a?e=(!b.mask||i)&&void 0!==b[p]?b[p]:(a=Buffer.from(a)).length:(e=a.length,g=b.mask&&b.readOnly&&!i);let j=e;e>=65536?(h+=8,j=127):e>125&&(h+=2,j=126);let k=Buffer.allocUnsafe(g?e+h:h);return(k[0]=b.fin?128|b.opcode:b.opcode,b.rsv1&&(k[0]|=64),k[1]=j,126===j?k.writeUInt16BE(e,2):127===j&&(k[2]=k[3]=0,k.writeUIntBE(e,4,6)),b.mask)?(k[1]|=128,k[h-4]=c[0],k[h-3]=c[1],k[h-2]=c[2],k[h-1]=c[3],i)?[k,a]:g?(n(a,c,k,h,e),[k]):(n(a,c,a,0,e),[k,a]):[k,a]}close(a,b,c,d){let e;if(void 0===a)e=i;else if("number"==typeof a&&m(a))if(void 0!==b&&b.length){let c=Buffer.byteLength(b);if(c>123)throw RangeError("The message must not be greater than 123 bytes");if((e=Buffer.allocUnsafe(2+c)).writeUInt16BE(a,0),"string"==typeof b)e.write(b,2);else if(g(b))e.set(b,2);else throw TypeError("Second argument must be a string or a Uint8Array")}else(e=Buffer.allocUnsafe(2)).writeUInt16BE(a,0);else throw TypeError("First argument must be a valid error code number");let f={[p]:e.length,fin:!0,generateMask:this._generateMask,mask:c,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};0!==this._state?this.enqueue([this.dispatch,e,!1,f,d]):this.sendFrame(s.frame(e,f),d)}ping(a,b,c){let d,e;if("string"==typeof a?(d=Buffer.byteLength(a),e=!1):l(a)?(d=a.size,e=!1):(d=(a=o(a)).length,e=o.readOnly),d>125)throw RangeError("The data size must not be greater than 125 bytes");let f={[p]:d,fin:!0,generateMask:this._generateMask,mask:b,maskBuffer:this._maskBuffer,opcode:9,readOnly:e,rsv1:!1};l(a)?0!==this._state?this.enqueue([this.getBlobData,a,!1,f,c]):this.getBlobData(a,!1,f,c):0!==this._state?this.enqueue([this.dispatch,a,!1,f,c]):this.sendFrame(s.frame(a,f),c)}pong(a,b,c){let d,e;if("string"==typeof a?(d=Buffer.byteLength(a),e=!1):l(a)?(d=a.size,e=!1):(d=(a=o(a)).length,e=o.readOnly),d>125)throw RangeError("The data size must not be greater than 125 bytes");let f={[p]:d,fin:!0,generateMask:this._generateMask,mask:b,maskBuffer:this._maskBuffer,opcode:10,readOnly:e,rsv1:!1};l(a)?0!==this._state?this.enqueue([this.getBlobData,a,!1,f,c]):this.getBlobData(a,!1,f,c):0!==this._state?this.enqueue([this.dispatch,a,!1,f,c]):this.sendFrame(s.frame(a,f),c)}send(a,b,c){let d,e,f=this._extensions[h.extensionName],g=b.binary?2:1,i=b.compress;"string"==typeof a?(d=Buffer.byteLength(a),e=!1):l(a)?(d=a.size,e=!1):(d=(a=o(a)).length,e=o.readOnly),this._firstFragment?(this._firstFragment=!1,i&&f&&f.params[f._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(i=d>=f._threshold),this._compress=i):(i=!1,g=0),b.fin&&(this._firstFragment=!0);let j={[p]:d,fin:b.fin,generateMask:this._generateMask,mask:b.mask,maskBuffer:this._maskBuffer,opcode:g,readOnly:e,rsv1:i};l(a)?0!==this._state?this.enqueue([this.getBlobData,a,this._compress,j,c]):this.getBlobData(a,this._compress,j,c):0!==this._state?this.enqueue([this.dispatch,a,this._compress,j,c]):this.dispatch(a,this._compress,j,c)}getBlobData(a,b,c,d){this._bufferedBytes+=c[p],this._state=2,a.arrayBuffer().then(a=>{if(this._socket.destroyed){let a=Error("The socket was closed while the blob was being read");process.nextTick(t,this,a,d);return}this._bufferedBytes-=c[p];let e=o(a);b?this.dispatch(e,b,c,d):(this._state=0,this.sendFrame(s.frame(e,c),d),this.dequeue())}).catch(a=>{process.nextTick(u,this,a,d)})}dispatch(a,b,c,d){if(!b)return void this.sendFrame(s.frame(a,c),d);let e=this._extensions[h.extensionName];this._bufferedBytes+=c[p],this._state=1,e.compress(a,c.fin,(a,b)=>{this._socket.destroyed?t(this,Error("The socket was closed while data was being compressed"),d):(this._bufferedBytes-=c[p],this._state=0,c.readOnly=!1,this.sendFrame(s.frame(b,c),d),this.dequeue())})}dequeue(){for(;0===this._state&&this._queue.length;){let a=this._queue.shift();this._bufferedBytes-=a[3][p],Reflect.apply(a[0],this,a.slice(1))}}enqueue(a){this._bufferedBytes+=a[3][p],this._queue.push(a)}sendFrame(a,b){2===a.length?(this._socket.cork(),this._socket.write(a[0]),this._socket.write(a[1],b),this._socket.uncork()):this._socket.write(a[0],b)}}function t(a,b,c){"function"==typeof c&&c(b);for(let c=0;c<a._queue.length;c++){let d=a._queue[c],e=d[d.length-1];"function"==typeof e&&e(b)}}function u(a,b,c){t(a,b,c),a.onerror(b)}a.exports=s},54351:(a,b,c)=>{"use strict";let d=c(94735),e=c(81630),{Duplex:f}=c(27910),{createHash:g}=c(55511),h=c(24509),i=c(88634),j=c(72786),k=c(80123),{CLOSE_TIMEOUT:l,GUID:m,kWebSocket:n}=c(17165),o=/^[+/0-9A-Za-z]{22}==$/;class p extends d{constructor(a,b){if(super(),null==(a={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1048576,maxFragments:131072,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:l,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:k,...a}).port&&!a.server&&!a.noServer||null!=a.port&&(a.server||a.noServer)||a.server&&a.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=a.port?(this._server=e.createServer((a,b)=>{let c=e.STATUS_CODES[426];b.writeHead(426,{"Content-Length":c.length,"Content-Type":"text/plain"}),b.end(c)}),this._server.listen(a.port,a.host,a.backlog,b)):a.server&&(this._server=a.server),this._server){const a=this.emit.bind(this,"connection");this._removeListeners=function(a,b){for(let c of Object.keys(b))a.on(c,b[c]);return function(){for(let c of Object.keys(b))a.removeListener(c,b[c])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(b,c,d)=>{this.handleUpgrade(b,c,d,a)}})}!0===a.perMessageDeflate&&(a.perMessageDeflate={}),a.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=a,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(a){if(2===this._state){a&&this.once("close",()=>{a(Error("The server is not running"))}),process.nextTick(q,this);return}if(a&&this.once("close",a),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(q,this);else{let a=this._server;this._removeListeners(),this._removeListeners=this._server=null,a.close(()=>{q(this)})}}shouldHandle(a){if(this.options.path){let b=a.url.indexOf("?");if((-1!==b?a.url.slice(0,b):a.url)!==this.options.path)return!1}return!0}handleUpgrade(a,b,c,d){b.on("error",r);let e=a.headers["sec-websocket-key"],f=a.headers.upgrade,g=+a.headers["sec-websocket-version"];if("GET"!==a.method)return void t(this,a,b,405,"Invalid HTTP method");if(void 0===f||"websocket"!==f.toLowerCase())return void t(this,a,b,400,"Invalid Upgrade header");if(void 0===e||!o.test(e))return void t(this,a,b,400,"Missing or invalid Sec-WebSocket-Key header");if(13!==g&&8!==g)return void t(this,a,b,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});if(!this.shouldHandle(a))return void s(b,400);let k=a.headers["sec-websocket-protocol"],l=new Set;if(void 0!==k)try{l=j.parse(k)}catch(c){t(this,a,b,400,"Invalid Sec-WebSocket-Protocol header");return}let m=a.headers["sec-websocket-extensions"],n={};if(this.options.perMessageDeflate&&void 0!==m){let c=new i({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let a=h.parse(m);a[i.extensionName]&&(c.accept(a[i.extensionName]),n[i.extensionName]=c)}catch(c){t(this,a,b,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let f={origin:a.headers[`${8===g?"sec-websocket-origin":"origin"}`],secure:!!(a.socket.authorized||a.socket.encrypted),req:a};if(2===this.options.verifyClient.length)return void this.options.verifyClient(f,(f,g,h,i)=>{if(!f)return s(b,g||401,h,i);this.completeUpgrade(n,e,l,a,b,c,d)});if(!this.options.verifyClient(f))return s(b,401)}this.completeUpgrade(n,e,l,a,b,c,d)}completeUpgrade(a,b,c,d,e,f,j){if(!e.readable||!e.writable)return e.destroy();if(e[n])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return s(e,503);let k=g("sha1").update(b+m).digest("base64"),l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${k}`],o=new this.options.WebSocket(null,void 0,this.options);if(c.size){let a=this.options.handleProtocols?this.options.handleProtocols(c,d):c.values().next().value;a&&(l.push(`Sec-WebSocket-Protocol: ${a}`),o._protocol=a)}if(a[i.extensionName]){let b=a[i.extensionName].params,c=h.format({[i.extensionName]:[b]});l.push(`Sec-WebSocket-Extensions: ${c}`),o._extensions=a}this.emit("headers",l,d),e.write(l.concat("\r\n").join("\r\n")),e.removeListener("error",r),o.setSocket(e,f,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(o),o.on("close",()=>{this.clients.delete(o),this._shouldEmitClose&&!this.clients.size&&process.nextTick(q,this)})),j(o,d)}}function q(a){a._state=2,a.emit("close")}function r(){this.destroy()}function s(a,b,c,d){c=c||e.STATUS_CODES[b],d={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(c),...d},a.once("finish",a.destroy),a.end(`HTTP/1.1 ${b} ${e.STATUS_CODES[b]}\r
|
|
2
|
+
`+Object.keys(d).map(a=>`${a}: ${d[a]}`).join("\r\n")+"\r\n\r\n"+c)}function t(a,b,c,d,e,f){if(a.listenerCount("wsClientError")){let d=Error(e);Error.captureStackTrace(d,t),a.emit("wsClientError",d,c,b)}else s(c,d,e,f)}a.exports=p},55511:a=>{"use strict";a.exports=require("crypto")},55591:a=>{"use strict";a.exports=require("https")},58336:(a,b,c)=>{"use strict";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(62105),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/project-state/route",pathname:"/api/project-state",filename:"route",bundlePath:"app/api/project-state/route"},distDir:".next-prod",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/cockpit/cockpit/src/app/api/project-state/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/project-state/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)}})},62105:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>k,POST:()=>l});var e=c(89705),f=c(7939),g=c(72891),h=c(770),i=c(38573),j=a([g]);g=(j.then?(await j)():j)[0];let k=(0,g.RL)(a=>e.JkU(function*(){let b=new URL(a.url).searchParams.get("cwd");if(!b)return yield*e.fJG(new h.yI({field:"cwd",reason:"missing"}));let c=(0,f.Mx)(b),d=yield*e.$mh({try:()=>(0,f.JE)(c,{sessions:[]}),catch:a=>new h.uU({path:c,op:"read",cause:a})});return(0,g.ok)(d)})),l=(0,g.RL)(a=>e.JkU(function*(){let b=yield*(0,g.k9)(a);if(!b.cwd)return yield*e.fJG(new h.yI({field:"cwd",reason:"missing"}));if(!Array.isArray(b.sessions))return yield*e.fJG(new h.yI({field:"sessions",reason:"must be array"}));let c=b.cwd,d=b.sessions,j=b.closedSessionIds??[],k=(0,f.Mx)(c),l=yield*e.$mh({try:()=>(0,f.Ux)(k,async()=>{let a=await (0,f.JE)(k,{sessions:[]}),c=new Set(j),e=[];for(let b of[...a.sessions,...d])c.has(b)||e.includes(b)||e.push(b);let g=new Set(e),h=(a,b)=>{let c={...a??{},...b??{}};for(let a of Object.keys(c))g.has(a)||delete c[a];return c},i=h(a.engines,b.engines),l=h(a.ollamaModels,b.ollamaModels),m=h(a.deepseekModels,b.deepseekModels),n=h(a.chatModes,b.chatModes),o=h(a.planModes,b.planModes),p=b.activeSessionId??a.activeSessionId,q={sessions:e,...p&&g.has(p)?{activeSessionId:p}:{},...Object.keys(i).length?{engines:i}:{},...Object.keys(l).length?{ollamaModels:l}:{},...Object.keys(m).length?{deepseekModels:m}:{},...Object.keys(n).length?{chatModes:n}:{},...Object.keys(o).length?{planModes:o}:{}};return await (0,f.An)(k,q),q}),catch:a=>new h.uU({path:k,op:"write",cause:a})});return yield*e.OH5(()=>(0,i.d)({type:"project-state-changed",cwd:c,closedSessionIds:j})),(0,g.ok)(l)}));d()}catch(a){d(a)}})},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{"use strict";a.exports=import("pg")},66136:a=>{"use strict";a.exports=require("timers")},72786:(a,b,c)=>{"use strict";let{tokenChars:d}=c(97861);a.exports={parse:function(a){let b=new Set,c=-1,e=-1,f=0;for(;f<a.length;f++){let g=a.charCodeAt(f);if(-1===e&&1===d[g])-1===c&&(c=f);else if(0!==f&&(32===g||9===g))-1===e&&-1!==c&&(e=f);else if(44===g){if(-1===c)throw SyntaxError(`Unexpected character at index ${f}`);-1===e&&(e=f);let d=a.slice(c,e);if(b.has(d))throw SyntaxError(`The "${d}" subprotocol is duplicated`);b.add(d),c=e=-1}else throw SyntaxError(`Unexpected character at index ${f}`)}if(-1===c||-1!==e)throw SyntaxError("Unexpected end of input");let g=a.slice(c,f);if(b.has(g))throw SyntaxError(`The "${g}" subprotocol is duplicated`);return b.add(g),b}}},72891:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{OZ:()=>o,RL:()=>n,k9:()=>p,ok:()=>l});var e=c(37625),f=c(52693),g=c(18412),h=c(89705),i=c(94506),j=c(770),k=a([i]);i=(k.then?(await k)():k)[0];let l=(a,b=200)=>new Response(JSON.stringify(a),{status:b,headers:{"content-type":"application/json"}}),m=a=>{let b=e.od(a);if(f.Ru(b)){let a=b.value,c=(0,j.Sh)(a);return new Response(JSON.stringify({error:(a=>{let b=a.message;if("string"==typeof b&&b.length>0)return b;let c=a.cause;if(c instanceof Error&&c.message.length>0)return c.message;switch(a._tag){case"ValidationError":return`Invalid ${a.field}: ${a.reason}`;case"NotFoundError":return`${a.resource} not found: ${a.id}`;case"PermissionError":return`Permission denied: ${a.action} on ${a.resource}`;case"DBError":return`${a.db} ${a.op} failed`;case"FSError":return`${a.op} ${a.path} failed`;case"WSError":return`${a.proto} ${a.kind} failed`;case"AgentError":return`${a.provider} ${a.kind} failed`;default:return a._tag}})(a),tag:a._tag}),{status:c,headers:{"content-type":"application/json"}})}return console.error("[handler] uncaught defect:\n"+e.j9(a)),new Response(JSON.stringify({error:"Internal Server Error",tag:"InternalError"}),{status:500,headers:{"content-type":"application/json"}})},n=a=>async b=>{let c=await i.s9.runPromiseExit(a(b));return g.YW(c,{onFailure:a=>m(a),onSuccess:a=>a})},o=a=>async(b,c)=>{let d=await c.params,e=await i.s9.runPromiseExit(a(b,d));return g.YW(e,{onFailure:a=>m(a),onSuccess:a=>a})},p=a=>h.$mh({try:()=>a.json(),catch:()=>new j.yI({field:"body",reason:"invalid JSON"})});d()}catch(a){d(a)}})},74075:a=>{"use strict";a.exports=require("zlib")},78900:(a,b,c)=>{"use strict";let{kForOnEventAttribute:d,kListener:e}=c(17165),f=Symbol("kCode"),g=Symbol("kData"),h=Symbol("kError"),i=Symbol("kMessage"),j=Symbol("kReason"),k=Symbol("kTarget"),l=Symbol("kType"),m=Symbol("kWasClean");class n{constructor(a){this[k]=null,this[l]=a}get target(){return this[k]}get type(){return this[l]}}Object.defineProperty(n.prototype,"target",{enumerable:!0}),Object.defineProperty(n.prototype,"type",{enumerable:!0});class o extends n{constructor(a,b={}){super(a),this[f]=void 0===b.code?0:b.code,this[j]=void 0===b.reason?"":b.reason,this[m]=void 0!==b.wasClean&&b.wasClean}get code(){return this[f]}get reason(){return this[j]}get wasClean(){return this[m]}}Object.defineProperty(o.prototype,"code",{enumerable:!0}),Object.defineProperty(o.prototype,"reason",{enumerable:!0}),Object.defineProperty(o.prototype,"wasClean",{enumerable:!0});class p extends n{constructor(a,b={}){super(a),this[h]=void 0===b.error?null:b.error,this[i]=void 0===b.message?"":b.message}get error(){return this[h]}get message(){return this[i]}}Object.defineProperty(p.prototype,"error",{enumerable:!0}),Object.defineProperty(p.prototype,"message",{enumerable:!0});class q extends n{constructor(a,b={}){super(a),this[g]=void 0===b.data?null:b.data}get data(){return this[g]}}function r(a,b,c){"object"==typeof a&&a.handleEvent?a.handleEvent.call(a,c):a.call(b,c)}Object.defineProperty(q.prototype,"data",{enumerable:!0}),a.exports={CloseEvent:o,ErrorEvent:p,Event:n,EventTarget:{addEventListener(a,b,c={}){let f;for(let f of this.listeners(a))if(!c[d]&&f[e]===b&&!f[d])return;if("message"===a)f=function(a,c){let d=new q("message",{data:c?a:a.toString()});d[k]=this,r(b,this,d)};else if("close"===a)f=function(a,c){let d=new o("close",{code:a,reason:c.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});d[k]=this,r(b,this,d)};else if("error"===a)f=function(a){let c=new p("error",{error:a,message:a.message});c[k]=this,r(b,this,c)};else{if("open"!==a)return;f=function(){let a=new n("open");a[k]=this,r(b,this,a)}}f[d]=!!c[d],f[e]=b,c.once?this.once(a,f):this.on(a,f)},removeEventListener(a,b){for(let c of this.listeners(a))if(c[e]===b&&!c[d]){this.removeListener(a,c);break}}},MessageEvent:q}},79428:a=>{"use strict";a.exports=require("buffer")},79646:a=>{"use strict";a.exports=require("child_process")},79748:a=>{"use strict";a.exports=require("fs/promises")},80123:(a,b,c)=>{"use strict";let d=c(94735),e=c(55591),f=c(81630),g=c(91645),h=c(34631),{randomBytes:i,createHash:j}=c(55511),{Duplex:k,Readable:l}=c(27910),{URL:m}=c(1932),n=c(88634),o=c(13259),p=c(53455),{isBlob:q}=c(97861),{BINARY_TYPES:r,CLOSE_TIMEOUT:s,EMPTY_BUFFER:t,GUID:u,kForOnEventAttribute:v,kListener:w,kStatusCode:x,kWebSocket:y,NOOP:z}=c(17165),{EventTarget:{addEventListener:A,removeEventListener:B}}=c(78900),{format:C,parse:D}=c(24509),{toBuffer:E}=c(6361),F=Symbol("kAborted"),G=[8,13],H=["CONNECTING","OPEN","CLOSING","CLOSED"],I=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class J extends d{constructor(a,b,c){super(),this._binaryType=r[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=t,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=J.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==a?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===b?b=[]:Array.isArray(b)||("object"==typeof b&&null!==b?(c=b,b=[]):b=[b]),function a(b,c,d,g){let h,k,l,o,p={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:s,protocolVersion:G[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...g,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(b._autoPong=p.autoPong,b._closeTimeout=p.closeTimeout,!G.includes(p.protocolVersion))throw RangeError(`Unsupported protocol version: ${p.protocolVersion} (supported versions: ${G.join(", ")})`);if(c instanceof m)h=c;else try{h=new m(c)}catch{throw SyntaxError(`Invalid URL: ${c}`)}"http:"===h.protocol?h.protocol="ws:":"https:"===h.protocol&&(h.protocol="wss:"),b._url=h.href;let q="wss:"===h.protocol,r="ws+unix:"===h.protocol;if("ws:"===h.protocol||q||r?r&&!h.pathname?k="The URL's pathname is empty":h.hash&&(k="The URL contains a fragment identifier"):k='The URL\'s protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"',k){let a=SyntaxError(k);if(0!==b._redirects)return void K(b,a);throw a}let t=q?443:80,v=i(16).toString("base64"),w=q?e.request:f.request,x=new Set;if(p.createConnection=p.createConnection||(q?M:L),p.defaultPort=p.defaultPort||t,p.port=h.port||t,p.host=h.hostname.startsWith("[")?h.hostname.slice(1,-1):h.hostname,p.headers={...p.headers,"Sec-WebSocket-Version":p.protocolVersion,"Sec-WebSocket-Key":v,Connection:"Upgrade",Upgrade:"websocket"},p.path=h.pathname+h.search,p.timeout=p.handshakeTimeout,p.perMessageDeflate&&(l=new n({...p.perMessageDeflate,isServer:!1,maxPayload:p.maxPayload}),p.headers["Sec-WebSocket-Extensions"]=C({[n.extensionName]:l.offer()})),d.length){for(let a of d){if("string"!=typeof a||!I.test(a)||x.has(a))throw SyntaxError("An invalid or duplicated subprotocol was specified");x.add(a)}p.headers["Sec-WebSocket-Protocol"]=d.join(",")}if(p.origin&&(p.protocolVersion<13?p.headers["Sec-WebSocket-Origin"]=p.origin:p.headers.Origin=p.origin),(h.username||h.password)&&(p.auth=`${h.username}:${h.password}`),r){let a=p.path.split(":");p.socketPath=a[0],p.path=a[1]}if(p.followRedirects){if(0===b._redirects){b._originalIpc=r,b._originalSecure=q,b._originalHostOrSocketPath=r?p.socketPath:h.host;let a=g&&g.headers;if(g={...g,headers:{}},a)for(let[b,c]of Object.entries(a))g.headers[b.toLowerCase()]=c}else if(0===b.listenerCount("redirect")){let a=r?!!b._originalIpc&&p.socketPath===b._originalHostOrSocketPath:!b._originalIpc&&h.host===b._originalHostOrSocketPath;a&&(!b._originalSecure||q)||(delete p.headers.authorization,delete p.headers.cookie,a||delete p.headers.host,p.auth=void 0)}p.auth&&!g.headers.authorization&&(g.headers.authorization="Basic "+Buffer.from(p.auth).toString("base64")),o=b._req=w(p),b._redirects&&b.emit("redirect",b.url,o)}else o=b._req=w(p);p.timeout&&o.on("timeout",()=>{N(b,o,"Opening handshake has timed out")}),o.on("error",a=>{null===o||o[F]||(o=b._req=null,K(b,a))}),o.on("response",e=>{let f=e.headers.location,h=e.statusCode;if(f&&p.followRedirects&&h>=300&&h<400){let e;if(++b._redirects>p.maxRedirects)return void N(b,o,"Maximum redirects exceeded");o.abort();try{e=new m(f,c)}catch(a){K(b,SyntaxError(`Invalid URL: ${f}`));return}a(b,e,d,g)}else b.emit("unexpected-response",o,e)||N(b,o,`Unexpected server response: ${e.statusCode}`)}),o.on("upgrade",(a,c,d)=>{let e;if(b.emit("upgrade",a),b.readyState!==J.CONNECTING)return;o=b._req=null;let f=a.headers.upgrade;if(void 0===f||"websocket"!==f.toLowerCase())return void N(b,c,"Invalid Upgrade header");let g=j("sha1").update(v+u).digest("base64");if(a.headers["sec-websocket-accept"]!==g)return void N(b,c,"Invalid Sec-WebSocket-Accept header");let h=a.headers["sec-websocket-protocol"];if(void 0!==h?x.size?x.has(h)||(e="Server sent an invalid subprotocol"):e="Server sent a subprotocol but none was requested":x.size&&(e="Server sent no subprotocol"),e)return void N(b,c,e);h&&(b._protocol=h);let i=a.headers["sec-websocket-extensions"];if(void 0!==i){let a;if(!l)return void N(b,c,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");try{a=D(i)}catch(a){N(b,c,"Invalid Sec-WebSocket-Extensions header");return}let d=Object.keys(a);if(1!==d.length||d[0]!==n.extensionName)return void N(b,c,"Server indicated an extension that was not requested");try{l.accept(a[n.extensionName])}catch(a){N(b,c,"Invalid Sec-WebSocket-Extensions header");return}b._extensions[n.extensionName]=l}b.setSocket(c,d,{allowSynchronousEvents:p.allowSynchronousEvents,generateMask:p.generateMask,maxBufferedChunks:p.maxBufferedChunks,maxFragments:p.maxFragments,maxPayload:p.maxPayload,skipUTF8Validation:p.skipUTF8Validation})}),p.finishRequest?p.finishRequest(o,b):o.end()}(this,a,b,c)):(this._autoPong=c.autoPong,this._closeTimeout=c.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(a){r.includes(a)&&(this._binaryType=a,this._receiver&&(this._receiver._binaryType=a))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(a,b,c){let d=new o({allowSynchronousEvents:c.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:c.maxBufferedChunks,maxFragments:c.maxFragments,maxPayload:c.maxPayload,skipUTF8Validation:c.skipUTF8Validation}),e=new p(a,this._extensions,c.generateMask);this._receiver=d,this._sender=e,this._socket=a,d[y]=this,e[y]=this,a[y]=this,d.on("conclude",P),d.on("drain",Q),d.on("error",R),d.on("message",T),d.on("ping",U),d.on("pong",V),e.onerror=X,a.setTimeout&&a.setTimeout(0),a.setNoDelay&&a.setNoDelay(),b.length>0&&a.unshift(b),a.on("close",Z),a.on("data",$),a.on("end",_),a.on("error",aa),this._readyState=J.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=J.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[n.extensionName]&&this._extensions[n.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=J.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(a,b){if(this.readyState!==J.CLOSED){if(this.readyState===J.CONNECTING)return void N(this,this._req,"WebSocket was closed before the connection was established");if(this.readyState===J.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=J.CLOSING,this._sender.close(a,b,!this._isServer,a=>{!a&&(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Y(this)}}pause(){this.readyState!==J.CONNECTING&&this.readyState!==J.CLOSED&&(this._paused=!0,this._socket.pause())}ping(a,b,c){if(this.readyState===J.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof a?(c=a,a=b=void 0):"function"==typeof b&&(c=b,b=void 0),"number"==typeof a&&(a=a.toString()),this.readyState!==J.OPEN)?O(this,a,c):(void 0===b&&(b=!this._isServer),this._sender.ping(a||t,b,c))}pong(a,b,c){if(this.readyState===J.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof a?(c=a,a=b=void 0):"function"==typeof b&&(c=b,b=void 0),"number"==typeof a&&(a=a.toString()),this.readyState!==J.OPEN)?O(this,a,c):(void 0===b&&(b=!this._isServer),this._sender.pong(a||t,b,c))}resume(){this.readyState!==J.CONNECTING&&this.readyState!==J.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(a,b,c){if(this.readyState===J.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof b&&(c=b,b={}),"number"==typeof a&&(a=a.toString()),this.readyState!==J.OPEN)return void O(this,a,c);let d={binary:"string"!=typeof a,mask:!this._isServer,compress:!0,fin:!0,...b};this._extensions[n.extensionName]||(d.compress=!1),this._sender.send(a||t,d,c)}terminate(){if(this.readyState!==J.CLOSED){if(this.readyState===J.CONNECTING)return void N(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=J.CLOSING,this._socket.destroy())}}}function K(a,b){a._readyState=J.CLOSING,a._errorEmitted=!0,a.emit("error",b),a.emitClose()}function L(a){return a.path=a.socketPath,g.connect(a)}function M(a){return a.path=void 0,a.servername||""===a.servername||(a.servername=g.isIP(a.host)?"":a.host),h.connect(a)}function N(a,b,c){a._readyState=J.CLOSING;let d=Error(c);Error.captureStackTrace(d,N),b.setHeader?(b[F]=!0,b.abort(),b.socket&&!b.socket.destroyed&&b.socket.destroy(),process.nextTick(K,a,d)):(b.destroy(d),b.once("error",a.emit.bind(a,"error")),b.once("close",a.emitClose.bind(a)))}function O(a,b,c){if(b){let c=q(b)?b.size:E(b).length;a._socket?a._sender._bufferedBytes+=c:a._bufferedAmount+=c}if(c){let b=Error(`WebSocket is not open: readyState ${a.readyState} (${H[a.readyState]})`);process.nextTick(c,b)}}function P(a,b){let c=this[y];c._closeFrameReceived=!0,c._closeMessage=b,c._closeCode=a,void 0!==c._socket[y]&&(c._socket.removeListener("data",$),process.nextTick(W,c._socket),1005===a?c.close():c.close(a,b))}function Q(){let a=this[y];a.isPaused||a._socket.resume()}function R(a){let b=this[y];void 0!==b._socket[y]&&(b._socket.removeListener("data",$),process.nextTick(W,b._socket),b.close(a[x])),b._errorEmitted||(b._errorEmitted=!0,b.emit("error",a))}function S(){this[y].emitClose()}function T(a,b){this[y].emit("message",a,b)}function U(a){let b=this[y];b._autoPong&&b.pong(a,!this._isServer,z),b.emit("ping",a)}function V(a){this[y].emit("pong",a)}function W(a){a.resume()}function X(a){let b=this[y];b.readyState!==J.CLOSED&&(b.readyState===J.OPEN&&(b._readyState=J.CLOSING,Y(b)),this._socket.end(),b._errorEmitted||(b._errorEmitted=!0,b.emit("error",a)))}function Y(a){a._closeTimer=setTimeout(a._socket.destroy.bind(a._socket),a._closeTimeout)}function Z(){let a=this[y];if(this.removeListener("close",Z),this.removeListener("data",$),this.removeListener("end",_),a._readyState=J.CLOSING,!this._readableState.endEmitted&&!a._closeFrameReceived&&!a._receiver._writableState.errorEmitted&&0!==this._readableState.length){let b=this.read(this._readableState.length);a._receiver.write(b)}a._receiver.end(),this[y]=void 0,clearTimeout(a._closeTimer),a._receiver._writableState.finished||a._receiver._writableState.errorEmitted?a.emitClose():(a._receiver.on("error",S),a._receiver.on("finish",S))}function $(a){this[y]._receiver.write(a)||this.pause()}function _(){let a=this[y];a._readyState=J.CLOSING,a._receiver.end(),this.end()}function aa(){let a=this[y];this.removeListener("error",aa),this.on("error",z),a&&(a._readyState=J.CLOSING,this.destroy())}Object.defineProperty(J,"CONNECTING",{enumerable:!0,value:H.indexOf("CONNECTING")}),Object.defineProperty(J.prototype,"CONNECTING",{enumerable:!0,value:H.indexOf("CONNECTING")}),Object.defineProperty(J,"OPEN",{enumerable:!0,value:H.indexOf("OPEN")}),Object.defineProperty(J.prototype,"OPEN",{enumerable:!0,value:H.indexOf("OPEN")}),Object.defineProperty(J,"CLOSING",{enumerable:!0,value:H.indexOf("CLOSING")}),Object.defineProperty(J.prototype,"CLOSING",{enumerable:!0,value:H.indexOf("CLOSING")}),Object.defineProperty(J,"CLOSED",{enumerable:!0,value:H.indexOf("CLOSED")}),Object.defineProperty(J.prototype,"CLOSED",{enumerable:!0,value:H.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(a=>{Object.defineProperty(J.prototype,a,{enumerable:!0})}),["open","error","close","message"].forEach(a=>{Object.defineProperty(J.prototype,`on${a}`,{enumerable:!0,get(){for(let b of this.listeners(a))if(b[v])return b[w];return null},set(b){for(let b of this.listeners(a))if(b[v]){this.removeListener(a,b);break}"function"==typeof b&&this.addEventListener(a,b,{[v]:!0})}})}),J.prototype.addEventListener=A,J.prototype.removeEventListener=B,a.exports=J},81630:a=>{"use strict";a.exports=require("http")},82146:(a,b,c)=>{"use strict";c(80123);let{Duplex:d}=c(27910);function e(a){a.emit("close")}function f(){!this.destroyed&&this._writableState.finished&&this.destroy()}function g(a){this.removeListener("error",g),this.destroy(),0===this.listenerCount("error")&&this.emit("error",a)}a.exports=function(a,b){let c=!0,h=new d({...b,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return a.on("message",function(b,c){let d=!c&&h._readableState.objectMode?b.toString():b;h.push(d)||a.pause()}),a.once("error",function(a){h.destroyed||(c=!1,h.destroy(a))}),a.once("close",function(){h.destroyed||h.push(null)}),h._destroy=function(b,d){if(a.readyState===a.CLOSED){d(b),process.nextTick(e,h);return}let f=!1;a.once("error",function(a){f=!0,d(a)}),a.once("close",function(){f||d(b),process.nextTick(e,h)}),c&&a.terminate()},h._final=function(b){a.readyState===a.CONNECTING?a.once("open",function(){h._final(b)}):null!==a._socket&&(a._socket._writableState.finished?(b(),h._readableState.endEmitted&&h.destroy()):(a._socket.once("finish",function(){b()}),a.close()))},h._read=function(){a.isPaused&&a.resume()},h._write=function(b,c,d){a.readyState===a.CONNECTING?a.once("open",function(){h._write(b,c,d)}):a.send(b,d)},h.on("end",f),h.on("error",g),h}},83997:a=>{"use strict";a.exports=require("tty")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},88634:(a,b,c)=>{"use strict";let d,e=c(74075),f=c(6361),g=c(89672),{kStatusCode:h}=c(17165),i=Buffer[Symbol.species],j=Buffer.from([0,0,255,255]),k=Symbol("permessage-deflate"),l=Symbol("total-length"),m=Symbol("callback"),n=Symbol("buffers"),o=Symbol("error");class p{constructor(a){this._options=a||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._maxPayload=0|this._options.maxPayload,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,d||(d=new g(void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10))}static get extensionName(){return"permessage-deflate"}offer(){let a={};return this._options.serverNoContextTakeover&&(a.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(a.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(a.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?a.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(a.client_max_window_bits=!0),a}accept(a){return a=this.normalizeParams(a),this.params=this._isServer?this.acceptAsServer(a):this.acceptAsClient(a),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let a=this._deflate[m];this._deflate.close(),this._deflate=null,a&&a(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(a){let b=this._options,c=a.find(a=>(!1!==b.serverNoContextTakeover||!a.server_no_context_takeover)&&(!a.server_max_window_bits||!1!==b.serverMaxWindowBits&&("number"!=typeof b.serverMaxWindowBits||!(b.serverMaxWindowBits>a.server_max_window_bits)))&&("number"!=typeof b.clientMaxWindowBits||!!a.client_max_window_bits));if(!c)throw Error("None of the extension offers can be accepted");return b.serverNoContextTakeover&&(c.server_no_context_takeover=!0),b.clientNoContextTakeover&&(c.client_no_context_takeover=!0),"number"==typeof b.serverMaxWindowBits&&(c.server_max_window_bits=b.serverMaxWindowBits),"number"==typeof b.clientMaxWindowBits?c.client_max_window_bits=b.clientMaxWindowBits:(!0===c.client_max_window_bits||!1===b.clientMaxWindowBits)&&delete c.client_max_window_bits,c}acceptAsClient(a){let b=a[0];if(!1===this._options.clientNoContextTakeover&&b.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(b.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&b.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(b.client_max_window_bits=this._options.clientMaxWindowBits);return b}normalizeParams(a){return a.forEach(a=>{Object.keys(a).forEach(b=>{let c=a[b];if(c.length>1)throw Error(`Parameter "${b}" must have only a single value`);if(c=c[0],"client_max_window_bits"===b){if(!0!==c){let a=+c;if(!Number.isInteger(a)||a<8||a>15)throw TypeError(`Invalid value for parameter "${b}": ${c}`);c=a}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${b}": ${c}`)}else if("server_max_window_bits"===b){let a=+c;if(!Number.isInteger(a)||a<8||a>15)throw TypeError(`Invalid value for parameter "${b}": ${c}`);c=a}else if("client_no_context_takeover"===b||"server_no_context_takeover"===b){if(!0!==c)throw TypeError(`Invalid value for parameter "${b}": ${c}`)}else throw Error(`Unknown parameter "${b}"`);a[b]=c})}),a}decompress(a,b,c){d.add(d=>{this._decompress(a,b,(a,b)=>{d(),c(a,b)})})}compress(a,b,c){d.add(d=>{this._compress(a,b,(a,b)=>{d(),c(a,b)})})}_decompress(a,b,c){let d=this._isServer?"client":"server";if(!this._inflate){let a=`${d}_max_window_bits`,b="number"!=typeof this.params[a]?e.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=e.createInflateRaw({...this._options.zlibInflateOptions,windowBits:b}),this._inflate[k]=this,this._inflate[l]=0,this._inflate[n]=[],this._inflate.on("error",s),this._inflate.on("data",r)}this._inflate[m]=c,this._inflate.write(a),b&&this._inflate.write(j),this._inflate.flush(()=>{let a=this._inflate[o];if(a){this._inflate.close(),this._inflate=null,c(a);return}let e=f.concat(this._inflate[n],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[n]=[],b&&this.params[`${d}_no_context_takeover`]&&this._inflate.reset()),c(null,e)})}_compress(a,b,c){let d=this._isServer?"server":"client";if(!this._deflate){let a=`${d}_max_window_bits`,b="number"!=typeof this.params[a]?e.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=e.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:b}),this._deflate[l]=0,this._deflate[n]=[],this._deflate.on("data",q)}this._deflate[m]=c,this._deflate.write(a),this._deflate.flush(e.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=f.concat(this._deflate[n],this._deflate[l]);b&&(a=new i(a.buffer,a.byteOffset,a.length-4)),this._deflate[m]=null,this._deflate[l]=0,this._deflate[n]=[],b&&this.params[`${d}_no_context_takeover`]&&this._deflate.reset(),c(null,a)})}}function q(a){this[n].push(a),this[l]+=a.length}function r(a){(this[l]+=a.length,this[k]._maxPayload<1||this[l]<=this[k]._maxPayload)?this[n].push(a):(this[o]=RangeError("Max payload size exceeded"),this[o].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[o][h]=1009,this.removeListener("data",r),this.reset())}function s(a){(this[k]._inflate=null,this[o])?this[m](this[o]):(a[h]=1007,this[m](a))}a.exports=p},89672:a=>{"use strict";let b=Symbol("kDone"),c=Symbol("kRun");class d{constructor(a){this[b]=()=>{this.pending--,this[c]()},this.concurrency=a||1/0,this.jobs=[],this.pending=0}add(a){this.jobs.push(a),this[c]()}[c](){if(this.pending!==this.concurrency&&this.jobs.length){let a=this.jobs.shift();this.pending++,a(this[b])}}}a.exports=d},91645:a=>{"use strict";a.exports=require("net")},94735:a=>{"use strict";a.exports=require("events")},97861:(a,b,c)=>{"use strict";let{isUtf8:d}=c(79428),{hasBlob:e}=c(17165);function f(a){let b=a.length,c=0;for(;c<b;)if((128&a[c])==0)c++;else if((224&a[c])==192){if(c+1===b||(192&a[c+1])!=128||(254&a[c])==192)return!1;c+=2}else if((240&a[c])==224){if(c+2>=b||(192&a[c+1])!=128||(192&a[c+2])!=128||224===a[c]&&(224&a[c+1])==128||237===a[c]&&(224&a[c+1])==160)return!1;c+=3}else{if((248&a[c])!=240||c+3>=b||(192&a[c+1])!=128||(192&a[c+2])!=128||(192&a[c+3])!=128||240===a[c]&&(240&a[c+1])==128||244===a[c]&&a[c+1]>143||a[c]>244)return!1;c+=4}return!0}if(a.exports={isBlob:function(a){return e&&"object"==typeof a&&"function"==typeof a.arrayBuffer&&"string"==typeof a.type&&"function"==typeof a.stream&&("Blob"===a[Symbol.toStringTag]||"File"===a[Symbol.toStringTag])},isValidStatusCode:function(a){return a>=1e3&&a<=1014&&1004!==a&&1005!==a&&1006!==a||a>=3e3&&a<=4999},isValidUTF8:f,tokenChars:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0]},d)a.exports.isValidUTF8=function(a){return a.length<24?f(a):d(a)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let b=c(47990);a.exports.isValidUTF8=function(a){return a.length<32?f(a):b(a)}}catch(a){}}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,7184,304],()=>b(b.s=58336));module.exports=c})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var a={};a.id=8834,a.ids=[8834],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{a.exports=require("url")},4573:a=>{a.exports=require("node:buffer")},4984:a=>{a.exports=require("readline")},6727:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{D9:()=>o,LO:()=>n,OR:()=>l,SJ:()=>p,fA:()=>k,fG:()=>m});var e=c(89705),f=c(56825),g=c(72891),h=c(770),i=c(88503),j=a([g,i,f]);[g,i,f]=j.then?(await j)():j;let k="nodejs",l="force-dynamic",m=(0,g.RL)(()=>e.JkU(function*(){let a=yield*i.Uu;return(0,g.ok)(a)})),n=(0,g.RL)(a=>e.JkU(function*(){let b,{cwd:c,tabId:d,sessionId:j,engine:k,model:l,message:m,type:n,delayMinutes:o,intervalMinutes:p,activeFrom:q,activeTo:r,cron:s}=yield*(0,g.k9)(a);if(!c||!d||!j||!m||!n)return yield*e.fJG(new h.yI({field:"cwd|tabId|sessionId|message|type",reason:"missing"}));if(k&&!["claude","claude2","ollama","codex","kimi","deepseek"].includes(k))return yield*e.fJG(new h.yI({field:"engine",reason:`unknown engine '${k}'`}));let t=Date.now();if("once"===n&&o)b=t+6e4*o;else if("interval"===n&&p)b=t+6e4*p;else{if("cron"!==n||!s)return yield*e.fJG(new h.yI({field:"type|timeConfig",reason:"Invalid type or missing time config"}));b=(0,f.$_)(s)}let u={id:`task-${t}-${Math.random().toString(36).slice(2,8)}`,cwd:c,tabId:d,sessionId:j,engine:k,model:"ollama"===k||"deepseek"===k?l:void 0,message:m,type:n,delayMinutes:"once"===n?o:void 0,intervalMinutes:"interval"===n?p:void 0,activeFrom:"interval"===n?q:void 0,activeTo:"interval"===n?r:void 0,cron:"cron"===n?s:void 0,nextFireTime:b,paused:!1,createdAt:t},v=yield*(0,i.sP)(u);return(0,g.ok)({task:v})})),o=(0,g.RL)(a=>e.JkU(function*(){let{id:b,action:c,fields:d}=yield*(0,g.k9)(a);if(!b)return yield*e.fJG(new h.yI({field:"id",reason:"missing"}));let f=yield*(0,i.ex)(b,c,d);return f.simpleSuccess?(0,g.ok)({success:!0}):(0,g.ok)({task:f.task})})),p=(0,g.RL)(a=>e.JkU(function*(){let b=yield*(0,g.k9)(a);return b.id?(yield*(0,i.OT)(b.id),(0,g.ok)({success:!0})):yield*e.fJG(new h.yI({field:"id",reason:"missing"}))}));d()}catch(a){d(a)}})},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},14566:a=>{a.exports=require("node-pty")},14985:a=>{a.exports=require("dns")},19771:a=>{a.exports=require("process")},19879:a=>{a.exports=import("@anthropic-ai/claude-agent-sdk")},21820:a=>{a.exports=require("os")},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")},30816:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{m:()=>k});var e=c(7939),f=c(79830),g=c(46122),h=c(90136),i=a([g]);g=(i.then?(await i)():i)[0];let j=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),k={name:"claude",runner:{async run(a){let{mode:b,engine:c}=a.params;"pty"!==b||c&&"claude"!==c&&"claude2"!==c?await (0,g.M)(a,function(a){let{engine:b,permissionMode:c}=a.params,d="plan"===c;return(c,f)=>({...f&&{resume:f},...a.cwd&&{cwd:a.cwd},settingSources:["user","project","local"],permissionMode:d?"plan":"bypassPermissions",...!d&&{allowDangerouslySkipPermissions:!0},...d&&{canUseTool:async(a,b,c)=>(function(a,b,c){if("ExitPlanMode"===a)return{behavior:"deny",message:"Plan presented to the user. There is no approval dialog to click in this environment — the user approves by turning off Plan mode (via the plan card button) and resending, which then executes. Do not ask the user to confirm in a popup; stop here.",interrupt:!0};if(j.has(a)){let d=[b.file_path,b.notebook_path,b.path,c?.blockedPath].find(a=>"string"==typeof a);return d&&/(^|\/)\.claude\/plans\//.test(d)?{behavior:"allow",updatedInput:b}:{behavior:"deny",message:`Plan mode is read-only and this environment has no approval dialog, so "${a}"${d?` on ${d}`:""} can't run. Only writes under .claude/plans/ are allowed. Capture the intended changes in your plan instead of editing files now.`}}return{behavior:"allow",updatedInput:b}})(a,b,c)},includePartialMessages:!0,abortController:c,..."claude2"===b&&{env:{...process.env,CLAUDE_CONFIG_DIR:e.h9}}})}(a)):await (0,h.u)(a)},resolveTitle:(a,b)=>(0,f.Pn)(a,b)}};d()}catch(a){d(a)}})},33873:a=>{a.exports=require("path")},34631:a=>{a.exports=require("tls")},38616:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>e.SJ,GET:()=>e.fG,PATCH:()=>e.D9,POST:()=>e.LO,dynamic:()=>e.OR,runtime:()=>e.fA});var e=c(6727),f=a([e]);e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},41204:a=>{a.exports=require("string_decoder")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46122:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{M:()=>h});var e=c(19879),f=a([e]);function g(a){let b=new AbortController;return a.signal.aborted?b.abort():a.signal.addEventListener("abort",()=>b.abort(),{once:!0}),b}async function h(a,b){let c,d=!!(a.images&&a.images.length>0),f=[];if(a.images)for(let b of a.images)f.push({type:"image",source:{type:"base64",media_type:b.media_type,data:b.data}});a.prompt&&f.push({type:"text",text:a.prompt});let h=g(a),i=b(h,a.sessionId);if(d){let b=async function*(){yield{type:"user",message:{role:"user",content:f},parent_tool_use_id:null,session_id:a.sessionId||`session-${a.currentKey()}`}}();c=(0,e.query)({prompt:b,options:i})}else c=(0,e.query)({prompt:a.prompt,options:i});let j=c;for(let c=0;c<=1;c++){let c=!1;for await(let b of j){if(a.signal.aborted)break;"system"===b.type&&"init"===b.subtype&&b.session_id&&a.rekey(b.session_id),"result"===b.type&&(c=!0),a.emit(b)}if(c||a.signal.aborted)break;let d=g(a),f=a.currentKey();j=(0,e.query)({prompt:"continue",options:{...b(d,f),resume:f}})}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},47994:(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(38616),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/scheduled-tasks/route",pathname:"/api/scheduled-tasks",filename:"route",bundlePath:"app/api/scheduled-tasks/route"},distDir:".next-prod",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/cockpit/cockpit/src/app/api/scheduled-tasks/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/scheduled-tasks/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)}})},51181:a=>{a.exports=require("web-push")},53053:a=>{a.exports=require("node:diagnostics_channel")},55511:a=>{a.exports=require("crypto")},56825:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{$_:()=>p,_u:()=>t});var e=c(29021),f=c(7939),g=c(79830),h=c(82940),i=c(83633),j=c(81869),k=c(89705),l=c(770),m=c(94506),n=a([j,m]);function o(a,b,c){let d=[];for(let e of a.split(","))if("*"===e)for(let a=b;a<=c;a++)d.push(a);else if(e.includes("/")){let[a,f]=e.split("/"),g=parseInt(f,10),h="*"===a?b:parseInt(a,10);for(let a=h;a<=c;a+=g)d.push(a)}else if(e.includes("-")){let[a,b]=e.split("-").map(Number);for(let c=a;c<=b;c++)d.push(c)}else d.push(parseInt(e,10));return d}function p(a,b=new Date){let c=a.trim().split(/\s+/);if(5!==c.length)return b.getTime()+6e4;let d=o(c[0],0,59),e=o(c[1],0,23),f=o(c[2],1,31),g=o(c[3],1,12),h=o(c[4],0,6),i=new Date(b);i.setSeconds(0,0),i.setMinutes(i.getMinutes()+1);for(let a=0;a<527040;a++){let a=i.getMinutes(),b=i.getHours(),c=i.getDate(),j=i.getMonth()+1,k=i.getDay();if(d.includes(a)&&e.includes(b)&&f.includes(c)&&g.includes(j)&&h.includes(k))return i.getTime();i.setMinutes(i.getMinutes()+1)}return b.getTime()+864e5}async function q(a){return m.s9.runPromise(k.JkU(function*(){let b=a.engine??"claude";if(!["claude","claude2","ollama","codex","kimi","deepseek"].includes(b))return yield*k.fJG(new l.Yv({provider:"claude",kind:"unsupported-engine",cause:Error(`scheduled tasks not supported for engine '${b}' (task ${a.id})`)}));let c="claude2"===b?(0,f.oZ)(a.cwd,a.sessionId):"ollama"===b?(0,f.yw)(a.cwd,a.sessionId):"deepseek"===b?(0,f.im)(a.cwd,a.sessionId):"codex"===b?(0,f.eg)(a.sessionId):"kimi"===b?(0,f.vI)(a.sessionId):(0,f.Kk)(a.cwd,a.sessionId),d=!c||!(0,e.existsSync)(c);return d&&console.warn(`[ScheduledTask] resume session missing (${c??`no session for ${a.sessionId}`}) for task ${a.id}, engine ${b}; starting a fresh session`),yield*k.$mh({try:async()=>{let c=(0,j.E)(b);if(!c)throw Error(`no engine spec for ${b}`);let e=await (0,i.T)(c,{prompt:a.message,...d?{}:{sessionId:a.sessionId},cwd:a.cwd,engine:b,...a.model&&{model:a.model}});if(!e.ok)throw Error(`${b} dispatch rejected (${e.status}): ${e.error}`);let f=e.runKey,g=Date.now()+18e5;for(;(0,h.yQ)(f)&&Date.now()<g;)await new Promise(a=>setTimeout(a,500));if((0,h.yQ)(f))throw(0,h.Y6)(f),Error(`${b} run timed out after 30m (session ${a.sessionId})`);let k=(0,h.Si)(f);if(!k||"error"===k.status)throw Error(`${b} run failed (session ${a.sessionId})`);if(d){let b=(0,h.j$)(f);b&&b!==a.sessionId&&(console.warn(`[ScheduledTask] task ${a.id}: rebound session ${a.sessionId} → ${b}`),a.sessionId=b)}return!0},catch:a=>new l.Yv({provider:"claude2"===b?"claude":b,kind:"unknown",cause:a})})}).pipe(k.h9N(b=>k.JkU(function*(){return console.error(`[ScheduledTask] Failed to send message for task ${a.id}:`,b),yield*k.$mh(()=>(0,g.CS)(a.cwd,a.sessionId,"unread")).pipe(k.NWQ(()=>k.rIH)),!1}))))}[j,m]=n.then?(await n)():n;class r{async ensureInit(){if(!this.initialized)return this.initPromise||(this.initPromise=this.init()),this.initPromise}async init(){if(!this.initialized){for(let a of(this.initialized=!0,this.tasks=await (0,f.JE)(f.iK,[]),console.log(`[ScheduledTaskManager] Loaded ${this.tasks.length} scheduled tasks`),this.tasks))a.paused||a.completed||this.scheduleTask(a);await this.saveToDisk()}}setOnTaskFired(a){this.onTaskFired=a}async readTasksFromDisk(){return(0,f.JE)(f.iK,[])}async getTasks(){await this.ensureInit();let a=await this.readTasksFromDisk();return a.sort((a,b)=>(a.sortIndex??a.createdAt)-(b.sortIndex??b.createdAt)),a}async getUnreadCount(){return await this.ensureInit(),(await this.readTasksFromDisk()).filter(a=>a.unread).length}async addTask(a){await this.ensureInit();let b={...a};return await (0,f.N9)(f.iK,[],a=>[...a,b]),this.tasks.push(b),b.paused||b.completed||this.scheduleTask(b),b}async updateTask(a,b){await this.ensureInit();let c=await (0,f.Ux)(f.iK,async()=>{let c=await (0,f.JE)(f.iK,[]),d=c.findIndex(b=>b.id===a);if(-1===d)return null;let e={...c[d],...b};return c[d]=e,await (0,f.An)(f.iK,c),e});if(!c)return null;let d=this.tasks.findIndex(b=>b.id===a);return -1!==d&&(this.tasks[d]=c,this.clearTimer(a),c.paused||c.completed||this.scheduleTask(c)),c}async deleteTask(a){if(await this.ensureInit(),!await (0,f.Ux)(f.iK,async()=>{let b=await (0,f.JE)(f.iK,[]),c=b.findIndex(b=>b.id===a);return -1!==c&&(b.splice(c,1),await (0,f.An)(f.iK,b),!0)}))return!1;let b=this.tasks.findIndex(b=>b.id===a);return -1!==b&&(this.clearTimer(a),this.tasks.splice(b,1)),!0}async pauseTask(a){return this.updateTask(a,{paused:!0})}async resumeTask(a){let b=(await (0,f.JE)(f.iK,[])).find(b=>b.id===a);if(!b)return null;let c=Date.now(),d=b.nextFireTime;return d<=c&&(d="interval"===b.type&&b.intervalMinutes?c+6e4*b.intervalMinutes:"cron"===b.type&&b.cron?p(b.cron):c+6e4),this.updateTask(a,{paused:!1,nextFireTime:d,consecutiveFailures:0})}async triggerTask(a){await this.ensureInit();let b=(await (0,f.JE)(f.iK,[])).find(b=>b.id===a);if(!b)return;let c=this.tasks.findIndex(b=>b.id===a);-1!==c?this.tasks[c]=b:this.tasks.push(b),this.fireTaskManual(a).catch(b=>{console.error(`[ScheduledTask] Manual trigger failed for ${a}:`,b)})}async fireTaskManual(a){if(this.firing.has(a))return void console.warn(`[ScheduledTask] Skipping manual trigger of ${a}: still in flight`);let b=this.tasks.find(b=>b.id===a);if(b){console.log(`[ScheduledTask] Manual trigger ${a}: "${b.message}"`),this.firing.add(a);try{let a=await q(b);b.lastFiredAt=Date.now(),b.lastResult=a?"success":"error",b.consecutiveFailures=a?0:(b.consecutiveFailures??0)+1,b.unread=!0,await this.saveToDisk(),this.onTaskFired&&this.onTaskFired(b)}finally{this.firing.delete(a)}}}async markRead(a){await this.updateTask(a,{unread:!1})}async markReadBySessionId(a){await this.ensureInit(),await (0,f.Ux)(f.iK,async()=>{let b=await (0,f.JE)(f.iK,[]),c=!1;for(let d of b)d.sessionId===a&&d.unread&&(d.unread=!1,c=!0);c&&await (0,f.An)(f.iK,b)})}async markAllRead(){await this.ensureInit(),await (0,f.Ux)(f.iK,async()=>{let a=await (0,f.JE)(f.iK,[]),b=!1;for(let c of a)c.unread&&(c.unread=!1,b=!0);b&&await (0,f.An)(f.iK,a)})}async reorderTasks(a){await this.ensureInit(),await (0,f.Ux)(f.iK,async()=>{let b=await (0,f.JE)(f.iK,[]);for(let c=0;c<a.length;c++){let d=b.find(b=>b.id===a[c]);d&&(d.sortIndex=c)}await (0,f.An)(f.iK,b)})}scheduleTask(a){let b=Date.now();if(a.nextFireTime<=b)if("interval"===a.type&&a.intervalMinutes)a.nextFireTime=b+6e4*a.intervalMinutes;else{if("cron"!==a.type||!a.cron)return a.completed=!0,!1;a.nextFireTime=p(a.cron)}this.clearTimer(a.id);let c=a.nextFireTime-b,d=setTimeout(()=>{this.fireTask(a.id)},c);return this.timers.set(a.id,d),!0}clearTimer(a){let b=this.timers.get(a);b&&(clearTimeout(b),this.timers.delete(a))}isInActiveRange(a){if("interval"!==a.type||!a.activeFrom||!a.activeTo)return!0;let b=new Date,[c,d]=a.activeFrom.split(":").map(Number),[e,f]=a.activeTo.split(":").map(Number),g=60*b.getHours()+b.getMinutes(),h=60*c+d,i=60*e+f;return h<=i?g>=h&&g<=i:g>=h||g<=i}async fireTask(a){if(this.firing.has(a))return void console.warn(`[ScheduledTask] Skipping reentrant fire of ${a}: still in flight`);let b=this.tasks.find(b=>b.id===a);if(b&&!b.paused){if(!this.isInActiveRange(b)){console.log(`[ScheduledTask] Skipping task ${a}: outside active range ${b.activeFrom}-${b.activeTo}`),"interval"===b.type&&b.intervalMinutes&&(b.nextFireTime=Date.now()+6e4*b.intervalMinutes,this.scheduleTask(b),await this.saveToDisk());return}console.log(`[ScheduledTask] Firing task ${a}: "${b.message}"`),this.firing.add(a);try{let c=await q(b);b.lastFiredAt=Date.now(),b.lastResult=c?"success":"error",b.consecutiveFailures=c?0:(b.consecutiveFailures??0)+1,b.unread=!0;let d=!c&&(b.consecutiveFailures??0)>=3;"once"===b.type?b.completed=!0:d?(b.paused=!0,this.clearTimer(a),console.warn(`[ScheduledTask] auto-paused task ${a} after ${b.consecutiveFailures} consecutive failures`)):"interval"===b.type&&b.intervalMinutes?(b.nextFireTime=Date.now()+6e4*b.intervalMinutes,this.scheduleTask(b)):"cron"===b.type&&b.cron&&(b.nextFireTime=p(b.cron),this.scheduleTask(b)),await this.saveToDisk(),this.onTaskFired&&this.onTaskFired(b)}finally{this.firing.delete(a)}}}async saveToDisk(){try{await (0,f.N9)(f.iK,[],()=>[...this.tasks])}catch(a){console.error("[ScheduledTaskManager] Failed to save:",a)}}constructor(){this.tasks=[],this.timers=new Map,this.firing=new Set,this.initialized=!1,this.initPromise=null,this.onTaskFired=null}}let s=globalThis,t=s.__scheduledTaskManager??(s.__scheduledTaskManager=new r);d()}catch(a){d(a)}})},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},66136:a=>{a.exports=require("timers")},67928:(a,b,c)=>{c.d(b,{S:()=>j});var d=c(79646),e=c(55511),f=c(4984),g=c(29021),h=c(33873),i=c(21820);let j={name:"kimi",preflight:async a=>"string"==typeof a.prompt&&a.prompt.trim()?{ok:!0}:{ok:!1,status:400,error:"kimi requires a text prompt"},runner:{run(a){let{cwd:b,sessionId:c}=a,j=a.prompt;return new Promise((k,l)=>{let m=["--print","--output-format","stream-json"];c&&m.push("-S",c),b&&m.push("-w",b),m.push("-p",j);let n=c?new Set:function(){let a=new Set,b=(0,h.join)((0,i.homedir)(),".kimi","sessions");try{for(let c of(0,g.readdirSync)(b))try{for(let d of(0,g.readdirSync)((0,h.join)(b,c)))a.add(d)}catch{}}catch{}return a}(),o=(0,d.spawn)("kimi",m,{stdio:["ignore","pipe","pipe"],cwd:b||void 0,env:{...process.env}});a.signal.addEventListener("abort",()=>o.kill("SIGTERM"),{once:!0}),c&&(a.emit({type:"system",subtype:"init",session_id:c}),a.rekey(c)),(0,f.createInterface)({input:o.stdout}).on("line",b=>{let c;try{c=JSON.parse(b)}catch{return}if("assistant"===c.role){for(let b of c.content??[])"text"===b.type&&b.text&&a.emit({type:"assistant",message:{content:[{type:"text",text:b.text}]}}),"think"===b.type&&b.think&&a.emit({type:"assistant",message:{content:[{type:"text",text:`<details><summary>Thinking</summary>
|
|
1
|
+
"use strict";(()=>{var a={};a.id=8834,a.ids=[8834],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1932:a=>{a.exports=require("url")},4573:a=>{a.exports=require("node:buffer")},4984:a=>{a.exports=require("readline")},6727:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{D9:()=>o,LO:()=>n,OR:()=>l,SJ:()=>p,fA:()=>k,fG:()=>m});var e=c(89705),f=c(56825),g=c(72891),h=c(770),i=c(88503),j=a([g,i,f]);[g,i,f]=j.then?(await j)():j;let k="nodejs",l="force-dynamic",m=(0,g.RL)(()=>e.JkU(function*(){let a=yield*i.Uu;return(0,g.ok)(a)})),n=(0,g.RL)(a=>e.JkU(function*(){let b,{cwd:c,tabId:d,sessionId:j,engine:k,model:l,message:m,type:n,delayMinutes:o,intervalMinutes:p,activeFrom:q,activeTo:r,cron:s}=yield*(0,g.k9)(a);if(!c||!d||!j||!m||!n)return yield*e.fJG(new h.yI({field:"cwd|tabId|sessionId|message|type",reason:"missing"}));if(k&&!["claude","claude2","ollama","codex","kimi","deepseek"].includes(k))return yield*e.fJG(new h.yI({field:"engine",reason:`unknown engine '${k}'`}));let t=Date.now();if("once"===n&&o)b=t+6e4*o;else if("interval"===n&&p)b=t+6e4*p;else{if("cron"!==n||!s)return yield*e.fJG(new h.yI({field:"type|timeConfig",reason:"Invalid type or missing time config"}));b=(0,f.$_)(s)}let u={id:`task-${t}-${Math.random().toString(36).slice(2,8)}`,cwd:c,tabId:d,sessionId:j,engine:k,model:"ollama"===k||"deepseek"===k?l:void 0,message:m,type:n,delayMinutes:"once"===n?o:void 0,intervalMinutes:"interval"===n?p:void 0,activeFrom:"interval"===n?q:void 0,activeTo:"interval"===n?r:void 0,cron:"cron"===n?s:void 0,nextFireTime:b,paused:!1,createdAt:t},v=yield*(0,i.sP)(u);return(0,g.ok)({task:v})})),o=(0,g.RL)(a=>e.JkU(function*(){let{id:b,action:c,fields:d}=yield*(0,g.k9)(a);if(!b)return yield*e.fJG(new h.yI({field:"id",reason:"missing"}));let f=yield*(0,i.ex)(b,c,d);return f.simpleSuccess?(0,g.ok)({success:!0}):(0,g.ok)({task:f.task})})),p=(0,g.RL)(a=>e.JkU(function*(){let b=yield*(0,g.k9)(a);return b.id?(yield*(0,i.OT)(b.id),(0,g.ok)({success:!0})):yield*e.fJG(new h.yI({field:"id",reason:"missing"}))}));d()}catch(a){d(a)}})},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},14566:a=>{a.exports=require("node-pty")},14985:a=>{a.exports=require("dns")},19771:a=>{a.exports=require("process")},19879:a=>{a.exports=import("@anthropic-ai/claude-agent-sdk")},21820:a=>{a.exports=require("os")},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")},30816:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{m:()=>k});var e=c(7939),f=c(79830),g=c(46122),h=c(90136),i=a([g]);g=(i.then?(await i)():i)[0];let j=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),k={name:"claude",runner:{async run(a){let{mode:b,engine:c}=a.params;"pty"!==b||c&&"claude"!==c&&"claude2"!==c?await (0,g.M)(a,function(a){let{engine:b,permissionMode:c}=a.params,d="plan"===c;return(c,f)=>({...f&&{resume:f},...a.cwd&&{cwd:a.cwd},settingSources:["user","project","local"],permissionMode:d?"plan":"bypassPermissions",...!d&&{allowDangerouslySkipPermissions:!0},...d&&{canUseTool:async(a,b,c)=>(function(a,b,c){if("ExitPlanMode"===a)return{behavior:"deny",message:"Plan presented to the user. There is no approval dialog to click in this environment — the user approves by turning off Plan mode (via the plan card button) and resending, which then executes. Do not ask the user to confirm in a popup; stop here.",interrupt:!0};if(j.has(a)){let d=[b.file_path,b.notebook_path,b.path,c?.blockedPath].find(a=>"string"==typeof a);return d&&/(^|\/)\.claude\/plans\//.test(d)?{behavior:"allow",updatedInput:b}:{behavior:"deny",message:`Plan mode is read-only and this environment has no approval dialog, so "${a}"${d?` on ${d}`:""} can't run. Only writes under .claude/plans/ are allowed. Capture the intended changes in your plan instead of editing files now.`}}return{behavior:"allow",updatedInput:b}})(a,b,c)},includePartialMessages:!0,abortController:c,..."claude2"===b&&{env:{...process.env,CLAUDE_CONFIG_DIR:e.h9}}})}(a)):await (0,h.u)(a)},resolveTitle:(a,b)=>(0,f.Pn)(a,b)}};d()}catch(a){d(a)}})},33873:a=>{a.exports=require("path")},34631:a=>{a.exports=require("tls")},38616:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>e.SJ,GET:()=>e.fG,PATCH:()=>e.D9,POST:()=>e.LO,dynamic:()=>e.OR,runtime:()=>e.fA});var e=c(6727),f=a([e]);e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},41204:a=>{a.exports=require("string_decoder")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46122:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{M:()=>g});var e=c(19879),f=a([e]);async function g(a,b){let c=!!(a.images&&a.images.length>0),d=[];if(a.images)for(let b of a.images)d.push({type:"image",source:{type:"base64",media_type:b.media_type,data:b.data}});a.prompt&&d.push({type:"text",text:a.prompt});let f=c?d:a.prompt??"",g=new Set,h=()=>{};a.signal.aborted||a.signal.addEventListener("abort",()=>h(),{once:!0});for(let c=0;c<=1;c++){let d=!1,i=new Promise(a=>{h=()=>{d||(d=!0,a())}});a.signal.aborted&&h();let j=c>0,k={type:"user",message:{role:"user",content:j?"continue":f},parent_tool_use_id:null,session_id:a.sessionId||`session-${a.currentKey()}`},l=async function*(){yield k,await i}(),m=function(a){let b=new AbortController;return a.signal.aborted?b.abort():a.signal.addEventListener("abort",()=>b.abort(),{once:!0}),b}(a),n=j?a.currentKey():a.sessionId,o=j?{...b(m,n),resume:n}:b(m,a.sessionId),p=(0,e.query)({prompt:l,options:o}),q=!1;for await(let b of p){if(a.signal.aborted){h();break}"system"===b.type&&"init"===b.subtype&&b.session_id&&a.rekey(b.session_id),"system"===b.type&&"task_started"===b.subtype&&b.task_id&&g.add(b.task_id),"system"===b.type&&"task_notification"===b.subtype&&b.task_id&&g.delete(b.task_id),"result"===b.type&&(q=!0),a.emit(b),"result"===b.type&&0===g.size&&h()}if(h(),q||a.signal.aborted)break}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},47994:(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(38616),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/scheduled-tasks/route",pathname:"/api/scheduled-tasks",filename:"route",bundlePath:"app/api/scheduled-tasks/route"},distDir:".next-prod",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/cockpit/cockpit/src/app/api/scheduled-tasks/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/scheduled-tasks/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)}})},51181:a=>{a.exports=require("web-push")},53053:a=>{a.exports=require("node:diagnostics_channel")},55511:a=>{a.exports=require("crypto")},56825:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{$_:()=>p,_u:()=>t});var e=c(29021),f=c(7939),g=c(79830),h=c(82940),i=c(83633),j=c(81869),k=c(89705),l=c(770),m=c(94506),n=a([j,m]);function o(a,b,c){let d=[];for(let e of a.split(","))if("*"===e)for(let a=b;a<=c;a++)d.push(a);else if(e.includes("/")){let[a,f]=e.split("/"),g=parseInt(f,10),h="*"===a?b:parseInt(a,10);for(let a=h;a<=c;a+=g)d.push(a)}else if(e.includes("-")){let[a,b]=e.split("-").map(Number);for(let c=a;c<=b;c++)d.push(c)}else d.push(parseInt(e,10));return d}function p(a,b=new Date){let c=a.trim().split(/\s+/);if(5!==c.length)return b.getTime()+6e4;let d=o(c[0],0,59),e=o(c[1],0,23),f=o(c[2],1,31),g=o(c[3],1,12),h=o(c[4],0,6),i=new Date(b);i.setSeconds(0,0),i.setMinutes(i.getMinutes()+1);for(let a=0;a<527040;a++){let a=i.getMinutes(),b=i.getHours(),c=i.getDate(),j=i.getMonth()+1,k=i.getDay();if(d.includes(a)&&e.includes(b)&&f.includes(c)&&g.includes(j)&&h.includes(k))return i.getTime();i.setMinutes(i.getMinutes()+1)}return b.getTime()+864e5}async function q(a){return m.s9.runPromise(k.JkU(function*(){let b=a.engine??"claude";if(!["claude","claude2","ollama","codex","kimi","deepseek"].includes(b))return yield*k.fJG(new l.Yv({provider:"claude",kind:"unsupported-engine",cause:Error(`scheduled tasks not supported for engine '${b}' (task ${a.id})`)}));let c="claude2"===b?(0,f.oZ)(a.cwd,a.sessionId):"ollama"===b?(0,f.yw)(a.cwd,a.sessionId):"deepseek"===b?(0,f.im)(a.cwd,a.sessionId):"codex"===b?(0,f.eg)(a.sessionId):"kimi"===b?(0,f.vI)(a.sessionId):(0,f.Kk)(a.cwd,a.sessionId),d=!c||!(0,e.existsSync)(c);return d&&console.warn(`[ScheduledTask] resume session missing (${c??`no session for ${a.sessionId}`}) for task ${a.id}, engine ${b}; starting a fresh session`),yield*k.$mh({try:async()=>{let c=(0,j.E)(b);if(!c)throw Error(`no engine spec for ${b}`);let e=await (0,i.T)(c,{prompt:a.message,...d?{}:{sessionId:a.sessionId},cwd:a.cwd,engine:b,...a.model&&{model:a.model}});if(!e.ok)throw Error(`${b} dispatch rejected (${e.status}): ${e.error}`);let f=e.runKey,g=Date.now()+18e5;for(;(0,h.yQ)(f)&&Date.now()<g;)await new Promise(a=>setTimeout(a,500));if((0,h.yQ)(f))throw(0,h.Y6)(f),Error(`${b} run timed out after 30m (session ${a.sessionId})`);let k=(0,h.Si)(f);if(!k||"error"===k.status)throw Error(`${b} run failed (session ${a.sessionId})`);if(d){let b=(0,h.j$)(f);b&&b!==a.sessionId&&(console.warn(`[ScheduledTask] task ${a.id}: rebound session ${a.sessionId} → ${b}`),a.sessionId=b)}return!0},catch:a=>new l.Yv({provider:"claude2"===b?"claude":b,kind:"unknown",cause:a})})}).pipe(k.h9N(b=>k.JkU(function*(){return console.error(`[ScheduledTask] Failed to send message for task ${a.id}:`,b),yield*k.$mh(()=>(0,g.CS)(a.cwd,a.sessionId,"unread")).pipe(k.NWQ(()=>k.rIH)),!1}))))}[j,m]=n.then?(await n)():n;class r{async ensureInit(){if(!this.initialized)return this.initPromise||(this.initPromise=this.init()),this.initPromise}async init(){if(!this.initialized){for(let a of(this.initialized=!0,this.tasks=await (0,f.JE)(f.iK,[]),console.log(`[ScheduledTaskManager] Loaded ${this.tasks.length} scheduled tasks`),this.tasks))a.paused||a.completed||this.scheduleTask(a);await this.saveToDisk()}}setOnTaskFired(a){this.onTaskFired=a}async readTasksFromDisk(){return(0,f.JE)(f.iK,[])}async getTasks(){await this.ensureInit();let a=await this.readTasksFromDisk();return a.sort((a,b)=>(a.sortIndex??a.createdAt)-(b.sortIndex??b.createdAt)),a}async getUnreadCount(){return await this.ensureInit(),(await this.readTasksFromDisk()).filter(a=>a.unread).length}async addTask(a){await this.ensureInit();let b={...a};return await (0,f.N9)(f.iK,[],a=>[...a,b]),this.tasks.push(b),b.paused||b.completed||this.scheduleTask(b),b}async updateTask(a,b){await this.ensureInit();let c=await (0,f.Ux)(f.iK,async()=>{let c=await (0,f.JE)(f.iK,[]),d=c.findIndex(b=>b.id===a);if(-1===d)return null;let e={...c[d],...b};return c[d]=e,await (0,f.An)(f.iK,c),e});if(!c)return null;let d=this.tasks.findIndex(b=>b.id===a);return -1!==d&&(this.tasks[d]=c,this.clearTimer(a),c.paused||c.completed||this.scheduleTask(c)),c}async deleteTask(a){if(await this.ensureInit(),!await (0,f.Ux)(f.iK,async()=>{let b=await (0,f.JE)(f.iK,[]),c=b.findIndex(b=>b.id===a);return -1!==c&&(b.splice(c,1),await (0,f.An)(f.iK,b),!0)}))return!1;let b=this.tasks.findIndex(b=>b.id===a);return -1!==b&&(this.clearTimer(a),this.tasks.splice(b,1)),!0}async pauseTask(a){return this.updateTask(a,{paused:!0})}async resumeTask(a){let b=(await (0,f.JE)(f.iK,[])).find(b=>b.id===a);if(!b)return null;let c=Date.now(),d=b.nextFireTime;return d<=c&&(d="interval"===b.type&&b.intervalMinutes?c+6e4*b.intervalMinutes:"cron"===b.type&&b.cron?p(b.cron):c+6e4),this.updateTask(a,{paused:!1,nextFireTime:d,consecutiveFailures:0})}async triggerTask(a){await this.ensureInit();let b=(await (0,f.JE)(f.iK,[])).find(b=>b.id===a);if(!b)return;let c=this.tasks.findIndex(b=>b.id===a);-1!==c?this.tasks[c]=b:this.tasks.push(b),this.fireTaskManual(a).catch(b=>{console.error(`[ScheduledTask] Manual trigger failed for ${a}:`,b)})}async fireTaskManual(a){if(this.firing.has(a))return void console.warn(`[ScheduledTask] Skipping manual trigger of ${a}: still in flight`);let b=this.tasks.find(b=>b.id===a);if(b){console.log(`[ScheduledTask] Manual trigger ${a}: "${b.message}"`),this.firing.add(a);try{let a=await q(b);b.lastFiredAt=Date.now(),b.lastResult=a?"success":"error",b.consecutiveFailures=a?0:(b.consecutiveFailures??0)+1,b.unread=!0,await this.saveToDisk(),this.onTaskFired&&this.onTaskFired(b)}finally{this.firing.delete(a)}}}async markRead(a){await this.updateTask(a,{unread:!1})}async markReadBySessionId(a){await this.ensureInit(),await (0,f.Ux)(f.iK,async()=>{let b=await (0,f.JE)(f.iK,[]),c=!1;for(let d of b)d.sessionId===a&&d.unread&&(d.unread=!1,c=!0);c&&await (0,f.An)(f.iK,b)})}async markAllRead(){await this.ensureInit(),await (0,f.Ux)(f.iK,async()=>{let a=await (0,f.JE)(f.iK,[]),b=!1;for(let c of a)c.unread&&(c.unread=!1,b=!0);b&&await (0,f.An)(f.iK,a)})}async reorderTasks(a){await this.ensureInit(),await (0,f.Ux)(f.iK,async()=>{let b=await (0,f.JE)(f.iK,[]);for(let c=0;c<a.length;c++){let d=b.find(b=>b.id===a[c]);d&&(d.sortIndex=c)}await (0,f.An)(f.iK,b)})}scheduleTask(a){let b=Date.now();if(a.nextFireTime<=b)if("interval"===a.type&&a.intervalMinutes)a.nextFireTime=b+6e4*a.intervalMinutes;else{if("cron"!==a.type||!a.cron)return a.completed=!0,!1;a.nextFireTime=p(a.cron)}this.clearTimer(a.id);let c=a.nextFireTime-b,d=setTimeout(()=>{this.fireTask(a.id)},c);return this.timers.set(a.id,d),!0}clearTimer(a){let b=this.timers.get(a);b&&(clearTimeout(b),this.timers.delete(a))}isInActiveRange(a){if("interval"!==a.type||!a.activeFrom||!a.activeTo)return!0;let b=new Date,[c,d]=a.activeFrom.split(":").map(Number),[e,f]=a.activeTo.split(":").map(Number),g=60*b.getHours()+b.getMinutes(),h=60*c+d,i=60*e+f;return h<=i?g>=h&&g<=i:g>=h||g<=i}async fireTask(a){if(this.firing.has(a))return void console.warn(`[ScheduledTask] Skipping reentrant fire of ${a}: still in flight`);let b=this.tasks.find(b=>b.id===a);if(b&&!b.paused){if(!this.isInActiveRange(b)){console.log(`[ScheduledTask] Skipping task ${a}: outside active range ${b.activeFrom}-${b.activeTo}`),"interval"===b.type&&b.intervalMinutes&&(b.nextFireTime=Date.now()+6e4*b.intervalMinutes,this.scheduleTask(b),await this.saveToDisk());return}console.log(`[ScheduledTask] Firing task ${a}: "${b.message}"`),this.firing.add(a);try{let c=await q(b);b.lastFiredAt=Date.now(),b.lastResult=c?"success":"error",b.consecutiveFailures=c?0:(b.consecutiveFailures??0)+1,b.unread=!0;let d=!c&&(b.consecutiveFailures??0)>=3;"once"===b.type?b.completed=!0:d?(b.paused=!0,this.clearTimer(a),console.warn(`[ScheduledTask] auto-paused task ${a} after ${b.consecutiveFailures} consecutive failures`)):"interval"===b.type&&b.intervalMinutes?(b.nextFireTime=Date.now()+6e4*b.intervalMinutes,this.scheduleTask(b)):"cron"===b.type&&b.cron&&(b.nextFireTime=p(b.cron),this.scheduleTask(b)),await this.saveToDisk(),this.onTaskFired&&this.onTaskFired(b)}finally{this.firing.delete(a)}}}async saveToDisk(){try{await (0,f.N9)(f.iK,[],()=>[...this.tasks])}catch(a){console.error("[ScheduledTaskManager] Failed to save:",a)}}constructor(){this.tasks=[],this.timers=new Map,this.firing=new Set,this.initialized=!1,this.initPromise=null,this.onTaskFired=null}}let s=globalThis,t=s.__scheduledTaskManager??(s.__scheduledTaskManager=new r);d()}catch(a){d(a)}})},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},66136:a=>{a.exports=require("timers")},67928:(a,b,c)=>{c.d(b,{S:()=>j});var d=c(79646),e=c(55511),f=c(4984),g=c(29021),h=c(33873),i=c(21820);let j={name:"kimi",preflight:async a=>"string"==typeof a.prompt&&a.prompt.trim()?{ok:!0}:{ok:!1,status:400,error:"kimi requires a text prompt"},runner:{run(a){let{cwd:b,sessionId:c}=a,j=a.prompt;return new Promise((k,l)=>{let m=["--print","--output-format","stream-json"];c&&m.push("-S",c),b&&m.push("-w",b),m.push("-p",j);let n=c?new Set:function(){let a=new Set,b=(0,h.join)((0,i.homedir)(),".kimi","sessions");try{for(let c of(0,g.readdirSync)(b))try{for(let d of(0,g.readdirSync)((0,h.join)(b,c)))a.add(d)}catch{}}catch{}return a}(),o=(0,d.spawn)("kimi",m,{stdio:["ignore","pipe","pipe"],cwd:b||void 0,env:{...process.env}});a.signal.addEventListener("abort",()=>o.kill("SIGTERM"),{once:!0}),c&&(a.emit({type:"system",subtype:"init",session_id:c}),a.rekey(c)),(0,f.createInterface)({input:o.stdout}).on("line",b=>{let c;try{c=JSON.parse(b)}catch{return}if("assistant"===c.role){for(let b of c.content??[])"text"===b.type&&b.text&&a.emit({type:"assistant",message:{content:[{type:"text",text:b.text}]}}),"think"===b.type&&b.think&&a.emit({type:"assistant",message:{content:[{type:"text",text:`<details><summary>Thinking</summary>
|
|
2
2
|
|
|
3
3
|
${b.think}
|
|
4
4
|
|