@zintrust/workers 0.1.54 → 0.4.3

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 (38) hide show
  1. package/README.md +9 -0
  2. package/dist/AnomalyDetection.js +2 -2
  3. package/dist/BroadcastWorker.js +1 -1
  4. package/dist/CanaryController.js +1 -1
  5. package/dist/ChaosEngineering.js +4 -4
  6. package/dist/DatacenterOrchestrator.js +1 -1
  7. package/dist/DeadLetterQueue.js +1 -1
  8. package/dist/HealthMonitor.js +1 -1
  9. package/dist/MultiQueueWorker.js +1 -1
  10. package/dist/NotificationWorker.js +1 -1
  11. package/dist/SLAMonitor.js +2 -2
  12. package/dist/WorkerFactory.js +18 -18
  13. package/dist/WorkerInit.js +4 -4
  14. package/dist/WorkerRegistry.js +1 -1
  15. package/dist/WorkerShutdown.js +1 -1
  16. package/dist/WorkerShutdownDurableObject.d.ts +12 -0
  17. package/dist/WorkerShutdownDurableObject.js +41 -0
  18. package/dist/build-manifest.json +558 -0
  19. package/dist/dashboard/workers-api.js +2 -2
  20. package/dist/http/WorkerApiController.js +3 -3
  21. package/dist/http/WorkerController.js +10 -10
  22. package/dist/http/WorkerMonitoringService.js +2 -2
  23. package/dist/http/middleware/EditWorkerValidation.js +8 -8
  24. package/dist/http/middleware/WorkerValidationChain.js +9 -9
  25. package/dist/index.js +39 -28
  26. package/dist/register.d.ts +6 -0
  27. package/dist/register.js +37 -0
  28. package/dist/routes/workers.js +11 -11
  29. package/dist/telemetry/api/TelemetryAPI.js +3 -3
  30. package/dist/telemetry/index.js +3 -3
  31. package/dist/telemetry/routes/dashboard.js +4 -4
  32. package/dist/ui/router/ui.js +1 -1
  33. package/dist/ui/workers/index.html +202 -0
  34. package/dist/ui/workers/main.js +1952 -0
  35. package/dist/ui/workers/styles.css +1350 -0
  36. package/dist/ui/workers/zintrust.svg +30 -0
  37. package/package.json +19 -13
  38. package/src/register.ts +68 -0
package/dist/index.js CHANGED
@@ -1,48 +1,59 @@
1
+ /**
2
+ * @zintrust/workers v0.1.52
3
+ *
4
+ * ZinTrust Framework Package
5
+ *
6
+ * Build Information:
7
+ * Built: 2026-03-20T13:12:38.169Z
8
+ * Node: >=20.0.0
9
+ * License: MIT
10
+ *
11
+ */
1
12
  /**
2
13
  * Worker Management System - Public API
3
14
  *
4
15
  * Central export file for all worker management modules.
5
16
  */
6
17
  // Core Infrastructure
7
- export { ClusterLock } from './ClusterLock';
8
- export { PriorityQueue } from './PriorityQueue';
9
- export { WorkerMetrics } from './WorkerMetrics';
10
- export { WorkerRegistry } from './WorkerRegistry';
18
+ export { ClusterLock } from './ClusterLock.js';
19
+ export { PriorityQueue } from './PriorityQueue.js';
20
+ export { WorkerMetrics } from './WorkerMetrics.js';
21
+ export { WorkerRegistry } from './WorkerRegistry.js';
11
22
  // Resilience & Recovery
12
- export { AutoScaler } from './AutoScaler';
13
- export { CircuitBreaker } from './CircuitBreaker';
14
- export { DeadLetterQueue } from './DeadLetterQueue';
23
+ export { AutoScaler } from './AutoScaler.js';
24
+ export { CircuitBreaker } from './CircuitBreaker.js';
25
+ export { DeadLetterQueue } from './DeadLetterQueue.js';
15
26
  // Monitoring & Resources
16
- export { HealthMonitor } from './HealthMonitor';
17
- export { ResourceMonitor } from './ResourceMonitor';
18
- export { SLAMonitor } from './SLAMonitor';
27
+ export { HealthMonitor } from './HealthMonitor.js';
28
+ export { ResourceMonitor } from './ResourceMonitor.js';
29
+ export { SLAMonitor } from './SLAMonitor.js';
19
30
  // Compliance & Security
