@dudousxd/nestjs-agent 1.36.1 → 1.37.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.
@@ -1,8 +1,8 @@
1
1
  import { A2uiStreamOptions, a2uiThreadReplay } from '@dudousxd/nestjs-agent-core/a2ui';
2
- import { AgentAttachmentConfig, AttachmentStagingStore, AgentStore, Actor, ListActionProposals, ActionProposalView, ActionProposalMutationView, TextActionProposalVocabulary, AgentRunner, ModelCatalog, QuotaProvider, ActionApprovalMode, MessageAttachment, QuotaReport, ModelCatalogView, AgentHostContext, AttachmentRef, PageContext, ChatQueueState, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, ActorResolver } from '@dudousxd/nestjs-agent-core';
2
+ import { AgentAttachmentConfig, AttachmentStagingStore, AgentStore, Actor, ListActionProposals, ActionProposalView, ActionProposalMutationView, TextActionProposalVocabulary, AgentRunner, ModelCatalog, QuotaProvider, ActionApprovalMode, MessageAttachment, QuotaReport, ModelCatalogView, AgentHostContext, AttachmentRef, PageContext, ChatQueueState, SubscribeOptions, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, ActorResolver } from '@dudousxd/nestjs-agent-core';
3
3
  import { Request, Response } from 'express';
