bunqueue-dashboard 0.0.30 → 0.0.31

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 (67) hide show
  1. package/agent/db.ts +16 -19
  2. package/agent/server.ts +4 -4
  3. package/dist/.vite/manifest.json +194 -146
  4. package/dist/assets/{AddJob-Bsc2w6F0.js → AddJob-CAhdg38n.js} +1 -1
  5. package/dist/assets/{Alerts-GhRfE6uG.js → Alerts-70bxf-PT.js} +1 -1
  6. package/dist/assets/{AreaChart-Dl_9G6GH.js → AreaChart-2gM0YoZT.js} +1 -1
  7. package/dist/assets/{Benchmark-Bc_ZEM87.js → Benchmark-CFZ3WCvj.js} +1 -1
  8. package/dist/assets/{BulkAddJobs-B9q81JAq.js → BulkAddJobs-BzgzpGg_.js} +1 -1
  9. package/dist/assets/CopilotPanel-DZUGIf1q.js +44 -0
  10. package/dist/assets/{Cron-BqKxXt_G.js → Cron-ltjSoTjj.js} +1 -1
  11. package/dist/assets/{CronManager-DuWur13m.js → CronManager-BcFALDeT.js} +1 -1
  12. package/dist/assets/{Database-DSpCA3w7.js → Database-CV2yt5O2.js} +2 -2
  13. package/dist/assets/{Diagnostics-DsBFg_-t.js → Diagnostics-D-EK4GEi.js} +1 -1
  14. package/dist/assets/Dlq-fZAKwQoC.js +1 -0
  15. package/dist/assets/{DlqControl-B0VILOwI.js → DlqControl-eTrrQCrn.js} +1 -1
  16. package/dist/assets/{DlqPro-D8POex8v.js → DlqPro-CF79339e.js} +1 -1
  17. package/dist/assets/{Flows-BEafLVu_.js → Flows-Ba8G7mcC.js} +1 -1
  18. package/dist/assets/{JobInspector-Du4zhHVo.js → JobInspector--d_8ca9p.js} +2 -2
  19. package/dist/assets/Jobs-DEqAc1A5.js +1 -0
  20. package/dist/assets/JobsPro-BcaokZIf.js +1 -0
  21. package/dist/assets/Logs-DBTukPIX.js +1 -0
  22. package/dist/assets/LogsPro-Wl_e6hZM.js +1 -0
  23. package/dist/assets/{McpServer-CI9Z61Lm.js → McpServer-CnWJsKw7.js} +1 -1
  24. package/dist/assets/{Metrics-qsVJt17r.js → Metrics-DzeIhNL-.js} +1 -1
  25. package/dist/assets/{MetricsPro-BMNObO4L.js → MetricsPro-O9eVJSH0.js} +1 -1
  26. package/dist/assets/Overview-Bnu7rWqt.js +1 -0
  27. package/dist/assets/{Pagination-EJ2HGoqv.js → Pagination-D4ki-pGz.js} +1 -1
  28. package/dist/assets/{QueueActions-qd4d3da3.js → QueueActions-DHoSkWRz.js} +1 -1
  29. package/dist/assets/{QueueControl-2NXIrJqi.js → QueueControl-DKqEXnkM.js} +1 -1
  30. package/dist/assets/{QueueDetail-7EEYk51J.js → QueueDetail-DLRow04B.js} +1 -1
  31. package/dist/assets/{QueueDetailPro-DDB6mrh6.js → QueueDetailPro-BYmOVd4T.js} +1 -1
  32. package/dist/assets/Queues-CoyjRFN7.js +1 -0
  33. package/dist/assets/{QueuesOverview-CzbHoeuS.js → QueuesOverview-BeWdJpKi.js} +1 -1
  34. package/dist/assets/{S3Backup-ETwjL2TD.js → S3Backup-BaLFgl9d.js} +1 -1
  35. package/dist/assets/{S3BackupPro-DwX9b_1u.js → S3BackupPro-DJB4oWgz.js} +1 -1
  36. package/dist/assets/{ServerControl-BOh2ncLo.js → ServerControl-_0lVB33E.js} +1 -1
  37. package/dist/assets/{Settings-_aPq2yDv.js → Settings-zKFJTtnq.js} +1 -1
  38. package/dist/assets/Usage-CKGkvl0j.js +1 -0
  39. package/dist/assets/{UsagePro-Dv0izJVc.js → UsagePro-B-TJ6fp4.js} +1 -1
  40. package/dist/assets/{Webhooks-Cs-DqyhB.js → Webhooks-C3zmvY-_.js} +1 -1
  41. package/dist/assets/{Workers-CXwdSXup.js → Workers-jKhhXl3W.js} +1 -1
  42. package/dist/assets/{WorkersPro-BBnrgBbn.js → WorkersPro-mvY5VX8I.js} +1 -1
  43. package/dist/assets/{connectionStore-B-hNUqwK.js → connectionStore-Ci04lJmR.js} +1 -1
  44. package/dist/assets/dist-1f1fMHVO.js +11 -0
  45. package/dist/assets/dist-BlWBaCN6.js +11 -0
  46. package/dist/assets/dist-DZL8soAh.js +79 -0
  47. package/dist/assets/dist-DjvZiKhB.js +2 -0
  48. package/dist/assets/dist-DpZcbP9W.js +11 -0
  49. package/dist/assets/{form-C-zZyKfB.js → form-DGinTEEb.js} +1 -1
  50. package/dist/assets/{index-BFRKPhvf.js → index-BOcegTHa.js} +3 -3
  51. package/dist/assets/index-DWV3tgrk.css +1 -0
  52. package/dist/assets/{react-vendor-B68RYDeC.js → react-vendor-BcouBxpZ.js} +2 -2
  53. package/dist/assets/{useThroughputSeries-BzUriOcf.js → useThroughputSeries-Chp5OLx3.js} +1 -1
  54. package/dist/index.html +4 -4
  55. package/package.json +5 -5
  56. package/scripts/embedded.gen.ts +122 -112
  57. package/scripts/serve.ts +11 -0
  58. package/dist/assets/CopilotPanel-DL61f5jW.js +0 -152
  59. package/dist/assets/Dlq-BAQfqBgy.js +0 -1
  60. package/dist/assets/Jobs-9VzulNrm.js +0 -1
  61. package/dist/assets/JobsPro-YebB40C-.js +0 -1
  62. package/dist/assets/Logs-DtV3k05m.js +0 -1
  63. package/dist/assets/LogsPro-C9VmsZL-.js +0 -1
  64. package/dist/assets/Overview-DtVeV_uf.js +0 -1
  65. package/dist/assets/Queues-ClEE2_8g.js +0 -1
  66. package/dist/assets/Usage-B6ESpkgj.js +0 -1
  67. package/dist/assets/index-mF63w920.css +0 -1
