@circuitwall/jarela 1.3.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.
Files changed (102) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  5. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  6. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  14. package/.next/standalone/.next/server/app/_not-found.html +2 -2
  15. package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
  16. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  18. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  19. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  21. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  22. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js +10 -1
  23. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js.map +1 -1
  24. package/.next/standalone/.next/server/app/api/v1/dashboard/currency/route.js +10 -5
  25. package/.next/standalone/.next/server/app/api/v1/dashboard/currency/route.js.map +1 -1
  26. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +37 -3
  27. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js.map +1 -1
  28. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js +9 -1
  29. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js.map +1 -1
  30. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +33 -8
  31. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.map +1 -1
  32. package/.next/standalone/.next/server/app/page.js +73 -204
  33. package/.next/standalone/.next/server/app/page.js.map +1 -1
  34. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  36. package/.next/standalone/.next/server/app/setup/page.js +1 -1
  37. package/.next/standalone/.next/server/app/setup/page.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  39. package/.next/standalone/.next/server/chunks/1718.js +159 -0
  40. package/.next/standalone/.next/server/chunks/1718.js.map +1 -0
  41. package/.next/standalone/.next/server/chunks/2082.js +6 -3
  42. package/.next/standalone/.next/server/chunks/2082.js.map +1 -1
  43. package/.next/standalone/.next/server/chunks/210.js +28 -0
  44. package/.next/standalone/.next/server/chunks/210.js.map +1 -1
  45. package/.next/standalone/.next/server/chunks/423.js +6 -3
  46. package/.next/standalone/.next/server/chunks/423.js.map +1 -1
  47. package/.next/standalone/.next/server/chunks/4631.js +37 -5
  48. package/.next/standalone/.next/server/chunks/4631.js.map +1 -1
  49. package/.next/standalone/.next/server/chunks/8167.js +255 -204
  50. package/.next/standalone/.next/server/chunks/8167.js.map +1 -1
  51. package/.next/standalone/.next/server/chunks/8866.js +38 -5
  52. package/.next/standalone/.next/server/chunks/8866.js.map +1 -1
  53. package/.next/standalone/.next/server/chunks/9032.js +8 -0
  54. package/.next/standalone/.next/server/chunks/9032.js.map +1 -1
  55. package/.next/standalone/.next/server/chunks/{7883.js → 9557.js} +15 -3
  56. package/.next/standalone/.next/server/chunks/9557.js.map +1 -0
  57. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  58. package/.next/standalone/.next/server/middleware.js +6 -3
  59. package/.next/standalone/.next/server/pages/404.html +2 -2
  60. package/.next/standalone/.next/server/pages/500.html +1 -1
  61. package/.next/standalone/.next/server/proxy.js.map +1 -1
  62. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  63. package/.next/standalone/.next/static/chunks/{2351-68d8987bbe17ba2d.js → 2351-1ab119fb3b48f4c9.js} +258 -205
  64. package/.next/standalone/.next/static/chunks/2351-1ab119fb3b48f4c9.js.map +1 -0
  65. package/.next/standalone/.next/static/chunks/{9209-0d46118e502f8bf5.js → 4097-64691f9110cf167c.js} +14 -2
  66. package/.next/standalone/.next/static/chunks/4097-64691f9110cf167c.js.map +1 -0
  67. package/.next/standalone/.next/static/chunks/app/{page-2ab710949b62a638.js → page-145150e0468544e7.js} +74 -205
  68. package/.next/standalone/.next/static/chunks/app/page-145150e0468544e7.js.map +1 -0
  69. package/.next/standalone/.next/static/chunks/app/setup/{page-9a465b5fa755b3c3.js → page-a1463a9ace439ff7.js} +2 -2
  70. package/.next/standalone/.next/static/chunks/app/setup/{page-9a465b5fa755b3c3.js.map → page-a1463a9ace439ff7.js.map} +1 -1
  71. package/.next/standalone/.next/static/chunks/{webpack-ff5627013a5e3842.js → webpack-f4ac5c5f92cfd1c1.js} +13 -1
  72. package/.next/standalone/.next/static/chunks/webpack-f4ac5c5f92cfd1c1.js.map +1 -0
  73. package/.next/standalone/package.json +2 -1
  74. package/CHANGELOG.md +84 -0
  75. package/README.md +51 -26
  76. package/api/client.ts +10 -9
  77. package/app/api/v1/dashboard/currency/route.ts +7 -2
  78. package/app/api/v1/providers/[provider]/probe/route.ts +12 -1
  79. package/app/api/v1/threads/[thread_id]/run/route.ts +22 -8
  80. package/components/chat/InputBar.tsx +10 -1
  81. package/components/layout/AppShell.tsx +53 -17
  82. package/components/setup/PinKeypad.tsx +238 -0
  83. package/components/setup/ScreenLock.tsx +8 -173
  84. package/components/setup/UnlockScreen.tsx +25 -192
  85. package/lib/api/page-capture.test.ts +58 -0
  86. package/lib/api/page-capture.ts +31 -1
  87. package/lib/documents/remote/github.ts +16 -2
  88. package/lib/documents/remote/mail.ts +11 -2
  89. package/lib/lifecycle/shutdown.ts +9 -0
  90. package/lib/providers/github-copilot-auth.ts +2 -0
  91. package/lib/providers/github-copilot.ts +1 -0
  92. package/lib/tools/async-results.ts +11 -0
  93. package/package.json +2 -1
  94. package/scripts/install-to-system.ps1 +2 -2
  95. package/scripts/installed-launcher.ps1 +81 -17
  96. package/.next/standalone/.next/server/chunks/7883.js.map +0 -1
  97. package/.next/standalone/.next/static/chunks/2351-68d8987bbe17ba2d.js.map +0 -1
  98. package/.next/standalone/.next/static/chunks/9209-0d46118e502f8bf5.js.map +0 -1
  99. package/.next/standalone/.next/static/chunks/app/page-2ab710949b62a638.js.map +0 -1
  100. package/.next/standalone/.next/static/chunks/webpack-ff5627013a5e3842.js.map +0 -1
  101. /package/.next/standalone/.next/static/{ZKy7LJ3KXj2TIyKOg_fBH → WQdcnm9NyqpeNc0Z8_woo}/_buildManifest.js +0 -0
  102. /package/.next/standalone/.next/static/{ZKy7LJ3KXj2TIyKOg_fBH → WQdcnm9NyqpeNc0Z8_woo}/_ssgManifest.js +0 -0
