tricache 0.7.1 → 0.9.0

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 (102) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +89 -1371
  3. package/dashboards/prometheus-scrape.yml +18 -0
  4. package/dashboards/tricache-alerts.yaml +54 -0
  5. package/dashboards/tricache-grafana.json +548 -0
  6. package/dist/cache-service-DVvroyqA.d.ts +886 -0
  7. package/dist/cache-service-KI5ACF3F.js +12 -0
  8. package/dist/chunk-7RV5ZVBB.js +1023 -0
  9. package/dist/chunk-BQRURGGD.js +60 -0
  10. package/dist/chunk-IITRFWHY.js +196 -0
  11. package/dist/{chunk-X5AXHPVD.js → chunk-LJ5QJB5O.js} +90 -5
  12. package/dist/{chunk-EUGYR7KR.js → chunk-PL5J3ZNT.js} +3184 -514
  13. package/dist/chunk-QNU7B43J.js +687 -0
  14. package/dist/chunk-UGD4VEPD.js +138 -0
  15. package/dist/chunk-XZL45ABR.js +108 -0
  16. package/dist/cli.cjs +3122 -495
  17. package/dist/cli.d.ts +1 -0
  18. package/dist/cli.js +121 -5
  19. package/dist/dashboard/index.cjs +1065 -0
  20. package/dist/dashboard/index.d.ts +183 -0
  21. package/dist/dashboard/index.js +22 -0
  22. package/dist/drizzle/index.cjs +2846 -494
  23. package/dist/drizzle/index.d.ts +3 -1
  24. package/dist/drizzle/index.js +1 -1
  25. package/dist/edge/index.cjs +1559 -0
  26. package/dist/edge/index.d.ts +127 -0
  27. package/dist/edge/index.js +1109 -0
  28. package/dist/hono/index.cjs +7760 -0
  29. package/dist/hono/index.d.ts +91 -0
  30. package/dist/hono/index.js +185 -0
  31. package/dist/hono-VA9A1m0I.d.ts +371 -0
  32. package/dist/http/index.cjs +3281 -587
  33. package/dist/http/index.d.ts +85 -23
  34. package/dist/http/index.js +176 -78
  35. package/dist/index.cjs +7212 -2505
  36. package/dist/index.d.ts +547 -30
  37. package/dist/index.js +104 -5
  38. package/dist/murmur3-CMGw9PbV.d.ts +98 -0
  39. package/dist/nestjs/index.cjs +2787 -487
  40. package/dist/nestjs/index.d.ts +3 -1
  41. package/dist/nestjs/index.js +6 -3
  42. package/dist/next/index.cjs +2804 -501
  43. package/dist/next/index.d.ts +4 -2
  44. package/dist/next/index.js +14 -10
  45. package/dist/prisma/index.d.ts +3 -1
  46. package/dist/serialize-worker.cjs +5 -4
  47. package/dist/serialize-worker.js +1 -1
  48. package/dist/{cache-service-D8tIXmzb.d.ts → types-B_QkVwJ7.d.ts} +622 -662
  49. package/dist/utils-CEsU_Z0s.d.ts +27 -0
  50. package/package.json +48 -10
  51. package/src/adapters/auto-pipeliner.ts +206 -0
  52. package/src/adapters/node-redis.ts +370 -0
  53. package/src/cache-service.ts +1619 -415
  54. package/src/cli.ts +137 -2
  55. package/src/codec.ts +72 -0
  56. package/src/cross-region.ts +245 -0
  57. package/src/dashboard/handler.ts +392 -0
  58. package/src/dashboard/html.ts +594 -0
  59. package/src/dashboard/index.ts +195 -0
  60. package/src/dashboard/types.ts +96 -0
  61. package/src/disk-tier.ts +449 -47
  62. package/src/drizzle/index.ts +86 -86
  63. package/src/edge/adapters/cloudflare-do.ts +130 -0
  64. package/src/edge/adapters/cloudflare-kv.ts +115 -0
  65. package/src/edge/adapters/upstash.ts +143 -0
  66. package/src/edge/cache.ts +797 -0
  67. package/src/edge/crypto.ts +182 -0
  68. package/src/edge/hono.ts +284 -0
  69. package/src/edge/index.ts +37 -0
  70. package/src/edge/types.ts +230 -0
  71. package/src/edge/utils/base64.ts +63 -0
  72. package/src/edge/utils/murmur3.ts +179 -0
  73. package/src/encryption.ts +127 -5
  74. package/src/hono/index.ts +316 -0
  75. package/src/http/express.ts +195 -0
  76. package/src/http/fastify.ts +260 -0
  77. package/src/http/index.ts +44 -258
  78. package/src/http/utils.ts +92 -0
  79. package/src/index.ts +149 -47
  80. package/src/ipc-telemetry.ts +509 -0
  81. package/src/latency-watchdog.ts +282 -0
  82. package/src/nestjs/decorators.ts +161 -161
  83. package/src/nestjs/index.ts +23 -23
  84. package/src/nestjs/tricache.module.ts +104 -104
  85. package/src/nestjs/tricache.store.ts +97 -97
  86. package/src/nestjs/types.ts +79 -79
  87. package/src/next/cache-handler.ts +12 -9
  88. package/src/next/index.ts +37 -37
  89. package/src/next/isr-handler.ts +105 -105
  90. package/src/next/types.ts +130 -130
  91. package/src/remote-snapshot.ts +153 -0
  92. package/src/serialize-worker.ts +120 -120
  93. package/src/sigv4-snapshot-adapter.ts +260 -0
  94. package/src/smart-memory-cache.ts +91 -8
  95. package/src/types.ts +315 -2
  96. package/src/utils/cgroup.ts +100 -0
  97. package/src/utils/tracing.ts +54 -0
  98. package/src/wasm/bloom-filter-wasm.ts +109 -102
  99. package/src/worker-pool.ts +299 -299
  100. package/src/wtiny-lfu.ts +624 -0
  101. package/dist/cache-service-5GATUYAK.js +0 -7
  102. package/dist/chunk-UBSR5UYA.js +0 -0
