@dudousxd/nestjs-agent 1.20.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/README.md +58 -0
- package/dist/{chat-queue.service-C0hr7dqx.d.cts → chat-queue.service-CTyX_yNr.d.ts} +48 -3
- package/dist/{chat-queue.service-C0hr7dqx.d.ts → chat-queue.service-Dx9OsjcF.d.cts} +48 -3
- package/dist/durable/index.cjs +1662 -839
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.d.cts +3 -1
- package/dist/durable/index.d.ts +3 -1
- package/dist/durable/index.js +1395 -572
- package/dist/durable/index.js.map +1 -1
- package/dist/genui/index.cjs +1 -0
- package/dist/genui/index.cjs.map +1 -1
- package/dist/genui/index.d.cts +1 -1
- package/dist/genui/index.d.ts +1 -1
- package/dist/genui/index.js +1 -0
- package/dist/genui/index.js.map +1 -1
- package/dist/index.cjs +1647 -831
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +140 -9
- package/dist/index.d.ts +140 -9
- package/dist/index.js +1417 -605
- package/dist/index.js.map +1 -1
- package/dist/sink-redis/index.cjs +7 -2
- package/dist/sink-redis/index.cjs.map +1 -1
- package/dist/sink-redis/index.d.cts +6 -3
- package/dist/sink-redis/index.d.ts +6 -3
- package/dist/sink-redis/index.js +7 -2
- package/dist/sink-redis/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -1,17 +1,64 @@
|
|
|
1
|
-
import { DynamicModule, Type, OnApplicationBootstrap, OnModuleInit, ConflictException } 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-
|
|
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
|
|
4
|
-
import
|
|
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-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
|
+
import * as _dudousxd_nestjs_agent_core 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';
|
|
5
6
|
export * from '@dudousxd/nestjs-agent-core';
|
|
7
|
+
export { FunctionalToolDefinition } from '@dudousxd/nestjs-agent-core';
|
|
6
8
|
import { Request, Response } from 'express';
|
|
9
|
+
import { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
|
|
7
10
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
8
11
|
import { DiscoveryService, MetadataScanner } from '@nestjs/core';
|
|
12
|
+
import './genui/index.cjs';
|
|
9
13
|
|
|
10
14
|
declare class AgentModule {
|
|
11
15
|
static forRoot(options: AgentModuleOptions): DynamicModule;
|
|
12
16
|
static forRootAsync(options: AgentModuleAsyncOptions): DynamicModule;
|
|
13
17
|
}
|
|
14
18
|
|
|
19
|
+
declare class ActionProposalService {
|
|
20
|
+
private readonly store;
|
|
21
|
+
private readonly options;
|
|
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;
|
|
26
|
+
private capability;
|
|
27
|
+
private scope;
|
|
28
|
+
private mayDecide;
|
|
29
|
+
listPage(threadId: string, actor: Actor, query?: Pick<ListActionProposals, 'after'>): Promise<{
|
|
30
|
+
next?: {
|
|
31
|
+
createdAt: number;
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
items: _dudousxd_nestjs_agent_core.ActionProposalView[];
|
|
35
|
+
}>;
|
|
36
|
+
list(threadId: string, actor: Actor): Promise<_dudousxd_nestjs_agent_core.ActionProposalView[]>;
|
|
37
|
+
decide(threadId: string, proposalId: string, actor: Actor, command: {
|
|
38
|
+
decision: 'approved' | 'rejected';
|
|
39
|
+
remember?: boolean;
|
|
40
|
+
reason?: string;
|
|
41
|
+
via?: string;
|
|
42
|
+
}): Promise<ActionProposalMutationView>;
|
|
43
|
+
handleTextDecision(threadId: string, actor: Actor, text: string): Promise<{
|
|
44
|
+
status: "unmatched";
|
|
45
|
+
} | {
|
|
46
|
+
threadId: string;
|
|
47
|
+
proposalDecision: ActionProposalMutationView;
|
|
48
|
+
text: string;
|
|
49
|
+
} | {
|
|
50
|
+
threadId: string;
|
|
51
|
+
proposalDecision: {
|
|
52
|
+
status: "ambiguous";
|
|
53
|
+
proposalIds: string[];
|
|
54
|
+
};
|
|
55
|
+
text: string;
|
|
56
|
+
}>;
|
|
57
|
+
private textReceipt;
|
|
58
|
+
/** The configured reply to a decision the store answered with `result`. */
|
|
59
|
+
reply(result: ActionProposalMutationView, decision: 'approved' | 'rejected'): string;
|
|
60
|
+
}
|
|
61
|
+
|
|
15
62
|
/**
|
|
16
63
|
* What a send does when its thread already has a turn running:
|
|
17
64
|
* - `'auto'` (default) — run now when the thread is idle, else wait in the thread's queue.
|
|
@@ -39,8 +86,14 @@ type ChatSendResult = {
|
|
|
39
86
|
runId: string;
|
|
40
87
|
threadId: string;
|
|
41
88
|
queued?: undefined;
|
|
42
|
-
} | QueuedSend
|
|
89
|
+
} | QueuedSend | {
|
|
90
|
+
threadId: string;
|
|
91
|
+
proposalDecision: unknown;
|
|
92
|
+
text: string;
|
|
93
|
+
queued?: undefined;
|
|
94
|
+
};
|
|
43
95
|
interface ChatParams {
|
|
96
|
+
uiCapabilities?: UiCapabilities;
|
|
44
97
|
actor: Actor;
|
|
45
98
|
message: string;
|
|
46
99
|
threadId?: string;
|
|
@@ -103,7 +156,36 @@ declare class AgentService {
|
|
|
103
156
|
private readonly quotaProvider?;
|
|
104
157
|
private readonly options?;
|
|
105
158
|
private readonly queue?;
|
|
106
|
-
|
|
159
|
+
private readonly proposals?;
|
|
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
|
+
}>;
|
|
175
|
+
handleTextDecision(threadId: string, actor: Actor, text: string): Promise<{
|
|
176
|
+
status: "unmatched";
|
|
177
|
+
} | {
|
|
178
|
+
threadId: string;
|
|
179
|
+
proposalDecision: ActionProposalMutationView;
|
|
180
|
+
text: string;
|
|
181
|
+
} | {
|
|
182
|
+
threadId: string;
|
|
183
|
+
proposalDecision: {
|
|
184
|
+
status: "ambiguous";
|
|
185
|
+
proposalIds: string[];
|
|
186
|
+
};
|
|
187
|
+
text: string;
|
|
188
|
+
}>;
|
|
107
189
|
/** The queue service when the bound store can hold a queue, else `undefined`. */
|
|
108
190
|
private queueing;
|
|
109
191
|
/** The queue service, or a 501 naming what is missing. */
|
|
@@ -149,7 +231,9 @@ declare class AgentService {
|
|
|
149
231
|
* Send a message: start a turn, or — when its thread already has one running — queue the message
|
|
150
232
|
* to run after it (see {@link ChatSendMode}). What `POST <base>/chat` calls.
|
|
151
233
|
*/
|
|
152
|
-
send(params: ChatParams
|
|
234
|
+
send(params: ChatParams, sendOptions?: {
|
|
235
|
+
textDecisions?: boolean;
|
|
236
|
+
}): Promise<ChatSendResult>;
|
|
153
237
|
/**
|
|
154
238
|
* Start a turn the thread is already claimed for, under the claimed id. A runner that minted an
|
|
155
239
|
* id of its own anyway gets the thread re-pointed at it; one that fails to start frees the thread.
|
|
@@ -456,6 +540,15 @@ declare class AgUiRunHandler {
|
|
|
456
540
|
* bad entry settles nothing.
|
|
457
541
|
*/
|
|
458
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;
|
|
459
552
|
/**
|
|
460
553
|
* Pipe a run to the client as AG-UI 1.0 over SSE: one event per `data:` line, from `RUN_STARTED`
|
|
461
554
|
* to the run's terminal event. It ends when the run stops to ask — the library run stays parked,
|
|
@@ -492,7 +585,24 @@ declare function agUiAdapter(options?: AgUiAdapterOptions): AgentProtocolAdapter
|
|
|
492
585
|
*/
|
|
493
586
|
declare class AgentApprovalPortAdapter implements AgentApprovalPort {
|
|
494
587
|
private readonly agent;
|
|
495
|
-
|
|
588
|
+
private readonly proposals?;
|
|
589
|
+
constructor(agent: AgentService, proposals?: ActionProposalService | undefined);
|
|
590
|
+
approveActionProposal(actor: Actor, target: {
|
|
591
|
+
kind: 'proposal';
|
|
592
|
+
threadId: string;
|
|
593
|
+
proposalId: string;
|
|
594
|
+
}, opts?: {
|
|
595
|
+
remember?: boolean;
|
|
596
|
+
decidedVia?: string;
|
|
597
|
+
}): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationView>;
|
|
598
|
+
rejectActionProposal(actor: Actor, target: {
|
|
599
|
+
kind: 'proposal';
|
|
600
|
+
threadId: string;
|
|
601
|
+
proposalId: string;
|
|
602
|
+
}, opts?: {
|
|
603
|
+
reason?: string;
|
|
604
|
+
decidedVia?: string;
|
|
605
|
+
}): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationView>;
|
|
496
606
|
approve(toolCallId: string, opts?: {
|
|
497
607
|
executedByRef?: string;
|
|
498
608
|
remember?: boolean;
|
|
@@ -581,6 +691,7 @@ declare class ConfigController {
|
|
|
581
691
|
|
|
582
692
|
declare const AI_TOOL_METADATA: unique symbol;
|
|
583
693
|
interface AiToolOptions {
|
|
694
|
+
replacementKey?: ToolSpec['replacementKey'];
|
|
584
695
|
/**
|
|
585
696
|
* What the model calls it. Omit → the class name, camelCased, with a trailing `Tool` dropped
|
|
586
697
|
* (`GetWeatherTool` → `getWeather`).
|
|
@@ -1334,4 +1445,24 @@ declare class RunNotActiveException extends ConflictException {
|
|
|
1334
1445
|
constructor(runId: string);
|
|
1335
1446
|
}
|
|
1336
1447
|
|
|
1337
|
-
|
|
1448
|
+
declare class ActionProposalController {
|
|
1449
|
+
private readonly proposals;
|
|
1450
|
+
private readonly actors;
|
|
1451
|
+
constructor(proposals: ActionProposalService, actors: ActorResolver);
|
|
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>;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
declare class ActionProposalWorkerService implements OnModuleInit, OnModuleDestroy {
|
|
1458
|
+
private readonly store;
|
|
1459
|
+
private readonly options;
|
|
1460
|
+
private readonly deps;
|
|
1461
|
+
private worker;
|
|
1462
|
+
private readonly logger;
|
|
1463
|
+
constructor(store: AgentStore, options: AgentModuleOptions, deps: AgentDepsFactory);
|
|
1464
|
+
onModuleInit(): void;
|
|
1465
|
+
onModuleDestroy(): Promise<void>;
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
export { AGENT_CHAT_QUEUE, AGENT_METADATA, AI_TOOL_METADATA, ATTACHMENT_PAGE_SIZE, ActionProposalController, ActionProposalService, ActionProposalWorkerService, type AgUiAdapterOptions, AgUiRunHandler, Agent, AgentApprovalPortAdapter, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentProtocolAdapter, AgentService, AgentSkillsOptions, AiTool, AiToolDiscoveryService, type AiToolOptions, type AnonymousActorOptions, AnonymousActorResolver, type AttachmentLimits, AttachmentsController, type ChatParams, ChatQueueService, type ChatSendMode, type ChatSendResult, ConfigController, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, type DeclaredSkill, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, MAX_ATTACHMENTS_PER_MESSAGE, MemoriesController, MessagesController, ModelsController, QueueController, type QueuedSend, type RequestUserMapper, type ResolvedAiToolOptions, RunNotActiveException, SKILL_METADATA, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, Skill, type SkillBody, SkillDiscoveryService, type SkillOptions, SkillsController, SystemPrompt, SystemPromptContributor, type ThreadDefaultAgentReader, type ThreadModelReader, type ThreadPersonaReader, ToolsController, agUiAdapter, attachmentLimits, declaredSkillProvider, defaultRequestUserMapper, readAgentMetadata, readAiToolMetadata, readSkillMetadata, requestUserActorResolver, resolveSkillsConfig, skillScope, threadPersona, toolNameFromClass };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,64 @@
|
|
|
1
|
-
import { DynamicModule, Type, OnApplicationBootstrap, OnModuleInit, ConflictException } 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-
|
|
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
|
|
4
|
-
import
|
|
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-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
|
+
import * as _dudousxd_nestjs_agent_core 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';
|
|
5
6
|
export * from '@dudousxd/nestjs-agent-core';
|
|
7
|
+
export { FunctionalToolDefinition } from '@dudousxd/nestjs-agent-core';
|
|
6
8
|
import { Request, Response } from 'express';
|
|
9
|
+
import { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
|
|
7
10
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
8
11
|
import { DiscoveryService, MetadataScanner } from '@nestjs/core';
|
|
12
|
+
import './genui/index.js';
|
|
9
13
|
|
|
10
14
|
declare class AgentModule {
|
|
11
15
|
static forRoot(options: AgentModuleOptions): DynamicModule;
|
|
12
16
|
static forRootAsync(options: AgentModuleAsyncOptions): DynamicModule;
|
|
13
17
|
}
|
|
14
18
|
|
|
19
|
+
declare class ActionProposalService {
|
|
20
|
+
private readonly store;
|
|
21
|
+
private readonly options;
|
|
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;
|
|
26
|
+
private capability;
|
|
27
|
+
private scope;
|
|
28
|
+
private mayDecide;
|
|
29
|
+
listPage(threadId: string, actor: Actor, query?: Pick<ListActionProposals, 'after'>): Promise<{
|
|
30
|
+
next?: {
|
|
31
|
+
createdAt: number;
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
items: _dudousxd_nestjs_agent_core.ActionProposalView[];
|
|
35
|
+
}>;
|
|
36
|
+
list(threadId: string, actor: Actor): Promise<_dudousxd_nestjs_agent_core.ActionProposalView[]>;
|
|
37
|
+
decide(threadId: string, proposalId: string, actor: Actor, command: {
|
|
38
|
+
decision: 'approved' | 'rejected';
|
|
39
|
+
remember?: boolean;
|
|
40
|
+
reason?: string;
|
|
41
|
+
via?: string;
|
|
42
|
+
}): Promise<ActionProposalMutationView>;
|
|
43
|
+
handleTextDecision(threadId: string, actor: Actor, text: string): Promise<{
|
|
44
|
+
status: "unmatched";
|
|
45
|
+
} | {
|
|
46
|
+
threadId: string;
|
|
47
|
+
proposalDecision: ActionProposalMutationView;
|
|
48
|
+
text: string;
|
|
49
|
+
} | {
|
|
50
|
+
threadId: string;
|
|
51
|
+
proposalDecision: {
|
|
52
|
+
status: "ambiguous";
|
|
53
|
+
proposalIds: string[];
|
|
54
|
+
};
|
|
55
|
+
text: string;
|
|
56
|
+
}>;
|
|
57
|
+
private textReceipt;
|
|
58
|
+
/** The configured reply to a decision the store answered with `result`. */
|
|
59
|
+
reply(result: ActionProposalMutationView, decision: 'approved' | 'rejected'): string;
|
|
60
|
+
}
|
|
61
|
+
|
|
15
62
|
/**
|
|
16
63
|
* What a send does when its thread already has a turn running:
|
|
17
64
|
* - `'auto'` (default) — run now when the thread is idle, else wait in the thread's queue.
|
|
@@ -39,8 +86,14 @@ type ChatSendResult = {
|
|
|
39
86
|
runId: string;
|
|
40
87
|
threadId: string;
|
|
41
88
|
queued?: undefined;
|
|
42
|
-
} | QueuedSend
|
|
89
|
+
} | QueuedSend | {
|
|
90
|
+
threadId: string;
|
|
91
|
+
proposalDecision: unknown;
|
|
92
|
+
text: string;
|
|
93
|
+
queued?: undefined;
|
|
94
|
+
};
|
|
43
95
|
interface ChatParams {
|
|
96
|
+
uiCapabilities?: UiCapabilities;
|
|
44
97
|
actor: Actor;
|
|
45
98
|
message: string;
|
|
46
99
|
threadId?: string;
|
|
@@ -103,7 +156,36 @@ declare class AgentService {
|
|
|
103
156
|
private readonly quotaProvider?;
|
|
104
157
|
private readonly options?;
|
|
105
158
|
private readonly queue?;
|
|
106
|
-
|
|
159
|
+
private readonly proposals?;
|
|
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
|
+
}>;
|
|
175
|
+
handleTextDecision(threadId: string, actor: Actor, text: string): Promise<{
|
|
176
|
+
status: "unmatched";
|
|
177
|
+
} | {
|
|
178
|
+
threadId: string;
|
|
179
|
+
proposalDecision: ActionProposalMutationView;
|
|
180
|
+
text: string;
|
|
181
|
+
} | {
|
|
182
|
+
threadId: string;
|
|
183
|
+
proposalDecision: {
|
|
184
|
+
status: "ambiguous";
|
|
185
|
+
proposalIds: string[];
|
|
186
|
+
};
|
|
187
|
+
text: string;
|
|
188
|
+
}>;
|
|
107
189
|
/** The queue service when the bound store can hold a queue, else `undefined`. */
|
|
108
190
|
private queueing;
|
|
109
191
|
/** The queue service, or a 501 naming what is missing. */
|
|
@@ -149,7 +231,9 @@ declare class AgentService {
|
|
|
149
231
|
* Send a message: start a turn, or — when its thread already has one running — queue the message
|
|
150
232
|
* to run after it (see {@link ChatSendMode}). What `POST <base>/chat` calls.
|
|
151
233
|
*/
|
|
152
|
-
send(params: ChatParams
|
|
234
|
+
send(params: ChatParams, sendOptions?: {
|
|
235
|
+
textDecisions?: boolean;
|
|
236
|
+
}): Promise<ChatSendResult>;
|
|
153
237
|
/**
|
|
154
238
|
* Start a turn the thread is already claimed for, under the claimed id. A runner that minted an
|
|
155
239
|
* id of its own anyway gets the thread re-pointed at it; one that fails to start frees the thread.
|
|
@@ -456,6 +540,15 @@ declare class AgUiRunHandler {
|
|
|
456
540
|
* bad entry settles nothing.
|
|
457
541
|
*/
|
|
458
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;
|
|
459
552
|
/**
|
|
460
553
|
* Pipe a run to the client as AG-UI 1.0 over SSE: one event per `data:` line, from `RUN_STARTED`
|
|
461
554
|
* to the run's terminal event. It ends when the run stops to ask — the library run stays parked,
|
|
@@ -492,7 +585,24 @@ declare function agUiAdapter(options?: AgUiAdapterOptions): AgentProtocolAdapter
|
|
|
492
585
|
*/
|
|
493
586
|
declare class AgentApprovalPortAdapter implements AgentApprovalPort {
|
|
494
587
|
private readonly agent;
|
|
495
|
-
|
|
588
|
+
private readonly proposals?;
|
|
589
|
+
constructor(agent: AgentService, proposals?: ActionProposalService | undefined);
|
|
590
|
+
approveActionProposal(actor: Actor, target: {
|
|
591
|
+
kind: 'proposal';
|
|
592
|
+
threadId: string;
|
|
593
|
+
proposalId: string;
|
|
594
|
+
}, opts?: {
|
|
595
|
+
remember?: boolean;
|
|
596
|
+
decidedVia?: string;
|
|
597
|
+
}): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationView>;
|
|
598
|
+
rejectActionProposal(actor: Actor, target: {
|
|
599
|
+
kind: 'proposal';
|
|
600
|
+
threadId: string;
|
|
601
|
+
proposalId: string;
|
|
602
|
+
}, opts?: {
|
|
603
|
+
reason?: string;
|
|
604
|
+
decidedVia?: string;
|
|
605
|
+
}): Promise<_dudousxd_nestjs_agent_core.ActionProposalMutationView>;
|
|
496
606
|
approve(toolCallId: string, opts?: {
|
|
497
607
|
executedByRef?: string;
|
|
498
608
|
remember?: boolean;
|
|
@@ -581,6 +691,7 @@ declare class ConfigController {
|
|
|
581
691
|
|
|
582
692
|
declare const AI_TOOL_METADATA: unique symbol;
|
|
583
693
|
interface AiToolOptions {
|
|
694
|
+
replacementKey?: ToolSpec['replacementKey'];
|
|
584
695
|
/**
|
|
585
696
|
* What the model calls it. Omit → the class name, camelCased, with a trailing `Tool` dropped
|
|
586
697
|
* (`GetWeatherTool` → `getWeather`).
|
|
@@ -1334,4 +1445,24 @@ declare class RunNotActiveException extends ConflictException {
|
|
|
1334
1445
|
constructor(runId: string);
|
|
1335
1446
|
}
|
|
1336
1447
|
|
|
1337
|
-
|
|
1448
|
+
declare class ActionProposalController {
|
|
1449
|
+
private readonly proposals;
|
|
1450
|
+
private readonly actors;
|
|
1451
|
+
constructor(proposals: ActionProposalService, actors: ActorResolver);
|
|
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>;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
declare class ActionProposalWorkerService implements OnModuleInit, OnModuleDestroy {
|
|
1458
|
+
private readonly store;
|
|
1459
|
+
private readonly options;
|
|
1460
|
+
private readonly deps;
|
|
1461
|
+
private worker;
|
|
1462
|
+
private readonly logger;
|
|
1463
|
+
constructor(store: AgentStore, options: AgentModuleOptions, deps: AgentDepsFactory);
|
|
1464
|
+
onModuleInit(): void;
|
|
1465
|
+
onModuleDestroy(): Promise<void>;
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
export { AGENT_CHAT_QUEUE, AGENT_METADATA, AI_TOOL_METADATA, ATTACHMENT_PAGE_SIZE, ActionProposalController, ActionProposalService, ActionProposalWorkerService, type AgUiAdapterOptions, AgUiRunHandler, Agent, AgentApprovalPortAdapter, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentProtocolAdapter, AgentService, AgentSkillsOptions, AiTool, AiToolDiscoveryService, type AiToolOptions, type AnonymousActorOptions, AnonymousActorResolver, type AttachmentLimits, AttachmentsController, type ChatParams, ChatQueueService, type ChatSendMode, type ChatSendResult, ConfigController, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, type DeclaredSkill, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, MAX_ATTACHMENTS_PER_MESSAGE, MemoriesController, MessagesController, ModelsController, QueueController, type QueuedSend, type RequestUserMapper, type ResolvedAiToolOptions, RunNotActiveException, SKILL_METADATA, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, Skill, type SkillBody, SkillDiscoveryService, type SkillOptions, SkillsController, SystemPrompt, SystemPromptContributor, type ThreadDefaultAgentReader, type ThreadModelReader, type ThreadPersonaReader, ToolsController, agUiAdapter, attachmentLimits, declaredSkillProvider, defaultRequestUserMapper, readAgentMetadata, readAiToolMetadata, readSkillMetadata, requestUserActorResolver, resolveSkillsConfig, skillScope, threadPersona, toolNameFromClass };
|