@dudousxd/nestjs-agent 1.31.0 → 1.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,7 @@
1
- export { A as AgentGenuiModule, a as AgentGenuiModuleAsyncOptions, b as AgentGenuiModuleOptions, c as AgentGenuiOptions, d as AgentGenuiSandboxKitOptions, e as GENUI_CATALOG, f as GENUI_OPTIONS, G as GenuiCatalogResolver, I as InjectGenuiCatalog } from '../agent-genui.module-D0X3YnzO.cjs';
2
- import { Catalog, GenuiCatalogScope, GenuiChannels, GenuiChannelBase, SandboxClientConfig } from '@dudousxd/nestjs-agent-core/genui';
1
+ import { ToolPresentation } from '@dudousxd/nestjs-agent-core';
2
+ import { Catalog, GenuiCatalogScope, GenuiChannels, GenuiChannelBase, SandboxClientConfig, TreeSchemaMode, GenuiStreaming, TreeLimits, DefineSandboxOptions } from '@dudousxd/nestjs-agent-core/genui';
3
3
  export * from '@dudousxd/nestjs-agent-core/genui';
4
- import '@dudousxd/nestjs-agent-core';
5
- import '@nestjs/common';
4
+ import { Type, DynamicModule, ModuleMetadata, FactoryProvider } from '@nestjs/common';
6
5
 
