@circuitwall/jarela 1.4.0 → 1.4.1
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/build-manifest.json +3 -3
- 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 +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- 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 +1 -1
- 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 +1 -1
- package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js +10 -1
- package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/dashboard/currency/route.js +10 -5
- package/.next/standalone/.next/server/app/api/v1/dashboard/currency/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js +9 -1
- package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +33 -8
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.map +1 -1
- package/.next/standalone/.next/server/app/page.js +63 -202
- package/.next/standalone/.next/server/app/page.js.map +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/setup/page.js +1 -1
- package/.next/standalone/.next/server/app/setup/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/1718.js +159 -0
- package/.next/standalone/.next/server/chunks/1718.js.map +1 -0
- package/.next/standalone/.next/server/chunks/2082.js +6 -3
- package/.next/standalone/.next/server/chunks/2082.js.map +1 -1
- package/.next/standalone/.next/server/chunks/210.js +28 -0
- package/.next/standalone/.next/server/chunks/210.js.map +1 -1
- package/.next/standalone/.next/server/chunks/423.js +6 -3
- package/.next/standalone/.next/server/chunks/423.js.map +1 -1
- package/.next/standalone/.next/server/chunks/4631.js +37 -5
- package/.next/standalone/.next/server/chunks/4631.js.map +1 -1
- package/.next/standalone/.next/server/chunks/8167.js +255 -204
- package/.next/standalone/.next/server/chunks/8167.js.map +1 -1
- package/.next/standalone/.next/server/chunks/8866.js +38 -5
- package/.next/standalone/.next/server/chunks/8866.js.map +1 -1
- package/.next/standalone/.next/server/chunks/9032.js +8 -0
- package/.next/standalone/.next/server/chunks/9032.js.map +1 -1
- package/.next/standalone/.next/server/chunks/{7883.js → 9557.js} +15 -3
- package/.next/standalone/.next/server/chunks/9557.js.map +1 -0
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/middleware.js +6 -3
- 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/{2351-68d8987bbe17ba2d.js → 2351-1ab119fb3b48f4c9.js} +258 -205
- package/.next/standalone/.next/static/chunks/2351-1ab119fb3b48f4c9.js.map +1 -0
- package/.next/standalone/.next/static/chunks/{9209-0d46118e502f8bf5.js → 4097-64691f9110cf167c.js} +14 -2
- package/.next/standalone/.next/static/chunks/4097-64691f9110cf167c.js.map +1 -0
- package/.next/standalone/.next/static/chunks/app/{page-74846c864241b96d.js → page-145150e0468544e7.js} +64 -203
- package/.next/standalone/.next/static/chunks/app/page-145150e0468544e7.js.map +1 -0
- package/.next/standalone/.next/static/chunks/app/setup/{page-9a465b5fa755b3c3.js → page-a1463a9ace439ff7.js} +2 -2
- package/.next/standalone/.next/static/chunks/app/setup/{page-9a465b5fa755b3c3.js.map → page-a1463a9ace439ff7.js.map} +1 -1
- package/.next/standalone/.next/static/chunks/{webpack-ff5627013a5e3842.js → webpack-f4ac5c5f92cfd1c1.js} +13 -1
- package/.next/standalone/.next/static/chunks/webpack-f4ac5c5f92cfd1c1.js.map +1 -0
- package/.next/standalone/package.json +1 -1
- package/CHANGELOG.md +60 -0
- package/README.md +1 -1
- package/api/client.ts +10 -9
- package/app/api/v1/dashboard/currency/route.ts +7 -2
- package/app/api/v1/providers/[provider]/probe/route.ts +12 -1
- package/app/api/v1/threads/[thread_id]/run/route.ts +22 -8
- package/components/layout/AppShell.tsx +53 -17
- package/components/setup/PinKeypad.tsx +238 -0
- package/components/setup/ScreenLock.tsx +8 -173
- package/components/setup/UnlockScreen.tsx +25 -192
- package/lib/documents/remote/github.ts +16 -2
- package/lib/documents/remote/mail.ts +11 -2
- package/lib/lifecycle/shutdown.ts +9 -0
- package/lib/providers/github-copilot-auth.ts +2 -0
- package/lib/providers/github-copilot.ts +1 -0
- package/lib/tools/async-results.ts +11 -0
- package/package.json +1 -1
- package/scripts/install-to-system.ps1 +2 -2
- package/scripts/installed-launcher.ps1 +81 -17
- package/.next/standalone/.next/server/chunks/7883.js.map +0 -1
- package/.next/standalone/.next/static/chunks/2351-68d8987bbe17ba2d.js.map +0 -1
- package/.next/standalone/.next/static/chunks/9209-0d46118e502f8bf5.js.map +0 -1
- package/.next/standalone/.next/static/chunks/app/page-74846c864241b96d.js.map +0 -1
- package/.next/standalone/.next/static/chunks/webpack-ff5627013a5e3842.js.map +0 -1
- /package/.next/standalone/.next/static/{AV5AO0yTRABo-NgwxhDe7 → WQdcnm9NyqpeNc0Z8_woo}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{AV5AO0yTRABo-NgwxhDe7 → WQdcnm9NyqpeNc0Z8_woo}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"../app/api/v1/threads/[thread_id]/run/route.js","mappings":";;;;;;;;;;AAAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAa;AACb,IAAI,KAAmC,EAAE,EAExC,CAAC;AACF,QAAQ,KAAqC,EAAE,EAc1C,CAAC;AACN,YAAY,KAAsC,EAAE,EAM3C,CAAC;AACV,gBAAgB,KAAqB,EAAE,EAE1B,CAAC;AACd,gBAAgB,2CAAoF;AACpG;AACA;AACA;AACA;;AAEA;;;;;;;ACnCA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;;;;ACAA,yEAAyE;AACzE,yEAAyE;AACzE,yEAAyE;AACzE,oDAAoD;AAW7C,SAASA,YACdC,MAAsB,EACtBC,OAA2B,CAAC,CAAC;IAE7B,MAAM,EAAEC,wBAAwB,IAAI,EAAE,GAAGD;IACzC,MAAME,U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ACA,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","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 \"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/./node_modules/next/dist/server/route-modules/app-route/module.compiled.js","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:dns\"","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/external node-commonjs \"node:fs/promises\"","webpack://@circuitwall/jarela/./lib/api/sse.ts","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:worker_threads\"","webpack://@circuitwall/jarela/external node-commonjs \"node:path\"","webpack://@circuitwall/jarela/external node-commonjs \"node:net\"","webpack://@circuitwall/jarela/external node-commonjs \"node:crypto\"","webpack://@circuitwall/jarela/external commonjs2 \"buffer\"","webpack://@circuitwall/jarela/external commonjs2 \"fs/promises\"","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 module \"@langchain/mcp-adapters\"","webpack://@circuitwall/jarela/./node_modules/next/dist/server/send-response.js","webpack://@circuitwall/jarela/external commonjs2 \"events\"","webpack://@circuitwall/jarela/./app/api/v1/threads/[thread_id]/run/route.ts","webpack://@circuitwall/jarela/?07f6"],"sourcesContent":["module.exports = require(\"next/dist/shared/lib/router/utils/app-paths\");","module.exports = require(\"node:process\");","module.exports = require(\"url\");","module.exports = require(\"undici\");","module.exports = require(\"next/dist/compiled/next-server/app-page.runtime.prod.js\");","module.exports = require(\"node:async_hooks\");","\"use strict\";\nif (process.env.NEXT_RUNTIME === 'edge') {\n module.exports = require('next/dist/server/route-modules/app-route/module.js');\n} else {\n if (process.env.__NEXT_EXPERIMENTAL_REACT) {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.dev.js');\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.dev.js');\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.prod.js');\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.prod.js');\n }\n }\n } else {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.dev.js');\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route.runtime.dev.js');\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.prod.js');\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route.runtime.prod.js');\n }\n }\n }\n}\n\n//# sourceMappingURL=module.compiled.js.map","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:dns\");","module.exports = require(\"node:https\");","module.exports = require(\"next/dist/compiled/next-server/app-route.runtime.prod.js\");","module.exports = require(\"node:os\");","module.exports = require(\"node:fs/promises\");","// Shared response builder for Server-Sent Event streams. Centralises the\n// content-type / cache-control / connection / proxy-buffering headers so\n// every SSE endpoint behaves identically through nginx, tailscale-serve,\n// and Cloudflare. See ADR-0009 for the proxy story.\n\nexport interface SseResponseOptions {\n /**\n * Set `X-Accel-Buffering: no`. Required when intermediate proxies\n * (nginx, tailscale-serve) might coalesce small chunks and break SSE\n * framing. Default: true.\n */\n disableProxyBuffering?: boolean;\n}\n\nexport function sseResponse(\n stream: ReadableStream,\n opts: SseResponseOptions = {},\n): Response {\n const { disableProxyBuffering = true } = opts;\n const headers: Record<string, string> = {\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-cache\",\n Connection: \"keep-alive\",\n };\n if (disableProxyBuffering) headers[\"X-Accel-Buffering\"] = \"no\";\n return new Response(stream, { headers });\n}\n","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:worker_threads\");","module.exports = require(\"node:path\");","module.exports = require(\"node:net\");","module.exports = require(\"node:crypto\");","module.exports = require(\"buffer\");","module.exports = require(\"fs/promises\");","module.exports = require(\"node:sqlite\");","module.exports = require(\"http\");","module.exports = require(\"next/dist/shared/lib/no-fallback-error.external\");","module.exports = import(\"@langchain/mcp-adapters\");;","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"sendResponse\", {\n enumerable: true,\n get: function() {\n return sendResponse;\n }\n});\nconst _helpers = require(\"./base-http/helpers\");\nconst _pipereadable = require(\"./pipe-readable\");\nconst _utils = require(\"./web/utils\");\nasync function sendResponse(req, res, response, waitUntil) {\n if (// The type check here ensures that `req` is correctly typed, and the\n // environment variable check provides dead code elimination.\n process.env.NEXT_RUNTIME !== 'edge' && (0, _helpers.isNodeNextResponse)(res)) {\n var // Copy over the response headers.\n _response_headers;\n // Copy over the response status.\n res.statusCode = response.status;\n res.statusMessage = response.statusText;\n // TODO: this is not spec-compliant behavior and we should not restrict\n // headers that are allowed to appear many times.\n //\n // See:\n // https://github.com/vercel/next.js/pull/70127\n const headersWithMultipleValuesAllowed = [\n // can add more headers to this list if needed\n 'set-cookie',\n 'www-authenticate',\n 'proxy-authenticate',\n 'vary'\n ];\n (_response_headers = response.headers) == null ? void 0 : _response_headers.forEach((value, name)=>{\n // `x-middleware-set-cookie` is an internal header not needed for the response\n if (name.toLowerCase() === 'x-middleware-set-cookie') {\n return;\n }\n // The append handling is special cased for `set-cookie`.\n if (name.toLowerCase() === 'set-cookie') {\n // TODO: (wyattjoh) replace with native response iteration when we can upgrade undici\n for (const cookie of (0, _utils.splitCookiesString)(value)){\n res.appendHeader(name, cookie);\n }\n } else {\n // only append the header if it is either not present in the outbound response\n // or if the header supports multiple values\n const isHeaderPresent = typeof res.getHeader(name) !== 'undefined';\n if (headersWithMultipleValuesAllowed.includes(name.toLowerCase()) || !isHeaderPresent) {\n res.appendHeader(name, value);\n }\n }\n });\n /**\n * The response can't be directly piped to the underlying response. The\n * following is duplicated from the edge runtime handler.\n *\n * See packages/next/server/next-server.ts\n */ const { originalResponse } = res;\n // A response body must not be sent for HEAD requests. See https://httpwg.org/specs/rfc9110.html#HEAD\n if (response.body && req.method !== 'HEAD') {\n await (0, _pipereadable.pipeToNodeResponse)(response.body, originalResponse, waitUntil);\n } else {\n originalResponse.end();\n }\n }\n}\n\n//# sourceMappingURL=send-response.js.map","module.exports = require(\"events\");","/**\n * @public — `POST /api/v1/threads/[thread_id]/run` (submit run),\n * `GET /api/v1/threads/[thread_id]/run` (subscribe via SSE)\n *\n * Agent execution endpoint. Submit a run, then stream tokens, tool\n * calls, and final state. The split-and-subscribe shape lets reconnects\n * pick up an in-flight stream. See `docs/api.md`.\n */\n\nimport { NextRequest } from \"next/server\";\nimport type { StreamOptions, StreamChunk } from \"@/lib/agents/base\";\nimport type { ContentPart } from \"@/lib/tools/types\";\nimport {\n prepareThreadRun,\n persistAssistantMessage,\n withInterruptMarker,\n RunThreadError,\n snapshotThreadModelConfigName,\n shouldEmitChunk,\n} from \"@/lib/agents/run-thread\";\nimport { broadcast, finishRun, startRun, subscribe, abortRun, getRun } from \"@/lib/agents/run-registry\";\nimport { enqueueThreadRun, QueueFullError } from \"@/lib/agents/run-queue\";\nimport { collectStream } from \"@/lib/agents/stream-collector\";\nimport { getThread } from \"@/lib/stores/threads\";\nimport { publish as publishNotification } from \"@/lib/notifications/bus\";\nimport { sseResponse } from \"@/lib/api/sse\";\nimport { resolveTurnProfile } from \"@/lib/agents/turn-profile\";\n\ntype Params = { params: Promise<{ thread_id: string }> };\n\nconst enc = new TextEncoder();\nconst sse = (obj: Record<string, unknown>) => enc.encode(`data: ${JSON.stringify(obj)}\\n\\n`);\n\n// POST is the *command* half of the run lifecycle (ADR-0008). It accepts the\n// new user message, registers a run in the in-memory registry, kicks the\n// agent loop off in a detached async task, and returns 202 immediately. The\n// caller must follow up with a GET on this same path (as an `EventSource`)\n// to subscribe to the chunk stream — see GET below.\n//\n// Splitting submit from subscribe gives us a single reliable streaming\n// primitive across all browsers (EventSource is the only WebKit-native\n// streaming API that survives iOS Safari + Tailscale HTTP/2 proxies). It\n// also collapses what was previously a WS sidecar + SSE-over-POST +\n// SSE-GET-reattach trio into one transport.\nexport async function POST(req: NextRequest, { params }: Params) {\n const { thread_id } = await params;\n const { message, attachments, stream_options, hot_since } = (await req.json()) as {\n message: string;\n attachments?: ContentPart[];\n stream_options?: StreamOptions;\n // ADR-0042 — explicit context boundary the chat picked. ISO timestamp,\n // null to clear the pin, omitted to leave whatever's already persisted\n // on the thread.\n hot_since?: string | null;\n };\n\n // Per-thread FIFO queue (lib/agents/run-queue.ts). Every entry point\n // that drives an agent on a thread goes through this — HTTP POST,\n // scheduler, watcher, trigger, bridge — so concurrent fires on the same\n // thread_id serialise instead of racing the LangGraph checkpoint store.\n // If the queue is already at the soft cap, reject with 503 so the\n // caller can back off rather than pin yet more work in memory.\n const thread = getThread(thread_id);\n const pinnedModelConfigName = snapshotThreadModelConfigName(thread_id);\n let position: number;\n try {\n ({ position } = enqueueThreadRun(thread_id, \"user\", async () => {\n // startRun is called once it's our turn so the registry only ever\n // holds one active entry per thread at a time. Subscribers that\n // attach via GET before our turn comes will see no run yet and the\n // SSE handler emits a synthetic done — the client reopens the\n // EventSource and picks up the stream once we're running.\n const active = startRun(thread_id, thread?.agent_id ?? null);\n let prepared;\n try {\n prepared = await prepareThreadRun({\n thread_id,\n message,\n options: stream_options,\n attachments,\n signal: active.abort.signal,\n hot_since,\n context_profile: resolveTurnProfile(\"user\"),\n _pinned_model_config_name: pinnedModelConfigName,\n });\n } catch (err) {\n // Prep failure (unknown agent, model misconfig, …). With queueing\n // the HTTP request has already returned 202, so the error has to\n // surface as an SSE chunk to any attached subscriber. There may\n // be no subscriber if the GET hasn't connected yet — the chunk\n // is buffered on the ActiveRun for the next attach.\n const message_ = err instanceof RunThreadError ? err.message : String(err);\n const code = err instanceof RunThreadError ? err.code : \"run_prepare_error\";\n broadcast(active, { type: \"error\", data: { message: message_, code } });\n finishRun(active, \"error\");\n return;\n }\n\n // Drive the agent to completion regardless of client connection. Events\n // go to the registry; the GET subscriber (and any reattaching clients)\n // receive them via subscribe().\n //\n // CRITICAL: finishRun() MUST run no matter what — if it doesn't, the\n // run is pinned as \"running\" forever and the TTL eviction (scheduled\n // inside finishRun()) never fires, so a leaked entry never self-heals.\n // Wrap the whole body in try/finally.\n let terminal: \"done\" | \"error\" = \"error\";\n let assistantContent = \"\";\n try {\n const collected = await collectStream(prepared.stream as AsyncIterable<StreamChunk>, {\n onChunk: (chunk) => broadcast(active, chunk),\n });\n assistantContent = collected.assistantContent;\n terminal = collected.terminal;\n // If the stream threw mid-iteration, collectStream returns terminal=\"error\"\n // but no `error` chunk was broadcast — surface one to subscribers. Skip\n // when the run was deliberately aborted: llm.ts already emitted an\n // `error{code:\"aborted\"}` chunk for that path and re-broadcasting as\n // `stream_error` would mask the intent.\n if (collected.terminal === \"error\" && collected.errorMessage && !collected.aborted) {\n broadcast(active, {\n type: \"error\",\n data: { message: collected.errorMessage, code: \"stream_error\" },\n });\n }\n try {\n // On a user abort (Stop / steer), append the interrupt footer so\n // the partial reply is never silently dropped and the next agent\n // turn sees a clear marker explaining the cut. withInterruptMarker\n // returns the bare marker when the partial is empty, which forces\n // persistAssistantMessage past its skip-empty guard so the thread\n // always has a row recording what happened.\n const contentToPersist = collected.aborted\n ? withInterruptMarker(collected.assistantContent)\n : collected.assistantContent;\n persistAssistantMessage(thread_id, contentToPersist, collected.usedTools, collected.toolEvents, null, collected.usage ?? null, prepared.context_snapshot ?? null, prepared.source_manifest ?? null);\n } catch (persistErr) {\n terminal = \"error\";\n broadcast(active, {\n type: \"error\",\n data: { message: `persist failed: ${(persistErr as Error).message}`, code: \"persist_error\" },\n });\n }\n } catch (err) {\n terminal = \"error\";\n broadcast(active, {\n type: \"error\",\n data: { message: (err as Error).message ?? String(err), code: \"run_crashed\" },\n });\n } finally {\n finishRun(active, terminal);\n publishNotification({\n type: \"run_completed\",\n thread_id,\n agent_id: thread?.agent_id ?? null,\n status: terminal,\n preview: assistantContent.replace(/\\s+/g, \" \").trim().slice(0, 120),\n ts: Date.now(),\n });\n }\n }));\n } catch (err) {\n if (err instanceof QueueFullError) {\n return new Response(\n JSON.stringify({ accepted: false, code: \"queue_full\", thread_id, error: err.message }),\n { status: 503, headers: { \"Content-Type\": \"application/json\" } },\n );\n }\n throw err;\n }\n\n return new Response(\n JSON.stringify({ accepted: true, thread_id, queue_position: position }),\n { status: 202, headers: { \"Content-Type\": \"application/json\" } },\n );\n}\n\n// GET is the *query* half of the run lifecycle (ADR-0008). Attaches to an\n// active (or recently-finished, within the registry TTL) run and streams\n// chunks as Server-Sent Events. Always consumed client-side via\n// `EventSource` — never `fetch().body.getReader()`, which is unreliable on\n// iOS Safari for long-lived streaming responses.\n//\n// Emits a single synthetic `done` event and closes when there's no run to\n// attach to (run never existed, or it finished + TTL-evicted before the GET\n// arrived). We deliberately do NOT return 404 here: browsers map a 404 SSE\n// response onto `EventSource.onerror` with no terminal event, which trips\n// EventSource's auto-reconnect logic and leaves the client in a \"stream\n// open but silent\" state — UIs gating on a `done` event hang forever\n// showing the Stop/Reconnecting affordances. A 200 with `data: {\"type\":\n// \"done\"}\\n\\n` makes the iterator drain cleanly on every transport.\n//\n// `show_tools` / `show_thinking` query params let the caller suppress\n// chunk types it doesn't want to render. Defaults: both on. The full\n// `StreamOptions` shape is only meaningful on the POST (tool policy &\n// agent run config are run-wide settings, not per-subscriber filters).\nexport async function GET(req: NextRequest, { params }: Params) {\n const { thread_id } = await params;\n const showTools = req.nextUrl.searchParams.get(\"show_tools\") !== \"false\";\n const showThinking = req.nextUrl.searchParams.get(\"show_thinking\") !== \"false\";\n const stream_options: StreamOptions = {\n filters: { include_tools: showTools, include_thinking: showThinking },\n };\n\n const run = getRun(thread_id);\n if (!run) {\n const stream = new ReadableStream({\n start(controller) {\n controller.enqueue(sse({ type: \"done\" }));\n controller.close();\n },\n });\n return sseResponse(stream);\n }\n\n return attachStream(thread_id, stream_options);\n}\n\n// DELETE aborts the currently-running agent for this thread. The agent stream\n// loop in llm.ts catches the resulting AbortError and emits a synthetic\n// `error` + `done` event pair so subscribers (and the client's queue-drain\n// hook) finish cleanly.\nexport async function DELETE(_req: NextRequest, { params }: Params) {\n const { thread_id } = await params;\n const aborted = abortRun(thread_id, \"user_interrupted\");\n return new Response(JSON.stringify({ aborted }), {\n status: aborted ? 200 : 404,\n headers: { \"Content-Type\": \"application/json\" },\n });\n}\n\nfunction attachStream(\n thread_id: string,\n stream_options?: StreamOptions,\n): Response {\n const stream = new ReadableStream({\n start(controller) {\n let clientGone = false;\n const safeEnqueue = (chunk: Uint8Array): void => {\n if (clientGone) return;\n try { controller.enqueue(chunk); } catch { clientGone = true; }\n };\n\n const onEvent = (ev: StreamChunk) => {\n if (!shouldEmitChunk(ev.type, stream_options)) return;\n safeEnqueue(sse({ type: ev.type, ...ev.data }));\n };\n\n const { run, unsubscribe } = subscribe(thread_id, onEvent);\n if (!run) {\n controller.close();\n return;\n }\n\n // If run already terminal, close after replay.\n if (run.status !== \"running\") {\n try { controller.close(); } catch { /* */ }\n return;\n }\n\n // When the run finishes (status changes), close our response. We\n // poll lightly because the run might finish due to other subscribers'\n // signals; simpler than wiring a second listener channel.\n const poll = setInterval(() => {\n const r = getRun(thread_id);\n if (!r || r.status !== \"running\") {\n clearInterval(poll);\n unsubscribe();\n if (!clientGone) {\n try { controller.close(); } catch { /* */ }\n }\n }\n }, 500);\n poll.unref?.();\n },\n cancel() {\n // Client navigated away — agent run keeps going in registry.\n },\n });\n\n return sseResponse(stream);\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/threads/[thread_id]/run/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/threads/[thread_id]/run/route\",\n pathname: \"/api/v1/threads/[thread_id]/run\",\n filename: \"route\",\n bundlePath: \"app/api/v1/threads/[thread_id]/run/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/threads/[thread_id]/run/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/threads/[thread_id]/run/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/threads/[thread_id]/run/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"],"names":["sseResponse","stream","opts","disableProxyBuffering","headers","Connection","Response","prepareThreadRun","persistAssistantMessage","withInterruptMarker","RunThreadError","snapshotThreadModelConfigName","shouldEmitChunk","broadcast","finishRun","startRun","subscribe","abortRun","getRun","enqueueThreadRun","QueueFullError","collectStream","getThread","publish","publishNotification","resolveTurnProfile","enc","TextEncoder","sse","obj","encode","JSON","stringify","POST","req","params","thread_id","message","attachments","stream_options","hot_since","json","thread","pinnedModelConfigName","position","active","agent_id","prepared","options","signal","abort","context_profile","_pinned_model_config_name","err","message_","String","code","type","data","terminal","assistantContent","collected","onChunk","chunk","errorMessage","aborted","contentToPersist","usedTools","toolEvents","usage","context_snapshot","source_manifest","persistErr","status","preview","replace","trim","slice","ts","Date","now","accepted","error","queue_position","GET","showTools","nextUrl","searchParams","get","showThinking","filters","include_tools","include_thinking","run","ReadableStream","start","controller","enqueue","close","attachStream","DELETE","_req","clientGone","safeEnqueue","onEvent","ev","unsubscribe","poll","setInterval","r","clearInterval","unref","cancel"],"sourceRoot":"","ignoreList":[0,4,6,10,16,24,34,36]}
|
|
1
|
+
{"version":3,"file":"../app/api/v1/threads/[thread_id]/run/route.js","mappings":";;;;;;;;;;AAAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAA;;;;;;;ACAa;AACb,IAAI,KAAmC,EAAE,EAExC,CAAC;AACF,QAAQ,KAAqC,EAAE,EAc1C,CAAC;AACN,YAAY,KAAsC,EAAE,EAM3C,CAAC;AACV,gBAAgB,KAAqB,EAAE,EAE1B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IAAIC,aAAa;wBAAEA;wBAAeA,cAAc;oBAAM;oBACtD,IAAI,CAACC,YAAY;wBACf,IAAI;4BAAER,WAAWE,KAAK;wBAAI,EAAE,OAAM,CAAQ;oBAC5C;gBACF;YACF,GAAG;YACHI,KAAKU,KAAK;QACZ;QACAC;YACE,iEAAiE;YACjE,+DAA+D;YAC/D,6BAA6B;YAC7BT,aAAa;YACb,IAAIF,MAAM;gBAAES,cAAcT;gBAAOA,OAAO;YAAM;YAC9C,IAAIC,aAAa;gBAAEA;gBAAeA,cAAc;YAAM;QACxD;IACF;IAEA,OAAOvG,0BAAWA,CAACC;AACrB;;;ACvS+F;AACvC;AACqB;AACkB;AACvB;AACgB;AACT;AACK;AACmC;AACjD;AACO;AACf;AACsC;AACzB;AACM;AACC;AAChB;AACsC;AACxG;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","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 \"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/./node_modules/next/dist/server/route-modules/app-route/module.compiled.js","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:dns\"","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/external node-commonjs \"node:fs/promises\"","webpack://@circuitwall/jarela/./lib/api/sse.ts","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:worker_threads\"","webpack://@circuitwall/jarela/external node-commonjs \"node:path\"","webpack://@circuitwall/jarela/external node-commonjs \"node:net\"","webpack://@circuitwall/jarela/external node-commonjs \"node:crypto\"","webpack://@circuitwall/jarela/external commonjs2 \"buffer\"","webpack://@circuitwall/jarela/external commonjs2 \"fs/promises\"","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 module \"@langchain/mcp-adapters\"","webpack://@circuitwall/jarela/./node_modules/next/dist/server/send-response.js","webpack://@circuitwall/jarela/external commonjs2 \"events\"","webpack://@circuitwall/jarela/./app/api/v1/threads/[thread_id]/run/route.ts","webpack://@circuitwall/jarela/?07f6"],"sourcesContent":["module.exports = require(\"next/dist/shared/lib/router/utils/app-paths\");","module.exports = require(\"node:process\");","module.exports = require(\"url\");","module.exports = require(\"undici\");","module.exports = require(\"next/dist/compiled/next-server/app-page.runtime.prod.js\");","module.exports = require(\"node:async_hooks\");","\"use strict\";\nif (process.env.NEXT_RUNTIME === 'edge') {\n module.exports = require('next/dist/server/route-modules/app-route/module.js');\n} else {\n if (process.env.__NEXT_EXPERIMENTAL_REACT) {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.dev.js');\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.dev.js');\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.prod.js');\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.prod.js');\n }\n }\n } else {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.dev.js');\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route.runtime.dev.js');\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.prod.js');\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route.runtime.prod.js');\n }\n }\n }\n}\n\n//# sourceMappingURL=module.compiled.js.map","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:dns\");","module.exports = require(\"node:https\");","module.exports = require(\"next/dist/compiled/next-server/app-route.runtime.prod.js\");","module.exports = require(\"node:os\");","module.exports = require(\"node:fs/promises\");","// Shared response builder for Server-Sent Event streams. Centralises the\n// content-type / cache-control / connection / proxy-buffering headers so\n// every SSE endpoint behaves identically through nginx, tailscale-serve,\n// and Cloudflare. See ADR-0009 for the proxy story.\n\nexport interface SseResponseOptions {\n /**\n * Set `X-Accel-Buffering: no`. Required when intermediate proxies\n * (nginx, tailscale-serve) might coalesce small chunks and break SSE\n * framing. Default: true.\n */\n disableProxyBuffering?: boolean;\n}\n\nexport function sseResponse(\n stream: ReadableStream,\n opts: SseResponseOptions = {},\n): Response {\n const { disableProxyBuffering = true } = opts;\n const headers: Record<string, string> = {\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-cache\",\n Connection: \"keep-alive\",\n };\n if (disableProxyBuffering) headers[\"X-Accel-Buffering\"] = \"no\";\n return new Response(stream, { headers });\n}\n","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:worker_threads\");","module.exports = require(\"node:path\");","module.exports = require(\"node:net\");","module.exports = require(\"node:crypto\");","module.exports = require(\"buffer\");","module.exports = require(\"fs/promises\");","module.exports = require(\"node:sqlite\");","module.exports = require(\"http\");","module.exports = require(\"next/dist/shared/lib/no-fallback-error.external\");","module.exports = import(\"@langchain/mcp-adapters\");;","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"sendResponse\", {\n enumerable: true,\n get: function() {\n return sendResponse;\n }\n});\nconst _helpers = require(\"./base-http/helpers\");\nconst _pipereadable = require(\"./pipe-readable\");\nconst _utils = require(\"./web/utils\");\nasync function sendResponse(req, res, response, waitUntil) {\n if (// The type check here ensures that `req` is correctly typed, and the\n // environment variable check provides dead code elimination.\n process.env.NEXT_RUNTIME !== 'edge' && (0, _helpers.isNodeNextResponse)(res)) {\n var // Copy over the response headers.\n _response_headers;\n // Copy over the response status.\n res.statusCode = response.status;\n res.statusMessage = response.statusText;\n // TODO: this is not spec-compliant behavior and we should not restrict\n // headers that are allowed to appear many times.\n //\n // See:\n // https://github.com/vercel/next.js/pull/70127\n const headersWithMultipleValuesAllowed = [\n // can add more headers to this list if needed\n 'set-cookie',\n 'www-authenticate',\n 'proxy-authenticate',\n 'vary'\n ];\n (_response_headers = response.headers) == null ? void 0 : _response_headers.forEach((value, name)=>{\n // `x-middleware-set-cookie` is an internal header not needed for the response\n if (name.toLowerCase() === 'x-middleware-set-cookie') {\n return;\n }\n // The append handling is special cased for `set-cookie`.\n if (name.toLowerCase() === 'set-cookie') {\n // TODO: (wyattjoh) replace with native response iteration when we can upgrade undici\n for (const cookie of (0, _utils.splitCookiesString)(value)){\n res.appendHeader(name, cookie);\n }\n } else {\n // only append the header if it is either not present in the outbound response\n // or if the header supports multiple values\n const isHeaderPresent = typeof res.getHeader(name) !== 'undefined';\n if (headersWithMultipleValuesAllowed.includes(name.toLowerCase()) || !isHeaderPresent) {\n res.appendHeader(name, value);\n }\n }\n });\n /**\n * The response can't be directly piped to the underlying response. The\n * following is duplicated from the edge runtime handler.\n *\n * See packages/next/server/next-server.ts\n */ const { originalResponse } = res;\n // A response body must not be sent for HEAD requests. See https://httpwg.org/specs/rfc9110.html#HEAD\n if (response.body && req.method !== 'HEAD') {\n await (0, _pipereadable.pipeToNodeResponse)(response.body, originalResponse, waitUntil);\n } else {\n originalResponse.end();\n }\n }\n}\n\n//# sourceMappingURL=send-response.js.map","module.exports = require(\"events\");","/**\n * @public — `POST /api/v1/threads/[thread_id]/run` (submit run),\n * `GET /api/v1/threads/[thread_id]/run` (subscribe via SSE)\n *\n * Agent execution endpoint. Submit a run, then stream tokens, tool\n * calls, and final state. The split-and-subscribe shape lets reconnects\n * pick up an in-flight stream. See `docs/api.md`.\n */\n\nimport { NextRequest } from \"next/server\";\nimport type { StreamOptions, StreamChunk } from \"@/lib/agents/base\";\nimport type { ContentPart } from \"@/lib/tools/types\";\nimport {\n prepareThreadRun,\n persistAssistantMessage,\n withInterruptMarker,\n RunThreadError,\n snapshotThreadModelConfigName,\n shouldEmitChunk,\n} from \"@/lib/agents/run-thread\";\nimport { broadcast, finishRun, startRun, subscribe, abortRun, getRun } from \"@/lib/agents/run-registry\";\nimport { enqueueThreadRun, QueueFullError } from \"@/lib/agents/run-queue\";\nimport { collectStream } from \"@/lib/agents/stream-collector\";\nimport { getThread } from \"@/lib/stores/threads\";\nimport { publish as publishNotification } from \"@/lib/notifications/bus\";\nimport { sseResponse } from \"@/lib/api/sse\";\nimport { resolveTurnProfile } from \"@/lib/agents/turn-profile\";\n\ntype Params = { params: Promise<{ thread_id: string }> };\n\nconst enc = new TextEncoder();\nconst sse = (obj: Record<string, unknown>) => enc.encode(`data: ${JSON.stringify(obj)}\\n\\n`);\n\n// POST is the *command* half of the run lifecycle (ADR-0008). It accepts the\n// new user message, registers a run in the in-memory registry, kicks the\n// agent loop off in a detached async task, and returns 202 immediately. The\n// caller must follow up with a GET on this same path (as an `EventSource`)\n// to subscribe to the chunk stream — see GET below.\n//\n// Splitting submit from subscribe gives us a single reliable streaming\n// primitive across all browsers (EventSource is the only WebKit-native\n// streaming API that survives iOS Safari + Tailscale HTTP/2 proxies). It\n// also collapses what was previously a WS sidecar + SSE-over-POST +\n// SSE-GET-reattach trio into one transport.\nexport async function POST(req: NextRequest, { params }: Params) {\n const { thread_id } = await params;\n const { message, attachments, stream_options, hot_since } = (await req.json()) as {\n message: string;\n attachments?: ContentPart[];\n stream_options?: StreamOptions;\n // ADR-0042 — explicit context boundary the chat picked. ISO timestamp,\n // null to clear the pin, omitted to leave whatever's already persisted\n // on the thread.\n hot_since?: string | null;\n };\n\n // Per-thread FIFO queue (lib/agents/run-queue.ts). Every entry point\n // that drives an agent on a thread goes through this — HTTP POST,\n // scheduler, watcher, trigger, bridge — so concurrent fires on the same\n // thread_id serialise instead of racing the LangGraph checkpoint store.\n // If the queue is already at the soft cap, reject with 503 so the\n // caller can back off rather than pin yet more work in memory.\n const thread = getThread(thread_id);\n const pinnedModelConfigName = snapshotThreadModelConfigName(thread_id);\n let position: number;\n try {\n ({ position } = enqueueThreadRun(thread_id, \"user\", async () => {\n // startRun is called once it's our turn so the registry only ever\n // holds one active entry per thread at a time. Subscribers that\n // attach via GET before our turn comes will see no run yet and the\n // SSE handler emits a synthetic done — the client reopens the\n // EventSource and picks up the stream once we're running.\n const active = startRun(thread_id, thread?.agent_id ?? null);\n let prepared;\n try {\n prepared = await prepareThreadRun({\n thread_id,\n message,\n options: stream_options,\n attachments,\n signal: active.abort.signal,\n hot_since,\n context_profile: resolveTurnProfile(\"user\"),\n _pinned_model_config_name: pinnedModelConfigName,\n });\n } catch (err) {\n // Prep failure (unknown agent, model misconfig, …). With queueing\n // the HTTP request has already returned 202, so the error has to\n // surface as an SSE chunk to any attached subscriber. There may\n // be no subscriber if the GET hasn't connected yet — the chunk\n // is buffered on the ActiveRun for the next attach.\n const message_ = err instanceof RunThreadError ? err.message : String(err);\n const code = err instanceof RunThreadError ? err.code : \"run_prepare_error\";\n broadcast(active, { type: \"error\", data: { message: message_, code } });\n finishRun(active, \"error\");\n return;\n }\n\n // Drive the agent to completion regardless of client connection. Events\n // go to the registry; the GET subscriber (and any reattaching clients)\n // receive them via subscribe().\n //\n // CRITICAL: finishRun() MUST run no matter what — if it doesn't, the\n // run is pinned as \"running\" forever and the TTL eviction (scheduled\n // inside finishRun()) never fires, so a leaked entry never self-heals.\n // Wrap the whole body in try/finally.\n let terminal: \"done\" | \"error\" = \"error\";\n let assistantContent = \"\";\n try {\n const collected = await collectStream(prepared.stream as AsyncIterable<StreamChunk>, {\n onChunk: (chunk) => broadcast(active, chunk),\n });\n assistantContent = collected.assistantContent;\n terminal = collected.terminal;\n // If the stream threw mid-iteration, collectStream returns terminal=\"error\"\n // but no `error` chunk was broadcast — surface one to subscribers. Skip\n // when the run was deliberately aborted: llm.ts already emitted an\n // `error{code:\"aborted\"}` chunk for that path and re-broadcasting as\n // `stream_error` would mask the intent.\n if (collected.terminal === \"error\" && collected.errorMessage && !collected.aborted) {\n broadcast(active, {\n type: \"error\",\n data: { message: collected.errorMessage, code: \"stream_error\" },\n });\n }\n try {\n // On a user abort (Stop / steer), append the interrupt footer so\n // the partial reply is never silently dropped and the next agent\n // turn sees a clear marker explaining the cut. withInterruptMarker\n // returns the bare marker when the partial is empty, which forces\n // persistAssistantMessage past its skip-empty guard so the thread\n // always has a row recording what happened.\n const contentToPersist = collected.aborted\n ? withInterruptMarker(collected.assistantContent)\n : collected.assistantContent;\n persistAssistantMessage(thread_id, contentToPersist, collected.usedTools, collected.toolEvents, null, collected.usage ?? null, prepared.context_snapshot ?? null, prepared.source_manifest ?? null);\n } catch (persistErr) {\n terminal = \"error\";\n broadcast(active, {\n type: \"error\",\n data: { message: `persist failed: ${(persistErr as Error).message}`, code: \"persist_error\" },\n });\n }\n } catch (err) {\n terminal = \"error\";\n broadcast(active, {\n type: \"error\",\n data: { message: (err as Error).message ?? String(err), code: \"run_crashed\" },\n });\n } finally {\n finishRun(active, terminal);\n publishNotification({\n type: \"run_completed\",\n thread_id,\n agent_id: thread?.agent_id ?? null,\n status: terminal,\n preview: assistantContent.replace(/\\s+/g, \" \").trim().slice(0, 120),\n ts: Date.now(),\n });\n }\n }));\n } catch (err) {\n if (err instanceof QueueFullError) {\n return new Response(\n JSON.stringify({ accepted: false, code: \"queue_full\", thread_id, error: err.message }),\n { status: 503, headers: { \"Content-Type\": \"application/json\" } },\n );\n }\n throw err;\n }\n\n return new Response(\n JSON.stringify({ accepted: true, thread_id, queue_position: position }),\n { status: 202, headers: { \"Content-Type\": \"application/json\" } },\n );\n}\n\n// GET is the *query* half of the run lifecycle (ADR-0008). Attaches to an\n// active (or recently-finished, within the registry TTL) run and streams\n// chunks as Server-Sent Events. Always consumed client-side via\n// `EventSource` — never `fetch().body.getReader()`, which is unreliable on\n// iOS Safari for long-lived streaming responses.\n//\n// Emits a single synthetic `done` event and closes when there's no run to\n// attach to (run never existed, or it finished + TTL-evicted before the GET\n// arrived). We deliberately do NOT return 404 here: browsers map a 404 SSE\n// response onto `EventSource.onerror` with no terminal event, which trips\n// EventSource's auto-reconnect logic and leaves the client in a \"stream\n// open but silent\" state — UIs gating on a `done` event hang forever\n// showing the Stop/Reconnecting affordances. A 200 with `data: {\"type\":\n// \"done\"}\\n\\n` makes the iterator drain cleanly on every transport.\n//\n// `show_tools` / `show_thinking` query params let the caller suppress\n// chunk types it doesn't want to render. Defaults: both on. The full\n// `StreamOptions` shape is only meaningful on the POST (tool policy &\n// agent run config are run-wide settings, not per-subscriber filters).\nexport async function GET(req: NextRequest, { params }: Params) {\n const { thread_id } = await params;\n const showTools = req.nextUrl.searchParams.get(\"show_tools\") !== \"false\";\n const showThinking = req.nextUrl.searchParams.get(\"show_thinking\") !== \"false\";\n const stream_options: StreamOptions = {\n filters: { include_tools: showTools, include_thinking: showThinking },\n };\n\n const run = getRun(thread_id);\n if (!run) {\n const stream = new ReadableStream({\n start(controller) {\n controller.enqueue(sse({ type: \"done\" }));\n controller.close();\n },\n });\n return sseResponse(stream);\n }\n\n return attachStream(thread_id, stream_options);\n}\n\n// DELETE aborts the currently-running agent for this thread. The agent stream\n// loop in llm.ts catches the resulting AbortError and emits a synthetic\n// `error` + `done` event pair so subscribers (and the client's queue-drain\n// hook) finish cleanly.\nexport async function DELETE(_req: NextRequest, { params }: Params) {\n const { thread_id } = await params;\n const aborted = abortRun(thread_id, \"user_interrupted\");\n return new Response(JSON.stringify({ aborted }), {\n status: aborted ? 200 : 404,\n headers: { \"Content-Type\": \"application/json\" },\n });\n}\n\nfunction attachStream(\n thread_id: string,\n stream_options?: StreamOptions,\n): Response {\n // Captured by both start() and cancel() so the cancel branch can tear\n // down the poll timer + subscription when the client disconnects.\n // Without this, navigating away from a long-running thread leaks an\n // event subscriber + 2Hz setInterval per visit until the run finishes\n // (or forever if it doesn't).\n let poll: ReturnType<typeof setInterval> | null = null;\n let unsubscribe: (() => void) | null = null;\n let clientGone = false;\n\n const stream = new ReadableStream({\n start(controller) {\n const safeEnqueue = (chunk: Uint8Array): void => {\n if (clientGone) return;\n try { controller.enqueue(chunk); } catch { clientGone = true; }\n };\n\n const onEvent = (ev: StreamChunk) => {\n if (!shouldEmitChunk(ev.type, stream_options)) return;\n safeEnqueue(sse({ type: ev.type, ...ev.data }));\n };\n\n const sub = subscribe(thread_id, onEvent);\n unsubscribe = sub.unsubscribe;\n if (!sub.run) {\n controller.close();\n return;\n }\n\n // If run already terminal, close after replay.\n if (sub.run.status !== \"running\") {\n try { controller.close(); } catch { /* */ }\n return;\n }\n\n // When the run finishes (status changes), close our response. We\n // poll lightly because the run might finish due to other subscribers'\n // signals; simpler than wiring a second listener channel.\n poll = setInterval(() => {\n const r = getRun(thread_id);\n if (!r || r.status !== \"running\") {\n if (poll) { clearInterval(poll); poll = null; }\n if (unsubscribe) { unsubscribe(); unsubscribe = null; }\n if (!clientGone) {\n try { controller.close(); } catch { /* */ }\n }\n }\n }, 500);\n poll.unref?.();\n },\n cancel() {\n // Client navigated away — agent run keeps going in registry, but\n // tear down OUR poll + subscription so we don't leak a timer +\n // subscriber per disconnect.\n clientGone = true;\n if (poll) { clearInterval(poll); poll = null; }\n if (unsubscribe) { unsubscribe(); unsubscribe = null; }\n },\n });\n\n return sseResponse(stream);\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/threads/[thread_id]/run/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/threads/[thread_id]/run/route\",\n pathname: \"/api/v1/threads/[thread_id]/run\",\n filename: \"route\",\n bundlePath: \"app/api/v1/threads/[thread_id]/run/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/threads/[thread_id]/run/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/threads/[thread_id]/run/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/threads/[thread_id]/run/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"],"names":["sseResponse","stream","opts","disableProxyBuffering","headers","Connection","Response","prepareThreadRun","persistAssistantMessage","withInterruptMarker","RunThreadError","snapshotThreadModelConfigName","shouldEmitChunk","broadcast","finishRun","startRun","subscribe","abortRun","getRun","enqueueThreadRun","QueueFullError","collectStream","getThread","publish","publishNotification","resolveTurnProfile","enc","TextEncoder","sse","obj","encode","JSON","stringify","POST","req","params","thread_id","message","attachments","stream_options","hot_since","json","thread","pinnedModelConfigName","position","active","agent_id","prepared","options","signal","abort","context_profile","_pinned_model_config_name","err","message_","String","code","type","data","terminal","assistantContent","collected","onChunk","chunk","errorMessage","aborted","contentToPersist","usedTools","toolEvents","usage","context_snapshot","source_manifest","persistErr","status","preview","replace","trim","slice","ts","Date","now","accepted","error","queue_position","GET","showTools","nextUrl","searchParams","get","showThinking","filters","include_tools","include_thinking","run","ReadableStream","start","controller","enqueue","close","attachStream","DELETE","_req","poll","unsubscribe","clientGone","safeEnqueue","onEvent","ev","sub","setInterval","r","clearInterval","unref","cancel"],"sourceRoot":"","ignoreList":[0,4,6,10,16,24,34,36]}
|
|
@@ -62381,195 +62381,26 @@ function BootScreen({ agents, agentsLoaded, activeAgentId, onPickAgent, suppress
|
|
|
62381
62381
|
});
|
|
62382
62382
|
}
|
|
62383
62383
|
|
|
62384
|
+
// EXTERNAL MODULE: ./components/setup/PinKeypad.tsx
|
|
62385
|
+
var PinKeypad = __webpack_require__(71654);
|
|
62384
62386
|
;// ./components/setup/ScreenLock.tsx
|
|
62385
62387
|
/* __next_internal_client_entry_do_not_use__ ScreenLock auto */
|
|
62386
62388
|
|
|
62387
|
-
|
|
62388
|
-
//
|
|
62389
|
-
//
|
|
62390
|
-
//
|
|
62391
|
-
//
|
|
62392
|
-
//
|
|
62393
|
-
const PIN_LENGTH = 6;
|
|
62389
|
+
// Screen-lock overlay (presence check). Mounted by AppShell when the
|
|
62390
|
+
// idle timer fires or the server returns 423 `screen-locked`. Does
|
|
62391
|
+
// NOT touch the in-memory master key — background work (agents,
|
|
62392
|
+
// scheduler, bridges) keeps running underneath. The /verify-pin
|
|
62393
|
+
// endpoint just confirms the human at the keyboard and clears the
|
|
62394
|
+
// idle flag.
|
|
62394
62395
|
function ScreenLock({ onUnlock }) {
|
|
62395
|
-
|
|
62396
|
-
|
|
62397
|
-
|
|
62398
|
-
const [retryAfterSec, setRetryAfterSec] = (0,react.useState)(0);
|
|
62399
|
-
const submittingRef = (0,react.useRef)(false);
|
|
62400
|
-
const submit = (0,react.useCallback)(async (pin)=>{
|
|
62401
|
-
if (submittingRef.current) return;
|
|
62402
|
-
submittingRef.current = true;
|
|
62403
|
-
setSubmitting(true);
|
|
62404
|
-
setError(null);
|
|
62405
|
-
try {
|
|
62406
|
-
const res = await fetch("/api/v1/security/verify-pin", {
|
|
62407
|
-
method: "POST",
|
|
62408
|
-
headers: {
|
|
62409
|
-
"content-type": "application/json"
|
|
62410
|
-
},
|
|
62411
|
-
body: JSON.stringify({
|
|
62412
|
-
pin
|
|
62413
|
-
})
|
|
62414
|
-
});
|
|
62415
|
-
if (res.ok) {
|
|
62416
|
-
onUnlock();
|
|
62417
|
-
return;
|
|
62418
|
-
}
|
|
62419
|
-
const body = await res.json().catch(()=>({}));
|
|
62420
|
-
if (res.status === 429 && typeof body.retry_after_ms === "number") {
|
|
62421
|
-
setRetryAfterSec(Math.ceil(body.retry_after_ms / 1000));
|
|
62422
|
-
setError("Too many attempts. Try again later.");
|
|
62423
|
-
} else if (res.status === 401) {
|
|
62424
|
-
setError("Wrong PIN. Try again.");
|
|
62425
|
-
} else if (res.status === 400) {
|
|
62426
|
-
setError("Invalid PIN format.");
|
|
62427
|
-
} else {
|
|
62428
|
-
setError(body.error ?? `Error (${res.status})`);
|
|
62429
|
-
}
|
|
62430
|
-
setDigits("");
|
|
62431
|
-
} catch (err) {
|
|
62432
|
-
setError(err instanceof Error ? err.message : String(err));
|
|
62433
|
-
setDigits("");
|
|
62434
|
-
} finally{
|
|
62435
|
-
submittingRef.current = false;
|
|
62436
|
-
setSubmitting(false);
|
|
62437
|
-
}
|
|
62438
|
-
}, [
|
|
62439
|
-
onUnlock
|
|
62440
|
-
]);
|
|
62441
|
-
const append = (0,react.useCallback)((d)=>{
|
|
62442
|
-
if (submitting || retryAfterSec > 0) return;
|
|
62443
|
-
setError(null);
|
|
62444
|
-
setDigits((cur)=>cur.length >= PIN_LENGTH ? cur : cur + d);
|
|
62445
|
-
}, [
|
|
62446
|
-
submitting,
|
|
62447
|
-
retryAfterSec
|
|
62448
|
-
]);
|
|
62449
|
-
process.env.__NEXT_PRIVATE_MINIMIZE_MACRO_FALSE && (0,react.useEffect)(()=>{
|
|
62450
|
-
if (digits.length === PIN_LENGTH && !submittingRef.current) {
|
|
62451
|
-
void submit(digits);
|
|
62452
|
-
}
|
|
62453
|
-
}, [
|
|
62454
|
-
digits,
|
|
62455
|
-
submit
|
|
62456
|
-
]);
|
|
62457
|
-
const backspace = (0,react.useCallback)(()=>{
|
|
62458
|
-
if (submitting) return;
|
|
62459
|
-
setError(null);
|
|
62460
|
-
setDigits((cur)=>cur.slice(0, -1));
|
|
62461
|
-
}, [
|
|
62462
|
-
submitting
|
|
62463
|
-
]);
|
|
62464
|
-
process.env.__NEXT_PRIVATE_MINIMIZE_MACRO_FALSE && (0,react.useEffect)(()=>{
|
|
62465
|
-
function onKey(e) {
|
|
62466
|
-
if (/^[0-9]$/.test(e.key)) {
|
|
62467
|
-
e.preventDefault();
|
|
62468
|
-
append(e.key);
|
|
62469
|
-
} else if (e.key === "Backspace") {
|
|
62470
|
-
e.preventDefault();
|
|
62471
|
-
backspace();
|
|
62472
|
-
}
|
|
62473
|
-
}
|
|
62474
|
-
window.addEventListener("keydown", onKey);
|
|
62475
|
-
return ()=>window.removeEventListener("keydown", onKey);
|
|
62476
|
-
}, [
|
|
62477
|
-
append,
|
|
62478
|
-
backspace
|
|
62479
|
-
]);
|
|
62480
|
-
process.env.__NEXT_PRIVATE_MINIMIZE_MACRO_FALSE && (0,react.useEffect)(()=>{
|
|
62481
|
-
if (retryAfterSec <= 0) return;
|
|
62482
|
-
const t = setInterval(()=>{
|
|
62483
|
-
setRetryAfterSec((s)=>s > 0 ? s - 1 : 0);
|
|
62484
|
-
}, 1000);
|
|
62485
|
-
return ()=>clearInterval(t);
|
|
62486
|
-
}, [
|
|
62487
|
-
retryAfterSec
|
|
62488
|
-
]);
|
|
62489
|
-
return /*#__PURE__*/ (0,react_jsx_runtime.jsxs)("div", {
|
|
62490
|
-
className: "fixed inset-0 z-[1000] flex flex-col items-center justify-center gap-6 bg-surface text-fg",
|
|
62491
|
-
style: {
|
|
62492
|
-
paddingTop: "env(safe-area-inset-top)",
|
|
62493
|
-
paddingBottom: "env(safe-area-inset-bottom)"
|
|
62494
|
-
},
|
|
62495
|
-
children: [
|
|
62496
|
-
/*#__PURE__*/ (0,react_jsx_runtime.jsx)(Logo/* Logo */.g, {
|
|
62497
|
-
className: "h-16 w-auto"
|
|
62498
|
-
}),
|
|
62499
|
-
/*#__PURE__*/ (0,react_jsx_runtime.jsxs)("div", {
|
|
62500
|
-
className: "w-full max-w-xs p-6",
|
|
62501
|
-
children: [
|
|
62502
|
-
/*#__PURE__*/ (0,react_jsx_runtime.jsx)("h1", {
|
|
62503
|
-
className: "mb-1 text-center text-lg font-semibold text-fg",
|
|
62504
|
-
children: "Locked"
|
|
62505
|
-
}),
|
|
62506
|
-
/*#__PURE__*/ (0,react_jsx_runtime.jsx)("p", {
|
|
62507
|
-
className: "mb-6 text-center text-xs text-fg-faint",
|
|
62508
|
-
children: "Enter your 6-digit PIN to resume."
|
|
62509
|
-
}),
|
|
62510
|
-
/*#__PURE__*/ (0,react_jsx_runtime.jsx)("div", {
|
|
62511
|
-
className: "mb-6 flex justify-center gap-3",
|
|
62512
|
-
"aria-label": "PIN entry progress",
|
|
62513
|
-
children: Array.from({
|
|
62514
|
-
length: PIN_LENGTH
|
|
62515
|
-
}).map((_, i)=>/*#__PURE__*/ (0,react_jsx_runtime.jsx)("span", {
|
|
62516
|
-
className: `h-3 w-3 rounded-full transition-colors ${i < digits.length ? error ? "bg-red-500" : "bg-fg" : "bg-surface-3"}`
|
|
62517
|
-
}, i))
|
|
62518
|
-
}),
|
|
62519
|
-
/*#__PURE__*/ (0,react_jsx_runtime.jsxs)("div", {
|
|
62520
|
-
className: "grid grid-cols-3 gap-2",
|
|
62521
|
-
children: [
|
|
62522
|
-
[
|
|
62523
|
-
"1",
|
|
62524
|
-
"2",
|
|
62525
|
-
"3",
|
|
62526
|
-
"4",
|
|
62527
|
-
"5",
|
|
62528
|
-
"6",
|
|
62529
|
-
"7",
|
|
62530
|
-
"8",
|
|
62531
|
-
"9"
|
|
62532
|
-
].map((d)=>/*#__PURE__*/ (0,react_jsx_runtime.jsx)(PinKey, {
|
|
62533
|
-
digit: d,
|
|
62534
|
-
onPress: ()=>append(d),
|
|
62535
|
-
disabled: submitting || retryAfterSec > 0
|
|
62536
|
-
}, d)),
|
|
62537
|
-
/*#__PURE__*/ (0,react_jsx_runtime.jsx)("div", {}),
|
|
62538
|
-
/*#__PURE__*/ (0,react_jsx_runtime.jsx)(PinKey, {
|
|
62539
|
-
digit: "0",
|
|
62540
|
-
onPress: ()=>append("0"),
|
|
62541
|
-
disabled: submitting || retryAfterSec > 0
|
|
62542
|
-
}),
|
|
62543
|
-
/*#__PURE__*/ (0,react_jsx_runtime.jsx)(PinKey, {
|
|
62544
|
-
digit: "←",
|
|
62545
|
-
onPress: backspace,
|
|
62546
|
-
disabled: submitting || digits.length === 0,
|
|
62547
|
-
ariaLabel: "Backspace"
|
|
62548
|
-
})
|
|
62549
|
-
]
|
|
62550
|
-
}),
|
|
62551
|
-
/*#__PURE__*/ (0,react_jsx_runtime.jsx)("p", {
|
|
62552
|
-
className: `mt-4 min-h-[1.5rem] text-center text-xs ${error ? "text-red-400" : "text-fg-faint"}`,
|
|
62553
|
-
role: "status",
|
|
62554
|
-
"aria-live": "polite",
|
|
62555
|
-
children: retryAfterSec > 0 ? `Try again in ${retryAfterSec}s` : error ?? (submitting ? "Verifying…" : "\u00A0")
|
|
62556
|
-
})
|
|
62557
|
-
]
|
|
62558
|
-
})
|
|
62559
|
-
]
|
|
62560
|
-
});
|
|
62561
|
-
}
|
|
62562
|
-
function PinKey({ digit, onPress, disabled, ariaLabel }) {
|
|
62563
|
-
return /*#__PURE__*/ (0,react_jsx_runtime.jsx)("button", {
|
|
62564
|
-
type: "button",
|
|
62565
|
-
onClick: onPress,
|
|
62566
|
-
disabled: disabled,
|
|
62567
|
-
"aria-label": ariaLabel ?? digit,
|
|
62568
|
-
className: "h-14 rounded-xl bg-surface-3 text-xl font-medium text-fg transition-colors hover:bg-surface-3/70 active:bg-surface-3/50 disabled:cursor-not-allowed disabled:opacity-50",
|
|
62569
|
-
children: digit
|
|
62396
|
+
return /*#__PURE__*/ (0,react_jsx_runtime.jsx)(PinKeypad/* PinKeypad */.y, {
|
|
62397
|
+
mode: "unlock",
|
|
62398
|
+
onSuccess: onUnlock
|
|
62570
62399
|
});
|
|
62571
62400
|
}
|
|
62572
62401
|
|
|
62402
|
+
// EXTERNAL MODULE: ./components/setup/UnlockScreen.tsx
|
|
62403
|
+
var UnlockScreen = __webpack_require__(26751);
|
|
62573
62404
|
// EXTERNAL MODULE: ./node_modules/lucide-react/dist/esm/icons/message-square.mjs
|
|
62574
62405
|
var message_square = __webpack_require__(61022);
|
|
62575
62406
|
;// ./node_modules/lucide-react/dist/esm/icons/chart-column.mjs
|
|
@@ -65359,6 +65190,7 @@ function InteractiveCostChart({ series, currencyInfo, selectedDay, onSelectDay }
|
|
|
65359
65190
|
|
|
65360
65191
|
|
|
65361
65192
|
|
|
65193
|
+
|
|
65362
65194
|
|
|
65363
65195
|
|
|
65364
65196
|
const AppShell_ADVANCED_TABS = new Set([
|
|
@@ -65529,24 +65361,30 @@ function AppShell() {
|
|
|
65529
65361
|
showAgentPicker
|
|
65530
65362
|
]);
|
|
65531
65363
|
const activeAgent = state.activeAgentId ? agents.find((a)=>a.id === state.activeAgentId) ?? null : null;
|
|
65532
|
-
// Screen-lock overlay
|
|
65533
|
-
// (
|
|
65534
|
-
//
|
|
65535
|
-
//
|
|
65536
|
-
//
|
|
65537
|
-
//
|
|
65364
|
+
// Screen-lock overlay (presence check) AND master-key-locked overlay
|
|
65365
|
+
// (decrypt). Distinct from the boot-time gate in `app/page.tsx`:
|
|
65366
|
+
// those mounts are triggered mid-session — either by an idle timer
|
|
65367
|
+
// (screen-lock) or by the master key being re-locked by an external
|
|
65368
|
+
// process (decrypt). Both are signalled by the API client when it
|
|
65369
|
+
// sees the matching 423 response.
|
|
65538
65370
|
const [screenLocked, setScreenLocked] = (0,react.useState)(false);
|
|
65371
|
+
const [masterKeyLocked, setMasterKeyLocked] = (0,react.useState)(false);
|
|
65539
65372
|
// Bumped after each unlock so BootScreen remounts with fresh state
|
|
65540
65373
|
// (its `done` / `pickedId` / `prefetchStartedRef` would otherwise
|
|
65541
|
-
// suppress the picker on the second appearance).
|
|
65374
|
+
// suppress the picker on the second appearance). Both unlock paths
|
|
65375
|
+
// bump this — the agent selector is always the post-unlock landing.
|
|
65542
65376
|
const [bootSeq, setBootSeq] = (0,react.useState)(0);
|
|
65543
65377
|
process.env.__NEXT_PRIVATE_MINIMIZE_MACRO_FALSE && (0,react.useEffect)(()=>{
|
|
65544
65378
|
let cancelled = false;
|
|
65545
65379
|
let timer = null;
|
|
65546
|
-
function
|
|
65380
|
+
function onScreenLocked() {
|
|
65547
65381
|
if (!cancelled) setScreenLocked(true);
|
|
65548
65382
|
}
|
|
65549
|
-
|
|
65383
|
+
function onMasterKeyLocked() {
|
|
65384
|
+
if (!cancelled) setMasterKeyLocked(true);
|
|
65385
|
+
}
|
|
65386
|
+
window.addEventListener("jarela:screen-locked", onScreenLocked);
|
|
65387
|
+
window.addEventListener("jarela:master-key-locked", onMasterKeyLocked);
|
|
65550
65388
|
// Soft poll every 30s so the overlay still appears if no user
|
|
65551
65389
|
// action triggered a request after the idle timer elapsed.
|
|
65552
65390
|
async function probe() {
|
|
@@ -65554,11 +65392,13 @@ function AppShell() {
|
|
|
65554
65392
|
const res = await fetch("/api/v1/security/state");
|
|
65555
65393
|
if (!res.ok) return;
|
|
65556
65394
|
const body = await res.json();
|
|
65557
|
-
if (
|
|
65558
|
-
|
|
65559
|
-
|
|
65560
|
-
} catch
|
|
65561
|
-
|
|
65395
|
+
if (cancelled) return;
|
|
65396
|
+
if (body.state === "locked") setMasterKeyLocked(true);
|
|
65397
|
+
if (body.screen_locked === true) setScreenLocked(true);
|
|
65398
|
+
} catch (err) {
|
|
65399
|
+
// Network blip; try again next tick. Logged at debug-level so
|
|
65400
|
+
// a sustained outage is at least findable in devtools.
|
|
65401
|
+
if (false) {}
|
|
65562
65402
|
}
|
|
65563
65403
|
}
|
|
65564
65404
|
void probe();
|
|
@@ -65566,9 +65406,22 @@ function AppShell() {
|
|
|
65566
65406
|
return ()=>{
|
|
65567
65407
|
cancelled = true;
|
|
65568
65408
|
if (timer) clearInterval(timer);
|
|
65569
|
-
window.removeEventListener("jarela:screen-locked",
|
|
65409
|
+
window.removeEventListener("jarela:screen-locked", onScreenLocked);
|
|
65410
|
+
window.removeEventListener("jarela:master-key-locked", onMasterKeyLocked);
|
|
65570
65411
|
};
|
|
65571
65412
|
}, []);
|
|
65413
|
+
// Shared post-unlock landing: clear the current chat and force the
|
|
65414
|
+
// BootScreen to remount so the user lands on the agent picker. Used
|
|
65415
|
+
// by BOTH the screen-unlock and the master-key decrypt paths so the
|
|
65416
|
+
// two transitions feel identical from the user's side.
|
|
65417
|
+
const landOnAgentPicker = (0,react.useCallback)(()=>{
|
|
65418
|
+
dispatch({
|
|
65419
|
+
type: "NEW_CHAT"
|
|
65420
|
+
});
|
|
65421
|
+
setBootSeq((n)=>n + 1);
|
|
65422
|
+
}, [
|
|
65423
|
+
dispatch
|
|
65424
|
+
]);
|
|
65572
65425
|
return(// `dvh` natively tracks the visible viewport on iOS 16.4+ / modern
|
|
65573
65426
|
// Chromium, including the on-screen keyboard. The `--actual-vh`
|
|
65574
65427
|
// override (set by the iOS-standalone-PWA shim in layout.tsx) covers
|
|
@@ -65602,13 +65455,21 @@ function AppShell() {
|
|
|
65602
65455
|
onUnlock: ()=>{
|
|
65603
65456
|
// Drop the user back on the picker so they consciously
|
|
65604
65457
|
// re-enter their workspace rather than landing mid-chat.
|
|
65605
|
-
|
|
65606
|
-
type: "NEW_CHAT"
|
|
65607
|
-
});
|
|
65608
|
-
setBootSeq((n)=>n + 1);
|
|
65458
|
+
landOnAgentPicker();
|
|
65609
65459
|
setScreenLocked(false);
|
|
65610
65460
|
}
|
|
65611
65461
|
}),
|
|
65462
|
+
masterKeyLocked && !screenLocked && // Master key got re-locked mid-session (e.g. external lock
|
|
65463
|
+
// command). Mount the decrypt splash — same shared keypad as
|
|
65464
|
+
// boot — and on success drop back to the agent picker. The
|
|
65465
|
+
// existing components below stay mounted underneath; once
|
|
65466
|
+
// unlocked they resume against the now-unlocked DB.
|
|
65467
|
+
/*#__PURE__*/ (0,react_jsx_runtime.jsx)(UnlockScreen.UnlockScreen, {
|
|
65468
|
+
onUnlock: ()=>{
|
|
65469
|
+
landOnAgentPicker();
|
|
65470
|
+
setMasterKeyLocked(false);
|
|
65471
|
+
}
|
|
65472
|
+
}),
|
|
65612
65473
|
/*#__PURE__*/ (0,react_jsx_runtime.jsx)(NotificationStatus, {}),
|
|
65613
65474
|
/*#__PURE__*/ (0,react_jsx_runtime.jsx)(Toaster, {}),
|
|
65614
65475
|
/*#__PURE__*/ (0,react_jsx_runtime.jsx)(ServerStatus, {}),
|
|
@@ -68517,7 +68378,7 @@ function Home() {
|
|
|
68517
68378
|
var __webpack_require__ = require("../webpack-runtime.js");
|
|
68518
68379
|
__webpack_require__.C(exports);
|
|
68519
68380
|
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
|
68520
|
-
var __webpack_exports__ = __webpack_require__.X(0, [4741,1050,2497,319,1918,
|
|
68381
|
+
var __webpack_exports__ = __webpack_require__.X(0, [4741,1050,2497,319,1918,9557,2082,4045,8167], () => (__webpack_exec__(21424)));
|
|
68521
68382
|
module.exports = __webpack_exports__;
|
|
68522
68383
|
|
|
68523
68384
|
})();
|