@adonis-agora/agent 0.20.0 → 0.22.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 (66) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +39 -1
  3. package/dist/assets/spa/assets/index-D8pLS_sd.css +1 -0
  4. package/dist/assets/spa/assets/index-DoUZ23yb.js +9 -0
  5. package/dist/assets/spa/index.html +13 -0
  6. package/dist/configure.d.ts +11 -6
  7. package/dist/configure.d.ts.map +1 -1
  8. package/dist/configure.js +12 -6
  9. package/dist/configure.js.map +1 -1
  10. package/dist/providers/agent_provider.d.ts.map +1 -1
  11. package/dist/providers/agent_provider.js +6 -0
  12. package/dist/providers/agent_provider.js.map +1 -1
  13. package/dist/providers/dashboard_provider.d.ts +55 -0
  14. package/dist/providers/dashboard_provider.d.ts.map +1 -0
  15. package/dist/providers/dashboard_provider.js +152 -0
  16. package/dist/providers/dashboard_provider.js.map +1 -0
  17. package/dist/src/dashboard/define_config.d.ts +75 -0
  18. package/dist/src/dashboard/define_config.d.ts.map +1 -0
  19. package/dist/src/dashboard/define_config.js +56 -0
  20. package/dist/src/dashboard/define_config.js.map +1 -0
  21. package/dist/src/dashboard/gate.d.ts +33 -0
  22. package/dist/src/dashboard/gate.d.ts.map +1 -0
  23. package/dist/src/dashboard/gate.js +52 -0
  24. package/dist/src/dashboard/gate.js.map +1 -0
  25. package/dist/src/dashboard/index.d.ts +20 -0
  26. package/dist/src/dashboard/index.d.ts.map +1 -0
  27. package/dist/src/dashboard/index.js +20 -0
  28. package/dist/src/dashboard/index.js.map +1 -0
  29. package/dist/src/dashboard/paths.d.ts +40 -0
  30. package/dist/src/dashboard/paths.d.ts.map +1 -0
  31. package/dist/src/dashboard/paths.js +99 -0
  32. package/dist/src/dashboard/paths.js.map +1 -0
  33. package/dist/src/index.d.ts +1 -1
  34. package/dist/src/index.js +1 -1
  35. package/dist/src/telescope/agent-governance-providers.d.ts +67 -0
  36. package/dist/src/telescope/agent-governance-providers.d.ts.map +1 -0
  37. package/dist/src/telescope/agent-governance-providers.js +312 -0
  38. package/dist/src/telescope/agent-governance-providers.js.map +1 -0
  39. package/dist/src/telescope/dashboard.d.ts +28 -8
  40. package/dist/src/telescope/dashboard.d.ts.map +1 -1
  41. package/dist/src/telescope/dashboard.js +233 -4
  42. package/dist/src/telescope/dashboard.js.map +1 -1
  43. package/dist/src/telescope/data-providers.d.ts +40 -1
  44. package/dist/src/telescope/data-providers.d.ts.map +1 -1
  45. package/dist/src/telescope/data-providers.js +19 -8
  46. package/dist/src/telescope/data-providers.js.map +1 -1
  47. package/dist/src/telescope/extension.d.ts +59 -14
  48. package/dist/src/telescope/extension.d.ts.map +1 -1
  49. package/dist/src/telescope/extension.js +90 -13
  50. package/dist/src/telescope/extension.js.map +1 -1
  51. package/dist/src/telescope/governance-registry.d.ts +15 -0
  52. package/dist/src/telescope/governance-registry.d.ts.map +1 -0
  53. package/dist/src/telescope/governance-registry.js +42 -0
  54. package/dist/src/telescope/governance-registry.js.map +1 -0
  55. package/dist/src/telescope/index.d.ts +4 -2
  56. package/dist/src/telescope/index.d.ts.map +1 -1
  57. package/dist/src/telescope/index.js +3 -1
  58. package/dist/src/telescope/index.js.map +1 -1
  59. package/dist/src/telescope/rag-data-providers.d.ts +69 -0
  60. package/dist/src/telescope/rag-data-providers.d.ts.map +1 -0
  61. package/dist/src/telescope/rag-data-providers.js +84 -0
  62. package/dist/src/telescope/rag-data-providers.js.map +1 -0
  63. package/dist/src/telescope/telescope-sdk.d.ts +11 -0
  64. package/dist/src/telescope/telescope-sdk.d.ts.map +1 -1
  65. package/dist/stubs/config/agent.stub +7 -0
  66. package/package.json +28 -18