20
- export { ComplianceManager } from './ComplianceManager';
31
+ export { ComplianceManager } from './ComplianceManager.js';
21
32
  // Observability
22
- export { Observability } from './Observability';
33
+ export { Observability } from './Observability.js';
23
34
  // Plugin System
24
- export { PluginManager } from './PluginManager';
35
+ export { PluginManager } from './PluginManager.js';
25
36
  // Advanced Features
26
- export { AnomalyDetection } from './AnomalyDetection';
27
- export { CanaryController } from './CanaryController';
28
- export { ChaosEngineering } from './ChaosEngineering';
29
- export { DatacenterOrchestrator } from './DatacenterOrchestrator';
30
- export { MultiQueueWorker } from './MultiQueueWorker';
31
- export { WorkerVersioning } from './WorkerVersioning';
37
+ export { AnomalyDetection } from './AnomalyDetection.js';
38
+ export { CanaryController } from './CanaryController.js';
39
+ export { ChaosEngineering } from './ChaosEngineering.js';
40
+ export { DatacenterOrchestrator } from './DatacenterOrchestrator.js';
41
+ export { MultiQueueWorker } from './MultiQueueWorker.js';
42
+ export { WorkerVersioning } from './WorkerVersioning.js';
32
43
  // Factory & Lifecycle
33
- export { WorkerFactory } from './WorkerFactory';
34
- export { WorkerInit } from './WorkerInit';
35
- export { WorkerShutdown } from './WorkerShutdown';
44
+ export { WorkerFactory } from './WorkerFactory.js';
45
+ export { WorkerInit } from './WorkerInit.js';
46
+ export { WorkerShutdown } from './WorkerShutdown.js';
36
47
  // HTTP Controllers & Routes
37
- export { WorkerController } from './http/WorkerController';
38
- export { registerWorkerRoutes } from './routes/workers';
48
+ export { WorkerController } from './http/WorkerController.js';
49
+ export { registerWorkerRoutes } from './routes/workers.js';
39
50
  // Queue Workers
40
- export { BroadcastWorker } from './BroadcastWorker';
41
- export { createQueueWorker } from './createQueueWorker';
42
- export { NotificationWorker } from './NotificationWorker';
51
+ export { BroadcastWorker } from './BroadcastWorker.js';
52
+ export { createQueueWorker } from './createQueueWorker.js';
53
+ export { NotificationWorker } from './NotificationWorker.js';
43
54
  /**
44
55
  * Package version and build metadata
45
56
  * Available at runtime for debugging and health checks
46
57
  */
47
58
  export const _ZINTRUST_WORKERS_VERSION = '0.1.0';
48
- export const _ZINTRUST_WORKERS_BUILD_DATE = '__BUILD_DATE__';
59
+ export const _ZINTRUST_WORKERS_BUILD_DATE = '2026-03-20T13:12:38.203Z';
@@ -0,0 +1,6 @@
1
+ import type { CliCommandProvider } from '@zintrust/core/cli';
2
+ type Registry = {
3
+ register: (id: string, provider: CliCommandProvider) => void;
4
+ };
5
+ export declare function registerWorkerCliCommands(registry: Registry): void;
6
+ export {};
@@ -0,0 +1,37 @@
1
+ const commandModule = (await (async () => {
2
+ return (await import('@zintrust/core/cli'));
3
+ })());
4
+ const getWorkerProviders = () => {
5
+ const { WorkerCommands } = commandModule;
6
+ return [
7
+ ['worker:list', WorkerCommands.createWorkerListCommand()],
8
+ ['worker:status', WorkerCommands.createWorkerStatusCommand()],
9
+ ['worker:start', WorkerCommands.createWorkerStartCommand()],
10
+ ['worker:start-all', WorkerCommands.createWorkerStartAllCommand()],
11
+ ['worker:stop', WorkerCommands.createWorkerStopCommand()],
12
+ ['worker:restart', WorkerCommands.createWorkerRestartCommand()],
13
+ ['worker:summary', WorkerCommands.createWorkerSummaryCommand()],
14
+ ];
15
+ };
16
+ export function registerWorkerCliCommands(registry) {
17
+ for (const [id, provider] of getWorkerProviders()) {
18
+ registry.register(id, provider);
19
+ }
20
+ }
21
+ const globalWithRegistry = globalThis;
22
+ const globalRegistry = globalWithRegistry.__zintrust_cli_command_registry__ ??
23
+ (globalWithRegistry.__zintrust_cli_command_registry__ = new Map());
24
+ registerWorkerCliCommands({
25
+ register: (id, provider) => {
26
+ globalRegistry.set(id, provider);
27
+ },
28
+ });
29
+ try {
30
+ const core = (await import('@zintrust/core/cli'));
31
+ if (core.OptionalCliCommandRegistry !== undefined) {
32
+ registerWorkerCliCommands(core.OptionalCliCommandRegistry);
33
+ }
34
+ }
35
+ catch {
36
+ // no-op
37
+ }
@@ -3,17 +3,17 @@
3
3
  * HTTP API for managing workers with dashboard functionality
