@dudousxd/nestjs-agent-dashboard 0.22.0 → 0.23.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.
- package/dist/server/index.cjs +80 -24
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +23 -2
- package/dist/server/index.d.ts +23 -2
- package/dist/server/index.js +78 -24
- package/dist/server/index.js.map +1 -1
- package/package.json +2 -2
package/dist/server/index.d.cts
CHANGED
|
@@ -4,6 +4,13 @@ import { Observable } from 'rxjs';
|
|
|
4
4
|
import { ExecutionContext, Type, Logger, DynamicModule, StreamableFile, OnModuleInit, HttpException, ExceptionFilter, ArgumentsHost, CanActivate, OnModuleDestroy } from '@nestjs/common';
|
|
5
5
|
import { ModuleRef, HttpAdapterHost } from '@nestjs/core';
|
|
6
6
|
|
|
7
|
+
/** The agent's `tenancy` option, as `AgentModule.forRoot({ tenancy })` holds it. */
|
|
8
|
+
type AgentTenancyOption = 'inherit' | false | {
|
|
9
|
+
enabled?: 'inherit' | boolean;
|
|
10
|
+
kinds?: string[];
|
|
11
|
+
nullRows?: 'tenantless' | 'shared';
|
|
12
|
+
};
|
|
13
|
+
|
|
7
14
|
/** An actor-scoped row decorated with its resolved display label — `null` when unbound or unresolved. */
|
|
8
15
|
interface WithActorLabel {
|
|
9
16
|
actorLabel: string | null;
|
|
@@ -68,7 +75,17 @@ declare class DashboardService {
|
|
|
68
75
|
private readonly actorDirectory?;
|
|
69
76
|
private readonly pricingStore?;
|
|
70
77
|
private readonly approvalPort?;
|
|
71
|
-
|
|
78
|
+
private readonly agentOptions?;
|
|
79
|
+
private readonly contextAccessor?;
|
|
80
|
+
constructor(queries: AgentGovernanceQueries, actorDirectory?: ActorDirectory | undefined, pricingStore?: AgentPricingStore | undefined, approvalPort?: AgentApprovalPort | undefined, agentOptions?: {
|
|
81
|
+
tenancy?: AgentTenancyOption;
|
|
82
|
+
} | undefined, contextAccessor?: unknown | undefined);
|
|
83
|
+
/**
|
|
84
|
+
* The read-model for this request: with the agent's tenancy on, narrowed to the viewer's context
|
|
85
|
+
* tenant (another tenant's thread or run is not found). A store without `forTenant` cannot be
|
|
86
|
+
* narrowed, so the console refuses (`501`) rather than show every tenant's rows.
|
|
87
|
+
*/
|
|
88
|
+
private scoped;
|
|
72
89
|
/** Spend/usage overview for a day range: by-model + by-actor spend and the daily trend, in parallel. */
|
|
73
90
|
spend(range: GovernanceRange): Promise<SpendOverview>;
|
|
74
91
|
/** Top threads by cost for a day range (default 10, highest cost first). */
|
|
@@ -732,6 +749,10 @@ declare const AGENT_APPROVAL_PORT: unique symbol;
|
|
|
732
749
|
* unauthenticated), `executedByRef` is simply omitted.
|
|
733
750
|
*/
|
|
734
751
|
declare const AGENT_ACTOR_RESOLVER: unique symbol;
|
|
752
|
+
/** `AgentModule`'s options — read for their `tenancy`. Optional: absent → tenancy `'inherit'`. */
|
|
753
|
+
declare const AGENT_OPTIONS: unique symbol;
|
|
754
|
+
/** `@dudousxd/nestjs-context`'s accessor. Optional: absent → the global slot, else tenancy off. */
|
|
755
|
+
declare const CONTEXT_ACCESSOR: unique symbol;
|
|
735
756
|
/** DI token carrying the UI mount base (e.g. `/ai-gateway`). */
|
|
736
757
|
declare const DASHBOARD_BASE_PATH: unique symbol;
|
|
737
758
|
/** DI token carrying the JSON API base the SPA fetches from (e.g. `/ai-gateway/api`). */
|
|
@@ -749,4 +770,4 @@ declare const DASHBOARD_CONSOLE_OPTIONS: unique symbol;
|
|
|
749
770
|
/** DI token: whether the agent's dev tools register into the dev-tools slot. */
|
|
750
771
|
declare const DASHBOARD_DEV_TOOLS: unique symbol;
|
|
751
772
|
|
|
752
|
-
export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_CONSOLE_ID, AGENT_DASHBOARD_CONFIG_ID, AGENT_GOVERNANCE_QUERIES, AGENT_PRICING_STORE, AVIARY_CONSOLES_SLOT, type ActorSpendRowWithLabel, AgentApiController, AgentApiModule, AgentConsoleRegistration, AgentConsolesController, AgentDashboardModule, type AgentDashboardMountPathsOptions, type AgentDashboardOptions, type AgentDevTool, AgentDevToolsRegistration, AgentUiController, type AviaryConsoleDecision, type AviaryConsoleEntry, type AviaryConsoleIcon, type AviaryConsoleRegistry, CONSOLE_AUTHORIZE_MISSING_WARNING, CONSOLE_GATE, CONSOLE_PAGE_METADATA, CONSOLE_PROBE_TIMEOUT_MS, ConsoleAccessDenied, type ConsoleAuthorize, ConsoleAuthorizeFilter, ConsoleAuthorizeGuard, type ConsoleAuthorizeResult, type ConsoleAuthorizer, type ConsoleAuthorizerClass, type ConsoleDecide, type ConsoleDecision, type ConsoleGate, ConsolePage, type ConsolePolicyCheck, DASHBOARD_API_PATH, DASHBOARD_APPROVAL_ACTOR_REF, DASHBOARD_BASE_PATH, DASHBOARD_CONSOLE_OPTIONS, DASHBOARD_DEV_TOOLS, DashboardConsoleAccess, DashboardService, type LiveAgentEvent, type ReliabilityOverview, type RunDetailWithLabel, type SpendOverview, type ThreadActivityRowWithLabel, type ThreadDetailWithLabel, type ThreadSpendRowWithLabel, UseConsoleAuthorize, type VisibleConsole, type VisibleConsoles, type WithActorLabel, agentDashboardMountPaths, agentDevTools, anyAuthorize, authorizeByToken, listVisibleConsoles, normalizeConsoleResult, parsePriceInput, registerAviaryConsole, resolveConsoleAuthorize };
|
|
773
|
+
export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_CONSOLE_ID, AGENT_DASHBOARD_CONFIG_ID, AGENT_GOVERNANCE_QUERIES, AGENT_OPTIONS, AGENT_PRICING_STORE, AVIARY_CONSOLES_SLOT, type ActorSpendRowWithLabel, AgentApiController, AgentApiModule, AgentConsoleRegistration, AgentConsolesController, AgentDashboardModule, type AgentDashboardMountPathsOptions, type AgentDashboardOptions, type AgentDevTool, AgentDevToolsRegistration, AgentUiController, type AviaryConsoleDecision, type AviaryConsoleEntry, type AviaryConsoleIcon, type AviaryConsoleRegistry, CONSOLE_AUTHORIZE_MISSING_WARNING, CONSOLE_GATE, CONSOLE_PAGE_METADATA, CONSOLE_PROBE_TIMEOUT_MS, CONTEXT_ACCESSOR, ConsoleAccessDenied, type ConsoleAuthorize, ConsoleAuthorizeFilter, ConsoleAuthorizeGuard, type ConsoleAuthorizeResult, type ConsoleAuthorizer, type ConsoleAuthorizerClass, type ConsoleDecide, type ConsoleDecision, type ConsoleGate, ConsolePage, type ConsolePolicyCheck, DASHBOARD_API_PATH, DASHBOARD_APPROVAL_ACTOR_REF, DASHBOARD_BASE_PATH, DASHBOARD_CONSOLE_OPTIONS, DASHBOARD_DEV_TOOLS, DashboardConsoleAccess, DashboardService, type LiveAgentEvent, type ReliabilityOverview, type RunDetailWithLabel, type SpendOverview, type ThreadActivityRowWithLabel, type ThreadDetailWithLabel, type ThreadSpendRowWithLabel, UseConsoleAuthorize, type VisibleConsole, type VisibleConsoles, type WithActorLabel, agentDashboardMountPaths, agentDevTools, anyAuthorize, authorizeByToken, listVisibleConsoles, normalizeConsoleResult, parsePriceInput, registerAviaryConsole, resolveConsoleAuthorize };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -4,6 +4,13 @@ import { Observable } from 'rxjs';
|
|
|
4
4
|
import { ExecutionContext, Type, Logger, DynamicModule, StreamableFile, OnModuleInit, HttpException, ExceptionFilter, ArgumentsHost, CanActivate, OnModuleDestroy } from '@nestjs/common';
|
|
5
5
|
import { ModuleRef, HttpAdapterHost } from '@nestjs/core';
|
|
6
6
|
|
|
7
|
+
/** The agent's `tenancy` option, as `AgentModule.forRoot({ tenancy })` holds it. */
|
|
8
|
+
type AgentTenancyOption = 'inherit' | false | {
|
|
9
|
+
enabled?: 'inherit' | boolean;
|
|
10
|
+
kinds?: string[];
|
|
11
|
+
nullRows?: 'tenantless' | 'shared';
|
|
12
|
+
};
|
|
13
|
+
|
|
7
14
|
/** An actor-scoped row decorated with its resolved display label — `null` when unbound or unresolved. */
|
|
8
15
|
interface WithActorLabel {
|
|
9
16
|
actorLabel: string | null;
|
|
@@ -68,7 +75,17 @@ declare class DashboardService {
|
|
|
68
75
|
private readonly actorDirectory?;
|
|
69
76
|
private readonly pricingStore?;
|
|
70
77
|
private readonly approvalPort?;
|
|
71
|
-
|
|
78
|
+
private readonly agentOptions?;
|
|
79
|
+
private readonly contextAccessor?;
|
|
80
|
+
constructor(queries: AgentGovernanceQueries, actorDirectory?: ActorDirectory | undefined, pricingStore?: AgentPricingStore | undefined, approvalPort?: AgentApprovalPort | undefined, agentOptions?: {
|
|
81
|
+
tenancy?: AgentTenancyOption;
|
|
82
|
+
} | undefined, contextAccessor?: unknown | undefined);
|
|
83
|
+
/**
|
|
84
|
+
* The read-model for this request: with the agent's tenancy on, narrowed to the viewer's context
|
|
85
|
+
* tenant (another tenant's thread or run is not found). A store without `forTenant` cannot be
|
|
86
|
+
* narrowed, so the console refuses (`501`) rather than show every tenant's rows.
|
|
87
|
+
*/
|
|
88
|
+
private scoped;
|
|
72
89
|
/** Spend/usage overview for a day range: by-model + by-actor spend and the daily trend, in parallel. */
|
|
73
90
|
spend(range: GovernanceRange): Promise<SpendOverview>;
|
|
74
91
|
/** Top threads by cost for a day range (default 10, highest cost first). */
|
|
@@ -732,6 +749,10 @@ declare const AGENT_APPROVAL_PORT: unique symbol;
|
|
|
732
749
|
* unauthenticated), `executedByRef` is simply omitted.
|
|
733
750
|
*/
|
|
734
751
|
declare const AGENT_ACTOR_RESOLVER: unique symbol;
|
|
752
|
+
/** `AgentModule`'s options — read for their `tenancy`. Optional: absent → tenancy `'inherit'`. */
|
|
753
|
+
declare const AGENT_OPTIONS: unique symbol;
|
|
754
|
+
/** `@dudousxd/nestjs-context`'s accessor. Optional: absent → the global slot, else tenancy off. */
|
|
755
|
+
declare const CONTEXT_ACCESSOR: unique symbol;
|
|
735
756
|
/** DI token carrying the UI mount base (e.g. `/ai-gateway`). */
|
|
736
757
|
declare const DASHBOARD_BASE_PATH: unique symbol;
|
|
737
758
|
/** DI token carrying the JSON API base the SPA fetches from (e.g. `/ai-gateway/api`). */
|
|
@@ -749,4 +770,4 @@ declare const DASHBOARD_CONSOLE_OPTIONS: unique symbol;
|
|
|
749
770
|
/** DI token: whether the agent's dev tools register into the dev-tools slot. */
|
|
750
771
|
declare const DASHBOARD_DEV_TOOLS: unique symbol;
|
|
751
772
|
|
|
752
|
-
export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_CONSOLE_ID, AGENT_DASHBOARD_CONFIG_ID, AGENT_GOVERNANCE_QUERIES, AGENT_PRICING_STORE, AVIARY_CONSOLES_SLOT, type ActorSpendRowWithLabel, AgentApiController, AgentApiModule, AgentConsoleRegistration, AgentConsolesController, AgentDashboardModule, type AgentDashboardMountPathsOptions, type AgentDashboardOptions, type AgentDevTool, AgentDevToolsRegistration, AgentUiController, type AviaryConsoleDecision, type AviaryConsoleEntry, type AviaryConsoleIcon, type AviaryConsoleRegistry, CONSOLE_AUTHORIZE_MISSING_WARNING, CONSOLE_GATE, CONSOLE_PAGE_METADATA, CONSOLE_PROBE_TIMEOUT_MS, ConsoleAccessDenied, type ConsoleAuthorize, ConsoleAuthorizeFilter, ConsoleAuthorizeGuard, type ConsoleAuthorizeResult, type ConsoleAuthorizer, type ConsoleAuthorizerClass, type ConsoleDecide, type ConsoleDecision, type ConsoleGate, ConsolePage, type ConsolePolicyCheck, DASHBOARD_API_PATH, DASHBOARD_APPROVAL_ACTOR_REF, DASHBOARD_BASE_PATH, DASHBOARD_CONSOLE_OPTIONS, DASHBOARD_DEV_TOOLS, DashboardConsoleAccess, DashboardService, type LiveAgentEvent, type ReliabilityOverview, type RunDetailWithLabel, type SpendOverview, type ThreadActivityRowWithLabel, type ThreadDetailWithLabel, type ThreadSpendRowWithLabel, UseConsoleAuthorize, type VisibleConsole, type VisibleConsoles, type WithActorLabel, agentDashboardMountPaths, agentDevTools, anyAuthorize, authorizeByToken, listVisibleConsoles, normalizeConsoleResult, parsePriceInput, registerAviaryConsole, resolveConsoleAuthorize };
|
|
773
|
+
export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_CONSOLE_ID, AGENT_DASHBOARD_CONFIG_ID, AGENT_GOVERNANCE_QUERIES, AGENT_OPTIONS, AGENT_PRICING_STORE, AVIARY_CONSOLES_SLOT, type ActorSpendRowWithLabel, AgentApiController, AgentApiModule, AgentConsoleRegistration, AgentConsolesController, AgentDashboardModule, type AgentDashboardMountPathsOptions, type AgentDashboardOptions, type AgentDevTool, AgentDevToolsRegistration, AgentUiController, type AviaryConsoleDecision, type AviaryConsoleEntry, type AviaryConsoleIcon, type AviaryConsoleRegistry, CONSOLE_AUTHORIZE_MISSING_WARNING, CONSOLE_GATE, CONSOLE_PAGE_METADATA, CONSOLE_PROBE_TIMEOUT_MS, CONTEXT_ACCESSOR, ConsoleAccessDenied, type ConsoleAuthorize, ConsoleAuthorizeFilter, ConsoleAuthorizeGuard, type ConsoleAuthorizeResult, type ConsoleAuthorizer, type ConsoleAuthorizerClass, type ConsoleDecide, type ConsoleDecision, type ConsoleGate, ConsolePage, type ConsolePolicyCheck, DASHBOARD_API_PATH, DASHBOARD_APPROVAL_ACTOR_REF, DASHBOARD_BASE_PATH, DASHBOARD_CONSOLE_OPTIONS, DASHBOARD_DEV_TOOLS, DashboardConsoleAccess, DashboardService, type LiveAgentEvent, type ReliabilityOverview, type RunDetailWithLabel, type SpendOverview, type ThreadActivityRowWithLabel, type ThreadDetailWithLabel, type ThreadSpendRowWithLabel, UseConsoleAuthorize, type VisibleConsole, type VisibleConsoles, type WithActorLabel, agentDashboardMountPaths, agentDevTools, anyAuthorize, authorizeByToken, listVisibleConsoles, normalizeConsoleResult, parsePriceInput, registerAviaryConsole, resolveConsoleAuthorize };
|
package/dist/server/index.js
CHANGED
|
@@ -73,12 +73,37 @@ function isFiniteNonNegative(value) {
|
|
|
73
73
|
}
|
|
74
74
|
__name(isFiniteNonNegative, "isFiniteNonNegative");
|
|
75
75
|
|
|
76
|
+
// src/server/tenancy.ts
|
|
77
|
+
var SLOT = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-diagnostics:accessor");
|
|
78
|
+
function consoleTenantFilter(option = "inherit", accessor) {
|
|
79
|
+
const slot = globalThis[SLOT];
|
|
80
|
+
const a = accessor ?? slot?.current;
|
|
81
|
+
if (option === false || typeof a?.tenancy !== "function" || !a.tenantFilter) return void 0;
|
|
82
|
+
const own = typeof option === "object" ? option : {};
|
|
83
|
+
const inherit = own.enabled === void 0 || own.enabled === "inherit";
|
|
84
|
+
if (!(inherit ? a.tenancy().enabled : own.enabled)) return void 0;
|
|
85
|
+
const filter = a.tenantFilter(own.kinds ? {
|
|
86
|
+
kinds: own.kinds
|
|
87
|
+
} : void 0);
|
|
88
|
+
if (filter.mode === "system" || filter.mode === "all") return void 0;
|
|
89
|
+
if (filter.mode === "tenantless") return {
|
|
90
|
+
nulls: true
|
|
91
|
+
};
|
|
92
|
+
return {
|
|
93
|
+
tenant: filter.tenant.id,
|
|
94
|
+
nulls: own.nullRows === "shared"
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
__name(consoleTenantFilter, "consoleTenantFilter");
|
|
98
|
+
|
|
76
99
|
// src/server/tokens.ts
|
|
77
100
|
var AGENT_GOVERNANCE_QUERIES = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:governance-queries");
|
|
78
101
|
var AGENT_ACTOR_DIRECTORY = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:actor-directory");
|
|
79
102
|
var AGENT_PRICING_STORE = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:pricing-store");
|
|
80
103
|
var AGENT_APPROVAL_PORT = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:approval-port");
|
|
81
104
|
var AGENT_ACTOR_RESOLVER = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:actor-resolver");
|
|
105
|
+
var AGENT_OPTIONS = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:options");
|
|
106
|
+
var CONTEXT_ACCESSOR = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-context:accessor");
|
|
82
107
|
var DASHBOARD_BASE_PATH = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent-dashboard:base-path");
|
|
83
108
|
var DASHBOARD_API_PATH = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent-dashboard:api-path");
|
|
84
109
|
var DASHBOARD_APPROVAL_ACTOR_REF = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent-dashboard:approval-actor-ref");
|
|
@@ -114,6 +139,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
114
139
|
__name(_ts_param, "_ts_param");
|
|
115
140
|
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.";
|
|
116
141
|
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.";
|
|
142
|
+
var TENANT_SCOPE_UNSUPPORTED_MESSAGE = "The agent console is tenant-scoped (AgentModule tenancy is on), and the bound AGENT_GOVERNANCE_QUERIES store does not implement forTenant. Use a store adapter that does (Drizzle, MikroORM, in-memory) or set AgentModule `tenancy: false`.";
|
|
117
143
|
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.";
|
|
118
144
|
var AGENT_EVENTS = [
|
|
119
145
|
"run.started",
|
|
@@ -137,19 +163,37 @@ var DashboardService = class {
|
|
|
137
163
|
actorDirectory;
|
|
138
164
|
pricingStore;
|
|
139
165
|
approvalPort;
|
|
140
|
-
|
|
166
|
+
agentOptions;
|
|
167
|
+
contextAccessor;
|
|
168
|
+
constructor(queries, actorDirectory, pricingStore, approvalPort, agentOptions, contextAccessor) {
|
|
141
169
|
this.queries = queries;
|
|
142
170
|
this.actorDirectory = actorDirectory;
|
|
143
171
|
this.pricingStore = pricingStore;
|
|
144
172
|
this.approvalPort = approvalPort;
|
|
173
|
+
this.agentOptions = agentOptions;
|
|
174
|
+
this.contextAccessor = contextAccessor;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The read-model for this request: with the agent's tenancy on, narrowed to the viewer's context
|
|
178
|
+
* tenant (another tenant's thread or run is not found). A store without `forTenant` cannot be
|
|
179
|
+
* narrowed, so the console refuses (`501`) rather than show every tenant's rows.
|
|
180
|
+
*/
|
|
181
|
+
scoped() {
|
|
182
|
+
const filter = consoleTenantFilter(this.agentOptions?.tenancy ?? "inherit", this.contextAccessor);
|
|
183
|
+
if (filter === void 0) return this.queries;
|
|
184
|
+
if (typeof this.queries.forTenant !== "function") {
|
|
185
|
+
throw new NotImplementedException(TENANT_SCOPE_UNSUPPORTED_MESSAGE);
|
|
186
|
+
}
|
|
187
|
+
return this.queries.forTenant(filter);
|
|
145
188
|
}
|
|
146
189
|
/** Spend/usage overview for a day range: by-model + by-actor spend and the daily trend, in parallel. */
|
|
147
190
|
async spend(range) {
|
|
191
|
+
const queries = this.scoped();
|
|
148
192
|
const [byModel, byActorRaw, trend, byFeature] = await Promise.all([
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
193
|
+
queries.spendByModel(range),
|
|
194
|
+
queries.spendByActor(range),
|
|
195
|
+
queries.usageTrend(range),
|
|
196
|
+
queries.spendByFeature?.(range)
|
|
153
197
|
]);
|
|
154
198
|
const byActor = await this.withActorLabels(byActorRaw);
|
|
155
199
|
return {
|
|
@@ -163,16 +207,17 @@ var DashboardService = class {
|
|
|
163
207
|
}
|
|
164
208
|
/** Top threads by cost for a day range (default 10, highest cost first). */
|
|
165
209
|
async topThreads(range, limit2 = 10) {
|
|
166
|
-
const rows = await this.
|
|
210
|
+
const rows = await this.scoped().spendByThread(range, limit2);
|
|
167
211
|
return this.withActorLabels(rows);
|
|
168
212
|
}
|
|
169
213
|
/** Run reliability for a day range: metrics, by-agent/by-error breakdowns and the trend, in parallel. */
|
|
170
214
|
async reliability(range) {
|
|
215
|
+
const queries = this.scoped();
|
|
171
216
|
const [metrics, byAgent, errors, trend] = await Promise.all([
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
217
|
+
queries.runMetrics(range),
|
|
218
|
+
queries.runsByAgent(range),
|
|
219
|
+
queries.runErrors(range),
|
|
220
|
+
queries.runTrend(range)
|
|
176
221
|
]);
|
|
177
222
|
return {
|
|
178
223
|
metrics,
|
|
@@ -183,19 +228,19 @@ var DashboardService = class {
|
|
|
183
228
|
}
|
|
184
229
|
/** Most recent runs (status/agent/duration/error) for the Reliability recent-runs table. */
|
|
185
230
|
recentRuns(limit2) {
|
|
186
|
-
return this.
|
|
231
|
+
return this.scoped().recentRuns(limit2);
|
|
187
232
|
}
|
|
188
233
|
/** Most recent tool calls (status/type/thread) for the Runs & tools activity feed. */
|
|
189
234
|
recentToolCalls(limit2) {
|
|
190
|
-
return this.
|
|
235
|
+
return this.scoped().recentToolCalls(limit2);
|
|
191
236
|
}
|
|
192
237
|
/** Paged, filterable tool calls for the Runs & tools activity table. */
|
|
193
238
|
toolCallsPage(query) {
|
|
194
|
-
return this.
|
|
239
|
+
return this.scoped().toolCallsPage(query);
|
|
195
240
|
}
|
|
196
241
|
/** Paged, filterable runs for the Reliability recent-runs table. */
|
|
197
242
|
runsPage(query) {
|
|
198
|
-
return this.
|
|
243
|
+
return this.scoped().runsPage(query);
|
|
199
244
|
}
|
|
200
245
|
/**
|
|
201
246
|
* Tool calls sitting `pending_approval`, oldest first, for the cross-thread approvals inbox.
|
|
@@ -203,11 +248,11 @@ var DashboardService = class {
|
|
|
203
248
|
* {@link approvalsPage}, which reports how much of the backlog the cap hid.
|
|
204
249
|
*/
|
|
205
250
|
pendingApprovals(limit2) {
|
|
206
|
-
return this.
|
|
251
|
+
return this.scoped().pendingApprovals(limit2);
|
|
207
252
|
}
|
|
208
253
|
/** Paged, filterable approvals inbox with a total — the backlog-safe read of the HITL queue. */
|
|
209
254
|
approvalsPage(query) {
|
|
210
|
-
return this.
|
|
255
|
+
return this.scoped().approvalsPage(query);
|
|
211
256
|
}
|
|
212
257
|
/**
|
|
213
258
|
* One run with its thread and its tool calls. 404s on an unknown id rather than returning an empty
|
|
@@ -215,7 +260,7 @@ var DashboardService = class {
|
|
|
215
260
|
* that conflates them sends an operator looking for a bug that isn't there.
|
|
216
261
|
*/
|
|
217
262
|
async runDetail(runId) {
|
|
218
|
-
const detail = await this.
|
|
263
|
+
const detail = await this.scoped().runDetail(runId);
|
|
219
264
|
if (detail === null) {
|
|
220
265
|
throw new NotFoundException(`No run "${runId}".`);
|
|
221
266
|
}
|
|
@@ -232,7 +277,7 @@ var DashboardService = class {
|
|
|
232
277
|
}
|
|
233
278
|
/** One thread with its usage rollup, runs and messages. 404s on an unknown id, like {@link runDetail}. */
|
|
234
279
|
async threadDetail(query) {
|
|
235
|
-
const detail = await this.
|
|
280
|
+
const detail = await this.scoped().threadDetail(query);
|
|
236
281
|
if (detail === null) {
|
|
237
282
|
throw new NotFoundException(`No thread "${query.threadId}".`);
|
|
238
283
|
}
|
|
@@ -249,7 +294,7 @@ var DashboardService = class {
|
|
|
249
294
|
}
|
|
250
295
|
/** Per-tool call/failure/rejection/latency rollup for a day range, for the Tools section. */
|
|
251
296
|
toolStats(range) {
|
|
252
|
-
return this.
|
|
297
|
+
return this.scoped().toolStats(range);
|
|
253
298
|
}
|
|
254
299
|
/**
|
|
255
300
|
* Generative-UI telemetry for a day range — first-try success per tool/model, common errors, UI
|
|
@@ -258,10 +303,11 @@ var DashboardService = class {
|
|
|
258
303
|
* same posture as an unbound pricing store — the console renders that as its own state.
|
|
259
304
|
*/
|
|
260
305
|
async genuiStats(range) {
|
|
261
|
-
|
|
306
|
+
const queries = this.scoped();
|
|
307
|
+
if (queries.genuiStats === void 0) {
|
|
262
308
|
throw new NotImplementedException(GENUI_STATS_UNSUPPORTED_MESSAGE);
|
|
263
309
|
}
|
|
264
|
-
return
|
|
310
|
+
return queries.genuiStats(range);
|
|
265
311
|
}
|
|
266
312
|
/**
|
|
267
313
|
* Decide a pending HITL tool call from the console. Routes through the OPTIONAL
|
|
@@ -292,7 +338,7 @@ var DashboardService = class {
|
|
|
292
338
|
}
|
|
293
339
|
/** Most recent threads with rolled-up message/token counts. */
|
|
294
340
|
async recentThreads(limit2) {
|
|
295
|
-
const rows = await this.
|
|
341
|
+
const rows = await this.scoped().recentThreads(limit2);
|
|
296
342
|
return this.withActorLabels(rows);
|
|
297
343
|
}
|
|
298
344
|
/**
|
|
@@ -300,7 +346,7 @@ var DashboardService = class {
|
|
|
300
346
|
* {@link recentThreads} is.
|
|
301
347
|
*/
|
|
302
348
|
async threadsPage(query) {
|
|
303
|
-
const page2 = await this.
|
|
349
|
+
const page2 = await this.scoped().threadsPage(query);
|
|
304
350
|
const rows = await this.withActorLabels(page2.rows);
|
|
305
351
|
return {
|
|
306
352
|
...page2,
|
|
@@ -389,12 +435,18 @@ DashboardService = _ts_decorate([
|
|
|
389
435
|
_ts_param(2, Inject(AGENT_PRICING_STORE)),
|
|
390
436
|
_ts_param(3, Optional()),
|
|
391
437
|
_ts_param(3, Inject(AGENT_APPROVAL_PORT)),
|
|
438
|
+
_ts_param(4, Optional()),
|
|
439
|
+
_ts_param(4, Inject(AGENT_OPTIONS)),
|
|
440
|
+
_ts_param(5, Optional()),
|
|
441
|
+
_ts_param(5, Inject(CONTEXT_ACCESSOR)),
|
|
392
442
|
_ts_metadata("design:type", Function),
|
|
393
443
|
_ts_metadata("design:paramtypes", [
|
|
394
444
|
typeof AgentGovernanceQueries === "undefined" ? Object : AgentGovernanceQueries,
|
|
395
445
|
typeof ActorDirectory === "undefined" ? Object : ActorDirectory,
|
|
396
446
|
typeof AgentPricingStore === "undefined" ? Object : AgentPricingStore,
|
|
397
|
-
typeof AgentApprovalPort === "undefined" ? Object : AgentApprovalPort
|
|
447
|
+
typeof AgentApprovalPort === "undefined" ? Object : AgentApprovalPort,
|
|
448
|
+
Object,
|
|
449
|
+
Object
|
|
398
450
|
])
|
|
399
451
|
], DashboardService);
|
|
400
452
|
|
|
@@ -2323,6 +2375,7 @@ export {
|
|
|
2323
2375
|
AGENT_CONSOLE_ID,
|
|
2324
2376
|
AGENT_DASHBOARD_CONFIG_ID,
|
|
2325
2377
|
AGENT_GOVERNANCE_QUERIES,
|
|
2378
|
+
AGENT_OPTIONS,
|
|
2326
2379
|
AGENT_PRICING_STORE,
|
|
2327
2380
|
AVIARY_CONSOLES_SLOT,
|
|
2328
2381
|
AgentApiController,
|
|
@@ -2336,6 +2389,7 @@ export {
|
|
|
2336
2389
|
CONSOLE_GATE,
|
|
2337
2390
|
CONSOLE_PAGE_METADATA,
|
|
2338
2391
|
CONSOLE_PROBE_TIMEOUT_MS,
|
|
2392
|
+
CONTEXT_ACCESSOR,
|
|
2339
2393
|
ConsoleAccessDenied,
|
|
2340
2394
|
ConsoleAuthorizeFilter,
|
|
2341
2395
|
ConsoleAuthorizeGuard,
|