7
6
  /**
8
7
  * The app's genui setup ({@link AgentGenui}): the catalog, the per-channel options and what the
@@ -32,4 +31,146 @@ declare class AgentGenui {
32
31
  sandboxClient?: (() => SandboxClientConfig) | undefined);
33
32
  }
34
33
 
35
- export { AGENT_GENUI, AgentGenui };
34
+ /** The app's genui catalog — `@InjectGenuiCatalog()` it anywhere; `overrideProvider` it in tests. */
35
+ declare const GENUI_CATALOG: unique symbol;
36
+ /** The resolved {@link AgentGenuiOptions} (without the resolver). */
37
+ declare const GENUI_OPTIONS: unique symbol;
38
+ /** Inject the app's genui catalog ({@link GENUI_CATALOG}). */
39
+ declare const InjectGenuiCatalog: () => ParameterDecorator & PropertyDecorator;
40
+ /**
41
+ * Picks the catalog for ONE request — a tenant's own, versioned components. Consulted when a genui
42
+ * call is validated and when the turn's tool list is described to the model, so components can
43
+ * change without rebuilding tools at boot. Cache in here if resolving costs a round trip: it runs
44
+ * once per turn per genui tool, and once per call.
45
+ *
46
+ * Provide it through `AgentGenuiModule.forRoot({ resolver })` (a class, resolved with DI, or an
47
+ * instance); it is then injectable, and replaceable in a test with
48
+ * `overrideProvider(GenuiCatalogResolver)`.
49
+ */
50
+ declare abstract class GenuiCatalogResolver {
51
+ abstract resolve(scope: GenuiCatalogScope): Catalog | Promise<Catalog>;
52
+ }
53
+ /** What {@link AgentGenuiModule} builds tools from. */
54
+ interface AgentGenuiOptions {
55
+ /**
56
+ * The catalog. With a {@link GenuiCatalogResolver} it is the boot-time one — it names the
57
+ * per-component tools — and may be empty. Default: an empty catalog.
58
+ */
59
+ catalog?: Catalog;
60
+ /**
61
+ * `tree` (default): one `ui__render` tool taking a composed tree (a single node is pushed as that
62
+ * component). `per-component`: one `ui__show_<snake>` tool per component.
63
+ */
64
+ mode?: 'per-component' | 'tree';
65
+ /** `ui__render`'s input schema: `'strict'` (default, a `$defs` union per component) or `'loose'`. */
66
+ treeSchema?: TreeSchemaMode;
67
+ /**
68
+ * Tree mode: `'complete'` (default) draws the tree once the call has run; `'partial'` streams it
69
+ * as `partial` ui frames while the model writes it. A component's own `streaming` overrides it.
70
+ */
71
+ streaming?: GenuiStreaming;
72
+ /** Least time between two partial tree frames of one call, in ms. Default 100. */
73
+ streamingThrottleMs?: number;
74
+ /** End the model's turn once a genui call succeeds (no narrating follow-up call). */
75
+ terminal?: boolean;
76
+ /** Tool name in `tree` mode. Default `ui__render`. */
77
+ treeToolName?: string;
78
+ /** Text prepended to the tree tool's description. */
79
+ treeInstructions?: string;
80
+ treeLimits?: TreeLimits;
81
+ /**
82
+ * Tree mode: components that ALSO get a flat tool whose input IS their props —
83
+ * `componentTools: ['Sandbox']` adds `ui__sandbox`, so a model writing a big component on its own
84
+ * has no `{ type, props }` envelope to leave out.
85
+ */
86
+ componentTools?: readonly string[];
87
+ /** Tool-name prefix for `componentTools`. Default `ui__` (`Sandbox` → `ui__sandbox`). */
88
+ componentToolPrefix?: string;
89
+ /** Tool-name prefix in `per-component` mode. Default `ui__show_`. */
90
+ namePrefix?: string;
91
+ /**
92
+ * Also register ONE generic tool taking `{ component, props }`, validated against the request's
93
+ * catalog — how a model reaches a tenant's own components, which no boot-time tool names. `true`
94
+ * names it `ui__show`.
95
+ */
96
+ showTool?: boolean | string;
97
+ /** Text prepended to the show tool's description. */
98
+ showInstructions?: string;
99
+ /** Roles allowed to call the tools. Undefined → the roles policy default. */
100
+ roles?: string[];
101
+ /** Override the generated presentation per component (or per tree / show tool name). */
102
+ presentation?: (component: string) => ToolPresentation | undefined;
103
+ /**
104
+ * Add the sandbox component (`Sandbox`): the model may write HTML, CSS and JS for a one-off
105
+ * interactive answer when no catalog component fits. `true` for the defaults (no network), or
106
+ * the {@link DefineSandboxOptions} (a policy listing origins, extra instructions). Off by default.
107
+ * The browser's catalog should carry the same definition (`defineSandbox(...)` in the shared
108
+ * catalog file) so the renderer enforces the same policy.
109
+ *
110
+ * `theme` (default on), `tailwind` and `kit` put the app's design system in the frame. `kit: true`
111
+ * (and the theme's variable names) are found through `sandboxKit`: the descriptor
112
+ * `genuiSandboxKit()` (`@dudousxd/nestjs-agent/vite`) writes in dev, the Vite manifest in
113
+ * production — and `GET <base>/config` tells the renderer where the assets are.
114
+ */
115
+ sandbox?: boolean | DefineSandboxOptions;
116
+ /**
117
+ * Per-channel generative UI: each entry sets the mode, streaming, sandbox and rendering of one
118
+ * channel (`web`, `mobile`, `whatsapp`, `telegram`, `email`, or `default` for the rest), over the
119
+ * top-level options. A text channel (`@dudousxd/nestjs-agent-channels`) configured here draws the
120
+ * components natively (reply buttons, lists, images). Omitted → every channel is served by the
121
+ * top-level options, as before.
122
+ */
123
+ channels?: GenuiChannels;
124
+ /**
125
+ * Where the sandbox kit is found (with `sandbox: { kit: true }`, `tailwind: true` or the theme's
126
+ * names). No Vite runs in the Nest process, so: the descriptor the dev plugin writes, else the
127
+ * production Vite manifest (read first when `NODE_ENV=production`).
128
+ */
129
+ sandboxKit?: AgentGenuiSandboxKitOptions;
130
+ }
131
+ /** {@link AgentGenuiOptions.sandboxKit}. Relative paths resolve against `root`. */
132
+ interface AgentGenuiSandboxKitOptions {
133
+ /** Default `process.cwd()`. */
134
+ root?: string;
135
+ /** The dev descriptor `genuiSandboxKit()` writes. Default `.genui/sandbox-kit.json`. */
136
+ descriptor?: string;
137
+ /**
138
+ * The production Vite manifest, and the directory its `file`s are relative to. Default
139
+ * `{ file: 'public/.vite/manifest.json', outDir: 'public' }`; `false` → none.
140
+ */
141
+ manifest?: {
142
+ file: string;
143
+ outDir: string;
144
+ } | false;
145
+ /** An explicit kit url (an SPA served from elsewhere), over what is found. */
146
+ kitUrl?: string;
147
+ /** Read the manifest first. Default: `NODE_ENV === 'production'`. */
148
+ production?: boolean;
149
+ }
150
+ type ResolverOption = Type<GenuiCatalogResolver> | GenuiCatalogResolver;
151
+ interface AgentGenuiModuleOptions extends AgentGenuiOptions {
152
+ /** Per-request catalogs. A class is instantiated with DI (its dependencies must be global or exported to the root). */
153
+ resolver?: ResolverOption;
154
+ }
155
+ interface AgentGenuiModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
156
+ inject?: FactoryProvider['inject'];
157
+ useFactory: (...deps: any[]) => AgentGenuiOptions | Promise<AgentGenuiOptions>;
158
+ /** Per-request catalogs. A class resolves its dependencies from `imports`. */
159
+ resolver?: ResolverOption;
160
+ }
161
+ /**
162
+ * Generative UI for the agent: registers the tools that let the model push catalog components
163
+ * (one `ui__render` tree tool, or `ui__show_<component>` per component, and/or the generic
164
+ * `ui__show`), and makes the catalog
165
+ * injectable. Global, like `AgentModule`; import it once, next to it.
166
+ *
167
+ * ```ts
168
+ * AgentGenuiModule.forRoot({ catalog, mode: 'tree', terminal: true })
169
+ * ```
170
+ */
171
+ declare class AgentGenuiModule {
172
+ static forRoot(options?: AgentGenuiModuleOptions): DynamicModule;
173
+ static forRootAsync(options: AgentGenuiModuleAsyncOptions): DynamicModule;
174
+ }
175
+
176
+ export { AGENT_GENUI, AgentGenui, AgentGenuiModule, type AgentGenuiModuleAsyncOptions, type AgentGenuiModuleOptions, type AgentGenuiOptions, type AgentGenuiSandboxKitOptions, GENUI_CATALOG, GENUI_OPTIONS, GenuiCatalogResolver, InjectGenuiCatalog };
@@ -1,8 +1,7 @@
1
- export { A as AgentGenuiModule, a as AgentGenuiModuleAsyncOptions, b as AgentGenuiModuleOptions, c as AgentGenuiOptions, d as AgentGenuiSandboxKitOptions, e as GENUI_CATALOG, f as GENUI_OPTIONS, G as GenuiCatalogResolver, I as InjectGenuiCatalog } from '../agent-genui.module-D0X3YnzO.js';
2
- import { Catalog, GenuiCatalogScope, GenuiChannels, GenuiChannelBase, SandboxClientConfig } from '@dudousxd/nestjs-agent-core/genui';
1
+ import { ToolPresentation } from '@dudousxd/nestjs-agent-core';
2
+ import { Catalog, GenuiCatalogScope, GenuiChannels, GenuiChannelBase, SandboxClientConfig, TreeSchemaMode, GenuiStreaming, TreeLimits, DefineSandboxOptions } from '@dudousxd/nestjs-agent-core/genui';
3
3
  export * from '@dudousxd/nestjs-agent-core/genui';
