@dudousxd/nestjs-agent-dashboard 0.5.0 → 0.6.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.
@@ -99,6 +99,36 @@ export interface RecentRunRow {
99
99
  errorMessage: string | null;
100
100
  retries: number;
101
101
  startedAt: string;
102
+ /** sha256 hex of the run's resolved (pre-RAG) system prompt; `null` for a run recorded before this shipped. */
103
+ promptHash: string | null;
104
+ }
105
+ /** One tool call awaiting a HITL decision, for the cross-thread approvals inbox. */
106
+ export interface PendingApprovalRow {
107
+ toolCallId: string;
108
+ toolName: string;
109
+ input: unknown;
110
+ threadId: string;
111
+ threadTitle: string;
112
+ /** Who asked — the run's actor. */
113
+ actorRef: string;
114
+ agentName: string | null;
115
+ /** ISO timestamp. */
116
+ requestedAt: string;
117
+ }
118
+ /** Body for `POST <api>/approvals/:toolCallId` — decide a pending HITL tool call. */
119
+ export interface ApprovalDecisionInput {
120
+ approved: boolean;
121
+ reason?: string;
122
+ }
123
+ /** Governance rollup for one tool over a range, for the Tools section. */
124
+ export interface ToolStatRow {
125
+ toolName: string;
126
+ toolType: string;
127
+ calls: number;
128
+ failed: number;
129
+ rejected: number;
130
+ /** p95 of executionMs across executed calls; null when none carry it. */
131
+ p95ExecutionMs: number | null;
102
132
  }
103
133
  /** The `GET <api>/reliability` response. */