4
4
  import { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
5
- import { b as AgentModuleOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter } from './chat-queue.service-CF2fcJDx.cjs';
5
+ import { b as AgentModuleOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter } from './chat-queue.service-fopUN313.cjs';
6
6
 
7
7
  /** Default per-file size cap (20 MiB). */
8
8
  declare const DEFAULT_MAX_ATTACHMENT_BYTES: number;
@@ -167,6 +167,22 @@ interface ChatParams {
167
167
  interface ThreadDefaultAgentReader {
168
168
  defaultAgentForThread(threadId: string): Promise<string | null>;
169
169
  }
170
+ /** What {@link AgentService.forkThread} takes past the thread and the message to copy up to. */
171
+ interface ForkThreadParams {
172
+ /**
173
+ * The HOST already decided this actor may read the thread — "continue this conversation" from a
174
+ * link its owner shared. Skips the ownership check, and the copy belongs to the CALLER, not the
175
+ * source's owner; the original is left as it was. Never set it from a request's own claim: the
176
+ * `POST /threads/:id/fork-from/:messageId` route never does, so it stays owner-only.
177
+ */
178
+ authorized?: boolean;
179
+ /**
180
+ * The copy's tenant — see `ForkThreadOptions.tenantRef`. Absent keeps the SOURCE's, even when the
181
+ * copy now belongs to someone else; forking across tenants, pass the caller's
182
+ * (`actor.tenantRef ?? null`). `null` clears it.
183
+ */
184
+ tenantRef?: string | null;
185
+ }
170
186
  /** Like {@link ThreadDefaultAgentReader}, for the thread's pinned model. */
171
187
  interface ThreadModelReader {
172
188
  modelForThread(threadId: string): Promise<string | null>;
@@ -355,14 +371,14 @@ declare class AgentService {
355
371
  * {@link subscribeAs} instead: a runId is the only thing standing between a caller and another
356
372
  * actor's answer, tool arguments and tool results.
357
373
  */
358
- subscribe(runId: string): AsyncIterable<Uint8Array>;
374
+ subscribe(runId: string, options?: SubscribeOptions): AsyncIterable<Uint8Array>;
359
375
  /**
360
376
  * {@link subscribe}, gated the way {@link cancel} is: only the actor whose thread is currently
361
377
  * streaming this run may read it. A run that has already finished is reported missing rather than
362
378
  * replayed — the runner clears the thread's active stream as the run ends, and that field is what
363
379
  * ownership is derived from.
364
380
  */
365
- subscribeAs(actor: Actor, runId: string): Promise<AsyncIterable<Uint8Array>>;
381
+ subscribeAs(actor: Actor, runId: string, options?: SubscribeOptions): Promise<AsyncIterable<Uint8Array>>;
366
382
  /**
367
383
  * Approve a parked action call as `actor`. Who may is the call's recorded approver's business
368
384
  * (see {@link assertMayDecide}); `remember` approves later calls of the same tool in the same
@@ -430,7 +446,12 @@ declare class AgentService {
430
446
  listThreads(actorRef: string): Promise<ThreadSummary[]>;
431
447
  getThread(actor: Actor, threadId: string): Promise<ThreadDetail | null>;
432
448
  deleteThread(actor: Actor, threadId: string): Promise<void>;
433
- forkThread(actor: Actor, threadId: string, fromMessageId: string): Promise<ThreadSummary>;
449
+ /**
450
+ * Copy a thread up to `fromMessageId` (inclusive) into a new one. By default only the thread's
451
+ * owner may, and the copy is theirs. With `params.authorized`, the host has vouched for `actor`
452
+ * (a share link it checked) and the copy is `actor`'s — see {@link ForkThreadParams}.
453
+ */
454
+ forkThread(actor: Actor, threadId: string, fromMessageId: string, params?: ForkThreadParams): Promise<ThreadSummary>;
434
455
  /** Kept for source compatibility — a thin wrapper over the more general `updateThread`. */
435
456
  renameThread(actor: Actor, threadId: string, title: string): Promise<void>;
436
457
  /**
@@ -460,6 +481,8 @@ declare class AgentService {
460
481
  * the full read.
461
482
  */
462
483
  private resolveAgentName;
484
+ /** Everything a send reads off `threadId`, in one read where the store allows it. */
485
+ private threadReads;
463
486
  private threadDefaultAgent;
464
487
  private toSummaryView;
465
488
  private toDetailView;
@@ -645,4 +668,4 @@ declare class A2uiRunHandler {
645
668
  */
646
669
  declare function a2uiAdapter(options?: A2uiAdapterOptions): AgentProtocolAdapter;
647
670
 
648
- export { AgentService as A, type ChatParams as C, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES as D, MAX_ATTACHMENTS_PER_MESSAGE as M, NO_USER_MESSAGE_CODE as N, type QueuedSend as Q, type ThreadDefaultAgentReader as T, ActionProposalService as a, type A2uiAdapterOptions as b, A2uiRunHandler as c, type AttachmentLimits as d, type ChatSendMode as e, type ChatSendResult as f, DEFAULT_MAX_ATTACHMENT_BYTES as g, type ThreadModelReader as h, a2uiAdapter as i, attachmentLimits as j };
671
+ export { AgentService as A, type ChatParams as C, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES as D, type ForkThreadParams as F, MAX_ATTACHMENTS_PER_MESSAGE as M, NO_USER_MESSAGE_CODE as N, type QueuedSend as Q, type ThreadDefaultAgentReader as T, ActionProposalService as a, type A2uiAdapterOptions as b, A2uiRunHandler as c, type AttachmentLimits as d, type ChatSendMode as e, type ChatSendResult as f, DEFAULT_MAX_ATTACHMENT_BYTES as g, type ThreadModelReader as h, a2uiAdapter as i, attachmentLimits as j };
@@ -1,8 +1,8 @@
1
1
  import { A2uiStreamOptions, a2uiThreadReplay } from '@dudousxd/nestjs-agent-core/a2ui';
2
- import { AgentAttachmentConfig, AttachmentStagingStore, AgentStore, Actor, ListActionProposals, ActionProposalView, ActionProposalMutationView, TextActionProposalVocabulary, AgentRunner, ModelCatalog, QuotaProvider, ActionApprovalMode, MessageAttachment, QuotaReport, ModelCatalogView, AgentHostContext, AttachmentRef, PageContext, ChatQueueState, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, ActorResolver } from '@dudousxd/nestjs-agent-core';
2
+ import { AgentAttachmentConfig, AttachmentStagingStore, AgentStore, Actor, ListActionProposals, ActionProposalView, ActionProposalMutationView, TextActionProposalVocabulary, AgentRunner, ModelCatalog, QuotaProvider, ActionApprovalMode, MessageAttachment, QuotaReport, ModelCatalogView, AgentHostContext, AttachmentRef, PageContext, ChatQueueState, SubscribeOptions, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, ActorResolver } from '@dudousxd/nestjs-agent-core';
3
3
  import { Request, Response } from 'express';
4
4
  import { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
5
- import { b as AgentModuleOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter } from './chat-queue.service-CzXsKVb1.js';
5
+ import { b as AgentModuleOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter } from './chat-queue.service-YjiKVTKE.js';
6
6
 
7
7
  /** Default per-file size cap (20 MiB). */
8
8
  declare const DEFAULT_MAX_ATTACHMENT_BYTES: number;
@@ -167,6 +167,22 @@ interface ChatParams {
167
167
  interface ThreadDefaultAgentReader {
168
168
  defaultAgentForThread(threadId: string): Promise<string | null>;
169
169
  }
170
+ /** What {@link AgentService.forkThread} takes past the thread and the message to copy up to. */
171
+ interface ForkThreadParams {
172
+ /**
173
+ * The HOST already decided this actor may read the thread — "continue this conversation" from a
174
+ * link its owner shared. Skips the ownership check, and the copy belongs to the CALLER, not the
175
+ * source's owner; the original is left as it was. Never set it from a request's own claim: the
176
+ * `POST /threads/:id/fork-from/:messageId` route never does, so it stays owner-only.
177
+ */
178
+ authorized?: boolean;
179
+ /**
180
+ * The copy's tenant — see `ForkThreadOptions.tenantRef`. Absent keeps the SOURCE's, even when the
181
+ * copy now belongs to someone else; forking across tenants, pass the caller's
182
+ * (`actor.tenantRef ?? null`). `null` clears it.
183
+ */
184
+ tenantRef?: string | null;
185
+ }
170
186
  /** Like {@link ThreadDefaultAgentReader}, for the thread's pinned model. */
171
187
  interface ThreadModelReader {
172
188
  modelForThread(threadId: string): Promise<string | null>;
@@ -355,14 +371,14 @@ declare class AgentService {
355
371
  * {@link subscribeAs} instead: a runId is the only thing standing between a caller and another
356
372
  * actor's answer, tool arguments and tool results.
357
373
  */
358
- subscribe(runId: string): AsyncIterable<Uint8Array>;
374
+ subscribe(runId: string, options?: SubscribeOptions): AsyncIterable<Uint8Array>;
359
375
  /**
360
376
  * {@link subscribe}, gated the way {@link cancel} is: only the actor whose thread is currently
361
377
  * streaming this run may read it. A run that has already finished is reported missing rather than
362
378
  * replayed — the runner clears the thread's active stream as the run ends, and that field is what
363
379
  * ownership is derived from.
364
380
  */
365
- subscribeAs(actor: Actor, runId: string): Promise<AsyncIterable<Uint8Array>>;
381
+ subscribeAs(actor: Actor, runId: string, options?: SubscribeOptions): Promise<AsyncIterable<Uint8Array>>;
366
382
  /**
367
383
  * Approve a parked action call as `actor`. Who may is the call's recorded approver's business
368
384
  * (see {@link assertMayDecide}); `remember` approves later calls of the same tool in the same
@@ -430,7 +446,12 @@ declare class AgentService {
430
446
  listThreads(actorRef: string): Promise<ThreadSummary[]>;
431
447
  getThread(actor: Actor, threadId: string): Promise<ThreadDetail | null>;
432
448
  deleteThread(actor: Actor, threadId: string): Promise<void>;
433
- forkThread(actor: Actor, threadId: string, fromMessageId: string): Promise<ThreadSummary>;
449
+ /**
450
+ * Copy a thread up to `fromMessageId` (inclusive) into a new one. By default only the thread's
451
+ * owner may, and the copy is theirs. With `params.authorized`, the host has vouched for `actor`
452
+ * (a share link it checked) and the copy is `actor`'s — see {@link ForkThreadParams}.
453
+ */
454
+ forkThread(actor: Actor, threadId: string, fromMessageId: string, params?: ForkThreadParams): Promise<ThreadSummary>;
434
455
  /** Kept for source compatibility — a thin wrapper over the more general `updateThread`. */
435
456
  renameThread(actor: Actor, threadId: string, title: string): Promise<void>;
436
457
  /**
@@ -460,6 +481,8 @@ declare class AgentService {
460
481
  * the full read.
461
482
  */
462
483
  private resolveAgentName;
484
+ /** Everything a send reads off `threadId`, in one read where the store allows it. */
485
+ private threadReads;
463
486
  private threadDefaultAgent;
464
487
  private toSummaryView;
465
488
  private toDetailView;
@@ -645,4 +668,4 @@ declare class A2uiRunHandler {
645
668
  */
646
669
  declare function a2uiAdapter(options?: A2uiAdapterOptions): AgentProtocolAdapter;
647
670
 
648
- export { AgentService as A, type ChatParams as C, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES as D, MAX_ATTACHMENTS_PER_MESSAGE as M, NO_USER_MESSAGE_CODE as N, type QueuedSend as Q, type ThreadDefaultAgentReader as T, ActionProposalService as a, type A2uiAdapterOptions as b, A2uiRunHandler as c, type AttachmentLimits as d, type ChatSendMode as e, type ChatSendResult as f, DEFAULT_MAX_ATTACHMENT_BYTES as g, type ThreadModelReader as h, a2uiAdapter as i, attachmentLimits as j };
671
+ export { AgentService as A, type ChatParams as C, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES as D, type ForkThreadParams as F, MAX_ATTACHMENTS_PER_MESSAGE as M, NO_USER_MESSAGE_CODE as N, type QueuedSend as Q, type ThreadDefaultAgentReader as T, ActionProposalService as a, type A2uiAdapterOptions as b, A2uiRunHandler as c, type AttachmentLimits as d, type ChatSendMode as e, type ChatSendResult as f, DEFAULT_MAX_ATTACHMENT_BYTES as g, type ThreadModelReader as h, a2uiAdapter as i, attachmentLimits as j };