@@ -0,0 +1,312 @@
1
+ import { getTelescopeGovernanceQueries } from './governance-registry.js';
2
+ /**
3
+ * Governance data providers for the "Agent" Telescope tab: spend/usage, run reliability, tool
4
+ * activity, and the pending-approvals inbox. Unlike `data-providers.ts` (which reads the ephemeral,
5
+ * capped `lib:agent` diagnostic entries Telescope's generic bridge records), these read the
6
+ * authoritative, restart-surviving read-model — `AgentGovernanceQueries` — via
7
+ * `governance-registry.ts` (see that file for why a module-internal registry stands in for Nest's
8
+ * DI-resolved `AGENT_GOVERNANCE_QUERIES`).
9
+ *
10
+ * ## Ported from the Nest reference with real gaps, not just renamed fields
11
+ *
12
+ * Adonis's `AgentGovernanceQueries` (`../spi/governance-queries.js`) is NOT the same interface as
13
+ * nestjs-agent-core's — it is a separately-designed SPI that happens to cover the same ground. Some
14
+ * of Nest's governance panels have no Adonis equivalent to bind to, and are deliberately NOT ported
15
+ * here rather than faked against a shape that doesn't exist:
16
+ *
17
+ * - **Top threads by cost** (`spendByThread`) — no such query on `AgentGovernanceQueries`.
18
+ * - **Run retries** — `RunReliability` has no retry counter at all (Nest's `RunMetrics.retries`
19
+ * counts LLM-step retries; Adonis's read-model doesn't aggregate that dimension).
20
+ * - **Run duration percentiles** — `RunReliability` exposes one `avgDurationMs`, not p50/p95; the
21
+ * `agent.runs.duration` provider below returns the mean instead of a metric-selectable
22
+ * percentile (Nest's `query.metric === 'p95'` switch has nothing to switch to here).
23
+ * - **Failed-run breakdown by error code** — no `RunErrorBreakdownRow`-shaped query exists;
24
+ * `RunSummaryRow.error` is a per-run message, not an aggregable code.
25
+ * - **Paged tool-calls / threads / runs tables** (`{ rows, total, page, limit }`, `Panel.paged`) —
26
+ * `AgentGovernanceQueries` has no page+total query for tool calls or threads at all
27
+ * (`recentToolCalls`/`recentThreads` are capped lists with no total), and `listRuns` paginates by
28
+ * an opaque CURSOR, not a page number, so it cannot answer "page 3 of 7" either. `agent.runs.recent`
29
+ * below uses `listRuns` for its FIRST page only, same as Nest's `recentRuns(limit)` — the capped,
30
+ * non-paged shape both ecosystems already had before A1's paged-table convention existed.
31
+ * - **Exact pending-approvals count** — `pendingApprovals` returns an array with no `total`; unlike
32
+ * Nest's `approvalsPage({ page: 1, pageSize: 1 }).total`, there is no cheap way to ask "how many,
33
+ * without listing them". `agentPendingApprovalsCountProvider` below is therefore a real
34
+ * approximation — see its own doc comment.
35
+ *
36
+ * Every provider still degrades to an empty-but-valid shape (0 / `[]`) when the read-model isn't
37
+ * bound, exactly like the Nest reference — governance is optional configuration
38
+ * (`config.governanceQueries`), and telescope must render something sane when it's off.
39
+ */
40
+ /** Default trailing window (in days, inclusive) when a panel query omits an explicit range. */
41
+ const DEFAULT_TREND_WINDOW_DAYS = 30;
42
+ const ISO_DAY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
43
+ function isIsoDay(value) {
44
+ return typeof value === 'string' && ISO_DAY_PATTERN.test(value);
45
+ }
46
+ function todayUtcDay() {
47
+ return new Date().toISOString().slice(0, 10);
48
+ }
49
+ /** Shift a `YYYY-MM-DD` UTC day by `deltaDays` (negative goes back in time). */
50
+ export function shiftUtcDay(day, deltaDays) {
51
+ const shifted = new Date(`${day}T00:00:00.000Z`);
52
+ shifted.setUTCDate(shifted.getUTCDate() + deltaDays);
53
+ return shifted.toISOString().slice(0, 10);
54
+ }
55
+ /**
56
+ * Derive the query range: honour explicit `fromDay`/`toDay` (validated ISO days), otherwise default
57
+ * to the trailing {@link DEFAULT_TREND_WINDOW_DAYS}-day window ending today (UTC).
58
+ */
59
+ export function resolveRange(query) {
60
+ const toDay = query && isIsoDay(query.toDay) ? query.toDay : todayUtcDay();
61
+ const fromDay = query && isIsoDay(query.fromDay)
62
+ ? query.fromDay
63
+ : shiftUtcDay(toDay, -(DEFAULT_TREND_WINDOW_DAYS - 1));
64
+ return { fromDay, toDay };
65
+ }
66
+ function roundCents(value) {
67
+ return Math.round(value * 100) / 100;
68
+ }
69
+ /** Read a positive number out of a raw query value — panel queries reach a provider as strings. */
70
+ function readPositiveNumber(raw) {
71
+ if (typeof raw === 'number')
72
+ return Number.isFinite(raw) && raw > 0 ? raw : undefined;
73
+ if (typeof raw !== 'string' || raw.trim() === '')
74
+ return undefined;
75
+ const parsed = Number(raw);
76
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;
77
+ }
78
+ /** Default row count for a "recent …" feed when a panel's query omits `limit`. */
79
+ const DEFAULT_RECENT_LIMIT = 50;
80
+ /** Hard ceiling on `limit`, regardless of what a panel's query requests. */
81
+ const MAX_RECENT_LIMIT = 500;
82
+ /** Clamp a panel-supplied `limit` into `[1, MAX_RECENT_LIMIT]`, defaulting when absent/invalid. */
83
+ function resolveLimit(query, fallback) {
84
+ const value = readPositiveNumber(query?.limit) ?? fallback;
85
+ return Math.min(MAX_RECENT_LIMIT, Math.max(1, Math.trunc(value)));
86
+ }
87
+ /** Placeholder shown for a table cell whose source value is `null`/unmeasured. */
88
+ const NO_VALUE = '—';
89
+ /** Cap this many characters before an error message rides into a table cell (matches the DB column's practical display width). */
90
+ const ERROR_MESSAGE_CAP = 500;
91
+ /** Cap a run's error message to {@link ERROR_MESSAGE_CAP} characters. `resolve()` output bypasses
92
+ * Telescope's entry redaction pipeline (that only runs on Watcher-recorded entries) — this cap is a
93
+ * stopgap so an unbounded stack trace never rides straight into a table cell unbounded. */
94
+ export function capErrorMessage(message) {
95
+ if (message === null)
96
+ return NO_VALUE;
97
+ return message.length > ERROR_MESSAGE_CAP ? `${message.slice(0, ERROR_MESSAGE_CAP)}…` : message;
98
+ }
99
+ /** Build a governance `DataProvider` from a fetch + a format step. Degrades to `format([])` when the
100
+ * read-model isn't bound — the empty-but-valid shape every formatter already yields for `[]`. */
101
+ function governanceProvider(name, arg, fetch, format) {
102
+ return {
103
+ name,
104
+ async resolve(query, _ctx) {
105
+ const queries = getTelescopeGovernanceQueries();
106
+ const rows = queries ? await fetch(queries, arg(query)) : [];
107
+ return format(rows);
108
+ },
109
+ };
110
+ }
111
+ /** stat → authoritative total spend (USD) over the range. */
112
+ export function agentSpendTotalProvider() {
113
+ return governanceProvider('agent.spend.totalCost', resolveRange, (queries, range) => queries.spendByModel(range), (rows) => ({
114
+ value: roundCents(rows.reduce((sum, row) => sum + row.costUsd, 0)),
115
+ }));
116
+ }
117
+ /** stat → authoritative total tokens (input + output) over the range. */
118
+ export function agentTokensTotalProvider() {
119
+ return governanceProvider('agent.spend.totalTokens', resolveRange, (queries, range) => queries.spendByModel(range), (rows) => ({
120
+ value: rows.reduce((sum, row) => sum + row.inputTokens + row.outputTokens, 0),
121
+ }));
122
+ }
123
+ /** breakdown → spend share per model (models with zero cost dropped from the donut). */
124
+ export function agentSpendByModelProvider() {
125
+ return governanceProvider('agent.spend.byModel', resolveRange, (queries, range) => queries.spendByModel(range), (rows) => ({
126
+ segments: rows
127
+ .filter((row) => row.costUsd > 0)
128
+ .map((row) => ({ label: row.modelId, value: roundCents(row.costUsd) })),
129
+ }));
130
+ }
131
+ /** table → per-model requests / in+out tokens / cost. */
132
+ export function agentModelSpendTableProvider() {
133
+ return governanceProvider('agent.spend.byModelTable', resolveRange, (queries, range) => queries.spendByModel(range), (rows) => ({
134
+ rows: rows.map((row) => ({ ...row, costUsd: roundCents(row.costUsd) })),
135
+ }));
136
+ }
137
+ /** timeseries → daily spend + tokens trend. */
138
+ export function agentUsageTrendProvider() {
139
+ return governanceProvider('agent.usage.trend', resolveRange, (queries, range) => queries.usageTrend(range), (points) => ({
140
+ rows: points.map((point) => ({
141
+ label: point.day,
142
+ costUsd: roundCents(point.costUsd),
143
+ totalTokens: point.totalTokens,
144
+ })),
145
+ }));
146
+ }
147
+ /** table → spend per acting ref (user/tenant). */
148
+ export function agentActorSpendTableProvider() {
149
+ return governanceProvider('agent.spend.byActor', resolveRange, (queries, range) => queries.spendByActor(range), (rows) => ({
150
+ rows: rows.map((row) => ({ ...row, costUsd: roundCents(row.costUsd) })),
151
+ }));
152
+ }
153
+ /** breakdown → spend share per actor (actors with zero cost dropped). */
154
+ export function agentSpendByActorProvider() {
155
+ return governanceProvider('agent.spend.byActorShare', resolveRange, (queries, range) => queries.spendByActor(range), (rows) => ({
156
+ segments: rows
157
+ .filter((row) => row.costUsd > 0)
158
+ .map((row) => ({ label: row.actorRef, value: roundCents(row.costUsd) })),
159
+ }));
160
+ }
161
+ /** Build a `DataProvider` off ONE range-scoped `runReliability` call + a format step — every
162
+ * reliability stat below reuses the same underlying query. Degrades to zeros when unbound. */
163
+ function reliabilityProvider(name, format) {
164
+ return {
165
+ name,
166
+ async resolve(query, _ctx) {
167
+ const queries = getTelescopeGovernanceQueries();
168
+ const metrics = queries
169
+ ? await queries.runReliability(toToolStatsRange(query))
170
+ : EMPTY_RELIABILITY;
171
+ return format(metrics);
172
+ },
173
+ };
174
+ }
175
+ const EMPTY_RELIABILITY = {
176
+ runs: 0,
177
+ successRate: 0,
178
+ failed: 0,
179
+ avgDurationMs: null,
180
+ };
181
+ /** `runReliability`'s range is `{ from?, to? }` (both optional), not `resolveRange`'s `{ fromDay, toDay }`
182
+ * (both required) — a panel that omits `fromDay`/`toDay` here means "no lower/upper bound", not "default
183
+ * trailing 30 days", matching what an unscoped reliability query already means on the SPI. */
184
+ function toToolStatsRange(query) {
185
+ const from = query && isIsoDay(query.fromDay) ? query.fromDay : undefined;
186
+ const to = query && isIsoDay(query.toDay) ? query.toDay : undefined;
187
+ return { ...(from !== undefined ? { from } : {}), ...(to !== undefined ? { to } : {}) };
188
+ }
189
+ /** stat → total runs over the range. */
190
+ export function agentRunsTotalProvider() {
191
+ return reliabilityProvider('agent.runs.total', (metrics) => ({ value: metrics.runs }));
192
+ }
193
+ /** stat → completed/total success rate over the range. */
194
+ export function agentRunsSuccessRateProvider() {
195
+ return reliabilityProvider('agent.runs.successRate', (metrics) => ({
196
+ value: metrics.successRate,
197
+ }));
198
+ }
199
+ /** stat → failed run count over the range. */
200
+ export function agentRunsFailedProvider() {
201
+ return reliabilityProvider('agent.runs.failed', (metrics) => ({ value: metrics.failed }));
202
+ }
203
+ /**
204
+ * stat → MEAN settled-run duration over the range. Not a percentile: `RunReliability` exposes only
205
+ * `avgDurationMs` (see this file's header) — there is no p50/p95 to select between, unlike the Nest
206
+ * reference's `query.metric` switch. `null` (no settled runs) resolves to 0.
207
+ */
208
+ export function agentRunsDurationProvider() {
209
+ return reliabilityProvider('agent.runs.duration', (metrics) => ({
210
+ value: metrics.avgDurationMs ?? 0,
211
+ }));
212
+ }
213
+ /** table → run/failure rollup per agent (empty when the adapter predates `byAgent`). */
214
+ export function agentRunsByAgentTableProvider() {
215
+ return reliabilityProvider('agent.runs.byAgent', (metrics) => ({
216
+ rows: (metrics.byAgent ?? []).map((row) => ({
217
+ agentName: row.agentName ?? NO_VALUE,
218
+ runs: row.runs,
219
+ failed: row.failed,
220
+ })),
221
+ }));
222
+ }
223
+ /** timeseries → daily runs + failures trend (empty when the adapter predates `trend`). */
224
+ export function agentRunsTrendProvider() {
225
+ return reliabilityProvider('agent.runs.trend', (metrics) => ({
226
+ rows: (metrics.trend ?? []).map((point) => ({ label: point.day, runs: point.runs, failed: point.failed })),
227
+ }));
228
+ }
229
+ /** table → most recent runs (newest first), via `listRuns`' first page — see this file's header for
230
+ * why this isn't the paged-table protocol. errorMessage capped per {@link capErrorMessage}. */
231
+ export function agentRecentRunsTableProvider() {
232
+ return {
233
+ name: 'agent.runs.recent',
234
+ async resolve(query, _ctx) {
235
+ const queries = getTelescopeGovernanceQueries();
236
+ if (!queries)
237
+ return { rows: [] };
238
+ const limit = resolveLimit(query, DEFAULT_RECENT_LIMIT);
239
+ const { runs } = await queries.listRuns({ limit });
240
+ return {
241
+ rows: runs.map((row) => ({
242
+ startedAt: row.startedAt,
243
+ runId: row.runId,
244
+ threadId: row.threadId,
245
+ actorRef: row.actorRef,
246
+ agentName: row.agentName ?? NO_VALUE,
247
+ status: row.status,
248
+ durationMs: row.durationMs ?? NO_VALUE,
249
+ stepCount: row.stepCount,
250
+ costUsd: row.costUsd ?? NO_VALUE,
251
+ error: capErrorMessage(row.error),
252
+ })),
253
+ };
254
+ },
255
+ };
256
+ }
257
+ /** table → most recent tool calls (newest first), from the durable read-model. */
258
+ export function agentRecentToolCallsTableProvider() {
259
+ return governanceProvider('agent.tools.recent', (query) => resolveLimit(query, DEFAULT_RECENT_LIMIT), (queries, limit) => queries.recentToolCalls(limit), (rows) => ({ rows }));
260
+ }
261
+ /** table → most recently active threads, with rolled-up message/token counts. */
262
+ export function agentRecentThreadsTableProvider() {
263
+ return governanceProvider('agent.threads.recent', (query) => resolveLimit(query, DEFAULT_RECENT_LIMIT), (queries, limit) => queries.recentThreads(limit), (rows) => ({ rows }));
264
+ }
265
+ /**
266
+ * stat → an APPROXIMATE count of tool calls sitting `pending_approval`, capped at
267
+ * {@link MAX_RECENT_LIMIT}. `AgentGovernanceQueries.pendingApprovals` has no `total` — unlike the
268
+ * Nest reference's exact `approvalsPage({ page: 1, pageSize: 1 }).total`, there is no cheap "how
269
+ * many, without listing them" query on this SPI (see this file's header). A backlog past the cap
270
+ * undercounts here exactly the way Nest's OLD `pendingApprovals(500).length` did before it got an
271
+ * exact query — that regression is accepted, not fixed, until `AgentGovernanceQueries` grows one.
272
+ */
273
+ export function agentPendingApprovalsCountProvider() {
274
+ return {
275
+ name: 'agent.approvals.pending',
276
+ async resolve(_query, _ctx) {
277
+ const queries = getTelescopeGovernanceQueries();
278
+ if (!queries)
279
+ return { value: 0 };
280
+ const rows = await queries.pendingApprovals({ limit: MAX_RECENT_LIMIT });
281
+ return { value: rows.length };
282
+ },
283
+ };
284
+ }
285
+ /** table → the pending-approvals inbox, oldest request first. */
286
+ export function agentPendingApprovalsTableProvider() {
287
+ return governanceProvider('agent.approvals.recent', (query) => resolveLimit(query, DEFAULT_RECENT_LIMIT), (queries, limit) => queries.pendingApprovals({ limit }), (rows) => ({
288
+ rows: rows.map((row) => ({
289
+ toolCallId: row.toolCallId,
290
+ toolName: row.toolName,
291
+ threadId: row.threadId,
292
+ actorRef: row.actorRef,
293
+ requestedAt: row.requestedAt,
294
+ runId: row.runId,
295
+ })),
296
+ }));
297
+ }
298
+ /** table → per-tool call/failure/rejection/latency rollup over the range. Only ONE latency column
299
+ * (`avgDurationMs`) — `PerToolStatRow` has no p50/p95 split, unlike the Nest reference's table. */
300
+ export function agentToolStatsTableProvider() {
301
+ return governanceProvider('agent.tools.stats', toToolStatsRange, (queries, range) => queries.perToolStats(range), (rows) => ({
302
+ rows: rows.map((row) => ({
303
+ toolName: row.toolName,
304
+ toolType: row.toolType,
305
+ calls: row.calls,
306
+ failed: row.failed,
307
+ rejected: row.rejected,
308
+ avgDurationMs: row.avgDurationMs ?? NO_VALUE,
309
+ })),
310
+ }));
311
+ }
312
+ //# sourceMappingURL=agent-governance-providers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-governance-providers.js","sourceRoot":"","sources":["../../../src/telescope/agent-governance-providers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAGzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,+FAA+F;AAC/F,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAErC,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAQ9C,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,WAAW;IAClB,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,SAAiB;IACxD,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,GAAG,GAAG,gBAAgB,CAAC,CAAC;IACjD,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,SAAS,CAAC,CAAC;IACrD,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAA0C;IAIrE,MAAM,KAAK,GAAG,KAAK,IAAI,QA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,EAAoB,EAAE,CAAC,CAAC;YAC1B,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,aAAa,EAAE,GAAG,CAAC,aAAa,IAAI,QAAQ;SAC7C,CAAC,CACH;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -1,21 +1,41 @@
1
- import type { DashboardSpec } from './telescope-sdk.js';
1
+ import type { DashboardSection, DashboardSpec } from './telescope-sdk.js';
2
2
  /** Options for the agent "Agent" dashboard. */
