@dudousxd/nestjs-agent 1.11.0 → 1.12.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/README.md +21 -14
- package/dist/{agent-deps.factory-BRTBu0lV.d.cts → agent-deps.factory-pqv_qTmJ.d.cts} +22 -50
- package/dist/{agent-deps.factory-BRTBu0lV.d.ts → agent-deps.factory-pqv_qTmJ.d.ts} +22 -50
- package/dist/durable/index.cjs +669 -654
- 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 +569 -554
- package/dist/durable/index.js.map +1 -1
- package/dist/index.cjs +682 -663
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -47
- package/dist/index.d.ts +40 -47
- package/dist/index.js +570 -553
- package/dist/index.js.map +1 -1
- package/dist/media/index.cjs +11 -2
- package/dist/media/index.cjs.map +1 -1
- package/dist/media/index.d.cts +5 -1
- package/dist/media/index.d.ts +5 -1
- package/dist/media/index.js +11 -2
- package/dist/media/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DynamicModule,
|
|
2
|
-
import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, d as AgentSkillsOptions } from './agent-deps.factory-
|
|
3
|
-
export { e as AGENT_TOOL_BRAND, f as AgentAttachmentsOptions, g as AgentDeps, h as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, L as LedgerQuotaProvider, Q as QuotaLimits, i as QuotaWindowLimits, j as delegateToolName, p as provideAgentTool, k as provideAgentTools, u as utcDay } from './agent-deps.factory-
|
|
4
|
-
import { AgentRunner, AgentStore,
|
|
1
|
+
import { DynamicModule, Type, OnApplicationBootstrap, OnModuleInit } from '@nestjs/common';
|
|
2
|
+
import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, d as AgentSkillsOptions } from './agent-deps.factory-pqv_qTmJ.cjs';
|
|
3
|
+
export { e as AGENT_TOOL_BRAND, f as AgentAttachmentsOptions, g as AgentDeps, h as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, L as LedgerQuotaProvider, Q as QuotaLimits, i as QuotaWindowLimits, j as delegateToolName, p as provideAgentTool, k as provideAgentTools, u as utcDay } from './agent-deps.factory-pqv_qTmJ.cjs';
|
|
4
|
+
import { AgentRunner, AgentStore, AttachmentStagingStore, ModelCatalog, QuotaProvider, Actor, QuotaReport, ModelCatalogView, AttachmentRef, PageContext, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, AgentApprovalPort, ActorResolver, MessageAttachment, AgentAttachmentConfig, AgentClientConfig, ToolPresentation, AgentHistoryWindow, AgentIntake, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, TokenStreamSink, SinkWriter } from '@dudousxd/nestjs-agent-core';
|
|
5
5
|
export * from '@dudousxd/nestjs-agent-core';
|
|
6
6
|
import { Request } from 'express';
|
|
7
7
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
@@ -56,12 +56,11 @@ declare class AgentService {
|
|
|
56
56
|
private readonly runner;
|
|
57
57
|
private readonly store;
|
|
58
58
|
private readonly deps;
|
|
59
|
-
private readonly quota;
|
|
60
59
|
private readonly staging?;
|
|
61
60
|
private readonly models?;
|
|
62
61
|
private readonly quotaProvider?;
|
|
63
62
|
private readonly options?;
|
|
64
|
-
constructor(runner: AgentRunner, store: AgentStore, deps: AgentDepsFactory,
|
|
63
|
+
constructor(runner: AgentRunner, store: AgentStore, deps: AgentDepsFactory, staging?: AttachmentStagingStore | undefined, models?: ModelCatalog | undefined, quotaProvider?: QuotaProvider | undefined, options?: Pick<AgentModuleOptions, "quota"> | undefined);
|
|
65
64
|
/**
|
|
66
65
|
* The actor's budget across windows (`GET <base>/quota`) — the bound {@link QuotaProvider}'s
|
|
67
66
|
* report. Without one (a service built outside the module), a day window from the ledger.
|
|
@@ -69,8 +68,7 @@ declare class AgentService {
|
|
|
69
68
|
quotaReport(actor: Actor): Promise<QuotaReport>;
|
|
70
69
|
/**
|
|
71
70
|
* Refuse a turn the actor's budget no longer covers — only when the host configured one
|
|
72
|
-
* (`
|
|
73
|
-
* quota the loop enforces keeps working as it always has.
|
|
71
|
+
* (`quota`): the default report is informational.
|
|
74
72
|
*/
|
|
75
73
|
private assertWithinQuota;
|
|
76
74
|
/**
|
|
@@ -182,6 +180,13 @@ declare class AgentService {
|
|
|
182
180
|
private threadDefaultAgent;
|
|
183
181
|
private toSummaryView;
|
|
184
182
|
private toDetailView;
|
|
183
|
+
/**
|
|
184
|
+
* Re-mint each replayed attachment's url from the staging store, by `mediaId`: the url persisted
|
|
185
|
+
* with the message was minted for THAT turn (a presigned url with an expiry), so an old turn would
|
|
186
|
+
* otherwise show a dead link. The store's own access check applies — an attachment it will not
|
|
187
|
+
* resolve for this actor keeps the url it was stored with.
|
|
188
|
+
*/
|
|
189
|
+
private freshAttachmentUrls;
|
|
185
190
|
promoteThread(actor: Actor, threadId: string): Promise<void>;
|
|
186
191
|
/**
|
|
187
192
|
* Drop a message and everything after it — the "edit and resend" / "delete from here" primitive.
|
|
@@ -233,12 +238,6 @@ declare class AgentService {
|
|
|
233
238
|
* otherwise render identically — as a clean file list, and as a sweep that collects nothing.
|
|
234
239
|
*/
|
|
235
240
|
private attachmentInventory;
|
|
236
|
-
/**
|
|
237
|
-
* The day's usage for the badge: tokens + summed USD cost from the store, and the configured
|
|
238
|
-
* limit from the quota store (null → unlimited). `withinLimit` comes from the quota store so it
|
|
239
|
-
* can never drift from what enforcement uses.
|
|
240
|
-
*/
|
|
241
|
-
quotaToday(actorRef: string): Promise<QuotaView>;
|
|
242
241
|
/**
|
|
243
242
|
* Authorization seam for thread-scoped endpoints: the caller must own the thread. A missing
|
|
244
243
|
* thread is a 404; someone else's thread is a 403 — one actor never touches another's thread.
|
|
@@ -313,8 +312,6 @@ declare class AgentApprovalPortAdapter implements AgentApprovalPort {
|
|
|
313
312
|
}): Promise<void>;
|
|
314
313
|
}
|
|
315
314
|
|
|
316
|
-
/** Default per-file size cap when `AgentModuleOptions.attachments.maxBytes` is omitted (20 MiB). */
|
|
317
|
-
declare const DEFAULT_MAX_ATTACHMENT_BYTES: number;
|
|
318
315
|
/**
|
|
319
316
|
* How many entries `GET /agent/attachments` returns. Fixed rather than caller-supplied: this route
|
|
320
317
|
* exists so a composer can show the files someone has uploaded, and a host that needs real paging
|
|
@@ -322,13 +319,8 @@ declare const DEFAULT_MAX_ATTACHMENT_BYTES: number;
|
|
|
322
319
|
*/
|
|
323
320
|
declare const ATTACHMENT_PAGE_SIZE = 50;
|
|
324
321
|
/**
|
|
325
|
-
*
|
|
326
|
-
|
|
327
|
-
declare const DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES: readonly string[];
|
|
328
|
-
/**
|
|
329
|
-
* Optional `POST /agent/attachments` upload surface — mounted only when `AgentModuleOptions
|
|
330
|
-
* .attachments.upload` (or the async config's `attachmentsUpload`) is `true` (see `agent.module.ts`).
|
|
331
|
-
* Multipart single file field `'file'`, buffered in memory (no disk write — `FileInterceptor`'s
|
|
322
|
+
* `POST <base>/attachments` — the multipart upload route, live whenever an
|
|
323
|
+
* `AGENT_ATTACHMENT_STAGING` provider is bound (`501` otherwise). Multipart single file field `'file'`, buffered in memory (no disk write — `FileInterceptor`'s
|
|
332
324
|
* default storage) up to {@link HARD_MAX_ATTACHMENT_BYTES}, then validated against the configured
|
|
333
325
|
* size cap + content-type allowlist and handed to the bound {@link AttachmentStagingStore} to
|
|
334
326
|
* persist and turn into a model-fetchable URL. Both size gates answer `413`: the ceiling aborts the
|
|
@@ -339,19 +331,12 @@ declare const DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES: readonly string[];
|
|
|
339
331
|
* host deleting bytes, so it stays an in-process call (`AgentService.collectableAttachments`)
|
|
340
332
|
* rather than something reachable with a session cookie.
|
|
341
333
|
*/
|
|
342
|
-
declare class AttachmentsController
|
|
334
|
+
declare class AttachmentsController {
|
|
343
335
|
private readonly options;
|
|
344
336
|
private readonly actorResolver;
|
|
345
337
|
private readonly agents;
|
|
346
338
|
private readonly staging;
|
|
347
339
|
constructor(options: AgentModuleOptions, actorResolver: ActorResolver, agents: AgentService, staging: AttachmentStagingStore | undefined);
|
|
348
|
-
/**
|
|
349
|
-
* `attachments.upload: true` is what mounts this controller at all (see `agent.module.ts`), so by
|
|
350
|
-
* the time an instance exists the host clearly intends uploads to work. Fail boot loudly rather
|
|
351
|
-
* than mounting a controller that would 501 on every single request because nobody bound
|
|
352
|
-
* `AGENT_ATTACHMENT_STAGING`.
|
|
353
|
-
*/
|
|
354
|
-
onModuleInit(): void;
|
|
355
340
|
/**
|
|
356
341
|
* The caller's own staged files, newest first — the one question `GET /agent/threads/:id` cannot
|
|
357
342
|
* answer, since an upload that was never sent belongs to no thread.
|
|
@@ -365,6 +350,29 @@ declare class AttachmentsController implements OnModuleInit {
|
|
|
365
350
|
upload(req: Request, file: Express.Multer.File | undefined): Promise<MessageAttachment>;
|
|
366
351
|
}
|
|
367
352
|
|
|
353
|
+
/** Default per-file size cap (20 MiB). */
|
|
354
|
+
declare const DEFAULT_MAX_ATTACHMENT_BYTES: number;
|
|
355
|
+
/** Default allowlist: what multimodal model providers commonly accept as native image/file parts. */
|
|
356
|
+
declare const DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES: readonly string[];
|
|
357
|
+
/** How many attachments one message may name. */
|
|
358
|
+
declare const MAX_ATTACHMENTS_PER_MESSAGE = 10;
|
|
359
|
+
/** The attachment rules in force — `AgentAttachmentConfig`, as `GET <base>/config` serves it. */
|
|
360
|
+
type AttachmentLimits = AgentAttachmentConfig;
|
|
361
|
+
/**
|
|
362
|
+
* One source for attachment limits: the staging store's own `describe()` when it declares them
|
|
363
|
+
* (`AgentMediaAttachmentsModule` does), else `AgentModule`'s `attachments` option, else the defaults.
|
|
364
|
+
*/
|
|
365
|
+
declare function attachmentLimits(options: Pick<AgentModuleOptions, 'attachments'> | undefined, staging: AttachmentStagingStore | undefined): AttachmentLimits;
|
|
366
|
+
|
|
367
|
+
declare class ConfigController {
|
|
368
|
+
private readonly options;
|
|
369
|
+
private readonly actorResolver;
|
|
370
|
+
private readonly staging;
|
|
371
|
+
private readonly models;
|
|
372
|
+
constructor(options: AgentModuleOptions, actorResolver: ActorResolver, staging: AttachmentStagingStore | undefined, models: ModelCatalog | undefined);
|
|
373
|
+
config(req: Request): Promise<AgentClientConfig>;
|
|
374
|
+
}
|
|
375
|
+
|
|
368
376
|
declare const AI_TOOL_METADATA: unique symbol;
|
|
369
377
|
interface AiToolOptions {
|
|
370
378
|
/**
|
|
@@ -931,21 +939,6 @@ declare class InProcessTokenStreamSink implements TokenStreamSink {
|
|
|
931
939
|
close(runId: string): void;
|
|
932
940
|
}
|
|
933
941
|
|
|
934
|
-
/**
|
|
935
|
-
* A production {@link QuotaStore} backed by the persisted usage ledger. `check` reads the actor's
|
|
936
|
-
* tokens-so-far for the day straight from {@link AgentStore.quotaToday} and compares it to a fixed
|
|
937
|
-
* daily limit; `bump` is a deliberate no-op because the loop's `recordUsage` already writes every
|
|
938
|
-
* turn's tokens to that same ledger. One source of truth — so enforcement and what the dashboard
|
|
939
|
-
* reports can never drift, and it works across replicas with no extra shared state.
|
|
940
|
-
*/
|
|
941
|
-
declare class LedgerQuotaStore implements QuotaStore {
|
|
942
|
-
private readonly store;
|
|
943
|
-
private readonly limitTokens;
|
|
944
|
-
constructor(store: AgentStore, limitTokens: number);
|
|
945
|
-
check(actorRef: string, day: string): Promise<QuotaState>;
|
|
946
|
-
bump(_actorRef: string, _day: string, _tokens: number): Promise<void>;
|
|
947
|
-
}
|
|
948
|
-
|
|
949
942
|
/**
|
|
950
943
|
* A development / gateway {@link ActorResolver} that trusts request headers:
|
|
951
944
|
* `x-actor-id` (required), `x-actor-role` (comma-separated → `roles`), `x-tenant-ref`.
|
|
@@ -1035,4 +1028,4 @@ declare function defaultRequestUserMapper(user: Record<string, unknown>): Actor;
|
|
|
1035
1028
|
*/
|
|
1036
1029
|
declare function requestUserActorResolver<TUser = Record<string, unknown>>(map?: RequestUserMapper<TUser>): ActorResolver;
|
|
1037
1030
|
|
|
1038
|
-
export { AGENT_METADATA, AI_TOOL_METADATA, ATTACHMENT_PAGE_SIZE, Agent, AgentApprovalPortAdapter, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AgentSkillsOptions, AiTool, AiToolDiscoveryService, type AiToolOptions, type AnonymousActorOptions, AnonymousActorResolver, AttachmentsController, type ChatParams, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, type DeclaredSkill, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner,
|
|
1031
|
+
export { AGENT_METADATA, AI_TOOL_METADATA, ATTACHMENT_PAGE_SIZE, Agent, AgentApprovalPortAdapter, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AgentSkillsOptions, AiTool, AiToolDiscoveryService, type AiToolOptions, type AnonymousActorOptions, AnonymousActorResolver, type AttachmentLimits, AttachmentsController, type ChatParams, ConfigController, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, type DeclaredSkill, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, MAX_ATTACHMENTS_PER_MESSAGE, MemoriesController, MessagesController, ModelsController, type RequestUserMapper, type ResolvedAiToolOptions, SKILL_METADATA, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, Skill, type SkillBody, SkillDiscoveryService, type SkillOptions, SkillsController, SystemPrompt, SystemPromptContributor, type ThreadDefaultAgentReader, type ThreadModelReader, ToolsController, attachmentLimits, declaredSkillProvider, defaultRequestUserMapper, readAgentMetadata, readAiToolMetadata, readSkillMetadata, requestUserActorResolver, resolveSkillsConfig, skillScope, toolNameFromClass };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DynamicModule,
|
|
2
|
-
import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, d as AgentSkillsOptions } from './agent-deps.factory-
|
|
3
|
-
export { e as AGENT_TOOL_BRAND, f as AgentAttachmentsOptions, g as AgentDeps, h as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, L as LedgerQuotaProvider, Q as QuotaLimits, i as QuotaWindowLimits, j as delegateToolName, p as provideAgentTool, k as provideAgentTools, u as utcDay } from './agent-deps.factory-
|
|
4
|
-
import { AgentRunner, AgentStore,
|
|
1
|
+
import { DynamicModule, Type, OnApplicationBootstrap, OnModuleInit } from '@nestjs/common';
|
|
2
|
+
import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, d as AgentSkillsOptions } from './agent-deps.factory-pqv_qTmJ.js';
|
|
3
|
+
export { e as AGENT_TOOL_BRAND, f as AgentAttachmentsOptions, g as AgentDeps, h as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, L as LedgerQuotaProvider, Q as QuotaLimits, i as QuotaWindowLimits, j as delegateToolName, p as provideAgentTool, k as provideAgentTools, u as utcDay } from './agent-deps.factory-pqv_qTmJ.js';
|
|
4
|
+
import { AgentRunner, AgentStore, AttachmentStagingStore, ModelCatalog, QuotaProvider, Actor, QuotaReport, ModelCatalogView, AttachmentRef, PageContext, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, AgentApprovalPort, ActorResolver, MessageAttachment, AgentAttachmentConfig, AgentClientConfig, ToolPresentation, AgentHistoryWindow, AgentIntake, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, TokenStreamSink, SinkWriter } from '@dudousxd/nestjs-agent-core';
|
|
5
5
|
export * from '@dudousxd/nestjs-agent-core';
|
|
6
6
|
import { Request } from 'express';
|
|
7
7
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
@@ -56,12 +56,11 @@ declare class AgentService {
|
|
|
56
56
|
private readonly runner;
|
|
57
57
|
private readonly store;
|
|
58
58
|
private readonly deps;
|
|
59
|
-
private readonly quota;
|
|
60
59
|
private readonly staging?;
|
|
61
60
|
private readonly models?;
|
|
62
61
|
private readonly quotaProvider?;
|
|
63
62
|
private readonly options?;
|
|
64
|
-
constructor(runner: AgentRunner, store: AgentStore, deps: AgentDepsFactory,
|
|
63
|
+
constructor(runner: AgentRunner, store: AgentStore, deps: AgentDepsFactory, staging?: AttachmentStagingStore | undefined, models?: ModelCatalog | undefined, quotaProvider?: QuotaProvider | undefined, options?: Pick<AgentModuleOptions, "quota"> | undefined);
|
|
65
64
|
/**
|
|
66
65
|
* The actor's budget across windows (`GET <base>/quota`) — the bound {@link QuotaProvider}'s
|
|
67
66
|
* report. Without one (a service built outside the module), a day window from the ledger.
|
|
@@ -69,8 +68,7 @@ declare class AgentService {
|
|
|
69
68
|
quotaReport(actor: Actor): Promise<QuotaReport>;
|
|
70
69
|
/**
|
|
71
70
|
* Refuse a turn the actor's budget no longer covers — only when the host configured one
|
|
72
|
-
* (`
|
|
73
|
-
* quota the loop enforces keeps working as it always has.
|
|
71
|
+
* (`quota`): the default report is informational.
|
|
74
72
|
*/
|
|
75
73
|
private assertWithinQuota;
|
|
76
74
|
/**
|
|
@@ -182,6 +180,13 @@ declare class AgentService {
|
|
|
182
180
|
private threadDefaultAgent;
|
|
183
181
|
private toSummaryView;
|
|
184
182
|
private toDetailView;
|
|
183
|
+
/**
|
|
184
|
+
* Re-mint each replayed attachment's url from the staging store, by `mediaId`: the url persisted
|
|
185
|
+
* with the message was minted for THAT turn (a presigned url with an expiry), so an old turn would
|
|
186
|
+
* otherwise show a dead link. The store's own access check applies — an attachment it will not
|
|
187
|
+
* resolve for this actor keeps the url it was stored with.
|
|
188
|
+
*/
|
|
189
|
+
private freshAttachmentUrls;
|
|
185
190
|
promoteThread(actor: Actor, threadId: string): Promise<void>;
|
|
186
191
|
/**
|
|
187
192
|
* Drop a message and everything after it — the "edit and resend" / "delete from here" primitive.
|
|
@@ -233,12 +238,6 @@ declare class AgentService {
|
|
|
233
238
|
* otherwise render identically — as a clean file list, and as a sweep that collects nothing.
|
|
234
239
|
*/
|
|
235
240
|
private attachmentInventory;
|
|
236
|
-
/**
|
|
237
|
-
* The day's usage for the badge: tokens + summed USD cost from the store, and the configured
|
|
238
|
-
* limit from the quota store (null → unlimited). `withinLimit` comes from the quota store so it
|
|
239
|
-
* can never drift from what enforcement uses.
|
|
240
|
-
*/
|
|
241
|
-
quotaToday(actorRef: string): Promise<QuotaView>;
|
|
242
241
|
/**
|
|
243
242
|
* Authorization seam for thread-scoped endpoints: the caller must own the thread. A missing
|
|
244
243
|
* thread is a 404; someone else's thread is a 403 — one actor never touches another's thread.
|
|
@@ -313,8 +312,6 @@ declare class AgentApprovalPortAdapter implements AgentApprovalPort {
|
|
|
313
312
|
}): Promise<void>;
|
|
314
313
|
}
|
|
315
314
|
|
|
316
|
-
/** Default per-file size cap when `AgentModuleOptions.attachments.maxBytes` is omitted (20 MiB). */
|
|
317
|
-
declare const DEFAULT_MAX_ATTACHMENT_BYTES: number;
|
|
318
315
|
/**
|
|
319
316
|
* How many entries `GET /agent/attachments` returns. Fixed rather than caller-supplied: this route
|
|
320
317
|
* exists so a composer can show the files someone has uploaded, and a host that needs real paging
|
|
@@ -322,13 +319,8 @@ declare const DEFAULT_MAX_ATTACHMENT_BYTES: number;
|
|
|
322
319
|
*/
|
|
323
320
|
declare const ATTACHMENT_PAGE_SIZE = 50;
|
|
324
321
|
/**
|
|
325
|
-
*
|
|
326
|
-
|
|
327
|
-
declare const DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES: readonly string[];
|
|
328
|
-
/**
|
|
329
|
-
* Optional `POST /agent/attachments` upload surface — mounted only when `AgentModuleOptions
|
|
330
|
-
* .attachments.upload` (or the async config's `attachmentsUpload`) is `true` (see `agent.module.ts`).
|
|
331
|
-
* Multipart single file field `'file'`, buffered in memory (no disk write — `FileInterceptor`'s
|
|
322
|
+
* `POST <base>/attachments` — the multipart upload route, live whenever an
|
|
323
|
+
* `AGENT_ATTACHMENT_STAGING` provider is bound (`501` otherwise). Multipart single file field `'file'`, buffered in memory (no disk write — `FileInterceptor`'s
|
|
332
324
|
* default storage) up to {@link HARD_MAX_ATTACHMENT_BYTES}, then validated against the configured
|
|
333
325
|
* size cap + content-type allowlist and handed to the bound {@link AttachmentStagingStore} to
|
|
334
326
|
* persist and turn into a model-fetchable URL. Both size gates answer `413`: the ceiling aborts the
|
|
@@ -339,19 +331,12 @@ declare const DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES: readonly string[];
|
|
|
339
331
|
* host deleting bytes, so it stays an in-process call (`AgentService.collectableAttachments`)
|
|
340
332
|
* rather than something reachable with a session cookie.
|
|
341
333
|
*/
|
|
342
|
-
declare class AttachmentsController
|
|
334
|
+
declare class AttachmentsController {
|
|
343
335
|
private readonly options;
|
|
344
336
|
private readonly actorResolver;
|
|
345
337
|
private readonly agents;
|
|
346
338
|
private readonly staging;
|
|
347
339
|
constructor(options: AgentModuleOptions, actorResolver: ActorResolver, agents: AgentService, staging: AttachmentStagingStore | undefined);
|
|
348
|
-
/**
|
|
349
|
-
* `attachments.upload: true` is what mounts this controller at all (see `agent.module.ts`), so by
|
|
350
|
-
* the time an instance exists the host clearly intends uploads to work. Fail boot loudly rather
|
|
351
|
-
* than mounting a controller that would 501 on every single request because nobody bound
|
|
352
|
-
* `AGENT_ATTACHMENT_STAGING`.
|
|
353
|
-
*/
|
|
354
|
-
onModuleInit(): void;
|
|
355
340
|
/**
|
|
356
341
|
* The caller's own staged files, newest first — the one question `GET /agent/threads/:id` cannot
|
|
357
342
|
* answer, since an upload that was never sent belongs to no thread.
|
|
@@ -365,6 +350,29 @@ declare class AttachmentsController implements OnModuleInit {
|
|
|
365
350
|
upload(req: Request, file: Express.Multer.File | undefined): Promise<MessageAttachment>;
|
|
366
351
|
}
|
|
367
352
|
|
|
353
|
+
/** Default per-file size cap (20 MiB). */
|
|
354
|
+
declare const DEFAULT_MAX_ATTACHMENT_BYTES: number;
|
|
355
|
+
/** Default allowlist: what multimodal model providers commonly accept as native image/file parts. */
|
|
356
|
+
declare const DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES: readonly string[];
|
|
357
|
+
/** How many attachments one message may name. */
|
|
358
|
+
declare const MAX_ATTACHMENTS_PER_MESSAGE = 10;
|
|
359
|
+
/** The attachment rules in force — `AgentAttachmentConfig`, as `GET <base>/config` serves it. */
|
|
360
|
+
type AttachmentLimits = AgentAttachmentConfig;
|
|
361
|
+
/**
|
|
362
|
+
* One source for attachment limits: the staging store's own `describe()` when it declares them
|
|
363
|
+
* (`AgentMediaAttachmentsModule` does), else `AgentModule`'s `attachments` option, else the defaults.
|
|
364
|
+
*/
|
|
365
|
+
declare function attachmentLimits(options: Pick<AgentModuleOptions, 'attachments'> | undefined, staging: AttachmentStagingStore | undefined): AttachmentLimits;
|
|
366
|
+
|
|
367
|
+
declare class ConfigController {
|
|
368
|
+
private readonly options;
|
|
369
|
+
private readonly actorResolver;
|
|
370
|
+
private readonly staging;
|
|
371
|
+
private readonly models;
|
|
372
|
+
constructor(options: AgentModuleOptions, actorResolver: ActorResolver, staging: AttachmentStagingStore | undefined, models: ModelCatalog | undefined);
|
|
373
|
+
config(req: Request): Promise<AgentClientConfig>;
|
|
374
|
+
}
|
|
375
|
+
|
|
368
376
|
declare const AI_TOOL_METADATA: unique symbol;
|
|
369
377
|
interface AiToolOptions {
|
|
370
378
|
/**
|
|
@@ -931,21 +939,6 @@ declare class InProcessTokenStreamSink implements TokenStreamSink {
|
|
|
931
939
|
close(runId: string): void;
|
|
932
940
|
}
|
|
933
941
|
|
|
934
|
-
/**
|
|
935
|
-
* A production {@link QuotaStore} backed by the persisted usage ledger. `check` reads the actor's
|
|
936
|
-
* tokens-so-far for the day straight from {@link AgentStore.quotaToday} and compares it to a fixed
|
|
937
|
-
* daily limit; `bump` is a deliberate no-op because the loop's `recordUsage` already writes every
|
|
938
|
-
* turn's tokens to that same ledger. One source of truth — so enforcement and what the dashboard
|
|
939
|
-
* reports can never drift, and it works across replicas with no extra shared state.
|
|
940
|
-
*/
|
|
941
|
-
declare class LedgerQuotaStore implements QuotaStore {
|
|
942
|
-
private readonly store;
|
|
943
|
-
private readonly limitTokens;
|
|
944
|
-
constructor(store: AgentStore, limitTokens: number);
|
|
945
|
-
check(actorRef: string, day: string): Promise<QuotaState>;
|
|
946
|
-
bump(_actorRef: string, _day: string, _tokens: number): Promise<void>;
|
|
947
|
-
}
|
|
948
|
-
|
|
949
942
|
/**
|
|
950
943
|
* A development / gateway {@link ActorResolver} that trusts request headers:
|
|
951
944
|
* `x-actor-id` (required), `x-actor-role` (comma-separated → `roles`), `x-tenant-ref`.
|
|
@@ -1035,4 +1028,4 @@ declare function defaultRequestUserMapper(user: Record<string, unknown>): Actor;
|
|
|
1035
1028
|
*/
|
|
1036
1029
|
declare function requestUserActorResolver<TUser = Record<string, unknown>>(map?: RequestUserMapper<TUser>): ActorResolver;
|
|
1037
1030
|
|
|
1038
|
-
export { AGENT_METADATA, AI_TOOL_METADATA, ATTACHMENT_PAGE_SIZE, Agent, AgentApprovalPortAdapter, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AgentSkillsOptions, AiTool, AiToolDiscoveryService, type AiToolOptions, type AnonymousActorOptions, AnonymousActorResolver, AttachmentsController, type ChatParams, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, type DeclaredSkill, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner,
|
|
1031
|
+
export { AGENT_METADATA, AI_TOOL_METADATA, ATTACHMENT_PAGE_SIZE, Agent, AgentApprovalPortAdapter, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AgentSkillsOptions, AiTool, AiToolDiscoveryService, type AiToolOptions, type AnonymousActorOptions, AnonymousActorResolver, type AttachmentLimits, AttachmentsController, type ChatParams, ConfigController, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, type DeclaredSkill, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, MAX_ATTACHMENTS_PER_MESSAGE, MemoriesController, MessagesController, ModelsController, type RequestUserMapper, type ResolvedAiToolOptions, SKILL_METADATA, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, Skill, type SkillBody, SkillDiscoveryService, type SkillOptions, SkillsController, SystemPrompt, SystemPromptContributor, type ThreadDefaultAgentReader, type ThreadModelReader, ToolsController, attachmentLimits, declaredSkillProvider, defaultRequestUserMapper, readAgentMetadata, readAiToolMetadata, readSkillMetadata, requestUserActorResolver, resolveSkillsConfig, skillScope, toolNameFromClass };
|