@dudousxd/nestjs-agent-dashboard 0.17.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 {
@@ -521,16 +521,20 @@ var DashboardService = class {
521
521
  }
522
522
  /** Spend/usage overview for a day range: by-model + by-actor spend and the daily trend, in parallel. */
523
523
  async spend(range) {
524
- const [byModel, byActorRaw, trend] = await Promise.all([
524
+ const [byModel, byActorRaw, trend, byFeature] = await Promise.all([
525
525
  this.queries.spendByModel(range),
526
526
  this.queries.spendByActor(range),
527
- this.queries.usageTrend(range)
527
+ this.queries.usageTrend(range),
528
+ this.queries.spendByFeature?.(range)
528
529
  ]);
529
530
  const byActor = await this.withActorLabels(byActorRaw);
530
531
  return {
531
532
  byModel,
532
533
  byActor,
533
- trend
534
+ trend,
535
+ ...byFeature !== void 0 ? {
536
+ byFeature
537
+ } : {}
534
538
  };
535
539
  }
536
540
  /** Top threads by cost for a day range (default 10, highest cost first). */