3
3
  export interface AgentDashboardOptions {
4
4
  /**
5
5
  * URL template for deep-linking a run row (a `LinkSpec.href` with `{key}` placeholders filled from the
6
- * row, e.g. `/agent/runs/{runId}`). Applied to the `runId` column of the runs, tool-calls, approvals
7
- * and delegations tables. Omit to render plain run ids with no link.
6
+ * row, e.g. `/agent/runs/{runId}`). Applied to the `runId` column of every table below that carries one
7
+ * (the entry-backed runs/tool-calls/approvals/delegations tables, AND the governance-backed
8
+ * runs/tool-calls/approvals tables). Omit to render plain run ids with no link.
8
9
  */
9
10
  runHref?: string;
10
- /** URL template for deep-linking a thread from the recent-runs table, e.g. `/agent/threads/{thread}`. */
11
+ /**
12
+ * URL template for deep-linking a thread, e.g. `/agent/threads/{thread}`. Applied to the entry-backed
13
+ * recent-runs table's `thread` column and the governance-backed tables' `threadId` column (two
14
+ * different keys — see `data-providers.ts` vs `agent-governance-providers.ts` for why the entry-backed
15
+ * table renames the field and the governance-backed ones don't).
16
+ */
11
17
  threadHref?: string;
18
+ /**
19
+ * HOST-contributed dashboard sections, appended after the built-in ones. Bind their panels to a
20
+ * provider passed via `agentTelescopeExtension({ providers })`, or to any built-in `agent.*`
21
+ * provider. Size each section's panel count to an exact multiple of its `cols` where practical — the
22
+ * renderer lays a section out as a fixed grid with no `colSpan`, so an orphan panel leaves a visible
23
+ * hole beside it. That's a layout nicety, not something validated here.
24
+ */
25
+ sections?: DashboardSection[];
12
26
  }
