@dudousxd/nestjs-agent 1.36.2 → 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,5 +1,5 @@
1
1
  export * from '@dudousxd/nestjs-agent-core/a2ui';
2
- export { b as A2uiAdapterOptions, c as A2uiRunHandler, i as a2uiAdapter } from '../index-CJdTomOT.cjs';
2
+ export { b as A2uiAdapterOptions, c as A2uiRunHandler, i as a2uiAdapter } from '../index-4caNqEQ-.cjs';
3
3
  import '@dudousxd/nestjs-agent-core';
4
4
  import 'express';
5
5
  import '@dudousxd/nestjs-agent-core/genui';
@@ -1,5 +1,5 @@
1
1
  export * from '@dudousxd/nestjs-agent-core/a2ui';
2
- export { b as A2uiAdapterOptions, c as A2uiRunHandler, i as a2uiAdapter } from '../index-D1xRrnCq.js';
2
+ export { b as A2uiAdapterOptions, c as A2uiRunHandler, i as a2uiAdapter } from '../index-yC_Ra3CE.js';
3
3
  import '@dudousxd/nestjs-agent-core';
4
4
  import 'express';
5
5
  import '@dudousxd/nestjs-agent-core/genui';
@@ -3841,9 +3841,28 @@ var AgentService = class {
3841
3841
  await this.assertOwnsThread(actor, threadId);
3842
3842
  return this.store.softDeleteThread(threadId);
3843
3843
  }
3844
- async forkThread(actor, threadId, fromMessageId) {
3845
- await this.assertOwnsThread(actor, threadId);
3846
- return this.store.forkThread(threadId, fromMessageId);
3844
+ /**
3845
+ * Copy a thread up to `fromMessageId` (inclusive) into a new one. By default only the thread's
3846
+ * owner may, and the copy is theirs. With `params.authorized`, the host has vouched for `actor`
3847
+ * (a share link it checked) and the copy is `actor`'s — see {@link ForkThreadParams}.
3848
+ */
3849
+ async forkThread(actor, threadId, fromMessageId, params = {}) {
3850
+ if (params.authorized === true) {
3851
+ if (await this.store.ownerOfThread(threadId) === null) {
3852
+ throw new import_common10.NotFoundException(`thread ${threadId} not found`);
3853
+ }
3854
+ } else {
3855
+ await this.assertOwnsThread(actor, threadId);
3856
+ }
3857
+ const options = {
3858
+ ...params.authorized === true ? {
3859
+ actorRef: actor.id
3860
+ } : {},
3861
+ ...params.tenantRef !== void 0 ? {
3862
+ tenantRef: params.tenantRef
3863
+ } : {}
3864
+ };
3865
+ return this.store.forkThread(threadId, fromMessageId, options);
3847
3866
  }
3848
3867
  /** Kept for source compatibility — a thin wrapper over the more general `updateThread`. */
3849
3868
  async renameThread(actor, threadId, title) {