@copilotkitnext/core 1.54.1-next.6 → 1.54.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/dist/index.umd.js CHANGED
@@ -3019,6 +3019,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3019
3019
  context: null,
3020
3020
  sessionId: 0,
3021
3021
  metadataCredentialsRequested: false,
3022
+ metadataJoinCode: null,
3022
3023
  nextCursor: null
3023
3024
  };
3024
3025
  const threadAdapterEvents = createActionGroup("Thread Adapter", {
@@ -3071,6 +3072,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3071
3072
  isFetchingNextPage: false,
3072
3073
  error: null,
3073
3074
  metadataCredentialsRequested: false,
3075
+ metadataJoinCode: null,
3074
3076
  nextCursor: null
3075
3077
  })), on(threadAdapterEvents.stopped, (state) => ({
3076
3078
  ...state,
@@ -3079,6 +3081,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3079
3081
  isFetchingNextPage: false,
3080
3082
  error: null,
3081
3083
  metadataCredentialsRequested: false,
3084
+ metadataJoinCode: null,
3082
3085
  nextCursor: null
3083
3086
  })), on(threadRestEvents.listRequested, (state, { sessionId }) => {
3084
3087
  if (sessionId !== state.sessionId || !state.context) return state;
@@ -3087,13 +3090,14 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3087
3090
  isLoading: true,
3088
3091
  error: null
3089
3092
  };
3090
- }), on(threadRestEvents.listSucceeded, (state, { sessionId, threads, nextCursor }) => {
3093
+ }), on(threadRestEvents.listSucceeded, (state, { sessionId, threads, joinCode, nextCursor }) => {
3091
3094
  if (sessionId !== state.sessionId) return state;
3092
3095
  return {
3093
3096
  ...state,
3094
3097
  threads: sortThreadsByUpdatedAt(threads),
3095
3098
  isLoading: false,
3096
3099
  error: null,
3100
+ metadataJoinCode: joinCode,
3097
3101
  nextCursor
3098
3102
  };
3099
3103
  }), on(threadRestEvents.listFailed, (state, { sessionId, error }) => {
@@ -3166,10 +3170,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3166
3170
  }
3167
3171
  function createThreadFetchObservable(environment, context, sessionId) {
3168
3172
  return (0, rxjs.defer)(() => {
3169
- const params = {
3170
- userId: context.userId,
3171
- agentId: context.agentId
3172
- };
3173
+ const params = { agentId: context.agentId };
3173
3174
  if (context.includeArchived) params.includeArchived = "true";
3174
3175
  if (context.limit != null) params.limit = String(context.limit);
3175
3176
  const qs = new URLSearchParams(params);
@@ -3191,6 +3192,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3191
3192
  return threadRestEvents.listSucceeded({
3192
3193
  sessionId,
3193
3194
  threads: data.threads,
3195
+ joinCode: typeof data.joinCode === "string" && data.joinCode.length > 0 ? data.joinCode : null,
3194
3196
  nextCursor: (_data$nextCursor = data.nextCursor) !== null && _data$nextCursor !== void 0 ? _data$nextCursor : null
3195
3197
  });
3196
3198
  }), (0, rxjs_operators.catchError)((error) => {
@@ -3214,7 +3216,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3214
3216
  ...context.headers,
3215
3217
  "Content-Type": "application/json"
3216
3218
  },
3217
- body: JSON.stringify({ userId: context.userId })
3219
+ body: JSON.stringify({})
3218
3220
  }).pipe((0, rxjs_operators.timeout)({
3219
3221
  first: REQUEST_TIMEOUT_MS,
3220
3222
  with: () => {
@@ -3271,7 +3273,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3271
3273
  })), (0, rxjs_operators.takeUntil)(actions$.pipe(ofType(threadAdapterEvents.contextChanged, threadAdapterEvents.stopped))), (0, rxjs_operators.switchMap)(({ action: currentAction, context }) => createThreadFetchObservable(environment, context, currentAction.sessionId)))))),
3272
3274
  createEffect((actions$, state$) => actions$.pipe(ofType(threadRestEvents.listSucceeded), (0, rxjs_operators.withLatestFrom)(state$), (0, rxjs_operators.filter)(([action, state]) => {
3273
3275
  var _state$context;
3274
- return action.sessionId === state.sessionId && !state.metadataCredentialsRequested && Boolean((_state$context = state.context) === null || _state$context === void 0 ? void 0 : _state$context.wsUrl);
3276
+ return action.sessionId === state.sessionId && !state.metadataCredentialsRequested && Boolean((_state$context = state.context) === null || _state$context === void 0 ? void 0 : _state$context.wsUrl) && Boolean(state.metadataJoinCode);
3275
3277
  }), (0, rxjs_operators.map)(([action]) => threadRestEvents.metadataCredentialsRequested({ sessionId: action.sessionId })))),