13
27
  /**
14
- * The "Agent" overview dashboard — run health up top (active runs / token usage / tool-call success
15
- * rate), then run activity (runs over-time + recent finished runs), then tools & approvals (tool-call
16
- * volume by status, recent tool calls, recent approval decisions), then delegations & token throughput.
28
+ * The "Agent" overview dashboard. Four ENTRY-BACKED sections (unchanged from before this port — see
29
+ * `data-providers.ts`): run health, run activity, tools & approvals, delegations & tokens. Then two
30
+ * GOVERNANCE-BACKED sections reading the authoritative, restart-surviving read-model (see
31
+ * `agent-governance-providers.ts` for exactly what that read-model can and can't answer on this SPI):
32
+ * spend/usage and run reliability + governance activity feeds. Then RAG (see `rag-data-providers.ts`
33
+ * for the honest, partial scope: retrieval counts/zero-hit-rate/mean-chunks/trend only — no latency,
34
+ * scores, or store/collection breakdown, because the recorded event doesn't carry them).
35
+ *
17
36
  * Pure data: panels bind to the `agent.*` data providers by name; the `*Href` options add an optional
18
- * `LinkSpec` on the id columns so a host agent SPA can deep-link a row.
37
+ * `LinkSpec` on the id columns so a host agent SPA can deep-link a row. `opts.sections` appends
38
+ * host-contributed sections after the built-in ones (see `AgentDashboardOptions.sections`).
19
39
  */