@@ -0,0 +1,1065 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/dashboard/index.ts
31
+ var dashboard_exports = {};
32
+ __export(dashboard_exports, {
33
+ DASHBOARD_GZIP_BUFFER: () => DASHBOARD_GZIP_BUFFER,
34
+ DASHBOARD_HTML: () => DASHBOARD_HTML,
35
+ buildMetricsPayload: () => buildMetricsPayload,
36
+ createNextDashboardHandlers: () => createNextDashboardHandlers,
37
+ handleDashboardRequest: () => handleDashboardRequest,
38
+ resolveInstanceId: () => resolveInstanceId,
39
+ safeCompare: () => safeCompare,
40
+ startDashboardServer: () => startDashboardServer,
41
+ tricacheDashboard: () => tricacheDashboard
42
+ });
43
+ module.exports = __toCommonJS(dashboard_exports);
44
+ var import_node_http = __toESM(require("http"), 1);
45
+
46
+ // src/dashboard/handler.ts
47
+ var import_node_crypto = require("crypto");
48
+ var import_node_os = __toESM(require("os"), 1);
49
+
50
+ // src/dashboard/html.ts
51
+ var import_node_zlib = require("zlib");
52
+ var DASHBOARD_HTML = `<!DOCTYPE html>
53
+ <html lang="en">
54
+ <head>
55
+ <meta charset="UTF-8" />
56
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
57
+ <title>TriCache Observability</title>
58
+ <style>
59
+ :root {
60
+ --bg: #0b0f17;
61
+ --card-bg: rgba(18, 24, 38, 0.75);
62
+ --card-border: rgba(255, 255, 255, 0.08);
63
+ --card-hover: rgba(255, 255, 255, 0.12);
64
+ --text: #f1f5f9;
65
+ --text-muted: #94a3b8;
66
+ --primary: #38bdf8;
67
+ --primary-glow: rgba(56, 189, 248, 0.25);
68
+ --success: #10b981;
69
+ --warning: #f59e0b;
70
+ --danger: #ef4444;
71
+ --l1-color: #38bdf8;
72
+ --disk-color: #a855f7;
73
+ --l2-color: #f97316;
74
+ --db-color: #ef4444;
75
+ --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
76
+ }
77
+ * { box-sizing: border-box; margin: 0; padding: 0; }
78
+ body {
79
+ background-color: var(--bg);
80
+ color: var(--text);
81
+ font-family: var(--font);
82
+ line-height: 1.5;
83
+ padding: 1.5rem;
84
+ min-height: 100vh;
85
+ -webkit-font-smoothing: antialiased;
86
+ }
87
+ header {
88
+ display: flex;
89
+ flex-wrap: wrap;
90
+ justify-content: space-between;
91
+ align-items: center;
92
+ gap: 1rem;
93
+ margin-bottom: 2rem;
94
+ padding-bottom: 1.25rem;
95
+ border-bottom: 1px solid var(--card-border);
96
+ }
97
+ .brand {
98
+ display: flex;
99
+ align-items: center;
100
+ gap: 0.85rem;
101
+ }
102
+ .brand-logo {
103
+ width: 36px;
104
+ height: 36px;
105
+ border-radius: 8px;
106
+ background: linear-gradient(135deg, #0284c7, #818cf8);
107
+ display: flex;
108
+ align-items: center;
109
+ justify-content: center;
110
+ font-weight: 800;
111
+ color: #fff;
112
+ font-size: 1.1rem;
113
+ box-shadow: 0 0 16px var(--primary-glow);
114
+ }
115
+ .brand-text h1 {
116
+ font-size: 1.35rem;
117
+ font-weight: 700;
118
+ letter-spacing: -0.02em;
119
+ }
120
+ .brand-text p {
121
+ font-size: 0.8rem;
122
+ color: var(--text-muted);
123
+ }
124
+ .header-meta {
125
+ display: flex;
126
+ flex-wrap: wrap;
127
+ align-items: center;
128
+ gap: 0.75rem;
129
+ }
130
+ .badge {
131
+ display: inline-flex;
132
+ align-items: center;
133
+ gap: 0.4rem;
134
+ padding: 0.3rem 0.65rem;
135
+ border-radius: 9999px;
136
+ font-size: 0.75rem;
137
+ font-weight: 600;
138
+ background: rgba(255, 255, 255, 0.05);
139
+ border: 1px solid var(--card-border);
140
+ color: var(--text-muted);
141
+ }
142
+ .badge-live {
143
+ color: var(--success);
144
+ border-color: rgba(16, 185, 129, 0.3);
145
+ background: rgba(16, 185, 129, 0.1);
146
+ }
147
+ .pulse-dot {
148
+ width: 7px;
149
+ height: 7px;
150
+ border-radius: 50%;
151
+ background-color: currentColor;
152
+ box-shadow: 0 0 8px currentColor;
153
+ animation: pulse 2s infinite ease-in-out;
154
+ }
155
+ @keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.85); } }
156
+ .peer-select {
157
+ background: rgba(255, 255, 255, 0.06);
158
+ border: 1px solid var(--card-border);
159
+ color: var(--text);
160
+ padding: 0.3rem 0.65rem;
161
+ border-radius: 6px;
162
+ font-size: 0.8rem;
163
+ outline: none;
164
+ cursor: pointer;
165
+ }
166
+ .grid {
167
+ display: grid;
168
+ grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
169
+ gap: 1.25rem;
170
+ margin-bottom: 2rem;
171
+ }
172
+ .card {
173
+ background: var(--card-bg);
174
+ backdrop-filter: blur(12px);
175
+ border: 1px solid var(--card-border);
176
+ border-radius: 12px;
177
+ padding: 1.25rem;
178
+ transition: border-color 0.2s, transform 0.2s;
179
+ }
180
+ .card:hover {
181
+ border-color: var(--card-hover);
182
+ }
183
+ .card-label {
184
+ font-size: 0.75rem;
185
+ font-weight: 600;
186
+ color: var(--text-muted);
187
+ text-transform: uppercase;
188
+ letter-spacing: 0.05em;
189
+ margin-bottom: 0.4rem;
190
+ display: flex;
191
+ justify-content: space-between;
192
+ align-items: center;
193
+ }
194
+ .card-value {
195
+ font-size: 1.85rem;
196
+ font-weight: 800;
197
+ letter-spacing: -0.03em;
198
+ color: var(--text);
199
+ }
200
+ .card-sub {
201
+ font-size: 0.8rem;
202
+ color: var(--text-muted);
203
+ margin-top: 0.35rem;
204
+ }
205
+ .tier-bar {
206
+ height: 10px;
207
+ border-radius: 5px;
208
+ background: rgba(255, 255, 255, 0.06);
209
+ overflow: hidden;
210
+ display: flex;
211
+ margin: 0.75rem 0;
212
+ }
213
+ .tier-segment { height: 100%; transition: width 0.4s ease; }
214
+ .tier-legend {
215
+ display: flex;
216
+ flex-wrap: wrap;
217
+ gap: 0.85rem;
218
+ font-size: 0.75rem;
219
+ color: var(--text-muted);
220
+ }
221
+ .tier-item { display: flex; align-items: center; gap: 0.35rem; }
222
+ .tier-color-dot { width: 8px; height: 8px; border-radius: 2px; }
223
+ .actions-panel {
224
+ display: flex;
225
+ flex-wrap: wrap;
226
+ gap: 0.75rem;
227
+ align-items: center;
228
+ margin-top: 1rem;
229
+ }
230
+ .btn {
231
+ background: rgba(255, 255, 255, 0.08);
232
+ border: 1px solid var(--card-border);
233
+ color: var(--text);
234
+ font-family: inherit;
235
+ font-size: 0.8rem;
236
+ font-weight: 600;
237
+ padding: 0.45rem 0.9rem;
238
+ border-radius: 6px;
239
+ cursor: pointer;
240
+ display: inline-flex;
241
+ align-items: center;
242
+ gap: 0.4rem;
243
+ transition: background 0.15s, border-color 0.15s;
244
+ }
245
+ .btn:hover:not(:disabled) {
246
+ background: rgba(255, 255, 255, 0.15);
247
+ border-color: rgba(255, 255, 255, 0.25);
248
+ }
249
+ .btn:disabled {
250
+ opacity: 0.4;
251
+ cursor: not-allowed;
252
+ }
253
+ .btn-danger {
254
+ background: rgba(239, 68, 68, 0.15);
255
+ border-color: rgba(239, 68, 68, 0.3);
256
+ color: #fca5a5;
257
+ }
258
+ .btn-danger:hover:not(:disabled) {
259
+ background: rgba(239, 68, 68, 0.25);
260
+ }
261
+ .dialog-overlay {
262
+ position: fixed;
263
+ inset: 0;
264
+ background: rgba(0, 0, 0, 0.7);
265
+ backdrop-filter: blur(4px);
266
+ display: none;
267
+ place-items: center;
268
+ z-index: 100;
269
+ }
270
+ .dialog-overlay.active { display: grid; }
271
+ .dialog {
272
+ background: #141c2e;
273
+ border: 1px solid var(--card-border);
274
+ border-radius: 12px;
275
+ padding: 1.5rem;
276
+ width: 100%;
277
+ max-width: 420px;
278
+ box-shadow: 0 20px 40px rgba(0,0,0,0.5);
279
+ }
280
+ .dialog h3 { font-size: 1.15rem; margin-bottom: 0.5rem; }
281
+ .dialog p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }
282
+ .dialog input {
283
+ width: 100%;
284
+ background: rgba(0, 0, 0, 0.3);
285
+ border: 1px solid var(--card-border);
286
+ border-radius: 6px;
287
+ padding: 0.5rem 0.75rem;
288
+ color: var(--text);
289
+ font-size: 0.9rem;
290
+ margin-bottom: 1rem;
291
+ outline: none;
292
+ }
293
+ .dialog-actions {
294
+ display: flex;
295
+ justify-content: flex-end;
296
+ gap: 0.5rem;
297
+ }
298
+ #toast {
299
+ position: fixed;
300
+ bottom: 1.5rem;
301
+ right: 1.5rem;
302
+ background: #1e293b;
303
+ border: 1px solid var(--card-border);
304
+ padding: 0.75rem 1.25rem;
305
+ border-radius: 8px;
306
+ font-size: 0.85rem;
307
+ box-shadow: 0 10px 25px rgba(0,0,0,0.4);
308
+ display: none;
309
+ z-index: 200;
310
+ animation: slideIn 0.2s ease-out;
311
+ }
312
+ @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
313
+ </style>
314
+ </head>
315
+ <body>
316
+ <header>
317
+ <div class="brand">
318
+ <div class="brand-logo">\u0394</div>
319
+ <div class="brand-text">
320
+ <h1 id="ui-title">TriCache Observability</h1>
321
+ <p id="ui-subtitle">Connecting to live metric stream...</p>
322
+ </div>
323
+ </div>
324
+ <div class="header-meta">
325
+ <div class="badge" id="pod-badge">Pod: ...</div>
326
+ <div class="badge" id="uptime-badge">Uptime: 0s</div>
327
+ <div class="badge" id="cb-badge">L2: ...</div>
328
+ <div class="badge badge-live" id="stream-badge">
329
+ <span class="pulse-dot"></span>
330
+ <span id="stream-text">SSE Live</span>
331
+ </div>
332
+ <select id="peer-select" class="peer-select" style="display:none;" onchange="if(this.value) window.location.href=this.value;">
333
+ <option value="">Switch Pod...</option>
334
+ </select>
335
+ </div>
336
+ </header>
337
+
338
+ <section class="grid">
339
+ <!-- Stat 1: Overall Hit Ratio -->
340
+ <div class="card">
341
+ <div class="card-label">Hit Ratio <span>Global</span></div>
342
+ <div class="card-value" id="val-hit-ratio">0.0%</div>
343
+ <div class="card-sub" id="sub-hit-ratio">0 total gets</div>
344
+ <div class="tier-bar">
345
+ <div class="tier-segment" id="bar-l1" style="background:var(--l1-color); width:0%;"></div>
346
+ <div class="tier-segment" id="bar-disk" style="background:var(--disk-color); width:0%;"></div>
347
+ <div class="tier-segment" id="bar-l2" style="background:var(--l2-color); width:0%;"></div>
348
+ <div class="tier-segment" id="bar-db" style="background:var(--db-color); width:0%;"></div>
349
+ </div>
350
+ <div class="tier-legend">
351
+ <div class="tier-item"><span class="tier-color-dot" style="background:var(--l1-color);"></span> L1 RAM (<span id="pct-l1">0%</span>)</div>
352
+ <div class="tier-item"><span class="tier-color-dot" style="background:var(--disk-color);"></span> Disk (<span id="pct-disk">0%</span>)</div>
353
+ <div class="tier-item"><span class="tier-color-dot" style="background:var(--l2-color);"></span> L2 (<span id="pct-l2">0%</span>)</div>
354
+ <div class="tier-item"><span class="tier-color-dot" style="background:var(--db-color);"></span> DB (<span id="pct-db">0%</span>)</div>
355
+ </div>
356
+ </div>
357
+
358
+ <!-- Stat 2: Singleflight & Stampedes -->
359
+ <div class="card">
360
+ <div class="card-label">Stampedes Prevented <span>Singleflight</span></div>
361
+ <div class="card-value" id="val-stampedes">0</div>
362
+ <div class="card-sub" id="sub-stampedes">0 concurrent coalesced</div>
363
+ </div>
364
+
365
+ <!-- Stat 3: Memory Footprint & OOM Guard -->
366
+ <div class="card">
367
+ <div class="card-label">L1 Heap Memory <span>OOM Guard</span></div>
368
+ <div class="card-value" id="val-memory">0 MB</div>
369
+ <div class="card-sub" id="sub-memory">0 entries | 0 OOM rounds</div>
370
+ </div>
371
+
372
+ <!-- Stat 4: Invalidation Mesh -->
373
+ <div class="card">
374
+ <div class="card-label">Invalidation Mesh <span>Backplane</span></div>
375
+ <div class="card-value" id="val-backplane">0 / 0</div>
376
+ <div class="card-sub" id="sub-backplane">Sent / Received</div>
377
+ </div>
378
+ </section>
379
+
380
+ <!-- Actions & Control Bar -->
381
+ <div class="card">
382
+ <div class="card-label">Operational Controls & Invalidation</div>
383
+ <div class="actions-panel">
384
+ <button class="btn" id="btn-invalidate" onclick="openInvalidateModal()">\u{1F3F7}\uFE0F Invalidate Tag</button>
385
+ <button class="btn btn-danger" id="btn-clear" onclick="openClearModal()">\u{1F9F9} Clear Cache</button>
386
+ <button class="btn" onclick="fetchMetricsSnapshot()">\u{1F504} Refresh Snapshot</button>
387
+ </div>
388
+ </div>
389
+
390
+ <!-- Invalidate Modal -->
391
+ <div class="dialog-overlay" id="invalidate-modal">
392
+ <div class="dialog">
393
+ <h3>Invalidate Tag</h3>
394
+ <p>Increments generational tag version across local tiers and broadcast backplane.</p>
395
+ <input type="text" id="tag-input" placeholder="e.g. products, tenant-123" />
396
+ <div class="dialog-actions">
397
+ <button class="btn" onclick="closeModals()">Cancel</button>
398
+ <button class="btn btn-danger" onclick="submitTagInvalidation()">Invalidate</button>
399
+ </div>
400
+ </div>
401
+ </div>
402
+
403
+ <!-- Clear Modal -->
404
+ <div class="dialog-overlay" id="clear-modal">
405
+ <div class="dialog">
406
+ <h3>Clear Cache</h3>
407
+ <p>Evict all cached keys from the local L1 memory and NVMe disk tiers.</p>
408
+ <div class="dialog-actions">
409
+ <button class="btn" onclick="closeModals()">Cancel</button>
410
+ <button class="btn btn-danger" onclick="submitClear()">Confirm Clear</button>
411
+ </div>
412
+ </div>
413
+ </div>
414
+
415
+ <div id="toast"></div>
416
+
417
+ <script>
418
+ (function() {
419
+ let isReadOnly = false;
420
+ let sseFailed = false;
421
+
422
+ function showToast(msg, duration = 3000) {
423
+ const t = document.getElementById('toast');
424
+ t.innerText = msg;
425
+ t.style.display = 'block';
426
+ setTimeout(() => { t.style.display = 'none'; }, duration);
427
+ }
428
+
429
+ function formatBytes(bytes) {
430
+ if (!bytes || bytes < 1024) return (bytes || 0) + ' B';
431
+ if (bytes < 1048576) return (bytes / 1024).toFixed(1) + ' KB';
432
+ return (bytes / 1048576).toFixed(1) + ' MB';
433
+ }
434
+
435
+ function updateUI(data) {
436
+ if (!data || !data.metrics) return;
437
+ const m = data.metrics;
438
+ isReadOnly = !!data.readOnly;
439
+
440
+ if (data.title) document.getElementById('ui-title').innerText = data.title;
441
+ if (data.instanceId) {
442
+ document.getElementById('pod-badge').innerText = 'Pod: ' + data.instanceId;
443
+ document.getElementById('ui-subtitle').innerText = 'Cluster Instance: ' + data.instanceId + ' | Node ' + (data.nodeVersion || '');
444
+ }
445
+ if (m.uptimeMs) {
446
+ const s = Math.floor(m.uptimeMs / 1000);
447
+ document.getElementById('uptime-badge').innerText = 'Uptime: ' + (s > 3600 ? (s/3600).toFixed(1) + 'h' : s + 's');
448
+ }
449
+ if (m.l2CircuitBreaker) {
450
+ const cb = m.l2CircuitBreaker.state || 'closed';
451
+ const el = document.getElementById('cb-badge');
452
+ el.innerText = 'L2: ' + cb.toUpperCase();
453
+ el.style.color = cb === 'closed' ? 'var(--success)' : 'var(--danger)';
454
+ }
455
+
456
+ // Peer dropdown
457
+ if (data.peerInstances && data.peerInstances.length) {
458
+ const ps = document.getElementById('peer-select');
459
+ ps.style.display = 'inline-block';
460
+ if (ps.options.length <= 1) {
461
+ data.peerInstances.forEach(p => {
462
+ const opt = document.createElement('option');
463
+ opt.value = p.url;
464
+ opt.innerText = p.name;
465
+ ps.appendChild(opt);
466
+ });
467
+ }
468
+ }
469
+
470
+ // Read-only toggle
471
+ if (isReadOnly) {
472
+ document.getElementById('btn-invalidate').disabled = true;
473
+ document.getElementById('btn-clear').disabled = true;
474
+ document.getElementById('btn-invalidate').title = 'Read-Only Mode Enabled';
475
+ document.getElementById('btn-clear').title = 'Read-Only Mode Enabled';
476
+ }
477
+
478
+ // Hit Ratio
479
+ const gets = m.gets ? m.gets.total : 0;
480
+ const l1 = m.gets ? m.gets.l1Hits : 0;
481
+ const disk = m.gets ? m.gets.diskHits : 0;
482
+ const l2 = m.gets ? m.gets.l2Hits : 0;
483
+ const db = m.gets ? m.gets.fetches : 0;
484
+ const hits = l1 + disk + l2;
485
+ const hitRatio = gets > 0 ? (hits / gets * 100).toFixed(1) : '0.0';
486
+
487
+ document.getElementById('val-hit-ratio').innerText = hitRatio + '%';
488
+ document.getElementById('sub-hit-ratio').innerText = hits.toLocaleString() + ' hits / ' + gets.toLocaleString() + ' gets';
489
+
490
+ const pL1 = gets > 0 ? Math.round(l1 / gets * 100) : 0;
491
+ const pDisk = gets > 0 ? Math.round(disk / gets * 100) : 0;
492
+ const pL2 = gets > 0 ? Math.round(l2 / gets * 100) : 0;
493
+ const pDb = gets > 0 ? Math.round(db / gets * 100) : 0;
494
+
495
+ document.getElementById('bar-l1').style.width = pL1 + '%';
496
+ document.getElementById('bar-disk').style.width = pDisk + '%';
497
+ document.getElementById('bar-l2').style.width = pL2 + '%';
498
+ document.getElementById('bar-db').style.width = pDb + '%';
499
+
500
+ document.getElementById('pct-l1').innerText = pL1 + '%';
501
+ document.getElementById('pct-disk').innerText = pDisk + '%';
502
+ document.getElementById('pct-l2').innerText = pL2 + '%';
503
+ document.getElementById('pct-db').innerText = pDb + '%';
504
+
505
+ // Stampedes
506
+ const st = m.gets ? m.gets.stampedePrevented : 0;
507
+ document.getElementById('val-stampedes').innerText = st.toLocaleString();
508
+ document.getElementById('sub-stampedes').innerText = (m.revalidations ? m.revalidations.total : 0) + ' SWR refreshes';
509
+
510
+ // Memory
511
+ const mem = m.l1 ? m.l1.sizeBytes : 0;
512
+ const entries = m.l1 ? m.l1.entries : 0;
513
+ const oom = m.oom ? m.oom.evictions : 0;
514
+ document.getElementById('val-memory').innerText = formatBytes(mem);
515
+ document.getElementById('sub-memory').innerText = entries.toLocaleString() + ' entries | ' + oom + ' OOM purges';
516
+
517
+ // Backplane & Mesh
518
+ const bpSent = m.backplane ? m.backplane.sent : 0;
519
+ const bpRecv = m.backplane ? m.backplane.received : 0;
520
+ document.getElementById('val-backplane').innerText = bpSent + ' / ' + bpRecv;
521
+ if (m.crossRegion && m.crossRegion.enabled) {
522
+ document.getElementById('sub-backplane').innerText = 'Cross-Region: ' + m.crossRegion.sent + ' sent, ' + m.crossRegion.received + ' recv';
523
+ }
524
+ }
525
+
526
+ window.fetchMetricsSnapshot = function() {
527
+ fetch('api/metrics')
528
+ .then(r => r.json())
529
+ .then(data => updateUI(data))
530
+ .catch(err => showToast('Failed to fetch snapshot: ' + err.message));
531
+ };
532
+
533
+ function connectSSE() {
534
+ if (typeof EventSource === 'undefined') {
535
+ fallbackPolling();
536
+ return;
537
+ }
538
+ const sse = new EventSource('api/stream');
539
+ sse.onmessage = function(e) {
540
+ try {
541
+ const data = JSON.parse(e.data);
542
+ updateUI(data);
543
+ } catch(err) { /* ignore */ }
544
+ };
545
+ sse.onerror = function() {
546
+ sse.close();
547
+ if (!sseFailed) {
548
+ sseFailed = true;
549
+ document.getElementById('stream-badge').className = 'badge';
550
+ document.getElementById('stream-text').innerText = 'Polling Active';
551
+ fallbackPolling();
552
+ }
553
+ };
554
+ }
555
+
556
+ function fallbackPolling() {
557
+ fetchMetricsSnapshot();
558
+ setInterval(fetchMetricsSnapshot, 3000);
559
+ }
560
+
561
+ window.openInvalidateModal = function() {
562
+ if (isReadOnly) return;
563
+ document.getElementById('invalidate-modal').classList.add('active');
564
+ document.getElementById('tag-input').focus();
565
+ };
566
+ window.openClearModal = function() {
567
+ if (isReadOnly) return;
568
+ document.getElementById('clear-modal').classList.add('active');
569
+ };
570
+ window.closeModals = function() {
571
+ document.getElementById('invalidate-modal').classList.remove('active');
572
+ document.getElementById('clear-modal').classList.remove('active');
573
+ };
574
+
575
+ window.submitTagInvalidation = function() {
576
+ const tag = document.getElementById('tag-input').value.trim();
577
+ if (!tag) return;
578
+ fetch('api/actions/invalidate-tag', {
579
+ method: 'POST',
580
+ headers: {
581
+ 'Content-Type': 'application/json',
582
+ 'X-TriCache-Action': '1'
583
+ },
584
+ body: JSON.stringify({ tag })
585
+ })
586
+ .then(r => r.json())
587
+ .then(res => {
588
+ closeModals();
589
+ document.getElementById('tag-input').value = '';
590
+ if (res.ok) {
591
+ showToast('Tag "' + tag + '" invalidated across fleet');
592
+ fetchMetricsSnapshot();
593
+ } else {
594
+ showToast('Error: ' + (res.error || 'Failed'));
595
+ }
596
+ })
597
+ .catch(e => showToast('Request failed: ' + e.message));
598
+ };
599
+
600
+ window.submitClear = function() {
601
+ fetch('api/actions/clear', {
602
+ method: 'POST',
603
+ headers: {
604
+ 'Content-Type': 'application/json',
605
+ 'X-TriCache-Action': '1'
606
+ }
607
+ })
608
+ .then(r => r.json())
609
+ .then(res => {
610
+ closeModals();
611
+ if (res.ok) {
612
+ showToast('Local cache tiers cleared');
613
+ fetchMetricsSnapshot();
614
+ } else {
615
+ showToast('Error: ' + (res.error || 'Failed'));
616
+ }
617
+ })
618
+ .catch(e => showToast('Clear failed: ' + e.message));
619
+ };
620
+
621
+ // Bootstrap on load
622
+ fetchMetricsSnapshot();
623
+ connectSSE();
624
+ })();
625
+ </script>
626
+ </body>
627
+ </html>`;
628
+ var DASHBOARD_GZIP_BUFFER = (0, import_node_zlib.gzipSync)(Buffer.from(DASHBOARD_HTML, "utf-8"));
629
+
630
+ // src/dashboard/handler.ts
631
+ function safeCompare(a, b) {
632
+ if (typeof a !== "string" || typeof b !== "string") return false;
633
+ const hashA = (0, import_node_crypto.createHash)("sha256").update(a).digest();
634
+ const hashB = (0, import_node_crypto.createHash)("sha256").update(b).digest();
635
+ return (0, import_node_crypto.timingSafeEqual)(hashA, hashB);
636
+ }
637
+ var SECURITY_HEADERS = {
638
+ "Content-Security-Policy": "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self'",
639
+ "X-Frame-Options": "DENY",
640
+ "X-Content-Type-Options": "nosniff",
641
+ "Referrer-Policy": "same-origin",
642
+ "Cache-Control": "no-store, no-cache, must-revalidate"
643
+ };
644
+ function resolveInstanceId(custom) {
645
+ if (custom && custom.trim()) return custom.trim();
646
+ if (process.env.POD_NAME) return process.env.POD_NAME;
647
+ if (process.env.HOSTNAME) return process.env.HOSTNAME;
648
+ try {
649
+ return import_node_os.default.hostname();
650
+ } catch {
651
+ return "tricache-node";
652
+ }
653
+ }
654
+ function buildMetricsPayload(options) {
655
+ const metrics = options.cache.metrics();
656
+ return {
657
+ title: options.title || "TriCache Observability",
658
+ instanceId: resolveInstanceId(options.instanceId),
659
+ nodeVersion: process.version,
660
+ readOnly: !!options.readOnly,
661
+ peerInstances: options.peerInstances || [],
662
+ metrics: {
663
+ ...metrics,
664
+ health: {
665
+ status: metrics.l2CircuitBreaker?.state === "open" ? "degraded" : "healthy",
666
+ circuitBreaker: metrics.l2CircuitBreaker?.state || "closed",
667
+ uptimeMs: metrics.uptimeMs
668
+ }
669
+ },
670
+ timestamp: Date.now()
671
+ };
672
+ }
673
+ function verifyAuth(req, options) {
674
+ const url = new URL(req.url, "http://localhost");
675
+ if (options.auth) {
676
+ const authHeader = req.headers.get("authorization") || "";
677
+ if (!authHeader.toLowerCase().startsWith("basic ")) {
678
+ return { authorized: false };
679
+ }
680
+ const b64 = authHeader.slice(6).trim();
681
+ let decoded = "";
682
+ try {
683
+ decoded = Buffer.from(b64, "base64").toString("utf-8");
684
+ } catch {
685
+ return { authorized: false };
686
+ }
687
+ const colonIdx = decoded.indexOf(":");
688
+ if (colonIdx === -1) return { authorized: false };
689
+ const username = decoded.slice(0, colonIdx);
690
+ const password = decoded.slice(colonIdx + 1);
691
+ const userMatch = safeCompare(username, options.auth.username);
692
+ const passMatch = safeCompare(password, options.auth.password);
693
+ if (userMatch && passMatch) {
694
+ return { authorized: true, user: username };
695
+ }
696
+ return { authorized: false };
697
+ }
698
+ if (options.authSecret) {
699
+ const authHeader = req.headers.get("authorization") || "";
700
+ if (authHeader.toLowerCase().startsWith("bearer ")) {
701
+ const token = authHeader.slice(7).trim();
702
+ if (safeCompare(token, options.authSecret)) {
703
+ return { authorized: true, user: "token-client" };
704
+ }
705
+ }
706
+ const queryToken = url.searchParams.get("token");
707
+ if (queryToken && safeCompare(queryToken, options.authSecret)) {
708
+ return { authorized: true, user: "token-client" };
709
+ }
710
+ return { authorized: false };
711
+ }
712
+ return { authorized: true, user: "anonymous" };
713
+ }
714
+ function verifyCsrf(req) {
715
+ const customHeader = req.headers.get("x-tricache-action");
716
+ if (customHeader !== "1") {
717
+ return false;
718
+ }
719
+ const origin = req.headers.get("origin");
720
+ const host = req.headers.get("host");
721
+ if (origin && host) {
722
+ try {
723
+ const originHost = new URL(origin).host;
724
+ if (originHost !== host) return false;
725
+ } catch {
726
+ return false;
727
+ }
728
+ }
729
+ return true;
730
+ }
731
+ async function handleDashboardRequest(req, options) {
732
+ const authResult = verifyAuth(req, options);
733
+ if (!authResult.authorized) {
734
+ return new Response(JSON.stringify({ error: "Unauthorized" }), {
735
+ status: 401,
736
+ headers: {
737
+ "Content-Type": "application/json",
738
+ ...options.auth ? { "WWW-Authenticate": 'Basic realm="TriCache Dashboard"' } : {}
739
+ }
740
+ });
741
+ }
742
+ const url = new URL(req.url, "http://localhost");
743
+ let pathname = url.pathname;
744
+ const basePath = (options.basePath || "").replace(/\/+$/, "");
745
+ if (basePath && pathname.startsWith(basePath)) {
746
+ pathname = pathname.slice(basePath.length) || "/";
747
+ }
748
+ if (!pathname.startsWith("/")) {
749
+ pathname = "/" + pathname;
750
+ }
751
+ if (pathname === "/api/stream" && req.method === "GET") {
752
+ const encoder = new TextEncoder();
753
+ const intervalMs = Math.max(500, options.streamIntervalMs || 2e3);
754
+ let ticker = null;
755
+ const stream = new ReadableStream({
756
+ start(controller) {
757
+ try {
758
+ const initial = buildMetricsPayload(options);
759
+ controller.enqueue(encoder.encode(`data: ${JSON.stringify(initial)}
760
+
761
+ `));
762
+ } catch {
763
+ }
764
+ ticker = setInterval(() => {
765
+ try {
766
+ const data = buildMetricsPayload(options);
767
+ controller.enqueue(encoder.encode(`data: ${JSON.stringify(data)}
768
+
769
+ `));
770
+ } catch {
771
+ if (ticker) clearInterval(ticker);
772
+ try {
773
+ controller.close();
774
+ } catch {
775
+ }
776
+ }
777
+ }, intervalMs);
778
+ if (req.signal) {
779
+ req.signal.addEventListener("abort", () => {
780
+ if (ticker) {
781
+ clearInterval(ticker);
782
+ ticker = null;
783
+ }
784
+ try {
785
+ controller.close();
786
+ } catch {
787
+ }
788
+ });
789
+ }
790
+ },
791
+ cancel() {
792
+ if (ticker) {
793
+ clearInterval(ticker);
794
+ ticker = null;
795
+ }
796
+ }
797
+ });
798
+ return new Response(stream, {
799
+ status: 200,
800
+ headers: {
801
+ "Content-Type": "text/event-stream",
802
+ "Cache-Control": "no-cache, no-transform",
803
+ "Connection": "keep-alive",
804
+ "X-Accel-Buffering": "no"
805
+ }
806
+ });
807
+ }
808
+ if (pathname === "/api/metrics" && req.method === "GET") {
809
+ const payload = buildMetricsPayload(options);
810
+ return new Response(JSON.stringify(payload), {
811
+ status: 200,
812
+ headers: {
813
+ "Content-Type": "application/json",
814
+ "Cache-Control": "no-store, no-cache, must-revalidate"
815
+ }
816
+ });
817
+ }
818
+ if (pathname === "/api/actions/invalidate-tag" && req.method === "POST") {
819
+ const clientIp = req.headers.get("x-forwarded-for") || void 0;
820
+ if (options.readOnly) {
821
+ return new Response(JSON.stringify({ ok: false, error: "Dashboard is in read-only mode" }), {
822
+ status: 403,
823
+ headers: { "Content-Type": "application/json" }
824
+ });
825
+ }
826
+ if (!verifyCsrf(req)) {
827
+ return new Response(JSON.stringify({ ok: false, error: "Invalid or missing CSRF headers" }), {
828
+ status: 403,
829
+ headers: { "Content-Type": "application/json" }
830
+ });
831
+ }
832
+ try {
833
+ const body = await req.json();
834
+ const tag = body?.tag?.trim();
835
+ if (!tag) {
836
+ return new Response(JSON.stringify({ ok: false, error: "Tag parameter is required" }), {
837
+ status: 400,
838
+ headers: { "Content-Type": "application/json" }
839
+ });
840
+ }
841
+ await options.cache.invalidateTag(tag);
842
+ options.onAction?.({
843
+ action: "invalidate-tag",
844
+ target: tag,
845
+ user: authResult.user,
846
+ ip: clientIp,
847
+ timestamp: Date.now(),
848
+ success: true
849
+ });
850
+ return new Response(JSON.stringify({ ok: true, tag }), {
851
+ status: 200,
852
+ headers: { "Content-Type": "application/json" }
853
+ });
854
+ } catch (err) {
855
+ const errMsg = err instanceof Error ? err.message : String(err);
856
+ options.onAction?.({
857
+ action: "invalidate-tag",
858
+ user: authResult.user,
859
+ ip: clientIp,
860
+ timestamp: Date.now(),
861
+ success: false,
862
+ error: errMsg
863
+ });
864
+ return new Response(JSON.stringify({ ok: false, error: errMsg }), {
865
+ status: 500,
866
+ headers: { "Content-Type": "application/json" }
867
+ });
868
+ }
869
+ }
870
+ if (pathname === "/api/actions/clear" && req.method === "POST") {
871
+ const clientIp = req.headers.get("x-forwarded-for") || void 0;
872
+ if (options.readOnly) {
873
+ return new Response(JSON.stringify({ ok: false, error: "Dashboard is in read-only mode" }), {
874
+ status: 403,
875
+ headers: { "Content-Type": "application/json" }
876
+ });
877
+ }
878
+ if (!verifyCsrf(req)) {
879
+ return new Response(JSON.stringify({ ok: false, error: "Invalid or missing CSRF headers" }), {
880
+ status: 403,
881
+ headers: { "Content-Type": "application/json" }
882
+ });
883
+ }
884
+ try {
885
+ await options.cache.clear();
886
+ options.onAction?.({
887
+ action: "clear",
888
+ user: authResult.user,
889
+ ip: clientIp,
890
+ timestamp: Date.now(),
891
+ success: true
892
+ });
893
+ return new Response(JSON.stringify({ ok: true }), {
894
+ status: 200,
895
+ headers: { "Content-Type": "application/json" }
896
+ });
897
+ } catch (err) {
898
+ const errMsg = err instanceof Error ? err.message : String(err);
899
+ options.onAction?.({
900
+ action: "clear",
901
+ user: authResult.user,
902
+ ip: clientIp,
903
+ timestamp: Date.now(),
904
+ success: false,
905
+ error: errMsg
906
+ });
907
+ return new Response(JSON.stringify({ ok: false, error: errMsg }), {
908
+ status: 500,
909
+ headers: { "Content-Type": "application/json" }
910
+ });
911
+ }
912
+ }
913
+ if (pathname === "/" || pathname === "/index.html" || pathname === "") {
914
+ const acceptEncoding = req.headers.get("accept-encoding") || "";
915
+ if (acceptEncoding.includes("gzip")) {
916
+ return new Response(new Uint8Array(DASHBOARD_GZIP_BUFFER), {
917
+ status: 200,
918
+ headers: {
919
+ "Content-Type": "text/html; charset=utf-8",
920
+ "Content-Encoding": "gzip",
921
+ "Content-Length": String(DASHBOARD_GZIP_BUFFER.length),
922
+ ...SECURITY_HEADERS
923
+ }
924
+ });
925
+ }
926
+ return new Response(DASHBOARD_HTML, {
927
+ status: 200,
928
+ headers: {
929
+ "Content-Type": "text/html; charset=utf-8",
930
+ ...SECURITY_HEADERS
931
+ }
932
+ });
933
+ }
934
+ return new Response(JSON.stringify({ error: "Not Found" }), {
935
+ status: 404,
936
+ headers: { "Content-Type": "application/json" }
937
+ });
938
+ }
939
+
940
+ // src/dashboard/index.ts
941
+ async function nodeToWebRequest(req) {
942
+ const protocol = req.socket.encrypted ? "https" : "http";
943
+ const host = req.headers.host || "localhost";
944
+ const url = new URL(req.url || "/", `${protocol}://${host}`);
945
+ const headers = new Headers();
946
+ for (const [key, val] of Object.entries(req.headers)) {
947
+ if (val === void 0) continue;
948
+ if (Array.isArray(val)) {
949
+ for (const item of val) headers.append(key, item);
950
+ } else {
951
+ headers.set(key, val);
952
+ }
953
+ }
954
+ let body = null;
955
+ if (req.method !== "GET" && req.method !== "HEAD") {
956
+ const chunks = [];
957
+ for await (const chunk of req) {
958
+ chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
959
+ }
960
+ if (chunks.length > 0) {
961
+ body = Buffer.concat(chunks);
962
+ }
963
+ }
964
+ const controller = new AbortController();
965
+ req.on("close", () => {
966
+ if (req.destroyed || !req.complete) {
967
+ controller.abort();
968
+ }
969
+ });
970
+ const init = {
971
+ method: req.method,
972
+ headers,
973
+ body: body ? body : null,
974
+ signal: controller.signal
975
+ };
976
+ if (body) {
977
+ init.duplex = "half";
978
+ }
979
+ return new Request(url.toString(), init);
980
+ }
981
+ async function pipeWebResponseToNode(webRes, nodeRes) {
982
+ nodeRes.statusCode = webRes.status;
983
+ webRes.headers.forEach((val, key) => {
984
+ nodeRes.setHeader(key, val);
985
+ });
986
+ if (!webRes.body) {
987
+ nodeRes.end();
988
+ return;
989
+ }
990
+ const reader = webRes.body.getReader();
991
+ try {
992
+ while (true) {
993
+ const { done, value } = await reader.read();
994
+ if (done) break;
995
+ nodeRes.write(value);
996
+ }
997
+ } finally {
998
+ nodeRes.end();
999
+ }
1000
+ }
1001
+ function tricacheDashboard(options) {
1002
+ return async (req, res, next) => {
1003
+ try {
1004
+ const webReq = await nodeToWebRequest(req);
1005
+ const webRes = await handleDashboardRequest(webReq, options);
1006
+ await pipeWebResponseToNode(webRes, res);
1007
+ } catch (err) {
1008
+ if (typeof next === "function") {
1009
+ next(err);
1010
+ } else {
1011
+ res.statusCode = 500;
1012
+ res.end(JSON.stringify({ error: "Internal Server Error" }));
1013
+ }
1014
+ }
1015
+ };
1016
+ }
1017
+ function createNextDashboardHandlers(options) {
1018
+ const handler = async (req) => {
1019
+ return handleDashboardRequest(req, options);
1020
+ };
1021
+ return {
1022
+ GET: handler,
1023
+ POST: handler
1024
+ };
1025
+ }
1026
+ async function startDashboardServer(options) {
1027
+ const port = options.port || 9090;
1028
+ const host = options.host || "127.0.0.1";
1029
+ const middleware = tricacheDashboard(options);
1030
+ const server = import_node_http.default.createServer((req, res) => {
1031
+ middleware(req, res).catch((err) => {
1032
+ res.statusCode = 500;
1033
+ res.end(String(err));
1034
+ });
1035
+ });
1036
+ await new Promise((resolve, reject) => {
1037
+ server.once("error", reject);
1038
+ server.listen(port, host, () => {
1039
+ server.off("error", reject);
1040
+ resolve();
1041
+ });
1042
+ });
1043
+ const actualAddress = server.address();
1044
+ const actualPort = typeof actualAddress === "object" && actualAddress ? actualAddress.port : port;
1045
+ return {
1046
+ server,
1047
+ port: actualPort,
1048
+ host,
1049
+ close: () => new Promise((resolve, reject) => {
1050
+ server.close((err) => err ? reject(err) : resolve());
1051
+ })
1052
+ };
1053
+ }
1054
+ // Annotate the CommonJS export names for ESM import in node:
1055
+ 0 && (module.exports = {
1056
+ DASHBOARD_GZIP_BUFFER,
1057
+ DASHBOARD_HTML,
1058
+ buildMetricsPayload,
1059
+ createNextDashboardHandlers,
1060
+ handleDashboardRequest,
1061
+ resolveInstanceId,
1062
+ safeCompare,
1063
+ startDashboardServer,
1064
+ tricacheDashboard
1065
+ });