module.exports=[14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},85148,(e,t,r)=>{t.exports=e.x("better-sqlite3-90e2652d1716b047",()=>require("better-sqlite3-90e2652d1716b047"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},43793,77930,e=>{"use strict";var t=e.i(85148),r=e.i(14747),a=e.i(22734);function s(){return process.env.VIBEMETER_DATA_DIR??r.default.join(process.cwd(),".data")}e.s(["dataDir",0,s],77930);let n=null;e.s(["getDb",0,function(){var e;let i;if(n)return n;let o=s();return a.default.mkdirSync(o,{recursive:!0}),(n=new t.default(r.default.join(o,"continuity.sqlite"))).pragma("journal_mode = WAL"),(e=n).exec(`
    CREATE TABLE IF NOT EXISTS sessions (
      id TEXT PRIMARY KEY,
      tool TEXT NOT NULL,
      started_at INTEGER NOT NULL,
      ended_at INTEGER,
      exit_code INTEGER,
      cwd TEXT,
      cli_args TEXT,
      summary TEXT,
      confidence TEXT NOT NULL DEFAULT 'medium'
    );

    CREATE TABLE IF NOT EXISTS usage_snapshots (
      id INTEGER PRIMARY KEY AUTOINCREMENT,
      captured_at INTEGER NOT NULL,
      source TEXT NOT NULL,
      account_id TEXT,
      window_5h_used_pct REAL,
      window_weekly_used_pct REAL,
      reset_at_5h INTEGER,
      reset_at_weekly INTEGER,
      raw_output TEXT,
      confidence TEXT NOT NULL
    );

    CREATE TABLE IF NOT EXISTS file_changes (
      id INTEGER PRIMARY KEY AUTOINCREMENT,
      session_id TEXT NOT NULL,
      path TEXT NOT NULL,
      change_type TEXT NOT NULL,
      detected_at INTEGER NOT NULL,
      FOREIGN KEY (session_id) REFERENCES sessions(id)
    );
  `),(i=(t,r,a)=>{try{e.exec(`ALTER TABLE ${t} ADD COLUMN ${r} ${a}`)}catch{}})("sessions","ai_title","TEXT"),i("sessions","tags",'TEXT DEFAULT "[]"'),i("sessions","codex_category","TEXT"),i("sessions","tokens_used","INTEGER"),i("usage_snapshots","account_id","TEXT"),e.exec(`
    CREATE INDEX IF NOT EXISTS idx_sessions_started ON sessions(started_at DESC);
    CREATE INDEX IF NOT EXISTS idx_usage_captured ON usage_snapshots(captured_at DESC);
    CREATE INDEX IF NOT EXISTS idx_usage_source_account_captured ON usage_snapshots(source, account_id, captured_at DESC);
  `),n}],43793)},16113,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),s=e.i(59756),n=e.i(61916),i=e.i(74677),o=e.i(69741),d=e.i(16795),l=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),E=e.i(70101),T=e.i(26937),R=e.i(10372),x=e.i(93695);e.i(52474);var h=e.i(220),N=e.i(89171),g=e.i(69719),_=e.i(43793);let v=g.z.object({tags:g.z.array(g.z.string().max(32)).max(10)});async function f(e,{params:t}){let{id:r}=await t,a=await e.json(),s=v.safeParse(a);return s.success?((0,_.getDb)().prepare("UPDATE sessions SET tags = ? WHERE id = ?").run(JSON.stringify(s.data.tags),r),N.NextResponse.json({ok:!0,tags:s.data.tags})):N.NextResponse.json({error:"invalid"},{status:400})}e.s(["PATCH",0,f],33768);var A=e.i(33768);let w=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/tags/route",pathname:"/api/sessions/[id]/tags",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/sessions/[id]/tags/route.ts",nextConfigOutput:"",userland:A,...{}}),{workAsyncStorage:m,workUnitAsyncStorage:C,serverHooks:I}=w;async function y(e,t,a){a.requestMeta&&(0,s.setRequestMeta)(e,a.requestMeta),w.isDev&&(0,s.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let N="/api/sessions/[id]/tags/route";N=N.replace(/\/index$/,"")||"/";let g=await w.prepare(e,t,{srcPage:N,multiZoneDraftMode:!1});if(!g)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:_,deploymentId:v,params:f,nextConfig:A,parsedUrl:m,isDraftMode:C,prerenderManifest:I,routerServerContext:y,isOnDemandRevalidate:O,revalidateOnlyGenerated:S,resolvedPathname:b,clientReferenceManifest:L,serverActionsManifest:U}=g,q=(0,o.normalizeAppPath)(N),P=!!(I.dynamicRoutes[q]||I.routes[b]),D=async()=>((null==y?void 0:y.render404)?await y.render404(e,t,m,!1):t.end("This page could not be found"),null);if(P&&!C){let e=!!I.routes[b],t=I.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(A.adapterPath)return await D();throw new x.NoFallbackError}}let X=null;!P||w.isDev||C||(X="/index"===(X=b)?"/":X);let k=!0===w.isDev||!P,j=P&&!k;U&&L&&(0,i.setManifestsSingleton)({page:N,clientReferenceManifest:L,serverActionsManifest:U});let M=e.method||"GET",H=(0,n.getTracer)(),F=H.getActiveScopeSpan(),G=!!(null==y?void 0:y.isWrappedByNextServer),K=!!(0,s.getRequestMeta)(e,"minimalMode"),$=(0,s.getRequestMeta)(e,"incrementalCache")||await w.getIncrementalCache(e,A,I,K);null==$||$.resetRequestCache(),globalThis.__incrementalCache=$;let B={params:f,previewProps:I.preview,renderOpts:{experimental:{authInterrupts:!!A.experimental.authInterrupts},cacheComponents:!!A.cacheComponents,supportsDynamicResponse:k,incrementalCache:$,cacheLifeProfiles:A.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,s)=>w.onRequestError(e,t,a,s,y)},sharedContext:{buildId:_,deploymentId:v}},Y=new d.NodeNextRequest(e),W=new d.NodeNextResponse(t),z=l.NextRequestAdapter.fromNodeNextRequest(Y,(0,l.signalFromNodeResponse)(t));try{let s,i=async e=>w.handle(z,B).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=H.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${M} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),s&&s!==e&&(s.setAttribute("http.route",a),s.updateName(t))}else e.updateName(`${M} ${N}`)}),o=async s=>{var n,o;let d=async({previousCacheEntry:r})=>{try{if(!K&&O&&S&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await i(s);e.fetchMetrics=B.renderOpts.fetchMetrics;let o=B.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let d=B.renderOpts.collectedTags;if(!P)return await (0,p.sendResponse)(Y,W,n,B.renderOpts.pendingWaitUntil),null;{let e=await n.blob(),t=(0,E.toNodeOutgoingHttpHeaders)(n.headers);d&&(t[R.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=R.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,a=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=R.INFINITE_CACHE?void 0:B.renderOpts.collectedExpire;return{value:{kind:h.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await w.onRequestError(e,t,{routerKind:"App Router",routePath:N,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:j,isOnDemandRevalidate:O})},!1,y),t}},l=await w.handleResponse({req:e,nextConfig:A,cacheKey:X,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:I,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:S,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:K});if(!P)return null;if((null==l||null==(n=l.value)?void 0:n.kind)!==h.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==l||null==(o=l.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",O?"REVALIDATED":l.isMiss?"MISS":l.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,E.fromNodeOutgoingHttpHeaders)(l.value.headers);return K&&P||u.delete(R.NEXT_CACHE_TAGS_HEADER),!l.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,T.getCacheControlHeader)(l.cacheControl)),await (0,p.sendResponse)(Y,W,new Response(l.value.body,{headers:u,status:l.value.status||200})),null};G&&F?await o(F):(s=H.getActiveScopeSpan(),await H.withPropagatedContext(e.headers,()=>H.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${N}`,kind:n.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},o),void 0,!G))}catch(t){if(t instanceof x.NoFallbackError||await w.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:j,isOnDemandRevalidate:O})},!1,y),P)throw t;return await (0,p.sendResponse)(Y,W,new Response(null,{status:500})),null}}e.s(["handler",0,y,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:m,workUnitAsyncStorage:C})},"routeModule",0,w,"serverHooks",0,I,"workAsyncStorage",0,m,"workUnitAsyncStorage",0,C],16113)}];

//# sourceMappingURL=%5Broot-of-the-server%5D__00q0o~z._.js.map