4
- import '@dudousxd/nestjs-agent-core';
5
- import '@nestjs/common';
4
+ import { Type, DynamicModule, ModuleMetadata, FactoryProvider } from '@nestjs/common';
6
5
 
7
6
  /**
8
7
  * The app's genui setup ({@link AgentGenui}): the catalog, the per-channel options and what the
@@ -32,4 +31,146 @@ declare class AgentGenui {
32
31
  sandboxClient?: (() => SandboxClientConfig) | undefined);
33
32
  }
34
33
 
35
- export { AGENT_GENUI, AgentGenui };
34
+ /** The app's genui catalog — `@InjectGenuiCatalog()` it anywhere; `overrideProvider` it in tests. */
35
+ declare const GENUI_CATALOG: unique symbol;
36
+ /** The resolved {@link AgentGenuiOptions} (without the resolver). */
37
+ declare const GENUI_OPTIONS: unique symbol;
38
+ /** Inject the app's genui catalog ({@link GENUI_CATALOG}). */
39
+ declare const InjectGenuiCatalog: () => ParameterDecorator & PropertyDecorator;
40
+ /**
41
+ * Picks the catalog for ONE request — a tenant's own, versioned components. Consulted when a genui
42
+ * call is validated and when the turn's tool list is described to the model, so components can
43
+ * change without rebuilding tools at boot. Cache in here if resolving costs a round trip: it runs
44
+ * once per turn per genui tool, and once per call.
45
+ *
46
+ * Provide it through `AgentGenuiModule.forRoot({ resolver })` (a class, resolved with DI, or an
47
+ * instance); it is then injectable, and replaceable in a test with
48
+ * `overrideProvider(GenuiCatalogResolver)`.
49
+ */
50
+ declare abstract class GenuiCatalogResolver {
51
+ abstract resolve(scope: GenuiCatalogScope): Catalog | Promise<Catalog>;
52
+ }
53
+ /** What {@link AgentGenuiModule} builds tools from. */
54
+ interface AgentGenuiOptions {
55
+ /**
56
+ * The catalog. With a {@link GenuiCatalogResolver} it is the boot-time one — it names the
57
+ * per-component tools — and may be empty. Default: an empty catalog.
58
+ */
59
+ catalog?: Catalog;
60
+ /**
61
+ * `tree` (default): one `ui__render` tool taking a composed tree (a single node is pushed as that
62
+ * component). `per-component`: one `ui__show_<snake>` tool per component.
63
+ */
64
+ mode?: 'per-component' | 'tree';
65
+ /** `ui__render`'s input schema: `'strict'` (default, a `$defs` union per component) or `'loose'`. */
66
+ treeSchema?: TreeSchemaMode;
67
+ /**
68
+ * Tree mode: `'complete'` (default) draws the tree once the call has run; `'partial'` streams it
69
+ * as `partial` ui frames while the model writes it. A component's own `streaming` overrides it.
70
+ */
71
+ streaming?: GenuiStreaming;
72
+ /** Least time between two partial tree frames of one call, in ms. Default 100. */
73
+ streamingThrottleMs?: number;
74
+ /** End the model's turn once a genui call succeeds (no narrating follow-up call). */
75
+ terminal?: boolean;
76
+ /** Tool name in `tree` mode. Default `ui__render`. */
77
+ treeToolName?: string;
78
+ /** Text prepended to the tree tool's description. */
79
+ treeInstructions?: string;
80
+ treeLimits?: TreeLimits;
81
+ /**
82
+ * Tree mode: components that ALSO get a flat tool whose input IS their props —
83
+ * `componentTools: ['Sandbox']` adds `ui__sandbox`, so a model writing a big component on its own
84
+ * has no `{ type, props }` envelope to leave out.
85
+ */
86
+ componentTools?: readonly string[];
87
+ /** Tool-name prefix for `componentTools`. Default `ui__` (`Sandbox` → `ui__sandbox`). */
88
+ componentToolPrefix?: string;
89
+ /** Tool-name prefix in `per-component` mode. Default `ui__show_`. */
90
+ namePrefix?: string;
91
+ /**
92
+ * Also register ONE generic tool taking `{ component, props }`, validated against the request's
93
+ * catalog — how a model reaches a tenant's own components, which no boot-time tool names. `true`
94
+ * names it `ui__show`.
95
+ */
96
+ showTool?: boolean | string;
97
+ /** Text prepended to the show tool's description. */
98
+ showInstructions?: string;
99
+ /** Roles allowed to call the tools. Undefined → the roles policy default. */
100
+ roles?: string[];
101
+ /** Override the generated presentation per component (or per tree / show tool name). */
102
+ presentation?: (component: string) => ToolPresentation | undefined;
103
+ /**
104
+ * Add the sandbox component (`Sandbox`): the model may write HTML, CSS and JS for a one-off
105
+ * interactive answer when no catalog component fits. `true` for the defaults (no network), or
106
+ * the {@link DefineSandboxOptions} (a policy listing origins, extra instructions). Off by default.
107
+ * The browser's catalog should carry the same definition (`defineSandbox(...)` in the shared
108
+ * catalog file) so the renderer enforces the same policy.
109
+ *
110
+ * `theme` (default on), `tailwind` and `kit` put the app's design system in the frame. `kit: true`
111
+ * (and the theme's variable names) are found through `sandboxKit`: the descriptor
112
+ * `genuiSandboxKit()` (`@dudousxd/nestjs-agent/vite`) writes in dev, the Vite manifest in
113
+ * production — and `GET <base>/config` tells the renderer where the assets are.
114
+ */
115
+ sandbox?: boolean | DefineSandboxOptions;
116
+ /**
117
+ * Per-channel generative UI: each entry sets the mode, streaming, sandbox and rendering of one
118
+ * channel (`web`, `mobile`, `whatsapp`, `telegram`, `email`, or `default` for the rest), over the
119
+ * top-level options. A text channel (`@dudousxd/nestjs-agent-channels`) configured here draws the
120
+ * components natively (reply buttons, lists, images). Omitted → every channel is served by the
121
+ * top-level options, as before.
122
+ */
123
+ channels?: GenuiChannels;
124
+ /**
125
+ * Where the sandbox kit is found (with `sandbox: { kit: true }`, `tailwind: true` or the theme's
126
+ * names). No Vite runs in the Nest process, so: the descriptor the dev plugin writes, else the
127
+ * production Vite manifest (read first when `NODE_ENV=production`).
128
+ */
129
+ sandboxKit?: AgentGenuiSandboxKitOptions;
130
+ }
131
+ /** {@link AgentGenuiOptions.sandboxKit}. Relative paths resolve against `root`. */
132
+ interface AgentGenuiSandboxKitOptions {
133
+ /** Default `process.cwd()`. */
134
+ root?: string;
135
+ /** The dev descriptor `genuiSandboxKit()` writes. Default `.genui/sandbox-kit.json`. */
136
+ descriptor?: string;
137
+ /**
138
+ * The production Vite manifest, and the directory its `file`s are relative to. Default
139
+ * `{ file: 'public/.vite/manifest.json', outDir: 'public' }`; `false` → none.
140
+ */
141
+ manifest?: {
142
+ file: string;
143
+ outDir: string;
144
+ } | false;
145
+ /** An explicit kit url (an SPA served from elsewhere), over what is found. */
146
+ kitUrl?: string;
147
+ /** Read the manifest first. Default: `NODE_ENV === 'production'`. */
148
+ production?: boolean;
149
+ }
150
+ type ResolverOption = Type<GenuiCatalogResolver> | GenuiCatalogResolver;
151
+ interface AgentGenuiModuleOptions extends AgentGenuiOptions {
152
+ /** Per-request catalogs. A class is instantiated with DI (its dependencies must be global or exported to the root). */
153
+ resolver?: ResolverOption;
154
+ }
155
+ interface AgentGenuiModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
156
+ inject?: FactoryProvider['inject'];
157
+ useFactory: (...deps: any[]) => AgentGenuiOptions | Promise<AgentGenuiOptions>;
158
+ /** Per-request catalogs. A class resolves its dependencies from `imports`. */
159
+ resolver?: ResolverOption;
160
+ }
161
+ /**
162
+ * Generative UI for the agent: registers the tools that let the model push catalog components
163
+ * (one `ui__render` tree tool, or `ui__show_<component>` per component, and/or the generic
164
+ * `ui__show`), and makes the catalog
165
+ * injectable. Global, like `AgentModule`; import it once, next to it.
166
+ *
167
+ * ```ts
168
+ * AgentGenuiModule.forRoot({ catalog, mode: 'tree', terminal: true })
169
+ * ```
170
+ */
171
+ declare class AgentGenuiModule {
172
+ static forRoot(options?: AgentGenuiModuleOptions): DynamicModule;
173
+ static forRootAsync(options: AgentGenuiModuleAsyncOptions): DynamicModule;
174
+ }
175
+
176
+ export { AGENT_GENUI, AgentGenui, AgentGenuiModule, type AgentGenuiModuleAsyncOptions, type AgentGenuiModuleOptions, type AgentGenuiOptions, type AgentGenuiSandboxKitOptions, GENUI_CATALOG, GENUI_OPTIONS, GenuiCatalogResolver, InjectGenuiCatalog };
@@ -2,7 +2,7 @@ import { A2uiStreamOptions, a2uiThreadReplay } from '@dudousxd/nestjs-agent-core
2
2
  import { AgentAttachmentConfig, AttachmentStagingStore, AgentStore, Actor, ListActionProposals, ActionProposalView, ActionProposalMutationView, TextActionProposalVocabulary, AgentRunner, ModelCatalog, QuotaProvider, ActionApprovalMode, MessageAttachment, QuotaReport, ModelCatalogView, AgentHostContext, AttachmentRef, PageContext, ChatQueueState, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, ActorResolver } from '@dudousxd/nestjs-agent-core';