package/agent/db.ts CHANGED
@@ -436,24 +436,28 @@ function translateError(e: unknown): Error {
436
436
  /**
437
437
  * Time-boxed, off-thread execution of an arbitrary query. Spawns a disposable
438
438
  * readonly Worker and races it against QUERY_TIMEOUT_MS so a runaway scan can't
439
- * freeze the agent's control endpoints. Falls back to a synchronous run when a
440
- * Worker cannot be created (e.g. a compiled single-file binary) — still bounded
441
- * in memory and statement type, just not interruptible.
439
+ * freeze the agent's control endpoints.
442
440
  */
441
+ let queryWorkerUrl = new URL('./dbQueryWorker.ts', import.meta.url).href;
442
+
443
+ /**
444
+ * The standalone executable's bundle root is scripts/serve.ts, so it supplies
445
+ * the embedded worker URL relative to that entrypoint. Source-mode agent runs
446
+ * keep the module-relative default above.
447
+ */
448
+ export function setQueryWorkerUrl(url: string): void {
449
+ queryWorkerUrl = url;
450
+ }
451
+
443
452
  export async function queryWithTimeout(path: string, sql: string): Promise<DbQueryResult> {
444
453
  let worker: Worker;
445
454
  try {
446
- worker = new Worker(new URL('./dbQueryWorker.ts', import.meta.url).href, { type: 'module' });
447
- } catch {
448
- return dbQuery(path, sql); // no Worker available — degrade to synchronous
455
+ worker = new Worker(queryWorkerUrl, { type: 'module' });
456
+ } catch (e) {
457
+ throw new Error(`Query worker unavailable: ${(e as Error).message ?? String(e)}`);
449
458
  }
450
459
  try {
451
460
  return await new Promise<DbQueryResult>((resolve, reject) => {
452
- // The Worker module is not always available at runtime — notably a
453
- // `bun build --compile` single-file binary does not embed it, and there
454
- // `new Worker(...)` does NOT throw synchronously: it resolves and then
455
- // fails asynchronously via the `error` event (ModuleNotFound). Guard both
456
- // paths and degrade to a synchronous run rather than failing the request.
457
461
  let settled = false;
458
462
  const timer = setTimeout(() => {
459
463
  if (settled) return;
@@ -473,15 +477,8 @@ export async function queryWithTimeout(path: string, sql: string): Promise<DbQue
473
477
  if (settled) return;
474
478
  settled = true;
475
479
  clearTimeout(timer);
476
- // Worker infra itself failed to load/run (e.g. not embedded in the
477
- // compiled binary). Fall back to the synchronous path — still readonly,
478
- // allowlisted and row-capped, just not interruptible by the wall clock.
479
480
  ev.preventDefault?.();
480
- try {
481
- resolve(dbQuery(path, sql));
482
- } catch (e) {
483
- reject(translateError(e));
484
- }
481
+ reject(new Error(`Query worker failed: ${ev.message || 'unknown worker error'}`));
485
482
  });
486
483
  worker.postMessage({ path, sql });
487
484
  });
package/agent/server.ts CHANGED
@@ -180,10 +180,10 @@ export function createFetchHandler(mgr: ProcessManager, opts: AgentOptions) {
180
180
  // GETs (including the /db/* inspector, which can expose job payloads) are
181
181
  // protected by the Origin allowlist alone — a drive-by cross-origin page
182
182
  // can't read the response (no ACAO for its origin), which is the real
183
- // threat. Gating reads behind the token would break the dashboard itself:
184
- // the browser client sends no agent token (see bq.ts `agent()`), so the
185
- // whole point of loopback + allowlisted CORS is to make browser reads work
186
- // without one. Non-browser local callers on loopback are trusted for reads.
183
+ // threat. Reads intentionally remain available without a token for local
184
+ // dashboards that don't configure AGENT_TOKEN; when a token is configured,
185
+ // the browser client does send it, but only POST/PUT require it.
186
+ // Non-browser local callers on loopback are trusted for reads.
187
187
  const mutating = method === 'POST' || method === 'PUT';
188
188
  if (mutating && !tokenOk(req, token)) {
189
189
  return json({ ok: false, error: 'Unauthorized' }, 401, origin);