bunqueue-dashboard 0.0.39 → 0.0.41

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 (86) hide show
  1. package/README.md +22 -8
  2. package/agent/backup/resultValidation.ts +1 -1
  3. package/agent/index.ts +3 -0
  4. package/agent/manager/config.ts +1 -1
  5. package/agent/manager/process.ts +2 -2
  6. package/agent/manager/storageMode.ts +39 -0
  7. package/agent/manager.ts +5 -1
  8. package/agent/queue/routes.ts +57 -2
  9. package/agent/queue/runtime.ts +62 -1
  10. package/agent/queue/types.ts +31 -0
  11. package/agent/queue/validation.ts +16 -0
  12. package/agent/server/controlRoutes.ts +2 -93
  13. package/agent/server/controlStatus.ts +120 -0
  14. package/agent/workflows.ts +1 -1
  15. package/dist/.vite/manifest.json +233 -216
  16. package/dist/assets/{AddJob-d5KBvmN8.js → AddJob-CFnESFEU.js} +1 -1
  17. package/dist/assets/{Alerts-5I44QTnQ.js → Alerts-CYwfGLSQ.js} +1 -1
  18. package/dist/assets/{Benchmark-S1afsQRd.js → Benchmark-BINaJvak.js} +1 -1
  19. package/dist/assets/{BulkAddJobs-BO8LWUHE.js → BulkAddJobs-vyGFvlO3.js} +1 -1
  20. package/dist/assets/{CopilotPanel-DDkRd35p.js → CopilotPanel-DjHfX9ta.js} +1 -1
  21. package/dist/assets/{Cron-X3Y5uISO.js → Cron-CSoEPVeq.js} +1 -1
  22. package/dist/assets/{CronManager-ugmYEAwY.js → CronManager-s4xjNhGD.js} +1 -1
  23. package/dist/assets/Database-x6iWCu3-.js +3 -0
  24. package/dist/assets/{Diagnostics-D6oqvkOs.js → Diagnostics-DFshXeHl.js} +1 -1
  25. package/dist/assets/{Dlq-D70Lzmsa.js → Dlq-Cayt1PEN.js} +1 -1
  26. package/dist/assets/{DlqControl-nUT5Zzkl.js → DlqControl-BBQc6uu9.js} +1 -1
  27. package/dist/assets/DlqPro-BmrnGQ-3.js +1 -0
  28. package/dist/assets/Fleet-Bdrj9bLI.js +1 -0
  29. package/dist/assets/{Flows-CAG0nDnt.js → Flows-CcNdf_jS.js} +2 -2
  30. package/dist/assets/{JobInspector-CiS5HOSQ.js → JobInspector-BMjVR96H.js} +2 -2
  31. package/dist/assets/{Jobs-CkyRvzOT.js → Jobs-NN0fJ3BQ.js} +1 -1
  32. package/dist/assets/{JobsPro-B4-CSoq3.js → JobsPro-D_l1c80Q.js} +1 -1
  33. package/dist/assets/{Logs-DBTz2PTz.js → Logs-BGeTppXO.js} +1 -1
  34. package/dist/assets/{LogsPro-BCFeegvr.js → LogsPro-D7vvgZmb.js} +1 -1
  35. package/dist/assets/{McpServer-BKlTR1qr.js → McpServer-AsaFGnYZ.js} +2 -2
  36. package/dist/assets/{Metrics-Du__9Lbn.js → Metrics-CvoY4uhX.js} +1 -1
  37. package/dist/assets/{MetricsPro-CqnaO6YX.js → MetricsPro-C01FjqvR.js} +1 -1
  38. package/dist/assets/{Overview-udSSt7ZB.js → Overview-WStfS5ee.js} +1 -1
  39. package/dist/assets/{QueueActions-D7cQrGvJ.js → QueueActions-D51CYOjo.js} +1 -1
  40. package/dist/assets/QueueControl-Ce-O1L4p.js +1 -0
  41. package/dist/assets/{QueueDetail-C-ms6bMe.js → QueueDetail-D5TKm4bv.js} +1 -1
  42. package/dist/assets/{QueueDetailPro-DXEdsZx_.js → QueueDetailPro-CFNQcKho.js} +1 -1
  43. package/dist/assets/{Queues-BUMwTVAf.js → Queues-DlznHsfh.js} +1 -1
  44. package/dist/assets/QueuesOverview-DGtapyV0.js +1 -0
  45. package/dist/assets/{S3Backup-CDICSzxM.js → S3Backup-CxwbLJGK.js} +1 -1
  46. package/dist/assets/{S3BackupPro-CBidbI-s.js → S3BackupPro-8y0J0-3_.js} +3 -3
  47. package/dist/assets/{ServerControl-CPT0LpsC.js → ServerControl-DpE7t-OF.js} +2 -2
  48. package/dist/assets/Settings-Bw5MtDTF.js +1 -0
  49. package/dist/assets/{Usage-B895tSxi.js → Usage-DpShi3FE.js} +1 -1
  50. package/dist/assets/{UsagePro-CASN77iV.js → UsagePro-D4cGbozz.js} +1 -1
  51. package/dist/assets/{Webhooks-CXbZOFFw.js → Webhooks-UYiTg6hn.js} +1 -1
  52. package/dist/assets/{Workers-BceQlUhX.js → Workers-D70B_uAI.js} +1 -1
  53. package/dist/assets/{WorkersPro-Dtml89jB.js → WorkersPro-YycNhm9w.js} +1 -1
  54. package/dist/assets/Workflows-BxlrgGEB.js +1 -0
  55. package/dist/assets/{api-81m1TwB7.js → api-BAGaBh6R.js} +1 -1
  56. package/dist/assets/bq-Qh0VFLKV.js +1 -0
  57. package/dist/assets/connectionStore-BJLihGaC.js +1 -0
  58. package/dist/assets/controlConnectionEpoch-CZsS0wAb.js +1 -0
  59. package/dist/assets/{flowMutationSafety-6cP-l4Pa.js → flowMutationSafety-DSd3JLAV.js} +1 -1
  60. package/dist/assets/index-ByvrmBif.js +8 -0
  61. package/dist/assets/index-CxhXRVH_.css +1 -0
  62. package/dist/assets/{install-BPp8nydm.js → install-C5y2ohOo.js} +2 -2
  63. package/dist/assets/{responses-C9lP49qu.js → responses-DiIfPXXq.js} +1 -1
  64. package/dist/assets/{toastStore-B31o6Z5J.js → toastStore-IZn6OPLZ.js} +1 -1
  65. package/dist/assets/{upstreamPaths-ZeijhPPb.js → upstreamPaths-B_cyinGI.js} +1 -1
  66. package/dist/assets/{useControlActionGuard-DT7uudrj.js → useControlActionGuard-B-bzKZKI.js} +1 -1
  67. package/dist/assets/usePolledData-0CVelkl2.js +1 -0
  68. package/dist/assets/{useServerActionGuard-Db7PPgaI.js → useServerActionGuard-uGePilQQ.js} +1 -1
  69. package/dist/assets/{useThroughputSeries-_J7gWbcI.js → useThroughputSeries-Cagm3qzB.js} +1 -1
  70. package/dist/index.html +8 -8
  71. package/package.json +13 -9
  72. package/scripts/bunVersion.ts +10 -0
  73. package/scripts/embedded.gen.ts +152 -150
  74. package/scripts/serve.ts +3 -0
  75. package/dist/assets/Database-koy8haPX.js +0 -3
  76. package/dist/assets/DlqPro-VMuBKgP-.js +0 -1
  77. package/dist/assets/QueueControl-BF638r_0.js +0 -1
  78. package/dist/assets/QueuesOverview-Du8XLgN0.js +0 -1
  79. package/dist/assets/Settings-CmxfSX_8.js +0 -1
  80. package/dist/assets/Workflows-B8wmQN2X.js +0 -1
  81. package/dist/assets/bq-BOfwNIlJ.js +0 -1
  82. package/dist/assets/connectionStore-CFuNYZ_8.js +0 -1
  83. package/dist/assets/controlConnectionEpoch-DzbuWOhe.js +0 -1
  84. package/dist/assets/index-B-QjN7pA.css +0 -1
  85. package/dist/assets/index-TploGF7u.js +0 -8
  86. package/dist/assets/usePolledData-CNtNtd0a.js +0 -1
@@ -3,165 +3,167 @@
3
3
  import f0 from "../dist/index.html" with { type: 'file' };
4
4
  import f1 from "../dist/favicon.svg" with { type: 'file' };
5
5
  import f2 from "../dist/og.png" with { type: 'file' };
6
- import f3 from "../dist/assets/UsagePro-CASN77iV.js" with { type: 'file' };
7
- import f4 from "../dist/assets/MetricsPro-CqnaO6YX.js" with { type: 'file' };
8
- import f5 from "../dist/assets/QueueDetailPro-DXEdsZx_.js" with { type: 'file' };
9
- import f6 from "../dist/assets/ServerControl-CPT0LpsC.js" with { type: 'file' };
10
- import f7 from "../dist/assets/useServerActionGuard-Db7PPgaI.js" with { type: 'file' };
11
- import f8 from "../dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2" with { type: 'file' };
12
- import f9 from "../dist/assets/icons-BVzwsfbG.js" with { type: 'file' };
13
- import f10 from "../dist/assets/feedback-QDN1AsYt.js" with { type: 'file' };
14
- import f11 from "../dist/assets/JobsPro-B4-CSoq3.js" with { type: 'file' };
15
- import f12 from "../dist/assets/react-vendor-CvwrP0tU.js" with { type: 'file' };
16
- import f13 from "../dist/assets/Jobs-CkyRvzOT.js" with { type: 'file' };
17
- import f14 from "../dist/assets/McpServer-BKlTR1qr.js" with { type: 'file' };
18
- import f15 from "../dist/assets/Alerts-5I44QTnQ.js" with { type: 'file' };
19
- import f16 from "../dist/assets/Database-koy8haPX.js" with { type: 'file' };
20
- import f17 from "../dist/assets/usePolledData-CNtNtd0a.js" with { type: 'file' };
21
- import f18 from "../dist/assets/Diagnostics-D6oqvkOs.js" with { type: 'file' };
22
- import f19 from "../dist/assets/StatusBadge-BoOVTnKu.js" with { type: 'file' };
23
- import f20 from "../dist/assets/Flows-CAG0nDnt.js" with { type: 'file' };
24
- import f21 from "../dist/assets/Button-Ch1W94fJ.js" with { type: 'file' };
25
- import f22 from "../dist/assets/exportFile-C7xhE8Yh.js" with { type: 'file' };
26
- import f23 from "../dist/assets/dist-DjvZiKhB.js" with { type: 'file' };
27
- import f24 from "../dist/assets/toastStore-B31o6Z5J.js" with { type: 'file' };
28
- import f25 from "../dist/assets/useControlActionGuard-DT7uudrj.js" with { type: 'file' };
29
- import f26 from "../dist/assets/controlConnectionEpoch-DzbuWOhe.js" with { type: 'file' };
30
- import f27 from "../dist/assets/Metrics-Du__9Lbn.js" with { type: 'file' };
31
- import f28 from "../dist/assets/AddJob-d5KBvmN8.js" with { type: 'file' };
32
- import f29 from "../dist/assets/form-C4oby9pI.js" with { type: 'file' };
33
- import f30 from "../dist/assets/QueuesOverview-Du8XLgN0.js" with { type: 'file' };
34
- import f31 from "../dist/assets/index-TploGF7u.js" with { type: 'file' };
35
- import f32 from "../dist/assets/QueueControl-BF638r_0.js" with { type: 'file' };
36
- import f33 from "../dist/assets/DlqControl-nUT5Zzkl.js" with { type: 'file' };
37
- import f34 from "../dist/assets/DlqPro-VMuBKgP-.js" with { type: 'file' };
38
- import f35 from "../dist/assets/responses-C9lP49qu.js" with { type: 'file' };
6
+ import f3 from "../dist/assets/usePolledData-0CVelkl2.js" with { type: 'file' };
7
+ import f4 from "../dist/assets/Workflows-BxlrgGEB.js" with { type: 'file' };
8
+ import f5 from "../dist/assets/QueueDetailPro-CFNQcKho.js" with { type: 'file' };
9
+ import f6 from "../dist/assets/Metrics-CvoY4uhX.js" with { type: 'file' };
10
+ import f7 from "../dist/assets/Diagnostics-DFshXeHl.js" with { type: 'file' };
11
+ import f8 from "../dist/assets/WorkersPro-YycNhm9w.js" with { type: 'file' };
12
+ import f9 from "../dist/assets/Logs-BGeTppXO.js" with { type: 'file' };
13
+ import f10 from "../dist/assets/Settings-Bw5MtDTF.js" with { type: 'file' };
14
+ import f11 from "../dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2" with { type: 'file' };
15
+ import f12 from "../dist/assets/icons-BVzwsfbG.js" with { type: 'file' };
16
+ import f13 from "../dist/assets/feedback-QDN1AsYt.js" with { type: 'file' };
17
+ import f14 from "../dist/assets/Alerts-CYwfGLSQ.js" with { type: 'file' };
18
+ import f15 from "../dist/assets/connectionStore-BJLihGaC.js" with { type: 'file' };
19
+ import f16 from "../dist/assets/react-vendor-CvwrP0tU.js" with { type: 'file' };
20
+ import f17 from "../dist/assets/Flows-CcNdf_jS.js" with { type: 'file' };
21
+ import f18 from "../dist/assets/StatusBadge-BoOVTnKu.js" with { type: 'file' };
22
+ import f19 from "../dist/assets/Button-Ch1W94fJ.js" with { type: 'file' };
23
+ import f20 from "../dist/assets/exportFile-C7xhE8Yh.js" with { type: 'file' };
24
+ import f21 from "../dist/assets/Jobs-NN0fJ3BQ.js" with { type: 'file' };
25
+ import f22 from "../dist/assets/QueueControl-Ce-O1L4p.js" with { type: 'file' };
26
+ import f23 from "../dist/assets/index-ByvrmBif.js" with { type: 'file' };
27
+ import f24 from "../dist/assets/dist-DjvZiKhB.js" with { type: 'file' };
28
+ import f25 from "../dist/assets/McpServer-AsaFGnYZ.js" with { type: 'file' };
29
+ import f26 from "../dist/assets/Cron-CSoEPVeq.js" with { type: 'file' };
30
+ import f27 from "../dist/assets/Queues-DlznHsfh.js" with { type: 'file' };
31
+ import f28 from "../dist/assets/UsagePro-D4cGbozz.js" with { type: 'file' };
32
+ import f29 from "../dist/assets/upstreamPaths-B_cyinGI.js" with { type: 'file' };
33
+ import f30 from "../dist/assets/form-C4oby9pI.js" with { type: 'file' };
34
+ import f31 from "../dist/assets/BulkAddJobs-vyGFvlO3.js" with { type: 'file' };
35
+ import f32 from "../dist/assets/responses-DiIfPXXq.js" with { type: 'file' };
36
+ import f33 from "../dist/assets/api-BAGaBh6R.js" with { type: 'file' };
37
+ import f34 from "../dist/assets/Benchmark-BINaJvak.js" with { type: 'file' };
38
+ import f35 from "../dist/assets/controlConnectionEpoch-CZsS0wAb.js" with { type: 'file' };
39
39
  import f36 from "../dist/assets/AreaChart-DEAalJ6P.js" with { type: 'file' };
