@dudousxd/nestjs-agent 1.21.0 → 1.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/index.d.cts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { DynamicModule, Type, OnApplicationBootstrap, OnModuleInit, ConflictException, OnModuleDestroy } from '@nestjs/common';
2
- import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter, e as AgentSkillsOptions } from './chat-queue.service-CGsR40Ct.cjs';
3
- export { f as AGENT_TOOL_BRAND, g as AgentAttachmentsOptions, h as AgentDeps, i as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, L as LedgerQuotaProvider, Q as QueuePlan, j as QueueSettleOutcome, k as QueuedTurn, l as QueuedTurnStarter, m as QuotaLimits, n as QuotaWindowLimits, o as delegateToolName, p as provideAgentTool, q as provideAgentTools, u as utcDay } from './chat-queue.service-CGsR40Ct.cjs';
2
+ import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter, e as AgentSkillsOptions } from './chat-queue.service-Dx9OsjcF.cjs';
3
+ export { f as AGENT_TOOL_BRAND, g as AgentAttachmentsOptions, h as AgentDeps, i as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, L as LedgerQuotaProvider, Q as QueuePlan, j as QueueSettleOutcome, k as QueuedTurn, l as QueuedTurnStarter, m as QuotaLimits, n as QuotaWindowLimits, o as defineTool, p as delegateToolName, q as provideAgentTool, r as provideAgentTools, u as utcDay } from './chat-queue.service-Dx9OsjcF.cjs';
4
4
  import * as _dudousxd_nestjs_agent_core from '@dudousxd/nestjs-agent-core';
5
- import { AgentStore, Actor, ListActionProposals, ActionProposalMutationResult, AgentRunner, AttachmentStagingStore, ModelCatalog, QuotaProvider, QuotaReport, ModelCatalogView, AttachmentRef, PageContext, ChatQueueState, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, ActorResolver, AgentApprovalPort, MessageAttachment, AgentAttachmentConfig, AgentClientConfig, ToolSpec, ToolPresentation, AgentHistoryWindow, AgentIntake, Persona, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, AgentRunStartOptions, TokenStreamSink, SinkWriter } from '@dudousxd/nestjs-agent-core';
5
+ import { AgentStore, Actor, ListActionProposals, ActionProposalMutationView, AgentRunner, AttachmentStagingStore, ModelCatalog, QuotaProvider, QuotaReport, ModelCatalogView, AttachmentRef, PageContext, ChatQueueState, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, ActorResolver, AgentApprovalPort, MessageAttachment, AgentAttachmentConfig, AgentClientConfig, ToolSpec, ToolPresentation, AgentHistoryWindow, AgentIntake, Persona, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, AgentRunStartOptions, TokenStreamSink, SinkWriter } from '@dudousxd/nestjs-agent-core';
6
6
  export * from '@dudousxd/nestjs-agent-core';
7
+ export { FunctionalToolDefinition } from '@dudousxd/nestjs-agent-core';
7
8
  import { Request, Response } from 'express';