4
4
  */
5
5
  import { Cloudflare, Env, Logger, Router } from '@zintrust/core';
6
- import { HealthMonitor } from '../HealthMonitor';
7
- import { ValidationSchemas, withCustomValidation } from '../http/middleware/CustomValidation';
8
- import { withEditWorkerValidation } from '../http/middleware/EditWorkerValidation';
9
- import { withDriverValidation } from '../http/middleware/ValidateDriver';
10
- import { withCreateWorkerValidation, withWorkerOperationValidation, } from '../http/middleware/WorkerValidationChain';
11
- import { WorkerApiController } from '../http/WorkerApiController';
12
- import { WorkerController } from '../http/WorkerController';
13
- import { ResourceMonitor } from '../ResourceMonitor';
14
- import { TelemetryDashboard } from '../telemetry';
15
- import { registerStaticAssets } from '../ui/router/ui';
16
- import { WorkerFactory } from '../WorkerFactory';
6
+ import { HealthMonitor } from '../HealthMonitor.js';
7
+ import { ValidationSchemas, withCustomValidation } from '../http/middleware/CustomValidation.js';
8
+ import { withEditWorkerValidation } from '../http/middleware/EditWorkerValidation.js';
9
+ import { withDriverValidation } from '../http/middleware/ValidateDriver.js';
10
+ import { withCreateWorkerValidation, withWorkerOperationValidation, } from '../http/middleware/WorkerValidationChain.js';
11
+ import { WorkerApiController } from '../http/WorkerApiController.js';
12
+ import { WorkerController } from '../http/WorkerController.js';
13
+ import { ResourceMonitor } from '../ResourceMonitor.js';
14
+ import { TelemetryDashboard } from '../telemetry/index.js';
15
+ import { registerStaticAssets } from '../ui/router/ui.js';
16
+ import { WorkerFactory } from '../WorkerFactory.js';
17
17
  const controller = WorkerController.create();
18
18
  const apiController = WorkerApiController.create();