3276
3278
  createEffect((actions$, state$) => actions$.pipe(ofType(threadRestEvents.metadataCredentialsRequested), (0, rxjs_operators.switchMap)((action) => state$.pipe((0, rxjs_operators.map)((state) => state.context), (0, rxjs_operators.filter)((context) => Boolean(context)), (0, rxjs_operators.take)(1), (0, rxjs_operators.map)((context) => ({
3277
3279
  action,
@@ -3283,6 +3285,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3283
3285
  }), (0, rxjs_operators.switchMap)(([action, state]) => {
3284
3286
  const context = state.context;
3285
3287
  const joinToken = action.joinToken;
3288
+ const joinCode = state.metadataJoinCode;
3286
3289
  const shutdown$ = actions$.pipe(ofType(threadAdapterEvents.contextChanged, threadAdapterEvents.stopped));
3287
3290
  return (0, rxjs.defer)(() => {
3288
3291
  const socket$ = ɵphoenixSocket$({
@@ -3298,7 +3301,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3298
3301
  }));
3299
3302
  const channel$ = ɵphoenixChannel$({
3300
3303
  socket$,
3301
- topic: `user_meta:${context.userId}`
3304
+ topic: `user_meta:${joinCode}`
3302
3305
  }).pipe((0, rxjs_operators.shareReplay)({
3303
3306
  bufferSize: 1,
3304
3307
  refCount: true
@@ -3314,16 +3317,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3314
3317
  }))), ɵobservePhoenixJoinOutcome$(channel$).pipe((0, rxjs_operators.filter)((outcome) => outcome.type !== "joined"), (0, rxjs_operators.map)((outcome) => outcome.type === "timeout" ? threadSocketEvents.joinTimedOut({ sessionId: action.sessionId }) : threadSocketEvents.joinFailed({ sessionId: action.sessionId })))).pipe((0, rxjs_operators.takeUntil)((0, rxjs.merge)(shutdown$, fatalSocketShutdown$)));
3315
3318
  });
3316
3319
  }))),
3317
- createEffect((actions$, state$) => actions$.pipe(ofType(threadSocketEvents.metadataReceived), (0, rxjs_operators.withLatestFrom)(state$), (0, rxjs_operators.filter)(([action, state]) => {
3320
+ createEffect((actions$, state$) => actions$.pipe(ofType(threadSocketEvents.metadataReceived), (0, rxjs_operators.withLatestFrom)(state$), (0, rxjs_operators.filter)(([action, state]) => action.sessionId === state.sessionId), (0, rxjs_operators.map)(([action, state]) => {
3318
3321
  var _state$context3;
3319
- return action.sessionId === state.sessionId && action.payload.userId === ((_state$context3 = state.context) === null || _state$context3 === void 0 ? void 0 : _state$context3.userId);
3320
- }), (0, rxjs_operators.map)(([action, state]) => {
3321
- var _state$context4;
3322
3322
  if (action.payload.operation === "deleted") return threadDomainEvents.threadDeleted({
3323
3323
  sessionId: action.sessionId,
3324
3324
  threadId: action.payload.deleted.id
3325
3325
  });
3326
- if (action.payload.operation === "archived" && !((_state$context4 = state.context) === null || _state$context4 === void 0 ? void 0 : _state$context4.includeArchived)) return threadDomainEvents.threadDeleted({
3326
+ if (action.payload.operation === "archived" && !((_state$context3 = state.context) === null || _state$context3 === void 0 ? void 0 : _state$context3.includeArchived)) return threadDomainEvents.threadDeleted({
3327
3327
  sessionId: action.sessionId,
3328
3328
  threadId: action.payload.threadId
3329
3329
  });
@@ -3335,7 +3335,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3335
3335
  createEffect((actions$, state$) => actions$.pipe(ofType(threadAdapterEvents.fetchNextPageRequested), (0, rxjs_operators.withLatestFrom)(state$), (0, rxjs_operators.filter)(([, state]) => Boolean(state.context) && Boolean(state.nextCursor)), (0, rxjs_operators.switchMap)(([, state]) => {
3336
3336
  const context = state.context;
3337
3337
  const params = {
3338
- userId: context.userId,
3339
3338
  agentId: context.agentId,
3340
3339
  cursor: state.nextCursor
3341
3340
  };
@@ -3376,10 +3375,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3376
3375
  error: /* @__PURE__ */ new Error("Runtime URL is not configured")
3377
3376
  } }));
3378
3377
  }
3379
- const commonBody = {
3380
- userId: context.userId,
3381
- agentId: context.agentId
3382
- };
3378
+ const commonBody = { agentId: context.agentId };
3383
3379
  if (threadAdapterEvents.renameRequested.match(action)) return createThreadMutationObservable(environment, context, {
3384
3380
  requestId: action.requestId,
3385
3381
  method: "PATCH",