bunqueue-dashboard 0.0.39 → 0.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/agent/backup/resultValidation.ts +1 -1
- package/agent/index.ts +3 -0
- package/agent/manager/config.ts +1 -1
- package/agent/manager/process.ts +2 -2
- package/agent/manager/storageMode.ts +20 -0
- package/agent/manager.ts +1 -1
- package/agent/queue/routes.ts +57 -2
- package/agent/queue/runtime.ts +62 -1
- package/agent/queue/types.ts +31 -0
- package/agent/queue/validation.ts +16 -0
- package/agent/server/controlRoutes.ts +2 -93
- package/agent/server/controlStatus.ts +115 -0
- package/agent/workflows.ts +1 -1
- package/dist/.vite/manifest.json +120 -120
- package/dist/assets/{AddJob-d5KBvmN8.js → AddJob-DkbI_J5p.js} +1 -1
- package/dist/assets/{Alerts-5I44QTnQ.js → Alerts-CFj-u0iV.js} +1 -1
- package/dist/assets/{Benchmark-S1afsQRd.js → Benchmark-Ey2sq57q.js} +1 -1
- package/dist/assets/{BulkAddJobs-BO8LWUHE.js → BulkAddJobs-BwPoeSB6.js} +1 -1
- package/dist/assets/{CopilotPanel-DDkRd35p.js → CopilotPanel-CniuIIPn.js} +1 -1
- package/dist/assets/{Cron-X3Y5uISO.js → Cron-B5XFBvU-.js} +1 -1
- package/dist/assets/{CronManager-ugmYEAwY.js → CronManager-Bdg2BECM.js} +1 -1
- package/dist/assets/{Database-koy8haPX.js → Database-CB0oOEFB.js} +1 -1
- package/dist/assets/{Diagnostics-D6oqvkOs.js → Diagnostics-BDRftXQy.js} +1 -1
- package/dist/assets/{Dlq-D70Lzmsa.js → Dlq-CJO9itzJ.js} +1 -1
- package/dist/assets/{DlqControl-nUT5Zzkl.js → DlqControl-DZL2lHOU.js} +1 -1
- package/dist/assets/{DlqPro-VMuBKgP-.js → DlqPro-OqBlzCnN.js} +1 -1
- package/dist/assets/{Flows-CAG0nDnt.js → Flows-BItJzbVQ.js} +2 -2
- package/dist/assets/{JobInspector-CiS5HOSQ.js → JobInspector-CJHX63p_.js} +2 -2
- package/dist/assets/{Jobs-CkyRvzOT.js → Jobs-BwmTsjJx.js} +1 -1
- package/dist/assets/{JobsPro-B4-CSoq3.js → JobsPro-eFVAZJ10.js} +1 -1
- package/dist/assets/{Logs-DBTz2PTz.js → Logs-CXIf58M4.js} +1 -1
- package/dist/assets/{LogsPro-BCFeegvr.js → LogsPro-Xm6rylAd.js} +1 -1
- package/dist/assets/{McpServer-BKlTR1qr.js → McpServer-Rf3i6lRn.js} +2 -2
- package/dist/assets/{Metrics-Du__9Lbn.js → Metrics-Cj3VYxzL.js} +1 -1
- package/dist/assets/{MetricsPro-CqnaO6YX.js → MetricsPro-C63eY00A.js} +1 -1
- package/dist/assets/{Overview-udSSt7ZB.js → Overview-CUM3XG7A.js} +1 -1
- package/dist/assets/{QueueActions-D7cQrGvJ.js → QueueActions-b19K0vCT.js} +1 -1
- package/dist/assets/QueueControl-DusMoa05.js +1 -0
- package/dist/assets/{QueueDetail-C-ms6bMe.js → QueueDetail-CpFIG1PU.js} +1 -1
- package/dist/assets/{QueueDetailPro-DXEdsZx_.js → QueueDetailPro-BNlBOj5s.js} +1 -1
- package/dist/assets/{Queues-BUMwTVAf.js → Queues-CZ2qc7FY.js} +1 -1
- package/dist/assets/{QueuesOverview-Du8XLgN0.js → QueuesOverview-CBFqQ3N_.js} +1 -1
- package/dist/assets/{S3Backup-CDICSzxM.js → S3Backup-x4mOV-AO.js} +1 -1
- package/dist/assets/{S3BackupPro-CBidbI-s.js → S3BackupPro-BtvbPVg-.js} +3 -3
- package/dist/assets/{ServerControl-CPT0LpsC.js → ServerControl-C5nQ7CCp.js} +2 -2
- package/dist/assets/{Settings-CmxfSX_8.js → Settings-B5kCRSBH.js} +1 -1
- package/dist/assets/{Usage-B895tSxi.js → Usage-UYovs3D-.js} +1 -1
- package/dist/assets/{UsagePro-CASN77iV.js → UsagePro-bT82DS-d.js} +1 -1
- package/dist/assets/{Webhooks-CXbZOFFw.js → Webhooks-BjsUMJAn.js} +1 -1
- package/dist/assets/{Workers-BceQlUhX.js → Workers-CD4YZpca.js} +1 -1
- package/dist/assets/{WorkersPro-Dtml89jB.js → WorkersPro-hCPhfb1Z.js} +1 -1
- package/dist/assets/{Workflows-B8wmQN2X.js → Workflows-DOpeo-TP.js} +1 -1
- package/dist/assets/{api-81m1TwB7.js → api-BxYPEynh.js} +1 -1
- package/dist/assets/bq-C7wdABtE.js +1 -0
- package/dist/assets/{flowMutationSafety-6cP-l4Pa.js → flowMutationSafety-DSd3JLAV.js} +1 -1
- package/dist/assets/{index-TploGF7u.js → index-AUHH2nTG.js} +3 -3
- package/dist/assets/{index-B-QjN7pA.css → index-BK7fjWKK.css} +1 -1
- package/dist/assets/{install-BPp8nydm.js → install-C5y2ohOo.js} +2 -2
- package/dist/assets/{responses-C9lP49qu.js → responses-DiIfPXXq.js} +1 -1
- package/dist/assets/{upstreamPaths-ZeijhPPb.js → upstreamPaths-B_cyinGI.js} +1 -1
- package/dist/assets/{useThroughputSeries-_J7gWbcI.js → useThroughputSeries-y7Yyi7Zh.js} +1 -1
- package/dist/index.html +5 -5
- package/package.json +10 -7
- package/scripts/bunVersion.ts +10 -0
- package/scripts/embedded.gen.ts +148 -148
- package/scripts/serve.ts +3 -0
- package/dist/assets/QueueControl-BF638r_0.js +0 -1
- package/dist/assets/bq-BOfwNIlJ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./cn-zFEt5SO8.js";import{g as t}from"./react-vendor-CvwrP0tU.js";import{o as n}from"./connectionStore-CFuNYZ_8.js";import{t as r}from"./bq-
|
|
1
|
+
import{i as e}from"./cn-zFEt5SO8.js";import{g as t}from"./react-vendor-CvwrP0tU.js";import{o as n}from"./connectionStore-CFuNYZ_8.js";import{t as r}from"./bq-C7wdABtE.js";import{t as i}from"./usePolledData-CNtNtd0a.js";var a=e(t(),1),o=1e3,s={push:[],complete:[],fail:[],depth:[]},c=()=>typeof performance<`u`?performance.now():Date.now(),l=(e,t)=>`${e}\u0000${t}`;function u(e=60){let t=l(n(e=>e.baseUrl),n(e=>e.token)),[u,d]=(0,a.useState)(s),[f,p]=(0,a.useState)(null),[m,h]=(0,a.useState)(null),g=(0,a.useRef)(0),_=(0,a.useRef)(0),v=(0,a.useRef)(t),y=v.current===t;return(0,a.useEffect)(()=>{let n=++g.current,a=new AbortController,l=!1;v.current!==t&&(v.current=t,d(s),p(null),h(null),_.current=0);let u=i(()=>globalThis.document?.hidden??!1),f=async()=>{if(l||!u())return;l=!0;let t=c();try{let[i,c]=await Promise.all([r.overview({signal:a.signal}),r.stats({signal:a.signal})]);if(a.signal.aborted||g.current!==n)return;let l=i?.stats,u=i?.throughput,f=c?.stats;if(!l||!u||!f)throw Error(`malformed telemetry body`);if(![l.waiting,l.active,l.delayed,l.completed,l.dlq,l.totalPushed,l.totalPulled,l.totalCompleted,l.totalFailed,l.uptime,u.pushPerSec,u.completePerSec,u.failPerSec,f.waiting,f.prioritized,f.active,f.delayed,f[`waiting-children`]].every(e=>typeof e==`number`&&Number.isFinite(e)))throw Error(`malformed telemetry numeric metrics`);let m=u.pushPerSec,v=u.completePerSec,y=u.failPerSec,b=f.waiting+f.prioritized+f.active+f.delayed+f[`waiting-children`],x=_.current>0&&t-_.current>4*o;_.current=t,p(i),h(null),d(t=>{let n=x?s:t;return{push:[...n.push,m].slice(-e),complete:[...n.complete,v].slice(-e),fail:[...n.fail,y].slice(-e),depth:[...n.depth,b].slice(-e)}})}catch(e){!a.signal.aborted&&g.current===n&&h(e)}finally{l=!1}};f();let m=setInterval(f,o);return()=>{clearInterval(m),a.abort(),g.current===n&&(g.current+=1)}},[e,t]),y?{...u,latest:f,error:m}:{...s,latest:null,error:null}}function d(e,t=o){if(e.length<2)return{slope:0,label:`steady`,draining:!1};let n=e.length,r=(n-1)/2,i=e.reduce((e,t)=>e+t,0)/n,a=0,s=0;for(let t=0;t<n;t++)a+=(t-r)*(e[t]-i),s+=(t-r)**2;let c=s===0?0:a/s,l=t>0?o/t*c:c,u=l<-.05;return{slope:l,label:u?`draining`:l>.05?`accumulating`:`steady`,draining:u}}export{u as n,d as t};
|
package/dist/index.html
CHANGED
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
content="Fully drive a bunqueue server from one UI: queues, jobs, DLQ, cron, webhooks, workers, and start/stop/restart. Live demo, no signup."
|
|
50
50
|
/>
|
|
51
51
|
<meta name="twitter:image" content="https://egeominotti.github.io/bunqueue-dashboard/og.png" />
|
|
52
|
-
<script type="module" crossorigin src="./assets/index-
|
|
52
|
+
<script type="module" crossorigin src="./assets/index-AUHH2nTG.js"></script>
|
|
53
53
|
<link rel="modulepreload" crossorigin href="./assets/cn-zFEt5SO8.js">
|
|
54
54
|
<link rel="modulepreload" crossorigin href="./assets/react-vendor-CvwrP0tU.js">
|
|
55
55
|
<link rel="modulepreload" crossorigin href="./assets/connectionStore-CFuNYZ_8.js">
|
|
56
|
-
<link rel="modulepreload" crossorigin href="./assets/upstreamPaths-
|
|
57
|
-
<link rel="modulepreload" crossorigin href="./assets/bq-
|
|
56
|
+
<link rel="modulepreload" crossorigin href="./assets/upstreamPaths-B_cyinGI.js">
|
|
57
|
+
<link rel="modulepreload" crossorigin href="./assets/bq-C7wdABtE.js">
|
|
58
58
|
<link rel="modulepreload" crossorigin href="./assets/toastStore-B31o6Z5J.js">
|
|
59
59
|
<link rel="modulepreload" crossorigin href="./assets/icons-BVzwsfbG.js">
|
|
60
|
-
<link rel="modulepreload" crossorigin href="./assets/api-
|
|
60
|
+
<link rel="modulepreload" crossorigin href="./assets/api-BxYPEynh.js">
|
|
61
61
|
<link rel="modulepreload" crossorigin href="./assets/usePolledData-CNtNtd0a.js">
|
|
62
62
|
<link rel="modulepreload" crossorigin href="./assets/Button-Ch1W94fJ.js">
|
|
63
63
|
<link rel="modulepreload" crossorigin href="./assets/Card-CWxrC8OY.js">
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
<link rel="modulepreload" crossorigin href="./assets/StatusBadge-BoOVTnKu.js">
|
|
66
66
|
<link rel="modulepreload" crossorigin href="./assets/PageHeader-CvIyaFOO.js">
|
|
67
67
|
<link rel="modulepreload" crossorigin href="./assets/format-Cg7VCIZW.js">
|
|
68
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
68
|
+
<link rel="stylesheet" crossorigin href="./assets/index-BK7fjWKK.css">
|
|
69
69
|
</head>
|
|
70
70
|
<body>
|
|
71
71
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bunqueue-dashboard",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Web dashboard for a bunqueue server (queues, jobs, DLQ, cron, metrics, workers, live activity). Run with `bunx bunqueue-dashboard` (requires Bun).",
|
|
5
|
+
"description": "Web dashboard for a bunqueue server (queues, jobs, DLQ, cron, metrics, workers, live activity). Run with `bunx bunqueue-dashboard` (requires Bun 1.4.0).",
|
|
6
|
+
"packageManager": "bun@1.4.0",
|
|
6
7
|
"bin": {
|
|
7
8
|
"bunqueue-dashboard": "scripts/serve.ts"
|
|
8
9
|
},
|
|
@@ -11,6 +12,7 @@
|
|
|
11
12
|
"scripts/serve.ts",
|
|
12
13
|
"scripts/serveHandler.ts",
|
|
13
14
|
"scripts/servePolicy.ts",
|
|
15
|
+
"scripts/bunVersion.ts",
|
|
14
16
|
"scripts/embedded.gen.ts",
|
|
15
17
|
"agent"
|
|
16
18
|
],
|
|
@@ -45,10 +47,10 @@
|
|
|
45
47
|
"react"
|
|
46
48
|
],
|
|
47
49
|
"engines": {
|
|
48
|
-
"bun": "
|
|
50
|
+
"bun": "1.4.0"
|
|
49
51
|
},
|
|
50
52
|
"scripts": {
|
|
51
|
-
"prepack": "bun run build && bun scripts/gen-embed.ts",
|
|
53
|
+
"prepack": "bun run version:check && bun run build && bun scripts/gen-embed.ts",
|
|
52
54
|
"start": "bun run scripts/dev.ts",
|
|
53
55
|
"dev": "vite",
|
|
54
56
|
"agent": "bun run agent/index.ts",
|
|
@@ -56,6 +58,7 @@
|
|
|
56
58
|
"typecheck": "tsc --noEmit && bun run typecheck:agent",
|
|
57
59
|
"typecheck:agent": "tsc -p tsconfig.agent.json",
|
|
58
60
|
"size": "bun run scripts/check-bundle.ts",
|
|
61
|
+
"version:check": "bun run scripts/check-bun-version.ts",
|
|
59
62
|
"architecture": "bun run scripts/check-file-size.ts",
|
|
60
63
|
"docs:dev": "vitepress dev docs",
|
|
61
64
|
"docs:build": "bun run scripts/build-docs.ts",
|
|
@@ -79,7 +82,7 @@
|
|
|
79
82
|
"check": "bun run lint && bun run format:check",
|
|
80
83
|
"check:fix": "bun run lint:fix && bun run format",
|
|
81
84
|
"audit:high": "bun audit --audit-level=high --ignore=GHSA-qwww-vcr4-c8h2",
|
|
82
|
-
"quality": "bun run architecture && bun run check && bun run build && bun run size && bun run docs:build && bun run test:coverage && bun run test:e2e && bun run test:package && bun run audit:high"
|
|
85
|
+
"quality": "bun run version:check && bun run architecture && bun run check && bun run build && bun run size && bun run docs:build && bun run test:coverage && bun run test:e2e && bun run test:package && bun run audit:high"
|
|
83
86
|
},
|
|
84
87
|
"devDependencies": {
|
|
85
88
|
"@ai-sdk/anthropic": "^4.0.7",
|
|
@@ -97,7 +100,7 @@
|
|
|
97
100
|
"@types/react-dom": "^19.2.3",
|
|
98
101
|
"@vitejs/plugin-react": "^6.0.3",
|
|
99
102
|
"ai": "^7.0.14",
|
|
100
|
-
"bun-types": "
|
|
103
|
+
"bun-types": "1.4.0",
|
|
101
104
|
"happy-dom": "^20.10.6",
|
|
102
105
|
"mermaid": "^11.16.0",
|
|
103
106
|
"oxfmt": "^0.63.0",
|
|
@@ -123,7 +126,7 @@
|
|
|
123
126
|
"postcss": "^8.5.25"
|
|
124
127
|
},
|
|
125
128
|
"dependencies": {
|
|
126
|
-
"bunqueue": "2.9.
|
|
129
|
+
"bunqueue": "2.9.2",
|
|
127
130
|
"msgpackr": "^1.11.8"
|
|
128
131
|
}
|
|
129
132
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const REQUIRED_BUN_VERSION = '1.4.0';
|
|
2
|
+
|
|
3
|
+
export function assertRequiredBunVersion(version = Bun.version): void {
|
|
4
|
+
if (version !== REQUIRED_BUN_VERSION) {
|
|
5
|
+
throw new Error(
|
|
6
|
+
`bunqueue-dashboard requires Bun ${REQUIRED_BUN_VERSION}; received ${version}. ` +
|
|
7
|
+
'Install the version pinned in .bun-version.'
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
}
|
package/scripts/embedded.gen.ts
CHANGED
|
@@ -3,165 +3,165 @@
|
|
|
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/
|
|
7
|
-
import f4 from "../dist/assets/
|
|
8
|
-
import f5 from "../dist/assets/
|
|
9
|
-
import f6 from "../dist/assets/
|
|
10
|
-
import f7 from "../dist/assets/
|
|
11
|
-
import f8 from "../dist/assets/
|
|
12
|
-
import f9 from "../dist/assets/
|
|
13
|
-
import f10 from "../dist/assets/
|
|
14
|
-
import f11 from "../dist/assets/
|
|
15
|
-
import f12 from "../dist/assets/
|
|
16
|
-
import f13 from "../dist/assets/
|
|
17
|
-
import f14 from "../dist/assets/
|
|
18
|
-
import f15 from "../dist/assets/
|
|
19
|
-
import f16 from "../dist/assets/
|
|
20
|
-
import f17 from "../dist/assets/
|
|
21
|
-
import f18 from "../dist/assets/
|
|
22
|
-
import f19 from "../dist/assets/
|
|
23
|
-
import f20 from "../dist/assets/
|
|
24
|
-
import f21 from "../dist/assets/
|
|
25
|
-
import f22 from "../dist/assets/
|
|
26
|
-
import f23 from "../dist/assets/
|
|
27
|
-
import f24 from "../dist/assets/
|
|
6
|
+
import f3 from "../dist/assets/Metrics-Cj3VYxzL.js" with { type: 'file' };
|
|
7
|
+
import f4 from "../dist/assets/Workflows-DOpeo-TP.js" with { type: 'file' };
|
|
8
|
+
import f5 from "../dist/assets/Logs-CXIf58M4.js" with { type: 'file' };
|
|
9
|
+
import f6 from "../dist/assets/useServerActionGuard-Db7PPgaI.js" with { type: 'file' };
|
|
10
|
+
import f7 from "../dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2" with { type: 'file' };
|
|
11
|
+
import f8 from "../dist/assets/icons-BVzwsfbG.js" with { type: 'file' };
|
|
12
|
+
import f9 from "../dist/assets/feedback-QDN1AsYt.js" with { type: 'file' };
|
|
13
|
+
import f10 from "../dist/assets/MetricsPro-C63eY00A.js" with { type: 'file' };
|
|
14
|
+
import f11 from "../dist/assets/react-vendor-CvwrP0tU.js" with { type: 'file' };
|
|
15
|
+
import f12 from "../dist/assets/bq-C7wdABtE.js" with { type: 'file' };
|
|
16
|
+
import f13 from "../dist/assets/Queues-CZ2qc7FY.js" with { type: 'file' };
|
|
17
|
+
import f14 from "../dist/assets/S3Backup-x4mOV-AO.js" with { type: 'file' };
|
|
18
|
+
import f15 from "../dist/assets/usePolledData-CNtNtd0a.js" with { type: 'file' };
|
|
19
|
+
import f16 from "../dist/assets/StatusBadge-BoOVTnKu.js" with { type: 'file' };
|
|
20
|
+
import f17 from "../dist/assets/Button-Ch1W94fJ.js" with { type: 'file' };
|
|
21
|
+
import f18 from "../dist/assets/exportFile-C7xhE8Yh.js" with { type: 'file' };
|
|
22
|
+
import f19 from "../dist/assets/api-BxYPEynh.js" with { type: 'file' };
|
|
23
|
+
import f20 from "../dist/assets/McpServer-Rf3i6lRn.js" with { type: 'file' };
|
|
24
|
+
import f21 from "../dist/assets/dist-DjvZiKhB.js" with { type: 'file' };
|
|
25
|
+
import f22 from "../dist/assets/toastStore-B31o6Z5J.js" with { type: 'file' };
|
|
26
|
+
import f23 from "../dist/assets/WorkersPro-hCPhfb1Z.js" with { type: 'file' };
|
|
27
|
+
import f24 from "../dist/assets/UsagePro-bT82DS-d.js" with { type: 'file' };
|
|
28
28
|
import f25 from "../dist/assets/useControlActionGuard-DT7uudrj.js" with { type: 'file' };
|
|
29
29
|
import f26 from "../dist/assets/controlConnectionEpoch-DzbuWOhe.js" with { type: 'file' };
|
|
30
|
-
import f27 from "../dist/assets/
|
|
31
|
-
import f28 from "../dist/assets/
|
|
32
|
-
import f29 from "../dist/assets/
|
|
33
|
-
import f30 from "../dist/assets/
|
|
34
|
-
import f31 from "../dist/assets/
|
|
35
|
-
import f32 from "../dist/assets/
|
|
36
|
-
import f33 from "../dist/assets/
|
|
37
|
-
import f34 from "../dist/assets/
|
|
38
|
-
import f35 from "../dist/assets/responses-
|
|
39
|
-
import f36 from "../dist/assets/
|
|
40
|
-
import f37 from "../dist/assets/
|
|
30
|
+
import f27 from "../dist/assets/index-BK7fjWKK.css" with { type: 'file' };
|
|
31
|
+
import f28 from "../dist/assets/Dlq-CJO9itzJ.js" with { type: 'file' };
|
|
32
|
+
import f29 from "../dist/assets/S3BackupPro-BtvbPVg-.js" with { type: 'file' };
|
|
33
|
+
import f30 from "../dist/assets/Usage-UYovs3D-.js" with { type: 'file' };
|
|
34
|
+
import f31 from "../dist/assets/Settings-B5kCRSBH.js" with { type: 'file' };
|
|
35
|
+
import f32 from "../dist/assets/upstreamPaths-B_cyinGI.js" with { type: 'file' };
|
|
36
|
+
import f33 from "../dist/assets/form-C4oby9pI.js" with { type: 'file' };
|
|
37
|
+
import f34 from "../dist/assets/Flows-BItJzbVQ.js" with { type: 'file' };
|
|
38
|
+
import f35 from "../dist/assets/responses-DiIfPXXq.js" with { type: 'file' };
|
|
39
|
+
import f36 from "../dist/assets/BulkAddJobs-BwPoeSB6.js" with { type: 'file' };
|
|
40
|
+
import f37 from "../dist/assets/AreaChart-DEAalJ6P.js" with { type: 'file' };
|
|
41
41
|
import f38 from "../dist/assets/Pagination-x-Cwgrul.js" with { type: 'file' };
|
|
42
|
-
import f39 from "../dist/assets/
|
|
43
|
-
import f40 from "../dist/assets/
|
|
44
|
-
import f41 from "../dist/assets/
|
|
45
|
-
import f42 from "../dist/assets/
|
|
46
|
-
import f43 from "../dist/assets/
|
|
47
|
-
import f44 from "../dist/assets/
|
|
48
|
-
import f45 from "../dist/assets/
|
|
49
|
-
import f46 from "../dist/assets/
|
|
50
|
-
import f47 from "../dist/assets/
|
|
51
|
-
import f48 from "../dist/assets/
|
|
52
|
-
import f49 from "../dist/assets/
|
|
53
|
-
import f50 from "../dist/assets/
|
|
54
|
-
import f51 from "../dist/assets/
|
|
55
|
-
import f52 from "../dist/assets/
|
|
56
|
-
import f53 from "../dist/assets/
|
|
57
|
-
import f54 from "../dist/assets/
|
|
58
|
-
import f55 from "../dist/assets/
|
|
59
|
-
import f56 from "../dist/assets/
|
|
60
|
-
import f57 from "../dist/assets/
|
|
61
|
-
import f58 from "../dist/assets/
|
|
62
|
-
import f59 from "../dist/assets/
|
|
63
|
-
import f60 from "../dist/assets/
|
|
64
|
-
import f61 from "../dist/assets/
|
|
65
|
-
import f62 from "../dist/assets/
|
|
66
|
-
import f63 from "../dist/assets/
|
|
67
|
-
import f64 from "../dist/assets/
|
|
68
|
-
import f65 from "../dist/assets/
|
|
69
|
-
import f66 from "../dist/assets/
|
|
70
|
-
import f67 from "../dist/assets/
|
|
71
|
-
import f68 from "../dist/assets/
|
|
72
|
-
import f69 from "../dist/assets/
|
|
73
|
-
import f70 from "../dist/assets/
|
|
74
|
-
import f71 from "../dist/assets/
|
|
75
|
-
import f72 from "../dist/assets/
|
|
76
|
-
import f73 from "../dist/assets/
|
|
77
|
-
import f74 from "../dist/assets/
|
|
78
|
-
import f75 from "../dist/assets/
|
|
79
|
-
import f76 from "../dist/assets/
|
|
80
|
-
import f77 from "../dist/assets/
|
|
81
|
-
import f78 from "../dist/assets/
|
|
82
|
-
import f79 from "../dist/assets/
|
|
42
|
+
import f39 from "../dist/assets/CronManager-Bdg2BECM.js" with { type: 'file' };
|
|
43
|
+
import f40 from "../dist/assets/Jobs-BwmTsjJx.js" with { type: 'file' };
|
|
44
|
+
import f41 from "../dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2" with { type: 'file' };
|
|
45
|
+
import f42 from "../dist/assets/Workers-CD4YZpca.js" with { type: 'file' };
|
|
46
|
+
import f43 from "../dist/assets/QueueControl-DusMoa05.js" with { type: 'file' };
|
|
47
|
+
import f44 from "../dist/assets/Alerts-CFj-u0iV.js" with { type: 'file' };
|
|
48
|
+
import f45 from "../dist/assets/Database-CB0oOEFB.js" with { type: 'file' };
|
|
49
|
+
import f46 from "../dist/assets/ServerControl-C5nQ7CCp.js" with { type: 'file' };
|
|
50
|
+
import f47 from "../dist/assets/dist-DpZcbP9W.js" with { type: 'file' };
|
|
51
|
+
import f48 from "../dist/assets/cn-zFEt5SO8.js" with { type: 'file' };
|
|
52
|
+
import f49 from "../dist/assets/QueuesOverview-CBFqQ3N_.js" with { type: 'file' };
|
|
53
|
+
import f50 from "../dist/assets/PageHeader-CvIyaFOO.js" with { type: 'file' };
|
|
54
|
+
import f51 from "../dist/assets/DlqPro-OqBlzCnN.js" with { type: 'file' };
|
|
55
|
+
import f52 from "../dist/assets/install-C5y2ohOo.js" with { type: 'file' };
|
|
56
|
+
import f53 from "../dist/assets/Overview-CUM3XG7A.js" with { type: 'file' };
|
|
57
|
+
import f54 from "../dist/assets/AddJob-DkbI_J5p.js" with { type: 'file' };
|
|
58
|
+
import f55 from "../dist/assets/connectionStore-CFuNYZ_8.js" with { type: 'file' };
|
|
59
|
+
import f56 from "../dist/assets/QueueDetailPro-BNlBOj5s.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/JobInspector-CJHX63p_.js" with { type: 'file' };
|
|
63
|
+
import f60 from "../dist/assets/dist-1f1fMHVO.js" with { type: 'file' };
|
|
64
|
+
import f61 from "../dist/assets/promisePool-BVfQ9n9Q.js" with { type: 'file' };
|
|
65
|
+
import f62 from "../dist/assets/CopilotPanel-CniuIIPn.js" with { type: 'file' };
|
|
66
|
+
import f63 from "../dist/assets/DlqControl-DZL2lHOU.js" with { type: 'file' };
|
|
67
|
+
import f64 from "../dist/assets/Benchmark-Ey2sq57q.js" with { type: 'file' };
|
|
68
|
+
import f65 from "../dist/assets/index-AUHH2nTG.js" with { type: 'file' };
|
|
69
|
+
import f66 from "../dist/assets/Diagnostics-BDRftXQy.js" with { type: 'file' };
|
|
70
|
+
import f67 from "../dist/assets/QueueActions-b19K0vCT.js" with { type: 'file' };
|
|
71
|
+
import f68 from "../dist/assets/JobsPro-eFVAZJ10.js" with { type: 'file' };
|
|
72
|
+
import f69 from "../dist/assets/Card-CWxrC8OY.js" with { type: 'file' };
|
|
73
|
+
import f70 from "../dist/assets/useThroughputSeries-y7Yyi7Zh.js" with { type: 'file' };
|
|
74
|
+
import f71 from "../dist/assets/LogsPro-Xm6rylAd.js" with { type: 'file' };
|
|
75
|
+
import f72 from "../dist/assets/dist-BlWBaCN6.js" with { type: 'file' };
|
|
76
|
+
import f73 from "../dist/assets/Cron-B5XFBvU-.js" with { type: 'file' };
|
|
77
|
+
import f74 from "../dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2" with { type: 'file' };
|
|
78
|
+
import f75 from "../dist/assets/jobActions-LQD4KfCc.js" with { type: 'file' };
|
|
79
|
+
import f76 from "../dist/assets/dist-DZL8soAh.js" with { type: 'file' };
|
|
80
|
+
import f77 from "../dist/assets/flowMutationSafety-DSd3JLAV.js" with { type: 'file' };
|
|
81
|
+
import f78 from "../dist/assets/Webhooks-BjsUMJAn.js" with { type: 'file' };
|
|
82
|
+
import f79 from "../dist/assets/QueueDetail-CpFIG1PU.js" with { type: 'file' };
|
|
83
83
|
import f80 from "../dist/.vite/manifest.json" with { type: 'file' };
|
|
84
84
|
|
|
85
85
|
export const ASSETS: Record<string, string> = {
|
|
86
86
|
"/index.html": f0,
|
|
87
87
|
"/favicon.svg": f1,
|
|
88
88
|
"/og.png": f2,
|
|
89
|
-
"/assets/
|
|
90
|
-
"/assets/
|
|
91
|
-
"/assets/
|
|
92
|
-
"/assets/
|
|
93
|
-
"/assets/
|
|
94
|
-
"/assets/
|
|
95
|
-
"/assets/
|
|
96
|
-
"/assets/
|
|
97
|
-
"/assets/
|
|
98
|
-
"/assets/
|
|
99
|
-
"/assets/
|
|
100
|
-
"/assets/
|
|
101
|
-
"/assets/
|
|
102
|
-
"/assets/
|
|
103
|
-
"/assets/
|
|
104
|
-
"/assets/
|
|
105
|
-
"/assets/
|
|
106
|
-
"/assets/
|
|
107
|
-
"/assets/
|
|
108
|
-
"/assets/
|
|
109
|
-
"/assets/
|
|
110
|
-
"/assets/
|
|
89
|
+
"/assets/Metrics-Cj3VYxzL.js": f3,
|
|
90
|
+
"/assets/Workflows-DOpeo-TP.js": f4,
|
|
91
|
+
"/assets/Logs-CXIf58M4.js": f5,
|
|
92
|
+
"/assets/useServerActionGuard-Db7PPgaI.js": f6,
|
|
93
|
+
"/assets/inter-latin-wght-normal-Dx4kXJAl.woff2": f7,
|
|
94
|
+
"/assets/icons-BVzwsfbG.js": f8,
|
|
95
|
+
"/assets/feedback-QDN1AsYt.js": f9,
|
|
96
|
+
"/assets/MetricsPro-C63eY00A.js": f10,
|
|
97
|
+
"/assets/react-vendor-CvwrP0tU.js": f11,
|
|
98
|
+
"/assets/bq-C7wdABtE.js": f12,
|
|
99
|
+
"/assets/Queues-CZ2qc7FY.js": f13,
|
|
100
|
+
"/assets/S3Backup-x4mOV-AO.js": f14,
|
|
101
|
+
"/assets/usePolledData-CNtNtd0a.js": f15,
|
|
102
|
+
"/assets/StatusBadge-BoOVTnKu.js": f16,
|
|
103
|
+
"/assets/Button-Ch1W94fJ.js": f17,
|
|
104
|
+
"/assets/exportFile-C7xhE8Yh.js": f18,
|
|
105
|
+
"/assets/api-BxYPEynh.js": f19,
|
|
106
|
+
"/assets/McpServer-Rf3i6lRn.js": f20,
|
|
107
|
+
"/assets/dist-DjvZiKhB.js": f21,
|
|
108
|
+
"/assets/toastStore-B31o6Z5J.js": f22,
|
|
109
|
+
"/assets/WorkersPro-hCPhfb1Z.js": f23,
|
|
110
|
+
"/assets/UsagePro-bT82DS-d.js": f24,
|
|
111
111
|
"/assets/useControlActionGuard-DT7uudrj.js": f25,
|
|
112
112
|
"/assets/controlConnectionEpoch-DzbuWOhe.js": f26,
|
|
113
|
-
"/assets/
|
|
114
|
-
"/assets/
|
|
115
|
-
"/assets/
|
|
116
|
-
"/assets/
|
|
117
|
-
"/assets/
|
|
118
|
-
"/assets/
|
|
119
|
-
"/assets/
|
|
120
|
-
"/assets/
|
|
121
|
-
"/assets/responses-
|
|
122
|
-
"/assets/
|
|
123
|
-
"/assets/
|
|
113
|
+
"/assets/index-BK7fjWKK.css": f27,
|
|
114
|
+
"/assets/Dlq-CJO9itzJ.js": f28,
|
|
115
|
+
"/assets/S3BackupPro-BtvbPVg-.js": f29,
|
|
116
|
+
"/assets/Usage-UYovs3D-.js": f30,
|
|
117
|
+
"/assets/Settings-B5kCRSBH.js": f31,
|
|
118
|
+
"/assets/upstreamPaths-B_cyinGI.js": f32,
|
|
119
|
+
"/assets/form-C4oby9pI.js": f33,
|
|
120
|
+
"/assets/Flows-BItJzbVQ.js": f34,
|
|
121
|
+
"/assets/responses-DiIfPXXq.js": f35,
|
|
122
|
+
"/assets/BulkAddJobs-BwPoeSB6.js": f36,
|
|
123
|
+
"/assets/AreaChart-DEAalJ6P.js": f37,
|
|
124
124
|
"/assets/Pagination-x-Cwgrul.js": f38,
|
|
125
|
-
"/assets/
|
|
126
|
-
"/assets/
|
|
127
|
-
"/assets/
|
|
128
|
-
"/assets/
|
|
129
|
-
"/assets/
|
|
130
|
-
"/assets/
|
|
131
|
-
"/assets/
|
|
132
|
-
"/assets/
|
|
133
|
-
"/assets/
|
|
134
|
-
"/assets/
|
|
135
|
-
"/assets/
|
|
136
|
-
"/assets/
|
|
137
|
-
"/assets/
|
|
138
|
-
"/assets/
|
|
139
|
-
"/assets/
|
|
140
|
-
"/assets/
|
|
141
|
-
"/assets/
|
|
142
|
-
"/assets/
|
|
143
|
-
"/assets/
|
|
144
|
-
"/assets/
|
|
145
|
-
"/assets/
|
|
146
|
-
"/assets/
|
|
147
|
-
"/assets/
|
|
148
|
-
"/assets/
|
|
149
|
-
"/assets/
|
|
150
|
-
"/assets/
|
|
151
|
-
"/assets/
|
|
152
|
-
"/assets/
|
|
153
|
-
"/assets/
|
|
154
|
-
"/assets/
|
|
155
|
-
"/assets/
|
|
156
|
-
"/assets/
|
|
157
|
-
"/assets/
|
|
158
|
-
"/assets/
|
|
159
|
-
"/assets/
|
|
160
|
-
"/assets/
|
|
161
|
-
"/assets/
|
|
162
|
-
"/assets/
|
|
163
|
-
"/assets/
|
|
164
|
-
"/assets/
|
|
165
|
-
"/assets/
|
|
125
|
+
"/assets/CronManager-Bdg2BECM.js": f39,
|
|
126
|
+
"/assets/Jobs-BwmTsjJx.js": f40,
|
|
127
|
+
"/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2": f41,
|
|
128
|
+
"/assets/Workers-CD4YZpca.js": f42,
|
|
129
|
+
"/assets/QueueControl-DusMoa05.js": f43,
|
|
130
|
+
"/assets/Alerts-CFj-u0iV.js": f44,
|
|
131
|
+
"/assets/Database-CB0oOEFB.js": f45,
|
|
132
|
+
"/assets/ServerControl-C5nQ7CCp.js": f46,
|
|
133
|
+
"/assets/dist-DpZcbP9W.js": f47,
|
|
134
|
+
"/assets/cn-zFEt5SO8.js": f48,
|
|
135
|
+
"/assets/QueuesOverview-CBFqQ3N_.js": f49,
|
|
136
|
+
"/assets/PageHeader-CvIyaFOO.js": f50,
|
|
137
|
+
"/assets/DlqPro-OqBlzCnN.js": f51,
|
|
138
|
+
"/assets/install-C5y2ohOo.js": f52,
|
|
139
|
+
"/assets/Overview-CUM3XG7A.js": f53,
|
|
140
|
+
"/assets/AddJob-DkbI_J5p.js": f54,
|
|
141
|
+
"/assets/connectionStore-CFuNYZ_8.js": f55,
|
|
142
|
+
"/assets/QueueDetailPro-BNlBOj5s.js": f56,
|
|
143
|
+
"/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2": f57,
|
|
144
|
+
"/assets/format-Cg7VCIZW.js": f58,
|
|
145
|
+
"/assets/JobInspector-CJHX63p_.js": f59,
|
|
146
|
+
"/assets/dist-1f1fMHVO.js": f60,
|
|
147
|
+
"/assets/promisePool-BVfQ9n9Q.js": f61,
|
|
148
|
+
"/assets/CopilotPanel-CniuIIPn.js": f62,
|
|
149
|
+
"/assets/DlqControl-DZL2lHOU.js": f63,
|
|
150
|
+
"/assets/Benchmark-Ey2sq57q.js": f64,
|
|
151
|
+
"/assets/index-AUHH2nTG.js": f65,
|
|
152
|
+
"/assets/Diagnostics-BDRftXQy.js": f66,
|
|
153
|
+
"/assets/QueueActions-b19K0vCT.js": f67,
|
|
154
|
+
"/assets/JobsPro-eFVAZJ10.js": f68,
|
|
155
|
+
"/assets/Card-CWxrC8OY.js": f69,
|
|
156
|
+
"/assets/useThroughputSeries-y7Yyi7Zh.js": f70,
|
|
157
|
+
"/assets/LogsPro-Xm6rylAd.js": f71,
|
|
158
|
+
"/assets/dist-BlWBaCN6.js": f72,
|
|
159
|
+
"/assets/Cron-B5XFBvU-.js": f73,
|
|
160
|
+
"/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2": f74,
|
|
161
|
+
"/assets/jobActions-LQD4KfCc.js": f75,
|
|
162
|
+
"/assets/dist-DZL8soAh.js": f76,
|
|
163
|
+
"/assets/flowMutationSafety-DSd3JLAV.js": f77,
|
|
164
|
+
"/assets/Webhooks-BjsUMJAn.js": f78,
|
|
165
|
+
"/assets/QueueDetail-CpFIG1PU.js": f79,
|
|
166
166
|
"/.vite/manifest.json": f80,
|
|
167
167
|
};
|
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 +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{a as e,i as t,n,r}from"./connectionStore-CFuNYZ_8.js";import{a as i,i as a,n as o,r as s,s as c}from"./upstreamPaths-ZeijhPPb.js";var l=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`BqError`}},u=3e4,d=()=>u;async function f(e,t,n,r,i=!0,a=`server`,o=[],s=u){let c=AbortSignal.timeout(s),d=r?.signal?AbortSignal.any([r.signal,c]):c,f=new Headers(n);r?.headers&&new Headers(r.headers).forEach((e,t)=>{f.set(t,e)}),r?.body!=null&&!f.has(`Content-Type`)&&f.set(`Content-Type`,`application/json`);let p;try{p=await fetch(e+t,{...r,headers:f,signal:d})}catch(e){throw c.aborted&&!r?.signal?.aborted||e?.name===`TimeoutError`?new l(`Request timed out`,0):e}if(!p.ok&&!o.includes(p.status)){let t=`HTTP ${p.status}`;try{let e=await p.json();e?.error&&(t=e.error)}catch{}throw p.status===401&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(`auth:required`,{detail:{scope:a,auth:f.get(`Authorization`)??void 0,target:e}})),new l(t,p.status)}if(p.status===204)return;let m;try{m=await p.text()}catch(e){throw c.aborted&&!r?.signal?.aborted?new l(`Request timed out`,0):e}if(!m)return;let h;try{h=JSON.parse(m)}catch{throw new l(`Invalid JSON response (HTTP ${p.status})`,p.status)}if(i&&h&&typeof h==`object`&&h.ok===!1)throw new l(h.error??`Operation failed`,p.status);return h}var p=(e,n,i=!0,a=[],o=u)=>f(t(),e,r(),n,i,`server`,a,o);function m(t,n){return e(t)??e(n)??`http://localhost:6800`}function h(){try{return globalThis.__BUNQUEUE_AGENT_URL__}catch{return}}var g=m(h(),void 0),ee=()=>g,_=(e,t,r=u)=>f(g,e,n(),t,!0,`agent`,[],r),v=(e,t)=>({method:e,body:t===void 0?void 0:JSON.stringify(t)}),y=3e5,b=(e,t)=>v(e,t),x=new WeakMap,te=new WeakMap;function S(){let e=Object.freeze({baseUrl:t()});return x.set(e,Object.freeze({...r()})),e}function C(){let e=Object.freeze({baseUrl:g});return te.set(e,Object.freeze({...n()})),e}function w(e){let t=x.get(e);if(!t)throw TypeError(`Invalid server request target.`);return t}function T(e){let t=te.get(e);if(!t)throw TypeError(`Invalid agent request target.`);return t}function ne(e,t){let n=Object.entries(e);return n.length===Object.keys(t).length&&n.every(([e,n])=>t[e]===n)}function re(e){let n=w(e);if(e.baseUrl!==t()||!ne(n,r()))throw Error(`Server connection changed after confirmation was requested for ${e.baseUrl}; action refused.`)}async function E(e,t,n){n?.throwIfAborted();let r=await f(e.baseUrl,`/jobs/${i(t)}`,{...w(e)},n?{signal:n}:void 0);return n?.throwIfAborted(),r}var D=encodeURIComponent,ie={info:()=>_(`/db/info`),tables:()=>_(`/db/tables`),schema:e=>_(`/db/tables/${o(e,`Database table`)}/schema`),rows:(e,t=50,n=0,r,i=`asc`,a)=>_(`/db/tables/${o(e,`Database table`)}?limit=${t}&offset=${n}${r?`&orderBy=${D(r)}&dir=${i}`:``}${a?.value?`&fcol=${D(a.column)}&fop=${a.op}&fval=${D(a.value)}`:``}`),cell:(e,t,n)=>_(`/db/tables/${o(e,`Database table`)}/cell?rowid=${D(String(t))}&column=${D(n)}`),query:e=>_(`/db/query`,v(`POST`,{sql:e}))},ae={status:()=>_(`/control/status`),start:()=>_(`/control/start`,{method:`POST`}),stop:()=>_(`/control/stop`,{method:`POST`}),restart:()=>_(`/control/restart`,{method:`POST`}),logs:()=>_(`/control/logs`),getConfig:()=>_(`/control/config`),setConfig:(e,t)=>_(`/control/config`,v(`PUT`,{...e,...t===void 0?{}:{expectedRevision:t}}))},oe={stats:()=>_(`/workflows/stats`),list:(e={})=>{let t=new URLSearchParams;return e.kind&&t.set(`kind`,e.kind),e.workflowName&&t.set(`workflowName`,e.workflowName),e.state&&t.set(`state`,e.state),e.limit!==void 0&&t.set(`limit`,String(e.limit)),e.offset!==void 0&&t.set(`offset`,String(e.offset)),_(`/workflows${t.size?`?${t}`:``}`)},get:(e,t=`active`)=>_(`/workflows/${o(e,`Workflow execution id`)}?kind=${t}`)},se=2e5,O=16*1024*1024,ce=12e4,le=64*1024,k=encodeURIComponent;async function ue(e,t,n=50,r=0,i,a=`asc`,s,c){c?.throwIfAborted();let l=await f(e.baseUrl,`/db/tables/${o(t,`Database table`)}?limit=${n}&offset=${r}${i?`&orderBy=${k(i)}&dir=${a}`:``}${s?.value?`&fcol=${k(s.column)}&fop=${s.op}&fval=${k(s.value)}`:``}`,{...T(e)},c?{signal:c}:void 0,!0,`agent`);return c?.throwIfAborted(),l}function A(e,t,n,r=!0){let i=e.get(t);if(!i||!/^\d+$/.test(i))throw new l(`Malformed database export response: invalid ${t} header.`,200);let a=Number(i);if(!Number.isSafeInteger(a)||a>n||!r&&a===0)throw new l(`Malformed database export response: invalid ${t} header.`,200);return a}async function de(e){if(!e.body)return``;let t=e.body.getReader(),n=new Uint8Array(le),r=0;try{for(;;){let e=await t.read();if(e.done)break;if(r+e.value.byteLength>n.byteLength)return t.cancel().catch(()=>void 0),``;n.set(e.value,r),r+=e.value.byteLength}}finally{t.releaseLock()}return new TextDecoder().decode(n.subarray(0,r))}async function fe(e,t,n){if(!e.body)throw new l(`Malformed database export response: missing CSV body.`,200);let r=new Uint8Array(t),i=e.body.getReader(),a=0;try{for(;;){n?.throwIfAborted();let e=await i.read();if(e.done)break;if(a+e.value.byteLength>t)throw i.cancel().catch(()=>void 0),new l(`Malformed database export response: body exceeds declared ${t} bytes.`,200);r.set(e.value,a),a+=e.value.byteLength}}finally{i.releaseLock()}if(n?.throwIfAborted(),a!==t)throw new l(`Malformed database export response: received ${a} of ${t} declared bytes.`,200);return r}function pe(e){if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`Invalid database export request.`);if(typeof e.table!=`string`||!e.table)throw TypeError(`Database export table must not be empty.`);if(e.dir!==`asc`&&e.dir!==`desc`)throw TypeError(`Invalid database export sort direction.`);if(e.orderBy!==void 0&&(typeof e.orderBy!=`string`||!e.orderBy))throw TypeError(`Database export sort column must not be empty.`);let t=e.filter;if(t&&(typeof t!=`object`||Array.isArray(t)||typeof t.column!=`string`||!t.column||typeof t.value!=`string`||!t.value||![`contains`,`eq`,`ne`].includes(t.op)))throw TypeError(`Invalid database export filter.`);return Object.freeze({table:e.table,orderBy:e.orderBy,dir:e.dir,filter:t?Object.freeze({...t}):void 0})}async function me(e,t,n){e.status===401&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(`auth:required`,{detail:{scope:`agent`,auth:new Headers(n).get(`Authorization`)??void 0,target:t.baseUrl}}));let r=`HTTP ${e.status}`,i=await de(e);if(i)try{let e=JSON.parse(i);typeof e?.error==`string`&&(r=e.error)}catch{}return new l(r,e.status)}async function he(e,t,n){n?.throwIfAborted();let r={...T(e)},i=pe(t),a=new URLSearchParams;i.orderBy&&a.set(`orderBy`,i.orderBy),a.set(`dir`,i.dir),i.filter&&(a.set(`fcol`,i.filter.column),a.set(`fop`,i.filter.op),a.set(`fval`,i.filter.value));let s=`/db/tables/${o(i.table,`Database table`)}/export?${a}`,c=AbortSignal.timeout(ce),u=n?AbortSignal.any([n,c]):c;try{let t=await fetch(e.baseUrl+s,{headers:r,signal:u});if(!t.ok)throw await me(t,e,r);if(t.headers.get(`X-Bunqueue-Db-Export-Version`)!==`1`)throw new l(`Malformed database export response: unsupported contract version.`,200);if(!/^text\/csv(?:;|$)/i.test(t.headers.get(`Content-Type`)??``))throw new l(`Malformed database export response: expected CSV content.`,200);let a;try{let e=t.headers.get(`X-Bunqueue-Db-Export-Table`);if(!e)throw Error(`missing`);a=decodeURIComponent(e)}catch{throw new l(`Malformed database export response: invalid table identity.`,200)}if(a!==i.table)throw new l(`Database export target changed: requested "${i.table}", received "${a}".`,200);let o=A(t.headers,`X-Bunqueue-Db-Export-Rows`,se),c=A(t.headers,`X-Bunqueue-Db-Export-Bytes`,O,!1);if(A(t.headers,`Content-Length`,16777216,!1)!==c)throw new l(`Malformed database export response: Content-Length does not match X-Bunqueue-Db-Export-Bytes.`,200);let d=t.headers.get(`X-Bunqueue-Db-Export-Cap`);if(d!==`none`&&d!==`rows`&&d!==`bytes`)throw new l(`Malformed database export response: invalid export cap.`,200);if(d===`rows`&&o!==2e5)throw new l(`Malformed database export response: inconsistent row cap.`,200);let f=await fe(t,c,u);return n?.throwIfAborted(),{table:a,content:f,rowCount:o,bytes:c,cap:d===`none`?null:d}}catch(e){throw c.aborted&&!n?.aborted?new l(`Database export timed out`,0):e}}var ge={counts:e=>p(`/queues/${c(e)}/counts`),pause:e=>p(`/queues/${c(e)}/pause`,v(`POST`)),resume:e=>p(`/queues/${c(e)}/resume`,v(`POST`)),drain:e=>p(`/queues/${c(e)}/drain`,b(`POST`),!0,[],y),obliterate:e=>p(`/queues/${c(e)}/obliterate`,b(`POST`),!0,[],y),clean:(e,t={})=>p(`/queues/${c(e)}/clean`,v(`POST`,t)),promoteJobs:(e,t)=>p(`/queues/${c(e)}/promote-jobs`,v(`POST`,t==null?void 0:{count:t})),retryCompleted:(e,t)=>{throw TypeError(`Completed-job requeue is unavailable in Bunqueue v2.9.0 because flow dependency registration is not rebuilt.`)},setRateLimit:(e,t,n,r)=>p(`/queues/${c(e)}/rate-limit`,v(`PUT`,{limit:t,...n===void 0?{}:{duration:n},...r===void 0?{}:{ttl:r}})),clearRateLimit:e=>p(`/queues/${c(e)}/rate-limit`,{method:`DELETE`}),setConcurrency:(e,t)=>p(`/queues/${c(e)}/concurrency`,v(`PUT`,{concurrency:t})),clearConcurrency:e=>p(`/queues/${c(e)}/concurrency`,{method:`DELETE`}),getStallConfig:e=>p(`/queues/${c(e)}/stall-config`),setStallConfig:(e,t)=>p(`/queues/${c(e)}/stall-config`,v(`PUT`,{config:t})),getDlqConfig:e=>p(`/queues/${c(e)}/dlq-config`),setDlqConfig:(e,t)=>{if(t.autoRetry===!0)throw TypeError(`DLQ auto-retry is unavailable: Bunqueue v2.9.0 does not rebuild flow dependency registration.`);if(t.maxAge!==void 0||t.maxEntries!==void 0)throw TypeError(`DLQ retention is read-only: maxAge/maxEntries can destructively expire or evict flow jobs without an atomic dependency check.`);return p(`/queues/${c(e)}/dlq-config`,v(`PUT`,{config:t}))},dlq:(e,t=100,n=0)=>p(`/queues/${c(e)}/dlq?limit=${t}&offset=${n}`),dlqStats:e=>p(`/queues/${c(e)}/dlq/stats`),retryDlq:(e,t)=>{throw TypeError(`DLQ retry is unavailable in Bunqueue v2.9.0 because the endpoint has no atomic job-generation, state, or flow-topology precondition.`)},purgeDlq:e=>p(`/queues/${c(e)}/dlq/purge`,v(`POST`))},j=()=>encodeURIComponent(t()),_e={limits:(e,t)=>{let n=t===void 0?``:`&maxJobs=${t}`;return _(`/queue-operations/${c(e)}/limits?target=${j()}${n}`)},deduplicationJobId:(e,n)=>_(`/queue-operations/${c(e)}/deduplication?${new URLSearchParams({target:t(),deduplicationId:n})}`),removeDeduplicationKey:(e,t)=>_(`/queue-operations/${c(e)}/deduplication/remove?target=${j()}`,v(`POST`,{deduplicationId:t})),metrics:(e,n,r,i)=>_(`/queue-operations/${c(e)}/metrics?${new URLSearchParams({target:t(),type:n,start:String(r),end:String(i)})}`),trimEvents:(e,t)=>_(`/queue-operations/${c(e)}/events/trim?target=${j()}`,v(`POST`,{maxLength:t}))},M=1e4,ve=1e3,ye=864e13,be=new Set([`job.pushed`,`job.started`,`job.completed`,`job.failed`,`job.progress`,`job.stalled`]);function N(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function P(e,t,n=!1){if(typeof e!=`string`||e.length>t||!n&&e.length===0)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return!1}return!0}function F(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function xe(e){return typeof e==`number`&&Number.isFinite(e)}function I(e){return F(e)&&e<=ye}function Se(e,t){return e===null||P(e,t)}function Ce(e,t,n){if(!Array.isArray(e)||e.length>t)return!1;let r=new Set;for(let t of e){if(!P(t,n)||r.has(t))return!1;r.add(t)}return!0}function L(e,t){let n=N(e),r=n&&N(n.data);if(n?.ok!==!0||!r)throw Error(`Malformed ${t} response.`);return r}function R(e){if(!Array.isArray(e))throw Error(`Malformed queue summary response.`);let t=new Set,n=[];for(let r of e){let e=N(r),i=e&&N(e.counts);if(!e||!P(e.name,256)||t.has(e.name)||typeof e.paused!=`boolean`||!i||!F(i.waiting)||!F(i.prioritized)||!F(i.active)||!F(i.completed)||!F(i.failed)||!F(i.delayed))throw Error(`Malformed queue summary response.`);t.add(e.name),n.push(r)}return n}function z(e){let t=L(e,`workers`);if(!Array.isArray(t.workers)||t.workers.length>M)throw Error(`Malformed workers response.`);let n=new Set,r=[],i=[];for(let e=0;e<t.workers.length;e++){let a=t.workers[e],o=N(a),s=o&&typeof o.id==`string`?o.id:null,c=[];if(o?(P(o.id,1024)?n.has(o.id)&&c.push(`duplicate id`):c.push(`id`),P(o.name,512,!0)||c.push(`name`),Ce(o.queues,ve,256)||c.push(`queues`),(!F(o.concurrency)||o.concurrency<1)&&c.push(`concurrency`),P(o.hostname,512,!0)||c.push(`hostname`),F(o.pid)||c.push(`pid`),o.status!==`active`&&o.status!==`stale`&&c.push(`status`),I(o.registeredAt)||c.push(`registeredAt`),I(o.lastSeen)||c.push(`lastSeen`),F(o.activeJobs)||c.push(`activeJobs`),F(o.processedJobs)||c.push(`processedJobs`),F(o.failedJobs)||c.push(`failedJobs`),Se(o.currentJob,1024)||c.push(`currentJob`),xe(o.uptime)||c.push(`uptime`)):c.push(`entry is not an object`),s&&n.add(s),c.length>0){i.push({index:e,id:s,reason:c.join(`, `)});continue}r.push(a)}return{ok:!0,data:{workers:r,quarantinedWorkers:i,...Object.hasOwn(t,`stats`)?{stats:t.stats}:{}}}}function we(e){if(!P(e,2048))return!1;try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function Te(e){let t=L(e,`webhooks`);if(!Array.isArray(t.webhooks)||t.webhooks.length>M)throw Error(`Malformed webhooks response.`);let n=new Set,r=[];for(let e of t.webhooks){let t=N(e);if(!t||!P(t.id,1024)||n.has(t.id)||!we(t.url)||!Array.isArray(t.events)||!t.events.every(e=>be.has(e))||!(t.queue===null||typeof t.queue==`string`)||!I(t.createdAt)||!(t.lastTriggered===null||I(t.lastTriggered))||!F(t.successCount)||!F(t.failureCount)||typeof t.enabled!=`boolean`)throw Error(`Malformed webhooks response.`);n.add(t.id),r.push(e)}return{ok:!0,data:{webhooks:r,...Object.hasOwn(t,`stats`)?{stats:t.stats}:{}}}}var Ee={crons:()=>p(`/crons`),createCron:e=>p(`/crons`,v(`POST`,e)),deleteCron:e=>p(`/crons/${o(e,`Cron name`,256)}`,{method:`DELETE`}),webhooks:async()=>Te(await p(`/webhooks`)),addWebhook:e=>p(`/webhooks`,v(`POST`,e)),removeWebhook:e=>p(`/webhooks/${i(e)}`,{method:`DELETE`}),setWebhookEnabled:(e,t)=>p(`/webhooks/${i(e)}/enabled`,v(`PUT`,{enabled:t})),workers:async()=>z(await p(`/workers`)),unregisterWorker:e=>p(`/workers/${i(e)}`,{method:`DELETE`}),eventsUrl:e=>t()+(e?`/events/queues/${s(e)}`:`/events`)},B=365*24*60*60*1e3,V=64*1024*1024,H=1e4,De=[`childrenIds`,`parentId`,`failParentOnFailure`,`removeDependencyOnFailure`,`continueParentOnFailure`,`ignoreDependencyOnFailure`,`keepLogs`,`sizeLimit`,`debounceId`,`debounceTtl`];function U(e){if(e===void 0)return;if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`Repeat must be an object with a positive "every" interval`);let t=Object.keys(e).filter(e=>e!==`every`&&e!==`limit`);if(t.length)throw TypeError(`Unsupported repeat option(s): ${t.join(`, `)}. bunqueue v2.9.0 pattern repeats are unsafe; use the Cron API instead.`);if(!Number.isSafeInteger(e.every)||e.every<1||e.every>B)throw TypeError(`Repeat "every" must be a whole number from 1 to ${B} ms`);if(e.limit!==void 0&&(!Number.isSafeInteger(e.limit)||e.limit<1))throw TypeError(`Repeat "limit" must be a whole number of at least 1`)}function W(e){if(e!==void 0&&(typeof e!=`string`||!e||e.length>256))throw TypeError(`Job name must be a non-empty string of at most 256 characters`)}function G(e){let t=e,n=De.filter(e=>t[e]!==void 0);if(n.length)throw TypeError(`Unsupported Bunqueue v2.9.0 enqueue option(s): ${n.join(`, `)}. Flow topology must use the atomic flow API; inert compatibility fields are not sent.`)}function K(e,t){let n=a(t);if(n)throw TypeError(`${e}: ${n}. The job would not be manageable through v2.9.0 HTTP.`)}function Oe(e){if(W(e.name),U(e.repeat),G(e),e.dependsOn!==void 0&&(!Array.isArray(e.dependsOn)||!e.dependsOn.every(e=>typeof e==`string`)))throw TypeError(`dependsOn must be an array of job ID strings`);e.jobId!==void 0&&K(`jobId`,e.jobId);for(let t of e.dependsOn??[])K(`dependsOn`,t)}function ke(e){let t;try{t=JSON.stringify(e)}catch{throw TypeError(`Job payload must be JSON serializable`)}if(t===void 0)throw TypeError(`Job payload must be JSON serializable`);let n;try{n=JSON.parse(t)}catch{throw TypeError(`Job payload encoding failed`)}if(typeof n!=`object`||!n||Array.isArray(n))throw TypeError(`Job payload must serialize to a JSON object`);return Oe(n),t}function Ae({jobId:e,...t}){return e===void 0?t:{...t,customId:e}}function je(e){let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`must serialize to a JSON object`);let n=t;if(n.jobId!==void 0)throw TypeError(`serialized jobId is invalid; the bulk transport requires customId`);if(W(n.name),U(n.repeat),G(n),n.customId!==void 0){if(typeof n.customId!=`string`)throw TypeError(`customId must be a string`);K(`customId`,n.customId)}if(n.dependsOn!==void 0){if(!Array.isArray(n.dependsOn)||!n.dependsOn.every(e=>typeof e==`string`))throw TypeError(`dependsOn must be an array of job ID strings`);for(let e of n.dependsOn)K(`dependsOn`,e)}}function Me(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i<=127?n+=1:i<=2047?n+=2:i>=55296&&i<=56319&&r+1<e.length&&e.charCodeAt(r+1)>=56320&&e.charCodeAt(r+1)<=57343?(n+=4,r+=1):n+=3,n>t)return n}return n}function q(e,t,n){if(!Array.isArray(e)||e.length>1e4)return{ok:!1,error:`Bulk request must contain at most ${H} jobs`};if(!Number.isSafeInteger(t)||t<0)return{ok:!1,error:`Bulk request payload limit is invalid`};let r=11,i=n?Array(e.length):null;for(let a=0;a<e.length;a++){if(a&&(r+=1),r>t)return{ok:!1,error:`Bulk request payload exceeds the 64 MiB UTF-8 safety limit`};let o;try{o=JSON.stringify(Ae(e[a]))}catch{return{ok:!1,error:`Bulk request payload must be JSON serializable`}}if(o===void 0)return{ok:!1,error:`Bulk request payload must be JSON serializable`};if(r+=Me(o,t-r),r>t)return{ok:!1,error:`Bulk request payload exceeds the 64 MiB UTF-8 safety limit`};if(n)try{je(o)}catch(e){return{ok:!1,error:`Bulk job ${a+1}: ${e instanceof Error?e.message:String(e)}`}}i&&(i[a]=o)}return{ok:!0,bytes:r,body:i?`{"jobs":[${i.join(`,`)}]}`:void 0}}function Ne(e,t=V){let n=q(e,t,!1);return n.ok?null:n.error}function J(e){let t=q(e,V,!0);if(!t.ok)throw TypeError(t.error);if(t.body===void 0)throw TypeError(`Bulk request payload encoding failed`);return t.body}function Y(e){if(!Array.isArray(e)||e.length>1e4)throw TypeError(`Bulk request must contain at most ${H} jobs`)}var Pe={overview:e=>p(`/dashboard`,e),queues:(e=500,t=0)=>p(`/dashboard/queues?limit=${e}&offset=${t}`),queuesSummary:async()=>R(await p(`/queues/summary`)),queueDetail:(e,t=!0)=>p(`/dashboard/queues/${c(e)}?includeJobs=${t}`),stats:e=>p(`/stats`,e),storage:()=>p(`/storage`,void 0,!1),health:()=>p(`/health`,void 0,!1,[503]),ping:()=>p(`/ping`),prometheusUrl:()=>`${t()}/prometheus`,gc:()=>p(`/gc`,v(`POST`)),heapStats:()=>p(`/heapstats`)},Fe={jobsList:(e,t,n=50,r=0)=>{let i=new URLSearchParams;return t?.length&&i.set(`states`,t.join(`,`)),i.set(`limit`,String(n)),i.set(`offset`,String(r)),p(`/queues/${c(e)}/jobs/list?${i}`)},job:e=>p(`/jobs/${i(e)}`),jobByCustomId:e=>p(`/jobs/custom/${o(e,`Custom job ID`)}`),jobResult:e=>p(`/jobs/${i(e)}/result`),jobLogs:e=>p(`/jobs/${i(e)}/logs`),jobChildren:e=>p(`/jobs/${i(e)}/children`),addJob:async(e,t)=>p(`/queues/${c(e)}/jobs`,{method:`POST`,body:ke(t)}),addJobsBulk:async(e,t)=>(Y(t),p(`/queues/${c(e)}/jobs/bulk`,{method:`POST`,body:J(t)},!0,[],y)),pullBatch:(e,t)=>p(`/queues/${c(e)}/jobs/pull-batch`,v(`POST`,{count:t})),ackBatch:e=>p(`/jobs/ack-batch`,v(`POST`,{ids:e})),cancelJob:e=>p(`/jobs/${i(e)}`,{method:`DELETE`}),promoteJob:e=>p(`/jobs/${i(e)}/promote`,v(`POST`)),discardJob:e=>p(`/jobs/${i(e)}/discard`,v(`POST`)),retryJob:e=>p(`/jobs/${i(e)}/move-to-wait`,v(`POST`)),failJob:(e,t,n={})=>p(`/jobs/${i(e)}/fail`,v(`POST`,{error:t,...n})),updateJobData:(e,t)=>p(`/jobs/${i(e)}/data`,v(`PUT`,{data:t})),changePriority:(e,t,n)=>p(`/jobs/${i(e)}/priority`,v(`PUT`,{priority:t,...n===void 0?{}:{lifo:n}})),changeDelay:(e,t)=>p(`/jobs/${i(e)}/delay`,v(`PUT`,{delay:t})),moveToDelayed:(e,t)=>p(`/jobs/${i(e)}/move-to-delayed`,v(`POST`,{delay:t})),addJobLog:(e,t,n)=>p(`/jobs/${i(e)}/logs`,v(`POST`,{message:t,level:n})),clearJobLogs:e=>p(`/jobs/${i(e)}/logs`,{method:`DELETE`}),setJobProgress:(e,t,n)=>p(`/jobs/${i(e)}/progress`,v(`POST`,{progress:t,message:n}))};function X(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw new l(`Malformed ${t} response.`,200);return e}function Z(e,t){let n=X(e,t);if(n.ok!==!0)throw new l(`Malformed ${t} response.`,200);return n}var Q=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0;function $(e,t){if(e!==void 0)return Z(e,t)}function Ie(e,t){let n={...w(e)},r=(r,i,a=d())=>{let o=t?{...i,signal:i?.signal?AbortSignal.any([i.signal,t]):t}:i;return f(e.baseUrl,r,n,o,!0,`server`,[],a)};return Object.freeze({queuesSummary:async()=>R(await r(`/queues/summary`)),overview:()=>r(`/dashboard`),counts:async e=>{let t=X(Z(await r(`/queues/${c(e)}/counts`),`queue counts`).counts,`queue counts`);if(!Object.values(t).every(Q))throw new l(`Malformed queue counts response.`,200);return{ok:!0,counts:t}},jobsList:async(e,t,n=50,i=0)=>{let a=new URLSearchParams;t?.length&&a.set(`states`,t.join(`,`)),a.set(`limit`,String(n)),a.set(`offset`,String(i));let o=Z(await r(`/queues/${c(e)}/jobs/list?${a}`),`jobs list`);if(!Array.isArray(o.jobs)||!o.jobs.every(t=>{let n=t;return typeof n==`object`&&!!n&&!Array.isArray(n)&&typeof n.id==`string`&&n.id.length>0&&(n.queue===void 0||n.queue===e)}))throw new l(`Malformed jobs list response.`,200);return{ok:!0,jobs:o.jobs}},job:async e=>{let t=X(Z(await r(`/jobs/${i(e)}`),`job`).job,`job`);if(t.id!==e)throw new l(`Malformed job response.`,200);return{ok:!0,job:t}},dlqStats:async e=>{let t=X(Z(await r(`/queues/${c(e)}/dlq/stats`),`DLQ stats`).stats,`DLQ stats`);if(!Q(t.total))throw new l(`Malformed DLQ stats response.`,200);return{ok:!0,stats:t}},dlq:async(e,t=100,n=0)=>{let i=Z(await r(`/queues/${c(e)}/dlq?limit=${t}&offset=${n}`),`DLQ list`);if(!Array.isArray(i.entries)||!Q(i.total))throw new l(`Malformed DLQ list response.`,200);for(let e of i.entries){let t=X(X(e,`DLQ list`).job,`DLQ list`);if(typeof t.id!=`string`||!t.id)throw new l(`Malformed DLQ list response.`,200)}return{ok:!0,entries:i.entries,total:i.total}},health:async()=>X(await f(e.baseUrl,`/health`,n,t?{signal:t}:void 0,!1,`server`,[503]),`health`),stats:async()=>{let e=await r(`/stats`);return X(Z(e,`server stats`).stats,`server stats`),e},workers:async()=>z(await r(`/workers`)),crons:async()=>{let e=Z(await r(`/crons`),`crons`);if(!Array.isArray(e.crons)||!e.crons.every(e=>{let t=e;return typeof t==`object`&&!!t&&!Array.isArray(t)&&typeof t.name==`string`&&!!t.name&&typeof t.queue==`string`&&!!t.queue}))throw new l(`Malformed crons response.`,200);return{ok:!0,crons:e.crons}},addJobsBulk:async(e,t)=>(Y(t),r(`/queues/${c(e)}/jobs/bulk`,{method:`POST`,body:J(t)},y)),pullBatch:(e,t)=>r(`/queues/${c(e)}/jobs/pull-batch`,v(`POST`,{count:t})),heartbeatBatch:e=>r(`/jobs/heartbeat-batch`,v(`POST`,{ids:e})),ackBatch:e=>r(`/jobs/ack-batch`,v(`POST`,{ids:e})),retryJob:e=>r(`/jobs/${i(e)}/move-to-wait`,v(`POST`)),promoteJob:async e=>$(await r(`/jobs/${i(e)}/promote`,v(`POST`)),`promote job`),pause:async e=>$(await r(`/queues/${c(e)}/pause`,v(`POST`)),`pause queue`),resume:async e=>$(await r(`/queues/${c(e)}/resume`,v(`POST`)),`resume queue`),clean:(e,t={})=>r(`/queues/${c(e)}/clean`,v(`POST`,t))})}var Le={...Pe,captureServerRequestTarget:S,createServerTargetClient:Ie,getJobAtTarget:E,captureAgentRequestTarget:C,getDbRowsAtTarget:ue,getDbExportAtTarget:he,...Fe,...ge,queueOperations:_e,...Ee,db:ie,get agentBase(){return ee()},control:ae,workflows:oe};Object.defineProperty(Le,"agentBase",{configurable:!1});export{l as a,re as c,S as d,E as f,O as i,f as l,Ie as n,T as o,Ne as r,_ as s,Le as t,C as u};
|