@dudousxd/nestjs-agent-dashboard 0.15.4 → 0.16.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.
@@ -1,4 +1,4 @@
1
- import { ActorSpendRow, AgentGovernanceQueries, ActorDirectory, AgentPricingStore, AgentApprovalPort, GovernanceRange, ModelSpendRow, UsageTrendPoint, ThreadSpendRow, RunMetrics, RunAgentBreakdownRow, RunErrorBreakdownRow, RunTrendPoint, RecentRunRow, ToolCallActivityRow, GovernancePageQuery, ToolCallWhere, GovernancePage, RunWhere, PendingApprovalRow, ApprovalWhere, GovernanceRunDetail, GovernanceThreadDetailQuery, GovernanceThreadDetail, ThreadActivityRow, ToolStatRow, ThreadWhere, CurrentModelPrice, ActorResolver, ModelPriceInput } from '@dudousxd/nestjs-agent-core';
1
+ import { ActorSpendRow, AgentGovernanceQueries, ActorDirectory, AgentPricingStore, AgentApprovalPort, GovernanceRange, ModelSpendRow, UsageTrendPoint, ThreadSpendRow, RunMetrics, RunAgentBreakdownRow, RunErrorBreakdownRow, RunTrendPoint, RecentRunRow, ToolCallActivityRow, GovernancePageQuery, ToolCallWhere, GovernancePage, RunWhere, PendingApprovalRow, ApprovalWhere, GovernanceRunDetail, GovernanceThreadDetailQuery, GovernanceThreadDetail, ThreadActivityRow, ToolStatRow, GenuiStats, ThreadWhere, CurrentModelPrice, ActorResolver, ModelPriceInput } from '@dudousxd/nestjs-agent-core';
2
2
  export { ActorDirectory } from '@dudousxd/nestjs-agent-core';
3
3
  import { Observable } from 'rxjs';
4
4
  import { DynamicModule, Type, CanActivate, Provider, InjectionToken, OptionalFactoryDependency, StreamableFile } from '@nestjs/common';
