@gravito/zenith 1.1.2 → 1.1.6

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 (76) hide show
  1. package/README.md +95 -22
  2. package/README.zh-TW.md +88 -0
  3. package/dist/bin.js +54699 -39316
  4. package/dist/client/assets/index-C80c1frR.css +1 -0
  5. package/dist/client/assets/index-CrWem9u3.js +434 -0
  6. package/dist/client/index.html +2 -2
  7. package/dist/server/index.js +54699 -39316
  8. package/package.json +20 -9
  9. package/CHANGELOG.md +0 -47
  10. package/Dockerfile +0 -46
  11. package/Dockerfile.demo-worker +0 -29
  12. package/ECOSYSTEM_EXPANSION_RFC.md +0 -130
  13. package/bin/flux-console.ts +0 -2
  14. package/dist/client/assets/index-BSMp8oq_.js +0 -436
  15. package/dist/client/assets/index-BwxlHx-_.css +0 -1
  16. package/docker-compose.yml +0 -40
  17. package/docs/ALERTING_GUIDE.md +0 -71
  18. package/docs/DEPLOYMENT.md +0 -157
  19. package/docs/DOCS_INTERNAL.md +0 -73
  20. package/docs/LARAVEL_ZENITH_ROADMAP.md +0 -109
  21. package/docs/QUASAR_MASTER_PLAN.md +0 -140
  22. package/docs/QUICK_TEST_GUIDE.md +0 -72
  23. package/docs/ROADMAP.md +0 -85
  24. package/docs/integrations/LARAVEL.md +0 -207
  25. package/postcss.config.js +0 -6
  26. package/scripts/debug_redis_keys.ts +0 -24
  27. package/scripts/flood-logs.ts +0 -21
  28. package/scripts/seed.ts +0 -213
  29. package/scripts/verify-throttle.ts +0 -49
  30. package/scripts/worker.ts +0 -124
  31. package/specs/PULSE_SPEC.md +0 -86
  32. package/src/bin.ts +0 -6
  33. package/src/client/App.tsx +0 -72
  34. package/src/client/Layout.tsx +0 -672
  35. package/src/client/Sidebar.tsx +0 -112
  36. package/src/client/ThroughputChart.tsx +0 -144
  37. package/src/client/WorkerStatus.tsx +0 -226
  38. package/src/client/components/BrandIcons.tsx +0 -168
  39. package/src/client/components/ConfirmDialog.tsx +0 -126
  40. package/src/client/components/JobInspector.tsx +0 -554
  41. package/src/client/components/LogArchiveModal.tsx +0 -432
  42. package/src/client/components/NotificationBell.tsx +0 -212
  43. package/src/client/components/PageHeader.tsx +0 -47
  44. package/src/client/components/Toaster.tsx +0 -90
  45. package/src/client/components/UserProfileDropdown.tsx +0 -186
  46. package/src/client/contexts/AuthContext.tsx +0 -105
  47. package/src/client/contexts/NotificationContext.tsx +0 -128
  48. package/src/client/index.css +0 -174
  49. package/src/client/index.html +0 -12
  50. package/src/client/main.tsx +0 -15
  51. package/src/client/pages/LoginPage.tsx +0 -162
  52. package/src/client/pages/MetricsPage.tsx +0 -417
  53. package/src/client/pages/OverviewPage.tsx +0 -517
  54. package/src/client/pages/PulsePage.tsx +0 -488
  55. package/src/client/pages/QueuesPage.tsx +0 -379
  56. package/src/client/pages/SchedulesPage.tsx +0 -540
  57. package/src/client/pages/SettingsPage.tsx +0 -1020
  58. package/src/client/pages/WorkersPage.tsx +0 -394
  59. package/src/client/pages/index.ts +0 -8
  60. package/src/client/utils.ts +0 -15
  61. package/src/server/config/ServerConfigManager.ts +0 -90
  62. package/src/server/index.ts +0 -860
  63. package/src/server/middleware/auth.ts +0 -127
  64. package/src/server/services/AlertService.ts +0 -321
  65. package/src/server/services/CommandService.ts +0 -137
  66. package/src/server/services/LogStreamProcessor.ts +0 -93
  67. package/src/server/services/MaintenanceScheduler.ts +0 -78
  68. package/src/server/services/PulseService.ts +0 -91
  69. package/src/server/services/QueueMetricsCollector.ts +0 -138
  70. package/src/server/services/QueueService.ts +0 -631
  71. package/src/shared/types.ts +0 -198
  72. package/tailwind.config.js +0 -73
  73. package/tests/placeholder.test.ts +0 -7
  74. package/tsconfig.json +0 -38
  75. package/tsconfig.node.json +0 -12
  76. package/vite.config.ts +0 -27