20
40
  export declare function agentDashboard(opts?: AgentDashboardOptions): DashboardSpec;
21
41
  //# sourceMappingURL=dashboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../../src/telescope/dashboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEhE,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yGAAyG;IACzG,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,GAAE,qBAA0B,GAAG,aAAa,CAoI9E"}
1
+ {"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../../src/telescope/dashboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,gBAAgB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAElF,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC/B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,IAAI,GAAE,qBAA0B,GAAG,aAAa,CAoW9E"}
@@ -1,15 +1,24 @@
1
1
  /**
2
- * The "Agent" overview dashboard — run health up top (active runs / token usage / tool-call success
3
- * rate), then run activity (runs over-time + recent finished runs), then tools & approvals (tool-call
4
- * volume by status, recent tool calls, recent approval decisions), then delegations & token throughput.
2
+ * The "Agent" overview dashboard. Four ENTRY-BACKED sections (unchanged from before this port — see
3
+ * `data-providers.ts`): run health, run activity, tools & approvals, delegations & tokens. Then two
4
+ * GOVERNANCE-BACKED sections reading the authoritative, restart-surviving read-model (see
5
+ * `agent-governance-providers.ts` for exactly what that read-model can and can't answer on this SPI):
6
+ * spend/usage and run reliability + governance activity feeds. Then RAG (see `rag-data-providers.ts`
7
+ * for the honest, partial scope: retrieval counts/zero-hit-rate/mean-chunks/trend only — no latency,
8
+ * scores, or store/collection breakdown, because the recorded event doesn't carry them).
9
+ *
5
10
  * Pure data: panels bind to the `agent.*` data providers by name; the `*Href` options add an optional
6
- * `LinkSpec` on the id columns so a host agent SPA can deep-link a row.
11
+ * `LinkSpec` on the id columns so a host agent SPA can deep-link a row. `opts.sections` appends
12
+ * host-contributed sections after the built-in ones (see `AgentDashboardOptions.sections`).
7
13
  */