@@ -34,6 +34,7 @@ async function bootNode() {
34
34
  // doesn't double-patch.
35
35
  const { installConsolePatch } = await Promise.all(/* import() */[__webpack_require__.e(8067), __webpack_require__.e(6210)]).then(__webpack_require__.bind(__webpack_require__, 16210));
36
36
  installConsolePatch();
37
+ installGlobalErrorHandlers();
37
38
  const { registerShutdownHandlers } = await Promise.all(/* import() */[__webpack_require__.e(8067), __webpack_require__.e(9032)]).then(__webpack_require__.bind(__webpack_require__, 39032));
38
39
  registerShutdownHandlers();
39
40
  const { initTools } = await Promise.all(/* import() */[__webpack_require__.e(1218), __webpack_require__.e(5743), __webpack_require__.e(127), __webpack_require__.e(3169), __webpack_require__.e(423), __webpack_require__.e(8067), __webpack_require__.e(8866), __webpack_require__.e(2768)]).then(__webpack_require__.bind(__webpack_require__, 68318));
@@ -58,6 +59,33 @@ function warnIfExposedBind() {
58
59
  if (process.env.KUBERNETES_SERVICE_HOST) return;
59
60
  console.warn(`\n` + `[security] Jarela is bound to ${host}, which is NOT loopback.\n` + ` Non-loopback callers are only gated by the Tailscale-User-Login\n` + ` header, which can be forged by anyone on the LAN unless a\n` + ` Tailscale-Serve (or equivalent reverse proxy) is sitting in\n` + ` front of this process and injecting it.\n` + ` Bind to 127.0.0.1 or set JARELA_ALLOW_NONLOOPBACK_BIND=1 to\n` + ` silence this warning.\n`);
60
61
  }
62
+ // Global last-resort handlers for errors that escape every other try/catch.
63
+ // Without these, Node's default behaviour is to print a stack to stderr
64
+ // and (for uncaughtException) exit the process. We instead route them
65
+ // through the patched console so the in-memory log ring and the Logs
66
+ // panel capture them, and we keep the process alive — the launcher
67
+ // supervisor already restarts on hard crashes, but most stray rejections
68
+ // in HTTP handlers or background jobs shouldn't kill the whole server.
69
+ // Idempotent via a Symbol so dev HMR / multiple imports never stack
70
+ // handlers (which would double-log every event).
71
+ const HANDLERS_INSTALLED = Symbol.for("@jarela/global-error-handlers");
72
+ function installGlobalErrorHandlers() {
73
+ const p = process;
74
+ if (p[HANDLERS_INSTALLED]) return;
75
+ process.on("uncaughtException", (err, origin)=>{
76
+ try {
77
+ console.error(`[uncaughtException] origin=${origin}:`, err instanceof Error ? err.stack ?? err.message : String(err));
78
+ } catch {
79
+ /* logging itself failed — nothing safe to do */ }
80
+ });
81
+ process.on("unhandledRejection", (reason)=>{
82
+ try {
83
+ console.error(`[unhandledRejection]:`, reason instanceof Error ? reason.stack ?? reason.message : String(reason));
84
+ } catch {
85
+ /* logging itself failed — nothing saf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,KAAK;IACvD,IAAI;QACF,MAAMC,KAA+BC,mBAAOA,CAAC,KAAS;QACtD,IAAID,GAAGE,UAAU,CAAC,gBAAgB;IACpC,EAAE,OAAM;IACN,kCAAkC,GACpC;IACA,IAAInB,QAAQW,GAAG,CAACS,uBAAuB,EAAE;IACzCC,QAAQC,IAAI,CACV,CAAC,EAAE,CAAC,GACF,CAAC,8BAA8B,EAAEZ,KAAK,0BAA0B,CAAC,GACjE,CAAC,4EAA4E,CAAC,GAC9E,CAAC,sEAAsE,CAAC,GACxE,CAAC,wEAAwE,CAAC,GAC1E,CAAC,oDAAoD,CAAC,GACtD,CAAC,wEAAwE,CAAC,GAC1E,CAAC,kCAAkC,CAAC;AAE1C","sources":["webpack://@circuitwall/jarela/./instrumentation-node.ts"],"sourcesContent":["// Node-only bootstrap split out of `instrumentation.ts` so the edge-runtime\n// build never has to trace its dependency graph (which transitively pulls\n// in node-only modules like `child_process` via the MCP stdio client).\n//\n// `instrumentation.ts` only loads this file when running on the nodejs\n// server in production.\n\nexport async function bootNode(): Promise<void> {\n // ADR-0060 — apply persisted env-overrides FIRST so subsequent module\n // imports see the overridden values from the start. Done before the\n // logging / shutdown / tools imports because each of them caches env\n // reads at module-init time.\n const { applyOverridesToProcessEnv } = await import(\"@/lib/env/overrides\");\n const r = applyOverridesToProcessEnv();\n if (r.applied > 0 || r.skipped > 0) {\n // Use raw stdout — console isn't patched yet and we don't want this\n // line to land in the logs panel (the entries it produces would be\n // pre-patch anyway).\n process.stdout.write(\n `[env-overrides] applied ${r.applied}, skipped ${r.skipped} (already in env)\\n`,\n );\n }\n\n // ADR-0058 — install the console patch second so every subsequent\n // boot-time log line lands in the in-memory ring + the live Logs\n // panel feed. Idempotent (guarded by a global Symbol), so dev HMR\n // doesn't double-patch.\n const { installConsolePatch } = await import(\"@/lib/logging/sink\");\n installConsolePatch();\n\n const { registerShutdownHandlers } = await import(\"@/lib/lifecycle/shutdown\");\n registerShutdownHandlers();\n\n const { initTools } = await import(\"@/lib/tools\");\n initTools();\n\n const triggers = await import(\"@/lib/triggers\");\n await triggers.startAllTriggerHandlers();\n\n const { startScheduler } = await import(\"@/lib/scheduler\");\n startScheduler();\n\n warnIfExposedBind();\n}\n\nfunction warnIfExposedBind(): void {\n const host = (process.env.HOSTNAME || \"\").trim();\n if (!host) return;\n const isLoopback =\n host === \"127.0.0.1\" ||\n host === \"::1\" ||\n host === \"localhost\" ||\n host.startsWith(\"127.\");\n if (isLoopback) return;\n if (process.env.JARELA_ALLOW_NONLOOPBACK_BIND === \"1\") return;\n try {\n const fs: typeof import(\"node:fs\") = require(\"node:fs\");\n if (fs.existsSync(\"/.dockerenv\")) return;\n } catch {\n /* not on a POSIX runtime, ignore */\n }\n if (process.env.KUBERNETES_SERVICE_HOST) return;\n console.warn(\n `\\n` +\n `[security] Jarela is bound to ${host}, which is NOT loopback.\\n` +\n ` Non-loopback callers are only gated by the Tailscale-User-Login\\n` +\n ` header, which can be forged by anyone on the LAN unless a\\n` +\n ` Tailscale-Serve (or equivalent reverse proxy) is sitting in\\n` +\n ` front of this process and injecting it.\\n` +\n ` Bind to 127.0.0.1 or set JARELA_ALLOW_NONLOOPBACK_BIND=1 to\\n` +\n ` silence this warning.\\n`,\n );\n}\n"],"names":["bootNode","applyOverridesToProcessEnv","r","applied","skipped","process","stdout","write","installConsolePatch","registerShutdownHandlers","initTools","triggers","startAllTriggerHandlers","startScheduler","warnIfExposedBind","host","env","HOSTNAME","trim","isLoopback","startsWith","JARELA_ALLOW_NONLOOPBACK_BIND","fs","require","existsSync","KUBERNETES_SERVICE_HOST","console","warn"],"sourceRoot":"","ignoreList":[]}
1
+ {"version":3,"file":"210.js","mappings":";;;;;;;;;;;AAAA,4EAA4E;AAC5E,0EAA0E;AAC1E,uEAAuE;AACvE,EAAE;AACF,uEAAuE;AACvE,wBAAwB;AAEjB,eAAeA;IACpB,sEAAsE;IACtE,oEAAoE;IACpE,qEAAqE;IACrE,6BAA6B;IAC7B,MAAM,EAAEC,0B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C9E,CAAC,sEAAsE,CAAC,GACxE,CAAC,wEAAwE,CAAC,GAC1E,CAAC,oDAAoD,CAAC,GACtD,CAAC,wEAAwE,CAAC,GAC1E,CAAC,kCAAkC,CAAC;AAE1C;AAEA,4EAA4E;AAC5E,wEAAwE;AACxE,sEAAsE;AACtE,qEAAqE;AACrE,mEAAmE;AACnE,yEAAyE;AACzE,uEAAuE;AACvE,oEAAoE;AACpE,iDAAiD;AACjD,MAAMa,qBAAoCC,OAAOC,GAAG,CAAC;AAErD,SAAStB;IACP,MAAMuB,IAAI3B;IACV,IAAI2B,CAAC,CAACH,mBAAmB,EAAE;IAC3BxB,QAAQ4B,EAAE,CAAC,qBAAqB,CAACC,KAAKC;QACpC,IAAI;YACFR,QAAQS,KAAK,CACX,CAAC,2BAA2B,EAAED,OAAO,CAAC,CAAC,EACvCD,eAAeG,QAASH,IAAII,KAAK,IAAIJ,IAAIK,OAAO,GAAIC,OAAON;QAE/D,EAAE,OAAM;QACN,8CAA8C,GAChD;IACF;IACA7B,QAAQ4B,EAAE,CAAC,sBAAsB,CAACQ;QAChC,IAAI;YACFd,QAAQS,KAAK,CACX,CAAC,qBAAqB,CAAC,EACvBK,kBAAkBJ,QAASI,OAAOH,KAAK,IAAIG,OAAOF,OAAO,GAAIC,OAAOC;QAExE,EAAE,OAAM;QACN,8CAA8C,GAChD;IACF;IACAT,CAAC,CAACH,mBAAmB,GAAG;AAC1B","sources":["webpack://@circuitwall/jarela/./instrumentation-node.ts"],"sourcesContent":["// Node-only bootstrap split out of `instrumentation.ts` so the edge-runtime\n// build never has to trace its dependency graph (which transitively pulls\n// in node-only modules like `child_process` via the MCP stdio client).\n//\n// `instrumentation.ts` only loads this file when running on the nodejs\n// server in production.\n\nexport async function bootNode(): Promise<void> {\n // ADR-0060 — apply persisted env-overrides FIRST so subsequent module\n // imports see the overridden values from the start. Done before the\n // logging / shutdown / tools imports because each of them caches env\n // reads at module-init time.\n const { applyOverridesToProcessEnv } = await import(\"@/lib/env/overrides\");\n const r = applyOverridesToProcessEnv();\n if (r.applied > 0 || r.skipped > 0) {\n // Use raw stdout — console isn't patched yet and we don't want this\n // line to land in the logs panel (the entries it produces would be\n // pre-patch anyway).\n process.stdout.write(\n `[env-overrides] applied ${r.applied}, skipped ${r.skipped} (already in env)\\n`,\n );\n }\n\n // ADR-0058 — install the console patch second so every subsequent\n // boot-time log line lands in the in-memory ring + the live Logs\n // panel feed. Idempotent (guarded by a global Symbol), so dev HMR\n // doesn't double-patch.\n const { installConsolePatch } = await import(\"@/lib/logging/sink\");\n installConsolePatch();\n\n installGlobalErrorHandlers();\n\n const { registerShutdownHandlers } = await import(\"@/lib/lifecycle/shutdown\");\n registerShutdownHandlers();\n\n const { initTools } = await import(\"@/lib/tools\");\n initTools();\n\n const triggers = await import(\"@/lib/triggers\");\n await triggers.startAllTriggerHandlers();\n\n const { startScheduler } = await import(\"@/lib/scheduler\");\n startScheduler();\n\n warnIfExposedBind();\n}\n\nfunction warnIfExposedBind(): void {\n const host = (process.env.HOSTNAME || \"\").trim();\n if (!host) return;\n const isLoopback =\n host === \"127.0.0.1\" ||\n host === \"::1\" ||\n host === \"localhost\" ||\n host.startsWith(\"127.\");\n if (isLoopback) return;\n if (process.env.JARELA_ALLOW_NONLOOPBACK_BIND === \"1\") return;\n try {\n const fs: typeof import(\"node:fs\") = require(\"node:fs\");\n if (fs.existsSync(\"/.dockerenv\")) return;\n } catch {\n /* not on a POSIX runtime, ignore */\n }\n if (process.env.KUBERNETES_SERVICE_HOST) return;\n console.warn(\n `\\n` +\n `[security] Jarela is bound to ${host}, which is NOT loopback.\\n` +\n ` Non-loopback callers are only gated by the Tailscale-User-Login\\n` +\n ` header, which can be forged by anyone on the LAN unless a\\n` +\n ` Tailscale-Serve (or equivalent reverse proxy) is sitting in\\n` +\n ` front of this process and injecting it.\\n` +\n ` Bind to 127.0.0.1 or set JARELA_ALLOW_NONLOOPBACK_BIND=1 to\\n` +\n ` silence this warning.\\n`,\n );\n}\n\n// Global last-resort handlers for errors that escape every other try/catch.\n// Without these, Node's default behaviour is to print a stack to stderr\n// and (for uncaughtException) exit the process. We instead route them\n// through the patched console so the in-memory log ring and the Logs\n// panel capture them, and we keep the process alive — the launcher\n// supervisor already restarts on hard crashes, but most stray rejections\n// in HTTP handlers or background jobs shouldn't kill the whole server.\n// Idempotent via a Symbol so dev HMR / multiple imports never stack\n// handlers (which would double-log every event).\nconst HANDLERS_INSTALLED: unique symbol = Symbol.for(\"@jarela/global-error-handlers\");\ntype ProcessWithFlag = NodeJS.Process & { [HANDLERS_INSTALLED]?: true };\nfunction installGlobalErrorHandlers(): void {\n const p = process as ProcessWithFlag;\n if (p[HANDLERS_INSTALLED]) return;\n process.on(\"uncaughtException\", (err, origin) => {\n try {\n console.error(\n `[uncaughtException] origin=${origin}:`,\n err instanceof Error ? (err.stack ?? err.message) : String(err),\n );\n } catch {\n /* logging itself failed — nothing safe to do */\n }\n });\n process.on(\"unhandledRejection\", (reason) => {\n try {\n console.error(\n `[unhandledRejection]:`,\n reason instanceof Error ? (reason.stack ?? reason.message) : String(reason),\n );\n } catch {\n /* logging itself failed — nothing safe to do */\n }\n });\n p[HANDLERS_INSTALLED] = true;\n}\n"],"names":["bootNode","applyOverridesToProcessEnv","r","applied","skipped","process","stdout","write","installConsolePatch","installGlobalErrorHandlers","registerShutdownHandlers","initTools","triggers","startAllTriggerHandlers","startScheduler","warnIfExposedBind","host","env","HOSTNAME","trim","isLoopback","startsWith","JARELA_ALLOW_NONLOOPBACK_BIND","fs","require","existsSync","KUBERNETES_SERVICE_HOST","console","warn","HANDLERS_INSTALLED","Symbol","for","p","on","err","origin","error","Error","stack","message","String","reason"],"sourceRoot":"","ignoreList":[]}
@@ -923,7 +923,8 @@ async function startDeviceFlow() {
923
923
  body: JSON.stringify({
924
924
  client_id: COPILOT_CLIENT_ID,
925
925
  scope: SCOPE
926
- })
926
+ }),
927
+ signal: AbortSignal.timeout(30000)
927
928
  });
928
929
  if (!res.ok) {
929
930
  const body = await res.text().catch(()=>res.statusText);
@@ -947,7 +948,8 @@ async function pollDeviceFlow(device_code) {
947
948
  client_id: COPILOT_CLIENT_ID,
948
949
  device_code,
949
950
  grant_type: "urn:ietf:params:oauth:grant-type:device_code"
950
- })
951
+ }),
952
+ signal: AbortSignal.timeout(30000)
951
953
  });
952
954
  if (!res.ok) {
953
955
  return {
@@ -1064,7 +1066,8 @@ async function getCopilotToken(pat) {
1064
1066
  headers: {
1065
1067
  Authorization: `token ${pat}`,
1066
1068
  "User-Agent": "Jarela/1.0"
1067
- }
1069
+ },
1070
+ signal: AbortSignal.timeout(30000)
1068
1071
  });
1069
1072
  if (!res.ok) {
1070
1073
  const body = await res.text().catch(()=>res.statusText);