@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.
- package/dist/a2ui/index.d.cts +3 -3
- package/dist/a2ui/index.d.ts +3 -3
- package/dist/{chat-queue.service-ZwQ9p-Ps.d.cts → chat-queue.service-QIuTS-5c.d.cts} +11 -3
- package/dist/{chat-queue.service-Bdz43pAC.d.ts → chat-queue.service-wNWaoUN8.d.ts} +11 -3
- package/dist/durable/index.cjs +39 -14
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.d.cts +2 -2
- package/dist/durable/index.d.ts +2 -2
- package/dist/durable/index.js +41 -16
- package/dist/durable/index.js.map +1 -1
- package/dist/genui/index.d.cts +146 -5
- package/dist/genui/index.d.ts +146 -5
- package/dist/{index-BGevU_Ih.d.ts → index-DFKUTFfZ.d.ts} +1 -1
- package/dist/{index-DoCdfNrO.d.cts → index-DIFUEKPr.d.cts} +1 -1
- package/dist/index.cjs +38 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +39 -15
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/agent-genui.module-D0X3YnzO.d.cts +0 -147
- package/dist/agent-genui.module-D0X3YnzO.d.ts +0 -147
package/dist/a2ui/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from '@dudousxd/nestjs-agent-core/a2ui';
|
|
2
|
-
export { b as A2uiAdapterOptions, c as A2uiRunHandler, i as a2uiAdapter } from '../index-
|
|
2
|
+
export { b as A2uiAdapterOptions, c as A2uiRunHandler, i as a2uiAdapter } from '../index-DIFUEKPr.cjs';
|
|
3
3
|
import '@dudousxd/nestjs-agent-core';
|
|
4
4
|
import 'express';
|
|
5
5
|
import '@dudousxd/nestjs-agent-core/genui';
|
|
6
|
-
import '../chat-queue.service-
|
|
6
|
+
import '../chat-queue.service-QIuTS-5c.cjs';
|
|
7
7
|
import '@standard-schema/spec';
|
|
8
8
|
import '@nestjs/common';
|
|
9
|
-
import '../
|
|
9
|
+
import '../genui/index.cjs';
|
package/dist/a2ui/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from '@dudousxd/nestjs-agent-core/a2ui';
|
|
2
|
-
export { b as A2uiAdapterOptions, c as A2uiRunHandler, i as a2uiAdapter } from '../index-
|
|
2
|
+
export { b as A2uiAdapterOptions, c as A2uiRunHandler, i as a2uiAdapter } from '../index-DFKUTFfZ.js';
|
|
3
3
|
import '@dudousxd/nestjs-agent-core';
|
|
4
4
|
import 'express';
|
|
5
5
|
import '@dudousxd/nestjs-agent-core/genui';
|
|
6
|
-
import '../chat-queue.service-
|
|
6
|
+
import '../chat-queue.service-wNWaoUN8.js';
|
|
7
7
|
import '@standard-schema/spec';
|
|
8
8
|
import '@nestjs/common';
|
|
9
|
-
import '../
|
|
9
|
+
import '../genui/index.js';
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { ResolveToolUiCatalog, ModelProvider, AgentStore, ToolRegistry, RolesPolicy, ApprovalPolicy, QuotaStore, TokenStreamSink, PromptBuilder, PromptContributor, Persona, ToolTransientRetrySetting, Retriever, AgentPricingStore, HistoryPolicy, InputProcessor, OutputProcessor, AgentIntake, SkillsConfig, MemoryConfig, ToolSpec, ToolHandler, createFunctionalTool, QuotaProvider, QuotaQuery, QuotaReport, ActionApprovalMode, BackgroundActorResolver, ActionProposal, TextActionProposalConfig, PriceCatalogOptions, ModelCatalog, EmptyRoles, ActorResolver, AgentHistoryWindow, SkillProvider, ScopeResolver, MemoryProvider, AgentRegistry, PersonaCatalogEntry, Actor, AttachmentStagingStore, ChatQueueStore, ChatQueueState, AgentRunner, AgentRunInput, AgentStreamEvent, QueuePauseReason } from '@dudousxd/nestjs-agent-core';
|
|
1
|
+
import { ResolveToolUiCatalog, ToolUiChannelGuide, ModelProvider, AgentStore, ToolRegistry, RolesPolicy, ApprovalPolicy, QuotaStore, TokenStreamSink, PromptBuilder, PromptContributor, Persona, ToolTransientRetrySetting, Retriever, AgentPricingStore, HistoryPolicy, InputProcessor, OutputProcessor, AgentIntake, SkillsConfig, MemoryConfig, ToolSpec, ToolHandler, createFunctionalTool, QuotaProvider, QuotaQuery, QuotaReport, ActionApprovalMode, BackgroundActorResolver, ActionProposal, TextActionProposalConfig, PriceCatalogOptions, ModelCatalog, EmptyRoles, ActorResolver, AgentHistoryWindow, SkillProvider, ScopeResolver, MemoryProvider, AgentRegistry, PersonaCatalogEntry, Actor, AttachmentStagingStore, ChatQueueStore, ChatQueueState, AgentRunner, AgentRunInput, AgentStreamEvent, QueuePauseReason } from '@dudousxd/nestjs-agent-core';
|
|
2
2
|
import { Catalog } from '@dudousxd/nestjs-agent-core/genui';
|
|
3
3
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
4
|
import { Provider, InjectionToken, Type, FactoryProvider, CanActivate, ModuleMetadata, OptionalFactoryDependency } from '@nestjs/common';
|
|
5
|
-
import {
|
|
5
|
+
import { GenuiCatalogResolver, AgentGenui } from './genui/index.cjs';
|
|
6
6
|
|
|
7
7
|
/** Everything `runAgentLoop` needs, minus the per-run `day` the runner stamps. */
|
|
8
8
|
interface AgentDeps {
|
|
9
9
|
resolveUiCatalog?: ResolveToolUiCatalog;
|
|
10
|
+
/** genui `channels`: the channel's prompt block, and what tool pushes were delivered as. */
|
|
11
|
+
uiChannelGuide?: ToolUiChannelGuide;
|
|
10
12
|
actionApprovalMode?: 'blocking' | 'independent';
|
|
11
13
|
model: ModelProvider;
|
|
12
14
|
store: AgentStore;
|
|
@@ -644,6 +646,7 @@ declare function delegateToolName(args: {
|
|
|
644
646
|
}): string;
|
|
645
647
|
/** Builds the per-agent loop deps. The single-agent case is just the one registered `@Agent`. */
|
|
646
648
|
declare class AgentDepsFactory {
|
|
649
|
+
#private;
|
|
647
650
|
private readonly options;
|
|
648
651
|
private readonly model;
|
|
649
652
|
private readonly store;
|
|
@@ -657,7 +660,8 @@ declare class AgentDepsFactory {
|
|
|
657
660
|
private readonly memory;
|
|
658
661
|
private readonly uiCatalog?;
|
|
659
662
|
private readonly uiCatalogResolver?;
|
|
660
|
-
|
|
663
|
+
private readonly genui?;
|
|
664
|
+
constructor(options: AgentModuleOptions, model: ModelProvider, store: AgentStore, sink: TokenStreamSink, rolesPolicy: RolesPolicy, registry: ToolRegistry, agents: AgentRegistry, promptContributors: PromptContributor[], pricingStore: AgentPricingStore | undefined, skills: SkillsConfig | undefined, memory: MemoryConfig | undefined, uiCatalog?: Catalog | undefined, uiCatalogResolver?: GenuiCatalogResolver | undefined, genui?: AgentGenui | undefined);
|
|
661
665
|
/** The turn's memory seam, shared with the read-back endpoint. Undefined → memory is not configured. */
|
|
662
666
|
memoryConfig(): MemoryConfig | undefined;
|
|
663
667
|
/** The turn's skills seam, shared with the listing endpoint. Undefined → skills are not configured. */
|
|
@@ -691,6 +695,10 @@ declare class AgentDepsFactory {
|
|
|
691
695
|
threadPersona?: string | null;
|
|
692
696
|
}): string | undefined;
|
|
693
697
|
forProposal(proposal: ActionProposal, _actor: Actor): AgentDeps;
|
|
698
|
+
/** The turn's UI catalog: the per-request resolver's, else the app's. */
|
|
699
|
+
private readonly resolveUiCatalog;
|
|
700
|
+
/** genui `channels`: what the model is told per channel. Built once; `undefined` without channels. */
|
|
701
|
+
private uiChannelGuide;
|
|
694
702
|
forAgent(agentName?: string): AgentDeps;
|
|
695
703
|
/**
|
|
696
704
|
* A persona baked into an agent's deps — how a run journaled under an agent name that a persona
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { ResolveToolUiCatalog, ModelProvider, AgentStore, ToolRegistry, RolesPolicy, ApprovalPolicy, QuotaStore, TokenStreamSink, PromptBuilder, PromptContributor, Persona, ToolTransientRetrySetting, Retriever, AgentPricingStore, HistoryPolicy, InputProcessor, OutputProcessor, AgentIntake, SkillsConfig, MemoryConfig, ToolSpec, ToolHandler, createFunctionalTool, QuotaProvider, QuotaQuery, QuotaReport, ActionApprovalMode, BackgroundActorResolver, ActionProposal, TextActionProposalConfig, PriceCatalogOptions, ModelCatalog, EmptyRoles, ActorResolver, AgentHistoryWindow, SkillProvider, ScopeResolver, MemoryProvider, AgentRegistry, PersonaCatalogEntry, Actor, AttachmentStagingStore, ChatQueueStore, ChatQueueState, AgentRunner, AgentRunInput, AgentStreamEvent, QueuePauseReason } from '@dudousxd/nestjs-agent-core';
|
|
1
|
+
import { ResolveToolUiCatalog, ToolUiChannelGuide, ModelProvider, AgentStore, ToolRegistry, RolesPolicy, ApprovalPolicy, QuotaStore, TokenStreamSink, PromptBuilder, PromptContributor, Persona, ToolTransientRetrySetting, Retriever, AgentPricingStore, HistoryPolicy, InputProcessor, OutputProcessor, AgentIntake, SkillsConfig, MemoryConfig, ToolSpec, ToolHandler, createFunctionalTool, QuotaProvider, QuotaQuery, QuotaReport, ActionApprovalMode, BackgroundActorResolver, ActionProposal, TextActionProposalConfig, PriceCatalogOptions, ModelCatalog, EmptyRoles, ActorResolver, AgentHistoryWindow, SkillProvider, ScopeResolver, MemoryProvider, AgentRegistry, PersonaCatalogEntry, Actor, AttachmentStagingStore, ChatQueueStore, ChatQueueState, AgentRunner, AgentRunInput, AgentStreamEvent, QueuePauseReason } from '@dudousxd/nestjs-agent-core';
|
|
2
2
|
import { Catalog } from '@dudousxd/nestjs-agent-core/genui';
|
|
3
3
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
4
|
import { Provider, InjectionToken, Type, FactoryProvider, CanActivate, ModuleMetadata, OptionalFactoryDependency } from '@nestjs/common';
|
|
5
|
-
import {
|
|
5
|
+
import { GenuiCatalogResolver, AgentGenui } from './genui/index.js';
|
|
6
6
|
|
|
7
7
|
/** Everything `runAgentLoop` needs, minus the per-run `day` the runner stamps. */
|
|
8
8
|
interface AgentDeps {
|
|
9
9
|
resolveUiCatalog?: ResolveToolUiCatalog;
|
|
10
|
+
/** genui `channels`: the channel's prompt block, and what tool pushes were delivered as. */
|
|
11
|
+
uiChannelGuide?: ToolUiChannelGuide;
|
|
10
12
|
actionApprovalMode?: 'blocking' | 'independent';
|
|
11
13
|
model: ModelProvider;
|
|
12
14
|
store: AgentStore;
|
|
@@ -644,6 +646,7 @@ declare function delegateToolName(args: {
|
|
|
644
646
|
}): string;
|
|
645
647
|
/** Builds the per-agent loop deps. The single-agent case is just the one registered `@Agent`. */
|
|
646
648
|
declare class AgentDepsFactory {
|
|
649
|
+
#private;
|
|
647
650
|
private readonly options;
|
|
648
651
|
private readonly model;
|
|
649
652
|
private readonly store;
|
|
@@ -657,7 +660,8 @@ declare class AgentDepsFactory {
|
|
|
657
660
|
private readonly memory;
|
|
658
661
|
private readonly uiCatalog?;
|
|
659
662
|
private readonly uiCatalogResolver?;
|
|
660
|
-
|
|
663
|
+
private readonly genui?;
|
|
664
|
+
constructor(options: AgentModuleOptions, model: ModelProvider, store: AgentStore, sink: TokenStreamSink, rolesPolicy: RolesPolicy, registry: ToolRegistry, agents: AgentRegistry, promptContributors: PromptContributor[], pricingStore: AgentPricingStore | undefined, skills: SkillsConfig | undefined, memory: MemoryConfig | undefined, uiCatalog?: Catalog | undefined, uiCatalogResolver?: GenuiCatalogResolver | undefined, genui?: AgentGenui | undefined);
|
|
661
665
|
/** The turn's memory seam, shared with the read-back endpoint. Undefined → memory is not configured. */
|
|
662
666
|
memoryConfig(): MemoryConfig | undefined;
|
|
663
667
|
/** The turn's skills seam, shared with the listing endpoint. Undefined → skills are not configured. */
|
|
@@ -691,6 +695,10 @@ declare class AgentDepsFactory {
|
|
|
691
695
|
threadPersona?: string | null;
|
|
692
696
|
}): string | undefined;
|
|
693
697
|
forProposal(proposal: ActionProposal, _actor: Actor): AgentDeps;
|
|
698
|
+
/** The turn's UI catalog: the per-request resolver's, else the app's. */
|
|
699
|
+
private readonly resolveUiCatalog;
|
|
700
|
+
/** genui `channels`: what the model is told per channel. Built once; `undefined` without channels. */
|
|
701
|
+
private uiChannelGuide;
|
|
694
702
|
forAgent(agentName?: string): AgentDeps;
|
|
695
703
|
/**
|
|
696
704
|
* A persona baked into an agent's deps — how a run journaled under an agent name that a persona
|
package/dist/durable/index.cjs
CHANGED
|
@@ -386,6 +386,7 @@ var AgentRunSteps = class {
|
|
|
386
386
|
}
|
|
387
387
|
throw error;
|
|
388
388
|
}
|
|
389
|
+
output = await (0, import_nestjs_agent_core3.withChannelDelivery)(deps, input.ctx, output, ui.components());
|
|
389
390
|
return input.collectUi === true ? (0, import_nestjs_agent_core3.wrapToolStepOutput)(output, ui.components(), ui.text()) : output;
|
|
390
391
|
}
|
|
391
392
|
};
|
|
@@ -1322,7 +1323,7 @@ __name(provideAgentTools, "provideAgentTools");
|
|
|
1322
1323
|
|
|
1323
1324
|
// src/genui/agent-genui.token.ts
|
|
1324
1325
|
var AGENT_GENUI = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui");
|
|
1325
|
-
var
|
|
1326
|
+
var AgentGenui2 = class {
|
|
1326
1327
|
static {
|
|
1327
1328
|
__name(this, "AgentGenui");
|
|
1328
1329
|
}
|
|
@@ -1492,7 +1493,7 @@ function coreProviders(resolver) {
|
|
|
1492
1493
|
},
|
|
1493
1494
|
{
|
|
1494
1495
|
provide: AGENT_GENUI,
|
|
1495
|
-
useFactory: /* @__PURE__ */ __name((options, catalog, resolved, resolverInstance) => new
|
|
1496
|
+
useFactory: /* @__PURE__ */ __name((options, catalog, resolved, resolverInstance) => new AgentGenui2(catalog, perRequest(resolverInstance), resolved.channels, {
|
|
1496
1497
|
...options.mode !== void 0 ? {
|
|
1497
1498
|
mode: options.mode
|
|
1498
1499
|
} : {},
|
|
@@ -1628,7 +1629,8 @@ var AgentDepsFactory2 = class {
|
|
|
1628
1629
|
memory;
|
|
1629
1630
|
uiCatalog;
|
|
1630
1631
|
uiCatalogResolver;
|
|
1631
|
-
|
|
1632
|
+
genui;
|
|
1633
|
+
constructor(options, model, store, sink, rolesPolicy, registry, agents, promptContributors, pricingStore, skills, memory, uiCatalog, uiCatalogResolver, genui) {
|
|
1632
1634
|
this.options = options;
|
|
1633
1635
|
this.model = model;
|
|
1634
1636
|
this.store = store;
|
|
@@ -1642,6 +1644,7 @@ var AgentDepsFactory2 = class {
|
|
|
1642
1644
|
this.memory = memory;
|
|
1643
1645
|
this.uiCatalog = uiCatalog;
|
|
1644
1646
|
this.uiCatalogResolver = uiCatalogResolver;
|
|
1647
|
+
this.genui = genui;
|
|
1645
1648
|
if (options.actionApprovalMode === "independent") (0, import_nestjs_agent_core9.assertIndependentActionCapabilities)(store, options.backgroundActorResolver);
|
|
1646
1649
|
}
|
|
1647
1650
|
/** The turn's memory seam, shared with the read-back endpoint. Undefined → memory is not configured. */
|
|
@@ -1743,6 +1746,30 @@ var AgentDepsFactory2 = class {
|
|
|
1743
1746
|
}
|
|
1744
1747
|
return deps;
|
|
1745
1748
|
}
|
|
1749
|
+
/** The turn's UI catalog: the per-request resolver's, else the app's. */
|
|
1750
|
+
resolveUiCatalog = /* @__PURE__ */ __name((scope) => {
|
|
1751
|
+
const catalog = this.uiCatalogResolver?.resolve({
|
|
1752
|
+
...scope,
|
|
1753
|
+
...scope.actor.tenantRef !== void 0 ? {
|
|
1754
|
+
tenant: scope.actor.tenantRef
|
|
1755
|
+
} : {}
|
|
1756
|
+
}) ?? this.uiCatalog;
|
|
1757
|
+
if (!catalog) throw new Error("UI catalog unavailable");
|
|
1758
|
+
return catalog;
|
|
1759
|
+
}, "resolveUiCatalog");
|
|
1760
|
+
#uiChannelGuide;
|
|
1761
|
+
/** genui `channels`: what the model is told per channel. Built once; `undefined` without channels. */
|
|
1762
|
+
uiChannelGuide() {
|
|
1763
|
+
if (this.#uiChannelGuide === void 0) {
|
|
1764
|
+
const channels = this.genui?.channels;
|
|
1765
|
+
this.#uiChannelGuide = channels === void 0 || this.uiCatalog === void 0 && this.uiCatalogResolver === void 0 ? null : (0, import_nestjs_agent_core9.createToolUiChannelGuide)({
|
|
1766
|
+
channels,
|
|
1767
|
+
base: this.genui?.base ?? {},
|
|
1768
|
+
resolveCatalog: this.resolveUiCatalog
|
|
1769
|
+
});
|
|
1770
|
+
}
|
|
1771
|
+
return this.#uiChannelGuide ?? void 0;
|
|
1772
|
+
}
|
|
1746
1773
|
forAgent(agentName) {
|
|
1747
1774
|
const name = agentName ?? this.defaultAgentName();
|
|
1748
1775
|
if (agentName !== void 0 && !this.agents.has(agentName)) {
|
|
@@ -1758,6 +1785,7 @@ var AgentDepsFactory2 = class {
|
|
|
1758
1785
|
const retrieval = this.options.retrieval;
|
|
1759
1786
|
const historyPolicy = this.historyPolicy(definition);
|
|
1760
1787
|
const ask = definition?.ask ?? this.options.ask;
|
|
1788
|
+
const uiChannelGuide = this.uiChannelGuide();
|
|
1761
1789
|
return {
|
|
1762
1790
|
model: this.model,
|
|
1763
1791
|
store: this.store,
|
|
@@ -1771,16 +1799,10 @@ var AgentDepsFactory2 = class {
|
|
|
1771
1799
|
} : {},
|
|
1772
1800
|
registry: this.registry,
|
|
1773
1801
|
...this.uiCatalog !== void 0 || this.uiCatalogResolver !== void 0 ? {
|
|
1774
|
-
resolveUiCatalog:
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
tenant: scope.actor.tenantRef
|
|
1779
|
-
} : {}
|
|
1780
|
-
}) ?? this.uiCatalog;
|
|
1781
|
-
if (!catalog) throw new Error("UI catalog unavailable");
|
|
1782
|
-
return catalog;
|
|
1783
|
-
}, "resolveUiCatalog")
|
|
1802
|
+
resolveUiCatalog: this.resolveUiCatalog
|
|
1803
|
+
} : {},
|
|
1804
|
+
...uiChannelGuide !== void 0 ? {
|
|
1805
|
+
uiChannelGuide
|
|
1784
1806
|
} : {},
|
|
1785
1807
|
promptContributors: this.promptContributors,
|
|
1786
1808
|
systemPrompt: definition?.systemPrompt ?? this.options.systemPrompt ?? "You are a helpful assistant.",
|
|
@@ -1951,6 +1973,8 @@ AgentDepsFactory2 = _ts_decorate6([
|
|
|
1951
1973
|
_ts_param4(11, (0, import_common6.Optional)()),
|
|
1952
1974
|
_ts_param4(11, (0, import_common6.Inject)(GENUI_CATALOG)),
|
|
1953
1975
|
_ts_param4(12, (0, import_common6.Optional)()),
|
|
1976
|
+
_ts_param4(13, (0, import_common6.Optional)()),
|
|
1977
|
+
_ts_param4(13, (0, import_common6.Inject)(AGENT_GENUI)),
|
|
1954
1978
|
_ts_metadata4("design:type", Function),
|
|
1955
1979
|
_ts_metadata4("design:paramtypes", [
|
|
1956
1980
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
@@ -1965,7 +1989,8 @@ AgentDepsFactory2 = _ts_decorate6([
|
|
|
1965
1989
|
Object,
|
|
1966
1990
|
Object,
|
|
1967
1991
|
typeof Catalog === "undefined" ? Object : Catalog,
|
|
1968
|
-
typeof GenuiCatalogResolver === "undefined" ? Object : GenuiCatalogResolver
|
|
1992
|
+
typeof GenuiCatalogResolver === "undefined" ? Object : GenuiCatalogResolver,
|
|
1993
|
+
typeof AgentGenui === "undefined" ? Object : AgentGenui
|
|
1969
1994
|
])
|
|
1970
1995
|
], AgentDepsFactory2);
|
|
1971
1996
|
|