@adonis-agora/telescope 0.5.2 → 0.7.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.
- package/CHANGELOG.md +26 -0
- package/dist/configure.d.ts.map +1 -1
- package/dist/configure.js +6 -0
- package/dist/configure.js.map +1 -1
- package/dist/providers/telescope_alerts_provider.d.ts.map +1 -1
- package/dist/providers/telescope_alerts_provider.js +1 -1
- package/dist/providers/telescope_alerts_provider.js.map +1 -1
- package/dist/providers/telescope_cpu_profiling_provider.d.ts +28 -0
- package/dist/providers/telescope_cpu_profiling_provider.d.ts.map +1 -0
- package/dist/providers/telescope_cpu_profiling_provider.js +45 -0
- package/dist/providers/telescope_cpu_profiling_provider.js.map +1 -0
- package/dist/providers/telescope_mcp_provider.d.ts.map +1 -1
- package/dist/providers/telescope_mcp_provider.js +1 -1
- package/dist/providers/telescope_mcp_provider.js.map +1 -1
- package/dist/providers/telescope_provider.d.ts.map +1 -1
- package/dist/providers/telescope_provider.js +9 -3
- package/dist/providers/telescope_provider.js.map +1 -1
- package/dist/providers/telescope_ui_provider.d.ts.map +1 -1
- package/dist/providers/telescope_ui_provider.js +163 -12
- package/dist/providers/telescope_ui_provider.js.map +1 -1
- package/dist/providers/telescope_watchers_provider.d.ts +10 -0
- package/dist/providers/telescope_watchers_provider.d.ts.map +1 -1
- package/dist/providers/telescope_watchers_provider.js +32 -0
- package/dist/providers/telescope_watchers_provider.js.map +1 -1
- package/dist/src/ai/index.d.ts +1 -1
- package/dist/src/ai/index.js +1 -1
- package/dist/src/alerts/alert_rule.d.ts +84 -3
- package/dist/src/alerts/alert_rule.d.ts.map +1 -1
- package/dist/src/alerts/alerter.d.ts +24 -2
- package/dist/src/alerts/alerter.d.ts.map +1 -1
- package/dist/src/alerts/alerter.js +122 -11
- package/dist/src/alerts/alerter.js.map +1 -1
- package/dist/src/alerts/define_config.d.ts +9 -1
- package/dist/src/alerts/define_config.d.ts.map +1 -1
- package/dist/src/alerts/define_config.js +8 -0
- package/dist/src/alerts/define_config.js.map +1 -1
- package/dist/src/alerts/exception_source.d.ts +16 -7
- package/dist/src/alerts/exception_source.d.ts.map +1 -1
- package/dist/src/alerts/exception_source.js +29 -17
- package/dist/src/alerts/exception_source.js.map +1 -1
- package/dist/src/alerts/index.d.ts +2 -2
- package/dist/src/alerts/index.d.ts.map +1 -1
- package/dist/src/alerts/index.js +1 -1
- package/dist/src/alerts/index.js.map +1 -1
- package/dist/src/alerts/slack_format.d.ts +8 -0
- package/dist/src/alerts/slack_format.d.ts.map +1 -1
- package/dist/src/alerts/slack_format.js +128 -3
- package/dist/src/alerts/slack_format.js.map +1 -1
- package/dist/src/client_errors/ingestor.d.ts.map +1 -1
- package/dist/src/client_errors/ingestor.js +20 -1
- package/dist/src/client_errors/ingestor.js.map +1 -1
- package/dist/src/client_errors/validation.d.ts.map +1 -1
- package/dist/src/client_errors/validation.js +7 -2
- package/dist/src/client_errors/validation.js.map +1 -1
- package/dist/src/define_config.d.ts +51 -0
- package/dist/src/define_config.d.ts.map +1 -1
- package/dist/src/define_config.js +6 -0
- package/dist/src/define_config.js.map +1 -1
- package/dist/src/diagnostics_registry.d.ts +15 -0
- package/dist/src/diagnostics_registry.d.ts.map +1 -1
- package/dist/src/diagnostics_registry.js +19 -0
- package/dist/src/diagnostics_registry.js.map +1 -1
- package/dist/src/diagnostics_watcher.d.ts +28 -1
- package/dist/src/diagnostics_watcher.d.ts.map +1 -1
- package/dist/src/diagnostics_watcher.js +17 -2
- package/dist/src/diagnostics_watcher.js.map +1 -1
- package/dist/src/entry.d.ts +8 -0
- package/dist/src/entry.d.ts.map +1 -1
- package/dist/src/entry.js +8 -0
- package/dist/src/entry.js.map +1 -1
- package/dist/src/extension/types.d.ts +35 -2
- package/dist/src/extension/types.d.ts.map +1 -1
- package/dist/src/extension/types.js.map +1 -1
- package/dist/src/index.d.ts +7 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/index.d.ts +1 -1
- package/dist/src/mcp/index.js +1 -1
- package/dist/src/mcp/server.d.ts.map +1 -1
- package/dist/src/mcp/server.js +7 -2
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/metrics/waterfall.d.ts.map +1 -1
- package/dist/src/metrics/waterfall.js +6 -0
- package/dist/src/metrics/waterfall.js.map +1 -1
- package/dist/src/profiling/aggregate-profile.d.ts +21 -0
- package/dist/src/profiling/aggregate-profile.d.ts.map +1 -0
- package/dist/src/profiling/aggregate-profile.js +124 -0
- package/dist/src/profiling/aggregate-profile.js.map +1 -0
- package/dist/src/profiling/cpu-profiler.d.ts +59 -0
- package/dist/src/profiling/cpu-profiler.d.ts.map +1 -0
- package/dist/src/profiling/cpu-profiler.js +94 -0
- package/dist/src/profiling/cpu-profiler.js.map +1 -0
- package/dist/src/profiling/define_config.d.ts +38 -0
- package/dist/src/profiling/define_config.d.ts.map +1 -0
- package/dist/src/profiling/define_config.js +23 -0
- package/dist/src/profiling/define_config.js.map +1 -0
- package/dist/src/profiling/index.d.ts +11 -0
- package/dist/src/profiling/index.d.ts.map +1 -0
- package/dist/src/profiling/index.js +7 -0
- package/dist/src/profiling/index.js.map +1 -0
- package/dist/src/profiling/profiler_service.d.ts +100 -0
- package/dist/src/profiling/profiler_service.d.ts.map +1 -0
- package/dist/src/profiling/profiler_service.js +162 -0
- package/dist/src/profiling/profiler_service.js.map +1 -0
- package/dist/src/profiling/types.d.ts +86 -0
- package/dist/src/profiling/types.d.ts.map +1 -0
- package/dist/src/profiling/types.js +5 -0
- package/dist/src/profiling/types.js.map +1 -0
- package/dist/src/redaction/redact.d.ts +21 -0
- package/dist/src/redaction/redact.d.ts.map +1 -1
- package/dist/src/redaction/redact.js +18 -0
- package/dist/src/redaction/redact.js.map +1 -1
- package/dist/src/redaction/redacting_store.d.ts.map +1 -1
- package/dist/src/redaction/redacting_store.js +10 -1
- package/dist/src/redaction/redacting_store.js.map +1 -1
- package/dist/src/registry.d.ts +36 -1
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +24 -1
- package/dist/src/registry.js.map +1 -1
- package/dist/src/request_watcher.d.ts +68 -0
- package/dist/src/request_watcher.d.ts.map +1 -1
- package/dist/src/request_watcher.js +101 -0
- package/dist/src/request_watcher.js.map +1 -1
- package/dist/src/service.d.ts.map +1 -1
- package/dist/src/service.js.map +1 -1
- package/dist/src/telescope_middleware.d.ts.map +1 -1
- package/dist/src/telescope_middleware.js +30 -1
- package/dist/src/telescope_middleware.js.map +1 -1
- package/dist/src/ui/api.d.ts +41 -1
- package/dist/src/ui/api.d.ts.map +1 -1
- package/dist/src/ui/api.js +27 -1
- package/dist/src/ui/api.js.map +1 -1
- package/dist/src/ui/dashboard.html +58 -10
- package/dist/src/ui/define_config.d.ts +26 -0
- package/dist/src/ui/define_config.d.ts.map +1 -1
- package/dist/src/ui/define_config.js +8 -0
- package/dist/src/ui/define_config.js.map +1 -1
- package/dist/src/ui/diagnosis_api.d.ts +33 -0
- package/dist/src/ui/diagnosis_api.d.ts.map +1 -0
- package/dist/src/ui/diagnosis_api.js +60 -0
- package/dist/src/ui/diagnosis_api.js.map +1 -0
- package/dist/src/ui/ext_table.d.ts +50 -0
- package/dist/src/ui/ext_table.d.ts.map +1 -0
- package/dist/src/ui/ext_table.js +42 -0
- package/dist/src/ui/ext_table.js.map +1 -0
- package/dist/src/ui/extension_api.d.ts +6 -2
- package/dist/src/ui/extension_api.d.ts.map +1 -1
- package/dist/src/ui/extension_api.js +7 -2
- package/dist/src/ui/extension_api.js.map +1 -1
- package/dist/src/ui/index.d.ts +10 -2
- package/dist/src/ui/index.d.ts.map +1 -1
- package/dist/src/ui/index.js +9 -1
- package/dist/src/ui/index.js.map +1 -1
- package/dist/src/ui/profiles_api.d.ts +48 -0
- package/dist/src/ui/profiles_api.d.ts.map +1 -0
- package/dist/src/ui/profiles_api.js +94 -0
- package/dist/src/ui/profiles_api.js.map +1 -0
- package/dist/src/ui/queue_manager_api.d.ts +46 -0
- package/dist/src/ui/queue_manager_api.d.ts.map +1 -0
- package/dist/src/ui/queue_manager_api.js +118 -0
- package/dist/src/ui/queue_manager_api.js.map +1 -0
- package/dist/src/ui/schedules_api.d.ts +43 -0
- package/dist/src/ui/schedules_api.d.ts.map +1 -0
- package/dist/src/ui/schedules_api.js +46 -0
- package/dist/src/ui/schedules_api.js.map +1 -0
- package/dist/src/watchers/cron_next_run.d.ts +8 -0
- package/dist/src/watchers/cron_next_run.d.ts.map +1 -0
- package/dist/src/watchers/cron_next_run.js +67 -0
- package/dist/src/watchers/cron_next_run.js.map +1 -0
- package/dist/src/watchers/define_config.d.ts +28 -1
- package/dist/src/watchers/define_config.d.ts.map +1 -1
- package/dist/src/watchers/define_config.js +5 -0
- package/dist/src/watchers/define_config.js.map +1 -1
- package/dist/src/watchers/index.d.ts +7 -4
- package/dist/src/watchers/index.d.ts.map +1 -1
- package/dist/src/watchers/index.js +5 -2
- package/dist/src/watchers/index.js.map +1 -1
- package/dist/src/watchers/queue_manager.d.ts +229 -0
- package/dist/src/watchers/queue_manager.d.ts.map +1 -0
- package/dist/src/watchers/queue_manager.js +223 -0
- package/dist/src/watchers/queue_manager.js.map +1 -0
- package/dist/src/watchers/schedule_watcher.d.ts +94 -1
- package/dist/src/watchers/schedule_watcher.d.ts.map +1 -1
- package/dist/src/watchers/schedule_watcher.js +89 -2
- package/dist/src/watchers/schedule_watcher.js.map +1 -1
- package/dist/stubs/config/telescope_cpu_profiling.stub +0 -0
- package/package.json +29 -14
|
@@ -181,6 +181,10 @@
|
|
|
181
181
|
.card th, .card td { padding: 5px 8px; }
|
|
182
182
|
.card td a { color: var(--accent); text-decoration: none; }
|
|
183
183
|
.card td a:hover { text-decoration: underline; }
|
|
184
|
+
.pager { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); }
|
|
185
|
+
.pager button { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 5px; padding: 2px 8px; cursor: pointer; font-size: 11px; }
|
|
186
|
+
.pager button:hover:not(:disabled) { background: var(--border); }
|
|
187
|
+
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
|
|
184
188
|
.barlist { display: flex; flex-direction: column; gap: 6px; }
|
|
185
189
|
.barlist .row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; }
|
|
186
190
|
.barlist .track { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
|
|
@@ -457,9 +461,19 @@
|
|
|
457
461
|
})
|
|
458
462
|
.join('') + '</div>';
|
|
459
463
|
}
|
|
464
|
+
// Pager state for a paged table panel — a faithful mirror of core's
|
|
465
|
+
// `tablePagination` (src/ui/ext_table.ts), which is the unit-tested source
|
|
466
|
+
// of truth for this math. Keep the two in sync.
|
|
467
|
+
function tablePagination(data) {
|
|
468
|
+
var rows = data.rows || [];
|
|
469
|
+
var page = Math.max(1, data.page || 1);
|
|
470
|
+
var limit = data.limit && data.limit > 0 ? data.limit : (rows.length || 1);
|
|
471
|
+
var total = data.total != null ? data.total : rows.length;
|
|
472
|
+
var totalPages = Math.max(1, Math.ceil(total / limit));
|
|
473
|
+
return { page: page, limit: limit, total: total, totalPages: totalPages, hasPrev: page > 1, hasNext: page < totalPages };
|
|
474
|
+
}
|
|
460
475
|
function panelTable(panel, data) {
|
|
461
476
|
var cols = panel.columns || [], rows = data.rows || [];
|
|
462
|
-
if (!rows.length) return '<div class="muted-pill">no data</div>';
|
|
463
477
|
var head = '<tr>' + cols.map(function (c) { return '<th>' + esc(c.label) + '</th>'; }).join('') + '</tr>';
|
|
464
478
|
var body = rows
|
|
465
479
|
.map(function (row) {
|
|
@@ -475,7 +489,20 @@
|
|
|
475
489
|
.join('') + '</tr>';
|
|
476
490
|
})
|
|
477
491
|
.join('');
|
|
478
|
-
|
|
492
|
+
if (!panel.paged) {
|
|
493
|
+
if (!rows.length) return '<div class="muted-pill">no data</div>';
|
|
494
|
+
return '<table><thead>' + head + '</thead><tbody>' + body + '</tbody></table>';
|
|
495
|
+
}
|
|
496
|
+
// Paged: render the table (even when empty) + prev/next controls so the
|
|
497
|
+
// operator can page through the provider's full result set.
|
|
498
|
+
var p = tablePagination(data);
|
|
499
|
+
var emptyRow = rows.length ? '' : '<tr><td colspan="' + cols.length + '" class="muted-pill" style="text-align:center">no data</td></tr>';
|
|
500
|
+
var pager = '<div class="pager">' +
|
|
501
|
+
'<button type="button" class="pager-prev"' + (p.hasPrev ? '' : ' disabled') + '>Prev</button>' +
|
|
502
|
+
'<span>Page ' + p.page + ' of ' + p.totalPages + '</span>' +
|
|
503
|
+
'<button type="button" class="pager-next"' + (p.hasNext ? '' : ' disabled') + '>Next</button>' +
|
|
504
|
+
'</div>';
|
|
505
|
+
return '<table><thead>' + head + '</thead><tbody>' + emptyRow + body + '</tbody></table>' + pager;
|
|
479
506
|
}
|
|
480
507
|
function renderPanelBody(panel, data) {
|
|
481
508
|
if (panel.kind === 'stat') {
|
|
@@ -518,14 +545,35 @@
|
|
|
518
545
|
var binding = panel.data || {};
|
|
519
546
|
var provider = binding.provider || '';
|
|
520
547
|
var ext = provider.split('.')[0];
|
|
521
|
-
var
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
.
|
|
527
|
-
|
|
528
|
-
|
|
548
|
+
var baseQuery = binding.query || {};
|
|
549
|
+
var isPaged = panel.kind === 'table' && panel.paged;
|
|
550
|
+
function wirePager(currentPage) {
|
|
551
|
+
var prev = card.querySelector('.pager-prev');
|
|
552
|
+
var next = card.querySelector('.pager-next');
|
|
553
|
+
if (prev && !prev.disabled) prev.addEventListener('click', function () { load(currentPage - 1); });
|
|
554
|
+
if (next && !next.disabled) next.addEventListener('click', function () { load(currentPage + 1); });
|
|
555
|
+
}
|
|
556
|
+
function load(page) {
|
|
557
|
+
// Paged tables re-resolve the provider with query.page (1-based) merged
|
|
558
|
+
// over the panel's own static data.query; other panels load once.
|
|
559
|
+
var query = baseQuery;
|
|
560
|
+
if (isPaged) {
|
|
561
|
+
query = {};
|
|
562
|
+
Object.keys(baseQuery).forEach(function (k) { query[k] = baseQuery[k]; });
|
|
563
|
+
query.page = page;
|
|
564
|
+
}
|
|
565
|
+
var url = API_BASE + '/ext/' + encodeURIComponent(ext) + '/data/' + encodeURIComponent(provider) + qs(query);
|
|
566
|
+
fetchJson(url)
|
|
567
|
+
.then(function (res) {
|
|
568
|
+
var data = res.data || {};
|
|
569
|
+
card.innerHTML = '<div class="card-title">' + esc(panel.title) + '</div>' + renderPanelBody(panel, data);
|
|
570
|
+
if (isPaged) wirePager(tablePagination(data).page);
|
|
571
|
+
})
|
|
572
|
+
.catch(function (err) {
|
|
573
|
+
card.innerHTML = '<div class="card-title">' + esc(panel.title) + '</div><div class="error">' + esc(err.message) + '</div>';
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
load(1);
|
|
529
577
|
return card;
|
|
530
578
|
}
|
|
531
579
|
function renderDashboardSpec(spec) {
|
|
@@ -74,6 +74,24 @@ export interface TelescopeUiConfig {
|
|
|
74
74
|
* credential stripping, bounded, self-identifying).
|
|
75
75
|
*/
|
|
76
76
|
replay?: ReplayConfig;
|
|
77
|
+
/**
|
|
78
|
+
* The `POST <path>/api/profiles/arm` trigger: DISABLED BY DEFAULT, like `replay` — arming a
|
|
79
|
+
* capture incurs real CPU overhead (a running V8 sampling profiler on the next N requests), so the
|
|
80
|
+
* host must opt in even when `@adonis-agora/telescope/cpu_profiling` itself is installed and
|
|
81
|
+
* `enabled`. When disabled, the arm endpoint answers `403`. Purely a UI-mutation gate: reading
|
|
82
|
+
* captured profiles (`GET .../profiles*`) is unaffected.
|
|
83
|
+
*/
|
|
84
|
+
cpuProfiling?: {
|
|
85
|
+
armEnabled?: boolean;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* The queue console's mutating actions (`retry`/`enqueue`): DISABLED BY DEFAULT, like `replay` —
|
|
89
|
+
* they act on real jobs (retrying re-runs one, enqueueing dispatches a new one). Reading the queue
|
|
90
|
+
* console (`GET .../queues/live*`) is unaffected; only `POST .../queues/live/*` is gated.
|
|
91
|
+
*/
|
|
92
|
+
queueActions?: {
|
|
93
|
+
enabled?: boolean;
|
|
94
|
+
};
|
|
77
95
|
}
|
|
78
96
|
/** Request-replay configuration (see {@link TelescopeUiConfig.replay}). */
|
|
79
97
|
export interface ReplayConfig {
|
|
@@ -102,6 +120,14 @@ export interface ResolvedTelescopeUiConfig {
|
|
|
102
120
|
port?: number;
|
|
103
121
|
timeoutMs?: number;
|
|
104
122
|
};
|
|
123
|
+
/** Resolved CPU-profiling arm-trigger gate (disabled by default). */
|
|
124
|
+
cpuProfiling: {
|
|
125
|
+
armEnabled: boolean;
|
|
126
|
+
};
|
|
127
|
+
/** Resolved queue-console mutation gate (disabled by default). */
|
|
128
|
+
queueActions: {
|
|
129
|
+
enabled: boolean;
|
|
130
|
+
};
|
|
105
131
|
}
|
|
106
132
|
/**
|
|
107
133
|
* Identity helper giving `config/telescope_ui.ts` full type-checking. Mirrors the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define_config.d.ts","sourceRoot":"","sources":["../../../src/ui/define_config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAE3B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAE/E;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,KAAK,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAA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gB,aAAa,CAAC,MAAM,GAAE,iBAAsB,GAAG,yBAAyB,CAyBvF"}
|
|
@@ -109,6 +109,14 @@ export function resolveConfig(config = {}) {
|
|
|
109
109
|
...(config.replay?.port !== undefined ? { port: config.replay.port } : {}),
|
|
110
110
|
...(config.replay?.timeoutMs !== undefined ? { timeoutMs: config.replay.timeoutMs } : {}),
|
|
111
111
|
},
|
|
112
|
+
cpuProfiling: {
|
|
113
|
+
// Safe default: arming is OFF unless the host explicitly enables it.
|
|
114
|
+
armEnabled: config.cpuProfiling?.armEnabled ?? false,
|
|
115
|
+
},
|
|
116
|
+
queueActions: {
|
|
117
|
+
// Safe default: queue mutations are OFF unless the host explicitly enables them.
|
|
118
|
+
enabled: config.queueActions?.enabled ?? false,
|
|
119
|
+
},
|
|
112
120
|
};
|
|
113
121
|
}
|
|
114
122
|
//# sourceMappingURL=define_config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define_config.js","sourceRoot":"","sources":["../../../src/ui/define_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,GACrB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"define_config.js","sourceRoot":"","sources":["../../../src/ui/define_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,GACrB,MAAM,WAAW,CAAC;AAiInB;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,MAAyB;IACpD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IACpB,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG;QAAE,OAAO,YAAY,CAAC;IAC/C,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;IACpC,OAAO,CAAC,CAAC,MAAM,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,IAAI,KAAK;SACrD;QACD,YAAY,EAAE;YACZ,iFAAiF;YACjF,OAAO,EAAE,MAAM,CAAC,YAAY,EAAE,OAAO,IAAI,KAAK;SAC/C;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { DiagnosisCoordinator } from '../ai/diagnosis_coordinator.js';
|
|
2
|
+
import type { TelescopeService } from '../service.js';
|
|
3
|
+
import type { UiHttpContext } from './http.js';
|
|
4
|
+
/**
|
|
5
|
+
* `POST <path>/api/exceptions/:id/diagnose[?force=true]` handler — the UI's entry point into the
|
|
6
|
+
* AI diagnosis feature (`@adonis-agora/telescope`'s `src/ai/*`), which is otherwise only reachable
|
|
7
|
+
* from the MCP `diagnose_exception` tool and the alerter.
|
|
8
|
+
*
|
|
9
|
+
* Kept in its own class (mirroring {@link ExtensionApi}) rather than folded into {@link TelescopeApi}
|
|
10
|
+
* because it is constructed from the AI runtime slot (`getTelescopeRuntime().diagnosisCoordinator`),
|
|
11
|
+
* not `TelescopeApi`'s constructor args — the same "read the optional runtime slot in the provider"
|
|
12
|
+
* pattern the extension/stream routes already use.
|
|
13
|
+
*
|
|
14
|
+
* Response shape (`{ markdown, cached }`) intentionally mirrors the NestJS sibling's
|
|
15
|
+
* `POST telescope/api/exceptions/:id/diagnose` contract so the two dashboards' AI panels can share
|
|
16
|
+
* the same client/component shape, even though the underlying {@link DiagnosisCoordinator} here
|
|
17
|
+
* returns a structured {@link Diagnosis} rather than markdown directly — `formatDiagnosisMarkdown`
|
|
18
|
+
* bridges the two.
|
|
19
|
+
*
|
|
20
|
+
* Unlike the NestJS sibling there is no side-effect-free "peek cached" verb on
|
|
21
|
+
* {@link DiagnosisCoordinator} (it does not expose the underlying diagnoser's cache), so there is
|
|
22
|
+
* deliberately no read-only `GET .../diagnosis` route here — the dashboard always calls this POST
|
|
23
|
+
* route, which happens to be cheap (no model call) when the family is already cached.
|
|
24
|
+
*/
|
|
25
|
+
export declare class DiagnosisApi {
|
|
26
|
+
private readonly service;
|
|
27
|
+
private readonly coordinator;
|
|
28
|
+
constructor(service: TelescopeService, coordinator: DiagnosisCoordinator | null);
|
|
29
|
+
/** Whether the AI feature is installed and configured — surfaced on `GET <path>/api/meta`. */
|
|
30
|
+
isConfigured(): boolean;
|
|
31
|
+
diagnose(ctx: UiHttpContext, id: string, force: boolean): Promise<unknown>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=diagnosis_api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnosis_api.d.ts","sourceRoot":"","sources":["../../../src/ui/diagnosis_api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAI3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,YAAY;IAErB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;gBADX,OAAO,EAAE,gBAAgB,EACzB,WAAW,EAAE,oBAAoB,GAAG,IAAI;IAG3D,8FAA8F;IAC9F,YAAY,IAAI,OAAO;IAIjB,QAAQ,CAAC,GAAG,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAwBjF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { formatDiagnosisMarkdown } from '../ai/diagnosis_coordinator.js';
|
|
2
|
+
import { EntryType } from '../entry.js';
|
|
3
|
+
/**
|
|
4
|
+
* `POST <path>/api/exceptions/:id/diagnose[?force=true]` handler — the UI's entry point into the
|
|
5
|
+
* AI diagnosis feature (`@adonis-agora/telescope`'s `src/ai/*`), which is otherwise only reachable
|
|
6
|
+
* from the MCP `diagnose_exception` tool and the alerter.
|
|
7
|
+
*
|
|
8
|
+
* Kept in its own class (mirroring {@link ExtensionApi}) rather than folded into {@link TelescopeApi}
|
|
9
|
+
* because it is constructed from the AI runtime slot (`getTelescopeRuntime().diagnosisCoordinator`),
|
|
10
|
+
* not `TelescopeApi`'s constructor args — the same "read the optional runtime slot in the provider"
|
|
11
|
+
* pattern the extension/stream routes already use.
|
|
12
|
+
*
|
|
13
|
+
* Response shape (`{ markdown, cached }`) intentionally mirrors the NestJS sibling's
|
|
14
|
+
* `POST telescope/api/exceptions/:id/diagnose` contract so the two dashboards' AI panels can share
|
|
15
|
+
* the same client/component shape, even though the underlying {@link DiagnosisCoordinator} here
|
|
16
|
+
* returns a structured {@link Diagnosis} rather than markdown directly — `formatDiagnosisMarkdown`
|
|
17
|
+
* bridges the two.
|
|
18
|
+
*
|
|
19
|
+
* Unlike the NestJS sibling there is no side-effect-free "peek cached" verb on
|
|
20
|
+
* {@link DiagnosisCoordinator} (it does not expose the underlying diagnoser's cache), so there is
|
|
21
|
+
* deliberately no read-only `GET .../diagnosis` route here — the dashboard always calls this POST
|
|
22
|
+
* route, which happens to be cheap (no model call) when the family is already cached.
|
|
23
|
+
*/
|
|
24
|
+
export class DiagnosisApi {
|
|
25
|
+
service;
|
|
26
|
+
coordinator;
|
|
27
|
+
constructor(service, coordinator) {
|
|
28
|
+
this.service = service;
|
|
29
|
+
this.coordinator = coordinator;
|
|
30
|
+
}
|
|
31
|
+
/** Whether the AI feature is installed and configured — surfaced on `GET <path>/api/meta`. */
|
|
32
|
+
isConfigured() {
|
|
33
|
+
return this.coordinator?.isConfigured() ?? false;
|
|
34
|
+
}
|
|
35
|
+
async diagnose(ctx, id, force) {
|
|
36
|
+
if (this.coordinator === null || !this.coordinator.isConfigured()) {
|
|
37
|
+
return ctx.response
|
|
38
|
+
.status(404)
|
|
39
|
+
.send({ error: 'AI diagnosis is not configured for this dashboard.' });
|
|
40
|
+
}
|
|
41
|
+
const entry = await this.service.find(id);
|
|
42
|
+
if (entry === null || !isExceptionLike(entry)) {
|
|
43
|
+
return ctx.response.status(404).send({ error: 'No exception entry with that id.' });
|
|
44
|
+
}
|
|
45
|
+
const diagnosis = await this.coordinator.diagnose(entry, {
|
|
46
|
+
force,
|
|
47
|
+
});
|
|
48
|
+
if (diagnosis === null) {
|
|
49
|
+
return ctx.response.status(502).send({ error: 'AI diagnosis failed or timed out.' });
|
|
50
|
+
}
|
|
51
|
+
return ctx.response
|
|
52
|
+
.status(200)
|
|
53
|
+
.header('content-type', 'application/json')
|
|
54
|
+
.send({ data: { markdown: formatDiagnosisMarkdown(diagnosis), cached: diagnosis.cached } });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function isExceptionLike(entry) {
|
|
58
|
+
return entry.type === EntryType.Exception || entry.type === EntryType.ClientException;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=diagnosis_api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnosis_api.js","sourceRoot":"","sources":["../../../src/ui/diagnosis_api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,YAAY;IAEJ;IACA;IAFnB,YACmB,OAAyB,EACzB,WAAwC;QADxC,YAAO,GAAP,OAAO,CAAkB;QACzB,gBAAW,GAAX,WAAW,CAA6B;IACxD,CAAC;IAEJ,8FAA8F;IAC9F,YAAY;QACV,OAAO,IAAI,CAAC,WAAW,EAAE,YAAY,EAAE,IAAI,KAAK,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,GAAkB,EAAE,EAAU,EAAE,KAAc;QAC3D,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,EAAE,CAAC;YAClE,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
+
* TRUTH for the pagination math and the deep-link templating that the
|
|
4
|
+
* server-rendered `dashboard.html` mirrors in its inline JS. Kept framework-free
|
|
5
|
+
* and side-effect-free so the logic is unit-tested directly (dashboard.html's
|
|
6
|
+
* inline `<script>` is a static asset that can't import, so it carries a faithful
|
|
7
|
+
* mirror of these two functions).
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The provider payload for a `{ kind: 'table', paged: true }` panel — the shape
|
|
11
|
+
* a {@link DataProvider} MUST return when the panel opts into paging. `page` /
|
|
12
|
+
* `limit` normally echo the requested `query.page` / `query.limit`; `total` is
|
|
13
|
+
* the full, unpaginated row count so the UI can render "page X of Y".
|
|
14
|
+
*/
|
|
15
|
+
export interface PagedTableData {
|
|
16
|
+
rows?: Array<Record<string, unknown>>;
|
|
17
|
+
total?: number;
|
|
18
|
+
page?: number;
|
|
19
|
+
limit?: number;
|
|
20
|
+
}
|
|
21
|
+
/** The pager state the UI renders from a {@link PagedTableData} payload. */
|
|
22
|
+
export interface TablePagination {
|
|
23
|
+
/** Current 1-based page (clamped to >= 1). */
|
|
24
|
+
page: number;
|
|
25
|
+
/** Rows-per-page used to compute the page count. */
|
|
26
|
+
limit: number;
|
|
27
|
+
/** Full unpaginated row count. */
|
|
28
|
+
total: number;
|
|
29
|
+
/** Number of pages (>= 1). */
|
|
30
|
+
totalPages: number;
|
|
31
|
+
/** Whether a previous page exists (Prev enabled). */
|
|
32
|
+
hasPrev: boolean;
|
|
33
|
+
/** Whether a next page exists (Next enabled). */
|
|
34
|
+
hasNext: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Normalize a paged provider payload into pager state: clamp `page` to >= 1,
|
|
38
|
+
* derive `limit`/`total` defensively (so a provider echoing only `rows` still
|
|
39
|
+
* renders one page), and compute `totalPages` + prev/next availability.
|
|
40
|
+
*/
|
|
41
|
+
export declare function tablePagination(data: PagedTableData): TablePagination;
|
|
42
|
+
/**
|
|
43
|
+
* Fill a {@link LinkSpec.href} template's `{key}` placeholders from a table row.
|
|
44
|
+
* This is what turns the in-app trace deep-link convention `#/traces/{traceId}`
|
|
45
|
+
* into a concrete `#/traces/abc123` anchor (the same substitution the built-in
|
|
46
|
+
* Entries table uses). A missing key becomes the empty string. Values are
|
|
47
|
+
* URI-encoded so a key containing `#`/`/`/`?` cannot break out of the href.
|
|
48
|
+
*/
|
|
49
|
+
export declare function fillLinkHref(href: string, row: Record<string, unknown>): string;
|
|
50
|
+
//# sourceMappingURL=ext_table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ext_table.d.ts","sourceRoot":"","sources":["../../../src/ui/ext_table.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,iDAAiD;IACjD,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,eAAe,CAcrE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAK/E"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers for the paged extension-dashboard table. These are the SOURCE OF
|
|
3
|
+
* TRUTH for the pagination math and the deep-link templating that the
|
|
4
|
+
* server-rendered `dashboard.html` mirrors in its inline JS. Kept framework-free
|
|
5
|
+
* and side-effect-free so the logic is unit-tested directly (dashboard.html's
|
|
6
|
+
* inline `<script>` is a static asset that can't import, so it carries a faithful
|
|
7
|
+
* mirror of these two functions).
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Normalize a paged provider payload into pager state: clamp `page` to >= 1,
|
|
11
|
+
* derive `limit`/`total` defensively (so a provider echoing only `rows` still
|
|
12
|
+
* renders one page), and compute `totalPages` + prev/next availability.
|
|
13
|
+
*/
|
|
14
|
+
export function tablePagination(data) {
|
|
15
|
+
const rows = data.rows ?? [];
|
|
16
|
+
const page = Math.max(1, data.page ?? 1);
|
|
17
|
+
const limit = data.limit && data.limit > 0 ? data.limit : rows.length || 1;
|
|
18
|
+
const total = data.total ?? rows.length;
|
|
19
|
+
const totalPages = Math.max(1, Math.ceil(total / limit));
|
|
20
|
+
return {
|
|
21
|
+
page,
|
|
22
|
+
limit,
|
|
23
|
+
total,
|
|
24
|
+
totalPages,
|
|
25
|
+
hasPrev: page > 1,
|
|
26
|
+
hasNext: page < totalPages,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Fill a {@link LinkSpec.href} template's `{key}` placeholders from a table row.
|
|
31
|
+
* This is what turns the in-app trace deep-link convention `#/traces/{traceId}`
|
|
32
|
+
* into a concrete `#/traces/abc123` anchor (the same substitution the built-in
|
|
33
|
+
* Entries table uses). A missing key becomes the empty string. Values are
|
|
34
|
+
* URI-encoded so a key containing `#`/`/`/`?` cannot break out of the href.
|
|
35
|
+
*/
|
|
36
|
+
export function fillLinkHref(href, row) {
|
|
37
|
+
return href.replace(/\{(\w+)\}/g, (_, key) => {
|
|
38
|
+
const value = row[key];
|
|
39
|
+
return encodeURIComponent(value == null ? '' : String(value));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=ext_table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ext_table.js","sourceRoot":"","sources":["../../../src/ui/ext_table.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA+BH;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAoB;IAClD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;IAC3E,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;IACzD,OAAO;QACL,IAAI;QACJ,KAAK;QACL,KAAK;QACL,UAAU;QACV,OAAO,EAAE,IAAI,GAAG,CAAC;QACjB,OAAO,EAAE,IAAI,GAAG,UAAU;KAC3B,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,GAA4B;IACrE,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,GAAW,EAAE,EAAE;QACnD,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACvB,OAAO,kBAAkB,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -11,8 +11,12 @@ export declare class ExtensionApi {
|
|
|
11
11
|
private readonly registry;
|
|
12
12
|
private readonly ctx;
|
|
13
13
|
constructor(registry: ExtensionRegistry, ctx: ExtensionContext);
|
|
14
|
-
/**
|
|
15
|
-
|
|
14
|
+
/**
|
|
15
|
+
* `GET /api/meta` — the dashboards + entry types contributed by every extension, plus whatever
|
|
16
|
+
* `extra` fields the provider merges in (e.g. `{ ai: { enabled } }` — additive, unrelated to the
|
|
17
|
+
* extension SDK, but `/meta` is the one endpoint the dashboard always fetches on boot).
|
|
18
|
+
*/
|
|
19
|
+
meta(http: UiHttpContext, extra?: Record<string, unknown>): unknown;
|
|
16
20
|
/**
|
|
17
21
|
* `GET /api/ext/:ext/data/:provider` — resolve a named data provider. The `:ext` segment must be
|
|
18
22
|
* the provider's owning extension (namespace check), so one extension can't be addressed under
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension_api.d.ts","sourceRoot":"","sources":["../../../src/ui/extension_api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;;;;GAKG;AACH,qBAAa,YAAY;IAErB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBADH,QAAQ,EAAE,iBAAiB,EAC3B,GAAG,EAAE,gBAAgB;IAGxC
|
|
1
|
+
{"version":3,"file":"extension_api.d.ts","sourceRoot":"","sources":["../../../src/ui/extension_api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;;;;GAKG;AACH,qBAAa,YAAY;IAErB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBADH,QAAQ,EAAE,iBAAiB,EAC3B,GAAG,EAAE,gBAAgB;IAGxC;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,OAAO;IAUvE;;;;OAIG;IACG,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAoBrF"}
|
|
@@ -11,12 +11,17 @@ export class ExtensionApi {
|
|
|
11
11
|
this.registry = registry;
|
|
12
12
|
this.ctx = ctx;
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
15
|
-
|
|
14
|
+
/**
|
|
15
|
+
* `GET /api/meta` — the dashboards + entry types contributed by every extension, plus whatever
|
|
16
|
+
* `extra` fields the provider merges in (e.g. `{ ai: { enabled } }` — additive, unrelated to the
|
|
17
|
+
* extension SDK, but `/meta` is the one endpoint the dashboard always fetches on boot).
|
|
18
|
+
*/
|
|
19
|
+
meta(http, extra = {}) {
|
|
16
20
|
return http.response.status(200).send({
|
|
17
21
|
data: {
|
|
18
22
|
entryTypes: this.registry.entryTypes(),
|
|
19
23
|
dashboards: this.registry.dashboards(),
|
|
24
|
+
...extra,
|
|
20
25
|
},
|
|
21
26
|
});
|
|
22
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension_api.js","sourceRoot":"","sources":["../../../src/ui/extension_api.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,OAAO,YAAY;IAEJ;IACA;IAFnB,YACmB,QAA2B,EAC3B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IAAI,CAAC,EAAE,KAAK,EAAE,0BAA0B,YAAY,GAAG,EAAE,CAAC,CAAC;QAC9F,CAAC;QACD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YACnE,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QAC1D,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,IAAI,CAAC,QAAQ;iBACjB,MAAM,CAAC,GAAG,CAAC;iBACX,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;CACF"}
|
package/dist/src/ui/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export declare const VERSION = "0.
|
|
2
|
+
export declare const VERSION = "0.7.0";
|
|
3
3
|
export { defineConfig, resolveConfig, normalizePath, defaultAuthorize } from './define_config.js';
|
|
4
4
|
export type { AuthorizeHook, ReplayConfig, ResolvedTelescopeUiConfig, TelescopeUiConfig, UiCredentials, } from './define_config.js';
|
|
5
5
|
export { resolveDashboardAuth, performLogin, readSession, sanitizeReturnTo, decideDashboardAuth, SESSION_COOKIE_NAME, } from './auth.js';
|
|
@@ -7,13 +7,21 @@ export type { DashboardAuthOptions, ResolvedDashboardAuth, LoginHook, LoginOutco
|
|
|
7
7
|
export { signSessionCookie, verifySessionCookie, } from './session_cookie.js';
|
|
8
8
|
export type { DashboardSession, DashboardSessionUser, SignOptions, VerifyOptions, } from './session_cookie.js';
|
|
9
9
|
export { renderLoginPage } from './login_page.js';
|
|
10
|
+
export { fillLinkHref, tablePagination } from './ext_table.js';
|
|
11
|
+
export type { PagedTableData, TablePagination } from './ext_table.js';
|
|
10
12
|
export { readSessionCookie, writeSessionCookie, clearSessionCookie, enforceDashboardAuth, } from './dashboard_auth.js';
|
|
11
13
|
export { RecordingResponse, RecordingSink, formatSseFrame, formatSseHeartbeat, makeRequest, } from './http.js';
|
|
12
14
|
export type { SseSink, UiHttpContext, UiRequest, UiResponse } from './http.js';
|
|
13
15
|
export { enforceGuard, runGuard } from './guard.js';
|
|
14
16
|
export type { GuardResult } from './guard.js';
|
|
15
17
|
export { TelescopeApi, buildQuery, toSummary } from './api.js';
|
|
16
|
-
export type { EntrySummary } from './api.js';
|
|
18
|
+
export type { EntrySummary, RetentionInfo, RetentionOptions, RetentionPruneOptions, RetentionSamplingRate, } from './api.js';
|
|
19
|
+
export { ProfilesApi } from './profiles_api.js';
|
|
20
|
+
export type { ArmProfileBody } from './profiles_api.js';
|
|
21
|
+
export { QueueManagerApi } from './queue_manager_api.js';
|
|
22
|
+
export type { EnqueueBody } from './queue_manager_api.js';
|
|
23
|
+
export { SchedulesApi } from './schedules_api.js';
|
|
24
|
+
export type { LiveScheduledTask } from './schedules_api.js';
|
|
17
25
|
export { replayRequest, REPLAY_BODY_CAP, REPLAY_STRIPPED_HEADERS, REPLAY_TIMEOUT_MS, } from './request_replay.js';
|
|
18
26
|
export type { ReplayOptions, ReplayResult, ReplayTransport } from './request_replay.js';
|
|
19
27
|
export { renderDashboard } from './dashboard.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClG,YAAY,EACV,aAAa,EACb,YAAY,EACZ,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,SAAS,EACT,YAAY,EACZ,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClG,YAAY,EACV,aAAa,EACb,YAAY,EACZ,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,SAAS,EACT,YAAY,EACZ,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,C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/src/ui/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export const VERSION = '0.
|
|
2
|
+
export const VERSION = '0.7.0';
|
|
3
3
|
// — config —
|
|
4
4
|
export { defineConfig, resolveConfig, normalizePath, defaultAuthorize } from './define_config.js';
|
|
5
5
|
// — built-in `dashboardAuth` login screen (optional; opt-in via `config/telescope_ui.ts`) —
|
|
6
6
|
export { resolveDashboardAuth, performLogin, readSession, sanitizeReturnTo, decideDashboardAuth, SESSION_COOKIE_NAME, } from './auth.js';
|
|
7
7
|
export { signSessionCookie, verifySessionCookie, } from './session_cookie.js';
|
|
8
8
|
export { renderLoginPage } from './login_page.js';
|
|
9
|
+
// — paged extension-dashboard tables (source of truth for dashboard.html's mirror) —
|
|
10
|
+
export { fillLinkHref, tablePagination } from './ext_table.js';
|
|
9
11
|
export { readSessionCookie, writeSessionCookie, clearSessionCookie, enforceDashboardAuth, } from './dashboard_auth.js';
|
|
10
12
|
// — HTTP shapes (framework-light) —
|
|
11
13
|
export { RecordingResponse, RecordingSink, formatSseFrame, formatSseHeartbeat, makeRequest, } from './http.js';
|
|
@@ -13,6 +15,12 @@ export { RecordingResponse, RecordingSink, formatSseFrame, formatSseHeartbeat, m
|
|
|
13
15
|
export { enforceGuard, runGuard } from './guard.js';
|
|
14
16
|
// — JSON API —
|
|
15
17
|
export { TelescopeApi, buildQuery, toSummary } from './api.js';
|
|
18
|
+
// — CPU profiling JSON API (optional feature: @adonis-agora/telescope/cpu_profiling) —
|
|
19
|
+
export { ProfilesApi } from './profiles_api.js';
|
|
20
|
+
// — live queue manager JSON API (optional peer: @adonisjs/queue) —
|
|
21
|
+
export { QueueManagerApi } from './queue_manager_api.js';
|
|
22
|
+
// — live schedules JSON API (registry: `registerSchedule()`) —
|
|
23
|
+
export { SchedulesApi } from './schedules_api.js';
|
|
16
24
|
// — request replay —
|
|
17
25
|
export { replayRequest, REPLAY_BODY_CAP, REPLAY_STRIPPED_HEADERS, REPLAY_TIMEOUT_MS, } from './request_replay.js';
|
|
18
26
|
// — dashboard —
|
package/dist/src/ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,aAAa;AACb,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AASlG,4FAA4F;AAC5F,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AAQnB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAO7B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,aAAa;AACb,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AASlG,4FAA4F;AAC5F,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AAQnB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAO7B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,qFAAqF;AACrF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,oCAAoC;AACpC,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,WAAW,GACZ,MAAM,WAAW,CAAC;AAGnB,iBAAiB;AACjB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGpD,eAAe;AACf,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAS/D,uFAAuF;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,mEAAmE;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,+DAA+D;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,qBAAqB;AACrB,OAAO,EACL,aAAa,EACb,eAAe,EACf,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAG7B,gBAAgB;AAChB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ProfilerService } from '../profiling/profiler_service.js';
|
|
2
|
+
import type { TelescopeService } from '../service.js';
|
|
3
|
+
import type { UiHttpContext } from './http.js';
|
|
4
|
+
/** `POST <path>/api/profiles/arm` request body. */
|
|
5
|
+
export interface ArmProfileBody {
|
|
6
|
+
count?: unknown;
|
|
7
|
+
label?: unknown;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* `GET/POST <path>/api/profiles/*` handlers over the OPTIONAL `@adonis-agora/telescope/cpu_profiling`
|
|
11
|
+
* feature. Kept in its own class (mirroring {@link DiagnosisApi}/{@link ExtensionApi}) rather than
|
|
12
|
+
* folded into {@link TelescopeApi} because it is constructed from the runtime slot
|
|
13
|
+
* (`getTelescopeRuntime().cpuProfiler`), not `TelescopeApi`'s constructor args.
|
|
14
|
+
*
|
|
15
|
+
* Every route degrades to `404` when `profiler` is `null` (the feature isn't installed/enabled) —
|
|
16
|
+
* mirroring how {@link DiagnosisApi} degrades when the AI coordinator is absent — so a dashboard
|
|
17
|
+
* without CPU profiling simply doesn't see the routes rather than erroring.
|
|
18
|
+
*
|
|
19
|
+
* Response shapes mirror the NestJS sibling's `GET telescope/api/profiles*` /
|
|
20
|
+
* `POST telescope/api/profiles/arm` contract (`status`/list/detail/arm), modulo the `{ data }`
|
|
21
|
+
* envelope this package's JSON API always uses.
|
|
22
|
+
*/
|
|
23
|
+
export declare class ProfilesApi {
|
|
24
|
+
private readonly service;
|
|
25
|
+
private readonly profiler;
|
|
26
|
+
constructor(service: TelescopeService, profiler: ProfilerService | null);
|
|
27
|
+
/** Whether the feature is installed — surfaced on `GET <path>/api/meta`. */
|
|
28
|
+
isConfigured(): boolean;
|
|
29
|
+
/** `GET <path>/api/profiles/status` — the profiler's current sampling/arm state. */
|
|
30
|
+
status(ctx: UiHttpContext): unknown;
|
|
31
|
+
/**
|
|
32
|
+
* `GET <path>/api/profiles?limit=` — captured profiles newest-first, WITHOUT their (potentially
|
|
33
|
+
* large) frame tree — the summary already omits `content` (see {@link toSummary}).
|
|
34
|
+
*/
|
|
35
|
+
list(ctx: UiHttpContext): Promise<unknown>;
|
|
36
|
+
/** `GET <path>/api/profiles/:id` — one profile's full frame tree (the flamegraph payload), or 404. */
|
|
37
|
+
show(ctx: UiHttpContext, id: string): Promise<unknown>;
|
|
38
|
+
/**
|
|
39
|
+
* `POST <path>/api/profiles/arm` — arm an on-demand capture of the next N requests (optionally
|
|
40
|
+
* only those whose label matches). A MUTATION-shaped trigger (it incurs real profiling overhead),
|
|
41
|
+
* so — mirroring replay's `replay.enabled` gate — it is only reachable when the CALLER has already
|
|
42
|
+
* confirmed mutations are allowed; this class doesn't own that gate (the provider composes it),
|
|
43
|
+
* matching how `TelescopeApi.replayRequest` reads its own `replay.enabled` flag directly. `400`
|
|
44
|
+
* when profiling itself is disabled, so the dashboard can explain why nothing happens.
|
|
45
|
+
*/
|
|
46
|
+
arm(ctx: UiHttpContext, body: ArmProfileBody): unknown;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=profiles_api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles_api.d.ts","sourceRoot":"","sources":["../../../src/ui/profiles_api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,kCAAkC,CAAC;AAExF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,mDAAmD;AACnD,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,WAAW;IAEpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBADR,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,eAAe,GAAG,IAAI;IAGnD,4EAA4E;IAC5E,YAAY,IAAI,OAAO;IAIvB,oFAAoF;IACpF,MAAM,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO;IAMnC;;;OAGG;IACG,IAAI,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;IAahD,sGAAsG;IAChG,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAY5D;;;;;;;OAOG;IACH,GAAG,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO;CAevD"}
|