ai-agent-router 0.2.1 → 0.2.2

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.
Files changed (154) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +2 -2
  3. package/.next/fallback-build-manifest.json +2 -2
  4. package/.next/next-server.js.nft.json +1 -1
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/required-server-files.js +4 -4
  7. package/.next/required-server-files.json +4 -4
  8. package/.next/server/app/_global-error.html +2 -2
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/server/app/_not-found/page.js +1 -1
  16. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  17. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/server/app/_not-found.html +1 -1
  19. package/.next/server/app/_not-found.rsc +2 -2
  20. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  21. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  23. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  24. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  25. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  26. package/.next/server/app/api/config/route.js.nft.json +1 -1
  27. package/.next/server/app/api/gateway/[...path]/route.js.nft.json +1 -1
  28. package/.next/server/app/api/gateway/models/route.js.nft.json +1 -1
  29. package/.next/server/app/api/gateway/route.js.nft.json +1 -1
  30. package/.next/server/app/api/ide/claude/apply/route.js.nft.json +1 -1
  31. package/.next/server/app/api/ide/claude/available-models/route.js.nft.json +1 -1
  32. package/.next/server/app/api/ide/claude/restore/route.js.nft.json +1 -1
  33. package/.next/server/app/api/ide/claude/save/route.js.nft.json +1 -1
  34. package/.next/server/app/api/ide/claude/status/route.js.nft.json +1 -1
  35. package/.next/server/app/api/ide/claude/test/route.js.nft.json +1 -1
  36. package/.next/server/app/api/ide/openclaw/apply/route.js.nft.json +1 -1
  37. package/.next/server/app/api/ide/openclaw/available-models/route.js.nft.json +1 -1
  38. package/.next/server/app/api/ide/openclaw/preview/route.js.nft.json +1 -1
  39. package/.next/server/app/api/ide/openclaw/save/route.js.nft.json +1 -1
  40. package/.next/server/app/api/ide/openclaw/status/route.js.nft.json +1 -1
  41. package/.next/server/app/api/ide/opencode/apply/route.js.nft.json +1 -1
  42. package/.next/server/app/api/ide/opencode/available-models/route.js.nft.json +1 -1
  43. package/.next/server/app/api/ide/opencode/preview/route.js.nft.json +1 -1
  44. package/.next/server/app/api/ide/opencode/save/route.js.nft.json +1 -1
  45. package/.next/server/app/api/ide/opencode/status/route.js.nft.json +1 -1
  46. package/.next/server/app/api/logs/route.js.nft.json +1 -1
  47. package/.next/server/app/api/models/route.js.nft.json +1 -1
  48. package/.next/server/app/api/providers/route.js.nft.json +1 -1
  49. package/.next/server/app/api/providers/test/route.js.nft.json +1 -1
  50. package/.next/server/app/api/service/force-stop/route.js.nft.json +1 -1
  51. package/.next/server/app/api/service/start/route.js.nft.json +1 -1
  52. package/.next/server/app/api/service/status/route.js.nft.json +1 -1
  53. package/.next/server/app/api/service/stop/route.js.nft.json +1 -1
  54. package/.next/server/app/ide/page.js +1 -1
  55. package/.next/server/app/ide/page.js.nft.json +1 -1
  56. package/.next/server/app/ide/page_client-reference-manifest.js +1 -1
  57. package/.next/server/app/ide.html +1 -1
  58. package/.next/server/app/ide.rsc +3 -3
  59. package/.next/server/app/ide.segments/_full.segment.rsc +3 -3
  60. package/.next/server/app/ide.segments/_head.segment.rsc +1 -1
  61. package/.next/server/app/ide.segments/_index.segment.rsc +2 -2
  62. package/.next/server/app/ide.segments/_tree.segment.rsc +2 -2
  63. package/.next/server/app/ide.segments/ide/__PAGE__.segment.rsc +2 -2
  64. package/.next/server/app/ide.segments/ide.segment.rsc +1 -1
  65. package/.next/server/app/index.html +1 -1
  66. package/.next/server/app/index.rsc +2 -2
  67. package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  68. package/.next/server/app/index.segments/_full.segment.rsc +2 -2
  69. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  70. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  71. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  72. package/.next/server/app/logs/page.js +1 -1
  73. package/.next/server/app/logs/page.js.nft.json +1 -1
  74. package/.next/server/app/logs/page_client-reference-manifest.js +1 -1
  75. package/.next/server/app/logs.html +1 -1
  76. package/.next/server/app/logs.rsc +2 -2
  77. package/.next/server/app/logs.segments/_full.segment.rsc +2 -2
  78. package/.next/server/app/logs.segments/_head.segment.rsc +1 -1
  79. package/.next/server/app/logs.segments/_index.segment.rsc +2 -2
  80. package/.next/server/app/logs.segments/_tree.segment.rsc +2 -2
  81. package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +1 -1
  82. package/.next/server/app/logs.segments/logs.segment.rsc +1 -1
  83. package/.next/server/app/models/page.js +1 -1
  84. package/.next/server/app/models/page.js.nft.json +1 -1
  85. package/.next/server/app/models/page_client-reference-manifest.js +1 -1
  86. package/.next/server/app/models.html +1 -1
  87. package/.next/server/app/models.rsc +2 -2
  88. package/.next/server/app/models.segments/_full.segment.rsc +2 -2
  89. package/.next/server/app/models.segments/_head.segment.rsc +1 -1
  90. package/.next/server/app/models.segments/_index.segment.rsc +2 -2
  91. package/.next/server/app/models.segments/_tree.segment.rsc +2 -2
  92. package/.next/server/app/models.segments/models/__PAGE__.segment.rsc +1 -1
  93. package/.next/server/app/models.segments/models.segment.rsc +1 -1
  94. package/.next/server/app/page.js +1 -1
  95. package/.next/server/app/page.js.nft.json +1 -1
  96. package/.next/server/app/page_client-reference-manifest.js +1 -1
  97. package/.next/server/app/providers/page.js +1 -1
  98. package/.next/server/app/providers/page.js.nft.json +1 -1
  99. package/.next/server/app/providers/page_client-reference-manifest.js +1 -1
  100. package/.next/server/app/providers.html +1 -1
  101. package/.next/server/app/providers.rsc +2 -2
  102. package/.next/server/app/providers.segments/_full.segment.rsc +2 -2
  103. package/.next/server/app/providers.segments/_head.segment.rsc +1 -1
  104. package/.next/server/app/providers.segments/_index.segment.rsc +2 -2
  105. package/.next/server/app/providers.segments/_tree.segment.rsc +2 -2
  106. package/.next/server/app/providers.segments/providers/__PAGE__.segment.rsc +1 -1
  107. package/.next/server/app/providers.segments/providers.segment.rsc +1 -1
  108. package/.next/server/chunks/[root-of-the-server]__3a204d25._.js +1 -1
  109. package/.next/server/chunks/[root-of-the-server]__3a204d25._.js.map +1 -1
  110. package/.next/server/chunks/[root-of-the-server]__4a8f9bc7._.js +1 -1
  111. package/.next/server/chunks/[root-of-the-server]__4a8f9bc7._.js.map +1 -1
  112. package/.next/server/chunks/[root-of-the-server]__5e8276bc._.js +1 -1
  113. package/.next/server/chunks/[root-of-the-server]__5e8276bc._.js.map +1 -1
  114. package/.next/server/chunks/[root-of-the-server]__c1b4b601._.js +16 -16
  115. package/.next/server/chunks/[root-of-the-server]__c1b4b601._.js.map +1 -1
  116. package/.next/server/chunks/[root-of-the-server]__f0461b8d._.js +1 -1
  117. package/.next/server/chunks/[root-of-the-server]__f0461b8d._.js.map +1 -1
  118. package/.next/server/chunks/ssr/_69468f4c._.js +3 -0
  119. package/.next/server/chunks/ssr/_69468f4c._.js.map +1 -0
  120. package/.next/server/chunks/ssr/src_app_ide_page_tsx_8962793b._.js +1 -1
  121. package/.next/server/chunks/ssr/src_app_ide_page_tsx_8962793b._.js.map +1 -1
  122. package/.next/server/pages/404.html +1 -1
  123. package/.next/server/pages/500.html +2 -2
  124. package/.next/server/server-reference-manifest.js +1 -1
  125. package/.next/server/server-reference-manifest.json +1 -1
  126. package/.next/static/chunks/6992685fe009e8fd.css +1 -0
  127. package/.next/static/chunks/8ccc14e022ff6de3.js +1 -0
  128. package/README.md +31 -4
  129. package/dist/package.json +55 -0
  130. package/dist/src/app/api/config/route.js +17 -0
  131. package/dist/src/app/api/ide/claude/apply/route.js +84 -0
  132. package/dist/src/app/api/ide/claude/restore/route.js +30 -0
  133. package/dist/src/app/api/ide/claude/save/route.js +79 -0
  134. package/dist/src/app/components/Footer.js +11 -0
  135. package/dist/src/app/ide/page.js +62 -2
  136. package/dist/src/app/layout.js +5 -1
  137. package/dist/src/cli/index.js +0 -0
  138. package/dist/src/db/database.js +21 -2
  139. package/package.json +1 -1
  140. package/src/app/api/config/route.ts +17 -0
  141. package/src/app/api/ide/claude/apply/route.ts +94 -0
  142. package/src/app/api/ide/claude/restore/route.ts +36 -1
  143. package/src/app/api/ide/claude/save/route.ts +91 -1
  144. package/src/app/components/Footer.tsx +9 -0
  145. package/src/app/ide/page.tsx +71 -5
  146. package/src/app/layout.tsx +3 -1
  147. package/src/db/database.ts +27 -2
  148. package/.next/server/chunks/ssr/src_app_b2b1d928._.js +0 -3
  149. package/.next/server/chunks/ssr/src_app_b2b1d928._.js.map +0 -1
  150. package/.next/static/chunks/0f120c117962200b.css +0 -1
  151. package/.next/static/chunks/8ed839b2e4948968.js +0 -1
  152. /package/.next/static/{dYin74gcpdlg8TGoGv-_d → cf2SWIkI5HVbnDjLExI42}/_buildManifest.js +0 -0
  153. /package/.next/static/{dYin74gcpdlg8TGoGv-_d → cf2SWIkI5HVbnDjLExI42}/_clientMiddlewareManifest.json +0 -0
  154. /package/.next/static/{dYin74gcpdlg8TGoGv-_d → cf2SWIkI5HVbnDjLExI42}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[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"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},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"))},37765,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=e.i(59756),s=e.i(61916),o=e.i(74677),i=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),x=e.i(70101),h=e.i(26937),R=e.i(10372),g=e.i(93695);e.i(52474);var f=e.i(220),v=e.i(89171),w=e.i(71560),m=e.i(97731);async function y(e){try{await (0,w.getDatabase)();let{searchParams:t}=new URL(e.url),r=t.get("key");if(r){let e=await (0,m.getConfig)(r);if(!e)return v.NextResponse.json({error:"Config not found"},{status:404});return v.NextResponse.json(e)}let n=await (0,m.getAllConfig)();return v.NextResponse.json(n)}catch(e){return console.error("Config API error:",e),v.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}async function E(e){try{await (0,w.getDatabase)();let{key:t,value:r}=await e.json();if(!t)return v.NextResponse.json({error:"Key is required"},{status:400});let n=await (0,m.setConfig)(t,null==r?"":"string"==typeof r?r:JSON.stringify(r));return v.NextResponse.json(n)}catch(e){return console.error("Config POST API error:",e),v.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}e.s(["GET",()=>y,"POST",()=>E,"runtime",0,"nodejs"],77025);var C=e.i(77025);let A=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/config/route",pathname:"/api/config",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/config/route.ts",nextConfigOutput:"",userland:C}),{workAsyncStorage:N,workUnitAsyncStorage:b,serverHooks:P}=A;function T(){return(0,n.patchFetch)({workAsyncStorage:N,workUnitAsyncStorage:b})}async function j(e,t,n){A.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/config/route";v=v.replace(/\/index$/,"")||"/";let w=await A.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:m,params:y,nextConfig:E,parsedUrl:C,isDraftMode:N,prerenderManifest:b,routerServerContext:P,isOnDemandRevalidate:T,revalidateOnlyGenerated:j,resolvedPathname:k,clientReferenceManifest:O,serverActionsManifest:q}=w,S=(0,i.normalizeAppPath)(v),_=!!(b.dynamicRoutes[S]||b.routes[k]),I=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,C,!1):t.end("This page could not be found"),null);if(_&&!N){let e=!!b.routes[k],t=b.dynamicRoutes[S];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await I();throw new g.NoFallbackError}}let H=null;!_||A.isDev||N||(H="/index"===(H=k)?"/":H);let U=!0===A.isDev||!_,D=_&&!U;q&&O&&(0,o.setManifestsSingleton)({page:v,clientReferenceManifest:O,serverActionsManifest:q});let M=e.method||"GET",K=(0,s.getTracer)(),$=K.getActiveScopeSpan(),F={params:y,prerenderManifest:b,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:U,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>A.onRequestError(e,t,n,a,P)},sharedContext:{buildId:m}},L=new l.NodeNextRequest(e),B=new l.NodeNextResponse(t),G=d.NextRequestAdapter.fromNodeNextRequest(L,(0,d.signalFromNodeResponse)(t));try{let o=async e=>A.handle(G,F).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=K.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 n=r.get("next.route");if(n){let t=`${M} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${v}`)}),i=!!(0,a.getRequestMeta)(e,"minimalMode"),l=async a=>{var s,l;let d=async({previousCacheEntry:r})=>{try{if(!i&&T&&j&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await o(a);e.fetchMetrics=F.renderOpts.fetchMetrics;let l=F.renderOpts.pendingWaitUntil;l&&n.waitUntil&&(n.waitUntil(l),l=void 0);let d=F.renderOpts.collectedTags;if(!_)return await (0,c.sendResponse)(L,B,s,F.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,x.toNodeOutgoingHttpHeaders)(s.headers);d&&(t[R.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==F.renderOpts.collectedRevalidate&&!(F.renderOpts.collectedRevalidate>=R.INFINITE_CACHE)&&F.renderOpts.collectedRevalidate,n=void 0===F.renderOpts.collectedExpire||F.renderOpts.collectedExpire>=R.INFINITE_CACHE?void 0:F.renderOpts.collectedExpire;return{value:{kind:f.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await A.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:T})},!1,P),t}},u=await A.handleResponse({req:e,nextConfig:E,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:b,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:j,responseGenerator:d,waitUntil:n.waitUntil,isMinimalMode:i});if(!_)return null;if((null==u||null==(s=u.value)?void 0:s.kind)!==f.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});i||t.setHeader("x-nextjs-cache",T?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),N&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let g=(0,x.fromNodeOutgoingHttpHeaders)(u.value.headers);return i&&_||g.delete(R.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||g.get("Cache-Control")||g.set("Cache-Control",(0,h.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(L,B,new Response(u.value.body,{headers:g,status:u.value.status||200})),null};$?await l($):await K.withPropagatedContext(e.headers,()=>K.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${v}`,kind:s.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},l))}catch(t){if(t instanceof g.NoFallbackError||await A.onRequestError(e,t,{routerKind:"App Router",routePath:S,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:T})},!1,P),_)throw t;return await (0,c.sendResponse)(L,B,new Response(null,{status:500})),null}}e.s(["handler",()=>j,"patchFetch",()=>T,"routeModule",()=>A,"serverHooks",()=>P,"workAsyncStorage",()=>N,"workUnitAsyncStorage",()=>b],37765)}];
1
+ module.exports=[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"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},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"))},37765,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=e.i(59756),o=e.i(61916),s=e.i(74677),i=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),x=e.i(70101),h=e.i(26937),g=e.i(10372),f=e.i(93695);e.i(52474);var R=e.i(220),v=e.i(89171),w=e.i(71560),y=e.i(97731),m=e.i(54799);async function C(e){try{await (0,w.getDatabase)();let{searchParams:t}=new URL(e.url),r=t.get("key");if(r){let e=await (0,y.getConfig)(r);if(!e)return v.NextResponse.json({error:"Config not found"},{status:404});return v.NextResponse.json(e)}let n=await (0,y.getAllConfig)();if(!n.api_key){let e=`aar-${m.default.randomBytes(16).toString("hex")}`;await (0,y.setConfig)("api_key",e),n.api_key=e,console.log("[Config API] Generated default API key")}return v.NextResponse.json(n)}catch(e){return console.error("Config API error:",e),v.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}async function E(e){try{await (0,w.getDatabase)();let{key:t,value:r}=await e.json();if(!t)return v.NextResponse.json({error:"Key is required"},{status:400});let n=await (0,y.setConfig)(t,null==r?"":"string"==typeof r?r:JSON.stringify(r));return v.NextResponse.json(n)}catch(e){return console.error("Config POST API error:",e),v.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}e.s(["GET",()=>C,"POST",()=>E,"runtime",0,"nodejs"],77025);var A=e.i(77025);let N=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/config/route",pathname:"/api/config",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/config/route.ts",nextConfigOutput:"",userland:A}),{workAsyncStorage:b,workUnitAsyncStorage:P,serverHooks:k}=N;function T(){return(0,n.patchFetch)({workAsyncStorage:b,workUnitAsyncStorage:P})}async function j(e,t,n){N.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/config/route";v=v.replace(/\/index$/,"")||"/";let w=await N.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:y,params:m,nextConfig:C,parsedUrl:E,isDraftMode:A,prerenderManifest:b,routerServerContext:P,isOnDemandRevalidate:k,revalidateOnlyGenerated:T,resolvedPathname:j,clientReferenceManifest:O,serverActionsManifest:S}=w,_=(0,i.normalizeAppPath)(v),q=!!(b.dynamicRoutes[_]||b.routes[j]),I=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,E,!1):t.end("This page could not be found"),null);if(q&&!A){let e=!!b.routes[j],t=b.dynamicRoutes[_];if(t&&!1===t.fallback&&!e){if(C.experimental.adapterPath)return await I();throw new f.NoFallbackError}}let H=null;!q||N.isDev||A||(H="/index"===(H=j)?"/":H);let U=!0===N.isDev||!q,D=q&&!U;S&&O&&(0,s.setManifestsSingleton)({page:v,clientReferenceManifest:O,serverActionsManifest:S});let M=e.method||"GET",$=(0,o.getTracer)(),K=$.getActiveScopeSpan(),F={params:m,prerenderManifest:b,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts},cacheComponents:!!C.cacheComponents,supportsDynamicResponse:U,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:C.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>N.onRequestError(e,t,n,a,P)},sharedContext:{buildId:y}},B=new l.NodeNextRequest(e),L=new l.NodeNextResponse(t),G=d.NextRequestAdapter.fromNodeNextRequest(B,(0,d.signalFromNodeResponse)(t));try{let s=async e=>N.handle(G,F).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.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 n=r.get("next.route");if(n){let t=`${M} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${v}`)}),i=!!(0,a.getRequestMeta)(e,"minimalMode"),l=async a=>{var o,l;let d=async({previousCacheEntry:r})=>{try{if(!i&&k&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await s(a);e.fetchMetrics=F.renderOpts.fetchMetrics;let l=F.renderOpts.pendingWaitUntil;l&&n.waitUntil&&(n.waitUntil(l),l=void 0);let d=F.renderOpts.collectedTags;if(!q)return await (0,c.sendResponse)(B,L,o,F.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,x.toNodeOutgoingHttpHeaders)(o.headers);d&&(t[g.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==F.renderOpts.collectedRevalidate&&!(F.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&F.renderOpts.collectedRevalidate,n=void 0===F.renderOpts.collectedExpire||F.renderOpts.collectedExpire>=g.INFINITE_CACHE?void 0:F.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await N.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:k})},!1,P),t}},u=await N.handleResponse({req:e,nextConfig:C,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:b,isRoutePPREnabled:!1,isOnDemandRevalidate:k,revalidateOnlyGenerated:T,responseGenerator:d,waitUntil:n.waitUntil,isMinimalMode:i});if(!q)return null;if((null==u||null==(o=u.value)?void 0:o.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});i||t.setHeader("x-nextjs-cache",k?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,x.fromNodeOutgoingHttpHeaders)(u.value.headers);return i&&q||f.delete(g.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,h.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(B,L,new Response(u.value.body,{headers:f,status:u.value.status||200})),null};K?await l(K):await $.withPropagatedContext(e.headers,()=>$.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${v}`,kind:o.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},l))}catch(t){if(t instanceof f.NoFallbackError||await N.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:k})},!1,P),q)throw t;return await (0,c.sendResponse)(B,L,new Response(null,{status:500})),null}}e.s(["handler",()=>j,"patchFetch",()=>T,"routeModule",()=>N,"serverHooks",()=>k,"workAsyncStorage",()=>b,"workUnitAsyncStorage",()=>P],37765)}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__f0461b8d._.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/app/api/config/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { getDatabase } from '@/db/database';\nimport { getConfig, setConfig, getAllConfig } from '@/db/queries';\n\n// Ensure Node.js runtime (required for SQLite)\nexport const runtime = 'nodejs';\n\nexport async function GET(request: NextRequest) {\n try {\n // Initialize database on request (safer than module load)\n await getDatabase();\n\n const { searchParams } = new URL(request.url);\n const key = searchParams.get('key');\n\n if (key) {\n const config = await getConfig(key);\n if (!config) {\n return NextResponse.json(\n { error: 'Config not found' },\n { status: 404 }\n );\n }\n return NextResponse.json(config);\n }\n\n const configs = await getAllConfig();\n return NextResponse.json(configs);\n } catch (error: any) {\n console.error('Config API error:', error);\n return NextResponse.json(\n { error: error.message || 'Internal server error', stack: process.env.NODE_ENV === 'development' ? error.stack : undefined },\n { status: 500 }\n );\n }\n}\n\nexport async function POST(request: NextRequest) {\n try {\n // Initialize database on request\n await getDatabase();\n\n const body = await request.json();\n const { key, value } = body;\n\n if (!key) {\n return NextResponse.json(\n { error: 'Key is required' },\n { status: 400 }\n );\n }\n\n // Allow value to be null, undefined, or empty string (save as empty string)\n const config = await setConfig(key, (value === undefined || value === null) ? '' : typeof value === 'string' ? value : JSON.stringify(value));\n\n return NextResponse.json(config);\n } catch (error: any) {\n console.error('Config POST API error:', error);\n return NextResponse.json(\n { error: error.message || 'Internal server error', stack: process.env.NODE_ENV === 'development' ? error.stack : undefined },\n { status: 500 }\n );\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/config/route\",\n pathname: \"/api/config\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/config/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/config/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":[],"mappings":"8iCCAA,IAAA,EAAA,E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AeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[1]}
1
+ {"version":3,"sources":["../../../src/app/api/config/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { getDatabase } from '@/db/database';\nimport { getConfig, setConfig, getAllConfig } from '@/db/queries';\nimport crypto from 'crypto';\n\n// Ensure Node.js runtime (required for SQLite)\nexport const runtime = 'nodejs';\n\n/**\n * 生成随机的 API Key(用于网关密码默认值)\n */\nfunction generateRandomApiKey(): string {\n return `aar-${crypto.randomBytes(16).toString('hex')}`;\n}\n\nexport async function GET(request: NextRequest) {\n try {\n // Initialize database on request (safer than module load)\n await getDatabase();\n\n const { searchParams } = new URL(request.url);\n const key = searchParams.get('key');\n\n if (key) {\n const config = await getConfig(key);\n if (!config) {\n return NextResponse.json(\n { error: 'Config not found' },\n { status: 404 }\n );\n }\n return NextResponse.json(config);\n }\n\n const configs = await getAllConfig();\n \n // 如果 api_key 为空,生成一个随机默认值\n if (!configs.api_key) {\n const defaultApiKey = generateRandomApiKey();\n await setConfig('api_key', defaultApiKey);\n configs.api_key = defaultApiKey;\n console.log('[Config API] Generated default API key');\n }\n \n return NextResponse.json(configs);\n } catch (error: any) {\n console.error('Config API error:', error);\n return NextResponse.json(\n { error: error.message || 'Internal server error', stack: process.env.NODE_ENV === 'development' ? error.stack : undefined },\n { status: 500 }\n );\n }\n}\n\nexport async function POST(request: NextRequest) {\n try {\n // Initialize database on request\n await getDatabase();\n\n const body = await request.json();\n const { key, value } = body;\n\n if (!key) {\n return NextResponse.json(\n { error: 'Key is required' },\n { status: 400 }\n );\n }\n\n // Allow value to be null, undefined, or empty string (save as empty string)\n const config = await setConfig(key, (value === undefined || value === null) ? '' : typeof value === 'string' ? value : JSON.stringify(value));\n\n return NextResponse.json(config);\n } catch (error: any) {\n console.error('Config POST API error:', error);\n return NextResponse.json(\n { error: error.message || 'Internal server error', stack: process.env.NODE_ENV === 'development' ? error.stack : undefined },\n { status: 500 }\n );\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/config/route\",\n pathname: \"/api/config\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/config/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/config/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":[],"mappings":"8iCCAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,CAAA,CAAA,OAAA,IAAA,EAAA,EAAA,CAAA,CAAA,KDhBA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAYO,eAAe,EAAI,CAAoB,EAC5C,GAAI,CAEF,MAAM,CAAA,EAAA,EAAA,WAAA,AAAW,IAEjB,GAAM,cAAE,CAAY,CAAE,CAAG,IAAI,IAAI,EAAQ,GAAG,EACtC,EAAM,EAAa,GAAG,CAAC,OAE7B,GAAI,EAAK,CACP,IAAM,EAAS,MAAM,CAAA,EAAA,EAAA,SAAA,AAAS,EAAC,GAC/B,GAAI,CAAC,EACH,MADW,CACJ,EAA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AqB,EAAQ,AAAT,GAAY,CAAC,kBAAkB,AAC7F,EAAQ,GAAG,CAAC,gBAAiB,CAAA,EAAA,EAAA,qBAAA,AAAqB,EAAC,EAAW,YAAY,GAE9E,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,GAEf,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[1]}
@@ -0,0 +1,3 @@
1
+ module.exports=[76470,a=>{"use strict";a.s(["ToastProvider",()=>c,"useToast",()=>d]);var b=a.i(11857);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call ToastProvider() from the server but ToastProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/components/ToastProvider.tsx <module evaluation>","ToastProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useToast() from the server but useToast is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/components/ToastProvider.tsx <module evaluation>","useToast")},11328,a=>{"use strict";a.s(["ToastProvider",()=>c,"useToast",()=>d]);var b=a.i(11857);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call ToastProvider() from the server but ToastProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/components/ToastProvider.tsx","ToastProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useToast() from the server but useToast is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/components/ToastProvider.tsx","useToast")},79490,a=>{"use strict";a.i(76470);var b=a.i(11328);a.n(b)},4730,a=>{a.v({name:"ai-agent-router",version:"0.2.2",description:"A unified API gateway for managing multiple AI model providers (Anthropic, OpenAI, Gemini, etc.)",main:"dist/src/cli/index.js",bin:{aar:"./dist/src/cli/index.js"},scripts:{dev:"next dev -p 9527",build:"next build && tsc",start:"node dist/src/cli/index.js start",stop:"node dist/src/cli/index.js stop",lint:"eslint .",pub:"npm run build && npm publish","type-check":"tsc --noEmit"},keywords:["api-gateway","ai","openai","anthropic","gemini","proxy"],author:"",license:"MIT",dependencies:{"@anthropic-ai/sdk":"^0.71.2","sql.js":"^1.13.0",commander:"^11.1.0","crypto-js":"^4.2.0",globals:"^17.0.0",next:"^16.1.6",react:"^18.2.0","react-dom":"^18.2.0","typescript-eslint":"^8.53.0",autoprefixer:"^10.4.0",postcss:"^8.4.0",tailwindcss:"^3.3.0"},devDependencies:{"@types/sql.js":"^1.4.9","@types/crypto-js":"^4.2.0","@types/node":"^20.10.0","@types/react":"^18.2.0","@types/react-dom":"^18.2.0",eslint:"^9.39.2","eslint-config-next":"^16.1.1",typescript:"^5.3.0"},engines:{node:">=18.0.0"}})},27572,a=>{"use strict";var b=a.i(7997),c=a.i(79490),d=a.i(4730);function e(){return(0,b.jsx)("footer",{className:"fixed bottom-0 left-0 right-0 py-2 text-center text-xs text-gray-400 bg-gray-50 border-t border-gray-200",children:(0,b.jsxs)("span",{children:["AAR v",d.default.version]})})}function f({children:a}){return(0,b.jsx)("html",{lang:"zh-CN",suppressHydrationWarning:!0,children:(0,b.jsxs)("body",{className:"pb-10",children:[(0,b.jsx)(c.ToastProvider,{children:a}),(0,b.jsx)(e,{})]})})}a.s(["default",()=>f,"metadata",0,{title:"AAR - AI Agent Router",description:"Unified API gateway for managing multiple AI model providers"}],27572)}];
2
+
3
+ //# sourceMappingURL=_69468f4c._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/app/components/ToastProvider.tsx/__nextjs-internal-proxy.mjs","turbopack:///[project]/package.json","../../../../src/app/layout.tsx","../../../../src/app/components/Footer.tsx"],"sourcesContent":["// This file is generated by next-core EcmascriptClientReferenceModule.\nimport { registerClientReference } from \"react-server-dom-turbopack/server\";\nexport const ToastProvider = registerClientReference(\n function() { throw new Error(\"Attempted to call ToastProvider() from the server but ToastProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.\"); },\n \"[project]/src/app/components/ToastProvider.tsx\",\n \"ToastProvider\",\n);\nexport const useToast = registerClientReference(\n function() { throw new Error(\"Attempted to call useToast() from the server but useToast is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.\"); },\n \"[project]/src/app/components/ToastProvider.tsx\",\n \"useToast\",\n);\n","{\"name\":\"ai-agent-router\",\"version\":\"0.2.2\",\"description\":\"A unified API gateway for managing multiple AI model providers (Anthropic, OpenAI, Gemini, etc.)\",\"main\":\"dist/src/cli/index.js\",\"bin\":{\"aar\":\"./dist/src/cli/index.js\"},\"scripts\":{\"dev\":\"next dev -p 9527\",\"build\":\"next build && tsc\",\"start\":\"node dist/src/cli/index.js start\",\"stop\":\"node dist/src/cli/index.js stop\",\"lint\":\"eslint .\",\"pub\":\"npm run build && npm publish\",\"type-check\":\"tsc --noEmit\"},\"keywords\":[\"api-gateway\",\"ai\",\"openai\",\"anthropic\",\"gemini\",\"proxy\"],\"author\":\"\",\"license\":\"MIT\",\"dependencies\":{\"@anthropic-ai/sdk\":\"^0.71.2\",\"sql.js\":\"^1.13.0\",\"commander\":\"^11.1.0\",\"crypto-js\":\"^4.2.0\",\"globals\":\"^17.0.0\",\"next\":\"^16.1.6\",\"react\":\"^18.2.0\",\"react-dom\":\"^18.2.0\",\"typescript-eslint\":\"^8.53.0\",\"autoprefixer\":\"^10.4.0\",\"postcss\":\"^8.4.0\",\"tailwindcss\":\"^3.3.0\"},\"devDependencies\":{\"@types/sql.js\":\"^1.4.9\",\"@types/crypto-js\":\"^4.2.0\",\"@types/node\":\"^20.10.0\",\"@types/react\":\"^18.2.0\",\"@types/react-dom\":\"^18.2.0\",\"eslint\":\"^9.39.2\",\"eslint-config-next\":\"^16.1.1\",\"typescript\":\"^5.3.0\"},\"engines\":{\"node\":\">=18.0.0\"}}","import type { Metadata } from 'next';\nimport './globals.css';\nimport { ToastProvider } from './components/ToastProvider';\nimport Footer from './components/Footer';\n\nexport const metadata: Metadata = {\n title: 'AAR - AI Agent Router',\n description: 'Unified API gateway for managing multiple AI model providers',\n};\n\nexport default function RootLayout({\n children,\n}: {\n children: React.ReactNode;\n}) {\n return (\n <html lang=\"zh-CN\" suppressHydrationWarning>\n <body className=\"pb-10\">\n <ToastProvider>{children}</ToastProvider>\n <Footer />\n </body>\n </html>\n );\n}\n","import packageJson from '../../../package.json';\n\nexport default function Footer() {\n return (\n <footer className=\"fixed bottom-0 left-0 right-0 py-2 text-center text-xs text-gray-400 bg-gray-50 border-t border-gray-200\">\n <span>AAR v{packageJson.version}</span>\n </footer>\n );\n}\n"],"names":[],"mappings":"qFACA,IAAA,EAAA,EAAA,CAAA,CAAA,OACO,IAAM,EAAgB,CAAA,EAAA,EAAA,uBAAA,AAAuB,EAChD,WAAa,MA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