40
- import f37 from "../dist/assets/Overview-udSSt7ZB.js" with { type: 'file' };
41
- import f38 from "../dist/assets/Pagination-x-Cwgrul.js" with { type: 'file' };
42
- import f39 from "../dist/assets/JobInspector-CiS5HOSQ.js" with { type: 'file' };
43
- import f40 from "../dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2" with { type: 'file' };
44
- import f41 from "../dist/assets/index-B-QjN7pA.css" with { type: 'file' };
40
+ import f37 from "../dist/assets/Pagination-x-Cwgrul.js" with { type: 'file' };
41
+ import f38 from "../dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2" with { type: 'file' };
42
+ import f39 from "../dist/assets/useThroughputSeries-Cagm3qzB.js" with { type: 'file' };
43
+ import f40 from "../dist/assets/S3BackupPro-8y0J0-3_.js" with { type: 'file' };
44
+ import f41 from "../dist/assets/DlqPro-BmrnGQ-3.js" with { type: 'file' };
45
45
  import f42 from "../dist/assets/dist-DpZcbP9W.js" with { type: 'file' };
46
- import f43 from "../dist/assets/upstreamPaths-ZeijhPPb.js" with { type: 'file' };
47
- import f44 from "../dist/assets/QueueDetail-C-ms6bMe.js" with { type: 'file' };
48
- import f45 from "../dist/assets/Benchmark-S1afsQRd.js" with { type: 'file' };
49
- import f46 from "../dist/assets/cn-zFEt5SO8.js" with { type: 'file' };
50
- import f47 from "../dist/assets/PageHeader-CvIyaFOO.js" with { type: 'file' };
51
- import f48 from "../dist/assets/api-81m1TwB7.js" with { type: 'file' };
52
- import f49 from "../dist/assets/S3BackupPro-CBidbI-s.js" with { type: 'file' };
53
- import f50 from "../dist/assets/WorkersPro-Dtml89jB.js" with { type: 'file' };
54
- import f51 from "../dist/assets/S3Backup-CDICSzxM.js" with { type: 'file' };
55
- import f52 from "../dist/assets/Settings-CmxfSX_8.js" with { type: 'file' };
56
- import f53 from "../dist/assets/connectionStore-CFuNYZ_8.js" with { type: 'file' };
57
- import f54 from "../dist/assets/useThroughputSeries-_J7gWbcI.js" with { type: 'file' };
58
- import f55 from "../dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2" with { type: 'file' };
59
- import f56 from "../dist/assets/format-Cg7VCIZW.js" with { type: 'file' };
60
- import f57 from "../dist/assets/QueueActions-D7cQrGvJ.js" with { type: 'file' };
61
- import f58 from "../dist/assets/install-BPp8nydm.js" with { type: 'file' };
62
- import f59 from "../dist/assets/dist-1f1fMHVO.js" with { type: 'file' };
63
- import f60 from "../dist/assets/promisePool-BVfQ9n9Q.js" with { type: 'file' };
64
- import f61 from "../dist/assets/CronManager-ugmYEAwY.js" with { type: 'file' };
65
- import f62 from "../dist/assets/Workflows-B8wmQN2X.js" with { type: 'file' };
66
- import f63 from "../dist/assets/Workers-BceQlUhX.js" with { type: 'file' };
67
- import f64 from "../dist/assets/Queues-BUMwTVAf.js" with { type: 'file' };
68
- import f65 from "../dist/assets/CopilotPanel-DDkRd35p.js" with { type: 'file' };
69
- import f66 from "../dist/assets/bq-BOfwNIlJ.js" with { type: 'file' };
70
- import f67 from "../dist/assets/BulkAddJobs-BO8LWUHE.js" with { type: 'file' };
71
- import f68 from "../dist/assets/Dlq-D70Lzmsa.js" with { type: 'file' };
72
- import f69 from "../dist/assets/LogsPro-BCFeegvr.js" with { type: 'file' };
73
- import f70 from "../dist/assets/Cron-X3Y5uISO.js" with { type: 'file' };
74
- import f71 from "../dist/assets/flowMutationSafety-6cP-l4Pa.js" with { type: 'file' };
75
- import f72 from "../dist/assets/Card-CWxrC8OY.js" with { type: 'file' };
76
- import f73 from "../dist/assets/Webhooks-CXbZOFFw.js" with { type: 'file' };
77
- import f74 from "../dist/assets/Usage-B895tSxi.js" with { type: 'file' };
78
- import f75 from "../dist/assets/dist-BlWBaCN6.js" with { type: 'file' };
46
+ import f43 from "../dist/assets/cn-zFEt5SO8.js" with { type: 'file' };
47
+ import f44 from "../dist/assets/useServerActionGuard-uGePilQQ.js" with { type: 'file' };
48
+ import f45 from "../dist/assets/PageHeader-CvIyaFOO.js" with { type: 'file' };
49
+ import f46 from "../dist/assets/Fleet-Bdrj9bLI.js" with { type: 'file' };
50
+ import f47 from "../dist/assets/MetricsPro-C01FjqvR.js" with { type: 'file' };
51
+ import f48 from "../dist/assets/bq-Qh0VFLKV.js" with { type: 'file' };
52
+ import f49 from "../dist/assets/Overview-WStfS5ee.js" with { type: 'file' };
53
+ import f50 from "../dist/assets/index-CxhXRVH_.css" with { type: 'file' };
54
+ import f51 from "../dist/assets/useControlActionGuard-B-bzKZKI.js" with { type: 'file' };
55
+ import f52 from "../dist/assets/JobsPro-D_l1c80Q.js" with { type: 'file' };
56
+ import f53 from "../dist/assets/Usage-DpShi3FE.js" with { type: 'file' };
57
+ import f54 from "../dist/assets/CronManager-s4xjNhGD.js" with { type: 'file' };
58
+ import f55 from "../dist/assets/install-C5y2ohOo.js" with { type: 'file' };
59
+ import f56 from "../dist/assets/toastStore-IZn6OPLZ.js" with { type: 'file' };
60
+ import f57 from "../dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2" with { type: 'file' };
61
+ import f58 from "../dist/assets/format-Cg7VCIZW.js" with { type: 'file' };
62
+ import f59 from "../dist/assets/Database-x6iWCu3-.js" with { type: 'file' };
63
+ import f60 from "../dist/assets/dist-1f1fMHVO.js" with { type: 'file' };
64
+ import f61 from "../dist/assets/QueuesOverview-DGtapyV0.js" with { type: 'file' };
65
+ import f62 from "../dist/assets/promisePool-BVfQ9n9Q.js" with { type: 'file' };
66
+ import f63 from "../dist/assets/S3Backup-CxwbLJGK.js" with { type: 'file' };
67
+ import f64 from "../dist/assets/DlqControl-BBQc6uu9.js" with { type: 'file' };
68
+ import f65 from "../dist/assets/ServerControl-DpE7t-OF.js" with { type: 'file' };
69
+ import f66 from "../dist/assets/QueueDetail-D5TKm4bv.js" with { type: 'file' };
70
+ import f67 from "../dist/assets/Workers-D70B_uAI.js" with { type: 'file' };
71
+ import f68 from "../dist/assets/Card-CWxrC8OY.js" with { type: 'file' };
72
+ import f69 from "../dist/assets/LogsPro-D7vvgZmb.js" with { type: 'file' };
73
+ import f70 from "../dist/assets/dist-BlWBaCN6.js" with { type: 'file' };
74
+ import f71 from "../dist/assets/AddJob-CFnESFEU.js" with { type: 'file' };
75
+ import f72 from "../dist/assets/Dlq-Cayt1PEN.js" with { type: 'file' };
76
+ import f73 from "../dist/assets/JobInspector-BMjVR96H.js" with { type: 'file' };
77
+ import f74 from "../dist/assets/Webhooks-UYiTg6hn.js" with { type: 'file' };
78
+ import f75 from "../dist/assets/CopilotPanel-DjHfX9ta.js" with { type: 'file' };
79
79
  import f76 from "../dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2" with { type: 'file' };
80
- import f77 from "../dist/assets/jobActions-LQD4KfCc.js" with { type: 'file' };
81
- import f78 from "../dist/assets/dist-DZL8soAh.js" with { type: 'file' };
82
- import f79 from "../dist/assets/Logs-DBTz2PTz.js" with { type: 'file' };
83
- import f80 from "../dist/.vite/manifest.json" with { type: 'file' };
80
+ import f77 from "../dist/assets/QueueActions-D51CYOjo.js" with { type: 'file' };
81
+ import f78 from "../dist/assets/jobActions-LQD4KfCc.js" with { type: 'file' };
82
+ import f79 from "../dist/assets/dist-DZL8soAh.js" with { type: 'file' };
83
+ import f80 from "../dist/assets/flowMutationSafety-DSd3JLAV.js" with { type: 'file' };
84
+ import f81 from "../dist/.vite/manifest.json" with { type: 'file' };
84
85
 
85
86
  export const ASSETS: Record<string, string> = {
86
87
  "/index.html": f0,
87
88
  "/favicon.svg": f1,
88
89
  "/og.png": f2,
89
- "/assets/UsagePro-CASN77iV.js": f3,
90
- "/assets/MetricsPro-CqnaO6YX.js": f4,
91
- "/assets/QueueDetailPro-DXEdsZx_.js": f5,
92
- "/assets/ServerControl-CPT0LpsC.js": f6,
93
- "/assets/useServerActionGuard-Db7PPgaI.js": f7,
94
- "/assets/inter-latin-wght-normal-Dx4kXJAl.woff2": f8,
95
- "/assets/icons-BVzwsfbG.js": f9,
96
- "/assets/feedback-QDN1AsYt.js": f10,
97
- "/assets/JobsPro-B4-CSoq3.js": f11,
98
- "/assets/react-vendor-CvwrP0tU.js": f12,
99
- "/assets/Jobs-CkyRvzOT.js": f13,
100
- "/assets/McpServer-BKlTR1qr.js": f14,
101
- "/assets/Alerts-5I44QTnQ.js": f15,
102
- "/assets/Database-koy8haPX.js": f16,
103
- "/assets/usePolledData-CNtNtd0a.js": f17,
104
- "/assets/Diagnostics-D6oqvkOs.js": f18,
105
- "/assets/StatusBadge-BoOVTnKu.js": f19,
106
- "/assets/Flows-CAG0nDnt.js": f20,
107
- "/assets/Button-Ch1W94fJ.js": f21,
108
- "/assets/exportFile-C7xhE8Yh.js": f22,
109
- "/assets/dist-DjvZiKhB.js": f23,
110
- "/assets/toastStore-B31o6Z5J.js": f24,
111
- "/assets/useControlActionGuard-DT7uudrj.js": f25,
112
- "/assets/controlConnectionEpoch-DzbuWOhe.js": f26,
113
- "/assets/Metrics-Du__9Lbn.js": f27,
114
- "/assets/AddJob-d5KBvmN8.js": f28,
115
- "/assets/form-C4oby9pI.js": f29,
116
- "/assets/QueuesOverview-Du8XLgN0.js": f30,
117
- "/assets/index-TploGF7u.js": f31,
118
- "/assets/QueueControl-BF638r_0.js": f32,
119
- "/assets/DlqControl-nUT5Zzkl.js": f33,
120
- "/assets/DlqPro-VMuBKgP-.js": f34,
121
- "/assets/responses-C9lP49qu.js": f35,
90
+ "/assets/usePolledData-0CVelkl2.js": f3,
91
+ "/assets/Workflows-BxlrgGEB.js": f4,
92
+ "/assets/QueueDetailPro-CFNQcKho.js": f5,
93
+ "/assets/Metrics-CvoY4uhX.js": f6,
94
+ "/assets/Diagnostics-DFshXeHl.js": f7,
95
+ "/assets/WorkersPro-YycNhm9w.js": f8,
96
+ "/assets/Logs-BGeTppXO.js": f9,
97
+ "/assets/Settings-Bw5MtDTF.js": f10,
98
+ "/assets/inter-latin-wght-normal-Dx4kXJAl.woff2": f11,
99
+ "/assets/icons-BVzwsfbG.js": f12,
100
+ "/assets/feedback-QDN1AsYt.js": f13,
101
+ "/assets/Alerts-CYwfGLSQ.js": f14,
102
+ "/assets/connectionStore-BJLihGaC.js": f15,
103
+ "/assets/react-vendor-CvwrP0tU.js": f16,
104
+ "/assets/Flows-CcNdf_jS.js": f17,
105
+ "/assets/StatusBadge-BoOVTnKu.js": f18,
106
+ "/assets/Button-Ch1W94fJ.js": f19,
107
+ "/assets/exportFile-C7xhE8Yh.js": f20,
108
+ "/assets/Jobs-NN0fJ3BQ.js": f21,
109
+ "/assets/QueueControl-Ce-O1L4p.js": f22,
110
+ "/assets/index-ByvrmBif.js": f23,
111
+ "/assets/dist-DjvZiKhB.js": f24,
112
+ "/assets/McpServer-AsaFGnYZ.js": f25,
113
+ "/assets/Cron-CSoEPVeq.js": f26,
114
+ "/assets/Queues-DlznHsfh.js": f27,
115
+ "/assets/UsagePro-D4cGbozz.js": f28,
116
+ "/assets/upstreamPaths-B_cyinGI.js": f29,
117
+ "/assets/form-C4oby9pI.js": f30,
118
+ "/assets/BulkAddJobs-vyGFvlO3.js": f31,
119
+ "/assets/responses-DiIfPXXq.js": f32,
120
+ "/assets/api-BAGaBh6R.js": f33,
121
+ "/assets/Benchmark-BINaJvak.js": f34,
122
+ "/assets/controlConnectionEpoch-CZsS0wAb.js": f35,
122
123
  "/assets/AreaChart-DEAalJ6P.js": f36,
123
- "/assets/Overview-udSSt7ZB.js": f37,
124
- "/assets/Pagination-x-Cwgrul.js": f38,
125
- "/assets/JobInspector-CiS5HOSQ.js": f39,
126
- "/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2": f40,
127
- "/assets/index-B-QjN7pA.css": f41,
124
+ "/assets/Pagination-x-Cwgrul.js": f37,
125
+ "/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2": f38,
126
+ "/assets/useThroughputSeries-Cagm3qzB.js": f39,
127
+ "/assets/S3BackupPro-8y0J0-3_.js": f40,
128
+ "/assets/DlqPro-BmrnGQ-3.js": f41,
128
129
  "/assets/dist-DpZcbP9W.js": f42,
129
- "/assets/upstreamPaths-ZeijhPPb.js": f43,
130
- "/assets/QueueDetail-C-ms6bMe.js": f44,
131
- "/assets/Benchmark-S1afsQRd.js": f45,
132
- "/assets/cn-zFEt5SO8.js": f46,
133
- "/assets/PageHeader-CvIyaFOO.js": f47,
134
- "/assets/api-81m1TwB7.js": f48,
135
- "/assets/S3BackupPro-CBidbI-s.js": f49,
136
- "/assets/WorkersPro-Dtml89jB.js": f50,
137
- "/assets/S3Backup-CDICSzxM.js": f51,
138
- "/assets/Settings-CmxfSX_8.js": f52,
139
- "/assets/connectionStore-CFuNYZ_8.js": f53,
140
- "/assets/useThroughputSeries-_J7gWbcI.js": f54,
141
- "/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2": f55,
142
- "/assets/format-Cg7VCIZW.js": f56,
143
- "/assets/QueueActions-D7cQrGvJ.js": f57,
144
- "/assets/install-BPp8nydm.js": f58,
145
- "/assets/dist-1f1fMHVO.js": f59,
146
- "/assets/promisePool-BVfQ9n9Q.js": f60,
147
- "/assets/CronManager-ugmYEAwY.js": f61,
148
- "/assets/Workflows-B8wmQN2X.js": f62,
149
- "/assets/Workers-BceQlUhX.js": f63,
150
- "/assets/Queues-BUMwTVAf.js": f64,
151
- "/assets/CopilotPanel-DDkRd35p.js": f65,
152
- "/assets/bq-BOfwNIlJ.js": f66,
153
- "/assets/BulkAddJobs-BO8LWUHE.js": f67,
154
- "/assets/Dlq-D70Lzmsa.js": f68,
155
- "/assets/LogsPro-BCFeegvr.js": f69,
156
- "/assets/Cron-X3Y5uISO.js": f70,
157
- "/assets/flowMutationSafety-6cP-l4Pa.js": f71,
158
- "/assets/Card-CWxrC8OY.js": f72,
159
- "/assets/Webhooks-CXbZOFFw.js": f73,
160
- "/assets/Usage-B895tSxi.js": f74,
161
- "/assets/dist-BlWBaCN6.js": f75,
130
+ "/assets/cn-zFEt5SO8.js": f43,
131
+ "/assets/useServerActionGuard-uGePilQQ.js": f44,
132
+ "/assets/PageHeader-CvIyaFOO.js": f45,
133
+ "/assets/Fleet-Bdrj9bLI.js": f46,
134
+ "/assets/MetricsPro-C01FjqvR.js": f47,
135
+ "/assets/bq-Qh0VFLKV.js": f48,
136
+ "/assets/Overview-WStfS5ee.js": f49,
137
+ "/assets/index-CxhXRVH_.css": f50,
138
+ "/assets/useControlActionGuard-B-bzKZKI.js": f51,
139
+ "/assets/JobsPro-D_l1c80Q.js": f52,
140
+ "/assets/Usage-DpShi3FE.js": f53,
141
+ "/assets/CronManager-s4xjNhGD.js": f54,
142
+ "/assets/install-C5y2ohOo.js": f55,
143
+ "/assets/toastStore-IZn6OPLZ.js": f56,
144
+ "/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2": f57,
145
+ "/assets/format-Cg7VCIZW.js": f58,
146
+ "/assets/Database-x6iWCu3-.js": f59,
147
+ "/assets/dist-1f1fMHVO.js": f60,
148
+ "/assets/QueuesOverview-DGtapyV0.js": f61,
149
+ "/assets/promisePool-BVfQ9n9Q.js": f62,
150
+ "/assets/S3Backup-CxwbLJGK.js": f63,
151
+ "/assets/DlqControl-BBQc6uu9.js": f64,
152
+ "/assets/ServerControl-DpE7t-OF.js": f65,
153
+ "/assets/QueueDetail-D5TKm4bv.js": f66,
154
+ "/assets/Workers-D70B_uAI.js": f67,
155
+ "/assets/Card-CWxrC8OY.js": f68,
156
+ "/assets/LogsPro-D7vvgZmb.js": f69,
157
+ "/assets/dist-BlWBaCN6.js": f70,
158
+ "/assets/AddJob-CFnESFEU.js": f71,
159
+ "/assets/Dlq-Cayt1PEN.js": f72,
160
+ "/assets/JobInspector-BMjVR96H.js": f73,
161
+ "/assets/Webhooks-UYiTg6hn.js": f74,
162
+ "/assets/CopilotPanel-DjHfX9ta.js": f75,
162
163
  "/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2": f76,
163
- "/assets/jobActions-LQD4KfCc.js": f77,
164
- "/assets/dist-DZL8soAh.js": f78,
165
- "/assets/Logs-DBTz2PTz.js": f79,
166
- "/.vite/manifest.json": f80,
164
+ "/assets/QueueActions-D51CYOjo.js": f77,
165
+ "/assets/jobActions-LQD4KfCc.js": f78,
166
+ "/assets/dist-DZL8soAh.js": f79,
167
+ "/assets/flowMutationSafety-DSd3JLAV.js": f80,
168
+ "/.vite/manifest.json": f81,
167
169
  };