package/package.json CHANGED
@@ -1,14 +1,22 @@
1
1
  {
2
2
  "name": "@gravito/zenith",
3
- "version": "1.1.2",
3
+ "sideEffects": false,
4
+ "version": "1.1.6",
4
5
  "description": "Gravito Zenith: Zero-config control plane for Gravito Flux & Stream",
5
6
  "type": "module",
6
7
  "bin": {
7
8
  "zenith": "dist/bin.js",
8
9
  "flux-console": "dist/bin.js"
9
10
  },
10
- "main": "./dist/index.js",
11
- "types": "./dist/index.d.ts",
11
+ "main": "./dist/server/index.js",
12
+ "exports": {
13
+ ".": "./dist/server/index.js",
14
+ "./bin": "./dist/bin.js"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
12
20
  "scripts": {
13
21
  "dev:server": "bun run --watch src/server/index.ts",
14
22
  "dev:client": "vite",
@@ -17,13 +25,15 @@
17
25
  "test": "bun test",
18
26
  "typecheck": "bun tsc -p tsconfig.json --noEmit --skipLibCheck",
19
27
  "seed": "bun scripts/seed.ts",
20
- "worker": "bun scripts/worker.ts"
28
+ "worker": "bun scripts/worker.ts",
29
+ "test:unit": "bun test",
30
+ "test:integration": "test $(find tests -name '*.integration.test.ts' 2>/dev/null | wc -l) -gt 0 && find tests -name '*.integration.test.ts' -print0 | xargs -0 bun test --timeout=10000 || echo 'No integration tests found'"
21
31
  },
22
32
  "dependencies": {
23
- "@gravito/atlas": "workspace:*",
24
- "@gravito/photon": "workspace:*",
25
- "@gravito/quasar": "workspace:*",
26
- "@gravito/stream": "workspace:*",
33
+ "@gravito/atlas": "^2.5.2",
34
+ "@gravito/photon": "^1.1.3",
35
+ "@gravito/quasar": "^1.3.2",
36
+ "@gravito/stream": "^2.1.1",
27
37
  "@tanstack/react-query": "^5.0.0",
28
38
  "clsx": "^2.1.1",
29
39
  "date-fns": "^4.1.0",
@@ -41,6 +51,7 @@
41
51
  "@types/nodemailer": "^7.0.4",
42
52
  "@types/react": "^19.0.0",
43
53
  "@types/react-dom": "^19.0.0",
54
+ "@types/node": "latest",
44
55
  "@vitejs/plugin-react": "^5.1.2",
45
56
  "autoprefixer": "^10.4.0",
46
57
  "postcss": "^8.4.0",
@@ -51,4 +62,4 @@
51
62
  "publishConfig": {
52
63
  "access": "public"
53
64
  }
54
- }
65
+ }
package/CHANGELOG.md DELETED
@@ -1,47 +0,0 @@
1
- # @gravito/zenith
2
-
3
- ## 1.1.2
4
-
5
- ### Patch Changes
6
-
7
- - Updated dependencies [905588f]
8
- - @gravito/stream@2.0.1
9
-
10
- ## 1.1.1
11
-
12
- ### Patch Changes
13
-
14
- - Updated dependencies
15
- - @gravito/atlas@2.1.0
16
- - @gravito/stream@1.0.3
17
-
18
- ## 1.1.0
19
-
20
- ### Minor Changes
21
-
22
- - Implement several more examples and fix module issues, including:
23
- - Support middleware in core route definitions.
24
- - Improve Atlas driver loading and dependency injection.
25
- - Add PostgreSQL support to Ecommerce MVC example.
26
- - Fix internal type resolution issues across packages.
27
-
28
- ### Patch Changes
29
-
30
- - Updated dependencies
31
- - @gravito/atlas@1.2.0
32
- - @gravito/quasar@1.2.0
33
- - @gravito/stream@1.0.2
34
-
35
- ## 1.0.1
36
-
37
- ### Patch Changes
38
-
39
- - @gravito/stream@1.0.1
40
-
41
- ## 1.0.0
42
-
43
- ### Patch Changes
44
-
45
- - Updated dependencies
46
- - @gravito/atlas@1.0.1
47
- - @gravito/stream@1.0.0
package/Dockerfile DELETED
@@ -1,46 +0,0 @@
1
- # Use Bun official image
2
- FROM oven/bun:1.1.26 AS base
3
- WORKDIR /usr/src/app
4
-
5
- # ---- 1. Install Dependencies ----
6
- FROM base AS install
7
- # Copy root files
8
- COPY package.json bun.lock ./
9
- # Copy package.json files for workspace resolution
10
- COPY packages/photon/package.json ./packages/photon/
11
- COPY packages/stream/package.json ./packages/stream/
12
- COPY packages/flux-console/package.json ./packages/flux-console/
13
-
14
- # Install dependencies
15
- RUN bun install --frozen-lockfile
16
-
17
- # ---- 2. Build Stage ----
18
- FROM base AS build
19
- COPY --from=install /usr/src/app/node_modules ./node_modules
20
- COPY --from=install /usr/src/app/packages ./packages
21
- COPY . .
22
-
23
- # Build the console
24
- # This bundles the server and builds the client (Vite)
25
- RUN cd packages/flux-console && bun run build
26
-
27
- # ---- 3. Production Runner ----
28
- FROM base AS release
29
- WORKDIR /app
30
-
31
- # Copy built artifacts
32
- # Note: server and bin are bundled into dist/
33
- COPY --from=build /usr/src/app/packages/flux-console/dist ./dist
34
- COPY --from=build /usr/src/app/packages/flux-console/package.json ./package.json
35
- # Client source/assets are needed for the server to serve them
36
- COPY --from=build /usr/src/app/packages/flux-console/src/client ./src/client
37
-
38
- # Expose port
39
- EXPOSE 3000
40
-
41
- # Environment defaults
42
- ENV PORT=3000
43
- ENV NODE_ENV=production
44
-
45
- # Start the console
46
- CMD ["bun", "run", "dist/bin.js"]
@@ -1,29 +0,0 @@
1
- # Use Bun official image
2
- FROM oven/bun:1.1.26 AS base
3
- WORKDIR /usr/src/app
4
-
5
- # ---- 1. Install Dependencies ----
6
- FROM base AS install
7
- COPY package.json bun.lock ./
8
- COPY packages/photon/package.json ./packages/photon/
9
- COPY packages/stream/package.json ./packages/stream/
10
- COPY packages/flux-console/package.json ./packages/flux-console/
11
- RUN bun install --frozen-lockfile
12
-
13
- # ---- 2. Copy Source ----
14
- FROM base AS build
15
- COPY --from=install /usr/src/app/node_modules ./node_modules
16
- COPY --from=install /usr/src/app/packages ./packages
17
- COPY . .
18
-
19
- # ---- 3. Runner ----
20
- FROM base AS release
21
- WORKDIR /usr/src/app
22
- COPY --from=build /usr/src/app ./
23
-
24
- # Env defaults
25
- ENV NODE_ENV=production
26
-
27
- # Start the demo worker
28
- # It uses the local packages/dist if available, but Bun can run TS directly
29
- CMD ["bun", "run", "packages/flux-console/scripts/demo-worker.ts"]
@@ -1,130 +0,0 @@
1
- # Zenith Ecosystem Expansion RFC
2
-
3
- **Status**: Draft
4
- **Date**: 2026-01-10
5
- **Goal**: Expand Zenith monitoring capabilities beyond Gravito/Laravel to Python, Node.js, and Go ecosystems.
6
-
7
- ---
8
-
9
- ## 1. Executive Summary
10
-
11
- Gravito Zenith (Flux Console) is a unified control plane for background job processing. Currently, it supports **Gravito Stream** (Native) and **Laravel Queues** (via `laravel-zenith`). To become a true polyglot observability platform, we need to implement connectors for other popular queue systems.
12
-
13
- This RFC defines the **Universal Zenith Protocol (UZP)** and proposes implementation roadmaps for Python (Celery) and Node.js (BullMQ).
14
-
15
- ---
16
-
17
- ## 2. The Universal Zenith Protocol (UZP)
18
-
19
- Any background job system can be monitored by Zenith if it implements the following Redis-based interfaces.
20
-
21
- ### 2.1. Discovery (Heartbeat)
22
- Workers must announce their presence every 30 seconds to avoid being marked as "Offline".
23
-
24
- * **Command**: `SETEX flux_console:worker:<worker_id> 60 <payload>`
25
- * **Payload (JSON)**:
26
- ```json
27
- {
28
- "id": "celery@worker-1",
29
- "hostname": "pod-xyz",
30
- "pid": 1234,
31
- "uptime": 3600,
32
- "queues": ["high", "default"],
33
- "concurrency": 4,
34
- "memory": { "rss": "50MB", "heapUsed": "N/A" },
35
- "framework": "celery", // "laravel", "bullmq", "asynq"
36
- "language": "python", // "php", "typescript", "go"
37
- "timestamp": "2026-01-10T12:00:00Z"
38
- }
39
- ```
40
-
41
- ### 2.2. Event Stream (Logs)
42
- Workers publish lifecycle events to a shared Pub/Sub channel.
43
-
44
- * **Command**: `PUBLISH flux_console:logs <payload>`
45
- * **Payload (JSON)**:
46
- ```json
47
- {
48
- "level": "info", // "info" (start), "success", "error"
49
- "message": "Processing Task: tasks.send_email",
50
- "workerId": "celery@worker-1",
51
- "queue": "default",
52
- "jobId": "uuid-v4",
53
- "timestamp": "2026-01-10T12:00:01Z",
54
- "metadata": {
55
- "attempt": 1,
56
- "latency": 45 // ms (for success/error events)
57
- }
58
- }
59
- ```
60
-
61
- ### 2.3. Metrics (Optional but Recommended)
62
- Connectors should increment counters for throughput aggregation.
63
-
64
- * `INCR flux_console:metrics:processed`
65
- * `INCR flux_console:metrics:failed`
66
-
67
- ---
68
-
69
- ## 3. Implementation Plan: Python (Celery)
70
-
71
- **Target**: `gravito/zenith-celery` (PyPI Package)
72
-
73
- ### Architecture
74
- Celery has a rich Signal system. We can hook into `worker_ready`, `task_prerun`, `task_success`, and `task_failure`.
75
-
76
- ### Component Design
77
- 1. **ZenithMonitor**: A Celery Bootstep that starts a background thread for Heartbeats.
78
- 2. **SignalHandlers**:
79
- * `task_prerun`: Publish `level: info` log.
80
- * `task_success`: Publish `level: success` log + metrics.
81
- * `task_failure`: Publish `level: error` log with traceback.
82
-
83
- ### Configuration
84
- ```python
85
- # celery.py
86
- app.conf.zenith_redis_url = "redis://localhost:6379/0"
87
- app.conf.zenith_enabled = True
88
- ```
89
-
90
- ---
91
-
92
- ## 4. Implementation Plan: Node.js (BullMQ)
93
-
94
- **Target**: `@gravito/zenith-bullmq` (NPM Package)
95
-
96
- *Note: Gravito Stream is based on BullMQ principles but internal. This adapter allows *standard* BullMQ instances (e.g., in a NestJS app) to report to Zenith.*
97
-
98
- ### Architecture
99
- BullMQ uses `QueueEvents` (which listens to Redis streams). A separate "Monitor" process is the best approach to avoid modifying the worker code too much.
100
-
101
- ### Component Design
102
- 1. **ZenithMonitor Class**:
103
- ```typescript
104
- const monitor = new ZenithMonitor({
105
- connection: redisOptions,
106
- queues: ['email', 'reports']
107
- });
108
- monitor.start();
109
- ```
110
- 2. It listens to BullMQ global events (completed, failed) and bridges them to UZP.
111
- 3. **Heartbeat**: Since BullMQ workers don't have a central registry, the Monitor acts as a "Virtual Worker" or we require users to instantiate a `ZenithWorker` wrapper.
112
-
113
- ---
114
-
115
- ## 5. Implementation Plan: Go (Asynq)
116
-
117
- **Target**: `github.com/gravito-framework/zenith-asynq`
118
-
119
- ### Architecture
120
- Asynq provides `Server` middleware.
121
-
122
- ### Component Design
123
- 1. **Middleware**: `zenith.NewMiddleware(redisClient)`.
124
- 2. Wraps handler execution to capture Start/Success/Fail times.
125
- 3. Publishes to Redis asynchronously.
126
-
127
- ---
128
-
129
- ## 6. Future Work: Rust (Faktory?)
130
- (To be determined based on demand)
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env bun
2
- import '../src/server/index'