@assistant-ui/react 0.5.98 → 0.5.100
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/api/AssistantRuntime.d.ts +4 -4
- package/dist/api/AssistantRuntime.d.ts.map +1 -1
- package/dist/api/AssistantRuntime.js +7 -7
- package/dist/api/AssistantRuntime.js.map +1 -1
- package/dist/api/AssistantRuntime.mjs +7 -9
- package/dist/api/AssistantRuntime.mjs.map +1 -1
- package/dist/api/ComposerRuntime.d.ts +7 -0
- package/dist/api/ComposerRuntime.d.ts.map +1 -1
- package/dist/api/ComposerRuntime.js +13 -0
- package/dist/api/ComposerRuntime.js.map +1 -1
- package/dist/api/ComposerRuntime.mjs +13 -0
- package/dist/api/ComposerRuntime.mjs.map +1 -1
- package/dist/api/MessageRuntime.d.ts.map +1 -1
- package/dist/api/MessageRuntime.js +0 -5
- package/dist/api/MessageRuntime.js.map +1 -1
- package/dist/api/MessageRuntime.mjs +0 -5
- package/dist/api/MessageRuntime.mjs.map +1 -1
- package/dist/api/RuntimePathTypes.d.ts +16 -1
- package/dist/api/RuntimePathTypes.d.ts.map +1 -1
- package/dist/api/RuntimePathTypes.js.map +1 -1
- package/dist/api/ThreadListItemRuntime.d.ts +29 -0
- package/dist/api/ThreadListItemRuntime.d.ts.map +1 -0
- package/dist/api/ThreadListItemRuntime.js +61 -0
- package/dist/api/ThreadListItemRuntime.js.map +1 -0
- package/dist/api/ThreadListItemRuntime.mjs +36 -0
- package/dist/api/ThreadListItemRuntime.mjs.map +1 -0
- package/dist/api/ThreadListRuntime.d.ts +51 -0
- package/dist/api/ThreadListRuntime.d.ts.map +1 -0
- package/dist/api/ThreadListRuntime.js +128 -0
- package/dist/api/ThreadListRuntime.js.map +1 -0
- package/dist/api/ThreadListRuntime.mjs +105 -0
- package/dist/api/ThreadListRuntime.mjs.map +1 -0
- package/dist/api/ThreadRuntime.d.ts +3 -0
- package/dist/api/ThreadRuntime.d.ts.map +1 -1
- package/dist/api/ThreadRuntime.js +1 -1
- package/dist/api/ThreadRuntime.js.map +1 -1
- package/dist/api/ThreadRuntime.mjs +1 -1
- package/dist/api/ThreadRuntime.mjs.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.js +7 -9
- package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.mjs +7 -9
- package/dist/context/providers/AssistantRuntimeProvider.mjs.map +1 -1
- package/dist/context/providers/AttachmentRuntimeProvider.d.ts +6 -5
- package/dist/context/providers/AttachmentRuntimeProvider.d.ts.map +1 -1
- package/dist/context/providers/AttachmentRuntimeProvider.js.map +1 -1
- package/dist/context/providers/AttachmentRuntimeProvider.mjs.map +1 -1
- package/dist/context/providers/ContentPartRuntimeProvider.d.ts +6 -5
- package/dist/context/providers/ContentPartRuntimeProvider.d.ts.map +1 -1
- package/dist/context/providers/ContentPartRuntimeProvider.js +1 -4
- package/dist/context/providers/ContentPartRuntimeProvider.js.map +1 -1
- package/dist/context/providers/ContentPartRuntimeProvider.mjs +1 -4
- package/dist/context/providers/ContentPartRuntimeProvider.mjs.map +1 -1
- package/dist/context/providers/MessageRuntimeProvider.d.ts +6 -5
- package/dist/context/providers/MessageRuntimeProvider.d.ts.map +1 -1
- package/dist/context/providers/MessageRuntimeProvider.js.map +1 -1
- package/dist/context/providers/MessageRuntimeProvider.mjs.map +1 -1
- package/dist/context/providers/TextContentPartProvider.d.ts +7 -6
- package/dist/context/providers/TextContentPartProvider.d.ts.map +1 -1
- package/dist/context/providers/TextContentPartProvider.js +5 -1
- package/dist/context/providers/TextContentPartProvider.js.map +1 -1
- package/dist/context/providers/TextContentPartProvider.mjs +5 -1
- package/dist/context/providers/TextContentPartProvider.mjs.map +1 -1
- package/dist/context/providers/ThreadListItemRuntimeProvider.d.ts +13 -0
- package/dist/context/providers/ThreadListItemRuntimeProvider.d.ts.map +1 -0
- package/dist/context/providers/ThreadListItemRuntimeProvider.js +62 -0
- package/dist/context/providers/ThreadListItemRuntimeProvider.js.map +1 -0
- package/dist/context/providers/ThreadListItemRuntimeProvider.mjs +39 -0
- package/dist/context/providers/ThreadListItemRuntimeProvider.mjs.map +1 -0
- package/dist/context/react/AssistantContext.d.ts +35 -11
- package/dist/context/react/AssistantContext.d.ts.map +1 -1
- package/dist/context/react/AssistantContext.js +4 -4
- package/dist/context/react/AssistantContext.js.map +1 -1
- package/dist/context/react/AssistantContext.mjs +3 -3
- package/dist/context/react/AssistantContext.mjs.map +1 -1
- package/dist/context/react/ThreadListItemContext.d.ts +58 -0
- package/dist/context/react/ThreadListItemContext.d.ts.map +1 -0
- package/dist/context/react/ThreadListItemContext.js +53 -0
- package/dist/context/react/ThreadListItemContext.js.map +1 -0
- package/dist/context/react/ThreadListItemContext.mjs +25 -0
- package/dist/context/react/ThreadListItemContext.mjs.map +1 -0
- package/dist/context/react/index.d.ts +1 -1
- package/dist/context/react/index.d.ts.map +1 -1
- package/dist/context/react/index.js +2 -2
- package/dist/context/react/index.js.map +1 -1
- package/dist/context/react/index.mjs +2 -2
- package/dist/context/react/index.mjs.map +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/internal.mjs.map +1 -1
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +6 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/index.mjs +4 -0
- package/dist/primitives/index.mjs.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.d.ts +11 -0
- package/dist/primitives/threadList/ThreadListItems.d.ts.map +1 -0
- package/dist/primitives/threadList/ThreadListItems.js +72 -0
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -0
- package/dist/primitives/threadList/ThreadListItems.mjs +48 -0
- package/dist/primitives/threadList/ThreadListItems.mjs.map +1 -0
- package/dist/primitives/threadList/ThreadListNew.d.ts +13 -0
- package/dist/primitives/threadList/ThreadListNew.d.ts.map +1 -0
- package/dist/primitives/threadList/ThreadListNew.js +43 -0
- package/dist/primitives/threadList/ThreadListNew.js.map +1 -0
- package/dist/primitives/threadList/ThreadListNew.mjs +21 -0
- package/dist/primitives/threadList/ThreadListNew.mjs.map +1 -0
- package/dist/primitives/threadList/index.d.ts +3 -0
- package/dist/primitives/threadList/index.d.ts.map +1 -0
- package/dist/primitives/threadList/index.js +34 -0
- package/dist/primitives/threadList/index.js.map +1 -0
- package/dist/primitives/threadList/index.mjs +8 -0
- package/dist/primitives/threadList/index.mjs.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts +13 -0
- package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemArchive.js +43 -0
- package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemArchive.mjs +21 -0
- package/dist/primitives/threadListItem/ThreadListItemArchive.mjs.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts +13 -0
- package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemDelete.js +43 -0
- package/dist/primitives/threadListItem/ThreadListItemDelete.js.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemDelete.mjs +21 -0
- package/dist/primitives/threadListItem/ThreadListItemDelete.mjs.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts +13 -0
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +43 -0
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.mjs +21 -0
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.mjs.map +1 -0
- package/dist/primitives/threadListItem/index.d.ts +4 -0
- package/dist/primitives/threadListItem/index.d.ts.map +1 -0
- package/dist/primitives/threadListItem/index.js +37 -0
- package/dist/primitives/threadListItem/index.js.map +1 -0
- package/dist/primitives/threadListItem/index.mjs +10 -0
- package/dist/primitives/threadListItem/index.mjs.map +1 -0
- package/dist/runtimes/composer/BaseComposerRuntimeCore.d.ts +5 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.js +14 -5
- package/dist/runtimes/composer/BaseComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs +14 -5
- package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js +2 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs +2 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/core/AssistantRuntimeCore.d.ts +2 -2
- package/dist/runtimes/core/AssistantRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/AssistantRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.d.ts +2 -2
- package/dist/runtimes/core/BaseAssistantRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/core/ComposerRuntimeCore.d.ts +3 -0
- package/dist/runtimes/core/ComposerRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/ComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/{ThreadManagerRuntimeCore.d.ts → ThreadListRuntimeCore.d.ts} +7 -6
- package/dist/runtimes/core/ThreadListRuntimeCore.d.ts.map +1 -0
- package/dist/runtimes/core/{ThreadManagerRuntimeCore.js → ThreadListRuntimeCore.js} +4 -4
- package/dist/runtimes/core/ThreadListRuntimeCore.js.map +1 -0
- package/dist/runtimes/core/ThreadListRuntimeCore.mjs +1 -0
- package/dist/runtimes/core/subscribeToMainThread.js +2 -2
- package/dist/runtimes/core/subscribeToMainThread.js.map +1 -1
- package/dist/runtimes/core/subscribeToMainThread.mjs +2 -2
- package/dist/runtimes/core/subscribeToMainThread.mjs.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts +8 -8
- package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts +2 -2
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +8 -8
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs +8 -8
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts +35 -0
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts.map +1 -0
- package/dist/runtimes/external-store/{ExternalStoreThreadManagementAdapter.js → ExternalStoreThreadListRuntimeCore.js} +21 -9
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js.map +1 -0
- package/dist/runtimes/external-store/{ExternalStoreThreadManagementAdapter.mjs → ExternalStoreThreadListRuntimeCore.mjs} +17 -5
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs.map +1 -0
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +8 -3
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs +8 -3
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.d.ts +2 -2
- package/dist/runtimes/local/LocalRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.js +7 -7
- package/dist/runtimes/local/LocalRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.mjs +7 -7
- package/dist/runtimes/local/LocalRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/local/{LocalThreadManagerRuntimeCore.d.ts → LocalThreadListRuntimeCore.d.ts} +16 -6
- package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts.map +1 -0
- package/dist/runtimes/local/{LocalThreadManagerRuntimeCore.js → LocalThreadListRuntimeCore.js} +11 -8
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js.map +1 -0
- package/dist/runtimes/local/{LocalThreadManagerRuntimeCore.mjs → LocalThreadListRuntimeCore.mjs} +7 -4
- package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs.map +1 -0
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js +2 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +2 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +1 -1
- package/dist/types/AssistantTypes.d.ts +2 -0
- package/dist/types/AssistantTypes.d.ts.map +1 -1
- package/dist/types/AssistantTypes.js.map +1 -1
- package/package.json +7 -7
- package/src/api/AssistantRuntime.ts +9 -12
- package/src/api/ComposerRuntime.ts +17 -0
- package/src/api/MessageRuntime.ts +0 -9
- package/src/api/RuntimePathTypes.ts +10 -1
- package/src/api/ThreadListItemRuntime.ts +67 -0
- package/src/api/ThreadListRuntime.ts +159 -0
- package/src/api/ThreadRuntime.ts +2 -1
- package/src/api/index.ts +1 -4
- package/src/context/providers/AssistantRuntimeProvider.tsx +7 -9
- package/src/context/providers/AttachmentRuntimeProvider.tsx +6 -4
- package/src/context/providers/ContentPartRuntimeProvider.tsx +8 -7
- package/src/context/providers/MessageRuntimeProvider.tsx +6 -4
- package/src/context/providers/TextContentPartProvider.tsx +11 -7
- package/src/context/providers/ThreadListItemRuntimeProvider.tsx +54 -0
- package/src/context/react/AssistantContext.ts +4 -4
- package/src/context/react/ThreadListItemContext.ts +39 -0
- package/src/context/react/index.ts +2 -2
- package/src/internal.ts +1 -1
- package/src/primitives/index.ts +2 -0
- package/src/primitives/threadList/ThreadListItems.tsx +73 -0
- package/src/primitives/threadList/ThreadListNew.ts +25 -0
- package/src/primitives/threadList/index.ts +2 -0
- package/src/primitives/threadListItem/ThreadListItemArchive.ts +25 -0
- package/src/primitives/threadListItem/ThreadListItemDelete.ts +25 -0
- package/src/primitives/threadListItem/ThreadListItemUnarchive.ts +25 -0
- package/src/primitives/threadListItem/index.ts +3 -0
- package/src/runtimes/composer/BaseComposerRuntimeCore.tsx +19 -5
- package/src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx +3 -2
- package/src/runtimes/core/AssistantRuntimeCore.tsx +2 -2
- package/src/runtimes/core/BaseAssistantRuntimeCore.tsx +2 -2
- package/src/runtimes/core/ComposerRuntimeCore.tsx +4 -0
- package/src/runtimes/core/{ThreadManagerRuntimeCore.tsx → ThreadListRuntimeCore.tsx} +7 -5
- package/src/runtimes/core/subscribeToMainThread.ts +2 -2
- package/src/runtimes/external-store/ExternalStoreAdapter.tsx +8 -8
- package/src/runtimes/external-store/ExternalStoreRuntimeCore.tsx +8 -8
- package/src/runtimes/external-store/{ExternalStoreThreadManagementAdapter.tsx → ExternalStoreThreadListRuntimeCore.tsx} +24 -9
- package/src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx +8 -3
- package/src/runtimes/local/LocalRuntimeCore.tsx +7 -7
- package/src/runtimes/local/{LocalThreadManagerRuntimeCore.tsx → LocalThreadListRuntimeCore.tsx} +11 -7
- package/src/runtimes/local/LocalThreadRuntimeCore.tsx +2 -1
- package/src/types/AssistantTypes.ts +3 -0
- package/dist/api/ThreadManagerRuntime.d.ts +0 -32
- package/dist/api/ThreadManagerRuntime.d.ts.map +0 -1
- package/dist/api/ThreadManagerRuntime.js +0 -73
- package/dist/api/ThreadManagerRuntime.js.map +0 -1
- package/dist/api/ThreadManagerRuntime.mjs +0 -48
- package/dist/api/ThreadManagerRuntime.mjs.map +0 -1
- package/dist/runtimes/core/ThreadManagerRuntimeCore.d.ts.map +0 -1
- package/dist/runtimes/core/ThreadManagerRuntimeCore.js.map +0 -1
- package/dist/runtimes/core/ThreadManagerRuntimeCore.mjs +0 -1
- package/dist/runtimes/external-store/ExternalStoreThreadManagementAdapter.d.ts +0 -25
- package/dist/runtimes/external-store/ExternalStoreThreadManagementAdapter.d.ts.map +0 -1
- package/dist/runtimes/external-store/ExternalStoreThreadManagementAdapter.js.map +0 -1
- package/dist/runtimes/external-store/ExternalStoreThreadManagementAdapter.mjs.map +0 -1
- package/dist/runtimes/local/LocalThreadManagerRuntimeCore.d.ts.map +0 -1
- package/dist/runtimes/local/LocalThreadManagerRuntimeCore.js.map +0 -1
- package/dist/runtimes/local/LocalThreadManagerRuntimeCore.mjs.map +0 -1
- package/src/api/ThreadManagerRuntime.ts +0 -80
- /package/dist/runtimes/core/{ThreadManagerRuntimeCore.mjs.map → ThreadListRuntimeCore.mjs.map} +0 -0
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ThreadManagerRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/core/ThreadManagerRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,EAAE,iBAAiB,CAAC;IAE9B,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC1C,eAAe,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAElD,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,iBAAiB,IAAI,IAAI,CAAC;IAK1B,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,WAAW,CAAC;CAC9C,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/core/ThreadManagerRuntimeCore.tsx"],"sourcesContent":["import { Unsubscribe } from \"../../types\";\nimport { ThreadRuntimeCore } from \"./ThreadRuntimeCore\";\n\nexport type ThreadManagerMetadata = {\n threadId: string;\n title?: string;\n};\n\nexport type ThreadManagerRuntimeCore = {\n mainThread: ThreadRuntimeCore;\n\n threads: readonly ThreadManagerMetadata[];\n archivedThreads: readonly ThreadManagerMetadata[];\n\n switchToThread(threadId: string): void;\n switchToNewThread(): void;\n\n // getLoadThreadsPromise(): Promise<void>;\n // getLoadArchivedThreadsPromise(): Promise<void>;\n // create(): Promise<ThreadMetadata>;\n rename(threadId: string, newTitle: string): Promise<void>;\n archive(threadId: string): Promise<void>;\n unarchive(threadId: string): Promise<void>;\n delete(threadId: string): Promise<void>;\n\n subscribe(callback: () => void): Unsubscribe;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
//# sourceMappingURL=ThreadManagerRuntimeCore.mjs.map
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import type { Unsubscribe } from "../../types";
|
2
|
-
import { ExternalStoreThreadRuntimeCore } from "./ExternalStoreThreadRuntimeCore";
|
3
|
-
import { ThreadManagerRuntimeCore } from "../core/ThreadManagerRuntimeCore";
|
4
|
-
import { ExternalStoreThreadManagerAdapter } from "./ExternalStoreAdapter";
|
5
|
-
export type ExternalStoreThreadFactory = (threadId: string) => ExternalStoreThreadRuntimeCore;
|
6
|
-
export declare class ExternalStoreThreadManagerRuntimeCore implements ThreadManagerRuntimeCore {
|
7
|
-
private adapter;
|
8
|
-
private threadFactory;
|
9
|
-
get threads(): readonly import("../core/ThreadManagerRuntimeCore").ThreadManagerMetadata[];
|
10
|
-
get archivedThreads(): readonly import("../core/ThreadManagerRuntimeCore").ThreadManagerMetadata[];
|
11
|
-
private _mainThread;
|
12
|
-
get mainThread(): ExternalStoreThreadRuntimeCore;
|
13
|
-
constructor(adapter: ExternalStoreThreadManagerAdapter | undefined, threadFactory: ExternalStoreThreadFactory);
|
14
|
-
setAdapter(adapter: ExternalStoreThreadManagerAdapter): void;
|
15
|
-
switchToThread(threadId: string): void;
|
16
|
-
switchToNewThread(): void;
|
17
|
-
rename(threadId: string, newTitle: string): Promise<void>;
|
18
|
-
archive(threadId: string): Promise<void>;
|
19
|
-
unarchive(threadId: string): Promise<void>;
|
20
|
-
delete(threadId: string): Promise<void>;
|
21
|
-
private _subscriptions;
|
22
|
-
subscribe(callback: () => void): Unsubscribe;
|
23
|
-
private _notifySubscribers;
|
24
|
-
}
|
25
|
-
//# sourceMappingURL=ExternalStoreThreadManagementAdapter.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BAAkB;CAG3B"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/external-store/ExternalStoreThreadManagementAdapter.tsx"],"sourcesContent":["import type { Unsubscribe } from \"../../types\";\nimport { ExternalStoreThreadRuntimeCore } from \"./ExternalStoreThreadRuntimeCore\";\nimport { ThreadManagerRuntimeCore } from \"../core/ThreadManagerRuntimeCore\";\nimport { ExternalStoreThreadManagerAdapter } from \"./ExternalStoreAdapter\";\n\nexport type ExternalStoreThreadFactory = (\n threadId: string,\n) => ExternalStoreThreadRuntimeCore;\n\nconst EMPTY_ARRAY = Object.freeze([]);\nconst DEFAULT_THREAD_ID = \"DEFAULT_THREAD_ID\";\n\nexport class ExternalStoreThreadManagerRuntimeCore\n implements ThreadManagerRuntimeCore\n{\n public get threads() {\n return this.adapter.threads ?? EMPTY_ARRAY;\n }\n\n public get archivedThreads() {\n return this.adapter.archivedThreads ?? EMPTY_ARRAY;\n }\n\n private _mainThread: ExternalStoreThreadRuntimeCore;\n\n public get mainThread() {\n return this._mainThread;\n }\n\n constructor(\n private adapter: ExternalStoreThreadManagerAdapter = {},\n private threadFactory: ExternalStoreThreadFactory,\n ) {\n this._mainThread = this.threadFactory(DEFAULT_THREAD_ID);\n }\n\n public setAdapter(adapter: ExternalStoreThreadManagerAdapter) {\n const previousAdapter = this.adapter;\n this.adapter = adapter;\n\n const newThreadId = adapter.threadId ?? DEFAULT_THREAD_ID;\n const newThreads = adapter.threads ?? EMPTY_ARRAY;\n const newArchivedThreads = adapter.archivedThreads ?? EMPTY_ARRAY;\n\n if (\n previousAdapter.threadId === newThreadId &&\n previousAdapter.threads === newThreads &&\n previousAdapter.archivedThreads === newArchivedThreads\n ) {\n return;\n }\n\n if (previousAdapter.threadId !== newThreadId) {\n this._mainThread._notifyEventSubscribers(\"switched-away\");\n this._mainThread = this.threadFactory(newThreadId);\n this._mainThread._notifyEventSubscribers(\"switched-to\");\n }\n\n this._notifySubscribers();\n }\n\n public switchToThread(threadId: string): void {\n if (this._mainThread?.threadId === threadId) return;\n const onSwitchToThread = this.adapter.onSwitchToThread;\n if (!onSwitchToThread)\n throw new Error(\n \"External store adapter does not support switching to thread\",\n );\n onSwitchToThread(threadId);\n }\n\n public switchToNewThread(): void {\n const onSwitchToNewThread = this.adapter.onSwitchToNewThread;\n if (!onSwitchToNewThread)\n throw new Error(\n \"External store adapter does not support switching to new thread\",\n );\n\n onSwitchToNewThread();\n }\n\n public async rename(threadId: string, newTitle: string): Promise<void> {\n const onRename = this.adapter.onRename;\n if (!onRename)\n throw new Error(\"External store adapter does not support renaming\");\n\n onRename(threadId, newTitle);\n }\n\n public async archive(threadId: string): Promise<void> {\n const onArchive = this.adapter.onArchive;\n if (!onArchive)\n throw new Error(\"External store adapter does not support archiving\");\n\n onArchive(threadId);\n }\n\n public async unarchive(threadId: string): Promise<void> {\n const onUnarchive = this.adapter.onUnarchive;\n if (!onUnarchive)\n throw new Error(\"External store adapter does not support unarchiving\");\n\n onUnarchive(threadId);\n }\n\n public async delete(threadId: string): Promise<void> {\n const onDelete = this.adapter.onDelete;\n if (!onDelete)\n throw new Error(\"External store adapter does not support deleting\");\n\n onDelete(threadId);\n }\n\n private _subscriptions = new Set<() => void>();\n\n public subscribe(callback: () => void): Unsubscribe {\n this._subscriptions.add(callback);\n return () => this._subscriptions.delete(callback);\n }\n\n private _notifySubscribers() {\n for (const callback of this._subscriptions) callback();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAM,cAAc,OAAO,OAAO,CAAC,CAAC;AACpC,IAAM,oBAAoB;AAEnB,IAAM,wCAAN,MAEP;AAAA,EAeE,YACU,UAA6C,CAAC,GAC9C,eACR;AAFQ;AACA;AAER,SAAK,cAAc,KAAK,cAAc,iBAAiB;AAAA,EACzD;AAAA,EAnBA,IAAW,UAAU;AACnB,WAAO,KAAK,QAAQ,WAAW;AAAA,EACjC;AAAA,EAEA,IAAW,kBAAkB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,cAAc,KAAK,QAAQ;AACjC,QAAI,CAAC;AACH,YAAM,IAAI,MAAM,qDAAqD;AAEvE,gBAAY,QAAQ;AAAA,EACtB;AAAA,EAEA,MAAa,OAAO,UAAiC;AACnD,UAAM,WAAW,KAAK,QAAQ;AAC9B,QAAI,CAAC;AACH,YAAM,IAAI,MAAM,kDAAkD;AAEpE,aAAS,QAAQ;AAAA,EACnB;AAAA,EAEQ,iBAAiB,oBAAI,IAAgB;AAAA,EAEtC,UAAU,UAAmC;AAClD,SAAK,eAAe,IAAI,QAAQ;AAChC,WAAO,MAAM,KAAK,eAAe,OAAO,QAAQ;AAAA,EAClD;AAAA,EAEQ,qBAAqB;AAC3B,eAAW,YAAY,KAAK,eAAgB,UAAS;AAAA,EACvD;AACF;","names":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/external-store/ExternalStoreThreadManagementAdapter.tsx"],"sourcesContent":["import type { Unsubscribe } from \"../../types\";\nimport { ExternalStoreThreadRuntimeCore } from \"./ExternalStoreThreadRuntimeCore\";\nimport { ThreadManagerRuntimeCore } from \"../core/ThreadManagerRuntimeCore\";\nimport { ExternalStoreThreadManagerAdapter } from \"./ExternalStoreAdapter\";\n\nexport type ExternalStoreThreadFactory = (\n threadId: string,\n) => ExternalStoreThreadRuntimeCore;\n\nconst EMPTY_ARRAY = Object.freeze([]);\nconst DEFAULT_THREAD_ID = \"DEFAULT_THREAD_ID\";\n\nexport class ExternalStoreThreadManagerRuntimeCore\n implements ThreadManagerRuntimeCore\n{\n public get threads() {\n return this.adapter.threads ?? EMPTY_ARRAY;\n }\n\n public get archivedThreads() {\n return this.adapter.archivedThreads ?? EMPTY_ARRAY;\n }\n\n private _mainThread: ExternalStoreThreadRuntimeCore;\n\n public get mainThread() {\n return this._mainThread;\n }\n\n constructor(\n private adapter: ExternalStoreThreadManagerAdapter = {},\n private threadFactory: ExternalStoreThreadFactory,\n ) {\n this._mainThread = this.threadFactory(DEFAULT_THREAD_ID);\n }\n\n public setAdapter(adapter: ExternalStoreThreadManagerAdapter) {\n const previousAdapter = this.adapter;\n this.adapter = adapter;\n\n const newThreadId = adapter.threadId ?? DEFAULT_THREAD_ID;\n const newThreads = adapter.threads ?? EMPTY_ARRAY;\n const newArchivedThreads = adapter.archivedThreads ?? EMPTY_ARRAY;\n\n if (\n previousAdapter.threadId === newThreadId &&\n previousAdapter.threads === newThreads &&\n previousAdapter.archivedThreads === newArchivedThreads\n ) {\n return;\n }\n\n if (previousAdapter.threadId !== newThreadId) {\n this._mainThread._notifyEventSubscribers(\"switched-away\");\n this._mainThread = this.threadFactory(newThreadId);\n this._mainThread._notifyEventSubscribers(\"switched-to\");\n }\n\n this._notifySubscribers();\n }\n\n public switchToThread(threadId: string): void {\n if (this._mainThread?.threadId === threadId) return;\n const onSwitchToThread = this.adapter.onSwitchToThread;\n if (!onSwitchToThread)\n throw new Error(\n \"External store adapter does not support switching to thread\",\n );\n onSwitchToThread(threadId);\n }\n\n public switchToNewThread(): void {\n const onSwitchToNewThread = this.adapter.onSwitchToNewThread;\n if (!onSwitchToNewThread)\n throw new Error(\n \"External store adapter does not support switching to new thread\",\n );\n\n onSwitchToNewThread();\n }\n\n public async rename(threadId: string, newTitle: string): Promise<void> {\n const onRename = this.adapter.onRename;\n if (!onRename)\n throw new Error(\"External store adapter does not support renaming\");\n\n onRename(threadId, newTitle);\n }\n\n public async archive(threadId: string): Promise<void> {\n const onArchive = this.adapter.onArchive;\n if (!onArchive)\n throw new Error(\"External store adapter does not support archiving\");\n\n onArchive(threadId);\n }\n\n public async unarchive(threadId: string): Promise<void> {\n const onUnarchive = this.adapter.onUnarchive;\n if (!onUnarchive)\n throw new Error(\"External store adapter does not support unarchiving\");\n\n onUnarchive(threadId);\n }\n\n public async delete(threadId: string): Promise<void> {\n const onDelete = this.adapter.onDelete;\n if (!onDelete)\n throw new Error(\"External store adapter does not support deleting\");\n\n onDelete(threadId);\n }\n\n private _subscriptions = new Set<() => void>();\n\n public subscribe(callback: () => void): Unsubscribe {\n this._subscriptions.add(callback);\n return () => this._subscriptions.delete(callback);\n }\n\n private _notifySubscribers() {\n for (const callback of this._subscriptions) callback();\n }\n}\n"],"mappings":";AASA,IAAM,cAAc,OAAO,OAAO,CAAC,CAAC;AACpC,IAAM,oBAAoB;AAEnB,IAAM,wCAAN,MAEP;AAAA,EAeE,YACU,UAA6C,CAAC,GAC9C,eACR;AAFQ;AACA;AAER,SAAK,cAAc,KAAK,cAAc,iBAAiB;AAAA,EACzD;AAAA,EAnBA,IAAW,UAAU;AACnB,WAAO,KAAK,QAAQ,WAAW;AAAA,EACjC;AAAA,EAEA,IAAW,kBAAkB;AAC3B,WAAO,KAAK,QAAQ,mBAAmB;AAAA,EACzC;AAAA,EAEQ;AAAA,EAER,IAAW,aAAa;AACtB,WAAO,KAAK;AAAA,EACd;AAAA,EASO,WAAW,SAA4C;AAC5D,UAAM,kBAAkB,KAAK;AAC7B,SAAK,UAAU;AAEf,UAAM,cAAc,QAAQ,YAAY;AACxC,UAAM,aAAa,QAAQ,WAAW;AACtC,UAAM,qBAAqB,QAAQ,mBAAmB;AAEtD,QACE,gBAAgB,aAAa,eAC7B,gBAAgB,YAAY,cAC5B,gBAAgB,oBAAoB,oBACpC;AACA;AAAA,IACF;AAEA,QAAI,gBAAgB,aAAa,aAAa;AAC5C,WAAK,YAAY,wBAAwB,eAAe;AACxD,WAAK,cAAc,KAAK,cAAc,WAAW;AACjD,WAAK,YAAY,wBAAwB,aAAa;AAAA,IACxD;AAEA,SAAK,mBAAmB;AAAA,EAC1B;AAAA,EAEO,eAAe,UAAwB;AAC5C,QAAI,KAAK,aAAa,aAAa,SAAU;AAC7C,UAAM,mBAAmB,KAAK,QAAQ;AACtC,QAAI,CAAC;AACH,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AACF,qBAAiB,QAAQ;AAAA,EAC3B;AAAA,EAEO,oBAA0B;AAC/B,UAAM,sBAAsB,KAAK,QAAQ;AACzC,QAAI,CAAC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Core.tsx"],"sourcesContent":["import type { Unsubscribe } from \"../../types\";\nimport {\n ThreadManagerMetadata,\n ThreadManagerRuntimeCore,\n} from \"../core/ThreadManagerRuntimeCore\";\nimport { ExportedMessageRepository } from \"../utils/MessageRepository\";\nimport { generateId } from \"../../utils/idUtils\";\nimport { LocalThreadRuntimeCore } from \"./LocalThreadRuntimeCore\";\n\nexport type LocalThreadData = {\n data: ExportedMessageRepository;\n metadata: ThreadManagerMetadata;\n isArchived: boolean;\n};\n\nexport type LocalThreadFactory = (\n threadId: string,\n data: ExportedMessageRepository,\n) => LocalThreadRuntimeCore;\n\nexport class LocalThreadManagerRuntimeCore implements ThreadManagerRuntimeCore {\n private _threadData = new Map<string, LocalThreadData>();\n\n private _threads: readonly ThreadManagerMetadata[] = [];\n private _archivedThreads: readonly ThreadManagerMetadata[] = [];\n\n public get threads() {\n return this._threads;\n }\n\n public get archivedThreads() {\n return this._archivedThreads;\n }\n\n private _mainThread: LocalThreadRuntimeCore;\n\n public get mainThread(): LocalThreadRuntimeCore {\n return this._mainThread;\n }\n\n constructor(private _threadFactory: LocalThreadFactory) {\n const threadId = generateId();\n this._threadData.set(threadId, {\n data: { messages: [] },\n metadata: { threadId },\n isArchived: false,\n });\n this._threads = [{ threadId }];\n this._mainThread = this._threadFactory(threadId, { messages: [] });\n }\n\n public switchToThread(threadId: string): void {\n if (this._mainThread.threadId === threadId) return;\n\n const data = this._threadData.get(threadId);\n if (!data) throw new Error(\"Thread not found\");\n\n const thread = this._threadFactory(threadId, data.data);\n this._performThreadSwitch(thread);\n }\n\n public switchToNewThread(): void {\n const threadId = generateId();\n this._threadData.set(threadId, {\n data: { messages: [] },\n metadata: { threadId },\n isArchived: false,\n });\n this._threads = [{ threadId }];\n const thread = this._threadFactory(threadId, { messages: [] });\n this._performThreadSwitch(thread);\n }\n\n private _performThreadSwitch(newThreadCore: LocalThreadRuntimeCore) {\n const data = this._threadData.get(this._mainThread.threadId);\n if (!data) throw new Error(\"Thread not found\");\n\n const exprt = this._mainThread.export();\n data.data = exprt;\n\n this._mainThread._notifyEventSubscribers(\"switched-away\");\n this._mainThread = newThreadCore;\n newThreadCore._notifyEventSubscribers(\"switched-to\");\n\n this._notifySubscribers();\n }\n\n private _performMoveOp(\n threadId: string,\n operation: \"archive\" | \"unarchive\" | \"delete\",\n ) {\n const data = this._threadData.get(threadId);\n if (!data) throw new Error(\"Thread not found\");\n\n if (operation === \"archive\" && data.isArchived) return;\n if (operation === \"unarchive\" && !data.isArchived) return;\n\n if (operation === \"archive\") {\n data.isArchived = true;\n this._archivedThreads = [...this._archivedThreads, data.metadata];\n }\n if (operation === \"unarchive\") {\n data.isArchived = false;\n this._threads = [...this._threads, data.metadata];\n }\n if (operation === \"delete\") {\n this._threadData.delete(threadId);\n }\n\n if (\n operation === \"archive\" ||\n (operation === \"delete\" && data.isArchived)\n ) {\n this._archivedThreads = this._archivedThreads.filter(\n (t) => t.threadId !== threadId,\n );\n }\n\n if (\n operation === \"unarchive\" ||\n (operation === \"delete\" && !data.isArchived)\n ) {\n this._threads = this._threads.filter((t) => t.threadId !== threadId);\n }\n\n this._notifySubscribers();\n }\n\n public async rename(threadId: string, newTitle: string): Promise<void> {\n const data = this._threadData.get(threadId);\n if (!data) throw new Error(\"Thread not found\");\n\n data.metadata = {\n ...data.metadata,\n title: newTitle,\n };\n\n const threadList = data.isArchived ? this.archivedThreads : this.threads;\n const idx = threadList.findIndex((t) => t.threadId === threadId);\n const updatedThreadList = threadList.toSpliced(idx, 1, data.metadata);\n if (data.isArchived) {\n this._archivedThreads = updatedThreadList;\n } else {\n this._threads = updatedThreadList;\n }\n this._notifySubscribers();\n }\n\n public async archive(threadId: string): Promise<void> {\n this._performMoveOp(threadId, \"archive\");\n }\n\n public async unarchive(threadId: string): Promise<void> {\n this._performMoveOp(threadId, \"unarchive\");\n }\n\n public async delete(threadId: string): Promise<void> {\n this._performMoveOp(threadId, \"delete\");\n }\n\n private _subscriptions = new Set<() => void>();\n\n public subscribe(callback: () => void): Unsubscribe {\n this._subscriptions.add(callback);\n return () => this._subscriptions.delete(callback);\n }\n\n private _notifySubscribers() {\n for (const callback of this._subscriptions) callback();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,qBAA2B;AAcpB,IAAM,gCAAN,MAAwE;AAAA,EAoB7E,YAAoB,gBAAoC;AAApC;AAClB,UAAM,eAAW,2BAAW;AAC5B,SAAK,YAAY,IAAI,UAAU;AAAA,MAC7B,MAAM,EAAE,UAAU,CAAC,EAAE;AAAA,MACrB,UAAU,EAAE,SAAS;AAAA,MACrB,YAAY;AAAA,IACd,CAAC;AACD,SAAK,WAAW,CAAC,EAAE,SAAS,CAAC;AAC7B,SAAK,cAAc,KAAK,eAAe,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC;AAAA,EACnE;AAAA,EA5BQ,cAAc,oBAAI,IAA6B;AAAA,EAE/C,WAA6C,CAAC;AAAA,EAC9C,mBAAqD,CAAC;AAAA,EAE9D,IAAW,UAAU;AACnB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAW,kBAAkB;AAC3B,WAAO,KAAK;AAAA,EACd;AAAA,EAEQ;AAAA,EAER,IAAW,aAAqC;AAC9C,WAAO,KAAK;AAAA,EACd;AAAA,EAaO,eAAe,UAAwB;AAC5C,QAAI,KAAK,YAAY,aAAa,SAAU;AAE5C,UAAM,OAAO,KAAK,YAAY,IAAI,QAAQ;AAC1C,QAAI,CAAC,KAAM,OAAM,IAAI,MAAM,kBAAkB;AAE7C,UAAM,SAAS,KAAK,eAAe,UAAU,KAAK,IAAI;AACtD,SAAK,qBAAqB,MAAM;AAAA,EAClC;AAAA,EAEO,oBAA0B;AAC/B,UAAM,eAAW,2BAAW;AAC5B,SAAK,YAAY,IAAI,UAAU;AAAA,MAC7B,MAAM,EAAE,UAAU,CAAC,EAAE;AAAA,MACrB,UAAU,EAAE,SAAS;AAAA,MACrB,YAAY;AAAA,IACd,CAA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,mBAAmB;AAAA,EAC1B;AAAA,EAEA,MAAa,OAAO,UAAkB,UAAiC;AACrE,UAAM,OAAO,KAAK,YAAY,IAAI,QAAQ;AAC1C,QAAI,CAAC,KAAM,OAAM,IAAI,MAAM,kBAAkB;AAE7C,SAAK,WAAW;AAAA,MACd,GAAG,KAAK;AAAA,MACR,OAAO;AAAA,IACT;AAEA,UAAM,aAAa,KAAK,aAAa,KAAK,kBAAkB,KAAK;AACjE,UAAM,MAAM,WAAW,UAAU,CAAC,MAAM,EAAE,aAAa,QAAQ;AAC/D,UAAM,oBAAoB,WAAW,UAAU,KAAK,GAAG,KAAK,QAAQ;AACpE,QAAI,KAAK,YAAY;AACnB,WAAK,mBAAmB;AAAA,IAC1B,OAAO;AACL,WAAK,WAAW;AAAA,IAClB;AACA,SAAK,mBAAmB;AAAA,EAC1B;AAAA,EAEA,MAAa,QAAQ,UAAiC;AACpD,SAAK,eAAe,UAAU,SAAS;AAAA,EACzC;AAAA,EAEA,MAAa,UAAU,UAAiC;AACtD,SAAK,eAAe,UAAU,WAAW;AAAA,EAC3C;AAAA,EAEA,MAAa,OAAO,UAAiC;AACnD,SAAK,eAAe,UAAU,QAAQ;AAAA,EACxC;AAAA,EAEQ,iBAAiB,oBAAI,IAAgB;AAAA,EAEtC,UAAU,UAAmC;AAClD,SAAK,eAAe,IAAI,QAAQ;AAChC,WAAO,MAAM,KAAK,eAAe,OAAO,QAAQ;AAAA,EAClD;AAAA,EAEQ,qBAAqB;AAC3B,eAAW,YAAY,KAAK,eAAgB,UAAS;AAAA,EACvD;AACF;","names":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/local/LocalThreadManagerRuntimeCore.tsx"],"sourcesContent":["import type { Unsubscribe } from \"../../types\";\nimport {\n ThreadManagerMetadata,\n ThreadManagerRuntimeCore,\n} from \"../core/ThreadManagerRuntimeCore\";\nimport { ExportedMessageRepository } from \"../utils/MessageRepository\";\nimport { generateId } from \"../../utils/idUtils\";\nimport { LocalThreadRuntimeCore } from \"./LocalThreadRuntimeCore\";\n\nexport type LocalThreadData = {\n data: ExportedMessageRepository;\n metadata: ThreadManagerMetadata;\n isArchived: boolean;\n};\n\nexport type LocalThreadFactory = (\n threadId: string,\n data: ExportedMessageRepository,\n) => LocalThreadRuntimeCore;\n\nexport class LocalThreadManagerRuntimeCore implements ThreadManagerRuntimeCore {\n private _threadData = new Map<string, LocalThreadData>();\n\n private _threads: readonly ThreadManagerMetadata[] = [];\n private _archivedThreads: readonly ThreadManagerMetadata[] = [];\n\n public get threads() {\n return this._threads;\n }\n\n public get archivedThreads() {\n return this._archivedThreads;\n }\n\n private _mainThread: LocalThreadRuntimeCore;\n\n public get mainThread(): LocalThreadRuntimeCore {\n return this._mainThread;\n }\n\n constructor(private _threadFactory: LocalThreadFactory) {\n const threadId = generateId();\n this._threadData.set(threadId, {\n data: { messages: [] },\n metadata: { threadId },\n isArchived: false,\n });\n this._threads = [{ threadId }];\n this._mainThread = this._threadFactory(threadId, { messages: [] });\n }\n\n public switchToThread(threadId: string): void {\n if (this._mainThread.threadId === threadId) return;\n\n const data = this._threadData.get(threadId);\n if (!data) throw new Error(\"Thread not found\");\n\n const thread = this._threadFactory(threadId, data.data);\n this._performThreadSwitch(thread);\n }\n\n public switchToNewThread(): void {\n const threadId = generateId();\n this._threadData.set(threadId, {\n data: { messages: [] },\n metadata: { threadId },\n isArchived: false,\n });\n this._threads = [{ threadId }];\n const thread = this._threadFactory(threadId, { messages: [] });\n this._performThreadSwitch(thread);\n }\n\n private _performThreadSwitch(newThreadCore: LocalThreadRuntimeCore) {\n const data = this._threadData.get(this._mainThread.threadId);\n if (!data) throw new Error(\"Thread not found\");\n\n const exprt = this._mainThread.export();\n data.data = exprt;\n\n this._mainThread._notifyEventSubscribers(\"switched-away\");\n this._mainThread = newThreadCore;\n newThreadCore._notifyEventSubscribers(\"switched-to\");\n\n this._notifySubscribers();\n }\n\n private _performMoveOp(\n threadId: string,\n operation: \"archive\" | \"unarchive\" | \"delete\",\n ) {\n const data = this._threadData.get(threadId);\n if (!data) throw new Error(\"Thread not found\");\n\n if (operation === \"archive\" && data.isArchived) return;\n if (operation === \"unarchive\" && !data.isArchived) return;\n\n if (operation === \"archive\") {\n data.isArchived = true;\n this._archivedThreads = [...this._archivedThreads, data.metadata];\n }\n if (operation === \"unarchive\") {\n data.isArchived = false;\n this._threads = [...this._threads, data.metadata];\n }\n if (operation === \"delete\") {\n this._threadData.delete(threadId);\n }\n\n if (\n operation === \"archive\" ||\n (operation === \"delete\" && data.isArchived)\n ) {\n this._archivedThreads = this._archivedThreads.filter(\n (t) => t.threadId !== threadId,\n );\n }\n\n if (\n operation === \"unarchive\" ||\n (operation === \"delete\" && !data.isArchived)\n ) {\n this._threads = this._threads.filter((t) => t.threadId !== threadId);\n }\n\n this._notifySubscribers();\n }\n\n public async rename(threadId: string, newTitle: string): Promise<void> {\n const data = this._threadData.get(threadId);\n if (!data) throw new Error(\"Thread not found\");\n\n data.metadata = {\n ...data.metadata,\n title: newTitle,\n };\n\n const threadList = data.isArchived ? this.archivedThreads : this.threads;\n const idx = threadList.findIndex((t) => t.threadId === threadId);\n const updatedThreadList = threadList.toSpliced(idx, 1, data.metadata);\n if (data.isArchived) {\n this._archivedThreads = updatedThreadList;\n } else {\n this._threads = updatedThreadList;\n }\n this._notifySubscribers();\n }\n\n public async archive(threadId: string): Promise<void> {\n this._performMoveOp(threadId, \"archive\");\n }\n\n public async unarchive(threadId: string): Promise<void> {\n this._performMoveOp(threadId, \"unarchive\");\n }\n\n public async delete(threadId: string): Promise<void> {\n this._performMoveOp(threadId, \"delete\");\n }\n\n private _subscriptions = new Set<() => void>();\n\n public subscribe(callback: () => void): Unsubscribe {\n this._subscriptions.add(callback);\n return () => this._subscriptions.delete(callback);\n }\n\n private _notifySubscribers() {\n for (const callback of this._subscriptions) callback();\n }\n}\n"],"mappings":";AAMA,SAAS,kBAAkB;AAcpB,IAAM,gCAAN,MAAwE;AAAA,EAo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;AAEA,UAAM,aAAa,KAAK,aAAa,KAAK,kBAAkB,KAAK;AACjE,UAAM,MAAM,WAAW,UAAU,CAAC,MAAM,EAAE,aAAa,QAAQ;AAC/D,UAAM,oBAAoB,WAAW,UAAU,KAAK,GAAG,KAAK,QAAQ;AACpE,QAAI,KAAK,YAAY;AACnB,WAAK,mBAAmB;AAAA,IAC1B,OAAO;AACL,WAAK,WAAW;AAAA,IAClB;AACA,SAAK,mBAAmB;AAAA,EAC1B;AAAA,EAEA,MAAa,QAAQ,UAAiC;AACpD,SAAK,eAAe,UAAU,SAAS;AAAA,EACzC;AAAA,EAEA,MAAa,UAAU,UAAiC;AACtD,SAAK,eAAe,UAAU,WAAW;AAAA,EAC3C;AAAA,EAEA,MAAa,OAAO,UAAiC;AACnD,SAAK,eAAe,UAAU,QAAQ;AAAA,EACxC;AAAA,EAEQ,iBAAiB,oBAAI,IAAgB;AAAA,EAEtC,UAAU,UAAmC;AAClD,SAAK,eAAe,IAAI,QAAQ;AAChC,WAAO,MAAM,KAAK,eAAe,OAAO,QAAQ;AAAA,EAClD;AAAA,EAEQ,qBAAqB;AAC3B,eAAW,YAAY,KAAK,eAAgB,UAAS;AAAA,EACvD;AACF;","names":[]}
|
@@ -1,80 +0,0 @@
|
|
1
|
-
import { LazyMemoizeSubject } from "./subscribable/LazyMemoizeSubject";
|
2
|
-
import {
|
3
|
-
ThreadManagerMetadata,
|
4
|
-
ThreadManagerRuntimeCore,
|
5
|
-
} from "../runtimes/core/ThreadManagerRuntimeCore";
|
6
|
-
import { Unsubscribe } from "../types";
|
7
|
-
import { ThreadManagerRuntimePath } from "./RuntimePathTypes";
|
8
|
-
|
9
|
-
export type ThreadManagerState = Readonly<{
|
10
|
-
threads: readonly ThreadManagerMetadata[];
|
11
|
-
archivedThreads: readonly ThreadManagerMetadata[];
|
12
|
-
}>;
|
13
|
-
|
14
|
-
export type ThreadManagerRuntime = Readonly<{
|
15
|
-
path: ThreadManagerRuntimePath;
|
16
|
-
getState(): ThreadManagerState;
|
17
|
-
|
18
|
-
rename(threadId: string, newTitle: string): Promise<void>;
|
19
|
-
archive(threadId: string): Promise<void>;
|
20
|
-
unarchive(threadId: string): Promise<void>;
|
21
|
-
delete(threadId: string): Promise<void>;
|
22
|
-
|
23
|
-
subscribe(callback: () => void): Unsubscribe;
|
24
|
-
}>;
|
25
|
-
|
26
|
-
const getThreadManagerState = (
|
27
|
-
threadManager: ThreadManagerRuntimeCore,
|
28
|
-
): ThreadManagerState => {
|
29
|
-
return {
|
30
|
-
threads: threadManager.threads,
|
31
|
-
archivedThreads: threadManager.archivedThreads,
|
32
|
-
};
|
33
|
-
};
|
34
|
-
|
35
|
-
const THREAD_MANAGER_PATH = {
|
36
|
-
ref: "threadManager",
|
37
|
-
};
|
38
|
-
|
39
|
-
export type ThreadManagerRuntimeCoreBinding = ThreadManagerRuntimeCore;
|
40
|
-
|
41
|
-
export class ThreadManagerRuntimeImpl implements ThreadManagerRuntime {
|
42
|
-
public get path() {
|
43
|
-
return THREAD_MANAGER_PATH;
|
44
|
-
}
|
45
|
-
|
46
|
-
private _getState;
|
47
|
-
constructor(private _core: ThreadManagerRuntimeCoreBinding) {
|
48
|
-
const stateBinding = new LazyMemoizeSubject({
|
49
|
-
path: THREAD_MANAGER_PATH,
|
50
|
-
getState: () => getThreadManagerState(_core),
|
51
|
-
subscribe: (callback) => _core.subscribe(callback),
|
52
|
-
});
|
53
|
-
|
54
|
-
this._getState = stateBinding.getState.bind(stateBinding);
|
55
|
-
}
|
56
|
-
|
57
|
-
public getState(): ThreadManagerState {
|
58
|
-
return this._getState();
|
59
|
-
}
|
60
|
-
|
61
|
-
public rename(threadId: string, newTitle: string): Promise<void> {
|
62
|
-
return this._core.rename(threadId, newTitle);
|
63
|
-
}
|
64
|
-
|
65
|
-
public archive(threadId: string): Promise<void> {
|
66
|
-
return this._core.archive(threadId);
|
67
|
-
}
|
68
|
-
|
69
|
-
public unarchive(threadId: string): Promise<void> {
|
70
|
-
return this._core.unarchive(threadId);
|
71
|
-
}
|
72
|
-
|
73
|
-
public delete(threadId: string): Promise<void> {
|
74
|
-
return this._core.delete(threadId);
|
75
|
-
}
|
76
|
-
|
77
|
-
public subscribe(callback: () => void): Unsubscribe {
|
78
|
-
return this._core.subscribe(callback);
|
79
|
-
}
|
80
|
-
}
|
/package/dist/runtimes/core/{ThreadManagerRuntimeCore.mjs.map → ThreadListRuntimeCore.mjs.map}
RENAMED
File without changes
|