package/scripts/serve.ts CHANGED
@@ -16,6 +16,7 @@ import {
16
16
  } from '../agent/server';
17
17
  import { installAgentShutdown } from '../agent/shutdown';
18
18
  import { WorkflowRuntime } from '../agent/workflow/runtime';
19
+ import { assertRequiredBunVersion } from './bunVersion';
19
20
  import { createServeHandler } from './serveHandler';
20
21
  import {
21
22
  isLoopbackBind,
@@ -27,6 +28,8 @@ import {
27
28
  withSecurityHeaders,
28
29
  } from './servePolicy';
29
30
 
31
+ assertRequiredBunVersion();
32
+
30
33
  export { createServeHandler } from './serveHandler';
31
34
  export {
32
35
  agentSubUrl,
@@ -1,3 +0,0 @@
1
- import{i as e,t}from"./cn-zFEt5SO8.js";import{g as n,h as r,t as i}from"./react-vendor-CvwrP0tU.js";import{o as a}from"./connectionStore-CFuNYZ_8.js";import{a as o,i as s,t as c}from"./bq-BOfwNIlJ.js";import{t as l}from"./toastStore-B31o6Z5J.js";import{T as u,o as d}from"./icons-BVzwsfbG.js";import{n as f}from"./usePolledData-CNtNtd0a.js";import{t as p}from"./Button-Ch1W94fJ.js";import{n as m,t as h}from"./Card-CWxrC8OY.js";import{i as g,n as _,r as v,t as y}from"./feedback-QDN1AsYt.js";import{t as b}from"./PageHeader-CvIyaFOO.js";import{n as x,s as S}from"./format-Cg7VCIZW.js";import{a as C,c as w,n as T,s as E}from"./index-TploGF7u.js";import{a as D}from"./form-C4oby9pI.js";import{t as ee}from"./Pagination-x-Cwgrul.js";var O=e(r(),1),k=e(n(),1),A=i();function j({columns:e,filter:t,onChange:n}){let[r,i]=(0,k.useState)(t?.column??``),[a,o]=(0,k.useState)(t?.op??`contains`),[s,c]=(0,k.useState)(t?.value??``),l=r||e[0]||``,d=()=>n(s.trim()?{column:l,op:a,value:s.trim()}:null);return e.length===0?null:(0,A.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`div`,{className:`w-40`,children:(0,A.jsx)(D,{value:l,"aria-label":`Filter column`,name:`database-filter-column`,autoComplete:`off`,onChange:e=>i(e.target.value),children:e.map(e=>(0,A.jsx)(`option`,{value:e,children:e},e))})}),(0,A.jsx)(`div`,{className:`w-32`,children:(0,A.jsxs)(D,{value:a,"aria-label":`Filter operator`,name:`database-filter-operator`,autoComplete:`off`,onChange:e=>o(e.target.value),children:[(0,A.jsx)(`option`,{value:`contains`,children:`contains`}),(0,A.jsx)(`option`,{value:`eq`,children:`=`}),(0,A.jsx)(`option`,{value:`ne`,children:`≠`})]})}),(0,A.jsxs)(`div`,{className:`relative min-w-40 flex-1`,children:[(0,A.jsx)(u,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),(0,A.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),onKeyDown:e=>e.key===`Enter`&&d(),"aria-label":`Filter value`,name:`database-filter-value`,autoComplete:`off`,placeholder:`value — Enter to filter`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-8 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),(0,A.jsx)(p,{size:`sm`,onClick:d,disabled:!s.trim(),children:`Filter`}),t&&(0,A.jsx)(p,{size:`sm`,variant:`ghost`,onClick:()=>{c(``),n(null)},children:`Clear`}),(0,A.jsx)(`span`,{className:`text-[11px] text-faint`,children:`filters the whole table, server-side`})]})}var M=`bq-dash-db-history`,N=10,P=2e4,F=100;function I(e){let t=e==null?``:String(e),n=typeof e==`string`&&/^[=+\-@\t\r]/.test(e)?`'${e}`:t;return/[",\r\n]/.test(n)?`"${n.replaceAll(`"`,`""`)}"`:n}function L(e,t){return[e.map(I).join(`,`),...t.map(e=>e.map(I).join(`,`))].join(`
2
- `)}function R(e,t,n){let r=URL.createObjectURL(new Blob([n],{type:t})),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),0)}function z(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e.slice(0,F))if(!(typeof r!=`string`||r.length===0||r.length>P||n.has(r))&&(n.add(r),t.push(r),t.length===N))break;return t}function B(){try{return z(JSON.parse(localStorage.getItem(M)??`[]`))}catch{return[]}}function V(e){let t=z(e);try{localStorage.setItem(M,JSON.stringify(t))}catch{}return t}function H(e){return V([e,...B().filter(t=>t!==e)].slice(0,N))}function U(e){if(e==null)return`NULL`;let t=typeof e==`string`?e:String(e),n=t.trimStart();if(n.startsWith(`{`)||n.startsWith(`[`))try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}return t}async function W(e,t=c.captureAgentRequestTarget(),n){let r=Object.freeze({table:e.table,orderBy:e.orderBy,dir:e.dir,filter:e.filter?Object.freeze({...e.filter}):void 0});return c.getDbExportAtTarget(t,r,n)}var G=e=>JSON.stringify([e.baseUrl,e.token,e.agentToken]);function te({value:e,align:n}){if(e==null)return(0,A.jsx)(`span`,{className:`italic text-faint`,children:`NULL`});let r=typeof e==`string`?e:String(e);return(0,A.jsx)(`span`,{className:t(`block max-w-[24rem] truncate`,n===`right`&&`text-right tabular-nums`),title:r,children:r})}function ne({columns:e,rows:n,truncatedCells:r,colMeta:i,sort:a,onSort:o,onRowClick:s,dimmed:c}){let l=(0,k.useMemo)(()=>e.map((e,t)=>{let r=i?.[e]?.type?.toUpperCase()??``;if(/INT|REAL|NUM|DEC|DOUB|FLOA/.test(r))return!0;let a=!1;for(let e of n){let n=e[t];if(n!=null&&(a=!0,typeof n!=`number`))return!1}return a}),[e,n,i]);return(0,A.jsx)(`div`,{className:t(`max-h-[70vh] overflow-auto rounded-xl border border-line bg-surface transition-opacity`,c&&`pointer-events-none opacity-50`),children:(0,A.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{className:`text-left text-[11px] uppercase tracking-wider text-faint`,children:[s&&(0,A.jsx)(`th`,{className:`sticky top-0 z-10 whitespace-nowrap border-b border-line bg-surface px-4 py-3 font-medium`,children:(0,A.jsx)(`span`,{className:`sr-only`,children:`Row actions`})}),e.map((e,n)=>{let r=i?.[e];return(0,A.jsx)(`th`,{className:t(`sticky top-0 z-10 whitespace-nowrap border-b border-line bg-surface px-4 py-3 font-medium`,l[n]&&`text-right`),"aria-sort":a?.col===e?a.dir===`asc`?`ascending`:`descending`:o?`none`:void 0,children:o?(0,A.jsxs)(`button`,{type:`button`,onClick:()=>o(e),"aria-label":`Sort by ${e}`,className:`inline-flex items-center gap-1 uppercase tracking-wider hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[e,r?.primaryKey&&(0,A.jsx)(`span`,{className:`rounded bg-accent/15 px-1 py-0.5 text-[9px] font-semibold text-accent`,children:`PK`}),r?.type&&(0,A.jsx)(`span`,{className:`text-faint/70`,children:r.type.toLowerCase()}),(0,A.jsx)(`span`,{"aria-hidden":`true`,className:a?.col===e?`text-accent`:`text-faint/60`,children:a?.col===e?a.dir===`asc`?`▲`:`▼`:`↕`})]}):e},e)})]})}),(0,A.jsx)(`tbody`,{children:n.map((e,t)=>(0,A.jsxs)(`tr`,{className:`border-b border-line font-mono text-xs last:border-0 hover:bg-surface-2/40`,children:[s&&(0,A.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2`,children:(0,A.jsx)(`button`,{type:`button`,"aria-label":`View row ${t+1} details`,onClick:()=>s(t),className:`rounded-md border border-line px-2 py-1 font-sans text-[11px] font-medium text-muted transition-colors hover:border-line-strong hover:text-fg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,children:`View`})}),e.map((e,n)=>(0,A.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2 text-muted`,children:(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(te,{value:e,align:l[n]?`right`:`left`}),r?.[t]?.[n]&&(0,A.jsx)(`span`,{title:`Value truncated — use the row's View action to read it in full`,className:`shrink-0 rounded bg-warning/15 px-1 text-[9px] font-semibold text-warning`,children:`…`})]})},n))]},t))})]})})}function K(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Malformed database query response.`);let t=e;if(t.ok!==!0||!Array.isArray(t.columns)||t.columns.some(e=>typeof e!=`string`)||!Array.isArray(t.rows)||t.rows.length>500||t.rows.some(e=>!Array.isArray(e)||e.length!==t.columns.length)||!Number.isSafeInteger(t.rowCount)||t.rowCount!==t.rows.length||typeof t.truncated!=`boolean`||typeof t.ms!=`number`||!Number.isFinite(t.ms)||t.ms<0)throw Error(`Malformed database query response.`);return{columns:[...t.columns],rows:t.rows.map(e=>[...e]),rowCount:t.rowCount,truncated:t.truncated,ms:t.ms}}function re({sql:e,setSql:t,editorRef:n}){let r=a(G),[i,o]=(0,k.useState)(null),[s,l]=(0,k.useState)(null),[u,d]=(0,k.useState)(B),[f,g]=(0,k.useState)(null),_=(0,k.useRef)(0),v=(0,k.useRef)(null),y=(0,k.useRef)(r);y.current!==r&&(y.current=r,_.current++,v.current=null),(0,k.useEffect)(()=>(_.current++,v.current=null,o(null),l(null),g(null),()=>{_.current++,v.current=null}),[r]);let b=i===r,x=s?.target===r?s.message:null,C=f?.target===r?f:null,w=async(t=e,n=!0)=>{let i=t.trim();if(!i||v.current?.target===r)return;let s=++_.current,u=r;v.current={generation:s,target:u},o(u),l(null);try{let e=K(await c.db.query(t));if(s!==_.current||G(a.getState())!==u)return;g({...e,target:u}),n&&d(H(i))}catch(e){if(s!==_.current||G(a.getState())!==u)return;g(null),l({target:u,message:e.message})}finally{v.current?.generation===s&&(v.current=null),s===_.current&&o(null)}};return(0,A.jsxs)(h,{className:`mt-6`,children:[(0,A.jsx)(m,{title:`Query`,action:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(p,{size:`sm`,disabled:b||!e.trim(),onClick:()=>{let t=e.trim();t&&w(`EXPLAIN QUERY PLAN ${t}`,!1)},children:`Explain`}),(0,A.jsx)(p,{size:`sm`,variant:`accent`,disabled:b||!e.trim(),onClick:()=>w(),children:b?`Running…`:`Run`})]})}),(0,A.jsx)(`textarea`,{name:`database-sql-query`,autoComplete:`off`,ref:n,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&w()},rows:3,spellCheck:!1,"aria-label":`SQL query`,placeholder:`SELECT … — read-only: writes are rejected by the engine`,className:`w-full resize-y rounded-lg border border-line bg-surface-2 p-3 font-mono text-xs text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`}),(0,A.jsx)(`p`,{className:`mt-1 text-[11px] text-faint`,children:`⌘/Ctrl+Enter runs. Connection is read-only.`}),u.length>0&&(0,A.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:`History`}),u.map(e=>(0,A.jsx)(`button`,{type:`button`,onClick:()=>t(e),title:e,className:`max-w-56 truncate rounded-md border border-line bg-surface-2 px-2 py-1 font-mono text-[11px] text-muted transition-colors hover:border-line-strong hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:e},e)),(0,A.jsx)(`button`,{type:`button`,onClick:()=>{V([]),d([])},className:`rounded-md px-2 py-1 text-[11px] text-faint transition-colors hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:`Clear`})]}),(0,A.jsxs)(`div`,{"aria-live":`polite`,children:[x&&(0,A.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:x}),C&&!x&&(0,A.jsxs)(`div`,{className:`mt-4`,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-3`,children:[(0,A.jsxs)(`p`,{className:`text-xs text-faint`,children:[C.truncated?`≥ `:``,S(C.rowCount),` row`,C.rowCount===1?``:`s`,` · `,S(C.ms),` ms`,C.truncated&&(0,A.jsxs)(`span`,{className:`text-warning`,children:[` — showing first `,C.rows.length]})]}),C.rows.length>0&&(0,A.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,A.jsx)(p,{size:`sm`,onClick:()=>R(`query-results.csv`,`text/csv`,L(C.columns,C.rows)),children:`CSV`}),(0,A.jsx)(p,{size:`sm`,onClick:()=>R(`query-results.json`,`application/json`,JSON.stringify(C.rows.map(e=>Object.fromEntries(C.columns.map((t,n)=>[t,e[n]]))),null,2)),children:`JSON`})]})]}),C.rows.length>0?(0,A.jsx)(ne,{columns:C.columns,rows:C.rows}):(0,A.jsx)(`p`,{className:`text-xs text-faint`,children:`Query returned no rows.`})]})]})]})}var q=(e,t)=>t?e?.column===t.column&&e.op===t.op&&e.value===t.value:e===null;function J(e,t){return e.table===t.table&&e.limit===t.limit&&e.offset===t.offset&&e.orderBy===(t.orderBy??null)&&e.dir===t.dir&&q(e.filter,t.filter)}var Y=-(1n<<63n),X=(1n<<63n)-1n;function Z(e){if(e===null)return!0;if(typeof e==`number`)return Number.isSafeInteger(e);if(typeof e!=`string`||!/^-?(?:0|[1-9]\d*)$/.test(e)||e.length>20)return!1;try{let t=BigInt(e);return t>=Y&&t<=X}catch{return!1}}var ie=e=>e===null||typeof e==`string`||typeof e==`number`&&Number.isFinite(e);function ae(e,t){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Malformed database rows response.`);let n=e,r=n.columns,i=n.rows,a=n.rowids,o=n.truncatedCells,s=n.filter,c=s===null||typeof s==`object`&&!!s&&!Array.isArray(s)&&typeof s.column==`string`&&(s.op===`contains`||s.op===`eq`||s.op===`ne`)&&typeof s.value==`string`;if(n.ok!==!0||typeof n.table!=`string`||!Array.isArray(r)||r.length===0||r.length>2e3||r.some(e=>typeof e!=`string`||!e)||new Set(r).size!==r.length||!Array.isArray(i)||i.length>t.limit||i.some(e=>!Array.isArray(e)||e.length!==r.length||e.some(e=>!ie(e)))||!Array.isArray(a)||a.length!==i.length||a.some(e=>!Z(e))||!Array.isArray(o)||o.length!==i.length||o.some(e=>!Array.isArray(e)||e.length!==r.length||e.some(e=>typeof e!=`boolean`))||!Number.isSafeInteger(n.total)||n.total<0||!Number.isSafeInteger(n.limit)||!Number.isSafeInteger(n.offset)||n.offset<0||n.orderBy!==null&&typeof n.orderBy!=`string`||n.dir!==`asc`&&n.dir!==`desc`||!c)throw Error(`Malformed database rows response.`);let l={ok:!0,table:n.table,columns:[...r],rows:i.map(e=>[...e]),rowids:[...a],truncatedCells:o.map(e=>[...e]),total:n.total,limit:n.limit,offset:n.offset,orderBy:n.orderBy,dir:n.dir,filter:s===null?null:{...s}};if(!J(l,t))throw Error(`Database rows identity mismatch: requested table "${t.table}" at offset ${t.offset}.`);let u=Math.min(l.limit,Math.max(0,l.total-l.offset));if(l.rows.length!==u)throw Error(`Malformed database rows response: row count does not match pagination metadata.`);return l}function Q(e,t){let n=e.rows[t],r=e.truncatedCells[t],i=e.rowids[t];return!n||!r||i===void 0||t<0?null:{index:t,table:e.table,columns:[...e.columns],row:[...n],rowid:i,truncated:[...r]}}var oe=(e,t)=>e.length===t.length&&e.every((e,n)=>Object.is(e,t[n]));function se(e,t){let n=Q(t,e.index);return n!==null&&n.table===e.table&&n.rowid===e.rowid&&oe(n.columns,e.columns)&&oe(n.row,e.row)&&oe(n.truncated,e.truncated)}function ce({schema:e}){return(0,A.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,A.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,A.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,A.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Column`}),(0,A.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Type`}),(0,A.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Constraints`}),(0,A.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Default`})]})}),(0,A.jsx)(`tbody`,{children:e.columns.map(e=>(0,A.jsxs)(`tr`,{className:`border-b border-line last:border-0`,children:[(0,A.jsx)(`td`,{className:`px-4 py-2 font-mono text-xs text-fg`,children:e.name}),(0,A.jsx)(`td`,{className:`px-4 py-2 font-mono text-xs text-muted`,children:e.type}),(0,A.jsxs)(`td`,{className:`px-4 py-2 text-xs`,children:[e.primaryKey&&(0,A.jsx)(`span`,{className:`mr-1 rounded-md bg-accent/15 px-1.5 py-0.5 text-[10px] font-semibold text-accent`,children:`PK`}),e.notNull&&(0,A.jsx)(`span`,{className:`rounded-md bg-surface-2 px-1.5 py-0.5 text-[10px] font-semibold text-muted`,children:`NOT NULL`})]}),(0,A.jsx)(`td`,{className:`px-4 py-2 font-mono text-xs text-faint`,children:e.defaultValue??`—`})]},e.name))})]})}),(0,A.jsxs)(h,{children:[(0,A.jsx)(m,{title:`Indexes (${e.indexes.length})`}),e.indexes.length===0?(0,A.jsx)(`p`,{className:`text-xs text-faint`,children:`No indexes on this table.`}):(0,A.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.indexes.map(e=>(0,A.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2 font-mono text-xs`,children:[(0,A.jsx)(`span`,{className:`text-fg`,children:e.name}),e.unique&&(0,A.jsx)(`span`,{className:`rounded-md bg-accent/15 px-1.5 py-0.5 text-[10px] font-semibold text-accent`,children:`UNIQUE`}),(0,A.jsxs)(`span`,{className:`text-faint`,children:[`(`,e.columns.join(`, `),`)`]})]},e.name))})]}),e.sql&&(0,A.jsxs)(h,{children:[(0,A.jsx)(m,{title:`DDL`,action:(0,A.jsx)(C,{value:e.sql})}),(0,A.jsx)(`pre`,{className:`overflow-x-auto rounded-lg bg-surface-2 p-3 font-mono text-xs text-muted`,children:e.sql})]})]})}function le({db:e}){let{anyTruncated:n,colMeta:r,cycleSort:i,data:a,dbMissing:o,detail:s,editorRef:c,exportBusy:l,exportPage:u,exportTable:d,filter:f,info:m,infoError:C,msg:w,page:E,pageSize:D,queryThisTable:O,refetchInfo:k,refetchRows:M,refetchSchema:N,refetchTables:P,requestModal:F,rowsLoading:I,schema:L,schemaError:R,selectTable:z,selected:B,setDetailSelection:V,setFilter:H,setPage:U,setSql:W,setTab:G,sort:te,sql:K,tab:q,tables:J,tablesError:Y,tablesLoading:X,visibleRowsError:Z}=e;return(0,A.jsxs)(`div`,{"data-database-background":``,inert:s?!0:void 0,"aria-hidden":s?!0:void 0,children:[(0,A.jsx)(b,{title:`Database`,description:`SQLite inspector — schema, data and queries over a read-only connection.`,actions:(0,A.jsx)(`span`,{className:`rounded-full bg-emerald-500/10 px-2.5 py-1 text-[11px] font-medium text-success`,children:`read-only`})}),Y&&!o&&(0,A.jsx)(g,{message:`Could not read the database — ${Y.message}`,onRetry:P}),C&&!o&&(0,A.jsx)(g,{message:`Could not read database metadata — ${C.message}`,onRetry:k}),m&&(0,A.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-5`,children:[(0,A.jsx)(T,{label:`SQLite`,value:m.sqliteVersion,compact:!0}),(0,A.jsx)(T,{label:`On disk`,value:x(m.fileSize+m.walSize),compact:!0}),(0,A.jsx)(T,{label:`Journal`,value:m.journalMode.toUpperCase(),compact:!0}),(0,A.jsx)(T,{label:`Tables`,value:S(m.tables),compact:!0}),(0,A.jsx)(T,{label:`Indexes`,value:S(m.indexes),compact:!0})]}),o?(0,A.jsx)(y,{title:`No database yet`,hint:Y.message}):X&&J.length===0?(0,A.jsx)(v,{label:`Reading database…`}):(0,A.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-4`,children:[(0,A.jsxs)(h,{padded:!1,className:`self-start overflow-hidden`,children:[(0,A.jsxs)(`div`,{className:`border-b border-line px-4 py-3 text-[11px] font-medium uppercase tracking-wider text-faint`,children:[`Tables (`,J.length,`)`]}),(0,A.jsxs)(`ul`,{className:`max-h-[28rem] overflow-y-auto`,children:[J.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsxs)(`button`,{type:`button`,onClick:()=>z(e.name),className:t(`flex w-full items-center justify-between gap-2 px-4 py-2 text-left text-sm transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,B===e.name?`bg-surface-2 text-fg`:`text-muted hover:bg-surface-2/60 hover:text-fg`),children:[(0,A.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.name}),(0,A.jsx)(`span`,{className:`shrink-0 text-[11px] text-faint tabular-nums`,children:S(e.rows)})]})},e.name)),J.length===0&&(0,A.jsx)(`li`,{className:`px-4 py-6 text-center text-xs text-faint`,children:`No tables.`})]})]}),(0,A.jsx)(`div`,{className:`min-w-0 lg:col-span-3`,children:J.length===0?(0,A.jsx)(y,{title:`No tables`,hint:`This database has no user tables yet.`}):(0,A.jsxs)(A.Fragment,{children:[B&&(0,A.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`mr-auto min-w-0 truncate font-mono text-sm text-fg`,title:B,children:B}),(0,A.jsx)(p,{size:`sm`,variant:`ghost`,onClick:O,children:`Query`}),(0,A.jsx)(`div`,{className:`inline-flex items-center gap-1 rounded-lg border border-line bg-surface p-1`,children:[`data`,`schema`].map(e=>(0,A.jsx)(`button`,{type:`button`,onClick:()=>G(e),"aria-pressed":q===e,className:t(`rounded-md px-3 py-1 text-xs font-medium capitalize transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,q===e?`bg-surface-2 text-fg`:`text-muted hover:text-fg`),children:e},e))}),q===`data`&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(p,{size:`sm`,disabled:!a||a.rows.length===0,title:a?`Exports the ${a.rows.length} rows on this page only`:void 0,onClick:u,children:[`Export page`,a?` (${a.rows.length})`:``]}),(0,A.jsx)(p,{size:`sm`,variant:`accent`,disabled:l||!a||a.total===0,onClick:d,children:l?`Exporting…`:`Export table${a?` (${S(a.total)})`:``}`})]})]}),q===`data`&&B&&(0,A.jsx)(j,{columns:a?.columns??L?.columns.map(e=>e.name)??[],filter:f,onChange:e=>{H(e),U(0),V(null)}},B),w&&(0,A.jsx)(`p`,{className:`mb-3 text-xs text-muted`,children:w}),q===`schema`?R?(0,A.jsx)(y,{title:`Could not read schema`,hint:R.message,action:(0,A.jsx)(p,{size:`sm`,onClick:N,children:`Retry`})}):L?.table===B?(0,A.jsx)(ce,{schema:L}):(0,A.jsx)(v,{label:`Reading schema of ${B}…`}):Z?(0,A.jsx)(_,{error:Z,onRetry:M}):I&&!a?(0,A.jsx)(v,{label:`Reading ${B}…`}):a?a.total===0?(0,A.jsx)(y,{title:f?`No matching rows`:`Empty table`,hint:f?`No rows match the current filter.`:`"${a.table}" has no rows.`}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(ne,{columns:a.columns,rows:a.rows,truncatedCells:a.truncatedCells,colMeta:r,sort:te,onSort:i,onRowClick:e=>{let t=Q(a,e);t&&F(`database-row`)&&V(t)},dimmed:I&&!a}),n&&(0,A.jsx)(`p`,{className:`mt-2 text-[11px] text-faint`,children:`Cells over 2000 chars and BLOBs are abbreviated in the grid and CSV — use the row's View action to read the full value.`}),(0,A.jsx)(ee,{page:E,pageSize:D,total:a.total,onPageChange:e=>{U(e),V(null)},label:`rows`})]}):(0,A.jsx)(y,{title:`Select a table`,hint:`Pick a table on the left to browse its rows.`}),(0,A.jsx)(re,{sql:K,setSql:W,editorRef:c})]})})]})]})}var ue=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function de({table:e,columns:t,row:n,rowid:r,truncated:i,onClose:a}){let[o,s]=(0,k.useState)({}),[l,u]=(0,k.useState)({}),f=(0,k.useRef)(null),p=(0,k.useRef)(null),m=(0,k.useRef)(a);m.current=a,(0,k.useEffect)(()=>{let e=document.activeElement,t=f.current,n=()=>t?Array.from(t.querySelectorAll(ue)).filter(e=>e.getAttribute(`aria-hidden`)!==`true`):[],r=(e=!1)=>{let r=n();(e?r.at(-1):r[0])?.focus(),r.length===0&&t?.focus()},i=e=>{if(e.key===`Escape`){e.preventDefault(),m.current();return}if(e.key!==`Tab`)return;let r=n();if(r.length===0){e.preventDefault(),t?.focus();return}let i=document.activeElement,a=r[0],o=r[r.length-1];e.shiftKey&&(i===a||!i||!t?.contains(i))?(e.preventDefault(),o.focus()):!e.shiftKey&&(i===o||!i||!t?.contains(i))&&(e.preventDefault(),a.focus())},a=e=>{t&&!t.contains(e.target)&&r()};return p.current?.focus(),document.activeElement!==p.current&&t?.focus(),document.addEventListener(`keydown`,i,!0),document.addEventListener(`focusin`,a),()=>{document.removeEventListener(`keydown`,i,!0),document.removeEventListener(`focusin`,a),E(`database-row`)&&e?.isConnected&&e.focus()}},[]);let h=JSON.stringify(t.filter((e,t)=>i[t]));return(0,k.useEffect)(()=>{s({}),u({});let t=JSON.parse(h);if(r==null||t.length===0)return;let n=!1;return Promise.all(t.map(async t=>{try{let i=await c.db.cell(e,r,t);if(!i||typeof i!=`object`||!Object.hasOwn(i,`value`))throw Error(`Malformed full-cell response.`);n||s(e=>({...e,[t]:i.value}))}catch(e){if(!n){let n=e instanceof Error?e.message:String(e);u(e=>({...e,[t]:n.slice(0,300)}))}}})),()=>{n=!0}},[e,r,h]),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`button`,{type:`button`,"aria-label":`Close row detail`,onClick:a,className:`fixed inset-0 z-40 bg-black/50`}),(0,A.jsxs)(`aside`,{ref:f,role:`dialog`,"aria-modal":`true`,"aria-label":`${e} row ${r??`detail`}`,tabIndex:-1,className:`fixed inset-y-0 right-0 z-50 flex w-full max-w-xl flex-col border-l border-line bg-surface shadow-xl focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-accent`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-5 py-4`,children:[(0,A.jsxs)(`h2`,{className:`font-mono text-sm text-fg`,children:[e,` · row detail`]}),(0,A.jsx)(`button`,{ref:p,type:`button`,"aria-label":`Close`,onClick:a,className:`flex size-8 items-center justify-center rounded-lg text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:(0,A.jsx)(d,{className:`size-4`})})]}),(0,A.jsx)(`div`,{className:`flex-1 overscroll-contain overflow-y-auto p-5`,children:(0,A.jsx)(`dl`,{className:`flex flex-col gap-4`,children:t.map((e,t)=>{let r=Object.hasOwn(o,e),a=r?o[e]:n[t],s=U(a),c=s.includes(`
3
- `)||s.length>80;return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`dt`,{className:`mb-1 flex items-center gap-1.5 text-[11px] uppercase tracking-wider text-faint`,children:[e,a!=null&&(0,A.jsx)(C,{value:String(a)}),i[t]&&!r&&(Object.hasOwn(l,e)?(0,A.jsxs)(`span`,{role:`alert`,className:`normal-case text-danger`,children:[`(full value unavailable — `,l[e],`)`]}):(0,A.jsx)(`span`,{className:`text-warning`,children:`(loading full value…)`}))]}),(0,A.jsx)(`dd`,{children:a==null?(0,A.jsx)(`span`,{className:`italic text-faint`,children:`NULL`}):c?(0,A.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-2 p-3 font-mono text-xs text-muted`,children:s}):(0,A.jsx)(`span`,{className:`break-words font-mono text-sm text-fg`,children:s})})]},e)})})})]})]})}function fe({data:e,filter:t,page:n,selected:r,sort:i}){let o=a(G),[u,d]=(0,k.useState)(!1),[f,p]=(0,k.useState)(null),m=(0,k.useRef)(!1),h=(0,k.useRef)(null);return(0,k.useEffect)(()=>(h.current?.abort(),h.current=null,m.current=!1,d(!1),p(null),()=>{h.current?.abort(),h.current=null,m.current=!1}),[o]),{exportBusy:u,exportPage:()=>{e&&R(`${e.table}-page${n+1}.csv`,`text/csv`,L(e.columns,e.rows))},exportTable:async()=>{if(!r||m.current)return;m.current=!0;let e=G(a.getState()),n={table:r,orderBy:i?.col,dir:i?.dir??`asc`,filter:t?{...t}:void 0},o=c.captureAgentRequestTarget(),u=new AbortController;h.current=u,d(!0),p(null);try{let t=await W(n,o,u.signal);if(u.signal.aborted||G(a.getState())!==e)return;R(`${n.table}.csv`,`text/csv;charset=utf-8`,t.content);let r=t.cap===`rows`?`Exported the first ${S(t.rowCount)} rows (row cap reached)`:t.cap===`bytes`?`Exported ${S(t.rowCount)} rows (${x(s)} byte cap reached)`:`Exported ${S(t.rowCount)} rows`;p(r),l.success(`Export of ${n.table} complete`,r)}catch(t){if(u.signal.aborted||G(a.getState())!==e)return;p(`Export failed: ${t.message}`),l.error(`Export of ${n.table} failed`,t.message)}finally{h.current===u&&(h.current=null,m.current=!1,u.signal.aborted||d(!1))}},msg:f}}var $=50;function pe(){let[e,t]=(0,k.useState)(``),[n,r]=(0,k.useState)(0),[i,a]=(0,k.useState)(null),[s,l]=(0,k.useState)(`data`),[u,d]=(0,k.useState)(null),[p,m]=(0,k.useState)(null),h=w(e=>e.active),g=w(e=>e.request),_=w(e=>e.release),[v,y]=(0,k.useState)(`SELECT name FROM sqlite_master WHERE type = 'table'`),b=(0,k.useRef)(null);(0,k.useEffect)(()=>{p===null?_(`database-row`):h!==`database-row`&&m(null)},[p,h,_]),(0,k.useEffect)(()=>()=>{w.getState().release(`database-row`)},[]);let{data:x,error:S,loading:C,refetch:T}=f(()=>c.db.tables(),[],{intervalMs:1e4}),E=(0,k.useMemo)(()=>x?.tables??[],[x]),D=S instanceof o&&S.status===404,{data:ee,error:O,refetch:A}=f(()=>D?Promise.resolve(null):c.db.info(),[D],{intervalMs:15e3}),j=e||E[0]?.name||``;(0,k.useEffect)(()=>{!e&&E[0]&&t(E[0].name)},[e,E]);let{data:M,error:N,refetch:P}=f(()=>j?c.db.schema(j):Promise.resolve(null),[j],{intervalMs:3e4}),F=(0,k.useMemo)(()=>{let e={};if(M?.table===j)for(let t of M.columns)e[t.name]={type:t.type,primaryKey:t.primaryKey};return e},[M,j]),I=u?JSON.stringify([u.column,u.op,u.value]):``,{data:L,error:R,loading:z,refetch:B}=f((0,k.useCallback)(async()=>{if(!j)return null;let e={table:j,limit:$,offset:n*$,orderBy:i?.col,dir:i?.dir??`asc`,filter:u??void 0};return ae(await c.db.rows(j,$,e.offset,i?.col,i?.dir,u??void 0),e)},[j,n,i,u]),[j,n,i,I],{intervalMs:6e3}),V={table:j,limit:$,offset:n*$,orderBy:i?.col,dir:i?.dir??`asc`,filter:u??void 0},H=!!L&&J(L,V),U=R??(L&&!H?Error(`Database rows identity no longer matches the selected table and page.`):null),W=!U&&H?L:null,G=p!==null&&W!==null&&se(p,W),te=G?p:null;(0,k.useEffect)(()=>{p&&!G&&m(null)},[p,G]),(0,k.useEffect)(()=>{W&&W.total>0&&W.rows.length===0&&n>0&&r(Math.max(0,Math.ceil(W.total/$)-1))},[W,n]);let ne=()=>{r(0),a(null),d(null),m(null)},K=e=>{t(e),l(`data`),ne()},re=e=>{r(0),m(null),a(t=>t?.col===e?t.dir===`asc`?{col:e,dir:`desc`}:null:{col:e,dir:`asc`})},q=()=>{let e=`SELECT * FROM "${j.replaceAll(`"`,`""`)}" LIMIT 100`;y(e),requestAnimationFrame(()=>{b.current?.focus(),b.current?.scrollIntoView({behavior:`smooth`,block:`center`})})},Y=!!W?.truncatedCells.some(e=>e.some(Boolean)),{exportBusy:X,exportPage:Z,exportTable:ie,msg:Q}=fe({data:W,filter:u,page:n,selected:j,sort:i});return{activeModal:h,anyTruncated:Y,colMeta:F,cycleSort:re,data:W,dbMissing:D,detail:te,editorRef:b,exportBusy:X,exportPage:Z,exportTable:ie,filter:u,info:ee,infoError:O,msg:Q,page:n,pageSize:$,queryThisTable:q,refetchInfo:A,refetchRows:B,refetchSchema:P,refetchTables:T,requestModal:g,rowsLoading:z,schema:M,schemaError:N,selectTable:K,selected:j,setDetailSelection:m,setFilter:d,setPage:r,setSql:y,setTab:l,sort:i,sql:v,tab:s,tables:E,tablesError:S,tablesLoading:C,visibleRowsError:U}}function me(){let e=pe(),{activeModal:t,detail:n,setDetailSelection:r}=e;return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(le,{db:e}),n&&t===`database-row`&&(0,O.createPortal)((0,A.jsx)(de,{table:n.table,columns:n.columns,row:n.row,rowid:n.rowid,truncated:n.truncated,onClose:()=>r(null)}),document.body)]})}export{me as Database};
@@ -1 +0,0 @@
1
- import{i as e,t}from"./cn-zFEt5SO8.js";import{f as n,g as r,r as i,t as a}from"./react-vendor-CvwrP0tU.js";import{t as o}from"./bq-BOfwNIlJ.js";import{t as s}from"./toastStore-B31o6Z5J.js";import{C as c,d as l,u}from"./icons-BVzwsfbG.js";import{n as d}from"./usePolledData-CNtNtd0a.js";import{n as f,t as p}from"./Button-Ch1W94fJ.js";import{t as m}from"./Card-CWxrC8OY.js";import{i as h,n as g,r as _,t as v}from"./feedback-QDN1AsYt.js";import{t as y}from"./PageHeader-CvIyaFOO.js";import{l as b,s as x}from"./format-Cg7VCIZW.js";import{a as S}from"./form-C4oby9pI.js";import{t as C}from"./Pagination-x-Cwgrul.js";import{r as w,t as T}from"./flowMutationSafety-6cP-l4Pa.js";import{t as E}from"./exportFile-C7xhE8Yh.js";import{t as D}from"./QueueControl-BF638r_0.js";var O=e(r(),1),k=a();function ee({total:e,discoveryError:n,healthy:r,statsError:i,queue:a,topReason:o,pendingRetry:s,reasonCount:c}){return(0,k.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,k.jsxs)(m,{children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,k.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Total in DLQ`}),(0,k.jsx)(`span`,{className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,n?`bg-amber-500/10 text-warning`:e==null?`bg-surface-2 text-muted`:r?`bg-emerald-500/10 text-success`:`bg-red-500/10 text-danger`),children:n?`Unavailable`:e==null?`Loading`:r?`Healthy`:`Attention`})]}),(0,k.jsx)(`div`,{className:t(`mt-2 text-3xl font-bold tnum`,e==null||n?`text-muted`:r?`text-success`:`text-danger`),children:e==null?`—`:x(e)})]}),(0,k.jsxs)(m,{children:[(0,k.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Top Reason`}),(0,k.jsx)(`div`,{className:`mt-2 text-lg font-semibold text-fg`,children:n||i?`Unavailable`:a?o??`No failures`:`Select a queue`})]}),(0,k.jsxs)(m,{children:[(0,k.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Pending Retry`}),(0,k.jsx)(`div`,{className:`mt-2 text-3xl font-bold tnum text-fg`,children:s==null?`—`:x(s)}),(0,k.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:a?`in this queue`:`awaiting retry`})]}),(0,k.jsxs)(m,{children:[(0,k.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Failure Types`}),(0,k.jsx)(`div`,{className:`mt-2 text-3xl font-bold tnum text-fg`,children:c==null?`—`:x(c)}),(0,k.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:`distinct reasons`})]})]})}function te({queues:e,queue:n,onSelect:r}){return e.length===0?null:(0,k.jsxs)(m,{className:`mb-6`,children:[(0,k.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,k.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`DLQ by queue`}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsxs)(p,{size:`sm`,disabled:!0,title:T,children:[(0,k.jsx)(c,{className:`size-3.5`}),` Retry all (`,e.length,` queues)`]}),(0,k.jsxs)(p,{variant:`danger`,size:`sm`,disabled:!0,title:w,children:[`Purge all (`,e.length,` queues)`]})]})]}),(0,k.jsx)(`div`,{className:`grid grid-cols-2 gap-3 md:grid-cols-4 xl:grid-cols-5`,children:e.map(e=>(0,k.jsxs)(`button`,{type:`button`,onClick:()=>r(e.name),className:t(`rounded-lg border p-3 text-left transition-colors`,n===e.name?`border-accent/50 bg-surface-2`:`border-line hover:border-line-strong`),children:[(0,k.jsx)(`div`,{className:`truncate font-mono text-xs text-muted`,children:e.name}),(0,k.jsx)(`div`,{className:`mt-1 text-xl font-bold tnum text-danger`,children:e.dlq})]},e.name))})]})}function A({queue:e,queues:t,reason:n,reasons:r,sort:i,search:a,pageScoped:o,onQueue:s,onReason:u,onSort:d,onSearch:m,onExport:h}){return(0,k.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,k.jsx)(`div`,{className:`w-48`,children:(0,k.jsxs)(S,{value:e,"aria-label":`Queue`,name:`dlq-queue`,autoComplete:`off`,onChange:e=>s(e.target.value),children:[(0,k.jsx)(`option`,{value:``,children:`Select a queue…`}),t.map(e=>(0,k.jsxs)(`option`,{value:e.name,children:[e.name,e.dlq?` (${e.dlq})`:``]},e.name))]})}),(0,k.jsx)(`div`,{className:`w-40`,children:(0,k.jsxs)(S,{value:n,onChange:e=>u(e.target.value),"aria-label":`Filter by reason`,name:`dlq-reason-filter`,autoComplete:`off`,children:[(0,k.jsx)(`option`,{value:`all`,children:`All Reasons`}),r.map(e=>(0,k.jsx)(`option`,{value:e,children:e},e))]})}),(0,k.jsx)(`div`,{className:`w-36`,children:(0,k.jsxs)(S,{value:i,onChange:e=>d(e.target.value),"aria-label":o?`Sort this page`:`Sort`,name:`dlq-sort`,autoComplete:`off`,children:[(0,k.jsxs)(`option`,{value:`newest`,children:[`Newest First`,o?` (this page)`:``]}),(0,k.jsxs)(`option`,{value:`oldest`,children:[`Oldest First`,o?` (this page)`:``]})]})}),(0,k.jsx)(`input`,{value:a,onChange:e=>m(e.target.value),placeholder:`Filter this page by job ID…`,"aria-label":`Filter this page by job ID`,name:`dlq-job-filter`,autoComplete:`off`,className:`h-9 min-w-40 flex-1 rounded-lg border border-line bg-surface px-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`}),(0,k.jsxs)(p,{size:`sm`,disabled:!0,title:T,children:[(0,k.jsx)(c,{className:`size-3.5`}),` Retry All`]}),(0,k.jsx)(p,{variant:`danger`,size:`sm`,disabled:!0,title:w,children:`Purge All`}),(0,k.jsx)(f,{"aria-label":`Export this page to CSV`,title:`Export this page to CSV`,disabled:!e,onClick:h,children:(0,k.jsx)(l,{className:`size-3.5`})})]})}function j({entries:e,expanded:n,onToggle:r}){return(0,k.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,k.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,k.jsx)(`thead`,{children:(0,k.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,k.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Job ID`}),(0,k.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Name`}),(0,k.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Reason`}),(0,k.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Error`}),(0,k.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Entered`}),(0,k.jsx)(`th`,{className:`w-16 px-5 py-3`})]})}),(0,k.jsx)(`tbody`,{children:e.map(e=>{let a=`${e.job.id}-${e.enteredAt}`;return(0,k.jsxs)(`tr`,{className:`border-b border-line last:border-0 align-top hover:bg-surface-2/40`,children:[(0,k.jsx)(`td`,{className:`px-5 py-3`,children:(0,k.jsx)(i,{to:`/job?id=${encodeURIComponent(e.job.id)}`,className:`font-mono text-xs text-accent hover:underline`,children:e.job.id})}),(0,k.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.job.name??`default`}),(0,k.jsx)(`td`,{className:`px-5 py-3`,children:(0,k.jsx)(`span`,{className:`rounded-md bg-red-500/10 px-2 py-0.5 text-xs text-danger`,children:e.reason})}),(0,k.jsx)(`td`,{className:`max-w-md px-5 py-3 text-xs text-danger/80`,children:e.error?(0,k.jsx)(`button`,{type:`button`,title:e.error,"aria-expanded":n.has(a),onClick:()=>r(a),className:t(`block w-full break-words text-left`,!n.has(a)&&`line-clamp-2`),children:e.error}):`—`}),(0,k.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:b(e.enteredAt)}),(0,k.jsx)(`td`,{className:`px-5 py-3 text-right`,children:(0,k.jsx)(f,{"aria-label":`Retry unavailable`,disabled:!0,title:T,children:(0,k.jsx)(c,{className:`size-3.5`})})})]},a)})})]})})}var M=25;function N(){let[e,t]=n(),[r,i]=(0,O.useState)(``),[a,c]=(0,O.useState)(`all`),[l,f]=(0,O.useState)(`newest`),[p,m]=(0,O.useState)(``),[b,x]=(0,O.useState)(0),[S,w]=(0,O.useState)(new Set),{data:N,error:P,loading:F,refetch:I}=d(D,[],{intervalMs:1e4}),L=N?.queues??[],R=N?L.reduce((e,t)=>e+t.dlq,0):null,{data:z,error:B,loading:V,refetch:H}=d((0,O.useCallback)(async()=>{if(!r)return{queue:r,page:b,entries:[],entriesTotal:0,stats:null,statsError:null};let[e,t]=await Promise.all([o.dlq(r,M,b*M),o.dlqStats(r).then(e=>({stats:e.stats,error:null})).catch(e=>({stats:null,error:e.message||`Unknown error`}))]);return{queue:r,page:b,entries:e.entries??[],entriesTotal:e.total??0,stats:t.stats,statsError:t.error}},[r,b]),[r,b]),U=z?.queue===r&&z.page===b?z:null;(0,O.useEffect)(()=>{if(!U)return;let e=U.entriesTotal??0;b>0&&b*M>=e&&x(Math.max(0,Math.ceil(e/M)-1))},[U,b]);let W=()=>{let e=(U?.entries??[]).map(e=>({jobId:e.job.id,reason:e.reason,error:e.error??``,enteredAt:new Date(e.enteredAt).toISOString(),attempts:e.attempts?.length??0}));if(e.length===0){s.info(`Nothing to export on this page`);return}E(`dlq-${r}`,e,[`jobId`,`reason`,`error`,`enteredAt`,`attempts`])},G=e=>{X.current=!0,i(e),x(0),c(`all`),t(e?{queue:e}:{},{replace:!0})},K=U?.stats?.byReason??{},q=Object.keys(K).filter(e=>K[e]>0),J=[...q].sort((e,t)=>(K[t]??0)-(K[e]??0))[0],Y=(0,O.useMemo)(()=>L.filter(e=>e.dlq>0).sort((e,t)=>t.dlq-e.dlq),[L]),X=(0,O.useRef)(!1),Z=e.get(`queue`);(0,O.useEffect)(()=>{if(!(X.current||r)){if(Z){if(L.some(e=>e.name===Z)){X.current=!0,i(Z),x(0),c(`all`);return}if(L.length===0)return}Y.length!==0&&(X.current=!0,i(Y[0].name),x(0),c(`all`))}},[r,L,Y,Z]);let Q=(0,O.useMemo)(()=>{let e=U?.entries??[];a!==`all`&&(e=e.filter(e=>e.reason===a));let t=p.trim().toLowerCase();return t&&(e=e.filter(e=>e.job.id.toLowerCase().includes(t))),[...e].sort((e,t)=>l===`newest`?t.enteredAt-e.enteredAt:e.enteredAt-t.enteredAt)},[U,a,p,l]),ne=R===0&&!P,$=a!==`all`||p.trim()!==``,re=(U?.entriesTotal??0)>M;return(0,k.jsxs)(`div`,{children:[(0,k.jsx)(y,{title:`Dead Letter Queue`,description:`Jobs that failed after exhausting all retries. Inspect and export entries without mutating flow topology.`,live:!!r&&!!U&&!U.statsError&&!B&&!P}),B&&U&&(0,k.jsx)(h,{message:`DLQ refresh failed — showing the last successful page.`,onRetry:H}),P&&(0,k.jsx)(h,{onRetry:I,message:`Could not discover queue DLQ totals — ${P.message}. Health status is unavailable.`}),U?.statsError&&(0,k.jsx)(h,{message:`DLQ statistics are unavailable — ${U.statsError}. The entry list may still be current.`,onRetry:H}),(0,k.jsx)(ee,{total:R,discoveryError:!!P,healthy:ne,statsError:!!U?.statsError,queue:r,topReason:J,pendingRetry:U?.stats?.pendingRetry,reasonCount:U?.stats?q.length:void 0}),(0,k.jsx)(te,{queues:Y,queue:r,onSelect:G}),(0,k.jsx)(A,{queue:r,queues:L,reason:a,reasons:q,sort:l,search:p,pageScoped:re,onQueue:G,onReason:c,onSort:f,onSearch:m,onExport:W}),(0,k.jsx)(`p`,{className:`mb-4 text-xs text-warning`,children:T}),B&&!U?(0,k.jsx)(g,{error:B,onRetry:H}):F&&!N&&!r&&!P?(0,k.jsx)(_,{label:`Discovering queues…`}):V&&!U&&!B?(0,k.jsx)(_,{label:`Loading DLQ…`}):P&&!r?(0,k.jsx)(v,{icon:(0,k.jsx)(u,{}),title:`Could not discover queues`,hint:`${P.message}. Retry the queue discovery request above.`}):r?Q.length===0?(0,k.jsx)(v,{icon:(0,k.jsx)(u,{}),title:$?`No matches on this page`:`No dead letter entries`,hint:$?`No entries on this page match your filter — the filter is page-scoped. Use the pager below to check other pages.`:`This queue has no dead letter entries.`}):(0,k.jsx)(j,{entries:Q,expanded:S,onToggle:e=>w(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}):(0,k.jsx)(v,{icon:(0,k.jsx)(u,{}),title:`Select a queue`,hint:`Choose a queue from the dropdown to view its dead letter queue entries.`}),r&&U&&(0,k.jsx)(C,{page:b,pageSize:M,total:U.entriesTotal,onPageChange:x,label:`entries`})]})}export{N as DlqPro};
@@ -1 +0,0 @@
1
- import{i as e}from"./cn-zFEt5SO8.js";import{g as t,t as n}from"./react-vendor-CvwrP0tU.js";import{t as r}from"./bq-BOfwNIlJ.js";import{n as i}from"./usePolledData-CNtNtd0a.js";import{t as a}from"./Button-Ch1W94fJ.js";import{n as o,t as s}from"./Card-CWxrC8OY.js";import{i as c,n as l,r as u}from"./feedback-QDN1AsYt.js";import{n as d}from"./StatusBadge-BoOVTnKu.js";import{t as f}from"./PageHeader-CvIyaFOO.js";import{s as p}from"./format-Cg7VCIZW.js";import{n as m}from"./index-TploGF7u.js";import{a as h,n as g,t as _}from"./form-C4oby9pI.js";import{r as v}from"./useServerActionGuard-Db7PPgaI.js";import{a as y,i as b,n as x,o as S,r as C,s as w,t as ee}from"./QueueActions-D7cQrGvJ.js";var T=e(t(),1),E={limits:async(e,t)=>D(await r.queueOperations.limits(e,t)),deduplicationJobId:async(e,t)=>O(await r.queueOperations.deduplicationJobId(e,t)),removeDeduplicationKey:async(e,t)=>k(await r.queueOperations.removeDeduplicationKey(e,t)),metrics:async(e,t,n,i)=>A(await r.queueOperations.metrics(e,t,n,i)),trimEvents:async(e,t)=>k(await r.queueOperations.trimEvents(e,t))};function D(e){let t=M(j(e,`Queue limits`).limits,`Queue limits`),n=t.rateLimit;if(n!==null&&(!N(n)||!P(n.max)||!P(n.duration))||t.concurrency!==null&&!P(t.concurrency)||!F(t.rateLimitTtl,-2)||typeof t.maxed!=`boolean`)throw I(`Queue limits`);return{rateLimit:n,concurrency:t.concurrency,rateLimitTtl:t.rateLimitTtl,maxed:t.maxed}}function O(e){let t=j(e,`deduplication lookup`).jobId;if(t!==null&&(typeof t!=`string`||!t))throw I(`deduplication lookup`);return t}function k(e){let t=j(e,`Queue mutation`).removed;if(!F(t,0))throw I(`Queue mutation`);return t}function A(e){let t=M(j(e,`Queue metrics`).metrics,`Queue metrics`),n=M(t.meta,`Queue metrics`);if(!F(n.count,0)||!F(n.prevTS,0)||!F(n.prevCount,0)||!F(t.count,0)||!Array.isArray(t.data)||t.data.length>10001||!t.data.every(e=>F(e,0)))throw I(`Queue metrics`);return t}function j(e,t){let n=M(e,t);if(n.ok!==!0)throw I(t);return n}function M(e,t){if(!N(e))throw I(t);return e}function N(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}var P=e=>F(e,1),F=(e,t)=>Number.isSafeInteger(e)&&e>=t,I=e=>Error(`Malformed ${e} response`),L=n();function R({queue:e,repository:t,busy:n,run:r}){let[i,o]=(0,T.useState)(``),[s,c]=(0,T.useState)(),[l,u]=(0,T.useState)(``),d=i.length>0&&i.length<=1024;return(0,L.jsxs)(`section`,{"aria-labelledby":`queue-dedup-title`,className:`border-t border-line pt-4 xl:border-t-0`,children:[(0,L.jsx)(`h3`,{id:`queue-dedup-title`,className:`text-sm font-semibold text-fg`,children:`Deduplication registry`}),(0,L.jsx)(`p`,{className:`mt-1 mb-4 text-xs leading-5 text-faint`,children:`Resolve an official deduplication ID to its current job, or release only the registry key.`}),(0,L.jsx)(_,{label:`Deduplication ID`,children:(0,L.jsx)(g,{name:`queue-sdk-deduplication-id`,autoComplete:`off`,spellCheck:!1,maxLength:1024,value:i,onChange:e=>{o(e.target.value),c(void 0),u(``)}})}),(0,L.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,L.jsx)(a,{size:`sm`,disabled:!d||!!n,onClick:()=>r(`Looking up deduplication key`,()=>t.deduplicationJobId(e,i),c),children:`Find owner`}),(0,L.jsx)(a,{variant:`warning`,size:`sm`,disabled:!d||!!n,onClick:()=>{window.confirm(`Remove deduplication key "${i}" from queue "${e}"? The job is not deleted, but a later enqueue may reuse this key.`)&&r(`Removing deduplication key`,()=>t.removeDeduplicationKey(e,i),e=>{u(e?`Deduplication key removed.`:`No matching key was active.`),c(void 0)},!0)},children:`Remove key`})]}),s!==void 0&&(0,L.jsx)(`p`,{role:`status`,className:`mt-3 break-all text-xs text-muted`,children:s===null?`No active owner.`:`Current job: ${s}`}),l&&(0,L.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-success`,children:l})]})}function te({snapshot:e,loading:t,error:n}){if(t&&!e)return(0,L.jsx)(`p`,{className:`text-sm text-muted`,children:`Reading broker limit state...`});if(n&&!e)return(0,L.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:n});if(!e)return null;let r=e.rateLimit;return(0,L.jsxs)(`div`,{children:[n&&(0,L.jsxs)(`p`,{role:`alert`,className:`mb-3 text-xs text-warning`,children:[`Refresh failed. Showing the last successful limit snapshot: `,n]}),(0,L.jsxs)(`dl`,{className:`grid gap-x-6 gap-y-4 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,L.jsx)(z,{label:`Global rate limit`,value:r?`${r.max} / ${r.duration} ms`:`Not configured`}),(0,L.jsx)(z,{label:`Rate-limit TTL`,value:e.rateLimitTtl===-2?`No active limit`:`${e.rateLimitTtl} ms`}),(0,L.jsx)(z,{label:`Global concurrency`,value:e.concurrency===null?`Not configured`:String(e.concurrency)}),(0,L.jsx)(z,{label:`Capacity`,value:e.maxed?`Maxed`:`Available`})]})]})}function z({label:e,value:t}){return(0,L.jsxs)(`div`,{className:`min-w-0 border-l-2 border-line pl-3`,children:[(0,L.jsx)(`dt`,{className:`text-[11px] font-medium text-faint`,children:e}),(0,L.jsx)(`dd`,{className:`mt-1 break-words font-mono text-sm text-fg`,children:t})]})}function B({queue:e,repository:t,busy:n,run:r}){let[i,o]=(0,T.useState)(`completed`),[s,c]=(0,T.useState)(`0`),[l,u]=(0,T.useState)(`29`),[d,f]=(0,T.useState)(`1000`),[p,m]=(0,T.useState)(null),[v,y]=(0,T.useState)(``),b=H(s,l),x=U(d,0,1e6);return(0,L.jsxs)(`section`,{"aria-labelledby":`queue-telemetry-title`,className:`border-t border-line pt-4 xl:border-t-0`,children:[(0,L.jsx)(`h3`,{id:`queue-telemetry-title`,className:`text-sm font-semibold text-fg`,children:`Durable queue telemetry`}),(0,L.jsx)(`p`,{className:`mt-1 mb-4 text-xs leading-5 text-faint`,children:`Read paged one-minute completion or failure buckets, and bound the lifecycle-event journal.`}),(0,L.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,L.jsx)(_,{label:`Metric`,children:(0,L.jsxs)(h,{name:`queue-sdk-metric-type`,value:i,onChange:e=>o(e.target.value),children:[(0,L.jsx)(`option`,{value:`completed`,children:`Completed`}),(0,L.jsx)(`option`,{value:`failed`,children:`Failed`})]})}),(0,L.jsx)(_,{label:`Start bucket`,children:(0,L.jsx)(g,{name:`queue-sdk-metric-start`,type:`number`,min:0,max:1e4,value:s,onChange:e=>c(e.target.value)})}),(0,L.jsx)(_,{label:`End bucket`,hint:`Use -1 for all remaining buckets`,children:(0,L.jsx)(g,{name:`queue-sdk-metric-end`,type:`number`,min:-1,max:1e4,value:l,onChange:e=>u(e.target.value)})})]}),(0,L.jsx)(a,{className:`mt-3`,size:`sm`,disabled:!b||!!n,onClick:()=>{b&&r(`Reading ${i} metrics`,()=>t.metrics(e,i,b.start,b.end),m)},children:`Read metrics`}),!b&&(0,L.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:`Use integer buckets from 0 to 10000; end must be -1 or at least start.`}),p&&(0,L.jsx)(V,{metrics:p}),(0,L.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-end gap-3 border-t border-line pt-4`,children:[(0,L.jsx)(`div`,{className:`min-w-48 flex-1`,children:(0,L.jsx)(_,{label:`Retain lifecycle events`,hint:`0 clears the queue journal`,children:(0,L.jsx)(g,{name:`queue-sdk-event-retention`,type:`number`,min:0,max:1e6,value:d,onChange:e=>f(e.target.value)})})}),(0,L.jsx)(a,{variant:`warning`,size:`sm`,disabled:x===null||!!n,onClick:()=>{x!==null&&window.confirm(`Retain at most ${x} lifecycle events for queue "${e}"? Older journal events are permanently removed; metric buckets are unchanged.`)&&r(`Trimming lifecycle journal`,()=>t.trimEvents(e,x),e=>y(`${e} lifecycle events removed.`),!0)},children:`Trim journal`})]}),v&&(0,L.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-success`,children:v})]})}function V({metrics:e}){let t=e.data.slice(0,120).map((t,n)=>({timestamp:e.meta.prevTS-n*6e4,value:t,offset:n})),n=Math.max(1,...t.map(e=>e.value));return(0,L.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-2 p-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-1 font-mono text-xs text-muted`,children:[(0,L.jsxs)(`span`,{children:[`Total terminal: `,e.meta.count]}),(0,L.jsxs)(`span`,{children:[`Available buckets: `,e.count]}),(0,L.jsxs)(`span`,{children:[`Latest bucket: `,e.meta.prevCount]})]}),t.length?(0,L.jsx)(`div`,{className:`mt-3 flex h-16 items-end gap-px overflow-hidden`,role:`img`,"aria-label":`${t.length} one-minute metric buckets, newest first`,children:t.map(e=>(0,L.jsx)(`span`,{title:`Bucket ${e.offset}: ${e.value}`,className:`min-w-px flex-1 bg-accent/70`,style:{height:`${Math.max(2,e.value/n*100)}%`}},e.timestamp))}):(0,L.jsx)(`p`,{className:`mt-3 text-xs text-faint`,children:`No buckets in this range.`}),e.data.length>t.length&&(0,L.jsx)(`p`,{className:`mt-2 text-[11px] text-faint`,children:`Showing the first 120 returned buckets.`})]})}function H(e,t){let n=U(e,0,1e4),r=U(t,-1,1e4);return n===null||r===null||r!==-1&&r<n?null:{start:n,end:r}}function U(e,t,n){let r=Number(e);return Number.isSafeInteger(r)&&r>=t&&r<=n?r:null}function ne({queue:e,refreshKey:t=0,repository:n=E,onApplied:r}){let[i,c]=(0,T.useState)(``),[l,u]=(0,T.useState)(null),[d,f]=(0,T.useState)(``),[p,m]=(0,T.useState)(``),h=(0,T.useRef)(!1),v=(0,T.useRef)(0),y=(0,T.useRef)(!0),b=l?.queue===e?l:{queue:e,snapshot:null,loading:!0,error:``};(0,T.useEffect)(()=>(y.current=!0,()=>{y.current=!1,v.current+=1}),[]);let x=(0,T.useCallback)(async()=>{let t=re(i);if(t===null){u(t=>({queue:e,snapshot:t?.queue===e?t.snapshot:null,loading:!1,error:`maxJobs must be a whole number from 0 to 1000000.`}));return}let r=++v.current;u(t=>({queue:e,snapshot:t?.queue===e?t.snapshot:null,loading:!0,error:``}));try{let i=await n.limits(e,t);y.current&&r===v.current&&u({queue:e,snapshot:i,loading:!1,error:``})}catch(t){y.current&&r===v.current&&u({queue:e,snapshot:null,loading:!1,error:W(t)})}},[i,e,n]);(0,T.useEffect)(()=>void x(),[e,t]);let S=(e,t,n,i=!1)=>{h.current||(h.current=!0,f(e),m(``),t().then(e=>{y.current&&(n(e),i&&(r?.(),r||x()))}).catch(e=>{y.current&&m(W(e))}).finally(()=>{h.current=!1,y.current&&f(``)}))};return(0,L.jsxs)(s,{className:`mb-6`,children:[(0,L.jsx)(o,{title:`Queue SDK operations`,action:d?(0,L.jsxs)(`span`,{className:`font-mono text-xs text-accent`,children:[d,`...`]}):void 0}),(0,L.jsx)(`p`,{className:`mb-5 max-w-3xl text-xs leading-5 text-faint`,children:`Live Bunqueue 2.9.0 limit, deduplication, metric, and event-journal contracts. Requests are pinned to the server managed by this control agent.`}),(0,L.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-end gap-3 border-b border-line pb-5`,children:[(0,L.jsx)(`div`,{className:`w-48`,children:(0,L.jsx)(_,{label:`TTL threshold (maxJobs)`,hint:`Optional token-consumption threshold`,children:(0,L.jsx)(g,{name:`queue-sdk-max-jobs`,type:`number`,min:0,max:1e6,step:1,value:i,onChange:e=>c(e.target.value),placeholder:`Not set`})})}),(0,L.jsx)(a,{size:`sm`,disabled:b.loading||!!d,onClick:x,children:`Refresh limits`})]}),(0,L.jsx)(te,{snapshot:b.snapshot,loading:b.loading,error:b.error}),p&&(0,L.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:p}),(0,L.jsxs)(`div`,{className:`mt-6 grid gap-6 xl:grid-cols-[0.8fr_1.2fr]`,children:[(0,L.jsx)(R,{queue:e,repository:n,busy:d,run:S},`${e}:deduplication`),(0,L.jsx)(B,{queue:e,repository:n,busy:d,run:S},`${e}:telemetry`)]})]})}function re(e){if(!e.trim())return;let t=Number(e);return Number.isSafeInteger(t)&&t>=0&&t<=1e6?t:null}var W=e=>e instanceof Error?e.message:String(e),G=[`waiting`,`prioritized`,`active`,`completed`,`failed`,`delayed`,`waiting-children`,`paused`],K=500,q=200,J=K*q;function Y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function X(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function ie(e){return Y(e)&&G.every(t=>X(e[t]))}function Z(e,t){if(!Y(e)||e.ok!==!0||!Array.isArray(e.queues)||!X(e.total)||!X(e.limit)||e.limit<1||!X(e.offset)||e.offset!==t||typeof e.timestamp!=`number`||!Number.isFinite(e.timestamp)||!e.queues.every(e=>Y(e)&&typeof e.name==`string`&&e.name.length>0&&X(e.waiting)&&X(e.delayed)&&X(e.active)&&X(e.dlq)&&typeof e.paused==`boolean`))throw Error(`Malformed /dashboard/queues response.`)}async function Q(){let e=await r.queues(K,0);Z(e,0);let t=e.total;if(t>J)throw Error(`Queue discovery reported ${t} queues, above the safe dashboard limit of ${J}.`);if(e.queues.length!==Math.min(K,t))throw Error(`Incomplete /dashboard/queues page at offset 0: expected ${Math.min(K,t)} queues, received ${e.queues.length}.`);let n=new Map,i=e=>{for(let t of e.queues){if(n.has(t.name))throw Error(`Overlapping /dashboard/queues pages: queue "${t.name}" appeared more than once.`);n.set(t.name,t)}};i(e);let a=e.queues.length,o=1;for(;a<t;){if(o>=q)throw Error(`Queue discovery exceeded the safe limit of ${q} pages.`);let e=await r.queues(K,a);if(Z(e,a),e.total!==t)throw Error(`Queue discovery changed during pagination: total moved from ${t} to ${e.total}. Retry the snapshot.`);let n=Math.min(K,t-a);if(e.queues.length!==n)throw Error(`Incomplete /dashboard/queues page at offset ${a}: expected ${n} queues, received ${e.queues.length}.`);i(e),a+=e.queues.length,o+=1}if(n.size!==t)throw Error(`Incomplete /dashboard/queues snapshot: expected ${t} unique queues, received ${n.size}.`);return{...e,queues:[...n.values()],total:t,limit:K,offset:0}}function ae(e,t){if(!Y(e)||e.ok!==!0||e.name!==t||typeof e.paused!=`boolean`||!ie(e.counts))throw Error(`Malformed queue detail response for "${t}".`)}function $(e){if(!Y(e)||e.ok!==!0||!w(e.config))throw Error(`Malformed /stall-config response.`);return e.config}function oe(e){if(!Y(e)||e.ok!==!0||!S(e.config))throw Error(`Malformed /dlq-config response.`);return e.config}function se(e){if(!Y(e)||e.ok!==!0)throw Error(`Malformed queue action response: expected { ok: true }.`);if(e.count!==void 0){if(!X(e.count))throw Error(`Malformed queue action response: count must be a non-negative integer.`);return e.count}}function ce(e,t){return t.some(t=>t.name===e)?e:t[0]?.name??``}function le(){let[e,t]=(0,T.useState)(``),[n,a]=(0,T.useState)(!1),[o,s]=(0,T.useState)(0),[g,_]=(0,T.useState)(null),S=v(`queue-control:${e}`);(0,T.useEffect)(()=>{a(!1),_(null)},[S.scopeKey]);let{data:w,error:E,loading:D,refetch:O}=i(Q,[],{intervalMs:3e4});(0,T.useEffect)(()=>{w&&t(e=>ce(e,w.queues))},[w]);let{data:k,error:A,loading:j,refetch:M}=i((0,T.useCallback)(async()=>{if(!e)return null;let[t,n,i]=await Promise.all([r.queueDetail(e,!1),r.getStallConfig(e).then($).catch(()=>null),r.getDlqConfig(e).then(oe).catch(()=>null)]);return ae(t,e),{queue:e,detail:t,stall:n,dlq:i}},[e]),[e]),N=!w||w.queues.some(t=>t.name===e),P=k?.queue===e&&N?k:null,F=(t,n,i,o)=>{let c=e;if(!c||i&&!window.confirm(i))return;let l=S.begin(`queue-write`);l&&(a(!0),_(null),(async()=>{try{let e=await r.queuesSummary();if(!l.isCurrent())return;if(!e.some(e=>e.name===c))throw Error(`Queue "${c}" no longer exists`);let i=se(await n());if(!l.isCurrent())return;_({queue:c,ok:!0,text:`${t}${i==null?` ✓`:`: ${i}`}`}),o?.(),s(e=>e+1),await M()}catch(e){l.isCurrent()&&_({queue:c,ok:!1,text:e.message})}finally{l.finish()&&a(!1)}})())};return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(f,{title:`Queue Control`,description:`Full per-queue operations and configuration.`,live:!!e&&!!P?.detail&&!!P.stall&&!!P.dlq&&!A&&!E}),(0,L.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-3`,children:[(0,L.jsx)(`div`,{className:`w-56`,children:(0,L.jsx)(h,{value:e,"aria-label":`Queue`,name:`queue-control-queue`,autoComplete:`off`,onChange:e=>t(e.target.value),children:(w?.queues??[]).map(e=>(0,L.jsx)(`option`,{value:e.name,children:e.name},e.name))})}),P?.detail&&(0,L.jsx)(d,{label:P.detail.paused?`Paused`:`Active`,tone:P.detail.paused?`amber`:`green`}),g?.queue===e&&(0,L.jsx)(`span`,{role:`status`,className:g.ok?`text-xs text-success`:`text-xs text-danger`,children:g.text})]}),E&&(0,L.jsx)(c,{onRetry:O,message:`Could not discover queues — ${E.message}. Retry to choose a queue.`}),A&&P&&(0,L.jsx)(c,{message:`Queue refresh failed — showing the last successful configuration.`,onRetry:M}),A&&!P?(0,L.jsx)(l,{error:A,onRetry:M}):D&&!w&&!e&&!E?(0,L.jsx)(u,{label:`Discovering queues…`}):j&&!P?(0,L.jsx)(u,{}):E&&!e?(0,L.jsx)(`p`,{role:`alert`,className:`text-sm text-warning`,children:`Queue discovery failed. Retry the request above before choosing a queue.`}):P?.detail?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`mb-6 grid grid-cols-2 gap-3 md:grid-cols-4 xl:grid-cols-8`,children:G.map(e=>(0,L.jsx)(m,{label:e,value:p(P.detail.counts[e]),compact:!0},e))}),(0,L.jsx)(x,{queue:e,paused:P.detail.paused,busy:n,run:F},`${e}:lifecycle`),(0,L.jsx)(ee,{queue:e,busy:n,run:F},`${e}:limits`),(0,L.jsx)(ne,{queue:e,refreshKey:o,onApplied:()=>s(e=>e+1)},`${e}:sdk-operations`),(0,L.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[P.stall?(0,L.jsx)(b,{queue:e,config:P.stall,onSaved:async()=>{_({queue:e,ok:!0,text:`Stall config saved ✓`}),await M()}},`${e}:stall`):(0,L.jsx)(C,{title:`Stall detection`,onRetry:M}),P.dlq?(0,L.jsx)(y,{queue:e,config:P.dlq,onSaved:async()=>{_({queue:e,ok:!0,text:`DLQ config saved ✓`}),await M()}},`${e}:dlq`):(0,L.jsx)(C,{title:`DLQ policy`,onRetry:M})]})]}):!A&&(0,L.jsx)(`p`,{className:`text-sm text-faint`,children:w?.queues.length===0?`No queues are available.`:`Select a queue.`})]})}export{le as QueueControl,Q as t};
@@ -1 +0,0 @@
1
- import{i as e,t}from"./cn-zFEt5SO8.js";import{g as n,r,t as i}from"./react-vendor-CvwrP0tU.js";import{t as a}from"./bq-BOfwNIlJ.js";import{t as o}from"./toastStore-B31o6Z5J.js";import{S as s,T as c,b as l,n as u,x as d}from"./icons-BVzwsfbG.js";import{n as f}from"./usePolledData-CNtNtd0a.js";import{n as p,t as m}from"./Button-Ch1W94fJ.js";import{i as h,n as g,r as _}from"./feedback-QDN1AsYt.js";import{t as v}from"./PageHeader-CvIyaFOO.js";import{s as y}from"./format-Cg7VCIZW.js";import{n as b}from"./index-TploGF7u.js";import{t as x}from"./Pagination-x-Cwgrul.js";import{r as S,t as C}from"./useServerActionGuard-Db7PPgaI.js";import{t as w}from"./promisePool-BVfQ9n9Q.js";var T=e(n(),1),E=i(),D=[[`waiting`,`Waiting`],[`prioritized`,`Prioritized`],[`active`,`Active`],[`completed`,`Completed`],[`failed`,`Failed`],[`delayed`,`Delayed`]];function O({rows:e,hasData:n,error:i,search:a,sortCol:o,sortDir:c,bulkBusy:f,busy:m,onSort:h,onToggle:g}){return(0,E.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,E.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,E.jsx)(`thead`,{children:(0,E.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,E.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),D.map(([e,t])=>(0,E.jsx)(`th`,{"aria-sort":o===e?c===`desc`?`descending`:`ascending`:void 0,className:`px-5 py-3 text-right font-medium`,children:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>h(e),className:`inline-flex items-center gap-1 rounded uppercase tracking-wider hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[t,o===e&&(0,E.jsx)(`span`,{"aria-hidden":`true`,children:c===`desc`?`↓`:`↑`})]})},e)),(0,E.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,E.jsx)(`th`,{className:`w-24 px-5 py-3 text-right font-medium`,children:`Actions`})]})}),(0,E.jsx)(`tbody`,{children:!n&&i?(0,E.jsx)(`tr`,{children:(0,E.jsxs)(`td`,{colSpan:9,className:`px-5 py-12 text-center text-sm text-warning`,children:[`Could not load queues — `,i.message,`. Retry above.`]})}):e.length===0?(0,E.jsx)(`tr`,{children:(0,E.jsx)(`td`,{colSpan:9,className:`px-5 py-12 text-center text-sm text-faint`,children:a?`No queues match your search.`:`No queues yet.`})}):e.map(e=>{let n=f||m.has(e.name);return(0,E.jsxs)(`tr`,{className:`group border-b border-line last:border-0 transition-colors hover:bg-surface-2/50`,children:[(0,E.jsx)(`td`,{className:`px-5 py-3`,children:(0,E.jsxs)(r,{to:`/queues/${encodeURIComponent(e.name)}`,className:`flex items-center gap-2 rounded font-medium text-fg hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[(0,E.jsx)(s,{className:`size-4 text-faint`}),e.name]})}),(0,E.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-warning`,children:y(e.counts.waiting)}),(0,E.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-orange-400`,children:y(e.counts.prioritized)}),(0,E.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:y(e.counts.active)}),(0,E.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-success`,children:y(e.counts.completed)}),(0,E.jsx)(`td`,{className:t(`px-5 py-3 text-right tnum`,e.counts.failed?`text-danger`:`text-muted`),children:y(e.counts.failed)}),(0,E.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:y(e.counts.delayed)}),(0,E.jsx)(`td`,{className:`px-5 py-3`,children:(0,E.jsxs)(`span`,{className:t(`inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium`,e.paused?`bg-orange-500/10 text-orange-400`:`bg-emerald-500/10 text-success`),children:[(0,E.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`}),e.paused?`Paused`:`Active`]})}),(0,E.jsx)(`td`,{className:`px-5 py-3`,children:(0,E.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,E.jsx)(p,{"aria-label":e.paused?`Resume queue`:`Pause queue`,disabled:n,onClick:t=>{t.stopPropagation(),g(e)},children:e.paused?(0,E.jsx)(d,{className:`size-3.5 text-success`}):(0,E.jsx)(l,{className:`size-3.5 text-warning`})}),(0,E.jsx)(u,{className:`size-4 text-faint opacity-0 transition-opacity group-hover:opacity-100`})]})})]},e.name)})})]})})}var k=6,A=15;function j(){let[e,n]=(0,T.useState)(``),[r,i]=(0,T.useState)(0),[s,u]=(0,T.useState)(new Set),[p,D]=(0,T.useState)(!1),[j,M]=(0,T.useState)(null),[N,P]=(0,T.useState)(null),[F,I]=(0,T.useState)(`desc`),L=S(`queues-overview`);(0,T.useEffect)(()=>{u(new Set),D(!1),M(null)},[L.scopeKey]);let{data:R,error:z,loading:B,refetch:V}=f(()=>a.queuesSummary(),[]),H=R??[],U=e=>{N===e?F===`desc`?I(`asc`):P(null):(P(e),I(`desc`)),i(0)},W=(0,T.useMemo)(()=>{let t=e.trim().toLowerCase(),n=[...t?H.filter(e=>e.name.toLowerCase().includes(t)):H].sort((e,t)=>e.name.localeCompare(t.name));if(N){let e=F===`desc`?-1:1;n.sort((t,n)=>e*(t.counts[N]-n.counts[N]))}return n},[H,e,N,F]),G=(0,T.useMemo)(()=>H.reduce((e,t)=>(e.waiting+=t.counts.waiting,e.prioritized+=t.counts.prioritized,e.active+=t.counts.active,e.failed+=t.counts.failed,e.paused+=+!!t.paused,e),{waiting:0,prioritized:0,active:0,failed:0,paused:0}),[H]),K=Math.max(1,Math.ceil(W.length/A)),q=Math.min(r,K-1),J=W.slice(q*A,q*A+A),Y=async e=>{let t=L.begin(`queue:${e.name}`);if(t){u(t=>new Set(t).add(e.name)),M(null);try{if(C(await(e.paused?a.resume(e.name):a.pause(e.name)),e.paused?`Resume queue`:`Pause queue`),!t.isCurrent())return;M({ok:!0,text:`${e.name} ${e.paused?`resumed`:`paused`} ✓`}),V()}catch(n){if(!t.isCurrent())return;M({ok:!1,text:n.message}),o.error(`Failed to ${e.paused?`resume`:`pause`} ${e.name}`,n.message)}finally{t.finish()&&u(t=>{let n=new Set(t);return n.delete(e.name),n})}}},X=async e=>{let t=H.filter(t=>e===`pause`?!t.paused:t.paused);if(t.length===0){o.info(`No queues to ${e}`);return}if(!window.confirm(`${e===`pause`?`Pause`:`Resume`} ${t.length} queue(s)?`))return;let n=L.begin([`bulk`,...H.map(e=>`queue:${e.name}`)]);if(n){D(!0),M(null);try{let r=await w(t,k,async t=>{if(!n.isCurrent())throw Error(`Queue action target changed`);C(e===`pause`?await a.pause(t.name):await a.resume(t.name),`${e===`pause`?`Pause`:`Resume`} ${t.name}`)});if(!n.isCurrent())return;let i=r.filter(e=>e.status===`rejected`).length,s=`${e===`pause`?`Paused`:`Resumed`} ${t.length-i}/${t.length} queues${i?`, ${i} failed`:``}`;M({ok:i===0,text:s}),i===0?o.success(s):o.error(s),V()}finally{n.finish()&&D(!1)}}};return B&&!R&&!z?(0,E.jsx)(_,{label:`Loading queues…`}):z&&!R?(0,E.jsxs)(`div`,{children:[(0,E.jsx)(v,{title:`Queues`,description:`Queue inventory unavailable`}),(0,E.jsx)(g,{error:z,onRetry:V})]}):(0,E.jsxs)(`div`,{children:[(0,E.jsx)(v,{title:`Queues`,description:R?`${H.length} queues`:`Queue inventory unavailable`,live:!!R&&!z,actions:H.length>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(m,{variant:`warning`,size:`sm`,disabled:p||s.size>0||G.paused>=H.length,onClick:()=>X(`pause`),children:[(0,E.jsx)(l,{className:`size-3.5`}),` Pause all`]}),(0,E.jsxs)(m,{variant:`success`,size:`sm`,disabled:p||s.size>0||G.paused===0,onClick:()=>X(`resume`),children:[(0,E.jsx)(d,{className:`size-3.5`}),` Resume all`]})]}):void 0}),z&&(0,E.jsx)(h,{message:`Queue refresh failed — showing the last successful inventory.`,onRetry:V}),(0,E.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-5`,children:[(0,E.jsx)(b,{label:`Waiting`,value:y(G.waiting),tone:`amber`,compact:!0}),(0,E.jsx)(b,{label:`Prioritized`,value:y(G.prioritized),tone:`amber`,compact:!0}),(0,E.jsx)(b,{label:`Active`,value:y(G.active),tone:`blue`,compact:!0}),(0,E.jsx)(b,{label:`Failed`,value:y(G.failed),tone:G.failed?`red`:`default`,compact:!0}),(0,E.jsx)(b,{label:`Paused`,value:y(G.paused),tone:G.paused?`amber`:`default`,compact:!0})]}),(0,E.jsxs)(`div`,{className:`relative mb-4 max-w-sm`,children:[(0,E.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,E.jsx)(`input`,{value:e,onChange:e=>{n(e.target.value),i(0)},placeholder:`Search queues…`,"aria-label":`Filter queues`,name:`queue-filter`,autoComplete:`off`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),j&&(0,E.jsx)(`div`,{role:`status`,className:t(`mb-3 text-sm`,j.ok?`text-success`:`text-danger`),children:j.text}),(0,E.jsx)(O,{rows:J,hasData:!!R,error:z,search:e,sortCol:N,sortDir:F,bulkBusy:p,busy:s,onSort:U,onToggle:e=>void Y(e)}),(0,E.jsx)(x,{page:q,pageSize:A,total:W.length,onPageChange:i,label:`queues`})]})}export{j as QueuesOverview};
@@ -1 +0,0 @@
1
- import{i as e}from"./cn-zFEt5SO8.js";import{g as t,t as n}from"./react-vendor-CvwrP0tU.js";import{a as r,o as i,t as a}from"./connectionStore-CFuNYZ_8.js";import{f as o}from"./icons-BVzwsfbG.js";import{n as s,t as c}from"./Button-Ch1W94fJ.js";import{n as l,t as u}from"./Card-CWxrC8OY.js";import{t as d}from"./PageHeader-CvIyaFOO.js";import{o as f}from"./index-TploGF7u.js";import{a as p,n as m,t as h}from"./form-C4oby9pI.js";var g=e(t(),1),_=n(),v=[[`1000`,`1 second`],[`2000`,`2 seconds`],[`3000`,`3 seconds`],[`5000`,`5 seconds`],[`10000`,`10 seconds`]];function y(){let{refreshMs:e,setRefreshMs:t}=i(),{theme:n,setTheme:r}=f();return(0,_.jsxs)(u,{children:[(0,_.jsx)(l,{title:`Appearance & refresh`}),(0,_.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,_.jsx)(h,{label:`Theme`,children:(0,_.jsxs)(p,{name:`theme`,autoComplete:`off`,value:n,onChange:e=>r(e.target.value),children:[(0,_.jsx)(`option`,{value:`dark`,children:`Dark`}),(0,_.jsx)(`option`,{value:`light`,children:`Light`})]})}),(0,_.jsx)(h,{label:`Refresh interval`,children:(0,_.jsx)(p,{name:`refresh-interval`,autoComplete:`off`,value:String(e),onChange:e=>t(Number(e.target.value)),children:v.map(([e,t])=>(0,_.jsx)(`option`,{value:e,children:t},e))})})]})]})}var b=1e4,x=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u;async function S(e,t={},n=b){let r=new AbortController,i=t.signal,a=i?AbortSignal.any([i,r.signal]):r.signal,o=Error(`Connection test timed out after ${Math.ceil(n/1e3)} seconds.`),s,c,l=new Promise((e,t)=>{s=setTimeout(()=>{r.abort(o),t(o)},n)}),u=i?new Promise((e,t)=>{let n=()=>{t(i.reason??new DOMException(`Connection test aborted`,`AbortError`))};i.aborted?n():(i.addEventListener(`abort`,n,{once:!0}),c=()=>i.removeEventListener(`abort`,n))}):null;try{let n=(async()=>{let n=await fetch(e,{...t,signal:a});if(!n.ok&&n.status!==503)throw Error(`HTTP ${n.status}`);let r=await n.json();if(typeof r!=`object`||!r||Array.isArray(r))throw Error(`Malformed health response`);let i=r;if(typeof i.ok!=`boolean`||i.status!==`healthy`&&i.status!==`degraded`||!Number.isSafeInteger(i.uptime)||i.uptime<0||typeof i.version!=`string`||!x.test(i.version)||i.ok!==(i.status===`healthy`))throw Error(`Malformed health response`);return{response:n,health:i}})();return await Promise.race(u?[n,l,u]:[n,l])}catch(e){throw r.signal.aborted&&r.signal.reason===o?o:e}finally{s!==void 0&&clearTimeout(s),c?.()}}function C(){let{baseUrl:e,token:t,agentToken:n,saveConnection:f}=i(),[p,v]=(0,g.useState)(!1),[b,x]=(0,g.useState)(null),[C,w]=(0,g.useState)(e),[T,E]=(0,g.useState)(t),[D,O]=(0,g.useState)(n),[k,A]=(0,g.useState)(!1),[j,M]=(0,g.useState)(!1),[N,P]=(0,g.useState)(null),[F,I]=(0,g.useState)(null),L=(0,g.useRef)(!0),R=(0,g.useRef)(0),z=(0,g.useRef)(null),B=(0,g.useRef)(null),V=(0,g.useCallback)(()=>{B.current!==null&&(clearTimeout(B.current),B.current=null),L.current&&I(null)},[]),H=(0,g.useCallback)(()=>{R.current+=1,z.current?.abort(new DOMException(`Connection test superseded`,`AbortError`)),z.current=null,L.current&&(v(!1),x(null))},[]);return(0,g.useEffect)(()=>(L.current=!0,()=>{L.current=!1,R.current+=1,z.current?.abort(new DOMException(`Settings unmounted`,`AbortError`)),z.current=null,B.current!==null&&(clearTimeout(B.current),B.current=null)}),[]),(0,g.useEffect)(()=>{w(e),E(t),O(n),H()},[n,e,H,t]),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(d,{title:`Settings`,description:`Connection and appearance.`}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,_.jsxs)(u,{children:[(0,_.jsx)(l,{title:`Connection`}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,_.jsx)(h,{label:`Server URL`,children:(0,_.jsx)(m,{name:`server-url`,value:C,onChange:e=>{H(),V(),w(e.target.value),P(null)},placeholder:`/api or https://queue.example.com`,autoComplete:`off`,inputMode:`url`,"aria-invalid":N?!0:void 0,"aria-describedby":N?`server-url-error`:`server-url-help`})}),N&&(0,_.jsx)(`p`,{id:`server-url-error`,className:`-mt-2 text-xs text-danger`,children:N}),(0,_.jsxs)(`p`,{id:`server-url-help`,className:`-mt-2 text-xs text-faint`,children:[`Use `,(0,_.jsx)(`code`,{className:`font-mono`,children:`/api`}),` in dev (proxied to localhost:6790), or the server origin in production.`]}),(0,_.jsx)(h,{label:`Bearer token (optional)`,hint:`Kept in memory only — re-enter after reload. Never bake secrets into VITE_* variables.`,htmlFor:`bearer-token`,children:(0,_.jsxs)(`div`,{className:`relative`,children:[(0,_.jsx)(m,{id:`bearer-token`,name:`bearer-token`,type:k?`text`:`password`,value:T,onChange:e=>{H(),V(),E(e.target.value)},placeholder:`only if AUTH_TOKENS is set`,className:`pr-10`,autoComplete:`off`,spellCheck:!1}),(0,_.jsx)(s,{"aria-label":k?`Hide token`:`Show token`,className:`absolute right-0.5 top-1/2 -translate-y-1/2`,onClick:()=>A(e=>!e),children:(0,_.jsx)(o,{className:`size-4`})})]})}),(0,_.jsx)(h,{label:`Agent token (optional)`,hint:`Only if the control agent runs with AGENT_TOKEN. Kept in memory; re-enter after reload.`,htmlFor:`agent-token`,children:(0,_.jsxs)(`div`,{className:`relative`,children:[(0,_.jsx)(m,{id:`agent-token`,name:`agent-token`,type:j?`text`:`password`,value:D,onChange:e=>{H(),V(),O(e.target.value)},placeholder:`only if AGENT_TOKEN is set`,className:`pr-10`,autoComplete:`off`,spellCheck:!1}),(0,_.jsx)(s,{"aria-label":j?`Hide agent token`:`Show agent token`,className:`absolute right-0.5 top-1/2 -translate-y-1/2`,onClick:()=>M(e=>!e),children:(0,_.jsx)(o,{className:`size-4`})})]})}),(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,_.jsx)(c,{variant:`accent`,onClick:()=>{H();let e=r(C);if(!e){P(a);return}P(null),w(e);let t=f({baseUrl:e,token:T,agentToken:D});V(),I({persisted:t.persisted,message:t.persisted?`Saved ✓`:`Saved for this session only — browser storage unavailable${t.error?`: ${t.error}`:`.`}`}),B.current=setTimeout(()=>{B.current=null,L.current&&I(null)},4e3)},children:`Save`}),(0,_.jsx)(c,{onClick:async()=>{H();let e=r(C);if(!e){P(a),x({ok:!1,msg:a});return}P(null);let t=R.current,n=new AbortController,o=i.getState(),s=()=>{let e=i.getState();return L.current&&t===R.current&&!n.signal.aborted&&e.baseUrl===o.baseUrl&&e.token===o.token&&e.agentToken===o.agentToken};z.current=n,v(!0),x(null);let c=performance.now();try{let{response:t,health:r}=await S(`${e}/health`,{headers:T.trim()?{Authorization:`Bearer ${T.trim()}`}:void 0,signal:n.signal});if(!s())return;let i=Math.round(performance.now()-c),a=t.status===503||r.status===`degraded`;x({ok:!a,msg:`${a?`Server reachable`:`Connected`} in ${i}ms · bunqueue v${r.version}${a?` · degraded`:``}`})}catch(e){if(!s())return;x({ok:!1,msg:e.message})}finally{L.current&&t===R.current&&(z.current=null,v(!1))}},children:p?`Restart test`:`Test connection`}),F&&(0,_.jsx)(`span`,{role:`status`,className:F.persisted?`text-sm text-success`:`text-sm text-warning`,children:F.message}),b&&(0,_.jsx)(`span`,{role:`status`,className:b.ok?`text-sm text-success`:`text-sm text-danger`,children:b.msg})]}),(0,_.jsx)(`p`,{className:`-mt-1 text-xs text-faint`,children:`Test checks the values above as typed. Saving repoints every page at the new server immediately.`})]})]}),(0,_.jsx)(y,{})]})]})}export{C as Settings};