@adonis-agora/telescope 0.6.0 → 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 +20 -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_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_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/index.d.ts +1 -1
- package/dist/src/alerts/index.js +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/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/mcp/index.d.ts +1 -1
- package/dist/src/mcp/index.js +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/registry.d.ts +28 -0
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +20 -0
- package/dist/src/registry.js.map +1 -1
- package/dist/src/telescope_middleware.d.ts.map +1 -1
- package/dist/src/telescope_middleware.js +25 -0
- 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/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/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 +8 -2
- package/dist/src/ui/index.d.ts.map +1 -1
- package/dist/src/ui/index.js +7 -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 +83 -1
- 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
|
@@ -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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;KAAE,CAAC;IAChE,qEAAqE;IACrE,YAAY,EAAE;QAAE,UAAU,EAAE,OAAO,CAAA;KAAE,CAAC;IACtC,kEAAkE;IAClE,YAAY,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CACpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAEzE;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMlD;AAiDD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,aAAa,GAAG,aAAa,CAS1E;AAED,qDAAqD;AACrD,wBAAgB,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,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MAAM,EAAE,OAAO,IAAI,KAAK;YACxC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1E,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1F;QACD,YAAY,EAAE;YACZ,qEAAqE;YACrE,UAAU,EAAE,MAAM,CAAC,YAAY,EAAE,UAAU,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;;;;;;;;;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AC,cAAc,EAAE,kBAAkB,CAAC;aAC1C,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,uBAAuB,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAChG,CAAC;CACF;AAED,SAAS,eAAe,CAAC,KAAY;IACnC,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,SAAS,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,eAAe,CAAC;AACxF,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,GAAqB;QADrB,aAAQ,GAAR,QAAQ,CAAmB;QAC3B,QAAG,GAAH,GAAG,CAAkB;IACrC,CAAC;IAEJ
|
|
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,GAAqB;QADrB,aAAQ,GAAR,QAAQ,CAAmB;QAC3B,QAAG,GAAH,GAAG,CAAkB;IACrC,CAAC;IAEJ;;;;OAIG;IACH,IAAI,CAAC,IAAmB,EAAE,QAAiC,EAAE;QAC3D,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACpC,IAAI,EAAE;gBACJ,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE;gBACtC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE;gBACtC,GAAG,KAAK;aACT;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAI,CAAC,IAAmB,EAAE,GAAW,EAAE,YAAoB;QAC/D,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QACxD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;YACzC,OAAO,IAAI,CAAC,QAAQ;iBACjB,MAAM,CAAC,GAAG,CAAC;iBACX,IAAI,CAAC,EAAE,KAAK,EAAE,0BAA0B,GAAG,IAAI,YAAY,GAAG,EAAE,CAAC,CAAC;QACvE,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QAC1D,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,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';
|
|
@@ -15,7 +15,13 @@ export type { SseSink, UiHttpContext, UiRequest, UiResponse } from './http.js';
|
|
|
15
15
|
export { enforceGuard, runGuard } from './guard.js';
|
|
16
16
|
export type { GuardResult } from './guard.js';
|
|
17
17
|
export { TelescopeApi, buildQuery, toSummary } from './api.js';
|
|
18
|
-
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';
|
|
19
25
|
export { replayRequest, REPLAY_BODY_CAP, REPLAY_STRIPPED_HEADERS, REPLAY_TIMEOUT_MS, } from './request_replay.js';
|
|
20
26
|
export type { ReplayOptions, ReplayResult, ReplayTransport } from './request_replay.js';
|
|
21
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;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mB,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,OAAO,EACL,aAAa,EACb,eAAe,EACf,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGxF,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/src/ui/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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`) —
|
|
@@ -15,6 +15,12 @@ export { RecordingResponse, RecordingSink, formatSseFrame, formatSseHeartbeat, m
|
|
|
15
15
|
export { enforceGuard, runGuard } from './guard.js';
|
|
16
16
|
// — JSON API —
|
|
17
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';
|
|
18
24
|
// — request replay —
|
|
19
25
|
export { replayRequest, REPLAY_BODY_CAP, REPLAY_STRIPPED_HEADERS, REPLAY_TIMEOUT_MS, } from './request_replay.js';
|
|
20
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;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;
|
|
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"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { EntryType } from '../entry.js';
|
|
2
|
+
import { toSummary } from './api.js';
|
|
3
|
+
/**
|
|
4
|
+
* `GET/POST <path>/api/profiles/*` handlers over the OPTIONAL `@adonis-agora/telescope/cpu_profiling`
|
|
5
|
+
* feature. Kept in its own class (mirroring {@link DiagnosisApi}/{@link ExtensionApi}) rather than
|
|
6
|
+
* folded into {@link TelescopeApi} because it is constructed from the runtime slot
|
|
7
|
+
* (`getTelescopeRuntime().cpuProfiler`), not `TelescopeApi`'s constructor args.
|
|
8
|
+
*
|
|
9
|
+
* Every route degrades to `404` when `profiler` is `null` (the feature isn't installed/enabled) —
|
|
10
|
+
* mirroring how {@link DiagnosisApi} degrades when the AI coordinator is absent — so a dashboard
|
|
11
|
+
* without CPU profiling simply doesn't see the routes rather than erroring.
|
|
12
|
+
*
|
|
13
|
+
* Response shapes mirror the NestJS sibling's `GET telescope/api/profiles*` /
|
|
14
|
+
* `POST telescope/api/profiles/arm` contract (`status`/list/detail/arm), modulo the `{ data }`
|
|
15
|
+
* envelope this package's JSON API always uses.
|
|
16
|
+
*/
|
|
17
|
+
export class ProfilesApi {
|
|
18
|
+
service;
|
|
19
|
+
profiler;
|
|
20
|
+
constructor(service, profiler) {
|
|
21
|
+
this.service = service;
|
|
22
|
+
this.profiler = profiler;
|
|
23
|
+
}
|
|
24
|
+
/** Whether the feature is installed — surfaced on `GET <path>/api/meta`. */
|
|
25
|
+
isConfigured() {
|
|
26
|
+
return this.profiler !== null;
|
|
27
|
+
}
|
|
28
|
+
/** `GET <path>/api/profiles/status` — the profiler's current sampling/arm state. */
|
|
29
|
+
status(ctx) {
|
|
30
|
+
if (this.profiler === null)
|
|
31
|
+
return notConfigured(ctx);
|
|
32
|
+
const data = this.profiler.status();
|
|
33
|
+
return ctx.response.status(200).header('content-type', 'application/json').send({ data });
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* `GET <path>/api/profiles?limit=` — captured profiles newest-first, WITHOUT their (potentially
|
|
37
|
+
* large) frame tree — the summary already omits `content` (see {@link toSummary}).
|
|
38
|
+
*/
|
|
39
|
+
async list(ctx) {
|
|
40
|
+
if (this.profiler === null)
|
|
41
|
+
return notConfigured(ctx);
|
|
42
|
+
const limitRaw = ctx.request.qs().limit;
|
|
43
|
+
const limit = typeof limitRaw === 'string' && Number.isFinite(Number(limitRaw)) ? Number(limitRaw) : 100;
|
|
44
|
+
const entries = await this.service.list({ type: EntryType.CpuProfile, limit });
|
|
45
|
+
const data = entries.map(toSummary);
|
|
46
|
+
return ctx.response
|
|
47
|
+
.status(200)
|
|
48
|
+
.header('content-type', 'application/json')
|
|
49
|
+
.send({ data, meta: { count: data.length } });
|
|
50
|
+
}
|
|
51
|
+
/** `GET <path>/api/profiles/:id` — one profile's full frame tree (the flamegraph payload), or 404. */
|
|
52
|
+
async show(ctx, id) {
|
|
53
|
+
if (this.profiler === null)
|
|
54
|
+
return notConfigured(ctx);
|
|
55
|
+
const entry = await this.service.find(id);
|
|
56
|
+
if (entry === null || entry.type !== EntryType.CpuProfile) {
|
|
57
|
+
return ctx.response.status(404).send({ error: 'No CPU profile with that id.' });
|
|
58
|
+
}
|
|
59
|
+
return ctx.response
|
|
60
|
+
.status(200)
|
|
61
|
+
.header('content-type', 'application/json')
|
|
62
|
+
.send({ data: entry });
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* `POST <path>/api/profiles/arm` — arm an on-demand capture of the next N requests (optionally
|
|
66
|
+
* only those whose label matches). A MUTATION-shaped trigger (it incurs real profiling overhead),
|
|
67
|
+
* so — mirroring replay's `replay.enabled` gate — it is only reachable when the CALLER has already
|
|
68
|
+
* confirmed mutations are allowed; this class doesn't own that gate (the provider composes it),
|
|
69
|
+
* matching how `TelescopeApi.replayRequest` reads its own `replay.enabled` flag directly. `400`
|
|
70
|
+
* when profiling itself is disabled, so the dashboard can explain why nothing happens.
|
|
71
|
+
*/
|
|
72
|
+
arm(ctx, body) {
|
|
73
|
+
if (this.profiler === null)
|
|
74
|
+
return notConfigured(ctx);
|
|
75
|
+
if (!this.profiler.status().enabled) {
|
|
76
|
+
return ctx.response.status(400).send({
|
|
77
|
+
error: 'CPU profiling is disabled (set telescope_cpu_profiling `enabled: true`).',
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const count = body?.count !== undefined ? Number(body.count) : 1;
|
|
81
|
+
if (!Number.isFinite(count) || count <= 0) {
|
|
82
|
+
return ctx.response.status(400).send({ error: '`count` must be a positive number.' });
|
|
83
|
+
}
|
|
84
|
+
const label = typeof body?.label === 'string' && body.label !== '' ? body.label : undefined;
|
|
85
|
+
const data = this.profiler.arm({ count, ...(label !== undefined ? { label } : {}) });
|
|
86
|
+
return ctx.response.status(200).header('content-type', 'application/json').send({ data });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function notConfigured(ctx) {
|
|
90
|
+
return ctx.response
|
|
91
|
+
.status(404)
|
|
92
|
+
.send({ error: 'CPU profiling is not installed for this dashboard.' });
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=profiles_api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles_api.js","sourceRoot":"","sources":["../../../src/ui/profiles_api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxC,OAAO,EAAqB,SAAS,EAAE,MAAM,UAAU,CAAC;AASxD;;;;;;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AE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;YAC1C,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,oCAAoC,EAAE,CAAC,CAAC;QACxF,CAAC;QACD,MAAM,KAAK,GAAG,OAAO,IAAI,EAAE,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QAC5F,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACrF,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5F,CAAC;CACF;AAED,SAAS,aAAa,CAAC,GAAkB;IACvC,OAAO,GAAG,CAAC,QAAQ;SAChB,MAAM,CAAC,GAAG,CAAC;SACX,IAAI,CAAC,EAAE,KAAK,EAAE,oDAAoD,EAAE,CAAC,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { QueueManager } from '../watchers/queue_manager.js';
|
|
2
|
+
import type { UiHttpContext } from './http.js';
|
|
3
|
+
/** `POST <path>/api/queues/live/:queue/enqueue` request body. */
|
|
4
|
+
export interface EnqueueBody {
|
|
5
|
+
name?: unknown;
|
|
6
|
+
payload?: unknown;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* `GET/POST <path>/api/queues/live*` handlers over the OPTIONAL `queue-manager` watcher capability
|
|
10
|
+
* (`src/watchers/queue_manager.ts`). Mirrors the shape of {@link ProfilesApi}/{@link DiagnosisApi}:
|
|
11
|
+
* constructed from the runtime slot (`getTelescopeRuntime().queueManager`), degrading every route to
|
|
12
|
+
* `404` when it's `null` (capability not enabled / `@adonisjs/queue` not installed).
|
|
13
|
+
*
|
|
14
|
+
* Unlike `nestjs-telescope`'s `TelescopeController` (which addresses N queue-manager DRIVERS by a
|
|
15
|
+
* `:driver` route segment, since a Nest app can register several `QueueManager`s), AdonisJS has
|
|
16
|
+
* exactly ONE `@adonisjs/queue` install per app, so there is exactly one {@link QueueManager} and no
|
|
17
|
+
* `:driver` segment — `<path>/api/queues/live/:queue/...` rather than
|
|
18
|
+
* `<path>/api/queues/live/:driver/:queue/...`.
|
|
19
|
+
*/
|
|
20
|
+
export declare class QueueManagerApi {
|
|
21
|
+
private readonly manager;
|
|
22
|
+
constructor(manager: QueueManager | null);
|
|
23
|
+
/** Whether the capability is enabled at all — surfaced on `GET <path>/api/meta`. */
|
|
24
|
+
isConfigured(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the manager can perform `action` — prefers the precise `capabilities` advertisement
|
|
27
|
+
* (see the {@link QueueManager} doc) and falls back to plain method presence when the driver
|
|
28
|
+
* doesn't expose it.
|
|
29
|
+
*/
|
|
30
|
+
private supports;
|
|
31
|
+
/** `GET <path>/api/queues/live` — configured queues (with counts) + capabilities. */
|
|
32
|
+
list(ctx: UiHttpContext, mutationsEnabled: boolean): Promise<unknown>;
|
|
33
|
+
/** `GET <path>/api/queues/live/:queue/jobs/:id` — one job, or 404. */
|
|
34
|
+
job(ctx: UiHttpContext, queue: string, id: string): Promise<unknown>;
|
|
35
|
+
/**
|
|
36
|
+
* `POST <path>/api/queues/live/:queue/jobs/:id/retry` — a MUTATION, so the caller (the provider)
|
|
37
|
+
* must have already confirmed `queueActions.enabled`, mirroring `replayRequest`'s convention of
|
|
38
|
+
* the provider owning the gate, not this class. `501` when the driver has no `retry` (mirrors the
|
|
39
|
+
* NestJS sibling's `MethodNotAllowedException` for an unsupported action, without depending on an
|
|
40
|
+
* HTTP-framework-specific exception type here).
|
|
41
|
+
*/
|
|
42
|
+
retry(ctx: UiHttpContext, queue: string, id: string): Promise<unknown>;
|
|
43
|
+
/** `POST <path>/api/queues/live/:queue/enqueue` — dispatch a new job. `501` when unsupported. */
|
|
44
|
+
enqueue(ctx: UiHttpContext, queue: string, body: EnqueueBody): Promise<unknown>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=queue_manager_api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue_manager_api.d.ts","sourceRoot":"","sources":["../../../src/ui/queue_manager_api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,YAAY,EAEb,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,iEAAiE;AACjE,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,YAAY,GAAG,IAAI;IAEzD,oFAAoF;IACpF,YAAY,IAAI,OAAO;IAIvB;;;;OAIG;IACH,OAAO,CAAC,QAAQ;IAShB,qFAAqF;IAC/E,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,gBAAgB,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAY3E,sEAAsE;IAChE,GAAG,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAO1E;;;;;;OAMG;IACG,KAAK,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAkB5E,iGAAiG;IAC3F,OAAO,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;CAsBtF"}
|