8
14
  export function agentDashboard(opts = {}) {
9
15
  const runCol = (label) => opts.runHref ? { key: 'runId', label, link: { href: opts.runHref } } : { key: 'runId', label };
10
16
  const threadCol = opts.threadHref
11
17
  ? { key: 'thread', label: 'Thread', link: { href: opts.threadHref } }
12
18
  : { key: 'thread', label: 'Thread' };
19
+ const threadIdCol = opts.threadHref
20
+ ? { key: 'threadId', label: 'Thread', link: { href: opts.threadHref } }
21
+ : { key: 'threadId', label: 'Thread' };
13
22
  return {
14
23
  id: 'agent.overview',
15
24
  label: 'Agent',
@@ -134,6 +143,226 @@ export function agentDashboard(opts = {}) {
134
143
  },
135
144
  ],
136
145
  },
146
+ {
147
+ title: 'Spend & usage',
148
+ cols: 3,
149
+ panels: [
150
+ {
151
+ kind: 'stat',
152
+ title: 'Total spend (USD)',
153
+ data: { provider: 'agent.spend.totalCost' },
154
+ format: 'number',
155
+ },
156
+ {
157
+ kind: 'stat',
158
+ title: 'Total tokens',
159
+ data: { provider: 'agent.spend.totalTokens' },
160
+ format: 'number',
161
+ },
162
+ {
163
+ kind: 'breakdown',
164
+ title: 'Spend by model',
165
+ data: { provider: 'agent.spend.byModel' },
166
+ style: 'donut',
167
+ },
168
+ ],
169
+ },
170
+ {
171
+ title: 'Spend detail',
172
+ cols: 2,
173
+ panels: [
174
+ {
175
+ kind: 'table',
176
+ title: 'Spend by model',
177
+ data: { provider: 'agent.spend.byModelTable' },
178
+ columns: [
179
+ { key: 'modelId', label: 'Model' },
180
+ { key: 'requests', label: 'Requests' },
181
+ { key: 'inputTokens', label: 'Input tokens' },
182
+ { key: 'outputTokens', label: 'Output tokens' },
183
+ { key: 'costUsd', label: 'Cost (USD)' },
184
+ ],
185
+ },
186
+ {
187
+ kind: 'table',
188
+ title: 'Spend by actor',
189
+ data: { provider: 'agent.spend.byActor' },
190
+ columns: [
191
+ { key: 'actorRef', label: 'Actor' },
192
+ { key: 'requests', label: 'Requests' },
193
+ { key: 'totalTokens', label: 'Tokens' },
194
+ { key: 'costUsd', label: 'Cost (USD)' },
195
+ ],
196
+ },
197
+ {
198
+ kind: 'breakdown',
199
+ title: 'Spend by actor',
200
+ data: { provider: 'agent.spend.byActorShare' },
201
+ style: 'donut',
202
+ },
203
+ {
204
+ kind: 'timeseries',
205
+ title: 'Usage trend',
206
+ data: { provider: 'agent.usage.trend' },
207
+ series: ['costUsd', 'totalTokens'],
208
+ style: 'area',
209
+ },
210
+ ],
211
+ },
212
+ {
213
+ title: 'Run reliability',
214
+ cols: 3,
215
+ panels: [
216
+ { kind: 'stat', title: 'Runs', data: { provider: 'agent.runs.total' }, format: 'number' },
217
+ {
218
+ kind: 'gauge',
219
+ title: 'Success rate',
220
+ data: { provider: 'agent.runs.successRate' },
221
+ max: 1,
222
+ format: 'percent',
223
+ thresholds: { warn: 0.95, bad: 0.9, direction: 'down-bad' },
224
+ },
225
+ {
226
+ kind: 'stat',
227
+ title: 'Failed runs',
228
+ data: { provider: 'agent.runs.failed' },
229
+ format: 'number',
230
+ },
231
+ {
232
+ kind: 'stat',
233
+ title: 'Avg run duration',
234
+ data: { provider: 'agent.runs.duration' },
235
+ format: 'duration',
236
+ },
237
+ {
238
+ kind: 'table',
239
+ title: 'Runs by agent',
240
+ data: { provider: 'agent.runs.byAgent' },
241
+ columns: [
242
+ { key: 'agentName', label: 'Agent' },
243
+ { key: 'runs', label: 'Runs' },
244
+ { key: 'failed', label: 'Failed' },
245
+ ],
246
+ },
247
+ {
248
+ kind: 'timeseries',
249
+ title: 'Runs trend',
250
+ data: { provider: 'agent.runs.trend' },
251
+ series: ['runs', 'failed'],
252
+ style: 'stacked',
253
+ },
254
+ ],
255
+ },
256
+ {
257
+ title: 'Governance activity',
258
+ cols: 2,
259
+ panels: [
260
+ {
261
+ kind: 'table',
262
+ title: 'Recent runs',
263
+ data: { provider: 'agent.runs.recent' },
264
+ columns: [
265
+ { key: 'startedAt', label: 'Started' },
266
+ runCol('Run'),
267
+ threadIdCol,
268
+ { key: 'actorRef', label: 'Actor' },
269
+ { key: 'agentName', label: 'Agent' },
270
+ { key: 'status', label: 'Status' },
271
+ { key: 'durationMs', label: 'Duration (ms)' },
272
+ { key: 'costUsd', label: 'Cost (USD)' },
273
+ { key: 'error', label: 'Error' },
274
+ ],
275
+ },
276
+ {
277
+ kind: 'table',
278
+ title: 'Recent tool calls',
279
+ data: { provider: 'agent.tools.recent' },
280
+ columns: [
281
+ { key: 'createdAt', label: 'Time' },
282
+ { key: 'toolName', label: 'Tool' },
283
+ { key: 'toolType', label: 'Type' },
284
+ { key: 'status', label: 'Status' },
285
+ threadIdCol,
286
+ ],
287
+ },
288
+ {
289
+ kind: 'table',
290
+ title: 'Recent threads',
291
+ data: { provider: 'agent.threads.recent' },
292
+ columns: [
293
+ { key: 'lastActivityAt', label: 'Last activity' },
294
+ { key: 'title', label: 'Title' },
295
+ { key: 'actorRef', label: 'Actor' },
296
+ { key: 'messageCount', label: 'Messages' },
297
+ { key: 'totalTokens', label: 'Tokens' },
298
+ ],
299
+ },
300
+ {
301
+ kind: 'stat',
302
+ title: 'Pending approvals',
303
+ data: { provider: 'agent.approvals.pending' },
304
+ format: 'number',
305
+ },
306
+ {
307
+ kind: 'table',
308
+ title: 'Approvals inbox',
309
+ data: { provider: 'agent.approvals.recent' },
310
+ columns: [
311
+ { key: 'requestedAt', label: 'Requested' },
312
+ runCol('Run'),
313
+ { key: 'toolName', label: 'Tool' },
314
+ threadIdCol,
315
+ { key: 'actorRef', label: 'Actor' },
316
+ ],
317
+ },
318
+ {
319
+ kind: 'table',
320
+ title: 'Tool stats',
321
+ data: { provider: 'agent.tools.stats' },
322
+ columns: [
323
+ { key: 'toolName', label: 'Tool' },
324
+ { key: 'toolType', label: 'Type' },
325
+ { key: 'calls', label: 'Calls' },
326
+ { key: 'failed', label: 'Failed' },
327
+ { key: 'rejected', label: 'Rejected' },
328
+ { key: 'avgDurationMs', label: 'Avg (ms)' },
329
+ ],
330
+ },
331
+ ],
332
+ },
333
+ {
334
+ title: 'RAG',
335
+ cols: 2,
336
+ panels: [
337
+ {
338
+ kind: 'stat',
339
+ title: 'Retrievals',
340
+ data: { provider: 'agent.rag.retrievals' },
341
+ format: 'number',
342
+ },
343
+ {
344
+ kind: 'stat',
345
+ title: 'Zero-hit rate',
346
+ data: { provider: 'agent.rag.zeroHitRate' },
347
+ format: 'percent',
348
+ thresholds: { warn: 0.1, bad: 0.25, direction: 'up-bad' },
349
+ },
350
+ {
351
+ kind: 'stat',
352
+ title: 'Mean chunks',
353
+ data: { provider: 'agent.rag.chunks' },
354
+ format: 'number',
355
+ },
356
+ {
357
+ kind: 'timeseries',
358
+ title: 'Retrieval trend',
359
+ data: { provider: 'agent.rag.trend' },
360
+ series: ['retrievals', 'zeroHits'],
361
+ style: 'area',
362
+ },
363
+ ],
364
+ },
365
+ ...(opts.sections ?? []),
137
366
  ],
138
367
  };
139
368
  }