@dudousxd/nestjs-agent 2.0.1 → 2.1.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/a2ui/index.d.cts +3 -3
- package/dist/a2ui/index.d.ts +3 -3
- package/dist/{chat-queue.service-BjPCw4Pf.d.ts → chat-queue.service-MYNBAY3P.d.ts} +24 -2
- package/dist/{chat-queue.service-C49HIuEV.d.cts → chat-queue.service-OY6mUgB9.d.cts} +24 -2
- package/dist/durable/index.cjs +241 -111
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.d.cts +1 -1
- package/dist/durable/index.d.ts +1 -1
- package/dist/durable/index.js +176 -46
- package/dist/durable/index.js.map +1 -1
- package/dist/{index-BBkyvNUi.d.cts → index-Ba_0o9Ze.d.ts} +33 -5
- package/dist/{index-CRCbsO6E.d.ts → index-QYQiIXCI.d.cts} +33 -5
- package/dist/index.cjs +249 -119
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +181 -51
- package/dist/index.js.map +1 -1
- package/dist/workflows/index.cjs.map +1 -1
- package/dist/workflows/index.d.cts +1 -1
- package/dist/workflows/index.d.ts +1 -1
- package/dist/workflows/index.js.map +1 -1
- package/package.json +7 -7
package/dist/a2ui/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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-QYQiIXCI.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-C49HIuEV.cjs';
|
|
7
|
-
import '@standard-schema/spec';
|
|
8
6
|
import '@nestjs/common';
|
|
7
|
+
import '../chat-queue.service-OY6mUgB9.cjs';
|
|
8
|
+
import '@standard-schema/spec';
|
|
9
9
|
import '@nestjs/ai';
|
|
10
10
|
import '../genui/index.cjs';
|
package/dist/a2ui/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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-Ba_0o9Ze.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-BjPCw4Pf.js';
|
|
7
|
-
import '@standard-schema/spec';
|
|
8
6
|
import '@nestjs/common';
|
|
7
|
+
import '../chat-queue.service-MYNBAY3P.js';
|
|
8
|
+
import '@standard-schema/spec';
|
|
9
9
|
import '@nestjs/ai';
|
|
10
10
|
import '../genui/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
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, Actor, AiToolCtx, ActionApprovalMode, BackgroundActorResolver, ActionProposal, ActionProposalOutcome, TextActionProposalConfig, PriceCatalogOptions, ModelCatalog, EmptyRoles, ActorResolver, AgentHistoryWindow, SkillProvider, ScopeResolver, MemoryProvider, AgentRegistry, PersonaCatalogEntry, 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, Actor, AiToolCtx, ActionApprovalMode, BackgroundActorResolver, ActionProposal, ActionProposalOutcome, TextActionProposalConfig, PriceCatalogOptions, TenancyOption, ModelCatalog, EmptyRoles, ActorResolver, AgentHistoryWindow, SkillProvider, ScopeResolver, MemoryProvider, AgentRegistry, PersonaCatalogEntry, 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, ModuleMetadata, OptionalFactoryDependency } from '@nestjs/common';
|
|
@@ -142,8 +142,16 @@ interface QuotaLimits {
|
|
|
142
142
|
day?: QuotaWindowLimits;
|
|
143
143
|
month?: QuotaWindowLimits;
|
|
144
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Whose spend a window sums: the actor's own (`'actor'`, the default), every actor's in the actor's
|
|
147
|
+
* tenant (`'tenant'`), or the actor's own within that tenant (`'actor-in-tenant'`). The tenant is
|
|
148
|
+
* `Actor.tenantRef`; an actor without one is counted per actor.
|
|
149
|
+
*/
|
|
150
|
+
type QuotaPer = 'actor' | 'tenant' | 'actor-in-tenant';
|
|
145
151
|
/** {@link LedgerQuotaProvider}'s tuning beyond the ceilings. */
|
|
146
152
|
interface LedgerQuotaOptions {
|
|
153
|
+
/** See {@link QuotaPer}. Default `'actor'`. Needs a store with `usageWindowsForTenant` otherwise. */
|
|
154
|
+
per?: QuotaPer;
|
|
147
155
|
/**
|
|
148
156
|
* The soft limit: the share of a ceiling (`0..1`) past which the report carries a `warning`.
|
|
149
157
|
* Stamped on every window that has a ceiling. Omit → no warnings.
|
|
@@ -164,7 +172,7 @@ interface LedgerQuotaOptions {
|
|
|
164
172
|
* - `month` — when the store implements `usageBetween` or `usageWindows`.
|
|
165
173
|
*
|
|
166
174
|
* `limits` add ceilings per window (tokens and/or USD). A window that reaches one makes the report
|
|
167
|
-
* `blocked`.
|
|
175
|
+
* `blocked`. `options.per` sums the windows by tenant instead of by actor (see {@link QuotaPer}).
|
|
168
176
|
*/
|
|
169
177
|
declare class LedgerQuotaProvider implements QuotaProvider {
|
|
170
178
|
private readonly store;
|
|
@@ -449,12 +457,26 @@ interface AgentModuleOptions {
|
|
|
449
457
|
* provider that reports none (marked `cost_source = 'estimate'`). `countEstimatedCost: false` counts
|
|
450
458
|
* reported cost only. The default (`true`) is there because otherwise a USD ceiling on Bedrock /
|
|
451
459
|
* OpenAI / Anthropic direct would read $0 and never block.
|
|
460
|
+
*
|
|
461
|
+
* `per` picks whose spend the windows sum: `'actor'` (default) the actor's own; `'tenant'` every
|
|
462
|
+
* actor's in the actor's tenant (`Actor.tenantRef`); `'actor-in-tenant'` the actor's own within
|
|
463
|
+
* that tenant. An actor with no tenant is counted per actor.
|
|
452
464
|
*/
|
|
453
465
|
quota?: {
|
|
454
466
|
limits: QuotaLimits;
|
|
455
467
|
warnAt?: number;
|
|
456
468
|
countEstimatedCost?: boolean;
|
|
469
|
+
per?: QuotaPer;
|
|
457
470
|
} | QuotaProvider;
|
|
471
|
+
/**
|
|
472
|
+
* Scope the agent by the request's tenant (from `@dudousxd/nestjs-context`). Default
|
|
473
|
+
* `'inherit'`: follow `ContextModule`'s `tenancy.enabled`, which is off by default. With tenancy
|
|
474
|
+
* on, an actor the `actorResolver` resolved without a `tenantRef` gets the context tenant's id,
|
|
475
|
+
* `recordUsage` records it when the input names none, and thread and run reads (and the governance
|
|
476
|
+
* dashboard) see only the request tenant's rows: another tenant's thread or run answers `404`.
|
|
477
|
+
* A `tenantRef` your resolver sets always wins. `false` keeps the agent out of tenancy.
|
|
478
|
+
*/
|
|
479
|
+
tenancy?: TenancyOption;
|
|
458
480
|
/**
|
|
459
481
|
* Which models a caller may pick — `GET <base>/models`, a send's `model`, a thread's pinned model
|
|
460
482
|
* (`PATCH <base>/threads/:id { model }`). Omit → the catalog the model provider carries
|
|
@@ -1,4 +1,4 @@
|
|
|
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, Actor, AiToolCtx, ActionApprovalMode, BackgroundActorResolver, ActionProposal, ActionProposalOutcome, TextActionProposalConfig, PriceCatalogOptions, ModelCatalog, EmptyRoles, ActorResolver, AgentHistoryWindow, SkillProvider, ScopeResolver, MemoryProvider, AgentRegistry, PersonaCatalogEntry, 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, Actor, AiToolCtx, ActionApprovalMode, BackgroundActorResolver, ActionProposal, ActionProposalOutcome, TextActionProposalConfig, PriceCatalogOptions, TenancyOption, ModelCatalog, EmptyRoles, ActorResolver, AgentHistoryWindow, SkillProvider, ScopeResolver, MemoryProvider, AgentRegistry, PersonaCatalogEntry, 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, ModuleMetadata, OptionalFactoryDependency } from '@nestjs/common';
|
|
@@ -142,8 +142,16 @@ interface QuotaLimits {
|
|
|
142
142
|
day?: QuotaWindowLimits;
|
|
143
143
|
month?: QuotaWindowLimits;
|
|
144
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Whose spend a window sums: the actor's own (`'actor'`, the default), every actor's in the actor's
|
|
147
|
+
* tenant (`'tenant'`), or the actor's own within that tenant (`'actor-in-tenant'`). The tenant is
|
|
148
|
+
* `Actor.tenantRef`; an actor without one is counted per actor.
|
|
149
|
+
*/
|
|
150
|
+
type QuotaPer = 'actor' | 'tenant' | 'actor-in-tenant';
|
|
145
151
|
/** {@link LedgerQuotaProvider}'s tuning beyond the ceilings. */
|
|
146
152
|
interface LedgerQuotaOptions {
|
|
153
|
+
/** See {@link QuotaPer}. Default `'actor'`. Needs a store with `usageWindowsForTenant` otherwise. */
|
|
154
|
+
per?: QuotaPer;
|
|
147
155
|
/**
|
|
148
156
|
* The soft limit: the share of a ceiling (`0..1`) past which the report carries a `warning`.
|
|
149
157
|
* Stamped on every window that has a ceiling. Omit → no warnings.
|
|
@@ -164,7 +172,7 @@ interface LedgerQuotaOptions {
|
|
|
164
172
|
* - `month` — when the store implements `usageBetween` or `usageWindows`.
|
|
165
173
|
*
|
|
166
174
|
* `limits` add ceilings per window (tokens and/or USD). A window that reaches one makes the report
|
|
167
|
-
* `blocked`.
|
|
175
|
+
* `blocked`. `options.per` sums the windows by tenant instead of by actor (see {@link QuotaPer}).
|
|
168
176
|
*/
|
|
169
177
|
declare class LedgerQuotaProvider implements QuotaProvider {
|
|
170
178
|
private readonly store;
|
|
@@ -449,12 +457,26 @@ interface AgentModuleOptions {
|
|
|
449
457
|
* provider that reports none (marked `cost_source = 'estimate'`). `countEstimatedCost: false` counts
|
|
450
458
|
* reported cost only. The default (`true`) is there because otherwise a USD ceiling on Bedrock /
|
|
451
459
|
* OpenAI / Anthropic direct would read $0 and never block.
|
|
460
|
+
*
|
|
461
|
+
* `per` picks whose spend the windows sum: `'actor'` (default) the actor's own; `'tenant'` every
|
|
462
|
+
* actor's in the actor's tenant (`Actor.tenantRef`); `'actor-in-tenant'` the actor's own within
|
|
463
|
+
* that tenant. An actor with no tenant is counted per actor.
|
|
452
464
|
*/
|
|
453
465
|
quota?: {
|
|
454
466
|
limits: QuotaLimits;
|
|
455
467
|
warnAt?: number;
|
|
456
468
|
countEstimatedCost?: boolean;
|
|
469
|
+
per?: QuotaPer;
|
|
457
470
|
} | QuotaProvider;
|
|
471
|
+
/**
|
|
472
|
+
* Scope the agent by the request's tenant (from `@dudousxd/nestjs-context`). Default
|
|
473
|
+
* `'inherit'`: follow `ContextModule`'s `tenancy.enabled`, which is off by default. With tenancy
|
|
474
|
+
* on, an actor the `actorResolver` resolved without a `tenantRef` gets the context tenant's id,
|
|
475
|
+
* `recordUsage` records it when the input names none, and thread and run reads (and the governance
|
|
476
|
+
* dashboard) see only the request tenant's rows: another tenant's thread or run answers `404`.
|
|
477
|
+
* A `tenantRef` your resolver sets always wins. `false` keeps the agent out of tenancy.
|
|
478
|
+
*/
|
|
479
|
+
tenancy?: TenancyOption;
|
|
458
480
|
/**
|
|
459
481
|
* Which models a caller may pick — `GET <base>/models`, a send's `model`, a thread's pinned model
|
|
460
482
|
* (`PATCH <base>/threads/:id { model }`). Omit → the catalog the model provider carries
|