@dudousxd/nestjs-agent-dashboard 0.21.0 → 0.22.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 +276 -60
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +92 -1
- package/dist/server/index.d.ts +92 -1
- package/dist/server/index.js +255 -47
- package/dist/server/index.js.map +1 -1
- package/dist/spa/assets/index-BW1bqmTf.css +1 -0
- package/dist/spa/assets/index-C4U9WEBt.js +1 -0
- package/dist/spa/assets/{preview-CbqJ2CAQ.js → preview-CJ1UfhOA.js} +1 -1
- package/dist/spa/index.html +3 -3
- package/dist/spa/preview.html +3 -3
- package/package.json +1 -1
- package/dist/spa/assets/index-ClnZsvJ1.css +0 -1
- package/dist/spa/assets/index-D3yTBCU0.js +0 -1
- /package/dist/spa/assets/{index-DS11tOEH.js → index-Br3YfiYJ.js} +0 -0
package/dist/server/index.d.cts
CHANGED
|
@@ -473,6 +473,8 @@ interface UiPageResponse {
|
|
|
473
473
|
status(code: number): unknown;
|
|
474
474
|
setHeader(name: string, value: string): unknown;
|
|
475
475
|
}
|
|
476
|
+
/** The id of the page's JSON config block. */
|
|
477
|
+
declare const AGENT_DASHBOARD_CONFIG_ID = "agent-dashboard-config";
|
|
476
478
|
/**
|
|
477
479
|
* Serves the bundled AI-gateway console SPA at the configured base (+ hashed assets at
|
|
478
480
|
* `<base>/assets`). The path comes from `RouterModule` (set by
|
|
@@ -488,6 +490,11 @@ declare class AgentUiController {
|
|
|
488
490
|
private readonly dir;
|
|
489
491
|
constructor(basePath: string, apiBasePath: string);
|
|
490
492
|
index(req: UiPageRequest, res: UiPageResponse): string;
|
|
493
|
+
/**
|
|
494
|
+
* The page's JSON config block (`agent-dashboard-config`, CSP-safe: data, not script). It carries
|
|
495
|
+
* `switcher` only when another Aviary console is registered.
|
|
496
|
+
*/
|
|
497
|
+
private configBlock;
|
|
491
498
|
asset(file: string): StreamableFile;
|
|
492
499
|
}
|
|
493
500
|
|
|
@@ -547,6 +554,90 @@ declare class ConsoleAuthorizeFilter implements ExceptionFilter<ConsoleAccessDen
|
|
|
547
554
|
*/
|
|
548
555
|
declare function UseConsoleAuthorize(): ClassDecorator & MethodDecorator;
|
|
549
556
|
|
|
557
|
+
/** The process-wide slot every Aviary console registers into (created by whichever boots first). */
|
|
558
|
+
declare const AVIARY_CONSOLES_SLOT: unique symbol;
|
|
559
|
+
/** The icon a console shows in the switcher. An unknown value renders as `generic`. */
|
|
560
|
+
type AviaryConsoleIcon = 'workflow' | 'telescope' | 'media' | 'payments' | 'agent' | 'identity' | 'generic';
|
|
561
|
+
/** What a console's `authorize` answers; only `allowed: true` lists it. */
|
|
562
|
+
interface AviaryConsoleDecision {
|
|
563
|
+
allowed: boolean;
|
|
564
|
+
reason?: string;
|
|
565
|
+
redirectTo?: string;
|
|
566
|
+
}
|
|
567
|
+
/** One console the switcher can list. */
|
|
568
|
+
interface AviaryConsoleEntry {
|
|
569
|
+
/** `/^[a-z][a-z0-9-]*$/`: `'durable'`, `'telescope'`, `'agent'`, `'media'`, … */
|
|
570
|
+
id: string;
|
|
571
|
+
/** Product title: `'Workflows'`, `'Telescope'`, `'Agents'`, `'Media'`. */
|
|
572
|
+
title: string;
|
|
573
|
+
icon: AviaryConsoleIcon;
|
|
574
|
+
/** Same-origin absolute path of the console's page (`/ai-gateway`). */
|
|
575
|
+
path: string;
|
|
576
|
+
/** Sort key: durable 10, telescope 20, agent 30, media 50. */
|
|
577
|
+
order: number;
|
|
578
|
+
/** The console's resolved gate (what its own routes run). Never throws. */
|
|
579
|
+
authorize(context: ExecutionContext): Promise<AviaryConsoleDecision>;
|
|
580
|
+
}
|
|
581
|
+
/** The value at {@link AVIARY_CONSOLES_SLOT}. Data only, so every console's copy is identical. */
|
|
582
|
+
interface AviaryConsoleRegistry {
|
|
583
|
+
readonly version: 1;
|
|
584
|
+
readonly entries: AviaryConsoleEntry[];
|
|
585
|
+
}
|
|
586
|
+
/** One console as `GET <api>/consoles` returns it. */
|
|
587
|
+
interface VisibleConsole {
|
|
588
|
+
id: string;
|
|
589
|
+
title: string;
|
|
590
|
+
icon: AviaryConsoleIcon;
|
|
591
|
+
href: string;
|
|
592
|
+
}
|
|
593
|
+
/** The answer of `GET <api>/consoles`. */
|
|
594
|
+
interface VisibleConsoles {
|
|
595
|
+
version: 1;
|
|
596
|
+
current: string;
|
|
597
|
+
consoles: VisibleConsole[];
|
|
598
|
+
}
|
|
599
|
+
/** How long another console's `authorize` may take before it is left out. */
|
|
600
|
+
declare const CONSOLE_PROBE_TIMEOUT_MS = 300;
|
|
601
|
+
/**
|
|
602
|
+
* Adds a console to the process's switcher registry, creating it when absent. Returns a function
|
|
603
|
+
* that removes the entry again, or `undefined` when it was not added (another registry version, or
|
|
604
|
+
* the id is taken: logged as a warning). A bad `id` or `path` throws.
|
|
605
|
+
*/
|
|
606
|
+
declare function registerAviaryConsole(entry: AviaryConsoleEntry, logger?: {
|
|
607
|
+
warn(message: string): void;
|
|
608
|
+
}): (() => void) | undefined;
|
|
609
|
+
/**
|
|
610
|
+
* The consoles other than `selfId` the viewer may open, by `order` then `id`. Every other entry's
|
|
611
|
+
* `authorize` runs in parallel, each given `timeoutMs`; a timeout, a rejection or any denial hides
|
|
612
|
+
* it. No reason is ever returned.
|
|
613
|
+
*/
|
|
614
|
+
declare function listVisibleConsoles(registry: AviaryConsoleRegistry | undefined, selfId: string, context: ExecutionContext, timeoutMs?: number): Promise<VisibleConsoles>;
|
|
615
|
+
/** The agent console's id in the registry. */
|
|
616
|
+
declare const AGENT_CONSOLE_ID = "agent";
|
|
617
|
+
/**
|
|
618
|
+
* Registers the agent console into the switcher registry (the console's page path, gated by its
|
|
619
|
+
* resolved `authorize`). Provided only when the console's routes are mounted; removed on shutdown.
|
|
620
|
+
*/
|
|
621
|
+
declare class AgentConsoleRegistration implements OnModuleInit, OnModuleDestroy {
|
|
622
|
+
#private;
|
|
623
|
+
private readonly basePath;
|
|
624
|
+
private readonly access;
|
|
625
|
+
constructor(basePath: string, access: DashboardConsoleAccess);
|
|
626
|
+
onModuleInit(): void;
|
|
627
|
+
onModuleDestroy(): void;
|
|
628
|
+
}
|
|
629
|
+
/** What the route hands on to the other consoles' `authorize`: this request's `ExecutionContext`. */
|
|
630
|
+
interface CurrentContext {
|
|
631
|
+
context: ExecutionContext;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* `GET <api>/consoles`: the other Aviary consoles this viewer may open. Behind the console's own
|
|
635
|
+
* access check, like every API route, so only someone who may open this console learns the list.
|
|
636
|
+
*/
|
|
637
|
+
declare class AgentConsolesController {
|
|
638
|
+
consoles(current: CurrentContext): Promise<VisibleConsoles>;
|
|
639
|
+
}
|
|
640
|
+
|
|
550
641
|
interface DevToolInputProperty {
|
|
551
642
|
type: 'string' | 'number' | 'integer' | 'boolean' | 'array';
|
|
552
643
|
description?: string;
|
|
@@ -658,4 +749,4 @@ declare const DASHBOARD_CONSOLE_OPTIONS: unique symbol;
|
|
|
658
749
|
/** DI token: whether the agent's dev tools register into the dev-tools slot. */
|
|
659
750
|
declare const DASHBOARD_DEV_TOOLS: unique symbol;
|
|
660
751
|
|
|
661
|
-
export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_GOVERNANCE_QUERIES, AGENT_PRICING_STORE, type ActorSpendRowWithLabel, AgentApiController, AgentApiModule, AgentDashboardModule, type AgentDashboardMountPathsOptions, type AgentDashboardOptions, type AgentDevTool, AgentDevToolsRegistration, AgentUiController, CONSOLE_AUTHORIZE_MISSING_WARNING, CONSOLE_GATE, CONSOLE_PAGE_METADATA, 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 WithActorLabel, agentDashboardMountPaths, agentDevTools, anyAuthorize, authorizeByToken, normalizeConsoleResult, parsePriceInput, resolveConsoleAuthorize };
|
|
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 };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -473,6 +473,8 @@ interface UiPageResponse {
|
|
|
473
473
|
status(code: number): unknown;
|
|
474
474
|
setHeader(name: string, value: string): unknown;
|
|
475
475
|
}
|
|
476
|
+
/** The id of the page's JSON config block. */
|
|
477
|
+
declare const AGENT_DASHBOARD_CONFIG_ID = "agent-dashboard-config";
|
|
476
478
|
/**
|
|
477
479
|
* Serves the bundled AI-gateway console SPA at the configured base (+ hashed assets at
|
|
478
480
|
* `<base>/assets`). The path comes from `RouterModule` (set by
|
|
@@ -488,6 +490,11 @@ declare class AgentUiController {
|
|
|
488
490
|
private readonly dir;
|
|
489
491
|
constructor(basePath: string, apiBasePath: string);
|
|
490
492
|
index(req: UiPageRequest, res: UiPageResponse): string;
|
|
493
|
+
/**
|
|
494
|
+
* The page's JSON config block (`agent-dashboard-config`, CSP-safe: data, not script). It carries
|
|
495
|
+
* `switcher` only when another Aviary console is registered.
|
|
496
|
+
*/
|
|
497
|
+
private configBlock;
|
|
491
498
|
asset(file: string): StreamableFile;
|
|
492
499
|
}
|
|
493
500
|
|
|
@@ -547,6 +554,90 @@ declare class ConsoleAuthorizeFilter implements ExceptionFilter<ConsoleAccessDen
|
|
|
547
554
|
*/
|
|
548
555
|
declare function UseConsoleAuthorize(): ClassDecorator & MethodDecorator;
|
|
549
556
|
|
|
557
|
+
/** The process-wide slot every Aviary console registers into (created by whichever boots first). */
|
|
558
|
+
declare const AVIARY_CONSOLES_SLOT: unique symbol;
|
|
559
|
+
/** The icon a console shows in the switcher. An unknown value renders as `generic`. */
|
|
560
|
+
type AviaryConsoleIcon = 'workflow' | 'telescope' | 'media' | 'payments' | 'agent' | 'identity' | 'generic';
|
|
561
|
+
/** What a console's `authorize` answers; only `allowed: true` lists it. */
|
|
562
|
+
interface AviaryConsoleDecision {
|
|
563
|
+
allowed: boolean;
|
|
564
|
+
reason?: string;
|
|
565
|
+
redirectTo?: string;
|
|
566
|
+
}
|
|
567
|
+
/** One console the switcher can list. */
|
|
568
|
+
interface AviaryConsoleEntry {
|
|
569
|
+
/** `/^[a-z][a-z0-9-]*$/`: `'durable'`, `'telescope'`, `'agent'`, `'media'`, … */
|
|
570
|
+
id: string;
|
|
571
|
+
/** Product title: `'Workflows'`, `'Telescope'`, `'Agents'`, `'Media'`. */
|
|
572
|
+
title: string;
|
|
573
|
+
icon: AviaryConsoleIcon;
|
|
574
|
+
/** Same-origin absolute path of the console's page (`/ai-gateway`). */
|
|
575
|
+
path: string;
|
|
576
|
+
/** Sort key: durable 10, telescope 20, agent 30, media 50. */
|
|
577
|
+
order: number;
|
|
578
|
+
/** The console's resolved gate (what its own routes run). Never throws. */
|
|
579
|
+
authorize(context: ExecutionContext): Promise<AviaryConsoleDecision>;
|
|
580
|
+
}
|
|
581
|
+
/** The value at {@link AVIARY_CONSOLES_SLOT}. Data only, so every console's copy is identical. */
|
|
582
|
+
interface AviaryConsoleRegistry {
|
|
583
|
+
readonly version: 1;
|
|
584
|
+
readonly entries: AviaryConsoleEntry[];
|
|
585
|
+
}
|
|
586
|
+
/** One console as `GET <api>/consoles` returns it. */
|
|
587
|
+
interface VisibleConsole {
|
|
588
|
+
id: string;
|
|
589
|
+
title: string;
|
|
590
|
+
icon: AviaryConsoleIcon;
|
|
591
|
+
href: string;
|
|
592
|
+
}
|
|
593
|
+
/** The answer of `GET <api>/consoles`. */
|
|
594
|
+
interface VisibleConsoles {
|
|
595
|
+
version: 1;
|
|
596
|
+
current: string;
|
|
597
|
+
consoles: VisibleConsole[];
|
|
598
|
+
}
|
|
599
|
+
/** How long another console's `authorize` may take before it is left out. */
|
|
600
|
+
declare const CONSOLE_PROBE_TIMEOUT_MS = 300;
|
|
601
|
+
/**
|
|
602
|
+
* Adds a console to the process's switcher registry, creating it when absent. Returns a function
|
|
603
|
+
* that removes the entry again, or `undefined` when it was not added (another registry version, or
|
|
604
|
+
* the id is taken: logged as a warning). A bad `id` or `path` throws.
|
|
605
|
+
*/
|
|
606
|
+
declare function registerAviaryConsole(entry: AviaryConsoleEntry, logger?: {
|
|
607
|
+
warn(message: string): void;
|
|
608
|
+
}): (() => void) | undefined;
|
|
609
|
+
/**
|
|
610
|
+
* The consoles other than `selfId` the viewer may open, by `order` then `id`. Every other entry's
|
|
611
|
+
* `authorize` runs in parallel, each given `timeoutMs`; a timeout, a rejection or any denial hides
|
|
612
|
+
* it. No reason is ever returned.
|
|
613
|
+
*/
|
|
614
|
+
declare function listVisibleConsoles(registry: AviaryConsoleRegistry | undefined, selfId: string, context: ExecutionContext, timeoutMs?: number): Promise<VisibleConsoles>;
|
|
615
|
+
/** The agent console's id in the registry. */
|
|
616
|
+
declare const AGENT_CONSOLE_ID = "agent";
|
|
617
|
+
/**
|
|
618
|
+
* Registers the agent console into the switcher registry (the console's page path, gated by its
|
|
619
|
+
* resolved `authorize`). Provided only when the console's routes are mounted; removed on shutdown.
|
|
620
|
+
*/
|
|
621
|
+
declare class AgentConsoleRegistration implements OnModuleInit, OnModuleDestroy {
|
|
622
|
+
#private;
|
|
623
|
+
private readonly basePath;
|
|
624
|
+
private readonly access;
|
|
625
|
+
constructor(basePath: string, access: DashboardConsoleAccess);
|
|
626
|
+
onModuleInit(): void;
|
|
627
|
+
onModuleDestroy(): void;
|
|
628
|
+
}
|
|
629
|
+
/** What the route hands on to the other consoles' `authorize`: this request's `ExecutionContext`. */
|
|
630
|
+
interface CurrentContext {
|
|
631
|
+
context: ExecutionContext;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* `GET <api>/consoles`: the other Aviary consoles this viewer may open. Behind the console's own
|
|
635
|
+
* access check, like every API route, so only someone who may open this console learns the list.
|
|
636
|
+
*/
|
|
637
|
+
declare class AgentConsolesController {
|
|
638
|
+
consoles(current: CurrentContext): Promise<VisibleConsoles>;
|
|
639
|
+
}
|
|
640
|
+
|
|
550
641
|
interface DevToolInputProperty {
|
|
551
642
|
type: 'string' | 'number' | 'integer' | 'boolean' | 'array';
|
|
552
643
|
description?: string;
|
|
@@ -658,4 +749,4 @@ declare const DASHBOARD_CONSOLE_OPTIONS: unique symbol;
|
|
|
658
749
|
/** DI token: whether the agent's dev tools register into the dev-tools slot. */
|
|
659
750
|
declare const DASHBOARD_DEV_TOOLS: unique symbol;
|
|
660
751
|
|
|
661
|
-
export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_GOVERNANCE_QUERIES, AGENT_PRICING_STORE, type ActorSpendRowWithLabel, AgentApiController, AgentApiModule, AgentDashboardModule, type AgentDashboardMountPathsOptions, type AgentDashboardOptions, type AgentDevTool, AgentDevToolsRegistration, AgentUiController, CONSOLE_AUTHORIZE_MISSING_WARNING, CONSOLE_GATE, CONSOLE_PAGE_METADATA, 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 WithActorLabel, agentDashboardMountPaths, agentDevTools, anyAuthorize, authorizeByToken, normalizeConsoleResult, parsePriceInput, resolveConsoleAuthorize };
|
|
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 };
|