3
3
  import { Request, Response } from 'express';
4
4
  import { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
5
- import { b as AgentModuleOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter } from './chat-queue.service-Bdz43pAC.js';
5
+ import { b as AgentModuleOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter } from './chat-queue.service-wNWaoUN8.js';
6
6
 
7
7
  /** Default per-file size cap (20 MiB). */
8
8
  declare const DEFAULT_MAX_ATTACHMENT_BYTES: number;
@@ -2,7 +2,7 @@ import { A2uiStreamOptions, a2uiThreadReplay } from '@dudousxd/nestjs-agent-core
2
2
  import { AgentAttachmentConfig, AttachmentStagingStore, AgentStore, Actor, ListActionProposals, ActionProposalView, ActionProposalMutationView, TextActionProposalVocabulary, AgentRunner, ModelCatalog, QuotaProvider, ActionApprovalMode, MessageAttachment, QuotaReport, ModelCatalogView, AgentHostContext, AttachmentRef, PageContext, ChatQueueState, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, ActorResolver } from '@dudousxd/nestjs-agent-core';
3
3
  import { Request, Response } from 'express';
4
4
  import { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
5
- import { b as AgentModuleOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter } from './chat-queue.service-ZwQ9p-Ps.cjs';
5
+ import { b as AgentModuleOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter } from './chat-queue.service-QIuTS-5c.cjs';
6
6
 
7
7
  /** Default per-file size cap (20 MiB). */
8
8
  declare const DEFAULT_MAX_ATTACHMENT_BYTES: number;
package/dist/index.cjs CHANGED
@@ -208,7 +208,7 @@ var defineTool = import_nestjs_agent_core.createFunctionalTool;
208
208
 
209
209
  // src/genui/agent-genui.token.ts
210
210
  var AGENT_GENUI = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui");
211
- var AgentGenui = class {
211
+ var AgentGenui2 = class {
212
212
  static {
213
213
  __name(this, "AgentGenui");
214
214
  }
@@ -378,7 +378,7 @@ function coreProviders(resolver) {
378
378
  },
379
379
  {
380
380
  provide: AGENT_GENUI,
381
- useFactory: /* @__PURE__ */ __name((options, catalog, resolved, resolverInstance) => new AgentGenui(catalog, perRequest(resolverInstance), resolved.channels, {
381
+ useFactory: /* @__PURE__ */ __name((options, catalog, resolved, resolverInstance) => new AgentGenui2(catalog, perRequest(resolverInstance), resolved.channels, {
382
382
  ...options.mode !== void 0 ? {
383
383
  mode: options.mode
384
384
  } : {},
@@ -514,7 +514,8 @@ var AgentDepsFactory2 = class {
514
514
  memory;
515
515
  uiCatalog;
516
516
  uiCatalogResolver;
517
- constructor(options, model, store, sink, rolesPolicy, registry, agents, promptContributors, pricingStore, skills, memory, uiCatalog, uiCatalogResolver) {
517
+ genui;
518
+ constructor(options, model, store, sink, rolesPolicy, registry, agents, promptContributors, pricingStore, skills, memory, uiCatalog, uiCatalogResolver, genui) {
518
519
  this.options = options;
519
520
  this.model = model;
520
521
  this.store = store;
@@ -528,6 +529,7 @@ var AgentDepsFactory2 = class {
528
529
  this.memory = memory;
529
530
  this.uiCatalog = uiCatalog;
530
531
  this.uiCatalogResolver = uiCatalogResolver;
532
+ this.genui = genui;
531
533
  if (options.actionApprovalMode === "independent") (0, import_nestjs_agent_core2.assertIndependentActionCapabilities)(store, options.backgroundActorResolver);
532
534
  }
533
535
  /** The turn's memory seam, shared with the read-back endpoint. Undefined → memory is not configured. */
@@ -629,6 +631,30 @@ var AgentDepsFactory2 = class {
629
631
  }
630
632
  return deps;
631
633
  }
634
+ /** The turn's UI catalog: the per-request resolver's, else the app's. */
635
+ resolveUiCatalog = /* @__PURE__ */ __name((scope) => {
636
+ const catalog = this.uiCatalogResolver?.resolve({
637
+ ...scope,
638
+ ...scope.actor.tenantRef !== void 0 ? {
639
+ tenant: scope.actor.tenantRef
640
+ } : {}
641
+ }) ?? this.uiCatalog;
642
+ if (!catalog) throw new Error("UI catalog unavailable");
643
+ return catalog;
644
+ }, "resolveUiCatalog");
645
+ #uiChannelGuide;
646
+ /** genui `channels`: what the model is told per channel. Built once; `undefined` without channels. */
647
+ uiChannelGuide() {
648
+ if (this.#uiChannelGuide === void 0) {
649
+ const channels = this.genui?.channels;
650
+ this.#uiChannelGuide = channels === void 0 || this.uiCatalog === void 0 && this.uiCatalogResolver === void 0 ? null : (0, import_nestjs_agent_core2.createToolUiChannelGuide)({
651
+ channels,
652
+ base: this.genui?.base ?? {},
653
+ resolveCatalog: this.resolveUiCatalog
654
+ });
655
+ }
656
+ return this.#uiChannelGuide ?? void 0;
657
+ }
632
658
  forAgent(agentName) {
633
659
  const name = agentName ?? this.defaultAgentName();
634
660
  if (agentName !== void 0 && !this.agents.has(agentName)) {
@@ -644,6 +670,7 @@ var AgentDepsFactory2 = class {
644
670
  const retrieval = this.options.retrieval;
645
671
  const historyPolicy = this.historyPolicy(definition);
646
672
  const ask = definition?.ask ?? this.options.ask;
673
+ const uiChannelGuide = this.uiChannelGuide();
647
674
  return {
648
675
  model: this.model,
649
676
  store: this.store,
@@ -657,16 +684,10 @@ var AgentDepsFactory2 = class {
657
684
  } : {},
658
685
  registry: this.registry,
659
686
  ...this.uiCatalog !== void 0 || this.uiCatalogResolver !== void 0 ? {
660
- resolveUiCatalog: /* @__PURE__ */ __name((scope) => {
661
- const catalog = this.uiCatalogResolver?.resolve({
662
- ...scope,
663
- ...scope.actor.tenantRef !== void 0 ? {
664
- tenant: scope.actor.tenantRef
665
- } : {}
666
- }) ?? this.uiCatalog;
667
- if (!catalog) throw new Error("UI catalog unavailable");
668
- return catalog;
669
- }, "resolveUiCatalog")
687
+ resolveUiCatalog: this.resolveUiCatalog
688
+ } : {},
689
+ ...uiChannelGuide !== void 0 ? {
690
+ uiChannelGuide
670
691
  } : {},
671
692
  promptContributors: this.promptContributors,
672
693
  systemPrompt: definition?.systemPrompt ?? this.options.systemPrompt ?? "You are a helpful assistant.",
@@ -837,6 +858,8 @@ AgentDepsFactory2 = _ts_decorate2([
837
858
  _ts_param(11, (0, import_common2.Optional)()),
838
859
  _ts_param(11, (0, import_common2.Inject)(GENUI_CATALOG)),
839
860
  _ts_param(12, (0, import_common2.Optional)()),
861
+ _ts_param(13, (0, import_common2.Optional)()),
862
+ _ts_param(13, (0, import_common2.Inject)(AGENT_GENUI)),
840
863
  _ts_metadata("design:type", Function),
841
864
  _ts_metadata("design:paramtypes", [
842
865
  typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
@@ -851,7 +874,8 @@ AgentDepsFactory2 = _ts_decorate2([
851
874
  Object,
852
875
  Object,
853
876
  typeof Catalog === "undefined" ? Object : Catalog,
854
- typeof GenuiCatalogResolver === "undefined" ? Object : GenuiCatalogResolver
877
+ typeof GenuiCatalogResolver === "undefined" ? Object : GenuiCatalogResolver,
878
+ typeof AgentGenui === "undefined" ? Object : AgentGenui
855
879
  ])
856
880
  ], AgentDepsFactory2);
857
881