104
134
  export interface ReliabilityOverview {
@@ -155,6 +185,16 @@ export declare const agentClient: {
155
185
  runs(limit?: number): Promise<RecentRunRow[]>;
156
186
  /** Most recent tool calls (default 50). */
157
187
  toolCalls(limit?: number): Promise<ToolCallActivityRow[]>;
188
+ /** Tool calls sitting `pending_approval`, oldest first (default 50) — the approvals inbox. */
189
+ approvals(limit?: number): Promise<PendingApprovalRow[]>;
190
+ /**
191
+ * Decide a pending HITL tool call. 501s (a plain `Error` whose message starts with `501`, like
192
+ * `upsertPrice` below) if the host has no `AGENT_APPROVAL_PORT` bound — the approvals inbox reads
193
+ * that as "render read-only".
194
+ */
195
+ decideApproval(toolCallId: string, input: ApprovalDecisionInput): Promise<void>;
196
+ /** Per-tool call/failure/rejection/latency rollup for a day range (the Tools section). */
197
+ toolStats(range: GovernanceRange): Promise<ToolStatRow[]>;
158
198
  /** Most recent threads (default 50). */
159
199
  threads(limit?: number): Promise<ThreadActivityRow[]>;
160
200
  /** Current price row per model. 501s if the host has no pricing store bound. */
@@ -1 +1 @@
1
- {"version":3,"file":"agent-client.d.ts","sourceRoot":"","sources":["../../src/client/agent-client.ts"],"names":[],"mappings":"AAIA,kDAAkD;AAClD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,uDAAuD;AACvD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,0EAA0E;AAC1E,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,0GAA0G;IAC1G,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,0GAA0G;IAC1G,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,+CAA+C;AAC/C,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MA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,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GAAG,MAAM,IAAI;CAWnE,CAAC"}
@@ -37,6 +37,29 @@ export const agentClient = {
37
37
  toolCalls(limit = 50) {
38
38
  return http(`/tool-calls?limit=${limit}`);
39
39
  },
40
+ /** Tool calls sitting `pending_approval`, oldest first (default 50) — the approvals inbox. */
41
+ approvals(limit = 50) {
42
+ return http(`/approvals?limit=${limit}`);
43
+ },
44
+ /**
45
+ * Decide a pending HITL tool call. 501s (a plain `Error` whose message starts with `501`, like
46
+ * `upsertPrice` below) if the host has no `AGENT_APPROVAL_PORT` bound — the approvals inbox reads
47
+ * that as "render read-only".
48
+ */
49
+ async decideApproval(toolCallId, input) {
50
+ const res = await fetch(`${apiBase()}/approvals/${encodeURIComponent(toolCallId)}`, {
51
+ method: 'POST',
52
+ headers: { 'Content-Type': 'application/json' },
53
+ body: JSON.stringify(input),
54
+ });
55
+ if (!res.ok)
56
+ throw new Error(`${res.status} ${res.statusText}`);
57
+ },
58
+ /** Per-tool call/failure/rejection/latency rollup for a day range (the Tools section). */
59
+ toolStats(range) {
60
+ const q = new URLSearchParams({ from: range.fromDay, to: range.toDay });
61
+ return http(`/tools?${q.toString()}`);
62
+ },
40
63
  /** Most recent threads (default 50). */
41
64
  threads(limit = 50) {
42
65
  return http(`/threads?limit=${limit}`);
@@ -1 +1 @@
1
- {"version":3,"file":"agent-client.js","sourceRoot":"","sources":["../../src/client/agent-client.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,uGAAuG;AACvG,gFAAgF;AAsKhF,SAAS,OAAO;IACd,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,aAAa;QAAE,OAAO,MAAM,CAAC,aAAa,CAAC;IACvF,MAAM,IAAI,GAAG,CAAC,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,IAAI,aAAa,CAAC;IACvF,OAAO,GAAG,IAAI,MAAM,CAAC;AACvB,CAAC;AAED,KAAK,U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AAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACF,CAAC"}
@@ -23,6 +23,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
23
23
  var index_exports = {};
24
24
  __export(index_exports, {
25
25
  AGENT_ACTOR_DIRECTORY: () => AGENT_ACTOR_DIRECTORY,
26
+ AGENT_APPROVAL_PORT: () => AGENT_APPROVAL_PORT,
26
27
  AGENT_GOVERNANCE_QUERIES: () => AGENT_GOVERNANCE_QUERIES,
27
28
  AGENT_PRICING_STORE: () => AGENT_PRICING_STORE,
28
29
  AgentApiController: () => AgentApiController,
@@ -30,6 +31,7 @@ __export(index_exports, {
30
31
  AgentDashboardModule: () => AgentDashboardModule,
31
32
  AgentUiController: () => AgentUiController,
32
33
  DASHBOARD_API_PATH: () => DASHBOARD_API_PATH,
34
+ DASHBOARD_APPROVAL_ACTOR_REF: () => DASHBOARD_APPROVAL_ACTOR_REF,
33
35
  DASHBOARD_BASE_PATH: () => DASHBOARD_BASE_PATH,
34
36
  DashboardService: () => DashboardService,
35
37
  agentDashboardMountPaths: () => agentDashboardMountPaths,
@@ -38,35 +40,57 @@ __export(index_exports, {
38
40
  module.exports = __toCommonJS(index_exports);
39
41
 
40
42
  // src/server/agent-api.controller.ts
41
- var import_common3 = require("@nestjs/common");
43
+ var import_common4 = require("@nestjs/common");
42
44
 
43
45
  // src/server/dashboard.service.ts
44
46
  var import_node_diagnostics_channel = require("diagnostics_channel");
45
47
  var import_nestjs_diagnostics = require("@dudousxd/nestjs-diagnostics");
46
- var import_common2 = require("@nestjs/common");
48
+ var import_common3 = require("@nestjs/common");
47
49
  var import_rxjs = require("rxjs");
48
50
 
49
- // src/server/parse-price-input.ts
51
+ // src/server/parse-approval-decision.ts
50
52
  var import_common = require("@nestjs/common");
51
- function parsePriceInput(body) {
53
+ function parseApprovalDecision(body) {
52
54
  if (typeof body !== "object" || body === null) {
53
55
  throw new import_common.BadRequestException("Expected a JSON object body.");
54
56
  }
57
+ const { approved, reason } = body;
58
+ if (typeof approved !== "boolean") {
59
+ throw new import_common.BadRequestException('"approved" must be a boolean.');
60
+ }
61
+ if (reason !== void 0 && typeof reason !== "string") {
62
+ throw new import_common.BadRequestException('"reason" must be a string when present.');
63
+ }
64
+ return {
65
+ approved,
66
+ ...reason !== void 0 ? {
67
+ reason
68
+ } : {}
69
+ };
70
+ }
71
+ __name(parseApprovalDecision, "parseApprovalDecision");
72
+
73
+ // src/server/parse-price-input.ts
74
+ var import_common2 = require("@nestjs/common");
75
+ function parsePriceInput(body) {
76
+ if (typeof body !== "object" || body === null) {
77
+ throw new import_common2.BadRequestException("Expected a JSON object body.");
78
+ }
55
79
  const { modelId, inputPricePer1m, outputPricePer1m, cacheWritePricePer1m, cacheReadPricePer1m } = body;
56
80
  if (typeof modelId !== "string" || modelId.trim().length === 0) {
57
- throw new import_common.BadRequestException('"modelId" must be a non-empty string.');
81
+ throw new import_common2.BadRequestException('"modelId" must be a non-empty string.');
58
82
  }
59
83
  if (!isFiniteNonNegative(inputPricePer1m)) {
60
- throw new import_common.BadRequestException('"inputPricePer1m" must be a non-negative number.');
84
+ throw new import_common2.BadRequestException('"inputPricePer1m" must be a non-negative number.');
61
85
  }
62
86
  if (!isFiniteNonNegative(outputPricePer1m)) {
63
- throw new import_common.BadRequestException('"outputPricePer1m" must be a non-negative number.');
87
+ throw new import_common2.BadRequestException('"outputPricePer1m" must be a non-negative number.');
64
88
  }
65
89
  if (cacheWritePricePer1m !== void 0 && !isFiniteNonNegative(cacheWritePricePer1m)) {
66
- throw new import_common.BadRequestException('"cacheWritePricePer1m" must be a non-negative number when present.');
90
+ throw new import_common2.BadRequestException('"cacheWritePricePer1m" must be a non-negative number when present.');
67
91
  }
68
92
  if (cacheReadPricePer1m !== void 0 && !isFiniteNonNegative(cacheReadPricePer1m)) {
69
- throw new import_common.BadRequestException('"cacheReadPricePer1m" must be a non-negative number when present.');
93
+ throw new import_common2.BadRequestException('"cacheReadPricePer1m" must be a non-negative number when present.');
70
94
  }
71
95
  return {
72
96
  modelId,
@@ -90,8 +114,10 @@ __name(isFiniteNonNegative, "isFiniteNonNegative");
90
114
  var AGENT_GOVERNANCE_QUERIES = Symbol.for("@dudousxd/nestjs-agent:governance-queries");
91
115
  var AGENT_ACTOR_DIRECTORY = Symbol.for("@dudousxd/nestjs-agent:actor-directory");
92
116
  var AGENT_PRICING_STORE = Symbol.for("@dudousxd/nestjs-agent:pricing-store");
117
+ var AGENT_APPROVAL_PORT = Symbol.for("@dudousxd/nestjs-agent:approval-port");
93
118
  var DASHBOARD_BASE_PATH = Symbol.for("@dudousxd/nestjs-agent-dashboard:base-path");
94
119
  var DASHBOARD_API_PATH = Symbol.for("@dudousxd/nestjs-agent-dashboard:api-path");
120
+ var DASHBOARD_APPROVAL_ACTOR_REF = Symbol.for("@dudousxd/nestjs-agent-dashboard:approval-actor-ref");
95
121
 
96
122
  // src/server/dashboard.service.ts
97
123
  function _ts_decorate(decorators, target, key, desc) {
@@ -112,6 +138,7 @@ function _ts_param(paramIndex, decorator) {
112
138
  }
113
139
  __name(_ts_param, "_ts_param");
114
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.";
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.";
115
142
  var AGENT_EVENTS = [
116
143
  "run.started",
117
144
  "message",
@@ -131,10 +158,12 @@ var DashboardService = class {
131
158
  queries;
132
159
  actorDirectory;
133
160
  pricingStore;
134
- constructor(queries, actorDirectory, pricingStore) {
161
+ approvalPort;
162
+ constructor(queries, actorDirectory, pricingStore, approvalPort) {
135
163
  this.queries = queries;
136
164
  this.actorDirectory = actorDirectory;
137
165
  this.pricingStore = pricingStore;
166
+ this.approvalPort = approvalPort;
138
167
  }
139
168
  /** Spend/usage overview for a day range: by-model + by-actor spend and the daily trend, in parallel. */
140
169
  async spend(range) {
@@ -178,6 +207,41 @@ var DashboardService = class {
178
207
  recentToolCalls(limit) {
179
208
  return this.queries.recentToolCalls(limit);
180
209
  }
210
+ /** Tool calls sitting `pending_approval`, oldest first, for the cross-thread approvals inbox. */
211
+ pendingApprovals(limit) {
212
+ return this.queries.pendingApprovals(limit);
213
+ }
214
+ /** Per-tool call/failure/rejection/latency rollup for a day range, for the Tools section. */
215
+ toolStats(range) {
216
+ return this.queries.toolStats(range);
217
+ }
218
+ /**
219
+ * Decide a pending HITL tool call from the console. Routes through the OPTIONAL
220
+ * {@link AGENT_APPROVAL_PORT} — bound by `@dudousxd/nestjs-agent` to the SAME signal path chat
221
+ * approvals use — so a 501 here (checked BEFORE body validation, same ordering as
222
+ * {@link upsertPrice}) means "no approval port bound", not "your body was invalid". `executedByRef`
223
+ * is an OPAQUE decider ref the caller resolved from the live request (see
224
+ * `AgentDashboardOptions.approvalActorRef`); omitted when the host didn't configure one.
225
+ */
226
+ async decideApproval(toolCallId, body, executedByRef) {
227
+ if (this.approvalPort === void 0) {
228
+ throw new import_common3.NotImplementedException(APPROVAL_PORT_UNBOUND_MESSAGE);
229
+ }
230
+ const decision = parseApprovalDecision(body);
231
+ const opts = executedByRef !== void 0 ? {
232
+ executedByRef
233
+ } : {};
234
+ if (decision.approved) {
235
+ await this.approvalPort.approve(toolCallId, opts);
236
+ return;
237
+ }
238
+ await this.approvalPort.reject(toolCallId, {
239
+ ...opts,
240
+ ...decision.reason !== void 0 ? {
241
+ reason: decision.reason
242
+ } : {}
243
+ });
244
+ }
181
245
  /** Most recent threads with rolled-up message/token counts. */
182
246
  async recentThreads(limit) {
183
247
  const rows = await this.queries.recentThreads(limit);
@@ -210,7 +274,7 @@ var DashboardService = class {
210
274
  /** Current price row per model, for the pricing tab. 501s when no `AGENT_PRICING_STORE` is bound. */
211
275
  async listPrices() {
212
276
  if (this.pricingStore === void 0) {
213
- throw new import_common2.NotImplementedException(PRICING_STORE_UNBOUND_MESSAGE);
277
+ throw new import_common3.NotImplementedException(PRICING_STORE_UNBOUND_MESSAGE);
214
278
  }
215
279
  return this.pricingStore.listCurrentPrices();
216
280
  }
@@ -221,7 +285,7 @@ var DashboardService = class {
221
285
  */
222
286
  async upsertPrice(body) {
223
287
  if (this.pricingStore === void 0) {
224
- throw new import_common2.NotImplementedException(PRICING_STORE_UNBOUND_MESSAGE);
288
+ throw new import_common3.NotImplementedException(PRICING_STORE_UNBOUND_MESSAGE);
225
289
  }
226
290
  await this.pricingStore.upsertModelPrice(parsePriceInput(body));
227
291
  }
@@ -257,17 +321,20 @@ var DashboardService = class {
257
321
  }
258
322
  };
259
323
  DashboardService = _ts_decorate([
260
- (0, import_common2.Injectable)(),
261
- _ts_param(0, (0, import_common2.Inject)(AGENT_GOVERNANCE_QUERIES)),
262
- _ts_param(1, (0, import_common2.Optional)()),
263
- _ts_param(1, (0, import_common2.Inject)(AGENT_ACTOR_DIRECTORY)),
264
- _ts_param(2, (0, import_common2.Optional)()),
265
- _ts_param(2, (0, import_common2.Inject)(AGENT_PRICING_STORE)),
324
+ (0, import_common3.Injectable)(),
325
+ _ts_param(0, (0, import_common3.Inject)(AGENT_GOVERNANCE_QUERIES)),
326
+ _ts_param(1, (0, import_common3.Optional)()),
327
+ _ts_param(1, (0, import_common3.Inject)(AGENT_ACTOR_DIRECTORY)),
328
+ _ts_param(2, (0, import_common3.Optional)()),
329
+ _ts_param(2, (0, import_common3.Inject)(AGENT_PRICING_STORE)),
330
+ _ts_param(3, (0, import_common3.Optional)()),
331
+ _ts_param(3, (0, import_common3.Inject)(AGENT_APPROVAL_PORT)),
266
332
  _ts_metadata("design:type", Function),
267
333
  _ts_metadata("design:paramtypes", [
268
334
  typeof AgentGovernanceQueries === "undefined" ? Object : AgentGovernanceQueries,
269
335
  typeof ActorDirectory === "undefined" ? Object : ActorDirectory,
270
- typeof AgentPricingStore === "undefined" ? Object : AgentPricingStore
336
+ typeof AgentPricingStore === "undefined" ? Object : AgentPricingStore,
337
+ typeof AgentApprovalPort === "undefined" ? Object : AgentApprovalPort
271
338
  ])
272
339
  ], DashboardService);
273
340
 
@@ -317,8 +384,10 @@ var AgentApiController = class {
317
384
  __name(this, "AgentApiController");
318
385
  }
319
386
  dashboard;
320
- constructor(dashboard) {
387
+ approvalActorRef;
388
+ constructor(dashboard, approvalActorRef) {
321
389
  this.dashboard = dashboard;
390
+ this.approvalActorRef = approvalActorRef;
322
391
  }
323
392
  /** `{ byModel, byActor, trend }` for a day range (defaults to the last 30 days). */
324
393
  spend(from, to) {
@@ -340,6 +409,22 @@ var AgentApiController = class {
340
409
  toolCalls(limit) {
341
410
  return this.dashboard.recentToolCalls(parseLimit(limit, 50));
342
411
  }
412
+ /** Tool calls sitting `pending_approval` (default 50, max 200), oldest first — the approvals inbox. */
413
+ approvals(limit) {
414
+ return this.dashboard.pendingApprovals(parseLimit(limit, 50));
415
+ }
416
+ /**
417
+ * Decide a pending HITL tool call. Body `{ approved: boolean; reason?: string }`. 501s (via
418
+ * `DashboardService.decideApproval`) when no `AGENT_APPROVAL_PORT` is bound. `executedByRef`
419
+ * comes from the host's `approvalActorRef` extractor run against the live request, when configured.
420
+ */
421
+ async decideApproval(toolCallId, body, req) {
422
+ await this.dashboard.decideApproval(toolCallId, body, this.approvalActorRef?.(req));
423
+ }
424
+ /** Per-tool call/failure/rejection/latency rollup for a day range (defaults to the last 30 days). */
425
+ tools(from, to) {
426
+ return this.dashboard.toolStats(resolveRange(from, to));
427
+ }
343
428
  /** Most recent threads (default 50, max 200) with rolled-up counts. */
344
429
  threads(limit) {
345
430
  return this.dashboard.recentThreads(parseLimit(limit, 50));
@@ -365,9 +450,9 @@ var AgentApiController = class {
365
450
  }
366
451
  };
367
452
  _ts_decorate2([
368
- (0, import_common3.Get)("spend"),
369
- _ts_param2(0, (0, import_common3.Query)("from")),
370
- _ts_param2(1, (0, import_common3.Query)("to")),
453
+ (0, import_common4.Get)("spend"),
454
+ _ts_param2(0, (0, import_common4.Query)("from")),
455
+ _ts_param2(1, (0, import_common4.Query)("to")),
371
456
  _ts_metadata2("design:type", Function),
372
457
  _ts_metadata2("design:paramtypes", [
373
458
  String,
@@ -376,10 +461,10 @@ _ts_decorate2([
376
461
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
377
462
  ], AgentApiController.prototype, "spend", null);
378
463
  _ts_decorate2([
379
- (0, import_common3.Get)("top-threads"),
380
- _ts_param2(0, (0, import_common3.Query)("from")),
381
- _ts_param2(1, (0, import_common3.Query)("to")),
382
- _ts_param2(2, (0, import_common3.Query)("limit")),
464
+ (0, import_common4.Get)("top-threads"),
465
+ _ts_param2(0, (0, import_common4.Query)("from")),
466
+ _ts_param2(1, (0, import_common4.Query)("to")),
467
+ _ts_param2(2, (0, import_common4.Query)("limit")),
383
468
  _ts_metadata2("design:type", Function),
384
469
  _ts_metadata2("design:paramtypes", [
385
470
  String,
@@ -389,9 +474,9 @@ _ts_decorate2([
389
474
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
390
475
  ], AgentApiController.prototype, "topThreads", null);
391
476
  _ts_decorate2([
392
- (0, import_common3.Get)("reliability"),
393
- _ts_param2(0, (0, import_common3.Query)("from")),
394
- _ts_param2(1, (0, import_common3.Query)("to")),
477
+ (0, import_common4.Get)("reliability"),
478
+ _ts_param2(0, (0, import_common4.Query)("from")),
479
+ _ts_param2(1, (0, import_common4.Query)("to")),
395
480
  _ts_metadata2("design:type", Function),
396
481
  _ts_metadata2("design:paramtypes", [
397
482
  String,
@@ -400,8 +485,8 @@ _ts_decorate2([
400
485
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
401
486
  ], AgentApiController.prototype, "reliability", null);
402
487
  _ts_decorate2([
403
- (0, import_common3.Get)("runs"),
404
- _ts_param2(0, (0, import_common3.Query)("limit")),
488
+ (0, import_common4.Get)("runs"),
489
+ _ts_param2(0, (0, import_common4.Query)("limit")),
405
490
  _ts_metadata2("design:type", Function),
406
491
  _ts_metadata2("design:paramtypes", [
407
492
  String
@@ -409,8 +494,8 @@ _ts_decorate2([
409
494
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
410
495
  ], AgentApiController.prototype, "runs", null);
411
496
  _ts_decorate2([
412
- (0, import_common3.Get)("tool-calls"),
413
- _ts_param2(0, (0, import_common3.Query)("limit")),
497
+ (0, import_common4.Get)("tool-calls"),
498
+ _ts_param2(0, (0, import_common4.Query)("limit")),
414
499
  _ts_metadata2("design:type", Function),
415
500
  _ts_metadata2("design:paramtypes", [
416
501
  String
@@ -418,8 +503,42 @@ _ts_decorate2([
418
503
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
419
504
  ], AgentApiController.prototype, "toolCalls", null);
420
505
  _ts_decorate2([
421
- (0, import_common3.Get)("threads"),
422
- _ts_param2(0, (0, import_common3.Query)("limit")),
506
+ (0, import_common4.Get)("approvals"),
507
+ _ts_param2(0, (0, import_common4.Query)("limit")),
508
+ _ts_metadata2("design:type", Function),
509
+ _ts_metadata2("design:paramtypes", [
510
+ String
511
+ ]),
512
+ _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
513
+ ], AgentApiController.prototype, "approvals", null);
514
+ _ts_decorate2([
515
+ (0, import_common4.Post)("approvals/:toolCallId"),
516
+ (0, import_common4.HttpCode)(204),
517
+ _ts_param2(0, (0, import_common4.Param)("toolCallId")),
518
+ _ts_param2(1, (0, import_common4.Body)()),
519
+ _ts_param2(2, (0, import_common4.Req)()),
520
+ _ts_metadata2("design:type", Function),
521
+ _ts_metadata2("design:paramtypes", [
522
+ String,
523
+ Object,
524
+ Object
525
+ ]),
526
+ _ts_metadata2("design:returntype", Promise)
527
+ ], AgentApiController.prototype, "decideApproval", null);
528
+ _ts_decorate2([
529
+ (0, import_common4.Get)("tools"),
530
+ _ts_param2(0, (0, import_common4.Query)("from")),
531
+ _ts_param2(1, (0, import_common4.Query)("to")),
532
+ _ts_metadata2("design:type", Function),
533
+ _ts_metadata2("design:paramtypes", [
534
+ String,
535
+ String
536
+ ]),
537
+ _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
538
+ ], AgentApiController.prototype, "tools", null);
539
+ _ts_decorate2([
540
+ (0, import_common4.Get)("threads"),
541
+ _ts_param2(0, (0, import_common4.Query)("limit")),
423
542
  _ts_metadata2("design:type", Function),
424
543
  _ts_metadata2("design:paramtypes", [
425
544
  String
@@ -427,14 +546,14 @@ _ts_decorate2([
427
546
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
428
547
  ], AgentApiController.prototype, "threads", null);
429
548
  _ts_decorate2([
430
- (0, import_common3.Get)("pricing"),
549
+ (0, import_common4.Get)("pricing"),
431
550
  _ts_metadata2("design:type", Function),
432
551
  _ts_metadata2("design:paramtypes", []),
433
552
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
434
553
  ], AgentApiController.prototype, "listPrices", null);
435
554
  _ts_decorate2([
436
- (0, import_common3.Post)("pricing"),
437
- _ts_param2(0, (0, import_common3.Body)()),
555
+ (0, import_common4.Post)("pricing"),
556
+ _ts_param2(0, (0, import_common4.Body)()),
438
557
  _ts_metadata2("design:type", Function),
439
558
  _ts_metadata2("design:paramtypes", [
440
559
  Object
@@ -442,16 +561,18 @@ _ts_decorate2([
442
561
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
443
562
  ], AgentApiController.prototype, "upsertPrice", null);
444
563
  _ts_decorate2([
445
- (0, import_common3.Sse)("stream"),
564
+ (0, import_common4.Sse)("stream"),
446
565
  _ts_metadata2("design:type", Function),
447
566
  _ts_metadata2("design:paramtypes", []),
448
567
  _ts_metadata2("design:returntype", typeof Observable === "undefined" ? Object : Observable)
449
568
  ], AgentApiController.prototype, "stream", null);
450
569
  AgentApiController = _ts_decorate2([
451
- (0, import_common3.Controller)(),
570
+ (0, import_common4.Controller)(),
571
+ _ts_param2(1, (0, import_common4.Inject)(DASHBOARD_APPROVAL_ACTOR_REF)),
452
572
  _ts_metadata2("design:type", Function),
453
573
  _ts_metadata2("design:paramtypes", [
454
- typeof DashboardService === "undefined" ? Object : DashboardService
574
+ typeof DashboardService === "undefined" ? Object : DashboardService,
575
+ Object
455
576
  ])
456
577
  ], AgentApiController);
457
578
 
@@ -482,14 +603,14 @@ __name(agentDashboardMountPaths, "agentDashboardMountPaths");
482
603
 
483
604
  // src/server/agent-dashboard.module.ts
484
605
  var import_reflect_metadata = require("reflect-metadata");
485
- var import_common5 = require("@nestjs/common");
606
+ var import_common6 = require("@nestjs/common");
486
607
  var import_core = require("@nestjs/core");
487
608
 
488
609
  // src/server/agent-ui.controller.ts
489
610
  var import_node_fs = require("fs");
490
611
  var import_node_path = require("path");
491
612
  var import_node_url = require("url");
492
- var import_common4 = require("@nestjs/common");
613
+ var import_common5 = require("@nestjs/common");
493
614
  function _ts_decorate3(decorators, target, key, desc) {
494
615
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
495
616
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -537,7 +658,7 @@ var AgentUiController = class {
537
658
  index() {
538
659
  const indexPath = (0, import_node_path.join)(this.dir, "index.html");
539
660
  if (!(0, import_node_fs.existsSync)(indexPath)) {
540
- throw new import_common4.NotFoundException("Dashboard is not built. Run the package build.");
661
+ throw new import_common5.NotFoundException("Dashboard is not built. Run the package build.");
541
662
  }
542
663
  const html = (0, import_node_fs.readFileSync)(indexPath, "utf8").replaceAll(`="${BUILD_BASE}/`, `="${this.basePath}/`);
543
664
  const inject = `<script>window.__AGENT_BASE__='${this.basePath}';window.__AGENT_API__='${this.apiBasePath}';</script>`;
@@ -545,40 +666,40 @@ var AgentUiController = class {
545
666
  }
546
667
  asset(file) {
547
668
  const safe = (0, import_node_path.basename)(file);
548
- if (safe !== file) throw new import_common4.NotFoundException();
669
+ if (safe !== file) throw new import_common5.NotFoundException();
549
670
  const root = (0, import_node_path.resolve)(this.dir, "assets");
550
671
  const assetPath = (0, import_node_path.resolve)(root, safe);
551
672
  if (!assetPath.startsWith(root + import_node_path.sep) || !(0, import_node_fs.existsSync)(assetPath)) {
552
- throw new import_common4.NotFoundException();
673
+ throw new import_common5.NotFoundException();
553
674
  }
554
675
  const type = CONTENT_TYPES[(0, import_node_path.extname)(safe)] ?? "application/octet-stream";
555
- return new import_common4.StreamableFile((0, import_node_fs.readFileSync)(assetPath), {
676
+ return new import_common5.StreamableFile((0, import_node_fs.readFileSync)(assetPath), {
556
677
  type
557
678
  });
558
679
  }
559
680
  };
560
681
  _ts_decorate3([
561
- (0, import_common4.Get)(),
562
- (0, import_common4.Header)("Content-Type", "text/html; charset=utf-8"),
563
- (0, import_common4.Header)("Cache-Control", "no-store, must-revalidate"),
682
+ (0, import_common5.Get)(),
683
+ (0, import_common5.Header)("Content-Type", "text/html; charset=utf-8"),
684
+ (0, import_common5.Header)("Cache-Control", "no-store, must-revalidate"),
564
685
  _ts_metadata3("design:type", Function),
565
686
  _ts_metadata3("design:paramtypes", []),
566
687
  _ts_metadata3("design:returntype", String)
567
688
  ], AgentUiController.prototype, "index", null);
568
689
  _ts_decorate3([
569
- (0, import_common4.Get)("assets/:file"),
570
- (0, import_common4.Header)("Cache-Control", "public, max-age=31536000, immutable"),
571
- _ts_param3(0, (0, import_common4.Param)("file")),
690
+ (0, import_common5.Get)("assets/:file"),
691
+ (0, import_common5.Header)("Cache-Control", "public, max-age=31536000, immutable"),
692
+ _ts_param3(0, (0, import_common5.Param)("file")),
572
693
  _ts_metadata3("design:type", Function),
573
694
  _ts_metadata3("design:paramtypes", [
574
695
  String
575
696
  ]),
576
- _ts_metadata3("design:returntype", typeof import_common4.StreamableFile === "undefined" ? Object : import_common4.StreamableFile)
697
+ _ts_metadata3("design:returntype", typeof import_common5.StreamableFile === "undefined" ? Object : import_common5.StreamableFile)
577
698
  ], AgentUiController.prototype, "asset", null);
578
699
  AgentUiController = _ts_decorate3([
579
- (0, import_common4.Controller)(),
580
- _ts_param3(0, (0, import_common4.Inject)(DASHBOARD_BASE_PATH)),
581
- _ts_param3(1, (0, import_common4.Inject)(DASHBOARD_API_PATH)),
700
+ (0, import_common5.Controller)(),
701
+ _ts_param3(0, (0, import_common5.Inject)(DASHBOARD_BASE_PATH)),
702
+ _ts_param3(1, (0, import_common5.Inject)(DASHBOARD_API_PATH)),
582
703
  _ts_metadata3("design:type", Function),
583
704
  _ts_metadata3("design:paramtypes", [
584
705
  String,
@@ -620,7 +741,13 @@ var AgentApiModule = class _AgentApiModule {
620
741
  ],
621
742
  providers: [
622
743
  DashboardService,
623
- ...options.guards ?? []
744
+ ...options.guards ?? [],
745
+ // `useValue` even when `options.approvalActorRef` is `undefined` — AgentApiController
746
+ // injects this WITHOUT `@Optional()` (same pattern as `AGENT_QUOTA_STORE`'s factory).
747
+ {
748
+ provide: DASHBOARD_APPROVAL_ACTOR_REF,
749
+ useValue: options.approvalActorRef
750
+ }
624
751
  ],
625
752
  exports: [
626
753
  DashboardService
@@ -629,7 +756,7 @@ var AgentApiModule = class _AgentApiModule {
629
756
  }
630
757
  };
631
758
  AgentApiModule = _ts_decorate4([
632
- (0, import_common5.Module)({})
759
+ (0, import_common6.Module)({})
633
760
  ], AgentApiModule);
634
761
  var AgentDashboardModule = class _AgentDashboardModule {
635
762
  static {
@@ -652,6 +779,9 @@ var AgentDashboardModule = class _AgentDashboardModule {
652
779
  } : {},
653
780
  ...options.guards ? {
654
781
  guards: options.guards
782
+ } : {},
783
+ ...options.approvalActorRef ? {
784
+ approvalActorRef: options.approvalActorRef
655
785
  } : {}
656
786
  }),
657
787
  import_core.RouterModule.register([
@@ -688,11 +818,12 @@ var AgentDashboardModule = class _AgentDashboardModule {
688
818
  }
689
819
  };
690
820
  AgentDashboardModule = _ts_decorate4([
691
- (0, import_common5.Module)({})
821
+ (0, import_common6.Module)({})
692
822
  ], AgentDashboardModule);
693
823
  // Annotate the CommonJS export names for ESM import in node:
694
824
  0 && (module.exports = {
695
825
  AGENT_ACTOR_DIRECTORY,
826
+ AGENT_APPROVAL_PORT,
696
827
  AGENT_GOVERNANCE_QUERIES,
697
828
  AGENT_PRICING_STORE,
698
829
  AgentApiController,
@@ -700,6 +831,7 @@ AgentDashboardModule = _ts_decorate4([
700
831
  AgentDashboardModule,
701
832
  AgentUiController,
702
833
  DASHBOARD_API_PATH,
834
+ DASHBOARD_APPROVAL_ACTOR_REF,
703
835
  DASHBOARD_BASE_PATH,
704
836
  DashboardService,
705
837
  agentDashboardMountPaths,