@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/durable/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AgentStore, AgentRunInput, AgentLoopResult, LlmStepEnvelope, BufferedModelTurnResult, ToolStepEnvelope, AgentRunner, TokenStreamSink, AgentRunStartOptions, HumanReply } from '@dudousxd/nestjs-agent-core';
|
|
2
2
|
import { WorkflowService } from '@dudousxd/nestjs-durable';
|
|
3
3
|
import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
|
|
4
|
-
import { A as AgentDepsFactory, C as ChatQueueService, a as AgentSurface, b as AgentModuleOptions } from '../chat-queue.service-
|
|
4
|
+
import { A as AgentDepsFactory, C as ChatQueueService, a as AgentSurface, b as AgentModuleOptions } from '../chat-queue.service-QIuTS-5c.cjs';
|
|
5
5
|
import { DynamicModule } from '@nestjs/common';
|
|
6
6
|
import '@dudousxd/nestjs-agent-core/genui';
|
|
7
7
|
import '@standard-schema/spec';
|
|
8
|
-
import '../
|
|
8
|
+
import '../genui/index.cjs';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The agent turn AS a durable workflow. Persist/stream checkpoints are `ctx.localStep`s — the
|
package/dist/durable/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AgentStore, AgentRunInput, AgentLoopResult, LlmStepEnvelope, BufferedModelTurnResult, ToolStepEnvelope, AgentRunner, TokenStreamSink, AgentRunStartOptions, HumanReply } from '@dudousxd/nestjs-agent-core';
|
|
2
2
|
import { WorkflowService } from '@dudousxd/nestjs-durable';
|
|
3
3
|
import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
|
|
4
|
-
import { A as AgentDepsFactory, C as ChatQueueService, a as AgentSurface, b as AgentModuleOptions } from '../chat-queue.service-
|
|
4
|
+
import { A as AgentDepsFactory, C as ChatQueueService, a as AgentSurface, b as AgentModuleOptions } from '../chat-queue.service-wNWaoUN8.js';
|
|
5
5
|
import { DynamicModule } from '@nestjs/common';
|
|
6
6
|
import '@dudousxd/nestjs-agent-core/genui';
|
|
7
7
|
import '@standard-schema/spec';
|
|
8
|
-
import '../
|
|
8
|
+
import '../genui/index.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The agent turn AS a durable workflow. Persist/stream checkpoints are `ctx.localStep`s — the
|
package/dist/durable/index.js
CHANGED
|
@@ -93,7 +93,7 @@ var AGENT_CHAT_QUEUE = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:chat-q
|
|
|
93
93
|
// src/durable/agent-run.steps.ts
|
|
94
94
|
import { createNegotiatedUiCollector } from "@dudousxd/nestjs-agent-core";
|
|
95
95
|
import { prepareActionProposal, resolveActionProposalApproval } from "@dudousxd/nestjs-agent-core";
|
|
96
|
-
import { AGENT_DEPS_FACTORY, createFrameBuffer, createNoopEmitUi, encodeStreamEvent, intersectAllowLists, invokeWithTransientRetry, isControlFlowSignal, isReplayIntegrityError, observeTurnFrames, previewToolInputs, publishAgentToolRetry, registryInputPreviews, stampToolKinds, toolCallContext, traceLlmTurn, traceToolExecution, withAskTool, withMemoryTool, withSkillTool, withToolTimeout, withTurnFrames, wrapToolPreflightDenied, wrapToolStepOutput } from "@dudousxd/nestjs-agent-core";
|
|
96
|
+
import { AGENT_DEPS_FACTORY, createFrameBuffer, createNoopEmitUi, encodeStreamEvent, intersectAllowLists, invokeWithTransientRetry, isControlFlowSignal, isReplayIntegrityError, observeTurnFrames, previewToolInputs, publishAgentToolRetry, registryInputPreviews, stampToolKinds, toolCallContext, traceLlmTurn, traceToolExecution, withAskTool, withChannelDelivery, withMemoryTool, withSkillTool, withToolTimeout, withTurnFrames, wrapToolPreflightDenied, wrapToolStepOutput } from "@dudousxd/nestjs-agent-core";
|
|
97
97
|
import { turnChannel } from "@dudousxd/nestjs-agent-core/genui";
|
|
98
98
|
import { Step } from "@dudousxd/nestjs-durable";
|
|
99
99
|
import { Inject, Injectable } from "@nestjs/common";
|
|
@@ -353,6 +353,7 @@ var AgentRunSteps = class {
|
|
|
353
353
|
}
|
|
354
354
|
throw error;
|
|
355
355
|
}
|
|
356
|
+
output = await withChannelDelivery(deps, input.ctx, output, ui.components());
|
|
356
357
|
return input.collectUi === true ? wrapToolStepOutput(output, ui.components(), ui.text()) : output;
|
|
357
358
|
}
|
|
358
359
|
};
|
|
@@ -1254,7 +1255,7 @@ import { Global as Global2, Logger as Logger10, Module as Module3 } from "@nestj
|
|
|
1254
1255
|
import { DiscoveryModule, ModulesContainer, RouterModule } from "@nestjs/core";
|
|
1255
1256
|
|
|
1256
1257
|
// src/agent-deps.factory.ts
|
|
1257
|
-
import { assertIndependentActionCapabilities } from "@dudousxd/nestjs-agent-core";
|
|
1258
|
+
import { assertIndependentActionCapabilities, createToolUiChannelGuide } from "@dudousxd/nestjs-agent-core";
|
|
1258
1259
|
import { AGENT_MEMORY, AGENT_MODEL, AGENT_PRICING_STORE, AGENT_PROMPT_CONTRIBUTORS, AGENT_REGISTRY, AGENT_ROLES_POLICY, AGENT_SINK as AGENT_SINK2, AGENT_SKILLS, AGENT_STORE as AGENT_STORE3, AGENT_TOOL_REGISTRY, AgentRegistry as AgentRegistry2, ToolRegistry as ToolRegistry2, findPersona, intersectAllowLists as intersectAllowLists2, normalizeDelegation, personaCatalogEntry, resolvePersonaAlias, summarizeWithModel, windowHistory } from "@dudousxd/nestjs-agent-core";
|
|
1259
1260
|
import { AGENT_OPTIONS } from "@dudousxd/nestjs-agent-core";
|
|
1260
1261
|
import { BadRequestException, Inject as Inject5, Injectable as Injectable4, Optional as Optional3 } from "@nestjs/common";
|
|
@@ -1289,7 +1290,7 @@ __name(provideAgentTools, "provideAgentTools");
|
|
|
1289
1290
|
|
|
1290
1291
|
// src/genui/agent-genui.token.ts
|
|
1291
1292
|
var AGENT_GENUI = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui");
|
|
1292
|
-
var
|
|
1293
|
+
var AgentGenui2 = class {
|
|
1293
1294
|
static {
|
|
1294
1295
|
__name(this, "AgentGenui");
|
|
1295
1296
|
}
|
|
@@ -1459,7 +1460,7 @@ function coreProviders(resolver) {
|
|
|
1459
1460
|
},
|
|
1460
1461
|
{
|
|
1461
1462
|
provide: AGENT_GENUI,
|
|
1462
|
-
useFactory: /* @__PURE__ */ __name((options, catalog, resolved, resolverInstance) => new
|
|
1463
|
+
useFactory: /* @__PURE__ */ __name((options, catalog, resolved, resolverInstance) => new AgentGenui2(catalog, perRequest(resolverInstance), resolved.channels, {
|
|
1463
1464
|
...options.mode !== void 0 ? {
|
|
1464
1465
|
mode: options.mode
|
|
1465
1466
|
} : {},
|
|
@@ -1595,7 +1596,8 @@ var AgentDepsFactory2 = class {
|
|
|
1595
1596
|
memory;
|
|
1596
1597
|
uiCatalog;
|
|
1597
1598
|
uiCatalogResolver;
|
|
1598
|
-
|
|
1599
|
+
genui;
|
|
1600
|
+
constructor(options, model, store, sink, rolesPolicy, registry, agents, promptContributors, pricingStore, skills, memory, uiCatalog, uiCatalogResolver, genui) {
|
|
1599
1601
|
this.options = options;
|
|
1600
1602
|
this.model = model;
|
|
1601
1603
|
this.store = store;
|
|
@@ -1609,6 +1611,7 @@ var AgentDepsFactory2 = class {
|
|
|
1609
1611
|
this.memory = memory;
|
|
1610
1612
|
this.uiCatalog = uiCatalog;
|
|
1611
1613
|
this.uiCatalogResolver = uiCatalogResolver;
|
|
1614
|
+
this.genui = genui;
|
|
1612
1615
|
if (options.actionApprovalMode === "independent") assertIndependentActionCapabilities(store, options.backgroundActorResolver);
|
|
1613
1616
|
}
|
|
1614
1617
|
/** The turn's memory seam, shared with the read-back endpoint. Undefined → memory is not configured. */
|
|
@@ -1710,6 +1713,30 @@ var AgentDepsFactory2 = class {
|
|
|
1710
1713
|
}
|
|
1711
1714
|
return deps;
|
|
1712
1715
|
}
|
|
1716
|
+
/** The turn's UI catalog: the per-request resolver's, else the app's. */
|
|
1717
|
+
resolveUiCatalog = /* @__PURE__ */ __name((scope) => {
|
|
1718
|
+
const catalog = this.uiCatalogResolver?.resolve({
|
|
1719
|
+
...scope,
|
|
1720
|
+
...scope.actor.tenantRef !== void 0 ? {
|
|
1721
|
+
tenant: scope.actor.tenantRef
|
|
1722
|
+
} : {}
|
|
1723
|
+
}) ?? this.uiCatalog;
|
|
1724
|
+
if (!catalog) throw new Error("UI catalog unavailable");
|
|
1725
|
+
return catalog;
|
|
1726
|
+
}, "resolveUiCatalog");
|
|
1727
|
+
#uiChannelGuide;
|
|
1728
|
+
/** genui `channels`: what the model is told per channel. Built once; `undefined` without channels. */
|
|
1729
|
+
uiChannelGuide() {
|
|
1730
|
+
if (this.#uiChannelGuide === void 0) {
|
|
1731
|
+
const channels = this.genui?.channels;
|
|
1732
|
+
this.#uiChannelGuide = channels === void 0 || this.uiCatalog === void 0 && this.uiCatalogResolver === void 0 ? null : createToolUiChannelGuide({
|
|
1733
|
+
channels,
|
|
1734
|
+
base: this.genui?.base ?? {},
|
|
1735
|
+
resolveCatalog: this.resolveUiCatalog
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
return this.#uiChannelGuide ?? void 0;
|
|
1739
|
+
}
|
|
1713
1740
|
forAgent(agentName) {
|
|
1714
1741
|
const name = agentName ?? this.defaultAgentName();
|
|
1715
1742
|
if (agentName !== void 0 && !this.agents.has(agentName)) {
|
|
@@ -1725,6 +1752,7 @@ var AgentDepsFactory2 = class {
|
|
|
1725
1752
|
const retrieval = this.options.retrieval;
|
|
1726
1753
|
const historyPolicy = this.historyPolicy(definition);
|
|
1727
1754
|
const ask = definition?.ask ?? this.options.ask;
|
|
1755
|
+
const uiChannelGuide = this.uiChannelGuide();
|
|
1728
1756
|
return {
|
|
1729
1757
|
model: this.model,
|
|
1730
1758
|
store: this.store,
|
|
@@ -1738,16 +1766,10 @@ var AgentDepsFactory2 = class {
|
|
|
1738
1766
|
} : {},
|
|
1739
1767
|
registry: this.registry,
|
|
1740
1768
|
...this.uiCatalog !== void 0 || this.uiCatalogResolver !== void 0 ? {
|
|
1741
|
-
resolveUiCatalog:
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
tenant: scope.actor.tenantRef
|
|
1746
|
-
} : {}
|
|
1747
|
-
}) ?? this.uiCatalog;
|
|
1748
|
-
if (!catalog) throw new Error("UI catalog unavailable");
|
|
1749
|
-
return catalog;
|
|
1750
|
-
}, "resolveUiCatalog")
|
|
1769
|
+
resolveUiCatalog: this.resolveUiCatalog
|
|
1770
|
+
} : {},
|
|
1771
|
+
...uiChannelGuide !== void 0 ? {
|
|
1772
|
+
uiChannelGuide
|
|
1751
1773
|
} : {},
|
|
1752
1774
|
promptContributors: this.promptContributors,
|
|
1753
1775
|
systemPrompt: definition?.systemPrompt ?? this.options.systemPrompt ?? "You are a helpful assistant.",
|
|
@@ -1918,6 +1940,8 @@ AgentDepsFactory2 = _ts_decorate6([
|
|
|
1918
1940
|
_ts_param4(11, Optional3()),
|
|
1919
1941
|
_ts_param4(11, Inject5(GENUI_CATALOG)),
|
|
1920
1942
|
_ts_param4(12, Optional3()),
|
|
1943
|
+
_ts_param4(13, Optional3()),
|
|
1944
|
+
_ts_param4(13, Inject5(AGENT_GENUI)),
|
|
1921
1945
|
_ts_metadata4("design:type", Function),
|
|
1922
1946
|
_ts_metadata4("design:paramtypes", [
|
|
1923
1947
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
@@ -1932,7 +1956,8 @@ AgentDepsFactory2 = _ts_decorate6([
|
|
|
1932
1956
|
Object,
|
|
1933
1957
|
Object,
|
|
1934
1958
|
typeof Catalog === "undefined" ? Object : Catalog,
|
|
1935
|
-
typeof GenuiCatalogResolver === "undefined" ? Object : GenuiCatalogResolver
|
|
1959
|
+
typeof GenuiCatalogResolver === "undefined" ? Object : GenuiCatalogResolver,
|
|
1960
|
+
typeof AgentGenui === "undefined" ? Object : AgentGenui
|
|
1936
1961
|
])
|
|
1937
1962
|
], AgentDepsFactory2);
|
|
1938
1963
|
|