@@ -95,6 +95,13 @@ declare class DashboardService {
95
95
  threadDetail(query: GovernanceThreadDetailQuery): Promise<ThreadDetailWithLabel>;
96
96
  /** Per-tool call/failure/rejection/latency rollup for a day range, for the Tools section. */
97
97
  toolStats(range: GovernanceRange): Promise<ToolStatRow[]>;
98
+ /**
99
+ * Generative-UI telemetry for a day range — first-try success per tool/model, common errors, UI
100
+ * cost per day/turn and time-to-frame. `genuiStats` is OPTIONAL on the read-model (a store that
101
+ * does not record UI calls leaves it out), so an unsupported store 501s with a clear message, the
102
+ * same posture as an unbound pricing store — the console renders that as its own state.
103
+ */
104
+ genuiStats(range: GovernanceRange): Promise<GenuiStats>;
98
105
  /**
99
106
  * Decide a pending HITL tool call from the console. Routes through the OPTIONAL
100
107
  * {@link AGENT_APPROVAL_PORT} — bound by `@dudousxd/nestjs-agent` to the SAME signal path chat
@@ -210,6 +217,12 @@ declare class AgentApiController {
210
217
  private deciderRef;
211
218
  /** Per-tool call/failure/rejection/latency rollup for a day range (defaults to the last 30 days). */
212
219
  tools(from?: string, to?: string): Promise<ToolStatRow[]>;
220
+ /**
221
+ * Generative-UI telemetry for a day range (defaults to the last 30 days): `{ totals, byToolModel,
222
+ * errors, byDay, costPerTurn, latency }`. 501s (via `DashboardService.genuiStats`) when the bound
223
+ * store does not implement `genuiStats`.
224
+ */
225
+ genui(from?: string, to?: string): Promise<GenuiStats>;
213
226
  /** Most recent threads (default 50, max 200) with rolled-up counts. */
214
227
  threads(limit?: string): Promise<ThreadActivityRowWithLabel[]>;
215
228
  /**
@@ -1,4 +1,4 @@
1
- import { ActorSpendRow, AgentGovernanceQueries, ActorDirectory, AgentPricingStore, AgentApprovalPort, GovernanceRange, ModelSpendRow, UsageTrendPoint, ThreadSpendRow, RunMetrics, RunAgentBreakdownRow, RunErrorBreakdownRow, RunTrendPoint, RecentRunRow, ToolCallActivityRow, GovernancePageQuery, ToolCallWhere, GovernancePage, RunWhere, PendingApprovalRow, ApprovalWhere, GovernanceRunDetail, GovernanceThreadDetailQuery, GovernanceThreadDetail, ThreadActivityRow, ToolStatRow, ThreadWhere, CurrentModelPrice, ActorResolver, ModelPriceInput } from '@dudousxd/nestjs-agent-core';
1
+ import { ActorSpendRow, AgentGovernanceQueries, ActorDirectory, AgentPricingStore, AgentApprovalPort, GovernanceRange, ModelSpendRow, UsageTrendPoint, ThreadSpendRow, RunMetrics, RunAgentBreakdownRow, RunErrorBreakdownRow, RunTrendPoint, RecentRunRow, ToolCallActivityRow, GovernancePageQuery, ToolCallWhere, GovernancePage, RunWhere, PendingApprovalRow, ApprovalWhere, GovernanceRunDetail, GovernanceThreadDetailQuery, GovernanceThreadDetail, ThreadActivityRow, ToolStatRow, GenuiStats, ThreadWhere, CurrentModelPrice, ActorResolver, ModelPriceInput } from '@dudousxd/nestjs-agent-core';
2
2
  export { ActorDirectory } from '@dudousxd/nestjs-agent-core';
3
3
  import { Observable } from 'rxjs';
4
4
  import { DynamicModule, Type, CanActivate, Provider, InjectionToken, OptionalFactoryDependency, StreamableFile } from '@nestjs/common';
@@ -95,6 +95,13 @@ declare class DashboardService {
95
95
  threadDetail(query: GovernanceThreadDetailQuery): Promise<ThreadDetailWithLabel>;
96
96
  /** Per-tool call/failure/rejection/latency rollup for a day range, for the Tools section. */
97
97
  toolStats(range: GovernanceRange): Promise<ToolStatRow[]>;
98
+ /**
99
+ * Generative-UI telemetry for a day range — first-try success per tool/model, common errors, UI
100
+ * cost per day/turn and time-to-frame. `genuiStats` is OPTIONAL on the read-model (a store that
101
+ * does not record UI calls leaves it out), so an unsupported store 501s with a clear message, the
102
+ * same posture as an unbound pricing store — the console renders that as its own state.
103
+ */
104
+ genuiStats(range: GovernanceRange): Promise<GenuiStats>;
98
105
  /**
99
106
  * Decide a pending HITL tool call from the console. Routes through the OPTIONAL
100
107
  * {@link AGENT_APPROVAL_PORT} — bound by `@dudousxd/nestjs-agent` to the SAME signal path chat
@@ -210,6 +217,12 @@ declare class AgentApiController {
210
217
  private deciderRef;
211
218
  /** Per-tool call/failure/rejection/latency rollup for a day range (defaults to the last 30 days). */
212
219
  tools(from?: string, to?: string): Promise<ToolStatRow[]>;
220
+ /**
221
+ * Generative-UI telemetry for a day range (defaults to the last 30 days): `{ totals, byToolModel,
222
+ * errors, byDay, costPerTurn, latency }`. 501s (via `DashboardService.genuiStats`) when the bound
223
+ * store does not implement `genuiStats`.
224
+ */
225
+ genui(from?: string, to?: string): Promise<GenuiStats>;
213
226
  /** Most recent threads (default 50, max 200) with rolled-up counts. */
214
227
  threads(limit?: string): Promise<ThreadActivityRowWithLabel[]>;
215
228
  /**
@@ -490,6 +490,7 @@ function _ts_param2(paramIndex, decorator) {
490
490
  __name(_ts_param2, "_ts_param");
491
491
  var PRICING_STORE_UNBOUND_MESSAGE = "Pricing CRUD is unavailable: no AGENT_PRICING_STORE is bound. Bind a pricing store (e.g. MikroOrmPricingStore from @dudousxd/nestjs-agent-store-mikro-orm) to enable it.";
492
492
  var APPROVAL_PORT_UNBOUND_MESSAGE = "Approve/reject is unavailable: no AGENT_APPROVAL_PORT is bound. Import AgentModule from @dudousxd/nestjs-agent alongside this dashboard to enable it \u2014 the approvals inbox stays read-only until then.";
493
+ var GENUI_STATS_UNSUPPORTED_MESSAGE = "Generative UI telemetry is unavailable: the bound AGENT_GOVERNANCE_QUERIES store does not implement genuiStats. Use a store adapter that records generative-UI calls (recordGenuiCalls) to enable it.";
493
494
  var AGENT_EVENTS = [
494
495
  "run.started",
495
496
  "message",
@@ -621,6 +622,18 @@ var DashboardService = class {
621
622
  return this.queries.toolStats(range);
622
623
  }
623
624
  /**
625
+ * Generative-UI telemetry for a day range — first-try success per tool/model, common errors, UI
626
+ * cost per day/turn and time-to-frame. `genuiStats` is OPTIONAL on the read-model (a store that
627
+ * does not record UI calls leaves it out), so an unsupported store 501s with a clear message, the
628
+ * same posture as an unbound pricing store — the console renders that as its own state.
629
+ */
630
+ async genuiStats(range) {
631
+ if (this.queries.genuiStats === void 0) {
632
+ throw new NotImplementedException(GENUI_STATS_UNSUPPORTED_MESSAGE);
633
+ }
634
+ return this.queries.genuiStats(range);
635
+ }
636
+ /**
624
637
  * Decide a pending HITL tool call from the console. Routes through the OPTIONAL
625
638
  * {@link AGENT_APPROVAL_PORT} — bound by `@dudousxd/nestjs-agent` to the SAME signal path chat
626
639
  * approvals use — so a 501 here (checked BEFORE body validation, same ordering as
@@ -1095,6 +1108,14 @@ var AgentApiController = class {
1095
1108
  tools(from, to) {
1096
1109
  return this.dashboard.toolStats(resolveRange(from, to));
1097
1110
  }
1111
+ /**
1112
+ * Generative-UI telemetry for a day range (defaults to the last 30 days): `{ totals, byToolModel,
1113
+ * errors, byDay, costPerTurn, latency }`. 501s (via `DashboardService.genuiStats`) when the bound
1114
+ * store does not implement `genuiStats`.
1115
+ */
1116
+ genui(from, to) {
1117
+ return this.dashboard.genuiStats(resolveRange(from, to));
1118
+ }
1098
1119
  /** Most recent threads (default 50, max 200) with rolled-up counts. */
1099
1120
  threads(limit) {
1100
1121
  return this.dashboard.recentThreads(parseLimit(limit, 50));
@@ -1285,6 +1306,17 @@ _ts_decorate3([
1285
1306
  ]),
1286
1307
  _ts_metadata3("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1287
1308
  ], AgentApiController.prototype, "tools", null);
1309
+ _ts_decorate3([
1310
+ Get("genui"),
1311
+ _ts_param3(0, Query("from")),
1312
+ _ts_param3(1, Query("to")),
1313
+ _ts_metadata3("design:type", Function),
1314
+ _ts_metadata3("design:paramtypes", [
1315
+ String,
1316
+ String
1317
+ ]),
1318
+ _ts_metadata3("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1319
+ ], AgentApiController.prototype, "genui", null);
1288
1320
  _ts_decorate3([
1289
1321
  Get("threads"),
1290
1322
  _ts_param3(0, Query("limit")),