@dudousxd/nestjs-agent-dashboard 0.6.0 → 0.8.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.
@@ -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_ACTOR_RESOLVER: () => AGENT_ACTOR_RESOLVER,
26
27
  AGENT_APPROVAL_PORT: () => AGENT_APPROVAL_PORT,
27
28
  AGENT_GOVERNANCE_QUERIES: () => AGENT_GOVERNANCE_QUERIES,
28
29
  AGENT_PRICING_STORE: () => AGENT_PRICING_STORE,
@@ -40,7 +41,7 @@ __export(index_exports, {
40
41
  module.exports = __toCommonJS(index_exports);
41
42
 
42
43
  // src/server/agent-api.controller.ts
43
- var import_common4 = require("@nestjs/common");
44
+ var import_common5 = require("@nestjs/common");
44
45
 
45
46
  // src/server/dashboard.service.ts
46
47
  var import_node_diagnostics_channel = require("diagnostics_channel");
@@ -115,6 +116,7 @@ var AGENT_GOVERNANCE_QUERIES = Symbol.for("@dudousxd/nestjs-agent:governance-que
115
116
  var AGENT_ACTOR_DIRECTORY = Symbol.for("@dudousxd/nestjs-agent:actor-directory");
116
117
  var AGENT_PRICING_STORE = Symbol.for("@dudousxd/nestjs-agent:pricing-store");
117
118
  var AGENT_APPROVAL_PORT = Symbol.for("@dudousxd/nestjs-agent:approval-port");
119
+ var AGENT_ACTOR_RESOLVER = Symbol.for("@dudousxd/nestjs-agent:actor-resolver");
118
120
  var DASHBOARD_BASE_PATH = Symbol.for("@dudousxd/nestjs-agent-dashboard:base-path");
119
121
  var DASHBOARD_API_PATH = Symbol.for("@dudousxd/nestjs-agent-dashboard:api-path");
120
122
  var DASHBOARD_APPROVAL_ACTOR_REF = Symbol.for("@dudousxd/nestjs-agent-dashboard:approval-actor-ref");
@@ -207,6 +209,14 @@ var DashboardService = class {
207
209
  recentToolCalls(limit) {
208
210
  return this.queries.recentToolCalls(limit);
209
211
  }
212
+ /** Paged, filterable tool calls for the Runs & tools activity table. */
213
+ toolCallsPage(query) {
214
+ return this.queries.toolCallsPage(query);
215
+ }
216
+ /** Paged, filterable runs for the Reliability recent-runs table. */
217
+ runsPage(query) {
218
+ return this.queries.runsPage(query);
219
+ }
210
220
  /** Tool calls sitting `pending_approval`, oldest first, for the cross-thread approvals inbox. */
211
221
  pendingApprovals(limit) {
212
222
  return this.queries.pendingApprovals(limit);
@@ -248,6 +258,18 @@ var DashboardService = class {
248
258
  return this.withActorLabels(rows);
249
259
  }
250
260
  /**
261
+ * Paged, filterable threads for the Runs & tools threads table — actor-labeled the same way
262
+ * {@link recentThreads} is.
263
+ */
264
+ async threadsPage(query) {
265
+ const page = await this.queries.threadsPage(query);
266
+ const rows = await this.withActorLabels(page.rows);
267
+ return {
268
+ ...page,
269
+ rows
270
+ };
271
+ }
272
+ /**
251
273
  * Decorate actor-scoped rows with `actorLabel`, batching the distinct `actorRef`s into ONE
252
274
  * {@link ActorDirectory.resolveDisplay} call per response. `null` for every row when no directory
253
275
  * is bound, or for a ref the directory didn't resolve.
@@ -338,6 +360,127 @@ DashboardService = _ts_decorate([
338
360
  ])
339
361
  ], DashboardService);
340
362
 
363
+ // src/server/parse-page-query.ts
364
+ var import_common4 = require("@nestjs/common");
365
+ var ISO_DAY = /^\d{4}-\d{2}-\d{2}$/;
366
+ function parsePageNumber(value) {
367
+ const parsed = value === void 0 ? Number.NaN : Number.parseInt(value, 10);
368
+ if (!Number.isFinite(parsed) || parsed < 1) return 1;
369
+ return parsed;
370
+ }
371
+ __name(parsePageNumber, "parsePageNumber");
372
+ function assertKnownFields(raw, allowed) {
373
+ for (const field of Object.keys(raw)) {
374
+ if (!allowed.includes(field)) {
375
+ throw new import_common4.BadRequestException(`Unknown where field "${field}".`);
376
+ }
377
+ }
378
+ }
379
+ __name(assertKnownFields, "assertKnownFields");
380
+ function assertDayFields(raw, dayFields) {
381
+ for (const field of dayFields) {
382
+ const value = raw[field];
383
+ if (value !== void 0 && !ISO_DAY.test(value)) {
384
+ throw new import_common4.BadRequestException(`"where[${field}]" must be YYYY-MM-DD.`);
385
+ }
386
+ }
387
+ }
388
+ __name(assertDayFields, "assertDayFields");
389
+ var DAY_FIELDS = [
390
+ "fromDay",
391
+ "toDay"
392
+ ];
393
+ var TOOL_CALL_WHERE_FIELDS = [
394
+ "toolName",
395
+ "toolType",
396
+ "status",
397
+ "threadId",
398
+ "fromDay",
399
+ "toDay"
400
+ ];
401
+ function parseToolCallWhere(raw) {
402
+ if (raw === void 0 || Object.keys(raw).length === 0) return void 0;
403
+ assertKnownFields(raw, TOOL_CALL_WHERE_FIELDS);
404
+ assertDayFields(raw, DAY_FIELDS);
405
+ return {
406
+ ...raw.toolName !== void 0 ? {
407
+ toolName: raw.toolName
408
+ } : {},
409
+ ...raw.toolType !== void 0 ? {
410
+ toolType: raw.toolType
411
+ } : {},
412
+ ...raw.status !== void 0 ? {
413
+ status: raw.status
414
+ } : {},
415
+ ...raw.threadId !== void 0 ? {
416
+ threadId: raw.threadId
417
+ } : {},
418
+ ...raw.fromDay !== void 0 ? {
419
+ fromDay: raw.fromDay
420
+ } : {},
421
+ ...raw.toDay !== void 0 ? {
422
+ toDay: raw.toDay
423
+ } : {}
424
+ };
425
+ }
426
+ __name(parseToolCallWhere, "parseToolCallWhere");
427
+ var THREAD_WHERE_FIELDS = [
428
+ "actorRef",
429
+ "title",
430
+ "fromDay",
431
+ "toDay"
432
+ ];
433
+ function parseThreadWhere(raw) {
434
+ if (raw === void 0 || Object.keys(raw).length === 0) return void 0;
435
+ assertKnownFields(raw, THREAD_WHERE_FIELDS);
436
+ assertDayFields(raw, DAY_FIELDS);
437
+ return {
438
+ ...raw.actorRef !== void 0 ? {
439
+ actorRef: raw.actorRef
440
+ } : {},
441
+ ...raw.title !== void 0 ? {
442
+ title: raw.title
443
+ } : {},
444
+ ...raw.fromDay !== void 0 ? {
445
+ fromDay: raw.fromDay
446
+ } : {},
447
+ ...raw.toDay !== void 0 ? {
448
+ toDay: raw.toDay
449
+ } : {}
450
+ };
451
+ }
452
+ __name(parseThreadWhere, "parseThreadWhere");
453
+ var RUN_WHERE_FIELDS = [
454
+ "agentName",
455
+ "status",
456
+ "errorCode",
457
+ "fromDay",
458
+ "toDay"
459
+ ];
460
+ function parseRunWhere(raw) {
461
+ if (raw === void 0 || Object.keys(raw).length === 0) return void 0;
462
+ assertKnownFields(raw, RUN_WHERE_FIELDS);
463
+ assertDayFields(raw, DAY_FIELDS);
464
+ return {
465
+ ...raw.agentName !== void 0 ? {
466
+ agentName: raw.agentName
467
+ } : {},
468
+ ...raw.status !== void 0 ? {
469
+ status: raw.status
470
+ } : {},
471
+ ...raw.errorCode !== void 0 ? {
472
+ errorCode: raw.errorCode
473
+ } : {},
474
+ ...raw.fromDay !== void 0 ? {
475
+ fromDay: raw.fromDay
476
+ } : {},
477
+ ...raw.toDay !== void 0 ? {
478
+ toDay: raw.toDay
479
+ } : {}
480
+ };
481
+ }
482
+ __name(parseRunWhere, "parseRunWhere");
483
+
341
484
  // src/server/agent-api.controller.ts
342
485
  function _ts_decorate2(decorators, target, key, desc) {
343
486
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -357,13 +500,13 @@ function _ts_param2(paramIndex, decorator) {
357
500
  }
358
501
  __name(_ts_param2, "_ts_param");
359
502
  var DAY_MS = 864e5;
360
- var ISO_DAY = /^\d{4}-\d{2}-\d{2}$/;
503
+ var ISO_DAY2 = /^\d{4}-\d{2}-\d{2}$/;
361
504
  function utcDay(daysAgo) {
362
505
  return new Date(Date.now() - daysAgo * DAY_MS).toISOString().slice(0, 10);
363
506
  }
364
507
  __name(utcDay, "utcDay");
365
508
  function dayOr(value, fallback) {
366
- return value !== void 0 && ISO_DAY.test(value) ? value : fallback;
509
+ return value !== void 0 && ISO_DAY2.test(value) ? value : fallback;
367
510
  }
368
511
  __name(dayOr, "dayOr");
369
512
  function resolveRange(from, to) {
@@ -385,9 +528,11 @@ var AgentApiController = class {
385
528
  }
386
529
  dashboard;
387
530
  approvalActorRef;
388
- constructor(dashboard, approvalActorRef) {
531
+ actorResolver;
532
+ constructor(dashboard, approvalActorRef, actorResolver) {
389
533
  this.dashboard = dashboard;
390
534
  this.approvalActorRef = approvalActorRef;
535
+ this.actorResolver = actorResolver;
391
536
  }
392
537
  /** `{ byModel, byActor, trend }` for a day range (defaults to the last 30 days). */
393
538
  spend(from, to) {
@@ -405,10 +550,40 @@ var AgentApiController = class {
405
550
  runs(limit) {
406
551
  return this.dashboard.recentRuns(parseLimit(limit, 50));
407
552
  }
553
+ /**
554
+ * Paged, filterable runs for the Reliability recent-runs table. `page` (default 1), `limit`
555
+ * (default 25, max 200), and `where[agentName]`/`where[status]`/`where[errorCode]`/
556
+ * `where[fromDay]`/`where[toDay]` (`YYYY-MM-DD`) — an unknown `where` field 400s naming it.
557
+ */
558
+ runsPage(page, limit, where) {
559
+ const parsedWhere = parseRunWhere(where);
560
+ return this.dashboard.runsPage({
561
+ page: parsePageNumber(page),
562
+ pageSize: parseLimit(limit, 25),
563
+ ...parsedWhere !== void 0 ? {
564
+ where: parsedWhere
565
+ } : {}
566
+ });
567
+ }
408
568
  /** Most recent tool calls (default 50, max 200) for the activity feed. */
409
569
  toolCalls(limit) {
410
570
  return this.dashboard.recentToolCalls(parseLimit(limit, 50));
411
571
  }
572
+ /**
573
+ * Paged, filterable tool calls for the Runs & tools activity table. `page` (default 1), `limit`
574
+ * (default 25, max 200), and `where[toolName]`/`where[toolType]`/`where[status]`/`where[threadId]`/
575
+ * `where[fromDay]`/`where[toDay]` (`YYYY-MM-DD`) — an unknown `where` field 400s naming it.
576
+ */
577
+ toolCallsPage(page, limit, where) {
578
+ const parsedWhere = parseToolCallWhere(where);
579
+ return this.dashboard.toolCallsPage({
580
+ page: parsePageNumber(page),
581
+ pageSize: parseLimit(limit, 25),
582
+ ...parsedWhere !== void 0 ? {
583
+ where: parsedWhere
584
+ } : {}
585
+ });
586
+ }
412
587
  /** Tool calls sitting `pending_approval` (default 50, max 200), oldest first — the approvals inbox. */
413
588
  approvals(limit) {
414
589
  return this.dashboard.pendingApprovals(parseLimit(limit, 50));
@@ -416,10 +591,30 @@ var AgentApiController = class {
416
591
  /**
417
592
  * Decide a pending HITL tool call. Body `{ approved: boolean; reason?: string }`. 501s (via
418
593
  * `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.
594
+ * comes from {@link deciderRef} run against the live request.
420
595
  */
421
596
  async decideApproval(toolCallId, body, req) {
422
- await this.dashboard.decideApproval(toolCallId, body, this.approvalActorRef?.(req));
597
+ await this.dashboard.decideApproval(toolCallId, body, await this.deciderRef(req));
598
+ }
599
+ /**
600
+ * WHO decided, as an opaque ref: an explicit `approvalActorRef` override wins outright (no
601
+ * resolver fallback, even when it returns `undefined`); otherwise the AgentModule-configured
602
+ * actor resolver — the same identity seam chat requests use. A resolver that throws is an
603
+ * unauthenticated/unreadable request, not an error to surface: the decision itself was already
604
+ * authorized by the dashboard's guards, so the ref is simply omitted.
605
+ */
606
+ async deciderRef(req) {
607
+ if (this.approvalActorRef !== void 0) {
608
+ return this.approvalActorRef(req);
609
+ }
610
+ if (this.actorResolver === void 0) {
611
+ return void 0;
612
+ }
613
+ try {
614
+ return (await this.actorResolver.resolve(req)).id;
615
+ } catch {
616
+ return void 0;
617
+ }
423
618
  }
424
619
  /** Per-tool call/failure/rejection/latency rollup for a day range (defaults to the last 30 days). */
425
620
  tools(from, to) {
@@ -430,6 +625,21 @@ var AgentApiController = class {
430
625
  return this.dashboard.recentThreads(parseLimit(limit, 50));
431
626
  }
432
627
  /**
628
+ * Paged, filterable threads for the Runs & tools threads table. `page` (default 1), `limit`
629
+ * (default 25, max 200), and `where[actorRef]`/`where[title]` (case-insensitive substring)/
630
+ * `where[fromDay]`/`where[toDay]` (`YYYY-MM-DD`) — an unknown `where` field 400s naming it.
631
+ */
632
+ threadsPage(page, limit, where) {
633
+ const parsedWhere = parseThreadWhere(where);
634
+ return this.dashboard.threadsPage({
635
+ page: parsePageNumber(page),
636
+ pageSize: parseLimit(limit, 25),
637
+ ...parsedWhere !== void 0 ? {
638
+ where: parsedWhere
639
+ } : {}
640
+ });
641
+ }
642
+ /**
433
643
  * Current price row per model, for the pricing tab. 501s (via `DashboardService.listPrices`) when
434
644
  * no `AGENT_PRICING_STORE` is bound.
435
645
  */
@@ -450,9 +660,9 @@ var AgentApiController = class {
450
660
  }
451
661
  };
452
662
  _ts_decorate2([
453
- (0, import_common4.Get)("spend"),
454
- _ts_param2(0, (0, import_common4.Query)("from")),
455
- _ts_param2(1, (0, import_common4.Query)("to")),
663
+ (0, import_common5.Get)("spend"),
664
+ _ts_param2(0, (0, import_common5.Query)("from")),
665
+ _ts_param2(1, (0, import_common5.Query)("to")),
456
666
  _ts_metadata2("design:type", Function),
457
667
  _ts_metadata2("design:paramtypes", [
458
668
  String,
@@ -461,10 +671,10 @@ _ts_decorate2([
461
671
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
462
672
  ], AgentApiController.prototype, "spend", null);
463
673
  _ts_decorate2([
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")),
674
+ (0, import_common5.Get)("top-threads"),
675
+ _ts_param2(0, (0, import_common5.Query)("from")),
676
+ _ts_param2(1, (0, import_common5.Query)("to")),
677
+ _ts_param2(2, (0, import_common5.Query)("limit")),
468
678
  _ts_metadata2("design:type", Function),
469
679
  _ts_metadata2("design:paramtypes", [
470
680
  String,
@@ -474,9 +684,9 @@ _ts_decorate2([
474
684
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
475
685
  ], AgentApiController.prototype, "topThreads", null);
476
686
  _ts_decorate2([
477
- (0, import_common4.Get)("reliability"),
478
- _ts_param2(0, (0, import_common4.Query)("from")),
479
- _ts_param2(1, (0, import_common4.Query)("to")),
687
+ (0, import_common5.Get)("reliability"),
688
+ _ts_param2(0, (0, import_common5.Query)("from")),
689
+ _ts_param2(1, (0, import_common5.Query)("to")),
480
690
  _ts_metadata2("design:type", Function),
481
691
  _ts_metadata2("design:paramtypes", [
482
692
  String,
@@ -485,8 +695,8 @@ _ts_decorate2([
485
695
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
486
696
  ], AgentApiController.prototype, "reliability", null);
487
697
  _ts_decorate2([
488
- (0, import_common4.Get)("runs"),
489
- _ts_param2(0, (0, import_common4.Query)("limit")),
698
+ (0, import_common5.Get)("runs"),
699
+ _ts_param2(0, (0, import_common5.Query)("limit")),
490
700
  _ts_metadata2("design:type", Function),
491
701
  _ts_metadata2("design:paramtypes", [
492
702
  String
@@ -494,8 +704,21 @@ _ts_decorate2([
494
704
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
495
705
  ], AgentApiController.prototype, "runs", null);
496
706
  _ts_decorate2([
497
- (0, import_common4.Get)("tool-calls"),
498
- _ts_param2(0, (0, import_common4.Query)("limit")),
707
+ (0, import_common5.Get)("runs-page"),
708
+ _ts_param2(0, (0, import_common5.Query)("page")),
709
+ _ts_param2(1, (0, import_common5.Query)("limit")),
710
+ _ts_param2(2, (0, import_common5.Query)("where")),
711
+ _ts_metadata2("design:type", Function),
712
+ _ts_metadata2("design:paramtypes", [
713
+ String,
714
+ String,
715
+ typeof Record === "undefined" ? Object : Record
716
+ ]),
717
+ _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
718
+ ], AgentApiController.prototype, "runsPage", null);
719
+ _ts_decorate2([
720
+ (0, import_common5.Get)("tool-calls"),
721
+ _ts_param2(0, (0, import_common5.Query)("limit")),
499
722
  _ts_metadata2("design:type", Function),
500
723
  _ts_metadata2("design:paramtypes", [
501
724
  String
@@ -503,8 +726,21 @@ _ts_decorate2([
503
726
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
504
727
  ], AgentApiController.prototype, "toolCalls", null);
505
728
  _ts_decorate2([
506
- (0, import_common4.Get)("approvals"),
507
- _ts_param2(0, (0, import_common4.Query)("limit")),
729
+ (0, import_common5.Get)("tool-calls-page"),
730
+ _ts_param2(0, (0, import_common5.Query)("page")),
731
+ _ts_param2(1, (0, import_common5.Query)("limit")),
732
+ _ts_param2(2, (0, import_common5.Query)("where")),
733
+ _ts_metadata2("design:type", Function),
734
+ _ts_metadata2("design:paramtypes", [
735
+ String,
736
+ String,
737
+ typeof Record === "undefined" ? Object : Record
738
+ ]),
739
+ _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
740
+ ], AgentApiController.prototype, "toolCallsPage", null);
741
+ _ts_decorate2([
742
+ (0, import_common5.Get)("approvals"),
743
+ _ts_param2(0, (0, import_common5.Query)("limit")),
508
744
  _ts_metadata2("design:type", Function),
509
745
  _ts_metadata2("design:paramtypes", [
510
746
  String
@@ -512,11 +748,11 @@ _ts_decorate2([
512
748
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
513
749
  ], AgentApiController.prototype, "approvals", null);
514
750
  _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)()),
751
+ (0, import_common5.Post)("approvals/:toolCallId"),
752
+ (0, import_common5.HttpCode)(204),
753
+ _ts_param2(0, (0, import_common5.Param)("toolCallId")),
754
+ _ts_param2(1, (0, import_common5.Body)()),
755
+ _ts_param2(2, (0, import_common5.Req)()),
520
756
  _ts_metadata2("design:type", Function),
521
757
  _ts_metadata2("design:paramtypes", [
522
758
  String,
@@ -526,9 +762,9 @@ _ts_decorate2([
526
762
  _ts_metadata2("design:returntype", Promise)
527
763
  ], AgentApiController.prototype, "decideApproval", null);
528
764
  _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")),
765
+ (0, import_common5.Get)("tools"),
766
+ _ts_param2(0, (0, import_common5.Query)("from")),
767
+ _ts_param2(1, (0, import_common5.Query)("to")),
532
768
  _ts_metadata2("design:type", Function),
533
769
  _ts_metadata2("design:paramtypes", [
534
770
  String,
@@ -537,8 +773,8 @@ _ts_decorate2([
537
773
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
538
774
  ], AgentApiController.prototype, "tools", null);
539
775
  _ts_decorate2([
540
- (0, import_common4.Get)("threads"),
541
- _ts_param2(0, (0, import_common4.Query)("limit")),
776
+ (0, import_common5.Get)("threads"),
777
+ _ts_param2(0, (0, import_common5.Query)("limit")),
542
778
  _ts_metadata2("design:type", Function),
543
779
  _ts_metadata2("design:paramtypes", [
544
780
  String
@@ -546,14 +782,27 @@ _ts_decorate2([
546
782
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
547
783
  ], AgentApiController.prototype, "threads", null);
548
784
  _ts_decorate2([
549
- (0, import_common4.Get)("pricing"),
785
+ (0, import_common5.Get)("threads-page"),
786
+ _ts_param2(0, (0, import_common5.Query)("page")),
787
+ _ts_param2(1, (0, import_common5.Query)("limit")),
788
+ _ts_param2(2, (0, import_common5.Query)("where")),
789
+ _ts_metadata2("design:type", Function),
790
+ _ts_metadata2("design:paramtypes", [
791
+ String,
792
+ String,
793
+ typeof Record === "undefined" ? Object : Record
794
+ ]),
795
+ _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
796
+ ], AgentApiController.prototype, "threadsPage", null);
797
+ _ts_decorate2([
798
+ (0, import_common5.Get)("pricing"),
550
799
  _ts_metadata2("design:type", Function),
551
800
  _ts_metadata2("design:paramtypes", []),
552
801
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
553
802
  ], AgentApiController.prototype, "listPrices", null);
554
803
  _ts_decorate2([
555
- (0, import_common4.Post)("pricing"),
556
- _ts_param2(0, (0, import_common4.Body)()),
804
+ (0, import_common5.Post)("pricing"),
805
+ _ts_param2(0, (0, import_common5.Body)()),
557
806
  _ts_metadata2("design:type", Function),
558
807
  _ts_metadata2("design:paramtypes", [
559
808
  Object
@@ -561,18 +810,21 @@ _ts_decorate2([
561
810
  _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
562
811
  ], AgentApiController.prototype, "upsertPrice", null);
563
812
  _ts_decorate2([
564
- (0, import_common4.Sse)("stream"),
813
+ (0, import_common5.Sse)("stream"),
565
814
  _ts_metadata2("design:type", Function),
566
815
  _ts_metadata2("design:paramtypes", []),
567
816
  _ts_metadata2("design:returntype", typeof Observable === "undefined" ? Object : Observable)
568
817
  ], AgentApiController.prototype, "stream", null);
569
818
  AgentApiController = _ts_decorate2([
570
- (0, import_common4.Controller)(),
571
- _ts_param2(1, (0, import_common4.Inject)(DASHBOARD_APPROVAL_ACTOR_REF)),
819
+ (0, import_common5.Controller)(),
820
+ _ts_param2(1, (0, import_common5.Inject)(DASHBOARD_APPROVAL_ACTOR_REF)),
821
+ _ts_param2(2, (0, import_common5.Optional)()),
822
+ _ts_param2(2, (0, import_common5.Inject)(AGENT_ACTOR_RESOLVER)),
572
823
  _ts_metadata2("design:type", Function),
573
824
  _ts_metadata2("design:paramtypes", [
574
825
  typeof DashboardService === "undefined" ? Object : DashboardService,
575
- Object
826
+ Object,
827
+ typeof ActorResolver === "undefined" ? Object : ActorResolver
576
828
  ])
577
829
  ], AgentApiController);
578
830
 
@@ -603,14 +855,14 @@ __name(agentDashboardMountPaths, "agentDashboardMountPaths");
603
855
 
604
856
  // src/server/agent-dashboard.module.ts
605
857
  var import_reflect_metadata = require("reflect-metadata");
606
- var import_common6 = require("@nestjs/common");
858
+ var import_common7 = require("@nestjs/common");
607
859
  var import_core = require("@nestjs/core");
608
860
 
609
861
  // src/server/agent-ui.controller.ts
610
862
  var import_node_fs = require("fs");
611
863
  var import_node_path = require("path");
612
864
  var import_node_url = require("url");
613
- var import_common5 = require("@nestjs/common");
865
+ var import_common6 = require("@nestjs/common");
614
866
  function _ts_decorate3(decorators, target, key, desc) {
615
867
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
616
868
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -655,10 +907,15 @@ var AgentUiController = class {
655
907
  }
656
908
  // index.html references hash-named bundles, so it MUST NOT be cached (stale bundle = the classic
657
909
  // "stuck loading after a deploy"). The hashed assets below are immutable.
658
- index() {
910
+ index(req, res) {
911
+ if (req.headers["x-inertia"] !== void 0) {
912
+ res.status(409);
913
+ res.setHeader("X-Inertia-Location", req.originalUrl);
914
+ return "";
915
+ }
659
916
  const indexPath = (0, import_node_path.join)(this.dir, "index.html");
660
917
  if (!(0, import_node_fs.existsSync)(indexPath)) {
661
- throw new import_common5.NotFoundException("Dashboard is not built. Run the package build.");
918
+ throw new import_common6.NotFoundException("Dashboard is not built. Run the package build.");
662
919
  }
663
920
  const html = (0, import_node_fs.readFileSync)(indexPath, "utf8").replaceAll(`="${BUILD_BASE}/`, `="${this.basePath}/`);
664
921
  const inject = `<script>window.__AGENT_BASE__='${this.basePath}';window.__AGENT_API__='${this.apiBasePath}';</script>`;
@@ -666,40 +923,47 @@ var AgentUiController = class {
666
923
  }
667
924
  asset(file) {
668
925
  const safe = (0, import_node_path.basename)(file);
669
- if (safe !== file) throw new import_common5.NotFoundException();
926
+ if (safe !== file) throw new import_common6.NotFoundException();
670
927
  const root = (0, import_node_path.resolve)(this.dir, "assets");
671
928
  const assetPath = (0, import_node_path.resolve)(root, safe);
672
929
  if (!assetPath.startsWith(root + import_node_path.sep) || !(0, import_node_fs.existsSync)(assetPath)) {
673
- throw new import_common5.NotFoundException();
930
+ throw new import_common6.NotFoundException();
674
931
  }
675
932
  const type = CONTENT_TYPES[(0, import_node_path.extname)(safe)] ?? "application/octet-stream";
676
- return new import_common5.StreamableFile((0, import_node_fs.readFileSync)(assetPath), {
933
+ return new import_common6.StreamableFile((0, import_node_fs.readFileSync)(assetPath), {
677
934
  type
678
935
  });
679
936
  }
680
937
  };
681
938
  _ts_decorate3([
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"),
939
+ (0, import_common6.Get)(),
940
+ (0, import_common6.Header)("Content-Type", "text/html; charset=utf-8"),
941
+ (0, import_common6.Header)("Cache-Control", "no-store, must-revalidate"),
942
+ _ts_param3(0, (0, import_common6.Req)()),
943
+ _ts_param3(1, (0, import_common6.Res)({
944
+ passthrough: true
945
+ })),
685
946
  _ts_metadata3("design:type", Function),
686
- _ts_metadata3("design:paramtypes", []),
947
+ _ts_metadata3("design:paramtypes", [
948
+ typeof UiPageRequest === "undefined" ? Object : UiPageRequest,
949
+ typeof UiPageResponse === "undefined" ? Object : UiPageResponse
950
+ ]),
687
951
  _ts_metadata3("design:returntype", String)
688
952
  ], AgentUiController.prototype, "index", null);
689
953
  _ts_decorate3([
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")),
954
+ (0, import_common6.Get)("assets/:file"),
955
+ (0, import_common6.Header)("Cache-Control", "public, max-age=31536000, immutable"),
956
+ _ts_param3(0, (0, import_common6.Param)("file")),
693
957
  _ts_metadata3("design:type", Function),
694
958
  _ts_metadata3("design:paramtypes", [
695
959
  String
696
960
  ]),
697
- _ts_metadata3("design:returntype", typeof import_common5.StreamableFile === "undefined" ? Object : import_common5.StreamableFile)
961
+ _ts_metadata3("design:returntype", typeof import_common6.StreamableFile === "undefined" ? Object : import_common6.StreamableFile)
698
962
  ], AgentUiController.prototype, "asset", null);
699
963
  AgentUiController = _ts_decorate3([
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)),
964
+ (0, import_common6.Controller)(),
965
+ _ts_param3(0, (0, import_common6.Inject)(DASHBOARD_BASE_PATH)),
966
+ _ts_param3(1, (0, import_common6.Inject)(DASHBOARD_API_PATH)),
703
967
  _ts_metadata3("design:type", Function),
704
968
  _ts_metadata3("design:paramtypes", [
705
969
  String,
@@ -756,7 +1020,7 @@ var AgentApiModule = class _AgentApiModule {
756
1020
  }
757
1021
  };
758
1022
  AgentApiModule = _ts_decorate4([
759
- (0, import_common6.Module)({})
1023
+ (0, import_common7.Module)({})
760
1024
  ], AgentApiModule);
761
1025
  var AgentDashboardModule = class _AgentDashboardModule {
762
1026
  static {
@@ -818,11 +1082,12 @@ var AgentDashboardModule = class _AgentDashboardModule {
818
1082
  }
819
1083
  };
820
1084
  AgentDashboardModule = _ts_decorate4([
821
- (0, import_common6.Module)({})
1085
+ (0, import_common7.Module)({})
822
1086
  ], AgentDashboardModule);
823
1087
  // Annotate the CommonJS export names for ESM import in node:
824
1088
  0 && (module.exports = {
825
1089
  AGENT_ACTOR_DIRECTORY,
1090
+ AGENT_ACTOR_RESOLVER,
826
1091
  AGENT_APPROVAL_PORT,
827
1092
  AGENT_GOVERNANCE_QUERIES,
828
1093
  AGENT_PRICING_STORE,