@dudousxd/nestjs-agent 0.3.3 → 0.4.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/{agent-deps.factory-D4KyREOv.d.cts → agent-deps.factory-BM_RB6br.d.cts} +54 -4
- package/dist/{agent-deps.factory-D4KyREOv.d.ts → agent-deps.factory-BM_RB6br.d.ts} +54 -4
- package/dist/durable/index.cjs +492 -264
- 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 +447 -219
- package/dist/durable/index.js.map +1 -1
- package/dist/index.cjs +494 -263
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -5
- package/dist/index.d.ts +51 -5
- package/dist/index.js +446 -218
- package/dist/index.js.map +1 -1
- package/package.json +10 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { DynamicModule, Type, OnApplicationBootstrap
|
|
2
|
-
import { a as AgentModuleOptions, b as AgentModuleAsyncOptions, A as AgentDepsFactory } from './agent-deps.factory-
|
|
3
|
-
export { c as AGENT_TOOL_BRAND, d as AgentDeps, F as FunctionalTool,
|
|
4
|
-
import { AgentRunner, AgentStore, QuotaStore, Actor, MessageAttachment, PageContext, ThreadSummary, ThreadDetail, QuotaView, ToolRegistry, AgentRegistry, PromptContributor, AgentRunInput, Decision, TokenStreamSink, SinkWriter, QuotaState
|
|
1
|
+
import { DynamicModule, OnModuleInit, Type, OnApplicationBootstrap } from '@nestjs/common';
|
|
2
|
+
import { a as AgentModuleOptions, b as AgentModuleAsyncOptions, A as AgentDepsFactory } from './agent-deps.factory-BM_RB6br.cjs';
|
|
3
|
+
export { c as AGENT_TOOL_BRAND, d as AgentAttachmentsOptions, e as AgentDeps, F as FunctionalTool, f as delegateToolName, p as provideAgentTool, u as utcDay } from './agent-deps.factory-BM_RB6br.cjs';
|
|
4
|
+
import { AgentRunner, AgentStore, QuotaStore, Actor, MessageAttachment, PageContext, ThreadSummary, ThreadDetail, UpdateThreadInput, QuotaView, ActorResolver, AttachmentStagingStore, ToolRegistry, AgentRegistry, PromptContributor, AgentRunInput, Decision, TokenStreamSink, SinkWriter, QuotaState } from '@dudousxd/nestjs-agent-core';
|
|
5
5
|
export * from '@dudousxd/nestjs-agent-core';
|
|
6
|
+
import { Request } from 'express';
|
|
6
7
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
7
8
|
import { DiscoveryService, MetadataScanner } from '@nestjs/core';
|
|
8
9
|
|
|
@@ -46,7 +47,24 @@ declare class AgentService {
|
|
|
46
47
|
getThread(actor: Actor, threadId: string): Promise<ThreadDetail | null>;
|
|
47
48
|
deleteThread(actor: Actor, threadId: string): Promise<void>;
|
|
48
49
|
forkThread(actor: Actor, threadId: string, fromMessageId: string): Promise<ThreadSummary>;
|
|
50
|
+
/** Kept for source compatibility — a thin wrapper over the more general `updateThread`. */
|
|
49
51
|
renameThread(actor: Actor, threadId: string, title: string): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Rename a thread and/or set its default agent. Title-only patches work against ANY store (via
|
|
54
|
+
* the required `setTitle`); a `defaultAgent` change requires the bound store to implement the
|
|
55
|
+
* optional `updateThread` — 501 with a clear message when it doesn't, rather than silently
|
|
56
|
+
* dropping the field.
|
|
57
|
+
*/
|
|
58
|
+
updateThread(actor: Actor, threadId: string, patch: UpdateThreadInput): Promise<void>;
|
|
59
|
+
private validateTitle;
|
|
60
|
+
/**
|
|
61
|
+
* Agent-selection precedence for a `chat()` call with no explicit `agentName`: the thread's own
|
|
62
|
+
* `defaultAgent` (if the thread exists and one is set) wins over the module's configured default.
|
|
63
|
+
* Skips the thread lookup entirely when the caller already named an agent or there's no thread yet.
|
|
64
|
+
*/
|
|
65
|
+
private resolveAgentName;
|
|
66
|
+
private toSummaryView;
|
|
67
|
+
private toDetailView;
|
|
50
68
|
promoteThread(actor: Actor, threadId: string): Promise<void>;
|
|
51
69
|
/**
|
|
52
70
|
* Drop a message and everything after it — the "edit and resend" / "delete from here" primitive.
|
|
@@ -76,6 +94,34 @@ declare class AgentService {
|
|
|
76
94
|
private assertOwnsActiveStream;
|
|
77
95
|
}
|
|
78
96
|
|
|
97
|
+
/** Default per-file size cap when `AgentModuleOptions.attachments.maxBytes` is omitted (20 MiB). */
|
|
98
|
+
declare const DEFAULT_MAX_ATTACHMENT_BYTES: number;
|
|
99
|
+
/**
|
|
100
|
+
* Default allowlist: what multimodal model providers commonly accept as native image/file parts.
|
|
101
|
+
*/
|
|
102
|
+
declare const DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES: readonly string[];
|
|
103
|
+
/**
|
|
104
|
+
* Optional `POST /agent/attachments` upload surface — mounted only when `AgentModuleOptions
|
|
105
|
+
* .attachments.upload` (or the async config's `attachmentsUpload`) is `true` (see `agent.module.ts`).
|
|
106
|
+
* Multipart single file field `'file'`, buffered in memory (no disk write — `FileInterceptor`'s
|
|
107
|
+
* default storage), validated against the configured size cap + content-type allowlist, then handed
|
|
108
|
+
* to the bound {@link AttachmentStagingStore} to persist and turn into a model-fetchable URL.
|
|
109
|
+
*/
|
|
110
|
+
declare class AttachmentsController implements OnModuleInit {
|
|
111
|
+
private readonly options;
|
|
112
|
+
private readonly actorResolver;
|
|
113
|
+
private readonly staging;
|
|
114
|
+
constructor(options: AgentModuleOptions, actorResolver: ActorResolver, staging: AttachmentStagingStore | undefined);
|
|
115
|
+
/**
|
|
116
|
+
* `attachments.upload: true` is what mounts this controller at all (see `agent.module.ts`), so by
|
|
117
|
+
* the time an instance exists the host clearly intends uploads to work. Fail boot loudly rather
|
|
118
|
+
* than mounting a controller that would 501 on every single request because nobody bound
|
|
119
|
+
* `AGENT_ATTACHMENT_STAGING`.
|
|
120
|
+
*/
|
|
121
|
+
onModuleInit(): void;
|
|
122
|
+
upload(req: Request, file: Express.Multer.File | undefined): Promise<MessageAttachment>;
|
|
123
|
+
}
|
|
124
|
+
|
|
79
125
|
declare const AI_TOOL_METADATA: unique symbol;
|
|
80
126
|
interface AiToolOptions {
|
|
81
127
|
name: string;
|
|
@@ -286,4 +332,4 @@ declare class HeaderActorResolver implements ActorResolver {
|
|
|
286
332
|
resolve(req: unknown): Actor;
|
|
287
333
|
}
|
|
288
334
|
|
|
289
|
-
export { AGENT_METADATA, AI_TOOL_METADATA, Agent, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AiTool, AiToolDiscoveryService, type AiToolOptions, type ChatParams, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, LedgerQuotaStore, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, SystemPrompt, SystemPromptContributor, readAgentMetadata, readAiToolMetadata };
|
|
335
|
+
export { AGENT_METADATA, AI_TOOL_METADATA, Agent, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AiTool, AiToolDiscoveryService, type AiToolOptions, AttachmentsController, type ChatParams, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, LedgerQuotaStore, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, SystemPrompt, SystemPromptContributor, readAgentMetadata, readAiToolMetadata };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { DynamicModule, Type, OnApplicationBootstrap
|
|
2
|
-
import { a as AgentModuleOptions, b as AgentModuleAsyncOptions, A as AgentDepsFactory } from './agent-deps.factory-
|
|
3
|
-
export { c as AGENT_TOOL_BRAND, d as AgentDeps, F as FunctionalTool,
|
|
4
|
-
import { AgentRunner, AgentStore, QuotaStore, Actor, MessageAttachment, PageContext, ThreadSummary, ThreadDetail, QuotaView, ToolRegistry, AgentRegistry, PromptContributor, AgentRunInput, Decision, TokenStreamSink, SinkWriter, QuotaState
|
|
1
|
+
import { DynamicModule, OnModuleInit, Type, OnApplicationBootstrap } from '@nestjs/common';
|
|
2
|
+
import { a as AgentModuleOptions, b as AgentModuleAsyncOptions, A as AgentDepsFactory } from './agent-deps.factory-BM_RB6br.js';
|
|
3
|
+
export { c as AGENT_TOOL_BRAND, d as AgentAttachmentsOptions, e as AgentDeps, F as FunctionalTool, f as delegateToolName, p as provideAgentTool, u as utcDay } from './agent-deps.factory-BM_RB6br.js';
|
|
4
|
+
import { AgentRunner, AgentStore, QuotaStore, Actor, MessageAttachment, PageContext, ThreadSummary, ThreadDetail, UpdateThreadInput, QuotaView, ActorResolver, AttachmentStagingStore, ToolRegistry, AgentRegistry, PromptContributor, AgentRunInput, Decision, TokenStreamSink, SinkWriter, QuotaState } from '@dudousxd/nestjs-agent-core';
|
|
5
5
|
export * from '@dudousxd/nestjs-agent-core';
|
|
6
|
+
import { Request } from 'express';
|
|
6
7
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
7
8
|
import { DiscoveryService, MetadataScanner } from '@nestjs/core';
|
|
8
9
|
|
|
@@ -46,7 +47,24 @@ declare class AgentService {
|
|
|
46
47
|
getThread(actor: Actor, threadId: string): Promise<ThreadDetail | null>;
|
|
47
48
|
deleteThread(actor: Actor, threadId: string): Promise<void>;
|
|
48
49
|
forkThread(actor: Actor, threadId: string, fromMessageId: string): Promise<ThreadSummary>;
|
|
50
|
+
/** Kept for source compatibility — a thin wrapper over the more general `updateThread`. */
|
|
49
51
|
renameThread(actor: Actor, threadId: string, title: string): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Rename a thread and/or set its default agent. Title-only patches work against ANY store (via
|
|
54
|
+
* the required `setTitle`); a `defaultAgent` change requires the bound store to implement the
|
|
55
|
+
* optional `updateThread` — 501 with a clear message when it doesn't, rather than silently
|
|
56
|
+
* dropping the field.
|
|
57
|
+
*/
|
|
58
|
+
updateThread(actor: Actor, threadId: string, patch: UpdateThreadInput): Promise<void>;
|
|
59
|
+
private validateTitle;
|
|
60
|
+
/**
|
|
61
|
+
* Agent-selection precedence for a `chat()` call with no explicit `agentName`: the thread's own
|
|
62
|
+
* `defaultAgent` (if the thread exists and one is set) wins over the module's configured default.
|
|
63
|
+
* Skips the thread lookup entirely when the caller already named an agent or there's no thread yet.
|
|
64
|
+
*/
|
|
65
|
+
private resolveAgentName;
|
|
66
|
+
private toSummaryView;
|
|
67
|
+
private toDetailView;
|
|
50
68
|
promoteThread(actor: Actor, threadId: string): Promise<void>;
|
|
51
69
|
/**
|
|
52
70
|
* Drop a message and everything after it — the "edit and resend" / "delete from here" primitive.
|
|
@@ -76,6 +94,34 @@ declare class AgentService {
|
|
|
76
94
|
private assertOwnsActiveStream;
|
|
77
95
|
}
|
|
78
96
|
|
|
97
|
+
/** Default per-file size cap when `AgentModuleOptions.attachments.maxBytes` is omitted (20 MiB). */
|
|
98
|
+
declare const DEFAULT_MAX_ATTACHMENT_BYTES: number;
|
|
99
|
+
/**
|
|
100
|
+
* Default allowlist: what multimodal model providers commonly accept as native image/file parts.
|
|
101
|
+
*/
|
|
102
|
+
declare const DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES: readonly string[];
|
|
103
|
+
/**
|
|
104
|
+
* Optional `POST /agent/attachments` upload surface — mounted only when `AgentModuleOptions
|
|
105
|
+
* .attachments.upload` (or the async config's `attachmentsUpload`) is `true` (see `agent.module.ts`).
|
|
106
|
+
* Multipart single file field `'file'`, buffered in memory (no disk write — `FileInterceptor`'s
|
|
107
|
+
* default storage), validated against the configured size cap + content-type allowlist, then handed
|
|
108
|
+
* to the bound {@link AttachmentStagingStore} to persist and turn into a model-fetchable URL.
|
|
109
|
+
*/
|
|
110
|
+
declare class AttachmentsController implements OnModuleInit {
|
|
111
|
+
private readonly options;
|
|
112
|
+
private readonly actorResolver;
|
|
113
|
+
private readonly staging;
|
|
114
|
+
constructor(options: AgentModuleOptions, actorResolver: ActorResolver, staging: AttachmentStagingStore | undefined);
|
|
115
|
+
/**
|
|
116
|
+
* `attachments.upload: true` is what mounts this controller at all (see `agent.module.ts`), so by
|
|
117
|
+
* the time an instance exists the host clearly intends uploads to work. Fail boot loudly rather
|
|
118
|
+
* than mounting a controller that would 501 on every single request because nobody bound
|
|
119
|
+
* `AGENT_ATTACHMENT_STAGING`.
|
|
120
|
+
*/
|
|
121
|
+
onModuleInit(): void;
|
|
122
|
+
upload(req: Request, file: Express.Multer.File | undefined): Promise<MessageAttachment>;
|
|
123
|
+
}
|
|
124
|
+
|
|
79
125
|
declare const AI_TOOL_METADATA: unique symbol;
|
|
80
126
|
interface AiToolOptions {
|
|
81
127
|
name: string;
|
|
@@ -286,4 +332,4 @@ declare class HeaderActorResolver implements ActorResolver {
|
|
|
286
332
|
resolve(req: unknown): Actor;
|
|
287
333
|
}
|
|
288
334
|
|
|
289
|
-
export { AGENT_METADATA, AI_TOOL_METADATA, Agent, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AiTool, AiToolDiscoveryService, type AiToolOptions, type ChatParams, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, LedgerQuotaStore, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, SystemPrompt, SystemPromptContributor, readAgentMetadata, readAiToolMetadata };
|
|
335
|
+
export { AGENT_METADATA, AI_TOOL_METADATA, Agent, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AiTool, AiToolDiscoveryService, type AiToolOptions, AttachmentsController, type ChatParams, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, LedgerQuotaStore, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, SystemPrompt, SystemPromptContributor, readAgentMetadata, readAiToolMetadata };
|