8
9
  import { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
9
10
  import { StandardSchemaV1 } from '@standard-schema/spec';
@@ -18,7 +19,10 @@ declare class AgentModule {
18
19
  declare class ActionProposalService {
19
20
  private readonly store;
20
21
  private readonly options;
21
- constructor(store: AgentStore, options: Pick<AgentModuleOptions, 'approvalPolicy'>);
22
+ constructor(store: AgentStore, options: Pick<AgentModuleOptions, 'approvalPolicy' | 'actionProposalText'>);
23
+ /** The words a text decision is made of, and what the agent answers — English unless configured. */
24
+ private readonly vocabulary;
25
+ private readonly replies;
22
26
  private capability;
23
27
  private scope;
24
28
  private mayDecide;
@@ -27,20 +31,20 @@ declare class ActionProposalService {
27
31
  createdAt: number;
28
32
  id: string;
29
33
  };
30
- items: _dudousxd_nestjs_agent_core.ActionProposal[];
34
+ items: _dudousxd_nestjs_agent_core.ActionProposalView[];
31
35
  }>;
32
- list(threadId: string, actor: Actor): Promise<_dudousxd_nestjs_agent_core.ActionProposal[]>;
36
+ list(threadId: string, actor: Actor): Promise<_dudousxd_nestjs_agent_core.ActionProposalView[]>;
33
37
  decide(threadId: string, proposalId: string, actor: Actor, command: {
34
38
  decision: 'approved' | 'rejected';
35
39
  remember?: boolean;
36
40
  reason?: string;
37
41
  via?: string;
38
- }): Promise<ActionProposalMutationResult>;
42
+ }): Promise<ActionProposalMutationView>;
39
43
  handleTextDecision(threadId: string, actor: Actor, text: string): Promise<{
40
44
  status: "unmatched";
41
45
  } | {
42
46
  threadId: string;
43
- proposalDecision: ActionProposalMutationResult;
47
+ proposalDecision: ActionProposalMutationView;
44
48
  text: string;
45
49
  } | {
46
50
  threadId: string;
@@ -51,6 +55,8 @@ declare class ActionProposalService {
51
55
  text: string;
52
56
  }>;
53
57
  private textReceipt;
58
+ /** The configured reply to a decision the store answered with `result`. */
59
+ reply(result: ActionProposalMutationView, decision: 'approved' | 'rejected'): string;
54
60
  }
55
61
 
