@dudousxd/nestjs-agent-dashboard 0.16.0 → 0.18.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, GenuiStats, ThreadWhere, CurrentModelPrice, ActorResolver, ModelPriceInput } from '@dudousxd/nestjs-agent-core';
1
+ import { ActorSpendRow, AgentGovernanceQueries, ActorDirectory, AgentPricingStore, AgentApprovalPort, GovernanceRange, ModelSpendRow, UsageTrendPoint, FeatureSpendRow, 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';
@@ -27,6 +27,11 @@ interface SpendOverview {
27
27
  byModel: ModelSpendRow[];
28
28
  byActor: ActorSpendRowWithLabel[];
29
29
  trend: UsageTrendPoint[];
30
+ /**
31
+ * Spend per feature — agent turns and usage recorded outside them side by side. Absent when the
32
+ * bound governance adapter has no `spendByFeature`.
33
+ */
34
+ byFeature?: FeatureSpendRow[];
30
35
  }
31
36
  /** The run-reliability overview the SPA renders on its Reliability section (`GET <api>/reliability`). */
32
37
  interface ReliabilityOverview {
@@ -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, GenuiStats, ThreadWhere, CurrentModelPrice, ActorResolver, ModelPriceInput } from '@dudousxd/nestjs-agent-core';
1
+ import { ActorSpendRow, AgentGovernanceQueries, ActorDirectory, AgentPricingStore, AgentApprovalPort, GovernanceRange, ModelSpendRow, UsageTrendPoint, FeatureSpendRow, 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';
@@ -27,6 +27,11 @@ interface SpendOverview {
27
27
  byModel: ModelSpendRow[];
28
28
  byActor: ActorSpendRowWithLabel[];
29
29
  trend: UsageTrendPoint[];
30
+ /**
31
+ * Spend per feature — agent turns and usage recorded outside them side by side. Absent when the
32
+ * bound governance adapter has no `spendByFeature`.
33
+ */
34
+ byFeature?: FeatureSpendRow[];
30
35
  }
31
36
  /** The run-reliability overview the SPA renders on its Reliability section (`GET <api>/reliability`). */
32
37
  interface ReliabilityOverview {
@@ -497,6 +497,8 @@ var AGENT_EVENTS = [
497
497
  "tool-call",
498
498
  "quota.exceeded",
499
499
  "run.finished",
500
+ "run.failed",
501
+ "run.cancelled",
500
502
  "delegated"
501
503
  ];
502
504
  function isAgentEnvelope(message) {
@@ -519,16 +521,20 @@ var DashboardService = class {
519
521
  }
520
522
  /** Spend/usage overview for a day range: by-model + by-actor spend and the daily trend, in parallel. */
521
523
  async spend(range) {
522
- const [byModel, byActorRaw, trend] = await Promise.all([
524
+ const [byModel, byActorRaw, trend, byFeature] = await Promise.all([
523
525
  this.queries.spendByModel(range),
524
526
  this.queries.spendByActor(range),
525
- this.queries.usageTrend(range)
527
+ this.queries.usageTrend(range),
528
+ this.queries.spendByFeature?.(range)
526
529
  ]);
527
530
  const byActor = await this.withActorLabels(byActorRaw);
528
531
  return {
529
532
  byModel,
530
533
  byActor,
531
- trend
534
+ trend,
535
+ ...byFeature !== void 0 ? {
536
+ byFeature
537
+ } : {}
532
538
  };
533
539
  }
534
540
  /** Top threads by cost for a day range (default 10, highest cost first). */