19
19
  function registerCoreWorkerRoutes(r) {
@@ -1,7 +1,7 @@
1
1
  import { Logger } from '@zintrust/core';
2
- import { getWorkers } from '../../dashboard/workers-api';
3
- import { HealthMonitor } from '../../HealthMonitor';
4
- import { ResourceMonitor } from '../../ResourceMonitor';
2
+ import { getWorkers } from '../../dashboard/workers-api.js';
3
+ import { HealthMonitor } from '../../HealthMonitor.js';
4
+ import { ResourceMonitor } from '../../ResourceMonitor.js';
5
5
  const isOkWithUsage = (value) => value.ok === true && 'usage' in value;
6
6
  const isOkWithSummary = (value) => value.ok === true && 'summary' in value;
7
7
  // Helper function to create stopped worker alert
@@ -1,7 +1,7 @@
1
1
  import { Router } from '@zintrust/core';
2
- import { createSnapshotBuilder } from './api/TelemetryAPI';
3
- import { teleStream } from './api/TelemetryMonitoringService';
4
- import { getDashboardHtml } from './routes/dashboard';
2
+ import { createSnapshotBuilder } from './api/TelemetryAPI.js';
3
+ import { teleStream } from './api/TelemetryMonitoringService.js';
4
+ import { getDashboardHtml } from './routes/dashboard.js';
5
5
  const DEFAULTS = {
6
6
  enabled: true,
7
7
  basePath: '/telemetry',
@@ -1,7 +1,7 @@
1
- import { renderAlertPanel } from '../components/AlertPanel';
2
- import { renderCostTracking } from '../components/CostTracking';
3
- import { renderResourceUsageChart } from '../components/ResourceUsageChart';
4
- import { renderWorkerHealthChart } from '../components/WorkerHealthChart';
1
+ import { renderAlertPanel } from '../components/AlertPanel.js';
2
+ import { renderCostTracking } from '../components/CostTracking.js';
3
+ import { renderResourceUsageChart } from '../components/ResourceUsageChart.js';
4
+ import { renderWorkerHealthChart } from '../components/WorkerHealthChart.js';
5
5
  const getDashboardColorStyles = () => `
6
6
  :root {
7
7
  --bg: #0b1220;
@@ -1,5 +1,5 @@
1
1
  import { Cloudflare, Logger, MIME_TYPES, NodeSingletons, Router } from '@zintrust/core';
2
- import { INDEX_HTML, MAIN_JS, STYLES_CSS, ZINTRUST_SVG } from './EmbeddedAssets';
2
+ import { INDEX_HTML, MAIN_JS, STYLES_CSS, ZINTRUST_SVG } from './EmbeddedAssets.js';
3
3
  const isCloudflare = (() => {
4
4
  try {
5
5
  return Cloudflare.getWorkersEnv() !== null;
@@ -0,0 +1,202 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>ZinTrust Workers Dashboard</title>
7
+ <link rel="stylesheet" href="workers/styles.css" />
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <div class="header">
12
+ <div class="header-top">
13
+ <div style="display: flex; align-items: center; gap: 16px">
14
+ <div class="logo-frame">
15
+ <img src="workers/zintrust.svg" alt="ZinTrust" class="logo-img" />
16
+ </div>
17
+ <h1>ZinTrust Workers</h1>
18
+ </div>
19
+ <div class="header-actions">
20
+ <button id="theme-toggle" class="theme-toggle">
21
+ <svg class="icon" viewBox="0 0 24 24">
22
+ <circle cx="12" cy="12" r="5" />
23
+ <path
24
+ d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"
25
+ />
26
+ </svg>
27
+ Theme
28
+ </button>
29
+ <button id="auto-refresh-toggle" class="btn" onclick="toggleAutoRefresh()">
30
+ <svg id="auto-refresh-icon" class="icon" viewBox="0 0 24 24">
31
+ <polygon points="5 3 19 12 5 21 5 3" />
32
+ </svg>
33
+ <span id="auto-refresh-label">Auto Refresh</span>
34
+ </button>
35
+ <button class="btn" onclick="fetchData()">
36
+ <svg class="icon" viewBox="0 0 24 24">
37
+ <path d="M23 4v6h-6" />
38
+ <path d="M1 20v-6h6" />
39
+ <path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" />
40
+ </svg>
41
+ Refresh
42
+ </button>
43
+ <button class="btn btn-primary" onclick="showAddWorkerModal()">
44
+ <svg class="icon" viewBox="0 0 24 24">
45
+ <line x1="12" y1="5" x2="12" y2="19" />
46
+ <line x1="5" y1="12" x2="19" y2="12" />
47
+ </svg>
48
+ Add Worker
49
+ </button>
50
+ </div>
51
+ </div>
52
+
53
+ <div class="nav-bar">
54
+ <nav class="nav-links">
55
+ <a href="/queue-monitor" class="nav-link">Queue Monitor</a>
56
+ <a href="/telemetry" class="nav-link">Telemetry</a>
57
+ <a href="/metrics" class="nav-link">Metrics</a>
58
+ </nav>
59
+ </div>
60
+
61
+ <div class="filters-bar">
62
+ <div class="filter-group">
63
+ <span>Status:</span>
64
+ <select id="status-filter">
65
+ <option value="">All Status</option>
66
+ <option value="running">Running</option>
67
+ <option value="stopped">Stopped</option>
68
+ <option value="error">Error</option>
69
+ <option value="paused">Paused</option>
70
+ </select>
71
+ </div>
72
+ <div class="filter-group">
73
+ <span>Driver:</span>
74
+ <select id="driver-filter">
75
+ <option value="">All Drivers</option>
76
+ </select>
77
+ </div>
78
+ <div class="filter-group">
79
+ <span>Sort:</span>
80
+ <select id="sort-select">
81
+ <option value="name">Sort by Name</option>
82
+ <option value="status" selected>Sort by Status</option>
83
+ <option value="driver">Sort by Driver</option>
84
+ <option value="health">Sort by Health</option>
85
+ <option value="version">Sort by Version</option>
86
+ <option value="processed">Sort by Performance</option>
87
+ </select>
88
+ </div>
89
+ <div style="flex-grow: 1"></div>
90
+ <div class="search-box">
91
+ <svg class="search-icon" viewBox="0 0 24 24">
92
+ <circle cx="11" cy="11" r="8"></circle>
93
+ <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
94
+ </svg>
95
+ <input type="text" id="search-input" placeholder="Search workers..." />
96
+ </div>
97
+ </div>
98
+ </div>
99
+
100
+ <div id="loading" style="text-align: center; padding: 40px; color: var(--muted)">
101
+ <div>Loading workers...</div>
102
+ </div>
103
+
104
+ <div
105
+ id="error"
106
+ style="display: none; text-align: center; padding: 40px; color: var(--danger)"
107
+ >
108
+ <div>Failed to load workers data</div>
109
+ <button class="btn" onclick="fetchData()" style="margin-top: 16px">Retry</button>
110
+ </div>
111
+
112
+ <div id="workers-content" style="display: none">
113
+ <div class="summary-bar" id="queue-summary">
114
+ <div class="summary-item">
115
+ <span class="summary-label">Queue Driver</span>
116
+ <span class="summary-value" id="queue-driver">-</span>
117
+ </div>
118
+ <div class="summary-item">
119
+ <span class="summary-label">Queues</span>
120
+ <span class="summary-value" id="queue-total">0</span>
121
+ </div>
122
+ <div class="summary-item">
123
+ <span class="summary-label">Jobs</span>
124
+ <span class="summary-value" id="queue-jobs">0</span>
125
+ </div>
126
+ <div class="summary-item">
127
+ <span class="summary-label">Processing</span>
128
+ <span class="summary-value" id="queue-processing">0</span>
129
+ </div>
130
+ <div class="summary-item">
131
+ <span class="summary-label">Failed</span>
132
+ <span class="summary-value" id="queue-failed">0</span>
133
+ </div>
134
+ <div class="summary-item">
135
+ <span class="summary-label">Drivers</span>
136
+ <div class="drivers-list" id="drivers-list"></div>
137
+ </div>
138
+ </div>
139
+ <div class="table-container">
140
+ <div class="table-wrapper">
141
+ <table>
142
+ <thead>
143
+ <tr>
144
+ <th style="width: 250px">Worker</th>
145
+ <th style="width: 120px">Status</th>
146
+ <th style="width: 120px">Health</th>
147
+ <th style="width: 100px">Driver</th>
148
+ <th style="width: 100px">Version</th>
149
+ <th style="width: 320px">Performance</th>
150
+ <th style="width: 180px">Actions</th>
151
+ </tr>
152
+ </thead>
153
+ <tbody id="workers-tbody">
154
+ <!-- Workers will be populated here -->
155
+ </tbody>
156
+ </table>
157
+ </div>
158
+
159
+ <div class="pagination">
160
+ <div class="pagination-info" id="pagination-info">Showing 0-0 of 0 workers</div>
161
+ <div class="pagination-controls">
162
+ <button class="page-btn" id="prev-btn" onclick="loadPage('prev')" disabled>
163
+ <svg
164
+ viewBox="0 0 24 24"
165
+ fill="none"
166
+ stroke="currentColor"
167
+ stroke-linecap="round"
168
+ stroke-linejoin="round"
169
+ >
170
+ <polyline points="15 18 9 12 15 6"></polyline>
171
+ </svg>
172
+ </button>
173
+ <div id="page-numbers" style="display: flex; gap: 8px"></div>
174
+ <button class="page-btn" id="next-btn" onclick="loadPage('next')" disabled>
175
+ <svg
176
+ viewBox="0 0 24 24"
177
+ fill="none"
178
+ stroke="currentColor"
179
+ stroke-linecap="round"
180
+ stroke-linejoin="round"
181
+ >
182
+ <polyline points="9 18 15 12 9 6"></polyline>
183
+ </svg>
184
+ </button>
185
+
186
+ <div class="page-size-selector">
187
+ <span>Show:</span>
188
+ <select id="limit-select" onchange="changeLimit(this.value)">
189
+ <option value="10">10</option>
190
+ <option value="25">25</option>
191
+ <option value="50">50</option>
192
+ <option value="100">100</option>
193
+ </select>
194
+ </div>
195
+ </div>
196
+ </div>
197
+ </div>
198
+ </div>
199
+ </div>
200
+ <script src="workers/main.js"></script>
201
+ </body>
202
+ </html>