56
62
  /**
@@ -152,11 +158,25 @@ declare class AgentService {
152
158
  private readonly queue?;
153
159
  private readonly proposals?;
154
160
  constructor(runner: AgentRunner, store: AgentStore, deps: AgentDepsFactory, staging?: AttachmentStagingStore | undefined, models?: ModelCatalog | undefined, quotaProvider?: QuotaProvider | undefined, options?: Pick<AgentModuleOptions, "quota" | "actionApprovalMode"> | undefined, queue?: ChatQueueService | undefined, proposals?: ActionProposalService | undefined);
161
+ /**
162
+ * Decide one independent proposal through the scoped proposal service — what the native
163
+ * `action-proposals/:id/approve|reject` routes call — and the reply to show for it. `404` when
164
+ * proposals are not on, `403`/`404` when this actor may not decide it.
165
+ */
166
+ decideActionProposal(actor: Actor, threadId: string, proposalId: string, command: {
167
+ decision: 'approved' | 'rejected';
168
+ remember?: boolean;
169
+ reason?: string;
170
+ via: string;
171
+ }): Promise<{
172
+ proposalDecision: ActionProposalMutationView;
173
+ text: string;
174
+ }>;
155
175
  handleTextDecision(threadId: string, actor: Actor, text: string): Promise<{
156
176
  status: "unmatched";
157
177
  } | {
158
178
  threadId: string;
159
- proposalDecision: _dudousxd_nestjs_agent_core.ActionProposalMutationResult;
179
+ proposalDecision: ActionProposalMutationView;
160
180
  text: string;
161
181
  } | {
162
182
  threadId: string;
@@ -520,6 +540,15 @@ declare class AgUiRunHandler {
520
540
  * bad entry settles nothing.
521
541
  */
522
542
  private settle;
543
+ /**
544
+ * Decide independent proposals through the proposal service — the call the native
545
+ * `action-proposals/:id/approve|reject` routes make — never by signalling the origin run, which
546
+ * is not waiting. Every payload is checked before the first decision; a refusal is the service's
547
+ * own `403`/`404`.
548
+ */
549
+ private decideProposals;
550
+ /** Answer with a complete list of events, no run behind them. */
551
+ private writeEvents;
523
552
  /**
524
553
  * Pipe a run to the client as AG-UI 1.0 over SSE: one event per `data:` line, from `RUN_STARTED`
525
554
  * to the run's terminal event. It ends when the run stops to ask — the library run stays parked,
@@ -565,7 +594,7 @@ declare class AgentApprovalPortAdapter implements AgentApprovalPort {
565
594
  }, opts?: {
566
595
  remember?: boolean;
567
596
  decidedVia?: string;
568
- }): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationResult>;
597
+ }): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationView>;
569
598
  rejectActionProposal(actor: Actor, target: {
570
599
  kind: 'proposal';
571
600
  threadId: string;
@@ -573,7 +602,7 @@ declare class AgentApprovalPortAdapter implements AgentApprovalPort {
573
602
  }, opts?: {
574
603
  reason?: string;
575
604
  decidedVia?: string;
576
- }): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationResult>;
605
+ }): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationView>;
577
606
  approve(toolCallId: string, opts?: {
578
607
  executedByRef?: string;
579
608
  remember?: boolean;
@@ -1420,9 +1449,9 @@ declare class ActionProposalController {
1420
1449
  private readonly proposals;
1421
1450
  private readonly actors;
1422
1451
  constructor(proposals: ActionProposalService, actors: ActorResolver);
1423
- list(threadId: string, request: Request, cursor: unknown, response: Response): Promise<_dudousxd_nestjs_agent_core.ActionProposal[]>;
1424
- approve(threadId: string, proposalId: string, request: Request, body: unknown): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationResult>;
1425
- reject(threadId: string, proposalId: string, request: Request, body: unknown): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationResult>;
1452
+ list(threadId: string, request: Request, cursor: unknown, response: Response): Promise<_dudousxd_nestjs_agent_core.ActionProposalView[]>;
1453
+ approve(threadId: string, proposalId: string, request: Request, body: unknown): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationView>;
1454
+ reject(threadId: string, proposalId: string, request: Request, body: unknown): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationView>;
1426
1455
  }
1427
1456
 
1428
1457
  declare class ActionProposalWorkerService implements OnModuleInit, OnModuleDestroy {
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { DynamicModule, Type, OnApplicationBootstrap, OnModuleInit, ConflictException, OnModuleDestroy } from '@nestjs/common';
2
- import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter, e as AgentSkillsOptions } from './chat-queue.service-XG9RQCjU.js';
3
- export { f as AGENT_TOOL_BRAND, g as AgentAttachmentsOptions, h as AgentDeps, i as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, L as LedgerQuotaProvider, Q as QueuePlan, j as QueueSettleOutcome, k as QueuedTurn, l as QueuedTurnStarter, m as QuotaLimits, n as QuotaWindowLimits, o as delegateToolName, p as provideAgentTool, q as provideAgentTools, u as utcDay } from './chat-queue.service-XG9RQCjU.js';
2
+ import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter, e as AgentSkillsOptions } from './chat-queue.service-CTyX_yNr.js';
3
+ export { f as AGENT_TOOL_BRAND, g as AgentAttachmentsOptions, h as AgentDeps, i as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, L as LedgerQuotaProvider, Q as QueuePlan, j as QueueSettleOutcome, k as QueuedTurn, l as QueuedTurnStarter, m as QuotaLimits, n as QuotaWindowLimits, o as defineTool, p as delegateToolName, q as provideAgentTool, r as provideAgentTools, u as utcDay } from './chat-queue.service-CTyX_yNr.js';
4
4
  import * as _dudousxd_nestjs_agent_core from '@dudousxd/nestjs-agent-core';
5
- import { AgentStore, Actor, ListActionProposals, ActionProposalMutationResult, AgentRunner, AttachmentStagingStore, ModelCatalog, QuotaProvider, QuotaReport, ModelCatalogView, AttachmentRef, PageContext, ChatQueueState, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, ActorResolver, AgentApprovalPort, MessageAttachment, AgentAttachmentConfig, AgentClientConfig, ToolSpec, ToolPresentation, AgentHistoryWindow, AgentIntake, Persona, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, AgentRunStartOptions, TokenStreamSink, SinkWriter } from '@dudousxd/nestjs-agent-core';
5
+ import { AgentStore, Actor, ListActionProposals, ActionProposalMutationView, AgentRunner, AttachmentStagingStore, ModelCatalog, QuotaProvider, QuotaReport, ModelCatalogView, AttachmentRef, PageContext, ChatQueueState, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, ActorResolver, AgentApprovalPort, MessageAttachment, AgentAttachmentConfig, AgentClientConfig, ToolSpec, ToolPresentation, AgentHistoryWindow, AgentIntake, Persona, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, AgentRunStartOptions, TokenStreamSink, SinkWriter } from '@dudousxd/nestjs-agent-core';
6
6
  export * from '@dudousxd/nestjs-agent-core';
7
+ export { FunctionalToolDefinition } from '@dudousxd/nestjs-agent-core';
7
8
  import { Request, Response } from 'express';
8
9
  import { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
9
10
  import { StandardSchemaV1 } from '@standard-schema/spec';
@@ -18,7 +19,10 @@ declare class AgentModule {
18
19
  declare class ActionProposalService {
19
20
  private readonly store;
20
21
  private readonly options;
21
- constructor(store: AgentStore, options: Pick<AgentModuleOptions, 'approvalPolicy'>);
22
+ constructor(store: AgentStore, options: Pick<AgentModuleOptions, 'approvalPolicy' | 'actionProposalText'>);
23
+ /** The words a text decision is made of, and what the agent answers — English unless configured. */
24
+ private readonly vocabulary;
25
+ private readonly replies;
22
26
  private capability;
23
27
  private scope;
24
28
  private mayDecide;
@@ -27,20 +31,20 @@ declare class ActionProposalService {
27
31
  createdAt: number;
28
32
  id: string;
29
33
  };
30
- items: _dudousxd_nestjs_agent_core.ActionProposal[];
34
+ items: _dudousxd_nestjs_agent_core.ActionProposalView[];
31
35
  }>;
32
- list(threadId: string, actor: Actor): Promise<_dudousxd_nestjs_agent_core.ActionProposal[]>;
36
+ list(threadId: string, actor: Actor): Promise<_dudousxd_nestjs_agent_core.ActionProposalView[]>;
33
37
  decide(threadId: string, proposalId: string, actor: Actor, command: {
34
38
  decision: 'approved' | 'rejected';
35
39
  remember?: boolean;
36
40
  reason?: string;
37
41
  via?: string;
38
- }): Promise<ActionProposalMutationResult>;
42
+ }): Promise<ActionProposalMutationView>;
39
43
  handleTextDecision(threadId: string, actor: Actor, text: string): Promise<{
40
44
  status: "unmatched";
41
45
  } | {
42
46
  threadId: string;
43
- proposalDecision: ActionProposalMutationResult;
47
+ proposalDecision: ActionProposalMutationView;
44
48
  text: string;
45
49
  } | {
46
50
  threadId: string;
@@ -51,6 +55,8 @@ declare class ActionProposalService {
51
55
  text: string;
52
56
  }>;
53
57
  private textReceipt;
58
+ /** The configured reply to a decision the store answered with `result`. */
59
+ reply(result: ActionProposalMutationView, decision: 'approved' | 'rejected'): string;
54
60
  }
