@assistant-ui/react 0.5.98 → 0.5.99
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/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} +17 -8
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js.map +1 -0
- package/dist/runtimes/external-store/{ExternalStoreThreadManagementAdapter.mjs → ExternalStoreThreadListRuntimeCore.mjs} +13 -4
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs.map +1 -0
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts +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} +16 -6
- 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,6 +1,7 @@
|
|
|
1
1
|
import { LanguageModelV1LogProbs } from "@ai-sdk/provider";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import { CompleteAttachment } from "./AttachmentTypes";
|
|
4
|
+
export type MessageRole = "user" | "assistant" | "system";
|
|
4
5
|
export type TextContentPart = {
|
|
5
6
|
type: "text";
|
|
6
7
|
text: string;
|
|
@@ -106,6 +107,7 @@ export type ThreadAssistantMessage = MessageCommonProps & {
|
|
|
106
107
|
export type AppendMessage = CoreMessage & {
|
|
107
108
|
parentId: string | null;
|
|
108
109
|
attachments?: readonly CompleteAttachment[] | undefined;
|
|
110
|
+
startRun?: boolean | undefined;
|
|
109
111
|
};
|
|
110
112
|
type BaseThreadMessage = {
|
|
111
113
|
status?: ThreadAssistantMessage["status"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantTypes.d.ts","sourceRoot":"","sources":["../../src/types/AssistantTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,KAAK,GAAG,KAAK,CAAC;KACvB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,SAAS,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,uBAAuB,CACjC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EACxE,OAAO,GAAG,OAAO,IACf;IACF,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAC7B,KAAK,SAAS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K,iBAAiB,GAAG;IACvB,MAAM,CAAC,EAAE,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAC3C,CAAC,mBAAmB,GAAG,iBAAiB,GAAG,sBAAsB,CAAC,CAAC;AAErE,oDAAoD;AAEpD,MAAM,MAAM,mBAAmB,GAC3B,eAAe,GACf,gBAAgB,GAChB,yBAAyB,CAAC;AAC9B,MAAM,MAAM,wBAAwB,GAChC,eAAe,GACf,uBAAuB,CAAC;AAE5B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,CAAC,eAAe,CAAC,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,mBAAmB,EAAE,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,wBAAwB,EAAE,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,WAAW,GACnB,iBAAiB,GACjB,eAAe,GACf,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/AssistantTypes.ts"],"sourcesContent":["import { LanguageModelV1LogProbs } from \"@ai-sdk/provider\";\nimport type { ReactNode } from \"react\";\nimport { CompleteAttachment } from \"./AttachmentTypes\";\n\nexport type TextContentPart = {\n type: \"text\";\n text: string;\n};\n\nexport type ImageContentPart = {\n type: \"image\";\n image: string;\n};\n\nexport type Unstable_AudioContentPart = {\n type: \"audio\";\n audio: {\n data: string;\n format: \"mp3\" | \"wav\";\n };\n};\n\nexport type UIContentPart = {\n type: \"ui\";\n display: ReactNode;\n};\n\nexport type CoreToolCallContentPart<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = {\n type: \"tool-call\";\n toolCallId: string;\n toolName: string;\n args: TArgs;\n result?: TResult | undefined;\n isError?: boolean | undefined;\n};\n\nexport type ToolCallContentPart<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = CoreToolCallContentPart<TArgs, TResult> & {\n argsText: string;\n};\n\nexport type ThreadUserContentPart =\n | TextContentPart\n | ImageContentPart\n | Unstable_AudioContentPart\n | UIContentPart;\n\nexport type ThreadAssistantContentPart =\n | TextContentPart\n | ToolCallContentPart\n | UIContentPart;\n\ntype MessageCommonProps = {\n id: string;\n createdAt: Date;\n};\n\n/**\n * @deprecated Use `ThreadStep` instead. This type will be removed in v0.6.\n */\nexport type ThreadRoundtrip = ThreadStep;\n\nexport type ThreadStep = {\n /**\n * @deprecated This field will be removed in v0.6. Submit feedback if you need this functionality.\n */\n logprobs?: LanguageModelV1LogProbs | undefined;\n usage?:\n | {\n promptTokens: number;\n completionTokens: number;\n }\n | undefined;\n};\n\nexport type ContentPartStatus =\n | {\n type: \"running\";\n }\n | {\n type: \"complete\";\n }\n | {\n type: \"incomplete\";\n reason: \"cancelled\" | \"length\" | \"content-filter\" | \"other\" | \"error\";\n error?: unknown;\n };\n\nexport type ToolCallContentPartStatus =\n | {\n type: \"requires-action\";\n reason: \"tool-calls\";\n }\n | ContentPartStatus;\n\nexport type MessageStatus =\n | {\n type: \"running\";\n }\n | {\n type: \"requires-action\";\n reason: \"tool-calls\";\n }\n | {\n type: \"complete\";\n reason: \"stop\" | \"unknown\";\n }\n | {\n type: \"incomplete\";\n reason:\n | \"cancelled\"\n | \"tool-calls\"\n | \"length\"\n | \"content-filter\"\n | \"other\"\n | \"error\";\n error?: unknown;\n };\n\nexport type ThreadSystemMessage = MessageCommonProps & {\n role: \"system\";\n content: [TextContentPart];\n};\n\nexport type ThreadUserMessage = MessageCommonProps & {\n role: \"user\";\n content: ThreadUserContentPart[];\n attachments: readonly CompleteAttachment[];\n // TODO metadata\n};\n\nexport type ThreadAssistantMessage = MessageCommonProps & {\n role: \"assistant\";\n content: ThreadAssistantContentPart[];\n status: MessageStatus;\n /**\n * @deprecated Use `metadata.steps` instead.\n */\n roundtrips?: ThreadStep[] | undefined;\n metadata?: {\n /**\n * @deprecated Use `steps` instead. This field will be removed in v0.6.\n */\n roundtrips?: ThreadStep[] | undefined;\n steps?: ThreadStep[] | undefined;\n custom?: Record<string, unknown> | undefined;\n };\n};\n\nexport type AppendMessage = CoreMessage & {\n parentId: string | null;\n // TODO make required in the next major version\n attachments?: readonly CompleteAttachment[] | undefined;\n};\n\ntype BaseThreadMessage = {\n status?: ThreadAssistantMessage[\"status\"];\n metadata?: ThreadAssistantMessage[\"metadata\"];\n attachments?: ThreadUserMessage[\"attachments\"];\n};\n\nexport type ThreadMessage = BaseThreadMessage &\n (ThreadSystemMessage | ThreadUserMessage | ThreadAssistantMessage);\n\n/** Core Message Types (without UI content parts) */\n\nexport type CoreUserContentPart =\n | TextContentPart\n | ImageContentPart\n | Unstable_AudioContentPart;\nexport type CoreAssistantContentPart =\n | TextContentPart\n | CoreToolCallContentPart;\n\nexport type CoreSystemMessage = {\n role: \"system\";\n content: [TextContentPart];\n};\n\nexport type CoreUserMessage = {\n role: \"user\";\n content: CoreUserContentPart[];\n};\n\nexport type CoreAssistantMessage = {\n role: \"assistant\";\n content: CoreAssistantContentPart[];\n};\n\nexport type CoreMessage =\n | CoreSystemMessage\n | CoreUserMessage\n | CoreAssistantMessage;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/types/AssistantTypes.ts"],"sourcesContent":["import { LanguageModelV1LogProbs } from \"@ai-sdk/provider\";\nimport type { ReactNode } from \"react\";\nimport { CompleteAttachment } from \"./AttachmentTypes\";\n\nexport type MessageRole = \"user\" | \"assistant\" | \"system\";\n\nexport type TextContentPart = {\n type: \"text\";\n text: string;\n};\n\nexport type ImageContentPart = {\n type: \"image\";\n image: string;\n};\n\nexport type Unstable_AudioContentPart = {\n type: \"audio\";\n audio: {\n data: string;\n format: \"mp3\" | \"wav\";\n };\n};\n\nexport type UIContentPart = {\n type: \"ui\";\n display: ReactNode;\n};\n\nexport type CoreToolCallContentPart<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = {\n type: \"tool-call\";\n toolCallId: string;\n toolName: string;\n args: TArgs;\n result?: TResult | undefined;\n isError?: boolean | undefined;\n};\n\nexport type ToolCallContentPart<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = CoreToolCallContentPart<TArgs, TResult> & {\n argsText: string;\n};\n\nexport type ThreadUserContentPart =\n | TextContentPart\n | ImageContentPart\n | Unstable_AudioContentPart\n | UIContentPart;\n\nexport type ThreadAssistantContentPart =\n | TextContentPart\n | ToolCallContentPart\n | UIContentPart;\n\ntype MessageCommonProps = {\n id: string;\n createdAt: Date;\n};\n\n/**\n * @deprecated Use `ThreadStep` instead. This type will be removed in v0.6.\n */\nexport type ThreadRoundtrip = ThreadStep;\n\nexport type ThreadStep = {\n /**\n * @deprecated This field will be removed in v0.6. Submit feedback if you need this functionality.\n */\n logprobs?: LanguageModelV1LogProbs | undefined;\n usage?:\n | {\n promptTokens: number;\n completionTokens: number;\n }\n | undefined;\n};\n\nexport type ContentPartStatus =\n | {\n type: \"running\";\n }\n | {\n type: \"complete\";\n }\n | {\n type: \"incomplete\";\n reason: \"cancelled\" | \"length\" | \"content-filter\" | \"other\" | \"error\";\n error?: unknown;\n };\n\nexport type ToolCallContentPartStatus =\n | {\n type: \"requires-action\";\n reason: \"tool-calls\";\n }\n | ContentPartStatus;\n\nexport type MessageStatus =\n | {\n type: \"running\";\n }\n | {\n type: \"requires-action\";\n reason: \"tool-calls\";\n }\n | {\n type: \"complete\";\n reason: \"stop\" | \"unknown\";\n }\n | {\n type: \"incomplete\";\n reason:\n | \"cancelled\"\n | \"tool-calls\"\n | \"length\"\n | \"content-filter\"\n | \"other\"\n | \"error\";\n error?: unknown;\n };\n\nexport type ThreadSystemMessage = MessageCommonProps & {\n role: \"system\";\n content: [TextContentPart];\n};\n\nexport type ThreadUserMessage = MessageCommonProps & {\n role: \"user\";\n content: ThreadUserContentPart[];\n attachments: readonly CompleteAttachment[];\n // TODO metadata\n};\n\nexport type ThreadAssistantMessage = MessageCommonProps & {\n role: \"assistant\";\n content: ThreadAssistantContentPart[];\n status: MessageStatus;\n /**\n * @deprecated Use `metadata.steps` instead.\n */\n roundtrips?: ThreadStep[] | undefined;\n metadata?: {\n /**\n * @deprecated Use `steps` instead. This field will be removed in v0.6.\n */\n roundtrips?: ThreadStep[] | undefined;\n steps?: ThreadStep[] | undefined;\n custom?: Record<string, unknown> | undefined;\n };\n};\n\nexport type AppendMessage = CoreMessage & {\n parentId: string | null;\n // TODO make required in the next major version\n attachments?: readonly CompleteAttachment[] | undefined;\n startRun?: boolean | undefined;\n};\n\ntype BaseThreadMessage = {\n status?: ThreadAssistantMessage[\"status\"];\n metadata?: ThreadAssistantMessage[\"metadata\"];\n attachments?: ThreadUserMessage[\"attachments\"];\n};\n\nexport type ThreadMessage = BaseThreadMessage &\n (ThreadSystemMessage | ThreadUserMessage | ThreadAssistantMessage);\n\n/** Core Message Types (without UI content parts) */\n\nexport type CoreUserContentPart =\n | TextContentPart\n | ImageContentPart\n | Unstable_AudioContentPart;\nexport type CoreAssistantContentPart =\n | TextContentPart\n | CoreToolCallContentPart;\n\nexport type CoreSystemMessage = {\n role: \"system\";\n content: [TextContentPart];\n};\n\nexport type CoreUserMessage = {\n role: \"user\";\n content: CoreUserContentPart[];\n};\n\nexport type CoreAssistantMessage = {\n role: \"assistant\";\n content: CoreAssistantContentPart[];\n};\n\nexport type CoreMessage =\n | CoreSystemMessage\n | CoreUserMessage\n | CoreAssistantMessage;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"conversational-ui",
|
|
30
30
|
"conversational-ai"
|
|
31
31
|
],
|
|
32
|
-
"version": "0.5.
|
|
32
|
+
"version": "0.5.99",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"exports": {
|
|
35
35
|
".": {
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"class-variance-authority": "^0.7.0",
|
|
81
81
|
"classnames": "^2.5.1",
|
|
82
82
|
"json-schema": "^0.4.0",
|
|
83
|
-
"lucide-react": "^0.
|
|
84
|
-
"nanoid": "^5.0.
|
|
83
|
+
"lucide-react": "^0.454.0",
|
|
84
|
+
"nanoid": "^5.0.8",
|
|
85
85
|
"react-textarea-autosize": "^8.5.4",
|
|
86
86
|
"secure-json-parse": "^2.7.0",
|
|
87
87
|
"zod": "^3.23.8",
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"peerDependencies": {
|
|
92
92
|
"@types/react": "*",
|
|
93
93
|
"@types/react-dom": "*",
|
|
94
|
-
"react": "^18 || ^19",
|
|
95
|
-
"react-dom": "^18 || ^19",
|
|
94
|
+
"react": "^18 || ^19 || ^19.0.0-rc",
|
|
95
|
+
"react-dom": "^18 || ^19 || ^19.0.0-rc",
|
|
96
96
|
"tailwindcss": "^3.4.4"
|
|
97
97
|
},
|
|
98
98
|
"peerDependenciesMeta": {
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
110
|
"@types/json-schema": "^7.0.15",
|
|
111
|
-
"@types/node": "^22.8.
|
|
111
|
+
"@types/node": "^22.8.2",
|
|
112
112
|
"autoprefixer": "^10.4.20",
|
|
113
113
|
"esbuild-plugin-file-path-extensions": "^2.1.3",
|
|
114
114
|
"eslint": "^9",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"tailwindcss": "^3.4.14",
|
|
120
120
|
"tailwindcss-animate": "^1.0.7",
|
|
121
121
|
"tsup": "8.3.5",
|
|
122
|
-
"tsx": "^4.19.
|
|
122
|
+
"tsx": "^4.19.2",
|
|
123
123
|
"@assistant-ui/tailwindcss-transformer": "0.1.0",
|
|
124
124
|
"@assistant-ui/tsbuildutils": "^0.0.0",
|
|
125
125
|
"@assistant-ui/tsconfig": "0.0.0"
|
|
@@ -7,10 +7,7 @@ import {
|
|
|
7
7
|
ThreadRuntimeImpl,
|
|
8
8
|
} from "./ThreadRuntime";
|
|
9
9
|
import { Unsubscribe } from "../types";
|
|
10
|
-
import {
|
|
11
|
-
ThreadManagerRuntime,
|
|
12
|
-
ThreadManagerRuntimeImpl,
|
|
13
|
-
} from "./ThreadManagerRuntime";
|
|
10
|
+
import { ThreadListRuntime, ThreadListRuntimeImpl } from "./ThreadListRuntime";
|
|
14
11
|
|
|
15
12
|
export type AssistantRuntime = {
|
|
16
13
|
/**
|
|
@@ -21,7 +18,7 @@ export type AssistantRuntime = {
|
|
|
21
18
|
/**
|
|
22
19
|
* The thread manager, to rename, archive and delete threads.
|
|
23
20
|
*/
|
|
24
|
-
|
|
21
|
+
threadList: ThreadListRuntime;
|
|
25
22
|
|
|
26
23
|
/**
|
|
27
24
|
* Switch to a new thread.
|
|
@@ -54,16 +51,16 @@ export type AssistantRuntime = {
|
|
|
54
51
|
|
|
55
52
|
export class AssistantRuntimeImpl
|
|
56
53
|
implements
|
|
57
|
-
Omit<AssistantRuntimeCore, "thread" | "
|
|
54
|
+
Omit<AssistantRuntimeCore, "thread" | "threadList">,
|
|
58
55
|
AssistantRuntime
|
|
59
56
|
{
|
|
60
|
-
public readonly
|
|
57
|
+
public readonly threadList;
|
|
61
58
|
|
|
62
59
|
protected constructor(
|
|
63
60
|
private readonly _core: AssistantRuntimeCore,
|
|
64
61
|
private readonly _thread: ThreadRuntime,
|
|
65
62
|
) {
|
|
66
|
-
this.
|
|
63
|
+
this.threadList = new ThreadListRuntimeImpl(_core.threadList);
|
|
67
64
|
}
|
|
68
65
|
|
|
69
66
|
public get thread() {
|
|
@@ -71,7 +68,7 @@ export class AssistantRuntimeImpl
|
|
|
71
68
|
}
|
|
72
69
|
|
|
73
70
|
public switchToNewThread() {
|
|
74
|
-
return this._core.
|
|
71
|
+
return this._core.threadList.switchToNewThread();
|
|
75
72
|
}
|
|
76
73
|
|
|
77
74
|
public switchToThread(threadId: string): void;
|
|
@@ -81,7 +78,7 @@ export class AssistantRuntimeImpl
|
|
|
81
78
|
public switchToThread(threadId: string | null): void;
|
|
82
79
|
public switchToThread(threadId: string | null) {
|
|
83
80
|
if (threadId === null) return this.switchToNewThread();
|
|
84
|
-
return this._core.
|
|
81
|
+
return this._core.threadList.switchToThread(threadId);
|
|
85
82
|
}
|
|
86
83
|
|
|
87
84
|
public registerModelConfigProvider(provider: ModelConfigProvider) {
|
|
@@ -107,8 +104,8 @@ export class AssistantRuntimeImpl
|
|
|
107
104
|
ref: "threads.main",
|
|
108
105
|
threadSelector: { type: "main" },
|
|
109
106
|
},
|
|
110
|
-
getState: () => _core.
|
|
111
|
-
subscribe: (callback) => _core.
|
|
107
|
+
getState: () => _core.threadList.mainThread,
|
|
108
|
+
subscribe: (callback) => _core.threadList.subscribe(callback),
|
|
112
109
|
}),
|
|
113
110
|
);
|
|
114
111
|
}
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { ShallowMemoizeSubject } from "./subscribable/ShallowMemoizeSubject";
|
|
16
16
|
import { SKIP_UPDATE } from "./subscribable/SKIP_UPDATE";
|
|
17
17
|
import { ComposerRuntimePath } from "./RuntimePathTypes";
|
|
18
|
+
import { MessageRole } from "../types/AssistantTypes";
|
|
18
19
|
|
|
19
20
|
export type ThreadComposerRuntimeCoreBinding = SubscribableWithState<
|
|
20
21
|
ThreadComposerRuntimeCore | undefined,
|
|
@@ -99,6 +100,7 @@ type LegacyThreadComposerState = Readonly<{
|
|
|
99
100
|
|
|
100
101
|
type BaseComposerState = {
|
|
101
102
|
text: string;
|
|
103
|
+
role: MessageRole;
|
|
102
104
|
attachments: readonly Attachment[];
|
|
103
105
|
|
|
104
106
|
canCancel: boolean;
|
|
@@ -135,6 +137,7 @@ const getThreadComposerState = (
|
|
|
135
137
|
isEmpty: runtime?.isEmpty ?? true,
|
|
136
138
|
text: runtime?.text ?? "",
|
|
137
139
|
attachments: runtime?.attachments ?? EMPTY_ARRAY,
|
|
140
|
+
role: runtime?.role ?? "user",
|
|
138
141
|
|
|
139
142
|
value: runtime?.text ?? "",
|
|
140
143
|
setValue: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,
|
|
@@ -162,6 +165,7 @@ const getEditComposerState = (
|
|
|
162
165
|
isEmpty: runtime?.isEmpty ?? true,
|
|
163
166
|
text: runtime?.text ?? "",
|
|
164
167
|
attachments: runtime?.attachments ?? EMPTY_ARRAY,
|
|
168
|
+
role: runtime?.role ?? "user",
|
|
165
169
|
|
|
166
170
|
value: runtime?.text ?? "",
|
|
167
171
|
setValue: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,
|
|
@@ -252,6 +256,13 @@ export abstract class ComposerRuntimeImpl
|
|
|
252
256
|
return this.getState().text;
|
|
253
257
|
}
|
|
254
258
|
|
|
259
|
+
/**
|
|
260
|
+
* @deprecated Use `getState().role` instead. This will be removed in 0.6.0.
|
|
261
|
+
*/
|
|
262
|
+
public get role() {
|
|
263
|
+
return this.getState().role;
|
|
264
|
+
}
|
|
265
|
+
|
|
255
266
|
/**
|
|
256
267
|
* @deprecated Use `getState().attachments` instead. This will be removed in 0.6.0.
|
|
257
268
|
*/
|
|
@@ -314,6 +325,12 @@ export abstract class ComposerRuntimeImpl
|
|
|
314
325
|
core.cancel();
|
|
315
326
|
}
|
|
316
327
|
|
|
328
|
+
public setRole(role: MessageRole) {
|
|
329
|
+
const core = this._core.getState();
|
|
330
|
+
if (!core) throw new Error("Composer is not available");
|
|
331
|
+
core.setRole(role);
|
|
332
|
+
}
|
|
333
|
+
|
|
317
334
|
public subscribe(callback: () => void) {
|
|
318
335
|
return this._core.subscribe(callback);
|
|
319
336
|
}
|
|
@@ -180,7 +180,6 @@ export class MessageRuntimeImpl implements MessageRuntime {
|
|
|
180
180
|
|
|
181
181
|
public reload() {
|
|
182
182
|
const state = this._core.getState();
|
|
183
|
-
if (!state) throw new Error("Message is not available");
|
|
184
183
|
if (state.role !== "assistant")
|
|
185
184
|
throw new Error("Can only reload assistant messages");
|
|
186
185
|
|
|
@@ -189,15 +188,11 @@ export class MessageRuntimeImpl implements MessageRuntime {
|
|
|
189
188
|
|
|
190
189
|
public speak() {
|
|
191
190
|
const state = this._core.getState();
|
|
192
|
-
if (!state) throw new Error("Message is not available");
|
|
193
|
-
|
|
194
191
|
return this._threadBinding.getState().speak(state.id);
|
|
195
192
|
}
|
|
196
193
|
|
|
197
194
|
public stopSpeaking() {
|
|
198
195
|
const state = this._core.getState();
|
|
199
|
-
if (!state) throw new Error("Message is not available");
|
|
200
|
-
|
|
201
196
|
const thread = this._threadBinding.getState();
|
|
202
197
|
if (thread.speech?.messageId === state.id) {
|
|
203
198
|
this._threadBinding.getState().stopSpeaking();
|
|
@@ -208,8 +203,6 @@ export class MessageRuntimeImpl implements MessageRuntime {
|
|
|
208
203
|
|
|
209
204
|
public submitFeedback({ type }: { type: "positive" | "negative" }) {
|
|
210
205
|
const state = this._core.getState();
|
|
211
|
-
if (!state) throw new Error("Message is not available");
|
|
212
|
-
|
|
213
206
|
this._threadBinding.getState().submitFeedback({
|
|
214
207
|
messageId: state.id,
|
|
215
208
|
type,
|
|
@@ -224,8 +217,6 @@ export class MessageRuntimeImpl implements MessageRuntime {
|
|
|
224
217
|
branchId?: string | undefined;
|
|
225
218
|
}) {
|
|
226
219
|
const state = this._core.getState();
|
|
227
|
-
if (!state) throw new Error("Message is not available");
|
|
228
|
-
|
|
229
220
|
if (branchId && position) {
|
|
230
221
|
throw new Error("May not specify both branchId and position");
|
|
231
222
|
} else if (!branchId && !position) {
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type ThreadListRuntimePath = {
|
|
2
2
|
ref: string;
|
|
3
3
|
};
|
|
4
4
|
|
|
5
|
+
export type ThreadListItemRuntimePath = {
|
|
6
|
+
ref: string;
|
|
7
|
+
threadSelector:
|
|
8
|
+
| { type: "main" }
|
|
9
|
+
| { type: "index"; index: number }
|
|
10
|
+
| { type: "archiveIndex"; index: number }
|
|
11
|
+
| { type: "threadId"; threadId: string };
|
|
12
|
+
};
|
|
13
|
+
|
|
5
14
|
export type ThreadRuntimePath = {
|
|
6
15
|
ref: string;
|
|
7
16
|
threadSelector: { type: "main" };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ThreadListMetadata } from "../runtimes/core/ThreadListRuntimeCore";
|
|
2
|
+
import { Unsubscribe } from "../types";
|
|
3
|
+
import { ThreadListItemRuntimePath } from "./RuntimePathTypes";
|
|
4
|
+
import { SubscribableWithState } from "./subscribable/Subscribable";
|
|
5
|
+
import { ThreadListRuntimeCoreBinding } from "./ThreadListRuntime";
|
|
6
|
+
|
|
7
|
+
export type ThreadListItemState = ThreadListMetadata;
|
|
8
|
+
|
|
9
|
+
export type ThreadListItemRuntime = Readonly<{
|
|
10
|
+
path: ThreadListItemRuntimePath;
|
|
11
|
+
getState(): ThreadListMetadata;
|
|
12
|
+
|
|
13
|
+
rename(newTitle: string): Promise<void>;
|
|
14
|
+
archive(): Promise<void>;
|
|
15
|
+
unarchive(): Promise<void>;
|
|
16
|
+
delete(): Promise<void>;
|
|
17
|
+
|
|
18
|
+
subscribe(callback: () => void): Unsubscribe;
|
|
19
|
+
}>;
|
|
20
|
+
|
|
21
|
+
export type ThreadListItemStateBinding = SubscribableWithState<
|
|
22
|
+
ThreadListItemState,
|
|
23
|
+
ThreadListItemRuntimePath
|
|
24
|
+
>;
|
|
25
|
+
|
|
26
|
+
export class ThreadListItemRuntimeImpl implements ThreadListItemRuntime {
|
|
27
|
+
public get path() {
|
|
28
|
+
return this._core.path;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
constructor(
|
|
32
|
+
private _core: ThreadListItemStateBinding,
|
|
33
|
+
private _ThreadListBinding: ThreadListRuntimeCoreBinding,
|
|
34
|
+
) {}
|
|
35
|
+
|
|
36
|
+
public getState(): ThreadListItemState {
|
|
37
|
+
return this._core.getState();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public rename(newTitle: string): Promise<void> {
|
|
41
|
+
const state = this._core.getState();
|
|
42
|
+
|
|
43
|
+
return this._ThreadListBinding.rename(state.threadId, newTitle);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public archive(): Promise<void> {
|
|
47
|
+
const state = this._core.getState();
|
|
48
|
+
|
|
49
|
+
return this._ThreadListBinding.archive(state.threadId);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public unarchive(): Promise<void> {
|
|
53
|
+
const state = this._core.getState();
|
|
54
|
+
|
|
55
|
+
return this._ThreadListBinding.unarchive(state.threadId);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public delete(): Promise<void> {
|
|
59
|
+
const state = this._core.getState();
|
|
60
|
+
|
|
61
|
+
return this._ThreadListBinding.delete(state.threadId);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public subscribe(callback: () => void): Unsubscribe {
|
|
65
|
+
return this._core.subscribe(callback);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { LazyMemoizeSubject } from "./subscribable/LazyMemoizeSubject";
|
|
2
|
+
import {
|
|
3
|
+
ThreadListMetadata,
|
|
4
|
+
ThreadListRuntimeCore,
|
|
5
|
+
} from "../runtimes/core/ThreadListRuntimeCore";
|
|
6
|
+
import { Unsubscribe } from "../types";
|
|
7
|
+
import { ThreadListRuntimePath } from "./RuntimePathTypes";
|
|
8
|
+
import {
|
|
9
|
+
ThreadListItemRuntime,
|
|
10
|
+
ThreadListItemRuntimeImpl,
|
|
11
|
+
} from "./ThreadListItemRuntime";
|
|
12
|
+
import { SKIP_UPDATE } from "./subscribable/SKIP_UPDATE";
|
|
13
|
+
|
|
14
|
+
export type ThreadListState = Readonly<{
|
|
15
|
+
threads: readonly ThreadListMetadata[];
|
|
16
|
+
archivedThreads: readonly ThreadListMetadata[];
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
export type ThreadListRuntime = Readonly<{
|
|
20
|
+
path: ThreadListRuntimePath;
|
|
21
|
+
getState(): ThreadListState;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Use `getThreadListItemById(idx).rename(newTitle)` instead. This will be removed in 0.6.0.
|
|
25
|
+
*/
|
|
26
|
+
rename(threadId: string, newTitle: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use `getThreadListItemById(idx).archive()` instead. This will be removed in 0.6.0.
|
|
29
|
+
*/
|
|
30
|
+
archive(threadId: string): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Use `getThreadListItemById(idx).unarchive()` instead. This will be removed in 0.6.0.
|
|
33
|
+
*/
|
|
34
|
+
unarchive(threadId: string): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Use `getThreadListItemById(idx).delete()` instead. This will be removed in 0.6.0.
|
|
37
|
+
*/
|
|
38
|
+
delete(threadId: string): Promise<void>;
|
|
39
|
+
|
|
40
|
+
subscribe(callback: () => void): Unsubscribe;
|
|
41
|
+
|
|
42
|
+
getThreadListItemById(threadId: string): ThreadListItemRuntime;
|
|
43
|
+
getThreadListItemByIndex(idx: number): ThreadListItemRuntime;
|
|
44
|
+
getThreadListArchivedItemByIndex(idx: number): ThreadListItemRuntime;
|
|
45
|
+
}>;
|
|
46
|
+
|
|
47
|
+
const getThreadListState = (
|
|
48
|
+
threadList: ThreadListRuntimeCore,
|
|
49
|
+
): ThreadListState => {
|
|
50
|
+
return {
|
|
51
|
+
threads: threadList.threads,
|
|
52
|
+
archivedThreads: threadList.archivedThreads,
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const THREAD_MANAGER_PATH = {
|
|
57
|
+
ref: "ThreadList",
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type ThreadListRuntimeCoreBinding = ThreadListRuntimeCore;
|
|
61
|
+
|
|
62
|
+
export class ThreadListRuntimeImpl implements ThreadListRuntime {
|
|
63
|
+
public get path() {
|
|
64
|
+
return THREAD_MANAGER_PATH;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private _getState;
|
|
68
|
+
constructor(private _core: ThreadListRuntimeCoreBinding) {
|
|
69
|
+
const stateBinding = new LazyMemoizeSubject({
|
|
70
|
+
path: THREAD_MANAGER_PATH,
|
|
71
|
+
getState: () => getThreadListState(_core),
|
|
72
|
+
subscribe: (callback) => _core.subscribe(callback),
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
this._getState = stateBinding.getState.bind(stateBinding);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public getState(): ThreadListState {
|
|
79
|
+
return this._getState();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public rename(threadId: string, newTitle: string): Promise<void> {
|
|
83
|
+
return this._core.rename(threadId, newTitle);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public archive(threadId: string): Promise<void> {
|
|
87
|
+
return this._core.archive(threadId);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
public unarchive(threadId: string): Promise<void> {
|
|
91
|
+
return this._core.unarchive(threadId);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public delete(threadId: string): Promise<void> {
|
|
95
|
+
return this._core.delete(threadId);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
public subscribe(callback: () => void): Unsubscribe {
|
|
99
|
+
return this._core.subscribe(callback);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
public getThreadListItemByIndex(idx: number) {
|
|
103
|
+
return new ThreadListItemRuntimeImpl(
|
|
104
|
+
new LazyMemoizeSubject({
|
|
105
|
+
path: {
|
|
106
|
+
ref: this.path.ref + `${this.path.ref}.threadItems[${idx}]`,
|
|
107
|
+
threadSelector: { type: "index", index: idx },
|
|
108
|
+
},
|
|
109
|
+
getState: () => {
|
|
110
|
+
const threads = this._core.threads;
|
|
111
|
+
const thread = threads[idx];
|
|
112
|
+
if (!thread) return SKIP_UPDATE;
|
|
113
|
+
return thread;
|
|
114
|
+
},
|
|
115
|
+
subscribe: (callback) => this._core.subscribe(callback),
|
|
116
|
+
}),
|
|
117
|
+
this._core,
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
public getThreadListArchivedItemByIndex(idx: number) {
|
|
122
|
+
return new ThreadListItemRuntimeImpl(
|
|
123
|
+
new LazyMemoizeSubject({
|
|
124
|
+
path: {
|
|
125
|
+
ref: this.path.ref + `${this.path.ref}.archivedThreadItems[${idx}]`,
|
|
126
|
+
threadSelector: { type: "archiveIndex", index: idx },
|
|
127
|
+
},
|
|
128
|
+
getState: () => {
|
|
129
|
+
const threads = this._core.archivedThreads;
|
|
130
|
+
const thread = threads[idx];
|
|
131
|
+
if (!thread) return SKIP_UPDATE;
|
|
132
|
+
return thread;
|
|
133
|
+
},
|
|
134
|
+
subscribe: (callback) => this._core.subscribe(callback),
|
|
135
|
+
}),
|
|
136
|
+
this._core,
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
public getThreadListItemById(threadId: string) {
|
|
141
|
+
return new ThreadListItemRuntimeImpl(
|
|
142
|
+
new LazyMemoizeSubject({
|
|
143
|
+
path: {
|
|
144
|
+
ref:
|
|
145
|
+
this.path.ref +
|
|
146
|
+
`${this.path.ref}.threadItems[threadId=${threadId}]`,
|
|
147
|
+
threadSelector: { type: "threadId", threadId },
|
|
148
|
+
},
|
|
149
|
+
getState: () => {
|
|
150
|
+
const threadItem = this._core.getThreadMetadataById(threadId);
|
|
151
|
+
if (!threadItem) return SKIP_UPDATE;
|
|
152
|
+
return threadItem;
|
|
153
|
+
},
|
|
154
|
+
subscribe: (callback) => this._core.subscribe(callback),
|
|
155
|
+
}),
|
|
156
|
+
this._core,
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
}
|
package/src/api/ThreadRuntime.ts
CHANGED
|
@@ -42,6 +42,7 @@ export type CreateAppendMessage =
|
|
|
42
42
|
role?: AppendMessage["role"] | undefined;
|
|
43
43
|
content: AppendMessage["content"];
|
|
44
44
|
attachments?: AppendMessage["attachments"] | undefined;
|
|
45
|
+
startRun?: boolean | undefined;
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
const toAppendMessage = (
|
|
@@ -62,9 +63,9 @@ const toAppendMessage = (
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
return {
|
|
66
|
+
...message,
|
|
65
67
|
parentId: message.parentId ?? messages.at(-1)?.id ?? null,
|
|
66
68
|
role: message.role ?? "user",
|
|
67
|
-
content: message.content,
|
|
68
69
|
attachments: message.attachments ?? [],
|
|
69
70
|
} as AppendMessage;
|
|
70
71
|
};
|
package/src/api/index.ts
CHANGED
|
@@ -14,7 +14,4 @@ export type {
|
|
|
14
14
|
ComposerState,
|
|
15
15
|
} from "./ComposerRuntime";
|
|
16
16
|
export type { AttachmentRuntime, AttachmentState } from "./AttachmentRuntime";
|
|
17
|
-
export type {
|
|
18
|
-
ThreadManagerRuntime,
|
|
19
|
-
ThreadManagerState,
|
|
20
|
-
} from "./ThreadManagerRuntime";
|
|
17
|
+
export type { ThreadListRuntime, ThreadListState } from "./ThreadListRuntime";
|
|
@@ -32,16 +32,14 @@ const useAssistantToolUIsStore = () => {
|
|
|
32
32
|
return useMemo(() => makeAssistantToolUIsStore(), []);
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
const
|
|
36
|
-
const [store] = useState(() =>
|
|
37
|
-
create(() => runtime.threadManager.getState()),
|
|
38
|
-
);
|
|
35
|
+
const useThreadListStore = (runtime: AssistantRuntime) => {
|
|
36
|
+
const [store] = useState(() => create(() => runtime.threadList.getState()));
|
|
39
37
|
|
|
40
38
|
useEffect(() => {
|
|
41
39
|
const updateState = () =>
|
|
42
|
-
writableStore(store).setState(runtime.
|
|
40
|
+
writableStore(store).setState(runtime.threadList.getState(), true);
|
|
43
41
|
updateState();
|
|
44
|
-
return runtime.
|
|
42
|
+
return runtime.threadList.subscribe(updateState);
|
|
45
43
|
}, [runtime, store]);
|
|
46
44
|
|
|
47
45
|
return store;
|
|
@@ -52,15 +50,15 @@ export const AssistantRuntimeProviderImpl: FC<
|
|
|
52
50
|
> = ({ children, runtime }) => {
|
|
53
51
|
const useAssistantRuntime = useAssistantRuntimeStore(runtime);
|
|
54
52
|
const useToolUIs = useAssistantToolUIsStore();
|
|
55
|
-
const
|
|
53
|
+
const useThreadList = useThreadListStore(runtime);
|
|
56
54
|
const context = useMemo(() => {
|
|
57
55
|
return {
|
|
58
56
|
useToolUIs,
|
|
59
57
|
useAssistantRuntime,
|
|
60
58
|
useAssistantActions: useAssistantRuntime,
|
|
61
|
-
|
|
59
|
+
useThreadList,
|
|
62
60
|
};
|
|
63
|
-
}, [useAssistantRuntime, useToolUIs,
|
|
61
|
+
}, [useAssistantRuntime, useToolUIs, useThreadList]);
|
|
64
62
|
|
|
65
63
|
return (
|
|
66
64
|
<AssistantContext.Provider value={context}>
|
|
@@ -12,9 +12,11 @@ import { AttachmentContext } from "../react/AttachmentContext";
|
|
|
12
12
|
import { writableStore } from "../ReadonlyStore";
|
|
13
13
|
import { AttachmentRuntime } from "../../api/AttachmentRuntime";
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
export namespace AttachmentRuntimeProvider {
|
|
16
|
+
export type Props = PropsWithChildren<{
|
|
17
|
+
runtime: AttachmentRuntime;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
18
20
|
|
|
19
21
|
const useAttachmentRuntimeStore = (runtime: AttachmentRuntime) => {
|
|
20
22
|
const [store] = useState(() => create(() => runtime));
|
|
@@ -37,7 +39,7 @@ const useAttachmentStore = (runtime: AttachmentRuntime) => {
|
|
|
37
39
|
return store;
|
|
38
40
|
};
|
|
39
41
|
|
|
40
|
-
export const AttachmentRuntimeProvider: FC<
|
|
42
|
+
export const AttachmentRuntimeProvider: FC<AttachmentRuntimeProvider.Props> = ({
|
|
41
43
|
runtime,
|
|
42
44
|
children,
|
|
43
45
|
}) => {
|
|
@@ -7,9 +7,11 @@ import type { ContentPartContextValue } from "../react/ContentPartContext";
|
|
|
7
7
|
import { writableStore } from "../ReadonlyStore";
|
|
8
8
|
import { ContentPartRuntime } from "../../api/ContentPartRuntime";
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
export namespace ContentPartRuntimeProvider {
|
|
11
|
+
export type Props = PropsWithChildren<{
|
|
12
|
+
runtime: ContentPartRuntime;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
13
15
|
|
|
14
16
|
const useContentPartRuntimeStore = (runtime: ContentPartRuntime) => {
|
|
15
17
|
const [store] = useState(() => create(() => runtime));
|
|
@@ -33,10 +35,9 @@ export const useContentPartStore = (runtime: ContentPartRuntime) => {
|
|
|
33
35
|
return store;
|
|
34
36
|
};
|
|
35
37
|
|
|
36
|
-
export const ContentPartRuntimeProvider: FC<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}) => {
|
|
38
|
+
export const ContentPartRuntimeProvider: FC<
|
|
39
|
+
ContentPartRuntimeProvider.Props
|
|
40
|
+
> = ({ runtime, children }) => {
|
|
40
41
|
const useContentPartRuntime = useContentPartRuntimeStore(runtime);
|
|
41
42
|
const useContentPart = useContentPartStore(runtime);
|
|
42
43
|
const [context] = useState<ContentPartContextValue>(() => {
|
|
@@ -8,9 +8,11 @@ import { makeMessageUtilsStore } from "../stores/MessageUtils";
|
|
|
8
8
|
import { ReadonlyStore, writableStore } from "../ReadonlyStore";
|
|
9
9
|
import { MessageRuntime } from "../../api/MessageRuntime";
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export namespace MessageRuntimeProvider {
|
|
12
|
+
export type Props = PropsWithChildren<{
|
|
13
|
+
runtime: MessageRuntime;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
14
16
|
|
|
15
17
|
const useMessageRuntimeStore = (runtime: MessageRuntime) => {
|
|
16
18
|
const [store] = useState(() => create(() => runtime));
|
|
@@ -54,7 +56,7 @@ const useEditComposerStore = (
|
|
|
54
56
|
return store;
|
|
55
57
|
};
|
|
56
58
|
|
|
57
|
-
export const MessageRuntimeProvider: FC<
|
|
59
|
+
export const MessageRuntimeProvider: FC<MessageRuntimeProvider.Props> = ({
|
|
58
60
|
runtime,
|
|
59
61
|
children,
|
|
60
62
|
}) => {
|