@copilotkit/core 1.64.2 → 1.64.3-canary.1785623356
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.cjs +12 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +12 -8
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +12 -8
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -3425,13 +3425,15 @@ function createMemoryCredentialsFetchObservable(environment, context, sessionId)
|
|
|
3425
3425
|
throw new MemoryError("MEMORY_REQUEST_TIMEOUT");
|
|
3426
3426
|
}
|
|
3427
3427
|
}), (0, rxjs_operators.map)((data) => {
|
|
3428
|
-
|
|
3429
|
-
if (typeof data.joinCode !== "string" || data.joinCode.length === 0) throw new Error("missing joinCode");
|
|
3428
|
+
const hasUserCreds = typeof data.joinToken === "string" && data.joinToken.length > 0 && typeof data.joinCode === "string" && data.joinCode.length > 0;
|
|
3430
3429
|
const hasProjectCreds = typeof data.projectJoinToken === "string" && data.projectJoinToken.length > 0 && typeof data.projectJoinCode === "string" && data.projectJoinCode.length > 0;
|
|
3430
|
+
if (!hasUserCreds && !hasProjectCreds) throw new Error("missing memory realtime credentials");
|
|
3431
3431
|
return memoryRestEvents.credentialsSucceeded({
|
|
3432
3432
|
sessionId,
|
|
3433
|
-
|
|
3434
|
-
|
|
3433
|
+
...hasUserCreds ? {
|
|
3434
|
+
joinToken: data.joinToken,
|
|
3435
|
+
joinCode: data.joinCode
|
|
3436
|
+
} : {},
|
|
3435
3437
|
...hasProjectCreds ? {
|
|
3436
3438
|
projectJoinToken: data.projectJoinToken,
|
|
3437
3439
|
projectJoinCode: data.projectJoinCode
|
|
@@ -3660,6 +3662,8 @@ function createMemoryStore(environment) {
|
|
|
3660
3662
|
}), (0, rxjs_operators.switchMap)(([action, state]) => {
|
|
3661
3663
|
const context = state.context;
|
|
3662
3664
|
const { joinToken, joinCode, projectJoinToken, projectJoinCode } = action;
|
|
3665
|
+
const primaryJoinToken = joinToken ?? projectJoinToken;
|
|
3666
|
+
const primaryTopic = joinToken && joinCode ? `user_meta:memories:${joinCode}` : `project_meta:memories:${projectJoinCode}`;
|
|
3663
3667
|
const sessionId = action.sessionId;
|
|
3664
3668
|
const shutdown$ = actions$.pipe(ofType(memoryAdapterEvents.contextChanged, memoryAdapterEvents.stopped));
|
|
3665
3669
|
const channelMetadata$ = (channelJoinToken, topic) => {
|
|
@@ -3689,7 +3693,7 @@ function createMemoryStore(environment) {
|
|
|
3689
3693
|
const socket$ = ɵphoenixSocket$({
|
|
3690
3694
|
url: context.wsUrl,
|
|
3691
3695
|
options: {
|
|
3692
|
-
params: { join_token:
|
|
3696
|
+
params: { join_token: primaryJoinToken },
|
|
3693
3697
|
reconnectAfterMs: (0, _copilotkit_shared.phoenixExponentialBackoff)(100, 1e4),
|
|
3694
3698
|
rejoinAfterMs: (0, _copilotkit_shared.phoenixExponentialBackoff)(1e3, 3e4)
|
|
3695
3699
|
}
|
|
@@ -3699,7 +3703,7 @@ function createMemoryStore(environment) {
|
|
|
3699
3703
|
}));
|
|
3700
3704
|
const channel$ = ɵphoenixChannel$({
|
|
3701
3705
|
socket$,
|
|
3702
|
-
topic:
|
|
3706
|
+
topic: primaryTopic
|
|
3703
3707
|
}).pipe((0, rxjs_operators.shareReplay)({
|
|
3704
3708
|
bufferSize: 1,
|
|
3705
3709
|
refCount: true
|
|
@@ -3711,10 +3715,10 @@ function createMemoryStore(environment) {
|
|
|
3711
3715
|
const fatalStatus$ = fatalSocketShutdown$.pipe((0, rxjs_operators.map)(() => memoryDomainEvents.realtimeUnavailable({ sessionId })));
|
|
3712
3716
|
const metadata$ = channel$.pipe((0, rxjs_operators.switchMap)(({ channel }) => ɵobservePhoenixEvent$(channel, MEMORY_METADATA_EVENT)), (0, rxjs_operators.map)((event) => mapMemoryMetadataEvent(event, action.sessionId)));
|
|
3713
3717
|
const join$ = ɵjoinPhoenixChannel$(channel$).pipe((0, rxjs_operators.concatWith)((0, rxjs.of)(memoryDomainEvents.realtimeConnected({ sessionId }))), (0, rxjs_operators.catchError)((error) => {
|
|
3714
|
-
console.warn(`[memory] failed to join
|
|
3718
|
+
console.warn(`[memory] failed to join ${primaryTopic}`, error);
|
|
3715
3719
|
return (0, rxjs.of)(memoryDomainEvents.realtimeUnavailable({ sessionId }));
|
|
3716
3720
|
}));
|
|
3717
|
-
const projectMetadata$ = projectJoinToken && projectJoinCode ? channelMetadata$(projectJoinToken, `project_meta:memories:${projectJoinCode}`) : rxjs.EMPTY;
|
|
3721
|
+
const projectMetadata$ = joinToken && joinCode && projectJoinToken && projectJoinCode ? channelMetadata$(projectJoinToken, `project_meta:memories:${projectJoinCode}`) : rxjs.EMPTY;
|
|
3718
3722
|
return (0, rxjs.merge)((0, rxjs.of)(memoryDomainEvents.realtimeConnecting({ sessionId })), metadata$, join$, projectMetadata$, fatalStatus$).pipe((0, rxjs_operators.takeUntil)((0, rxjs.merge)(shutdown$, fatalSocketShutdown$.pipe((0, rxjs.observeOn)(rxjs.asapScheduler)))), (0, rxjs_operators.finalize)(() => {}));
|
|
3719
3723
|
});
|
|
3720
3724
|
})))
|