55
61
 
56
62
  /**
@@ -152,11 +158,25 @@ declare class AgentService {
152
158
  private readonly queue?;
153
159
  private readonly proposals?;
154
160
  constructor(runner: AgentRunner, store: AgentStore, deps: AgentDepsFactory, staging?: AttachmentStagingStore | undefined, models?: ModelCatalog | undefined, quotaProvider?: QuotaProvider | undefined, options?: Pick<AgentModuleOptions, "quota" | "actionApprovalMode"> | undefined, queue?: ChatQueueService | undefined, proposals?: ActionProposalService | undefined);
161
+ /**
162
+ * Decide one independent proposal through the scoped proposal service — what the native
163
+ * `action-proposals/:id/approve|reject` routes call — and the reply to show for it. `404` when
164
+ * proposals are not on, `403`/`404` when this actor may not decide it.
165
+ */
166
+ decideActionProposal(actor: Actor, threadId: string, proposalId: string, command: {
167
+ decision: 'approved' | 'rejected';
168
+ remember?: boolean;
169
+ reason?: string;
170
+ via: string;
171
+ }): Promise<{
172
+ proposalDecision: ActionProposalMutationView;
173
+ text: string;
174
+ }>;
155
175
  handleTextDecision(threadId: string, actor: Actor, text: string): Promise<{
156
176
  status: "unmatched";
157
177
  } | {
158
178
  threadId: string;
159
- proposalDecision: _dudousxd_nestjs_agent_core.ActionProposalMutationResult;
179
+ proposalDecision: ActionProposalMutationView;
160
180
  text: string;
161
181
  } | {
162
182
  threadId: string;
@@ -520,6 +540,15 @@ declare class AgUiRunHandler {
520
540
  * bad entry settles nothing.
521
541
  */
522
542
  private settle;
543
+ /**
544
+ * Decide independent proposals through the proposal service — the call the native
545
+ * `action-proposals/:id/approve|reject` routes make — never by signalling the origin run, which
546
+ * is not waiting. Every payload is checked before the first decision; a refusal is the service's
547
+ * own `403`/`404`.
548
+ */
549
+ private decideProposals;
550
+ /** Answer with a complete list of events, no run behind them. */
551
+ private writeEvents;
523
552
  /**
524
553
  * Pipe a run to the client as AG-UI 1.0 over SSE: one event per `data:` line, from `RUN_STARTED`
525
554
  * to the run's terminal event. It ends when the run stops to ask — the library run stays parked,
@@ -565,7 +594,7 @@ declare class AgentApprovalPortAdapter implements AgentApprovalPort {
565
594
  }, opts?: {
566
595
  remember?: boolean;
567
596
  decidedVia?: string;
568
- }): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationResult>;
597
+ }): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationView>;
569
598
  rejectActionProposal(actor: Actor, target: {
570
599
  kind: 'proposal';
571
600
  threadId: string;
@@ -573,7 +602,7 @@ declare class AgentApprovalPortAdapter implements AgentApprovalPort {
573
602
  }, opts?: {
574
603
  reason?: string;
575
604
  decidedVia?: string;
576
- }): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationResult>;
605
+ }): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationView>;
577
606
  approve(toolCallId: string, opts?: {
578
607
  executedByRef?: string;
579
608
  remember?: boolean;
@@ -1420,9 +1449,9 @@ declare class ActionProposalController {
1420
1449
  private readonly proposals;
1421
1450
  private readonly actors;
1422
1451
  constructor(proposals: ActionProposalService, actors: ActorResolver);
1423
- list(threadId: string, request: Request, cursor: unknown, response: Response): Promise<_dudousxd_nestjs_agent_core.ActionProposal[]>;
1424
- approve(threadId: string, proposalId: string, request: Request, body: unknown): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationResult>;
1425
- reject(threadId: string, proposalId: string, request: Request, body: unknown): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationResult>;
1452
+ list(threadId: string, request: Request, cursor: unknown, response: Response): Promise<_dudousxd_nestjs_agent_core.ActionProposalView[]>;
1453
+ approve(threadId: string, proposalId: string, request: Request, body: unknown): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationView>;
1454
+ reject(threadId: string, proposalId: string, request: Request, body: unknown): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationView>;
1426
1455
  }
1427
1456
 
1428
1457
  declare class ActionProposalWorkerService implements OnModuleInit, OnModuleDestroy {