@dudousxd/nestjs-agent-dashboard 0.15.5 → 0.17.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,12 +490,15 @@ 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",
496
497
  "tool-call",
497
498
  "quota.exceeded",
498
499
  "run.finished",
500
+ "run.failed",
501
+ "run.cancelled",
499
502
  "delegated"
500
503
  ];
501
504
  function isAgentEnvelope(message) {
@@ -621,6 +624,18 @@ var DashboardService = class {
621
624
  return this.queries.toolStats(range);
622
625
  }
623
626
  /**
627
+ * Generative-UI telemetry for a day range — first-try success per tool/model, common errors, UI
628
+ * cost per day/turn and time-to-frame. `genuiStats` is OPTIONAL on the read-model (a store that
629
+ * does not record UI calls leaves it out), so an unsupported store 501s with a clear message, the
630
+ * same posture as an unbound pricing store — the console renders that as its own state.
631
+ */
632
+ async genuiStats(range) {
633
+ if (this.queries.genuiStats === void 0) {
634
+ throw new NotImplementedException(GENUI_STATS_UNSUPPORTED_MESSAGE);
635
+ }
636
+ return this.queries.genuiStats(range);
637
+ }
638
+ /**
624
639
  * Decide a pending HITL tool call from the console. Routes through the OPTIONAL
625
640
  * {@link AGENT_APPROVAL_PORT} — bound by `@dudousxd/nestjs-agent` to the SAME signal path chat
626
641
  * approvals use — so a 501 here (checked BEFORE body validation, same ordering as
@@ -1095,6 +1110,14 @@ var AgentApiController = class {
1095
1110
  tools(from, to) {
1096
1111
  return this.dashboard.toolStats(resolveRange(from, to));
1097
1112
  }
1113
+ /**
1114
+ * Generative-UI telemetry for a day range (defaults to the last 30 days): `{ totals, byToolModel,
1115
+ * errors, byDay, costPerTurn, latency }`. 501s (via `DashboardService.genuiStats`) when the bound
1116
+ * store does not implement `genuiStats`.
1117
+ */
1118
+ genui(from, to) {
1119
+ return this.dashboard.genuiStats(resolveRange(from, to));
1120
+ }
1098
1121
  /** Most recent threads (default 50, max 200) with rolled-up counts. */
1099
1122
  threads(limit) {
1100
1123
  return this.dashboard.recentThreads(parseLimit(limit, 50));
@@ -1285,6 +1308,17 @@ _ts_decorate3([
1285
1308
  ]),
1286
1309
  _ts_metadata3("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1287
1310
  ], AgentApiController.prototype, "tools", null);
1311
+ _ts_decorate3([
1312
+ Get("genui"),
1313
+ _ts_param3(0, Query("from")),
1314
+ _ts_param3(1, Query("to")),
1315
+ _ts_metadata3("design:type", Function),
1316
+ _ts_metadata3("design:paramtypes", [
1317
+ String,
1318
+ String
1319
+ ]),
1320
+ _ts_metadata3("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1321
+ ], AgentApiController.prototype, "genui", null);
1288
1322
  _ts_decorate3([
1289
1323
  Get("threads"),
1290
1324
  _ts_param3(0, Query("limit")),