@circuitwall/jarela 0.14.0 → 1.0.0
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/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +1 -1
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +2 -2
- package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/v1/agents/[id]/route.js +6 -1
- package/.next/standalone/.next/server/app/api/v1/agents/[id]/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/agents/route.js +6 -1
- package/.next/standalone/.next/server/app/api/v1/agents/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js +9 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/route.js +9 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js +36 -29
- package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/events/route.js +7 -1
- package/.next/standalone/.next/server/app/api/v1/events/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/route.js +3 -3
- package/.next/standalone/.next/server/app/api/v1/extensions/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +4 -4
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/health/route.js +7 -1
- package/.next/standalone/.next/server/app/api/v1/health/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/mcp-servers/[name]/route.js +9 -1
- package/.next/standalone/.next/server/app/api/v1/mcp-servers/[name]/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/mcp-servers/route.js +9 -1
- package/.next/standalone/.next/server/app/api/v1/mcp-servers/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/models/route.js +6 -1
- package/.next/standalone/.next/server/app/api/v1/models/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +7 -1
- package/.next/standalone/.next/server/app/api/v1/page-capture/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +14 -7
- package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/providers/[provider]/models/route.js +28 -0
- package/.next/standalone/.next/server/app/api/v1/providers/[provider]/models/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/providers/route.js +7 -1
- package/.next/standalone/.next/server/app/api/v1/providers/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js +16 -2
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/threads/route.js +6 -1
- package/.next/standalone/.next/server/app/api/v1/threads/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/tools/route.js +10 -3
- package/.next/standalone/.next/server/app/api/v1/tools/route.js.map +1 -1
- package/.next/standalone/.next/server/app/index.html +2 -2
- package/.next/standalone/.next/server/app/index.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page.js +56 -0
- package/.next/standalone/.next/server/app/page.js.map +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/setup.html +1 -1
- package/.next/standalone/.next/server/app/setup.rsc +2 -2
- package/.next/standalone/.next/server/app/setup.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/setup.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/setup.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/setup.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/setup.segments/setup/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/setup.segments/setup.segment.rsc +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +1 -1
- package/.next/standalone/.next/server/chunks/1683.js +2 -2
- package/.next/standalone/.next/server/chunks/2082.js +122 -13
- package/.next/standalone/.next/server/chunks/2082.js.map +1 -1
- package/.next/standalone/.next/server/chunks/210.js +3 -3
- package/.next/standalone/.next/server/chunks/210.js.map +1 -1
- package/.next/standalone/.next/server/chunks/239.js +1902 -1487
- package/.next/standalone/.next/server/chunks/239.js.map +1 -1
- package/.next/standalone/.next/server/chunks/2447.js +9 -1
- package/.next/standalone/.next/server/chunks/2447.js.map +1 -1
- package/.next/standalone/.next/server/chunks/423.js +125 -16
- package/.next/standalone/.next/server/chunks/423.js.map +1 -1
- package/.next/standalone/.next/server/chunks/4631.js +36 -29
- package/.next/standalone/.next/server/chunks/4631.js.map +1 -1
- package/.next/standalone/.next/server/chunks/5937.js +3 -2
- package/.next/standalone/.next/server/chunks/5937.js.map +1 -1
- package/.next/standalone/.next/server/chunks/{947.js → 8866.js} +11321 -10883
- package/.next/standalone/.next/server/chunks/8866.js.map +1 -0
- package/.next/standalone/.next/server/chunks/9032.js +3 -3
- package/.next/standalone/.next/server/chunks/9032.js.map +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
- package/.next/standalone/.next/server/middleware.js +122 -13
- package/.next/standalone/.next/server/pages/404.html +2 -2
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/proxy.js.map +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/app/{page-473b39ec30c7f569.js → page-a7cae65f235e2942.js} +57 -1
- package/.next/standalone/.next/static/chunks/app/page-a7cae65f235e2942.js.map +1 -0
- package/.next/standalone/.next/static/css/{6f8b1a84bcbcd467.css → e57bdbbbb5a05779.css} +2 -2
- package/.next/standalone/.next/static/css/e57bdbbbb5a05779.css.map +1 -0
- package/.next/standalone/package.json +9 -1
- package/CHANGELOG.md +90 -0
- package/README.md +30 -2
- package/api/types.ts +8 -0
- package/app/api/v1/agents/[id]/route.ts +7 -0
- package/app/api/v1/agents/route.ts +7 -0
- package/app/api/v1/events/route.ts +8 -0
- package/app/api/v1/extensions/route.ts +2 -2
- package/app/api/v1/extensions/tools/[name]/secrets/route.ts +3 -3
- package/app/api/v1/health/route.ts +8 -0
- package/app/api/v1/models/route.ts +7 -0
- package/app/api/v1/page-capture/route.ts +8 -0
- package/app/api/v1/providers/route.ts +8 -0
- package/app/api/v1/threads/[thread_id]/route.ts +8 -0
- package/app/api/v1/threads/[thread_id]/run/route.ts +9 -0
- package/app/api/v1/threads/route.ts +7 -0
- package/app/api/v1/tools/route.ts +9 -0
- package/components/chat/ContextUsageBar.tsx +44 -0
- package/lib/agents/llm.ts +25 -2
- package/lib/agents/run-thread.ts +13 -1
- package/lib/agents/stream-collector.ts +9 -1
- package/lib/api/serializers.test.ts +15 -0
- package/lib/api/serializers.ts +8 -0
- package/lib/db/migrations.ts +15 -0
- package/lib/health/runner.test.ts +24 -2
- package/lib/mcp/registry.ts +14 -6
- package/lib/providers/anthropic.test.ts +95 -0
- package/lib/providers/anthropic.ts +106 -10
- package/lib/providers/jarela-chat-model.ts +9 -1
- package/lib/providers/known-context-windows.ts +21 -0
- package/lib/providers/types.ts +21 -1
- package/lib/stores/message-usage.test.ts +34 -0
- package/lib/stores/message-usage.ts +15 -3
- package/lib/stores/pricing.test.ts +52 -0
- package/lib/stores/pricing.ts +26 -1
- package/lib/tools/builtins.ts +4 -0
- package/lib/tools/extension-surfaces.test.ts +79 -0
- package/lib/tools/extension-surfaces.ts +153 -0
- package/lib/tools/index.ts +27 -8
- package/lib/tools/list-tools.test.ts +76 -0
- package/lib/tools/list-tools.ts +84 -0
- package/lib/tools/mcp-servers-info.test.ts +73 -0
- package/lib/tools/mcp-servers-info.ts +71 -0
- package/lib/tools/providers-info.test.ts +73 -0
- package/lib/tools/providers-info.ts +106 -0
- package/lib/tools/registry.ts +36 -25
- package/lib/tools/types.ts +13 -0
- package/package.json +9 -1
- package/.next/standalone/.next/server/chunks/947.js.map +0 -1
- package/.next/standalone/.next/static/chunks/app/page-473b39ec30c7f569.js.map +0 -1
- package/.next/standalone/.next/static/css/6f8b1a84bcbcd467.css.map +0 -1
- /package/.next/standalone/.next/static/{T0p2VVPsJPj44rwbmjaFb → d_vhp-lJqfdjRFpnLVIqZ}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{T0p2VVPsJPj44rwbmjaFb → d_vhp-lJqfdjRFpnLVIqZ}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"../app/api/v1/providers/[provider]/models/route.js","mappings":";;;;;;;;;;AAAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAwD;AACV;AAC+B;AAK9B;AAoB/C,6EAA6E;AAC7E,2EAA2E;AAC3E,yEAAyE;AACzE,MAAMM,0BAA0B,KAAK,KAAK;AAE1C,MAAMC,eAAe,IAAIC;AAEzB,eAAeC,iBAAiBC,QAAgB,EAAEC,KAAc;IAC9D,MAAMC,MAAMC,KAAKD,GAAG;IACpB,IAAI,CAACD,OAAO;QACV,MAAMG,SAASP,aAAaQ,GAAG,CAACL;QAChC,IAAII,UAAUF,MAAME,OAAOE,SAAS,GAAGV,yBAAyB,OAAOQ,OAAOG,IAAI;IACpF;IACA,MAAMA,OAAO,MAAMC,aAAaR;IAChCH,aAAaY,GAAG,CAACT,UAAU;QAAEO;QAAMD,WAAWJ;IAAI;IAClD,OAAOK;AACT;AAEO,eAAeG,IAAIC,GAAgB,EAAE,EAAEC,MAAM,EAAU;IAC5D,MAAM,EAAEZ,QAAQ,EAAE,GAAG,MAAMY;IAC3B,MAAMX,QAAQU,IAAIE,OAAO,CAACC,YAAY,CAACT,GAAG,CAAC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,OAAO,MAAsD,GAAG,CAE3D,CAAC;AACN,CAAC;AACD;AACA;AACA;AACA,QAAQ,sDAAsD;AAC9D;AACA,WAAW,0BAAW;AACtB;AACA;AACA,KAAK;AACL;AAC0F;AACnF;AACP;AACA,QAAQ,+BAAc;AACtB;AACA;AACA,QAAQ,+BAAc;AACtB;AACA;AACA;AACA;AACA;AACA,QAAQ,KAAqB,EAAE,EAE1B,CAAC;AACN;AACA;AACA;AACA,+BAA+B,KAAwC;AACvE;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,6NAA6N;AACzO,8BAA8B,+BAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,2CAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,6CAAqB;AAC7B;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,mBAAmB,0BAAS;AAC5B;AACA;AACA,kCAAkC,+BAAc;AAChD,6BAA6B,+BAAc;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,4BAA4B,oBAAe;AAC3C,4BAA4B,qBAAgB;AAC5C,oBAAoB,+BAAkB,kCAAkC,uCAAsB;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iEAAiE,wBAAc;AAC/E,+DAA+D,yCAAyC;AACxG;AACA;AACA;AACA;AACA,oCAAoC,QAAQ,EAAE,MAAM;AACpD;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB,uCAAuC,QAAQ,EAAE,QAAQ;AACzD;AACA,aAAa;AACb;AACA;AACA;AACA,+CAA+C,oBAAoB;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,uCAAyB;AACjE;AACA,oCAAoC,oCAAsB;AAC1D;AACA;AACA;AACA;AACA,sJAAsJ,4BAAc;AACpK,0IAA0I,4BAAc;AACxJ;AACA;AACA;AACA,sCAAsC,8BAAe;AACrD;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA,8BAA8B,qCAAY;AAC1C;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,oCAAmB;AACjE;AACA;AACA,6BAA6B;AAC7B,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,oBAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,qIAAqI,8BAAe;AACpJ;AACA,2GAA2G,iHAAiH;AAC5N;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,yCAA2B;AACvD;AACA,+BAA+B,oCAAsB;AACrD;AACA;AACA;AACA;AACA,6CAA6C,uCAAqB;AAClE;AACA,kBAAkB,qCAAY;AAC9B;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,6EAA6E,wBAAc;AAC3F,iCAAiC,QAAQ,EAAE,QAAQ;AACnD,0BAA0B,qBAAQ;AAClC;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,MAAM;AACN,6BAA6B,2CAAe;AAC5C;AACA;AACA;AACA;AACA;AACA,kCAAkC,oCAAmB;AACrD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AO;IAClB;AACF;AAEO,SAAS7G,sBAAsBM,QAAgB,EAAEuG,QAAgB;IACtE,OAAOc,oBAAoBrH,UAAUuG,WAAWzC,kBAAkB;AACpE;AAEO,SAASnE,wBAAwBK,QAAgB,EAAEuG,QAAgB;IACxE,OAAOc,oBAAoBrH,UAAUuG,WAAWxC,qBAAqB;AACvE;;;;;;;;ACxHA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA","sources":["webpack://@circuitwall/jarela/external commonjs \"next/dist/shared/lib/router/utils/app-paths\"","webpack://@circuitwall/jarela/external node-commonjs \"node:process\"","webpack://@circuitwall/jarela/external commonjs2 \"url\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/server/app-render/after-task-async-storage.external.js\"","webpack://@circuitwall/jarela/./app/api/v1/providers/[provider]/models/route.ts","webpack://@circuitwall/jarela/?f3fb","webpack://@circuitwall/jarela/external commonjs \"undici\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/compiled/next-server/app-page.runtime.prod.js\"","webpack://@circuitwall/jarela/external node-commonjs \"node:async_hooks\"","webpack://@circuitwall/jarela/external commonjs2 \"stream\"","webpack://@circuitwall/jarela/external commonjs2 \"util\"","webpack://@circuitwall/jarela/external commonjs2 \"fs\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/server/app-render/work-async-storage.external.js\"","webpack://@circuitwall/jarela/external node-commonjs \"node:child_process\"","webpack://@circuitwall/jarela/external commonjs2 \"path\"","webpack://@circuitwall/jarela/external node-commonjs \"node:http\"","webpack://@circuitwall/jarela/external node-commonjs \"node:https\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/compiled/next-server/app-route.runtime.prod.js\"","webpack://@circuitwall/jarela/./lib/providers/known-context-windows.ts","webpack://@circuitwall/jarela/external node-commonjs \"node:os\"","webpack://@circuitwall/jarela/external node-commonjs \"node:fs/promises\"","webpack://@circuitwall/jarela/external commonjs2 \"crypto\"","webpack://@circuitwall/jarela/external commonjs2 \"https\"","webpack://@circuitwall/jarela/external node-commonjs \"node:stream\"","webpack://@circuitwall/jarela/external node-commonjs \"node:util\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/server/app-render/work-unit-async-storage.external.js\"","webpack://@circuitwall/jarela/external node-commonjs \"node:fs\"","webpack://@circuitwall/jarela/external node-commonjs \"node:url\"","webpack://@circuitwall/jarela/external node-commonjs \"node:worker_threads\"","webpack://@circuitwall/jarela/external node-commonjs \"node:path\"","webpack://@circuitwall/jarela/external node-commonjs \"node:crypto\"","webpack://@circuitwall/jarela/external commonjs2 \"buffer\"","webpack://@circuitwall/jarela/external node-commonjs \"node:sqlite\"","webpack://@circuitwall/jarela/external commonjs2 \"http\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/shared/lib/no-fallback-error.external\"","webpack://@circuitwall/jarela/external commonjs2 \"events\""],"sourcesContent":["module.exports = require(\"next/dist/shared/lib/router/utils/app-paths\");","module.exports = require(\"node:process\");","module.exports = require(\"url\");","module.exports = require(\"next/dist/server/app-render/after-task-async-storage.external.js\");","import { NextRequest, NextResponse } from \"next/server\";\nimport { getProvider } from \"@/lib/providers\";\nimport { listModelConfigs, getModelParams } from \"@/lib/stores/model-config\";\nimport type { ProviderCatalogModel, ProviderParams } from \"@/lib/providers/types\";\nimport {\n getKnownContextLength,\n getKnownMaxOutputTokens,\n} from \"@/lib/providers/known-context-windows\";\n\nexport interface CatalogModel {\n id: string;\n context_length: number | null;\n max_output_tokens: number | null;\n hosted_on: string | null;\n capabilities: {\n vision: boolean;\n tools: boolean;\n streaming: boolean;\n json_mode: boolean;\n web_search: boolean;\n audio: boolean;\n files: boolean;\n };\n}\n\ntype Params = { params: Promise<{ provider: string }> };\n\n// Live provider catalogs (OpenAI, GitHub Copilot) hit external APIs on every\n// call; static ones still cost JSON construction. Cache per-provider for a\n// short TTL so flipping panels / model browsers doesn't re-hit upstream.\nconst PROVIDER_CATALOG_TTL_MS = 10 * 60 * 1000;\ntype CachedCatalog = { data: CatalogModel[]; fetchedAt: number };\nconst catalogCache = new Map<string, CachedCatalog>();\n\nasync function getCachedCatalog(provider: string, force: boolean): Promise<CatalogModel[]> {\n const now = Date.now();\n if (!force) {\n const cached = catalogCache.get(provider);\n if (cached && now - cached.fetchedAt < PROVIDER_CATALOG_TTL_MS) return cached.data;\n }\n const data = await fetchCatalog(provider);\n catalogCache.set(provider, { data, fetchedAt: now });\n return data;\n}\n\nexport async function GET(req: NextRequest, { params }: Params) {\n const { provider } = await params;\n const force = req.nextUrl.searchParams.get(\"fresh\") === \"1\";\n\n try {\n const models = await getCachedCatalog(provider, force);\n return NextResponse.json(models, {\n headers: {\n \"Cache-Control\": \"private, max-age=300, stale-while-revalidate=600\",\n },\n });\n } catch (err) {\n return NextResponse.json({ error: String(err) }, { status: 500 });\n }\n}\n\n// POST allows the editor to ship the in-form credentials (api_key /\n// base_url / extra_headers) before the user has saved them. We never cache\n// these responses since they're keyed on user-supplied secrets.\nexport async function POST(req: NextRequest, { params }: Params) {\n const { provider } = await params;\n let body: { params?: ProviderParams } = {};\n try { body = await req.json(); } catch { /* empty body is fine */ }\n try {\n const models = await fetchCatalog(provider, body.params);\n return NextResponse.json(models, { headers: { \"Cache-Control\": \"no-store\" } });\n } catch (err) {\n return NextResponse.json({ error: String(err) }, { status: 500 });\n }\n}\n\nasync function fetchCatalog(provider: string, overrides?: ProviderParams): Promise<CatalogModel[]> {\n switch (provider) {\n case \"openai\": return fetchOpenAICatalog();\n case \"github-copilot\": return fetchGitHubCopilotCatalog();\n case \"anthropic\": return anthropicKnownModels();\n case \"gemini\": return geminiKnownModels();\n case \"deepseek\": return deepseekKnownModels();\n default: return fetchExternalCatalog(provider, overrides);\n }\n}\n\nasync function fetchExternalCatalog(providerName: string, overrides?: ProviderParams): Promise<CatalogModel[]> {\n let provider;\n try {\n provider = getProvider(providerName);\n } catch {\n return [];\n }\n if (!provider.listModels) return [];\n\n // Try each saved config for this provider, plus the caller overrides.\n // Some providers ship multiple configs where only some carry usable\n // credentials; picking the first row blindly fails as soon as another\n // row is misconfigured. Overrides are merged on top of each candidate,\n // then also tried standalone, so a freshly-typed api_key works before\n // the user has saved it.\n const cfgs = listModelConfigs().filter((c) => c.provider === providerName);\n const candidates: ProviderParams[] = cfgs.map((c) => ({\n ...getModelParams(c),\n ...(overrides ?? {}),\n }));\n if (overrides && Object.keys(overrides).length > 0) candidates.push(overrides);\n if (candidates.length === 0) candidates.push(overrides ?? {});\n\n let lastErr: unknown;\n for (const params of candidates) {\n try {\n const models = await provider.listModels(params);\n return models as ProviderCatalogModel[];\n } catch (err) {\n lastErr = err;\n }\n }\n throw lastErr ?? new Error(`${providerName}: no usable credentials for catalog`);\n}\n\n// ── OpenAI ────────────────────────────────────────────────────────────────────\n\nasync function fetchOpenAICatalog(): Promise<CatalogModel[]> {\n const cfg = listModelConfigs().find((c) => c.provider === \"openai\");\n if (!cfg) throw new Error(\"No OpenAI model config found.\");\n const params = getModelParams(cfg);\n const apiKey = (params.api_key as string | undefined) ?? process.env.OPENAI_API_KEY;\n if (!apiKey) throw new Error(\"OpenAI: no api_key configured.\");\n\n const res = await fetch(\"https://api.openai.com/v1/models\", {\n headers: { Authorization: `Bearer ${apiKey}` },\n });\n if (!res.ok) throw new Error(`OpenAI catalog error: ${res.status}`);\n const data = await res.json() as { data: Array<{ id: string }> };\n\n const chatPrefixes = [\"gpt-\", \"o1\", \"o3\", \"o4\", \"chatgpt-\"];\n const chatModels = data.data\n .filter((m) => chatPrefixes.some((p) => m.id.startsWith(p)))\n .map((m): CatalogModel => ({\n id: m.id,\n context_length: getKnownContextLength(\"openai\", m.id),\n max_output_tokens: getKnownMaxOutputTokens(\"openai\", m.id),\n hosted_on: \"azure/openai\",\n capabilities: {\n vision: m.id.includes(\"vision\") || m.id.startsWith(\"gpt-4\"),\n tools: true,\n streaming: true,\n json_mode: true,\n web_search: false,\n audio: m.id.includes(\"audio\") || m.id.startsWith(\"gpt-4o\") || m.id.startsWith(\"gpt-5\"),\n files: m.id.startsWith(\"gpt-4\") || m.id.startsWith(\"gpt-5\") || m.id.startsWith(\"o\"),\n },\n }))\n .sort((a, b) => a.id.localeCompare(b.id));\n\n return chatModels;\n}\n\n// ── GitHub Copilot ────────────────────────────────────────────────────────────\n\nasync function fetchGitHubCopilotCatalog(): Promise<CatalogModel[]> {\n // We deliberately do NOT return the broad GitHub Models cross-publisher\n // registry here — that lists hundreds of models from every vendor, which is\n // confusing when the user is configuring the \"github-copilot\" provider\n // specifically. We mirror what Copilot Chat actually serves: its own\n // /models endpoint when we have an exchangeable credential, else a curated\n // fallback list. Users who want the raw GitHub Models catalog can type the\n // namespaced model id directly into the Model ID field.\n\n // 1. Prefer the in-app device-flow OAuth token — it can be exchanged.\n const { getStoredOAuthToken } = await import(\"@/lib/providers/github-copilot-auth\");\n const oauth = getStoredOAuthToken();\n if (oauth) {\n try {\n const sessionToken = await exchangeCopilotSessionToken(oauth);\n const list = await fetchCopilotChatCatalog(sessionToken);\n if (list.length > 0) return list;\n } catch { /* fall through */ }\n }\n\n // 2. Look up a saved github-copilot model config for an explicit session\n // token or a non-PAT credential that supports exchange.\n const cfg = listModelConfigs().find((c) => c.provider === \"github-copilot\");\n if (cfg) {\n const params = getModelParams(cfg);\n const sessionTok = (params.copilot_session_token as string | undefined)?.trim();\n if (sessionTok) {\n try {\n const list = await fetchCopilotChatCatalog(sessionTok);\n if (list.length > 0) return list;\n } catch { /* fall through */ }\n }\n const apiKey = (params.api_key as string | undefined) ?? process.env.GITHUB_TOKEN;\n if (apiKey && !isLikelyGitHubPat(apiKey)) {\n try {\n const sessionToken = await exchangeCopilotSessionToken(apiKey);\n const list = await fetchCopilotChatCatalog(sessionToken);\n if (list.length > 0) return list;\n } catch { /* fall through */ }\n }\n }\n\n // 3. Fallback: curated known-models list. Works even on a PAT — those\n // model IDs are valid on both Models API and Copilot Chat.\n return githubCopilotKnownModels();\n}\n\nasync function fetchCopilotChatCatalog(sessionToken: string): Promise<CatalogModel[]> {\n const res = await fetch(\"https://api.githubcopilot.com/models\", {\n headers: {\n Authorization: `Bearer ${sessionToken}`,\n \"Editor-Version\": \"vscode/1.85.0\",\n \"Copilot-Integration-Id\": \"vscode-chat\",\n \"openai-intent\": \"conversation-ai\",\n },\n });\n if (!res.ok) {\n const body = await res.text().catch(() => res.statusText);\n throw new Error(`GitHub Copilot catalog error: ${res.status} ${body}`);\n }\n const data = await res.json() as { data: Array<{ id: string; capabilities?: { supports?: { tool_calls?: boolean; streaming?: boolean; vision?: boolean } } }> };\n\n return data.data.map((m): CatalogModel => ({\n id: m.id,\n context_length: getKnownContextLength(\"github-copilot\", m.id),\n max_output_tokens: getKnownMaxOutputTokens(\"github-copilot\", m.id),\n hosted_on: \"github\",\n capabilities: {\n vision: m.capabilities?.supports?.vision ?? false,\n tools: m.capabilities?.supports?.tool_calls ?? false,\n streaming: m.capabilities?.supports?.streaming ?? true,\n json_mode: false,\n web_search: false,\n audio: false,\n files: m.capabilities?.supports?.vision ?? false,\n },\n }));\n}\n\nfunction isLikelyGitHubPat(token: string): boolean {\n return token.startsWith(\"ghp_\") || token.startsWith(\"github_pat_\") || token.startsWith(\"gho_\");\n}\n\nasync function exchangeCopilotSessionToken(pat: string): Promise<string> {\n const res = await fetch(\"https://api.github.com/copilot_internal/v2/token\", {\n headers: {\n Authorization: `token ${pat}`,\n \"User-Agent\": \"Jarela/1.0\",\n },\n });\n\n if (!res.ok) {\n const body = await res.text().catch(() => res.statusText);\n throw new Error(`GitHub Copilot token exchange failed: ${res.status} ${body}`);\n }\n\n const json = await res.json() as { token?: string };\n if (!json.token) throw new Error(\"GitHub Copilot token exchange returned no token\");\n return json.token;\n}\n\nfunction githubCopilotKnownModels(): CatalogModel[] {\n // Curated fallback — mirrors what the VS Code Copilot Chat picker exposes.\n // Used only when the live /models endpoint isn't reachable (no OAuth token\n // stored, exchange failed, etc.). Keep in sync with Copilot's current line-up.\n const v = (id: string, vision = false, tools = true): CatalogModel => ({\n id,\n context_length: getKnownContextLength(\"github-copilot\", id),\n max_output_tokens: getKnownMaxOutputTokens(\"github-copilot\", id),\n hosted_on: \"github\",\n capabilities: { vision, tools, streaming: true, json_mode: false, web_search: false, audio: false, files: vision },\n });\n return [\n // OpenAI family\n v(\"gpt-4o\", true),\n v(\"gpt-4.1\", true),\n v(\"gpt-4.1-mini\", true),\n v(\"gpt-5\", true),\n v(\"gpt-5-mini\", true),\n v(\"o1\", false),\n v(\"o3\", false),\n v(\"o3-mini\", false),\n v(\"o4-mini\", false),\n // Anthropic family\n v(\"claude-opus-4-7\", true),\n v(\"claude-sonnet-4-6\", true),\n v(\"claude-sonnet-4\", true),\n v(\"claude-3.7-sonnet\", true),\n v(\"claude-haiku-4-5\", true),\n // Google family\n v(\"gemini-2.5-pro\", true),\n v(\"gemini-2.5-flash\", true),\n v(\"gemini-2.0-flash\", true),\n ];\n}\n\n// ── Anthropic (static) ────────────────────────────────────────────────────────\n\nfunction anthropicKnownModels(): CatalogModel[] {\n return [\n { id: \"claude-opus-4-7\", context_length: 1000000, max_output_tokens: 8192, hosted_on: \"anthropic\", capabilities: { vision: true, tools: true, streaming: true, json_mode: false, web_search: true, audio: false, files: true } },\n { id: \"claude-sonnet-4-6\", context_length: 200000, max_output_tokens: 8192, hosted_on: \"anthropic\", capabilities: { vision: true, tools: true, streaming: true, json_mode: false, web_search: true, audio: false, files: true } },\n { id: \"claude-haiku-4-5-20251001\", context_length: 200000, max_output_tokens: 4096, hosted_on: \"anthropic\", capabilities: { vision: true, tools: true, streaming: true, json_mode: false, web_search: true, audio: false, files: true } },\n ];\n}\n\n// ── Gemini (static) ───────────────────────────────────────────────────────────\n\nfunction geminiKnownModels(): CatalogModel[] {\n return [\n { id: \"gemini-2.5-pro\", context_length: 1048576, max_output_tokens: 65536, hosted_on: \"google\", capabilities: { vision: true, tools: true, streaming: true, json_mode: true, web_search: true, audio: true, files: true } },\n { id: \"gemini-2.5-flash\", context_length: 1048576, max_output_tokens: 65536, hosted_on: \"google\", capabilities: { vision: true, tools: true, streaming: true, json_mode: true, web_search: true, audio: true, files: true } },\n { id: \"gemini-2.0-flash\", context_length: 1048576, max_output_tokens: 8192, hosted_on: \"google\", capabilities: { vision: true, tools: true, streaming: true, json_mode: true, web_search: true, audio: true, files: true } },\n { id: \"gemini-2.0-flash-lite\", context_length: 1048576, max_output_tokens: 8192, hosted_on: \"google\", capabilities: { vision: true, tools: true, streaming: true, json_mode: true, web_search: false, audio: true, files: true } },\n { id: \"gemini-1.5-pro\", context_length: 2097152, max_output_tokens: 8192, hosted_on: \"google\", capabilities: { vision: true, tools: true, streaming: true, json_mode: true, web_search: false, audio: true, files: true } },\n { id: \"gemini-1.5-flash\", context_length: 1048576, max_output_tokens: 8192, hosted_on: \"google\", capabilities: { vision: true, tools: true, streaming: true, json_mode: true, web_search: false, audio: true, files: true } },\n ];\n}\n\n// ── DeepSeek (static) ─────────────────────────────────────────────────────────\n\nfunction deepseekKnownModels(): CatalogModel[] {\n return [\n { id: \"deepseek-v4-flash\", context_length: 65536, max_output_tokens: 8192, hosted_on: \"deepseek\", capabilities: { vision: false, tools: true, streaming: true, json_mode: true, web_search: false, audio: false, files: false } },\n { id: \"deepseek-v4-pro\", context_length: 65536, max_output_tokens: 8192, hosted_on: \"deepseek\", capabilities: { vision: false, tools: true, streaming: true, json_mode: true, web_search: false, audio: false, files: false } },\n // Compatibility aliases currently accepted by DeepSeek (scheduled deprecation 2026-07-24).\n { id: \"deepseek-chat\", context_length: 65536, max_output_tokens: 8192, hosted_on: \"deepseek\", capabilities: { vision: false, tools: true, streaming: true, json_mode: true, web_search: false, audio: false, files: false } },\n { id: \"deepseek-reasoner\", context_length: 65536, max_output_tokens: 8192, hosted_on: \"deepseek\", capabilities: { vision: false, tools: false, streaming: true, json_mode: false, web_search: false, audio: false, files: false } },\n ];\n}\n","import { AppRouteRouteModule } from \"next/dist/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/lib/constants\";\nimport { NoFallbackError } from \"next/dist/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/server/response-cache\";\nimport * as userland from \"/home/runner/work/jarela/jarela/app/api/v1/providers/[provider]/models/route.ts\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/v1/providers/[provider]/models/route\",\n pathname: \"/api/v1/providers/[provider]/models\",\n filename: \"route\",\n bundlePath: \"app/api/v1/providers/[provider]/models/route\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"/home/runner/work/jarela/jarela/app/api/v1/providers/[provider]/models/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"/home/runner/work/jarela/jarela/app/api/v1/providers/[provider]/models/route.ts\")\n } : {}\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 (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/v1/providers/[provider]/models/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, deploymentId, 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.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 isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n 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 deploymentId\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 let parentSpan;\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 // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\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 (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\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), undefined, !isWrappedByNextServer);\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","module.exports = require(\"undici\");","module.exports = require(\"next/dist/compiled/next-server/app-page.runtime.prod.js\");","module.exports = require(\"node:async_hooks\");","module.exports = require(\"stream\");","module.exports = require(\"util\");","module.exports = require(\"fs\");","module.exports = require(\"next/dist/server/app-render/work-async-storage.external.js\");","module.exports = require(\"node:child_process\");","module.exports = require(\"path\");","module.exports = require(\"node:http\");","module.exports = require(\"node:https\");","module.exports = require(\"next/dist/compiled/next-server/app-route.runtime.prod.js\");","// Web-sourced fallback context-window sizes per (provider, model_id).\n// Used when the live `/models` endpoint doesn't report `context_length`\n// (OpenAI's catalog and GitHub Copilot's catalog both omit it) AND the\n// user hasn't pinned `context_window_tokens` on the model config.\n//\n// Resolution order at runtime is:\n// 1. user-set `params.context_window_tokens` (explicit override)\n// 2. live API value via `listModels()` / catalog cache (when populated)\n// 3. this static fallback (this file)\n// 4. `DEFAULT_CONTEXT_WINDOW_TOKENS` in lib/agents/context-budget.ts\n//\n// Verified from each vendor's public docs as of 2026-06. Bump when vendors\n// publish new families.\n\nexport interface KnownModelLimits {\n context_length: number;\n max_output_tokens?: number;\n}\n\nconst ANTHROPIC: Record<string, KnownModelLimits> = {\n \"claude-opus-4-7\": { context_length: 1_000_000, max_output_tokens: 8192 },\n \"claude-opus-4\": { context_length: 200_000, max_output_tokens: 8192 },\n \"claude-sonnet-4-6\": { context_length: 200_000, max_output_tokens: 8192 },\n \"claude-sonnet-4\": { context_length: 200_000, max_output_tokens: 8192 },\n \"claude-3.7-sonnet\": { context_length: 200_000, max_output_tokens: 8192 },\n \"claude-3-7-sonnet\": { context_length: 200_000, max_output_tokens: 8192 },\n \"claude-3-5-sonnet\": { context_length: 200_000, max_output_tokens: 8192 },\n \"claude-3-5-haiku\": { context_length: 200_000, max_output_tokens: 8192 },\n \"claude-haiku-4-5\": { context_length: 200_000, max_output_tokens: 4096 },\n \"claude-haiku-4\": { context_length: 200_000, max_output_tokens: 4096 },\n \"claude-3-opus\": { context_length: 200_000, max_output_tokens: 4096 },\n};\n\nconst GEMINI: Record<string, KnownModelLimits> = {\n \"gemini-2.5-pro\": { context_length: 1_048_576, max_output_tokens: 65_536 },\n \"gemini-2.5-flash\": { context_length: 1_048_576, max_output_tokens: 65_536 },\n \"gemini-2.0-flash-lite\": { context_length: 1_048_576, max_output_tokens: 8192 },\n \"gemini-2.0-flash\": { context_length: 1_048_576, max_output_tokens: 8192 },\n \"gemini-1.5-pro\": { context_length: 2_097_152, max_output_tokens: 8192 },\n \"gemini-1.5-flash\": { context_length: 1_048_576, max_output_tokens: 8192 },\n};\n\nconst OPENAI: Record<string, KnownModelLimits> = {\n \"gpt-5-mini\": { context_length: 400_000, max_output_tokens: 128_000 },\n \"gpt-5\": { context_length: 400_000, max_output_tokens: 128_000 },\n \"gpt-4.1-mini\": { context_length: 1_047_576, max_output_tokens: 32_768 },\n \"gpt-4.1\": { context_length: 1_047_576, max_output_tokens: 32_768 },\n \"gpt-4o-mini\": { context_length: 128_000, max_output_tokens: 16_384 },\n \"gpt-4o\": { context_length: 128_000, max_output_tokens: 16_384 },\n \"gpt-4-turbo\": { context_length: 128_000, max_output_tokens: 4096 },\n \"gpt-4\": { context_length: 8192, max_output_tokens: 4096 },\n \"gpt-3.5-turbo\": { context_length: 16_385, max_output_tokens: 4096 },\n \"chatgpt-4o\": { context_length: 128_000, max_output_tokens: 16_384 },\n \"o4-mini\": { context_length: 200_000, max_output_tokens: 100_000 },\n \"o3-mini\": { context_length: 200_000, max_output_tokens: 100_000 },\n \"o3\": { context_length: 200_000, max_output_tokens: 100_000 },\n \"o1-mini\": { context_length: 128_000, max_output_tokens: 65_536 },\n \"o1\": { context_length: 200_000, max_output_tokens: 100_000 },\n};\n\nconst DEEPSEEK: Record<string, KnownModelLimits> = {\n \"deepseek-v4-flash\": { context_length: 65_536, max_output_tokens: 8192 },\n \"deepseek-v4-pro\": { context_length: 65_536, max_output_tokens: 8192 },\n \"deepseek-chat\": { context_length: 65_536, max_output_tokens: 8192 },\n \"deepseek-reasoner\": { context_length: 65_536, max_output_tokens: 8192 },\n};\n\n// GitHub Copilot proxies vendor models — sometimes under a transformed id\n// (e.g. `Github-Opus4.6`, `copilot-claude-3.5-sonnet`). Strip the proxy\n// prefix and dispatch to the underlying vendor table.\nfunction resolveCopilot(model_id: string): KnownModelLimits | null {\n const normalized = model_id\n .replace(/^(?:Github-|copilot-)/i, \"\")\n .toLowerCase();\n // Canonicalise a few proxy-specific spellings.\n const canon = normalized\n .replace(/^opus4\\.6/, \"claude-opus-4-7\")\n .replace(/^opus4/, \"claude-opus-4\")\n .replace(/^sonnet4\\.6/, \"claude-sonnet-4-6\")\n .replace(/^sonnet4/, \"claude-sonnet-4\")\n .replace(/^haiku4\\.5/, \"claude-haiku-4-5\");\n if (canon.startsWith(\"claude\")) return matchPrefix(ANTHROPIC, canon);\n if (canon.startsWith(\"gemini\")) return matchPrefix(GEMINI, canon);\n if (canon.startsWith(\"gpt\") || /^o[134](?:-|$)/.test(canon)) return matchPrefix(OPENAI, canon);\n return null;\n}\n\nfunction matchPrefix(table: Record<string, KnownModelLimits>, id: string): KnownModelLimits | null {\n const lower = id.toLowerCase();\n const exact = table[lower];\n if (exact) return exact;\n // Longest-prefix match so `gpt-4o-2024-08-06` resolves to `gpt-4o` and\n // not `gpt-4` (which would also prefix-match).\n let best: { key: string; v: KnownModelLimits } | null = null;\n for (const [k, v] of Object.entries(table)) {\n if (lower.startsWith(k) && (!best || k.length > best.key.length)) {\n best = { key: k, v };\n }\n }\n return best?.v ?? null;\n}\n\nexport function getKnownModelLimits(provider: string, model_id: string): KnownModelLimits | null {\n if (!provider || !model_id) return null;\n switch (provider) {\n case \"anthropic\": return matchPrefix(ANTHROPIC, model_id);\n case \"gemini\": return matchPrefix(GEMINI, model_id);\n case \"openai\": return matchPrefix(OPENAI, model_id);\n case \"deepseek\": return matchPrefix(DEEPSEEK, model_id);\n case \"github-copilot\": return resolveCopilot(model_id);\n default: return null;\n }\n}\n\nexport function getKnownContextLength(provider: string, model_id: string): number | null {\n return getKnownModelLimits(provider, model_id)?.context_length ?? null;\n}\n\nexport function getKnownMaxOutputTokens(provider: string, model_id: string): number | null {\n return getKnownModelLimits(provider, model_id)?.max_output_tokens ?? null;\n}\n","module.exports = require(\"node:os\");","module.exports = require(\"node:fs/promises\");","module.exports = require(\"crypto\");","module.exports = require(\"https\");","module.exports = require(\"node:stream\");","module.exports = require(\"node:util\");","module.exports = require(\"next/dist/server/app-render/work-unit-async-storage.external.js\");","module.exports = require(\"node:fs\");","module.exports = require(\"node:url\");","module.exports = require(\"node:worker_threads\");","module.exports = require(\"node:path\");","module.exports = require(\"node:crypto\");","module.exports = require(\"buffer\");","module.exports = require(\"node:sqlite\");","module.exports = require(\"http\");","module.exports = require(\"next/dist/shared/lib/no-fallback-error.external\");","module.exports = require(\"events\");"],"names":["NextResponse","getProvider","listModelConfigs","getModelParams","getKnownContextLength","getKnownMaxOutputTokens","PROVIDER_CATALOG_TTL_MS","catalogCache","Map","getCachedCatalog","provider","force","now","Date","cached","get","fetchedAt","data","fetchCatalog","set","GET","req","params","nextUrl","searchParams","models","json","headers","err","error","String","status","POST","body","overrides","fetchOpenAICatalog","fetchGitHubCopilotCatalog","anthropicKnownModels","geminiKnownModels","deepseekKnownModels","fetchExternalCatalog","providerName","listModels","cfgs","filter","c","candidates","map","Object","keys","length","push","lastErr","Error","cfg","find","apiKey","api_key","process","env","OPENAI_API_KEY","res","fetch","Authorization","ok","chatPrefixes","chatModels","m","some","p","id","startsWith","context_length","max_output_tokens","hosted_on","capabilities","vision","includes","tools","streaming","json_mode","web_search","audio","files","sort","a","b","localeCompare","getStoredOAuthToken","oauth","sessionToken","exchangeCopilotSessionToken","list","fetchCopilotChatCatalog","sessionTok","copilot_session_token","trim","GITHUB_TOKEN","isLikelyGitHubPat","githubCopilotKnownModels","text","catch","statusText","supports","tool_calls","token","pat","v","ANTHROPIC","GEMINI","OPENAI","DEEPSEEK","resolveCopilot","model_id","normalized","replace","toLowerCase","canon","matchPrefix","test","table","lower","exact","best","k","entries","key","getKnownModelLimits"],"sourceRoot":"","ignoreList":[0,3,7,12,17,25,34]}
|
|
1
|
+
{"version":3,"file":"../app/api/v1/providers/[provider]/models/route.js","mappings":";;;;;;;;;;AAAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAwD;AACV;AAC+B;AAK9B;AAoB/C,6EAA6E;AAC7E,2EAA2E;AAC3E,yEAAyE;AACzE,MAAMM,0BAA0B,KAAK,KAAK;AAE1C,MAAMC,eAAe,IAAIC;AAEzB,eAAeC,iBAAiBC,QAAgB,EAAEC,KAAc;IAC9D,MAAMC,MAAMC,KAAKD,GAAG;IACpB,IAAI,CAACD,OAAO;QACV,MAAMG,SAASP,aAAaQ,GAA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;gBAAOC,OAAO;gBAAOC,OAAO;YAAM;QAAE;KACpO;AACH;;;AC3U+F;AACvC;AACqB;AACkB;AACvB;AACgB;AACT;AACK;AACmC;AACjD;AACO;AACf;AACsC;AACzB;AACM;AACC;AAChB;AAC0C;AAC5G;AACA;AACA;AACA,wBAAwB,mCAAmB;AAC3C;AACA,cAAc,oBAAS;AACvB;AACA;AACA;AACA;AACA,KAAK;AACL,aAAa,OAAoC,IAAI,CAAE;AACvD,wBAAwB,MAAuC;AAC/D;AACA;AACA;AACA,cAAc,qBAAQ;AACtB;AACA;AACA;AACA;AACA,OAAO,MAAsD,GAAG,CAE3D,CAAC;AACN,CAAC;AACD;AACA;AACA;AACA,QAAQ,sDAAsD;AAC9D;AACA,WAAW,0BAAW;AACtB;AACA;AACA,KAAK;AACL;AAC0F;AACnF;AACP;AACA,QAAQ,+BAAc;AACtB;AACA;AACA,QAAQ,+BAAc;AACtB;AACA;AACA;AACA;AACA;AACA,QAAQ,KAAqB,EAAE,EAE1B,CAAC;AACN;AACA;AACA;AACA,+BAA+B,KAAwC;AACvE;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,6NAA6N;AACzO,8BAA8B,+BAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,2CAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,6CAAqB;AAC7B;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,mBAAmB,0BAAS;AAC5B;AACA;AACA,kCAAkC,+BAAc;AAChD,6BAA6B,+BAAc;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,4BAA4B,oBAAe;AAC3C,4BAA4B,qBAAgB;AAC5C,oBAAoB,+BAAkB,kCAAkC,uCAAsB;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iEAAiE,wBAAc;AAC/E,+DAA+D,yCAAyC;AACxG;AACA;AACA;AACA;AACA,oCAAoC,QAAQ,EAAE,MAAM;AACpD;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB,uCAAuC,QAAQ,EAAE,QAAQ;AACzD;AACA,aAAa;AACb;AACA;AACA;AACA,+CAA+C,oBAAoB;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,uCAAyB;AACjE;AACA,oCAAoC,oCAAsB;AAC1D;AACA;AACA;AACA;AACA,sJAAsJ,4BAAc;AACpK,0IAA0I,4BAAc;AACxJ;AACA;AACA;AACA,sCAAsC,8BAAe;AACrD;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA,8BAA8B,qCAAY;AAC1C;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,oCAAmB;AACjE;AACA;AACA,6BAA6B;AAC7B,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,oBAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,qIAAqI,8BAAe;AACpJ;AACA,2GAA2G,iHAAiH;AAC5N;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,yCAA2B;AACvD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;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA","sources":["webpack://@circuitwall/jarela/external commonjs \"next/dist/shared/lib/router/utils/app-paths\"","webpack://@circuitwall/jarela/external node-commonjs \"node:process\"","webpack://@circuitwall/jarela/external commonjs2 \"url\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/server/app-render/after-task-async-storage.external.js\"","webpack://@circuitwall/jarela/./app/api/v1/providers/[provider]/models/route.ts","webpack://@circuitwall/jarela/?f3fb","webpack://@circuitwall/jarela/external commonjs \"undici\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/compiled/next-server/app-page.runtime.prod.js\"","webpack://@circuitwall/jarela/external node-commonjs \"node:async_hooks\"","webpack://@circuitwall/jarela/external commonjs2 \"stream\"","webpack://@circuitwall/jarela/external commonjs2 \"util\"","webpack://@circuitwall/jarela/external commonjs2 \"fs\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/server/app-render/work-async-storage.external.js\"","webpack://@circuitwall/jarela/external node-commonjs \"node:child_process\"","webpack://@circuitwall/jarela/external commonjs2 \"path\"","webpack://@circuitwall/jarela/external node-commonjs \"node:http\"","webpack://@circuitwall/jarela/external node-commonjs \"node:https\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/compiled/next-server/app-route.runtime.prod.js\"","webpack://@circuitwall/jarela/./lib/providers/known-context-windows.ts","webpack://@circuitwall/jarela/external node-commonjs \"node:os\"","webpack://@circuitwall/jarela/external node-commonjs \"node:fs/promises\"","webpack://@circuitwall/jarela/external commonjs2 \"crypto\"","webpack://@circuitwall/jarela/external commonjs2 \"https\"","webpack://@circuitwall/jarela/external node-commonjs \"node:stream\"","webpack://@circuitwall/jarela/external node-commonjs \"node:util\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/server/app-render/work-unit-async-storage.external.js\"","webpack://@circuitwall/jarela/external node-commonjs \"node:fs\"","webpack://@circuitwall/jarela/external node-commonjs \"node:url\"","webpack://@circuitwall/jarela/external node-commonjs \"node:worker_threads\"","webpack://@circuitwall/jarela/external node-commonjs \"node:path\"","webpack://@circuitwall/jarela/external node-commonjs \"node:crypto\"","webpack://@circuitwall/jarela/external commonjs2 \"buffer\"","webpack://@circuitwall/jarela/external node-commonjs \"node:sqlite\"","webpack://@circuitwall/jarela/external commonjs2 \"http\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/shared/lib/no-fallback-error.external\"","webpack://@circuitwall/jarela/external commonjs2 \"events\""],"sourcesContent":["module.exports = require(\"next/dist/shared/lib/router/utils/app-paths\");","module.exports = require(\"node:process\");","module.exports = require(\"url\");","module.exports = require(\"next/dist/server/app-render/after-task-async-storage.external.js\");","import { NextRequest, NextResponse } from \"next/server\";\nimport { getProvider } from \"@/lib/providers\";\nimport { listModelConfigs, getModelParams } from \"@/lib/stores/model-config\";\nimport type { ProviderCatalogModel, ProviderParams } from \"@/lib/providers/types\";\nimport {\n getKnownContextLength,\n getKnownMaxOutputTokens,\n} from \"@/lib/providers/known-context-windows\";\n\nexport interface CatalogModel {\n id: string;\n context_length: number | null;\n max_output_tokens: number | null;\n hosted_on: string | null;\n capabilities: {\n vision: boolean;\n tools: boolean;\n streaming: boolean;\n json_mode: boolean;\n web_search: boolean;\n audio: boolean;\n files: boolean;\n };\n}\n\ntype Params = { params: Promise<{ provider: string }> };\n\n// Live provider catalogs (OpenAI, GitHub Copilot) hit external APIs on every\n// call; static ones still cost JSON construction. Cache per-provider for a\n// short TTL so flipping panels / model browsers doesn't re-hit upstream.\nconst PROVIDER_CATALOG_TTL_MS = 10 * 60 * 1000;\ntype CachedCatalog = { data: CatalogModel[]; fetchedAt: number };\nconst catalogCache = new Map<string, CachedCatalog>();\n\nasync function getCachedCatalog(provider: string, force: boolean): Promise<CatalogModel[]> {\n const now = Date.now();\n if (!force) {\n const cached = catalogCache.get(provider);\n if (cached && now - cached.fetchedAt < PROVIDER_CATALOG_TTL_MS) return cached.data;\n }\n const data = await fetchCatalog(provider);\n catalogCache.set(provider, { data, fetchedAt: now });\n return data;\n}\n\nexport async function GET(req: NextRequest, { params }: Params) {\n const { provider } = await params;\n const force = req.nextUrl.searchParams.get(\"fresh\") === \"1\";\n\n try {\n const models = await getCachedCatalog(provider, force);\n return NextResponse.json(models, {\n headers: {\n \"Cache-Control\": \"private, max-age=300, stale-while-revalidate=600\",\n },\n });\n } catch (err) {\n return NextResponse.json({ error: String(err) }, { status: 500 });\n }\n}\n\n// POST allows the editor to ship the in-form credentials (api_key /\n// base_url / extra_headers) before the user has saved them. We never cache\n// these responses since they're keyed on user-supplied secrets.\nexport async function POST(req: NextRequest, { params }: Params) {\n const { provider } = await params;\n let body: { params?: ProviderParams } = {};\n try { body = await req.json(); } catch { /* empty body is fine */ }\n try {\n const models = await fetchCatalog(provider, body.params);\n return NextResponse.json(models, { headers: { \"Cache-Control\": \"no-store\" } });\n } catch (err) {\n return NextResponse.json({ error: String(err) }, { status: 500 });\n }\n}\n\nasync function fetchCatalog(provider: string, overrides?: ProviderParams): Promise<CatalogModel[]> {\n switch (provider) {\n case \"openai\": return fetchOpenAICatalog();\n case \"github-copilot\": return fetchGitHubCopilotCatalog();\n case \"anthropic\": return anthropicKnownModels();\n case \"gemini\": return geminiKnownModels();\n case \"deepseek\": return deepseekKnownModels();\n default: return fetchExternalCatalog(provider, overrides);\n }\n}\n\nasync function fetchExternalCatalog(providerName: string, overrides?: ProviderParams): Promise<CatalogModel[]> {\n let provider;\n try {\n provider = getProvider(providerName);\n } catch {\n return [];\n }\n if (!provider.listModels) return [];\n\n // Try each saved config for this provider, plus the caller overrides.\n // Some providers ship multiple configs where only some carry usable\n // credentials; picking the first row blindly fails as soon as another\n // row is misconfigured. Overrides are merged on top of each candidate,\n // then also tried standalone, so a freshly-typed api_key works before\n // the user has saved it.\n const cfgs = listModelConfigs().filter((c) => c.provider === providerName);\n const candidates: ProviderParams[] = cfgs.map((c) => ({\n ...getModelParams(c),\n ...(overrides ?? {}),\n }));\n if (overrides && Object.keys(overrides).length > 0) candidates.push(overrides);\n if (candidates.length === 0) candidates.push(overrides ?? {});\n\n let lastErr: unknown;\n for (const params of candidates) {\n try {\n const models = await provider.listModels(params);\n return models as ProviderCatalogModel[];\n } catch (err) {\n lastErr = err;\n }\n }\n throw lastErr ?? new Error(`${providerName}: no usable credentials for catalog`);\n}\n\n// ── OpenAI ────────────────────────────────────────────────────────────────────\n\nasync function fetchOpenAICatalog(): Promise<CatalogModel[]> {\n const cfg = listModelConfigs().find((c) => c.provider === \"openai\");\n if (!cfg) throw new Error(\"No OpenAI model config found.\");\n const params = getModelParams(cfg);\n const apiKey = (params.api_key as string | undefined) ?? process.env.OPENAI_API_KEY;\n if (!apiKey) throw new Error(\"OpenAI: no api_key configured.\");\n\n const res = await fetch(\"https://api.openai.com/v1/models\", {\n headers: { Authorization: `Bearer ${apiKey}` },\n });\n if (!res.ok) throw new Error(`OpenAI catalog error: ${res.status}`);\n const data = await res.json() as { data: Array<{ id: string }> };\n\n const chatPrefixes = [\"gpt-\", \"o1\", \"o3\", \"o4\", \"chatgpt-\"];\n const chatModels = data.data\n .filter((m) => chatPrefixes.some((p) => m.id.startsWith(p)))\n .map((m): CatalogModel => ({\n id: m.id,\n context_length: getKnownContextLength(\"openai\", m.id),\n max_output_tokens: getKnownMaxOutputTokens(\"openai\", m.id),\n hosted_on: \"azure/openai\",\n capabilities: {\n vision: m.id.includes(\"vision\") || m.id.startsWith(\"gpt-4\"),\n tools: true,\n streaming: true,\n json_mode: true,\n web_search: false,\n audio: m.id.includes(\"audio\") || m.id.startsWith(\"gpt-4o\") || m.id.startsWith(\"gpt-5\"),\n files: m.id.startsWith(\"gpt-4\") || m.id.startsWith(\"gpt-5\") || m.id.startsWith(\"o\"),\n },\n }))\n .sort((a, b) => a.id.localeCompare(b.id));\n\n return chatModels;\n}\n\n// ── GitHub Copilot ────────────────────────────────────────────────────────────\n\nasync function fetchGitHubCopilotCatalog(): Promise<CatalogModel[]> {\n // We deliberately do NOT return the broad GitHub Models cross-publisher\n // registry here — that lists hundreds of models from every vendor, which is\n // confusing when the user is configuring the \"github-copilot\" provider\n // specifically. We mirror what Copilot Chat actually serves: its own\n // /models endpoint when we have an exchangeable credential, else a curated\n // fallback list. Users who want the raw GitHub Models catalog can type the\n // namespaced model id directly into the Model ID field.\n\n // 1. Prefer the in-app device-flow OAuth token — it can be exchanged.\n const { getStoredOAuthToken } = await import(\"@/lib/providers/github-copilot-auth\");\n const oauth = getStoredOAuthToken();\n if (oauth) {\n try {\n const sessionToken = await exchangeCopilotSessionToken(oauth);\n const list = await fetchCopilotChatCatalog(sessionToken);\n if (list.length > 0) return list;\n } catch { /* fall through */ }\n }\n\n // 2. Look up a saved github-copilot model config for an explicit session\n // token or a non-PAT credential that supports exchange.\n const cfg = listModelConfigs().find((c) => c.provider === \"github-copilot\");\n if (cfg) {\n const params = getModelParams(cfg);\n const sessionTok = (params.copilot_session_token as string | undefined)?.trim();\n if (sessionTok) {\n try {\n const list = await fetchCopilotChatCatalog(sessionTok);\n if (list.length > 0) return list;\n } catch { /* fall through */ }\n }\n const apiKey = (params.api_key as string | undefined) ?? process.env.GITHUB_TOKEN;\n if (apiKey && !isLikelyGitHubPat(apiKey)) {\n try {\n const sessionToken = await exchangeCopilotSessionToken(apiKey);\n const list = await fetchCopilotChatCatalog(sessionToken);\n if (list.length > 0) return list;\n } catch { /* fall through */ }\n }\n }\n\n // 3. Fallback: curated known-models list. Works even on a PAT — those\n // model IDs are valid on both Models API and Copilot Chat.\n return githubCopilotKnownModels();\n}\n\nasync function fetchCopilotChatCatalog(sessionToken: string): Promise<CatalogModel[]> {\n const res = await fetch(\"https://api.githubcopilot.com/models\", {\n headers: {\n Authorization: `Bearer ${sessionToken}`,\n \"Editor-Version\": \"vscode/1.85.0\",\n \"Copilot-Integration-Id\": \"vscode-chat\",\n \"openai-intent\": \"conversation-ai\",\n },\n });\n if (!res.ok) {\n const body = await res.text().catch(() => res.statusText);\n throw new Error(`GitHub Copilot catalog error: ${res.status} ${body}`);\n }\n const data = await res.json() as { data: Array<{ id: string; capabilities?: { supports?: { tool_calls?: boolean; streaming?: boolean; vision?: boolean } } }> };\n\n return data.data.map((m): CatalogModel => ({\n id: m.id,\n context_length: getKnownContextLength(\"github-copilot\", m.id),\n max_output_tokens: getKnownMaxOutputTokens(\"github-copilot\", m.id),\n hosted_on: \"github\",\n capabilities: {\n vision: m.capabilities?.supports?.vision ?? false,\n tools: m.capabilities?.supports?.tool_calls ?? false,\n streaming: m.capabilities?.supports?.streaming ?? true,\n json_mode: false,\n web_search: false,\n audio: false,\n files: m.capabilities?.supports?.vision ?? false,\n },\n }));\n}\n\nfunction isLikelyGitHubPat(token: string): boolean {\n return token.startsWith(\"ghp_\") || token.startsWith(\"github_pat_\") || token.startsWith(\"gho_\");\n}\n\nasync function exchangeCopilotSessionToken(pat: string): Promise<string> {\n const res = await fetch(\"https://api.github.com/copilot_internal/v2/token\", {\n headers: {\n Authorization: `token ${pat}`,\n \"User-Agent\": \"Jarela/1.0\",\n },\n });\n\n if (!res.ok) {\n const body = await res.text().catch(() => res.statusText);\n throw new Error(`GitHub Copilot token exchange failed: ${res.status} ${body}`);\n }\n\n const json = await res.json() as { token?: string };\n if (!json.token) throw new Error(\"GitHub Copilot token exchange returned no token\");\n return json.token;\n}\n\nfunction githubCopilotKnownModels(): CatalogModel[] {\n // Curated fallback — mirrors what the VS Code Copilot Chat picker exposes.\n // Used only when the live /models endpoint isn't reachable (no OAuth token\n // stored, exchange failed, etc.). Keep in sync with Copilot's current line-up.\n const v = (id: string, vision = false, tools = true): CatalogModel => ({\n id,\n context_length: getKnownContextLength(\"github-copilot\", id),\n max_output_tokens: getKnownMaxOutputTokens(\"github-copilot\", id),\n hosted_on: \"github\",\n capabilities: { vision, tools, streaming: true, json_mode: false, web_search: false, audio: false, files: vision },\n });\n return [\n // OpenAI family\n v(\"gpt-4o\", true),\n v(\"gpt-4.1\", true),\n v(\"gpt-4.1-mini\", true),\n v(\"gpt-5\", true),\n v(\"gpt-5-mini\", true),\n v(\"o1\", false),\n v(\"o3\", false),\n v(\"o3-mini\", false),\n v(\"o4-mini\", false),\n // Anthropic family\n v(\"claude-opus-4-7\", true),\n v(\"claude-sonnet-4-6\", true),\n v(\"claude-sonnet-4\", true),\n v(\"claude-3.7-sonnet\", true),\n v(\"claude-haiku-4-5\", true),\n // Google family\n v(\"gemini-2.5-pro\", true),\n v(\"gemini-2.5-flash\", true),\n v(\"gemini-2.0-flash\", true),\n ];\n}\n\n// ── Anthropic (static) ────────────────────────────────────────────────────────\n\nfunction anthropicKnownModels(): CatalogModel[] {\n return [\n { id: \"claude-opus-4-7\", context_length: 1000000, max_output_tokens: 8192, hosted_on: \"anthropic\", capabilities: { vision: true, tools: true, streaming: true, json_mode: false, web_search: true, audio: false, files: true } },\n { id: \"claude-sonnet-4-6\", context_length: 200000, max_output_tokens: 8192, hosted_on: \"anthropic\", capabilities: { vision: true, tools: true, streaming: true, json_mode: false, web_search: true, audio: false, files: true } },\n { id: \"claude-haiku-4-5-20251001\", context_length: 200000, max_output_tokens: 4096, hosted_on: \"anthropic\", capabilities: { vision: true, tools: true, streaming: true, json_mode: false, web_search: true, audio: false, files: true } },\n ];\n}\n\n// ── Gemini (static) ───────────────────────────────────────────────────────────\n\nfunction geminiKnownModels(): CatalogModel[] {\n return [\n { id: \"gemini-2.5-pro\", context_length: 1048576, max_output_tokens: 65536, hosted_on: \"google\", capabilities: { vision: true, tools: true, streaming: true, json_mode: true, web_search: true, audio: true, files: true } },\n { id: \"gemini-2.5-flash\", context_length: 1048576, max_output_tokens: 65536, hosted_on: \"google\", capabilities: { vision: true, tools: true, streaming: true, json_mode: true, web_search: true, audio: true, files: true } },\n { id: \"gemini-2.0-flash\", context_length: 1048576, max_output_tokens: 8192, hosted_on: \"google\", capabilities: { vision: true, tools: true, streaming: true, json_mode: true, web_search: true, audio: true, files: true } },\n { id: \"gemini-2.0-flash-lite\", context_length: 1048576, max_output_tokens: 8192, hosted_on: \"google\", capabilities: { vision: true, tools: true, streaming: true, json_mode: true, web_search: false, audio: true, files: true } },\n { id: \"gemini-1.5-pro\", context_length: 2097152, max_output_tokens: 8192, hosted_on: \"google\", capabilities: { vision: true, tools: true, streaming: true, json_mode: true, web_search: false, audio: true, files: true } },\n { id: \"gemini-1.5-flash\", context_length: 1048576, max_output_tokens: 8192, hosted_on: \"google\", capabilities: { vision: true, tools: true, streaming: true, json_mode: true, web_search: false, audio: true, files: true } },\n ];\n}\n\n// ── DeepSeek (static) ─────────────────────────────────────────────────────────\n\nfunction deepseekKnownModels(): CatalogModel[] {\n return [\n { id: \"deepseek-v4-flash\", context_length: 65536, max_output_tokens: 8192, hosted_on: \"deepseek\", capabilities: { vision: false, tools: true, streaming: true, json_mode: true, web_search: false, audio: false, files: false } },\n { id: \"deepseek-v4-pro\", context_length: 65536, max_output_tokens: 8192, hosted_on: \"deepseek\", capabilities: { vision: false, tools: true, streaming: true, json_mode: true, web_search: false, audio: false, files: false } },\n // Compatibility aliases currently accepted by DeepSeek (scheduled deprecation 2026-07-24).\n { id: \"deepseek-chat\", context_length: 65536, max_output_tokens: 8192, hosted_on: \"deepseek\", capabilities: { vision: false, tools: true, streaming: true, json_mode: true, web_search: false, audio: false, files: false } },\n { id: \"deepseek-reasoner\", context_length: 65536, max_output_tokens: 8192, hosted_on: \"deepseek\", capabilities: { vision: false, tools: false, streaming: true, json_mode: false, web_search: false, audio: false, files: false } },\n ];\n}\n","import { AppRouteRouteModule } from \"next/dist/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/lib/constants\";\nimport { NoFallbackError } from \"next/dist/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/server/response-cache\";\nimport * as userland from \"/home/runner/work/jarela/jarela/app/api/v1/providers/[provider]/models/route.ts\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/v1/providers/[provider]/models/route\",\n pathname: \"/api/v1/providers/[provider]/models\",\n filename: \"route\",\n bundlePath: \"app/api/v1/providers/[provider]/models/route\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"/home/runner/work/jarela/jarela/app/api/v1/providers/[provider]/models/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"/home/runner/work/jarela/jarela/app/api/v1/providers/[provider]/models/route.ts\")\n } : {}\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 (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/v1/providers/[provider]/models/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, deploymentId, 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.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 isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n 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 deploymentId\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 let parentSpan;\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 // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\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 (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\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), undefined, !isWrappedByNextServer);\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","module.exports = require(\"undici\");","module.exports = require(\"next/dist/compiled/next-server/app-page.runtime.prod.js\");","module.exports = require(\"node:async_hooks\");","module.exports = require(\"stream\");","module.exports = require(\"util\");","module.exports = require(\"fs\");","module.exports = require(\"next/dist/server/app-render/work-async-storage.external.js\");","module.exports = require(\"node:child_process\");","module.exports = require(\"path\");","module.exports = require(\"node:http\");","module.exports = require(\"node:https\");","module.exports = require(\"next/dist/compiled/next-server/app-route.runtime.prod.js\");","// Web-sourced fallback context-window sizes per (provider, model_id).\n// Used when the live `/models` endpoint doesn't report `context_length`\n// (OpenAI's catalog and GitHub Copilot's catalog both omit it) AND the\n// user hasn't pinned `context_window_tokens` on the model config.\n//\n// Resolution order at runtime is:\n// 1. user-set `params.context_window_tokens` (explicit override)\n// 2. live API value via `listModels()` / catalog cache (when populated)\n// 3. this static fallback (this file)\n// 4. `DEFAULT_CONTEXT_WINDOW_TOKENS` in lib/agents/context-budget.ts\n//\n// Verified from each vendor's public docs as of 2026-06. Bump when vendors\n// publish new families.\n\nexport interface KnownModelLimits {\n context_length: number;\n max_output_tokens?: number;\n}\n\nconst ANTHROPIC: Record<string, KnownModelLimits> = {\n \"claude-opus-4-7\": { context_length: 1_000_000, max_output_tokens: 8192 },\n \"claude-opus-4\": { context_length: 200_000, max_output_tokens: 8192 },\n \"claude-sonnet-4-6\": { context_length: 200_000, max_output_tokens: 8192 },\n \"claude-sonnet-4\": { context_length: 200_000, max_output_tokens: 8192 },\n \"claude-3.7-sonnet\": { context_length: 200_000, max_output_tokens: 8192 },\n \"claude-3-7-sonnet\": { context_length: 200_000, max_output_tokens: 8192 },\n \"claude-3-5-sonnet\": { context_length: 200_000, max_output_tokens: 8192 },\n \"claude-3-5-haiku\": { context_length: 200_000, max_output_tokens: 8192 },\n \"claude-haiku-4-5\": { context_length: 200_000, max_output_tokens: 4096 },\n \"claude-haiku-4\": { context_length: 200_000, max_output_tokens: 4096 },\n \"claude-3-opus\": { context_length: 200_000, max_output_tokens: 4096 },\n};\n\nconst GEMINI: Record<string, KnownModelLimits> = {\n \"gemini-2.5-pro\": { context_length: 1_048_576, max_output_tokens: 65_536 },\n \"gemini-2.5-flash\": { context_length: 1_048_576, max_output_tokens: 65_536 },\n \"gemini-2.0-flash-lite\": { context_length: 1_048_576, max_output_tokens: 8192 },\n \"gemini-2.0-flash\": { context_length: 1_048_576, max_output_tokens: 8192 },\n \"gemini-1.5-pro\": { context_length: 2_097_152, max_output_tokens: 8192 },\n \"gemini-1.5-flash\": { context_length: 1_048_576, max_output_tokens: 8192 },\n};\n\nconst OPENAI: Record<string, KnownModelLimits> = {\n \"gpt-5-mini\": { context_length: 400_000, max_output_tokens: 128_000 },\n \"gpt-5\": { context_length: 400_000, max_output_tokens: 128_000 },\n \"gpt-4.1-mini\": { context_length: 1_047_576, max_output_tokens: 32_768 },\n \"gpt-4.1\": { context_length: 1_047_576, max_output_tokens: 32_768 },\n \"gpt-4o-mini\": { context_length: 128_000, max_output_tokens: 16_384 },\n \"gpt-4o\": { context_length: 128_000, max_output_tokens: 16_384 },\n \"gpt-4-turbo\": { context_length: 128_000, max_output_tokens: 4096 },\n \"gpt-4\": { context_length: 8192, max_output_tokens: 4096 },\n \"gpt-3.5-turbo\": { context_length: 16_385, max_output_tokens: 4096 },\n \"chatgpt-4o\": { context_length: 128_000, max_output_tokens: 16_384 },\n \"o4-mini\": { context_length: 200_000, max_output_tokens: 100_000 },\n \"o3-mini\": { context_length: 200_000, max_output_tokens: 100_000 },\n \"o3\": { context_length: 200_000, max_output_tokens: 100_000 },\n \"o1-mini\": { context_length: 128_000, max_output_tokens: 65_536 },\n \"o1\": { context_length: 200_000, max_output_tokens: 100_000 },\n};\n\nconst DEEPSEEK: Record<string, KnownModelLimits> = {\n \"deepseek-v4-flash\": { context_length: 65_536, max_output_tokens: 8192 },\n \"deepseek-v4-pro\": { context_length: 65_536, max_output_tokens: 8192 },\n \"deepseek-chat\": { context_length: 65_536, max_output_tokens: 8192 },\n \"deepseek-reasoner\": { context_length: 65_536, max_output_tokens: 8192 },\n};\n\n// GitHub Copilot proxies vendor models — sometimes under a transformed id\n// (e.g. `Github-Opus4.6`, `copilot-claude-3.5-sonnet`). Strip the proxy\n// prefix and dispatch to the underlying vendor table.\nfunction resolveCopilot(model_id: string): KnownModelLimits | null {\n const normalized = model_id\n .replace(/^(?:Github-|copilot-)/i, \"\")\n .toLowerCase();\n // Canonicalise a few proxy-specific spellings.\n const canon = normalized\n .replace(/^opus4\\.6/, \"claude-opus-4-7\")\n .replace(/^opus4/, \"claude-opus-4\")\n .replace(/^sonnet4\\.6/, \"claude-sonnet-4-6\")\n .replace(/^sonnet4/, \"claude-sonnet-4\")\n .replace(/^haiku4\\.5/, \"claude-haiku-4-5\");\n if (canon.startsWith(\"claude\")) return matchPrefix(ANTHROPIC, canon);\n if (canon.startsWith(\"gemini\")) return matchPrefix(GEMINI, canon);\n if (canon.startsWith(\"gpt\") || /^o[134](?:-|$)/.test(canon)) return matchPrefix(OPENAI, canon);\n return null;\n}\n\nfunction matchPrefix(table: Record<string, KnownModelLimits>, id: string): KnownModelLimits | null {\n const lower = id.toLowerCase();\n const exact = table[lower];\n if (exact) return exact;\n // Longest-prefix match so `gpt-4o-2024-08-06` resolves to `gpt-4o` and\n // not `gpt-4` (which would also prefix-match).\n let best: { key: string; v: KnownModelLimits } | null = null;\n for (const [k, v] of Object.entries(table)) {\n if (lower.startsWith(k) && (!best || k.length > best.key.length)) {\n best = { key: k, v };\n }\n }\n return best?.v ?? null;\n}\n\nexport function getKnownModelLimits(provider: string, model_id: string): KnownModelLimits | null {\n if (!provider || !model_id) return null;\n switch (provider) {\n case \"anthropic\": return matchPrefix(ANTHROPIC, model_id);\n case \"gemini\": return matchPrefix(GEMINI, model_id);\n case \"openai\": return matchPrefix(OPENAI, model_id);\n case \"deepseek\": return matchPrefix(DEEPSEEK, model_id);\n case \"github-copilot\": return resolveCopilot(model_id);\n default: return null;\n }\n}\n\nexport function getKnownContextLength(provider: string, model_id: string): number | null {\n return getKnownModelLimits(provider, model_id)?.context_length ?? null;\n}\n\nexport function getKnownMaxOutputTokens(provider: string, model_id: string): number | null {\n return getKnownModelLimits(provider, model_id)?.max_output_tokens ?? null;\n}\n\n// Flat catalog snapshot for one provider — used by introspection tools so\n// the agent can enumerate what's known statically. Returns [] for providers\n// without a static table (e.g. `langchain`, `mock`, externals).\nexport function listKnownModels(\n provider: string,\n): Array<{ model_id: string; context_length: number; max_output_tokens: number | null }> {\n let table: Record<string, KnownModelLimits> | null = null;\n switch (provider) {\n case \"anthropic\": table = ANTHROPIC; break;\n case \"gemini\": table = GEMINI; break;\n case \"openai\": table = OPENAI; break;\n case \"deepseek\": table = DEEPSEEK; break;\n default: return [];\n }\n return Object.entries(table).map(([model_id, l]) => ({\n model_id,\n context_length: l.context_length,\n max_output_tokens: l.max_output_tokens ?? null,\n }));\n}\n","module.exports = require(\"node:os\");","module.exports = require(\"node:fs/promises\");","module.exports = require(\"crypto\");","module.exports = require(\"https\");","module.exports = require(\"node:stream\");","module.exports = require(\"node:util\");","module.exports = require(\"next/dist/server/app-render/work-unit-async-storage.external.js\");","module.exports = require(\"node:fs\");","module.exports = require(\"node:url\");","module.exports = require(\"node:worker_threads\");","module.exports = require(\"node:path\");","module.exports = require(\"node:crypto\");","module.exports = require(\"buffer\");","module.exports = require(\"node:sqlite\");","module.exports = require(\"http\");","module.exports = require(\"next/dist/shared/lib/no-fallback-error.external\");","module.exports = require(\"events\");"],"names":["NextResponse","getProvider","listModelConfigs","getModelParams","getKnownContextLength","getKnownMaxOutputTokens","PROVIDER_CATALOG_TTL_MS","catalogCache","Map","getCachedCatalog","provider","force","now","Date","cached","get","fetchedAt","data","fetchCatalog","set","GET","req","params","nextUrl","searchParams","models","json","headers","err","error","String","status","POST","body","overrides","fetchOpenAICatalog","fetchGitHubCopilotCatalog","anthropicKnownModels","geminiKnownModels","deepseekKnownModels","fetchExternalCatalog","providerName","listModels","cfgs","filter","c","candidates","map","Object","keys","length","push","lastErr","Error","cfg","find","apiKey","api_key","process","env","OPENAI_API_KEY","res","fetch","Authorization","ok","chatPrefixes","chatModels","m","some","p","id","startsWith","context_length","max_output_tokens","hosted_on","capabilities","vision","includes","tools","streaming","json_mode","web_search","audio","files","sort","a","b","localeCompare","getStoredOAuthToken","oauth","sessionToken","exchangeCopilotSessionToken","list","fetchCopilotChatCatalog","sessionTok","copilot_session_token","trim","GITHUB_TOKEN","isLikelyGitHubPat","githubCopilotKnownModels","text","catch","statusText","supports","tool_calls","token","pat","v","ANTHROPIC","GEMINI","OPENAI","DEEPSEEK","resolveCopilot","model_id","normalized","replace","toLowerCase","canon","matchPrefix","test","table","lower","exact","best","k","entries","key","getKnownModelLimits","listKnownModels","l"],"sourceRoot":"","ignoreList":[0,3,7,12,17,25,34]}
|
|
@@ -254,7 +254,13 @@ var responses = __webpack_require__(39947);
|
|
|
254
254
|
// EXTERNAL MODULE: ./lib/providers/index.ts + 8 modules
|
|
255
255
|
var providers = __webpack_require__(68866);
|
|
256
256
|
;// ./app/api/v1/providers/route.ts
|
|
257
|
-
|
|
257
|
+
/**
|
|
258
|
+
* @public — `GET /api/v1/providers`
|
|
259
|
+
*
|
|
260
|
+
* Lists every registered LLM provider name (built-in + external `.cjs`
|
|
261
|
+
* plugins). The agent-callable equivalent is the `list_providers` tool.
|
|
262
|
+
* See `docs/api.md`.
|
|
263
|
+
*/
|
|
258
264
|
|
|
259
265
|
async function GET() {
|
|
260
266
|
return (0,responses/* cachedJson */.Bm)((0,providers/* listProviderNames */.Yb)(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B,cAAce,OAAOX,KAAK,CAACc,MAAM,CAAC,EAAE,EAAEjB,WAAW,gBAAgB;IAC1E;IACA,OAAOc,OAAOR,IAAI;AACpB;;;;;;;;ACzDA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAiD;AACG;AAE7C,eAAea;IACpB,OAAOZ,gCAAUA,CAACW,uCAAiBA,IAAI;AACzC;;;ACL+F;AACvC;AACqB;AACkB;AACvB;AACgB;AACT;AACK;AACmC;AACjD;AACO;AACf;AACsC;AACzB;AACM;AACC;AAChB;AACwB;AAC1F;AACA;AACA;AACA,wBAAwB,mCAAmB;AAC3C;AACA,cAAc,oBAAS;AACvB;AACA;AACA;AACA;AACA,KAAK;AACL,aAAa,OAAoC,IAAI,CAAE;AACvD,wBAAwB,MAAuC;AAC/D;AACA;AACA;AACA,cAAc,qBAAQ;AACtB;AACA;AACA;AACA;AACA,OAAO,MAAsD,GAAG,CAE3D,CAAC;AACN,CAAC;AACD;AACA;AACA;AACA,QAAQ,sDAAsD;AAC9D;AACA,WAAW,0BAAW;AACtB;AACA;AACA,KAAK;AACL;AAC0F;AACnF;AACP;AACA,QAAQ,+BAAc;AACtB;AACA;AACA,QAAQ,+BAAc;AACtB;AACA;AACA;AACA;AACA;AACA,QAAQ,KAAqB,EAAE,EAE1B,CAAC;AACN;AACA;AACA;AACA,+BAA+B,KAAwC;AACvE;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,6NAA6N;AACzO,8BAA8B,+BAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,2CAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,6CAAqB;AAC7B;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,mBAAmB,0BAAS;AAC5B;AACA;AACA,kCAAkC,+BAAc;AAChD,6BAA6B,+BAAc;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,4BAA4B,oBAAe;AAC3C,4BAA4B,qBAAgB;AAC5C,oBAAoB,+BAAkB,kCAAkC,uCAAsB;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iEAAiE,wBAAc;AAC/E,+DAA+D,yCAAyC;AACxG;AACA;AACA;AACA;AACA,oCAAoC,QAAQ,EAAE,MAAM;AACpD;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB,uCAAuC,QAAQ,EAAE,QAAQ;AACzD;AACA,aAAa;AACb;AACA;AACA;AACA,+CAA+C,oBAAoB;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,uCAAyB;AACjE;AACA,oCAAoC,oCAAsB;AAC1D;AACA;AACA;AACA;AACA,sJAAsJ,4BAAc;AACpK,0IAA0I,4BAAc;AACxJ;AACA;AACA;AACA,sCAAsC,8BAAe;AACrD;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA,8BAA8B,qCAAY;AAC1C;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,oCAAmB;AACjE;AACA;AACA,6BAA6B;AAC7B,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,oBAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,qIAAqI,8BAAe;AACpJ;AACA,2GAA2G,iHAAiH;AAC5N;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,yCAA2B;AACvD;AACA,+BAA+B,oCAAsB;AACrD;AACA;AACA;AACA;AACA,6CAA6C,uCAAqB;AAClE;AACA,kBAAkB,qCAAY;AAC9B;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,6EAA6E,wBAAc;AAC3F,iCAAiC,QAAQ,EAAE,QAAQ;AACnD,0BAA0B,qBAAQ;AAClC;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,MAAM;AACN,6BAA6B,2CAAe;AAC5C;AACA;AACA;AACA;AACA;AACA,kCAAkC,oCAAmB;AACrD;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,cAAc,qCAAY;AAC1B;AACA,SAAS;AACT;AACA;AACA;;AAEA;;;;;;;;AC7WA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA","sources":["webpack://@circuitwall/jarela/external commonjs \"next/dist/shared/lib/router/utils/app-paths\"","webpack://@circuitwall/jarela/external node-commonjs \"node:process\"","webpack://@circuitwall/jarela/external commonjs2 \"url\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/server/app-render/after-task-async-storage.external.js\"","webpack://@circuitwall/jarela/external commonjs \"undici\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/compiled/next-server/app-page.runtime.prod.js\"","webpack://@circuitwall/jarela/external node-commonjs \"node:async_hooks\"","webpack://@circuitwall/jarela/external commonjs2 \"stream\"","webpack://@circuitwall/jarela/external commonjs2 \"util\"","webpack://@circuitwall/jarela/external commonjs2 \"fs\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/server/app-render/work-async-storage.external.js\"","webpack://@circuitwall/jarela/external node-commonjs \"node:child_process\"","webpack://@circuitwall/jarela/external commonjs2 \"path\"","webpack://@circuitwall/jarela/external node-commonjs \"node:http\"","webpack://@circuitwall/jarela/./lib/api/responses.ts","webpack://@circuitwall/jarela/external node-commonjs \"node:https\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/compiled/next-server/app-route.runtime.prod.js\"","webpack://@circuitwall/jarela/external node-commonjs \"node:os\"","webpack://@circuitwall/jarela/./app/api/v1/providers/route.ts","webpack://@circuitwall/jarela/?9ee6","webpack://@circuitwall/jarela/external node-commonjs \"node:fs/promises\"","webpack://@circuitwall/jarela/external commonjs2 \"crypto\"","webpack://@circuitwall/jarela/external commonjs2 \"https\"","webpack://@circuitwall/jarela/external node-commonjs \"node:stream\"","webpack://@circuitwall/jarela/external node-commonjs \"node:util\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/server/app-render/work-unit-async-storage.external.js\"","webpack://@circuitwall/jarela/external node-commonjs \"node:fs\"","webpack://@circuitwall/jarela/external node-commonjs \"node:url\"","webpack://@circuitwall/jarela/external node-commonjs \"node:worker_threads\"","webpack://@circuitwall/jarela/external node-commonjs \"node:path\"","webpack://@circuitwall/jarela/external node-commonjs \"node:crypto\"","webpack://@circuitwall/jarela/external commonjs2 \"buffer\"","webpack://@circuitwall/jarela/external node-commonjs \"node:sqlite\"","webpack://@circuitwall/jarela/external commonjs2 \"http\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/shared/lib/no-fallback-error.external\"","webpack://@circuitwall/jarela/external commonjs2 \"events\""],"sourcesContent":["module.exports = require(\"next/dist/shared/lib/router/utils/app-paths\");","module.exports = require(\"node:process\");","module.exports = require(\"url\");","module.exports = require(\"next/dist/server/app-render/after-task-async-storage.external.js\");","module.exports = require(\"undici\");","module.exports = require(\"next/dist/compiled/next-server/app-page.runtime.prod.js\");","module.exports = require(\"node:async_hooks\");","module.exports = require(\"stream\");","module.exports = require(\"util\");","module.exports = require(\"fs\");","module.exports = require(\"next/dist/server/app-render/work-async-storage.external.js\");","module.exports = require(\"node:child_process\");","module.exports = require(\"path\");","module.exports = require(\"node:http\");","// Shared HTTP response builders for app/api/v1/** route handlers.\n//\n// Goal: every error/success payload across the v1 surface has the same\n// shape. Before this lived inline, response bodies drifted —\n// `{error: \"x\"}` vs `{message: \"x\"}`, 400 vs 422 for the same condition,\n// some routes returned Zod's raw issue array, others stringified it.\n\nimport { NextResponse } from \"next/server\";\nimport type { z } from \"zod\";\nimport type { NextRequest } from \"next/server\";\n\nexport function errorResponse(message: string, status: number = 400): NextResponse {\n return NextResponse.json({ error: message }, { status });\n}\n\nexport function notFoundResponse(message: string = \"Not found\"): NextResponse {\n return errorResponse(message, 404);\n}\n\nexport function createdResponse<T>(data: T): NextResponse {\n return NextResponse.json(data, { status: 201 });\n}\n\n// Wrap a 200 JSON response with a private Cache-Control header. Use on safe\n// GET endpoints that serve user-scoped data the client refetches often (panel\n// mounts, navigation back/forward) but mutates rarely. The TTL is short\n// enough that explicit mutations — which patch the client-side ApiClient\n// cache in place — stay observably consistent without an extra roundtrip.\nexport function cachedJson<T>(data: T, maxAgeSeconds: number): NextResponse {\n return NextResponse.json(data, {\n headers: {\n \"Cache-Control\": `private, max-age=${maxAgeSeconds}`,\n },\n });\n}\n\n// Validate a JSON request body against a zod schema.\n// Returns either the parsed data or a 400 NextResponse explaining the issue.\n// Caller pattern:\n// const parsed = await validateBody(req, Schema);\n// if (parsed instanceof NextResponse) return parsed;\n// // use parsed.field\nexport async function validateBody<S extends z.ZodTypeAny>(\n req: NextRequest,\n schema: S,\n): Promise<z.infer<S> | NextResponse> {\n let raw: unknown;\n try {\n raw = await req.json();\n } catch {\n return errorResponse(\"Request body must be valid JSON\", 400);\n }\n const parsed = schema.safeParse(raw);\n if (!parsed.success) {\n return errorResponse(parsed.error.issues[0]?.message ?? \"invalid body\", 400);\n }\n return parsed.data;\n}\n","module.exports = require(\"node:https\");","module.exports = require(\"next/dist/compiled/next-server/app-route.runtime.prod.js\");","module.exports = require(\"node:os\");","import { cachedJson } from \"@/lib/api/responses\";\nimport { listProviderNames } from \"@/lib/providers\";\n\nexport async function GET() {\n return cachedJson(listProviderNames(), 300);\n}\n","import { AppRouteRouteModule } from \"next/dist/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/lib/constants\";\nimport { NoFallbackError } from \"next/dist/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/server/response-cache\";\nimport * as userland from \"/home/runner/work/jarela/jarela/app/api/v1/providers/route.ts\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/v1/providers/route\",\n pathname: \"/api/v1/providers\",\n filename: \"route\",\n bundlePath: \"app/api/v1/providers/route\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"/home/runner/work/jarela/jarela/app/api/v1/providers/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"/home/runner/work/jarela/jarela/app/api/v1/providers/route.ts\")\n } : {}\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 (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/v1/providers/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, deploymentId, 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.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 isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n 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 deploymentId\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 let parentSpan;\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 // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\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 (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\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), undefined, !isWrappedByNextServer);\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","module.exports = require(\"node:fs/promises\");","module.exports = require(\"crypto\");","module.exports = require(\"https\");","module.exports = require(\"node:stream\");","module.exports = require(\"node:util\");","module.exports = require(\"next/dist/server/app-render/work-unit-async-storage.external.js\");","module.exports = require(\"node:fs\");","module.exports = require(\"node:url\");","module.exports = require(\"node:worker_threads\");","module.exports = require(\"node:path\");","module.exports = require(\"node:crypto\");","module.exports = require(\"buffer\");","module.exports = require(\"node:sqlite\");","module.exports = require(\"http\");","module.exports = require(\"next/dist/shared/lib/no-fallback-error.external\");","module.exports = require(\"events\");"],"names":["NextResponse","errorResponse","message","status","json","error","notFoundResponse","createdResponse","data","cachedJson","maxAgeSeconds","headers","validateBody","req","schema","raw","parsed","safeParse","success","issues","listProviderNames","GET"],"sourceRoot":"","ignoreList":[0,3,5,10,16,25,34]}
|
|
1
|
+
{"version":3,"file":"../app/api/v1/providers/route.js","mappings":";;;;;;;;;;AAAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;;;;;;;;;ACAA,kEAAkE;AAClE,EAAE;AACF,uEAAuE;AACvE,6DAA6D;AAC7D,yEAAyE;AACzE,qEAAqE;AAE1B;AAIpC,SAASC,cAAcC,OAAe,EAAEC,SAAiB,GAAG;IACjE,OAAOH,qDAAYA,CAACI,IAAI,CAAC;QAAEC,OAAOH;IAAQ,GAAG;QAAEC;IAAO;AACxD;AAEO,SAASG,iBAAiBJ,UAAkB,WAAW;IAC5D,OAAOD,cAAcC,SAAS;AAChC;AAEO,SAASK,gBAAmBC,IAAO;IACxC,OAAOR,qDAAYA,CAACI,IAAI,CAACI,MAAM;QAAEL,QAAQ;IAAI;AAC/C;AAEA,4EAA4E;AAC5E,8EAA8E;AAC9E,wEAAwE;AACxE,yEAAyE;AACzE,0EAA0E;AACnE,SAASM,WAAcD,IAAO,EAAEE,aAAqB;IAC1D,OAAOV,qDAAYA,CAACI,IAAI,CAACI,MAAM;QAC7BG,SAAS;YACP,iBAAiB,CAAC,iBAAiB,EAAED,eAAe;QACtD;IACF;AACF;AAEA,qDAAqD;AACrD,6EAA6E;AAC7E,kBAAkB;AAClB,oDAAoD;AACpD,uDAAuD;AACvD,wBAAwB;AACjB,eAAeE,aACpBC,GAAgB,EAChBC,MAAS;IAET,IAAIC;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AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,2CAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,6CAAqB;AAC7B;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,mBAAmB,0BAAS;AAC5B;AACA;AACA,kCAAkC,+BAAc;AAChD,6BAA6B,+BAAc;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,4BAA4B,oBAAe;AAC3C,4BAA4B,qBAAgB;AAC5C,oBAAoB,+BAAkB,kCAAkC,uCAAsB;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iEAAiE,wBAAc;AAC/E,+DAA+D,yCAAyC;AACxG;AACA;AACA;AACA;AACA,oCAAoC,QAAQ,EAAE,MAAM;AACpD;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB,uCAAuC,QAAQ,EAAE,QAAQ;AACzD;AACA,aAAa;AACb;AACA;AACA;AACA,+CAA+C,oBAAoB;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,uCAAyB;AACjE;AACA,oCAAoC,oCAAsB;AAC1D;AACA;AACA;AACA;AACA,sJAAsJ,4BAAc;AACpK,0IAA0I,4BAAc;AACxJ;AACA;AACA;AACA,sCAAsC,8BAAe;AACrD;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA,8BAA8B,qCAAY;AAC1C;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,oCAAmB;AACjE;AACA;AACA,6BAA6B;AAC7B,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,oBAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,qIAAqI,8BAAe;AACpJ;AACA,2GAA2G,iHAAiH;AAC5N;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,yCAA2B;AACvD;AACA,+BAA+B,oCAAsB;AACrD;AACA;AACA;AACA;AACA,6CAA6C,uCAAqB;AAClE;AACA,kBAAkB,qCAAY;AAC9B;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,6EAA6E,wBAAc;AAC3F,iCAAiC,QAAQ,EAAE,QAAQ;AACnD,0BAA0B,qBAAQ;AAClC;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,MAAM;AACN,6BAA6B,2CAAe;AAC5C;AACA;AACA;AACA;AACA;AACA,kCAAkC,oCAAmB;AACrD;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,cAAc,qCAAY;AAC1B;AACA,SAAS;AACT;AACA;AACA;;AAEA;;;;;;;;AC7WA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA","sources":["webpack://@circuitwall/jarela/external commonjs \"next/dist/shared/lib/router/utils/app-paths\"","webpack://@circuitwall/jarela/external node-commonjs \"node:process\"","webpack://@circuitwall/jarela/external commonjs2 \"url\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/server/app-render/after-task-async-storage.external.js\"","webpack://@circuitwall/jarela/external commonjs \"undici\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/compiled/next-server/app-page.runtime.prod.js\"","webpack://@circuitwall/jarela/external node-commonjs \"node:async_hooks\"","webpack://@circuitwall/jarela/external commonjs2 \"stream\"","webpack://@circuitwall/jarela/external commonjs2 \"util\"","webpack://@circuitwall/jarela/external commonjs2 \"fs\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/server/app-render/work-async-storage.external.js\"","webpack://@circuitwall/jarela/external node-commonjs \"node:child_process\"","webpack://@circuitwall/jarela/external commonjs2 \"path\"","webpack://@circuitwall/jarela/external node-commonjs \"node:http\"","webpack://@circuitwall/jarela/./lib/api/responses.ts","webpack://@circuitwall/jarela/external node-commonjs \"node:https\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/compiled/next-server/app-route.runtime.prod.js\"","webpack://@circuitwall/jarela/external node-commonjs \"node:os\"","webpack://@circuitwall/jarela/./app/api/v1/providers/route.ts","webpack://@circuitwall/jarela/?9ee6","webpack://@circuitwall/jarela/external node-commonjs \"node:fs/promises\"","webpack://@circuitwall/jarela/external commonjs2 \"crypto\"","webpack://@circuitwall/jarela/external commonjs2 \"https\"","webpack://@circuitwall/jarela/external node-commonjs \"node:stream\"","webpack://@circuitwall/jarela/external node-commonjs \"node:util\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/server/app-render/work-unit-async-storage.external.js\"","webpack://@circuitwall/jarela/external node-commonjs \"node:fs\"","webpack://@circuitwall/jarela/external node-commonjs \"node:url\"","webpack://@circuitwall/jarela/external node-commonjs \"node:worker_threads\"","webpack://@circuitwall/jarela/external node-commonjs \"node:path\"","webpack://@circuitwall/jarela/external node-commonjs \"node:crypto\"","webpack://@circuitwall/jarela/external commonjs2 \"buffer\"","webpack://@circuitwall/jarela/external node-commonjs \"node:sqlite\"","webpack://@circuitwall/jarela/external commonjs2 \"http\"","webpack://@circuitwall/jarela/external commonjs \"next/dist/shared/lib/no-fallback-error.external\"","webpack://@circuitwall/jarela/external commonjs2 \"events\""],"sourcesContent":["module.exports = require(\"next/dist/shared/lib/router/utils/app-paths\");","module.exports = require(\"node:process\");","module.exports = require(\"url\");","module.exports = require(\"next/dist/server/app-render/after-task-async-storage.external.js\");","module.exports = require(\"undici\");","module.exports = require(\"next/dist/compiled/next-server/app-page.runtime.prod.js\");","module.exports = require(\"node:async_hooks\");","module.exports = require(\"stream\");","module.exports = require(\"util\");","module.exports = require(\"fs\");","module.exports = require(\"next/dist/server/app-render/work-async-storage.external.js\");","module.exports = require(\"node:child_process\");","module.exports = require(\"path\");","module.exports = require(\"node:http\");","// Shared HTTP response builders for app/api/v1/** route handlers.\n//\n// Goal: every error/success payload across the v1 surface has the same\n// shape. Before this lived inline, response bodies drifted —\n// `{error: \"x\"}` vs `{message: \"x\"}`, 400 vs 422 for the same condition,\n// some routes returned Zod's raw issue array, others stringified it.\n\nimport { NextResponse } from \"next/server\";\nimport type { z } from \"zod\";\nimport type { NextRequest } from \"next/server\";\n\nexport function errorResponse(message: string, status: number = 400): NextResponse {\n return NextResponse.json({ error: message }, { status });\n}\n\nexport function notFoundResponse(message: string = \"Not found\"): NextResponse {\n return errorResponse(message, 404);\n}\n\nexport function createdResponse<T>(data: T): NextResponse {\n return NextResponse.json(data, { status: 201 });\n}\n\n// Wrap a 200 JSON response with a private Cache-Control header. Use on safe\n// GET endpoints that serve user-scoped data the client refetches often (panel\n// mounts, navigation back/forward) but mutates rarely. The TTL is short\n// enough that explicit mutations — which patch the client-side ApiClient\n// cache in place — stay observably consistent without an extra roundtrip.\nexport function cachedJson<T>(data: T, maxAgeSeconds: number): NextResponse {\n return NextResponse.json(data, {\n headers: {\n \"Cache-Control\": `private, max-age=${maxAgeSeconds}`,\n },\n });\n}\n\n// Validate a JSON request body against a zod schema.\n// Returns either the parsed data or a 400 NextResponse explaining the issue.\n// Caller pattern:\n// const parsed = await validateBody(req, Schema);\n// if (parsed instanceof NextResponse) return parsed;\n// // use parsed.field\nexport async function validateBody<S extends z.ZodTypeAny>(\n req: NextRequest,\n schema: S,\n): Promise<z.infer<S> | NextResponse> {\n let raw: unknown;\n try {\n raw = await req.json();\n } catch {\n return errorResponse(\"Request body must be valid JSON\", 400);\n }\n const parsed = schema.safeParse(raw);\n if (!parsed.success) {\n return errorResponse(parsed.error.issues[0]?.message ?? \"invalid body\", 400);\n }\n return parsed.data;\n}\n","module.exports = require(\"node:https\");","module.exports = require(\"next/dist/compiled/next-server/app-route.runtime.prod.js\");","module.exports = require(\"node:os\");","/**\n * @public — `GET /api/v1/providers`\n *\n * Lists every registered LLM provider name (built-in + external `.cjs`\n * plugins). The agent-callable equivalent is the `list_providers` tool.\n * See `docs/api.md`.\n */\n\nimport { cachedJson } from \"@/lib/api/responses\";\nimport { listProviderNames } from \"@/lib/providers\";\n\nexport async function GET() {\n return cachedJson(listProviderNames(), 300);\n}\n","import { AppRouteRouteModule } from \"next/dist/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/lib/constants\";\nimport { NoFallbackError } from \"next/dist/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/server/response-cache\";\nimport * as userland from \"/home/runner/work/jarela/jarela/app/api/v1/providers/route.ts\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/v1/providers/route\",\n pathname: \"/api/v1/providers\",\n filename: \"route\",\n bundlePath: \"app/api/v1/providers/route\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"/home/runner/work/jarela/jarela/app/api/v1/providers/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"/home/runner/work/jarela/jarela/app/api/v1/providers/route.ts\")\n } : {}\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 (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/v1/providers/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, deploymentId, 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.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 isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n 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 deploymentId\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 let parentSpan;\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 // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\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 (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\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), undefined, !isWrappedByNextServer);\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","module.exports = require(\"node:fs/promises\");","module.exports = require(\"crypto\");","module.exports = require(\"https\");","module.exports = require(\"node:stream\");","module.exports = require(\"node:util\");","module.exports = require(\"next/dist/server/app-render/work-unit-async-storage.external.js\");","module.exports = require(\"node:fs\");","module.exports = require(\"node:url\");","module.exports = require(\"node:worker_threads\");","module.exports = require(\"node:path\");","module.exports = require(\"node:crypto\");","module.exports = require(\"buffer\");","module.exports = require(\"node:sqlite\");","module.exports = require(\"http\");","module.exports = require(\"next/dist/shared/lib/no-fallback-error.external\");","module.exports = require(\"events\");"],"names":["NextResponse","errorResponse","message","status","json","error","notFoundResponse","createdResponse","data","cachedJson","maxAgeSeconds","headers","validateBody","req","schema","raw","parsed","safeParse","success","issues","listProviderNames","GET"],"sourceRoot":"","ignoreList":[0,3,5,10,16,25,34]}
|
|
@@ -106,7 +106,13 @@ var serializers = __webpack_require__(85678);
|
|
|
106
106
|
// EXTERNAL MODULE: ./lib/agents/checkpointer.ts + 1 modules
|
|
107
107
|
var checkpointer = __webpack_require__(66963);
|
|
108
108
|
;// ./app/api/v1/threads/[thread_id]/route.ts
|
|
109
|
-
|
|
109
|
+
/**
|
|
110
|
+
* @public — `GET /api/v1/threads/[thread_id]` (read messages),
|
|
111
|
+
* `PATCH /api/v1/threads/[thread_id]` (rename / set agent),
|
|
112
|
+
* `DELETE /api/v1/threads/[thread_id]` (drop thread)
|
|
113
|
+
*
|
|
114
|
+
* Thread-level CRUD. See `docs/api.md`.
|
|
115
|
+
*/
|
|
110
116
|
|
|
111
117
|
|
|
112
118
|
|
|
@@ -1067,6 +1073,12 @@ function mcpServerToResponse(r) {
|
|
|
1067
1073
|
* chat panel's `ContextUsageBar` consumes. Returns `null` for messages
|
|
1068
1074
|
* that have no snapshot (user turns and legacy assistant rows recorded
|
|
1069
1075
|
* before the per-turn snapshot landed in ADR-0041).
|
|
1076
|
+
*
|
|
1077
|
+
* Anthropic prompt-cache tokens (PR #181 + the cache-fidelity follow-up)
|
|
1078
|
+
* are surfaced as additive fields so future UI work can render a
|
|
1079
|
+
* "served from cache" badge without another wire change. Both are
|
|
1080
|
+
* `null` for rows that predate cache plumbing or for providers that
|
|
1081
|
+
* don't expose a cache breakdown.
|
|
1070
1082
|
*/ function messageUsageToResponse(u) {
|
|
1071
1083
|
if (!u) return null;
|
|
1072
1084
|
return {
|
|
@@ -1079,7 +1091,9 @@ function mcpServerToResponse(r) {
|
|
|
1079
1091
|
hot_budget_tokens: u.hot_budget_tokens,
|
|
1080
1092
|
warm_budget_tokens: u.warm_budget_tokens,
|
|
1081
1093
|
facts_budget_tokens: u.facts_budget_tokens,
|
|
1082
|
-
context_window_tokens: u.context_window_tokens
|
|
1094
|
+
context_window_tokens: u.context_window_tokens,
|
|
1095
|
+
cache_creation_input_tokens: u.cache_creation_input_tokens,
|
|
1096
|
+
cache_read_input_tokens: u.cache_read_input_tokens
|
|
1083
1097
|
};
|
|
1084
1098
|
}
|
|
1085
1099
|
/**
|