@assistant-ui/react 0.7.11 → 0.7.14
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/primitive-hooks/thread/useThreadViewportAutoScroll.d.ts +1 -1
- package/dist/primitive-hooks/thread/useThreadViewportAutoScroll.d.ts.map +1 -1
- package/dist/primitive-hooks/thread/useThreadViewportAutoScroll.js.map +1 -1
- package/dist/primitive-hooks/thread/useThreadViewportAutoScroll.mjs.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarCopy.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarEdit.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarReload.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarRoot.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarRoot.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarSpeak.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts.map +1 -1
- package/dist/primitives/assistantModal/scope.d.ts +2 -6
- package/dist/primitives/assistantModal/scope.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentRemove.d.ts +1 -3
- package/dist/primitives/attachment/AttachmentRemove.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentRoot.d.ts +1 -3
- package/dist/primitives/attachment/AttachmentRoot.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentThumb.d.ts +1 -3
- package/dist/primitives/attachment/AttachmentThumb.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.d.ts +1 -3
- package/dist/primitives/branchPicker/BranchPickerNext.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts +1 -3
- package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.d.ts +1 -3
- package/dist/primitives/branchPicker/BranchPickerRoot.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.d.ts +1 -3
- package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerCancel.d.ts +1 -3
- package/dist/primitives/composer/ComposerCancel.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +2 -2
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.mjs +2 -2
- package/dist/primitives/composer/ComposerInput.mjs.map +1 -1
- package/dist/primitives/composer/ComposerRoot.d.ts +1 -3
- package/dist/primitives/composer/ComposerRoot.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerSend.d.ts +1 -3
- package/dist/primitives/composer/ComposerSend.d.ts.map +1 -1
- package/dist/primitives/contentPart/ContentPartImage.d.ts +1 -3
- package/dist/primitives/contentPart/ContentPartImage.d.ts.map +1 -1
- package/dist/primitives/contentPart/ContentPartText.d.ts +1 -3
- package/dist/primitives/contentPart/ContentPartText.d.ts.map +1 -1
- package/dist/primitives/message/MessageRoot.d.ts +1 -3
- package/dist/primitives/message/MessageRoot.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadRoot.d.ts +1 -3
- package/dist/primitives/thread/ThreadRoot.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.d.ts +1 -3
- package/dist/primitives/thread/ThreadScrollToBottom.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.d.ts +1 -3
- package/dist/primitives/thread/ThreadSuggestion.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadViewport.d.ts +1 -3
- package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.d.ts +1 -3
- package/dist/primitives/threadList/ThreadListNew.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts +1 -3
- package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts +1 -3
- package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts +1 -3
- package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts +1 -3
- package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts +1 -3
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts +2 -0
- package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.js +8 -0
- package/dist/runtimes/core/BaseThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.mjs +8 -0
- package/dist/runtimes/core/BaseThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.js +16 -9
- package/dist/runtimes/edge/streams/assistantDecoderStream.js.map +1 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.mjs +16 -9
- package/dist/runtimes/edge/streams/assistantDecoderStream.mjs.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +3 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs +3 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts +0 -2
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js +2 -9
- package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +2 -9
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +1 -1
- package/dist/styles/index.css.map +1 -1
- package/dist/ui/assistant-action-bar.d.ts +1 -3
- package/dist/ui/assistant-action-bar.d.ts.map +1 -1
- package/dist/ui/assistant-message.d.ts +1 -3
- package/dist/ui/assistant-message.d.ts.map +1 -1
- package/dist/ui/attachment-ui.d.ts +1 -3
- package/dist/ui/attachment-ui.d.ts.map +1 -1
- package/dist/ui/base/button.d.ts +1 -3
- package/dist/ui/base/button.d.ts.map +1 -1
- package/dist/ui/base/tooltip-icon-button.d.ts +1 -3
- package/dist/ui/base/tooltip-icon-button.d.ts.map +1 -1
- package/dist/ui/branch-picker.d.ts +1 -3
- package/dist/ui/branch-picker.d.ts.map +1 -1
- package/dist/ui/composer.d.ts +1 -3
- package/dist/ui/composer.d.ts.map +1 -1
- package/dist/ui/edit-composer.d.ts +1 -3
- package/dist/ui/edit-composer.d.ts.map +1 -1
- package/dist/ui/thread-list-item.d.ts +1 -3
- package/dist/ui/thread-list-item.d.ts.map +1 -1
- package/dist/ui/thread-list.d.ts +1 -3
- package/dist/ui/thread-list.d.ts.map +1 -1
- package/dist/ui/thread.d.ts +2 -6
- package/dist/ui/thread.d.ts.map +1 -1
- package/dist/ui/user-action-bar.d.ts +1 -3
- package/dist/ui/user-action-bar.d.ts.map +1 -1
- package/dist/ui/user-message.d.ts +1 -3
- package/dist/ui/user-message.d.ts.map +1 -1
- package/dist/utils/createActionButton.d.ts +1 -3
- package/dist/utils/createActionButton.d.ts.map +1 -1
- package/dist/utils/hooks/useManagedRef.js +1 -1
- package/dist/utils/hooks/useManagedRef.js.map +1 -1
- package/dist/utils/hooks/useManagedRef.mjs +1 -1
- package/dist/utils/hooks/useManagedRef.mjs.map +1 -1
- package/package.json +22 -22
- package/src/primitive-hooks/thread/useThreadViewportAutoScroll.tsx +1 -1
- package/src/primitives/composer/ComposerInput.tsx +2 -2
- package/src/runtimes/core/BaseThreadRuntimeCore.tsx +10 -0
- package/src/runtimes/edge/streams/assistantDecoderStream.ts +18 -9
- package/src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx +4 -1
- package/src/runtimes/local/LocalThreadRuntimeCore.tsx +2 -11
- package/src/utils/hooks/useManagedRef.ts +1 -1
- package/edge/package-lock.json +0 -6
@@ -4,9 +4,7 @@ export declare namespace MessagePrimitiveRoot {
|
|
4
4
|
type Element = ElementRef<typeof Primitive.div>;
|
5
5
|
type Props = ComponentPropsWithoutRef<typeof Primitive.div>;
|
6
6
|
}
|
7
|
-
export declare const MessagePrimitiveRoot: import("react").ForwardRefExoticComponent<Omit<
|
8
|
-
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
9
|
-
} & {
|
7
|
+
export declare const MessagePrimitiveRoot: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
10
8
|
asChild?: boolean;
|
11
9
|
}, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
12
10
|
//# sourceMappingURL=MessageRoot.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MessageRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/message/MessageRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EACL,KAAK,UAAU,EAEf,wBAAwB,EAEzB,MAAM,OAAO,CAAC;AAiCf,yBAAiB,oBAAoB,CAAC;IACpC,KAAY,OAAO,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACvD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;CACpE;AAED,eAAO,MAAM,oBAAoB
|
1
|
+
{"version":3,"file":"MessageRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/message/MessageRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EACL,KAAK,UAAU,EAEf,wBAAwB,EAEzB,MAAM,OAAO,CAAC;AAiCf,yBAAiB,oBAAoB,CAAC;IACpC,KAAY,OAAO,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACvD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;CACpE;AAED,eAAO,MAAM,oBAAoB;;0DAQ/B,CAAC"}
|
@@ -4,9 +4,7 @@ export declare namespace ThreadPrimitiveRoot {
|
|
4
4
|
type Element = ElementRef<typeof Primitive.div>;
|
5
5
|
type Props = ComponentPropsWithoutRef<typeof Primitive.div>;
|
6
6
|
}
|
7
|
-
export declare const ThreadPrimitiveRoot: import("react").ForwardRefExoticComponent<Omit<
|
8
|
-
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
9
|
-
} & {
|
7
|
+
export declare const ThreadPrimitiveRoot: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
10
8
|
asChild?: boolean;
|
11
9
|
}, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
12
10
|
//# sourceMappingURL=ThreadRoot.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,UAAU,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAE9E,yBAAiB,mBAAmB,CAAC;IACnC,KAAY,OAAO,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACvD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;CACpE;AAED,eAAO,MAAM,mBAAmB
|
1
|
+
{"version":3,"file":"ThreadRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,UAAU,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAE9E,yBAAiB,mBAAmB,CAAC;IACnC,KAAY,OAAO,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACvD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;CACpE;AAED,eAAO,MAAM,mBAAmB;;0DAK9B,CAAC"}
|
@@ -4,9 +4,7 @@ export declare namespace ThreadPrimitiveScrollToBottom {
|
|
4
4
|
type Element = ActionButtonElement;
|
5
5
|
type Props = ActionButtonProps<typeof useThreadScrollToBottom>;
|
6
6
|
}
|
7
|
-
export declare const ThreadPrimitiveScrollToBottom: import("react").ForwardRefExoticComponent<Omit<
|
8
|
-
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
9
|
-
} & {
|
7
|
+
export declare const ThreadPrimitiveScrollToBottom: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
10
8
|
asChild?: boolean;
|
11
9
|
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
12
10
|
//# sourceMappingURL=ThreadScrollToBottom.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadScrollToBottom.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,sDAAsD,CAAC;AAE/F,yBAAiB,6BAA6B,CAAC;IAC7C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,uBAAuB,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,6BAA6B
|
1
|
+
{"version":3,"file":"ThreadScrollToBottom.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,sDAAsD,CAAC;AAE/F,yBAAiB,6BAA6B,CAAC;IAC7C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,uBAAuB,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,6BAA6B;;6DAGzC,CAAC"}
|
@@ -4,9 +4,7 @@ export declare namespace ThreadPrimitiveSuggestion {
|
|
4
4
|
type Element = ActionButtonElement;
|
5
5
|
type Props = ActionButtonProps<typeof useThreadSuggestion>;
|
6
6
|
}
|
7
|
-
export declare const ThreadPrimitiveSuggestion: import("react").ForwardRefExoticComponent<Omit<
|
8
|
-
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
9
|
-
} & {
|
7
|
+
export declare const ThreadPrimitiveSuggestion: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
10
8
|
asChild?: boolean;
|
11
9
|
}, "ref"> & import("../../primitive-hooks/thread/useThreadSuggestion").UseApplyThreadSuggestionProps & import("react").RefAttributes<HTMLButtonElement>>;
|
12
10
|
//# sourceMappingURL=ThreadSuggestion.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadSuggestion.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadSuggestion.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AAEvF,yBAAiB,yBAAyB,CAAC;IACzC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACnE;AAED,eAAO,MAAM,yBAAyB
|
1
|
+
{"version":3,"file":"ThreadSuggestion.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadSuggestion.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AAEvF,yBAAiB,yBAAyB,CAAC;IACzC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACnE;AAED,eAAO,MAAM,yBAAyB;;wJAIrC,CAAC"}
|
@@ -5,9 +5,7 @@ export declare namespace ThreadPrimitiveViewport {
|
|
5
5
|
type Element = ElementRef<typeof Primitive.div>;
|
6
6
|
type Props = ComponentPropsWithoutRef<typeof Primitive.div> & UseThreadViewportAutoScrollProps;
|
7
7
|
}
|
8
|
-
export declare const ThreadPrimitiveViewport: import("react").ForwardRefExoticComponent<Omit<
|
9
|
-
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
10
|
-
} & {
|
8
|
+
export declare const ThreadPrimitiveViewport: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
11
9
|
asChild?: boolean;
|
12
10
|
}, "ref"> & UseThreadViewportAutoScrollProps & import("react").RefAttributes<HTMLDivElement>>;
|
13
11
|
//# sourceMappingURL=ThreadViewport.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadViewport.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,UAAU,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,EACL,gCAAgC,EAEjC,MAAM,0DAA0D,CAAC;AAElE,yBAAiB,uBAAuB,CAAC;IACvC,KAAY,OAAO,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACvD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,GAChE,gCAAgC,CAAC;CACpC;AAED,eAAO,MAAM,uBAAuB
|
1
|
+
{"version":3,"file":"ThreadViewport.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,UAAU,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,EACL,gCAAgC,EAEjC,MAAM,0DAA0D,CAAC;AAElE,yBAAiB,uBAAuB,CAAC;IACvC,KAAY,OAAO,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACvD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,GAChE,gCAAgC,CAAC;CACpC;AAED,eAAO,MAAM,uBAAuB;;6FAelC,CAAC"}
|
@@ -4,9 +4,7 @@ export declare namespace ThreadListPrimitiveNew {
|
|
4
4
|
type Element = ActionButtonElement;
|
5
5
|
type Props = ActionButtonProps<typeof useThreadListNew>;
|
6
6
|
}
|
7
|
-
export declare const ThreadListPrimitiveNew: import("react").ForwardRefExoticComponent<Omit<
|
8
|
-
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
9
|
-
} & {
|
7
|
+
export declare const ThreadListPrimitiveNew: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
10
8
|
asChild?: boolean;
|
11
9
|
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
12
10
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadListNew.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadList/ThreadListNew.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,gCAAgC,CAAC;AAMxC,QAAA,MAAM,gBAAgB,kBAKrB,CAAC;AAEF,yBAAiB,sBAAsB,CAAC;IACtC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,gBAAgB,CAAC,CAAC;CAChE;AAED,eAAO,MAAM,sBAAsB
|
1
|
+
{"version":3,"file":"ThreadListNew.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadList/ThreadListNew.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,gCAAgC,CAAC;AAMxC,QAAA,MAAM,gBAAgB,kBAKrB,CAAC;AAEF,yBAAiB,sBAAsB,CAAC;IACtC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,gBAAgB,CAAC,CAAC;CAChE;AAED,eAAO,MAAM,sBAAsB;;6DAmBjC,CAAC"}
|
@@ -4,9 +4,7 @@ export declare namespace ThreadListItemPrimitiveArchive {
|
|
4
4
|
type Element = ActionButtonElement;
|
5
5
|
type Props = ActionButtonProps<typeof useThreadListItemArchive>;
|
6
6
|
}
|
7
|
-
export declare const ThreadListItemPrimitiveArchive: import("react").ForwardRefExoticComponent<Omit<
|
8
|
-
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
9
|
-
} & {
|
7
|
+
export declare const ThreadListItemPrimitiveArchive: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
10
8
|
asChild?: boolean;
|
11
9
|
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
12
10
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadListItemArchive.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadListItem/ThreadListItemArchive.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAIxC,QAAA,MAAM,wBAAwB,kBAK7B,CAAC;AAEF,yBAAiB,8BAA8B,CAAC;IAC9C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,wBAAwB,CAAC,CAAC;CACxE;AAED,eAAO,MAAM,8BAA8B
|
1
|
+
{"version":3,"file":"ThreadListItemArchive.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadListItem/ThreadListItemArchive.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAIxC,QAAA,MAAM,wBAAwB,kBAK7B,CAAC;AAEF,yBAAiB,8BAA8B,CAAC;IAC9C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,wBAAwB,CAAC,CAAC;CACxE;AAED,eAAO,MAAM,8BAA8B;;6DAG1C,CAAC"}
|
@@ -4,9 +4,7 @@ export declare namespace ThreadListItemPrimitiveDelete {
|
|
4
4
|
type Element = ActionButtonElement;
|
5
5
|
type Props = ActionButtonProps<typeof useThreadListItemDelete>;
|
6
6
|
}
|
7
|
-
export declare const ThreadListItemPrimitiveDelete: import("react").ForwardRefExoticComponent<Omit<
|
8
|
-
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
9
|
-
} & {
|
7
|
+
export declare const ThreadListItemPrimitiveDelete: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
10
8
|
asChild?: boolean;
|
11
9
|
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
12
10
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadListItemDelete.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadListItem/ThreadListItemDelete.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAGxC,QAAA,MAAM,uBAAuB,kBAK5B,CAAC;AAEF,yBAAiB,6BAA6B,CAAC;IAC7C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,uBAAuB,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,6BAA6B
|
1
|
+
{"version":3,"file":"ThreadListItemDelete.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadListItem/ThreadListItemDelete.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAGxC,QAAA,MAAM,uBAAuB,kBAK5B,CAAC;AAEF,yBAAiB,6BAA6B,CAAC;IAC7C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,uBAAuB,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,6BAA6B;;6DAGzC,CAAC"}
|
@@ -5,9 +5,7 @@ export declare namespace ThreadListItemPrimitiveRoot {
|
|
5
5
|
type Element = ElementRef<typeof Primitive.div>;
|
6
6
|
type Props = PrimitiveDivProps;
|
7
7
|
}
|
8
|
-
export declare const ThreadListItemPrimitiveRoot: import("react").ForwardRefExoticComponent<Omit<
|
9
|
-
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
10
|
-
} & {
|
8
|
+
export declare const ThreadListItemPrimitiveRoot: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
11
9
|
asChild?: boolean;
|
12
10
|
}, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
13
11
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadListItemRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadListItem/ThreadListItemRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,UAAU,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAG9E,KAAK,iBAAiB,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;AAExE,yBAAiB,2BAA2B,CAAC;IAC3C,KAAY,OAAO,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACvD,KAAY,KAAK,GAAG,iBAAiB,CAAC;CACvC;AAED,eAAO,MAAM,2BAA2B
|
1
|
+
{"version":3,"file":"ThreadListItemRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadListItem/ThreadListItemRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,UAAU,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAG9E,KAAK,iBAAiB,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;AAExE,yBAAiB,2BAA2B,CAAC;IAC3C,KAAY,OAAO,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACvD,KAAY,KAAK,GAAG,iBAAiB,CAAC;CACvC;AAED,eAAO,MAAM,2BAA2B;;0DAatC,CAAC"}
|
@@ -4,9 +4,7 @@ export declare namespace ThreadListItemPrimitiveTrigger {
|
|
4
4
|
type Element = ActionButtonElement;
|
5
5
|
type Props = ActionButtonProps<typeof useThreadListItemTrigger>;
|
6
6
|
}
|
7
|
-
export declare const ThreadListItemPrimitiveTrigger: import("react").ForwardRefExoticComponent<Omit<
|
8
|
-
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
9
|
-
} & {
|
7
|
+
export declare const ThreadListItemPrimitiveTrigger: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
10
8
|
asChild?: boolean;
|
11
9
|
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
12
10
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadListItemTrigger.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadListItem/ThreadListItemTrigger.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAGxC,QAAA,MAAM,wBAAwB,kBAK7B,CAAC;AAEF,yBAAiB,8BAA8B,CAAC;IAC9C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,wBAAwB,CAAC,CAAC;CACxE;AAED,eAAO,MAAM,8BAA8B
|
1
|
+
{"version":3,"file":"ThreadListItemTrigger.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadListItem/ThreadListItemTrigger.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAGxC,QAAA,MAAM,wBAAwB,kBAK7B,CAAC;AAEF,yBAAiB,8BAA8B,CAAC;IAC9C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,wBAAwB,CAAC,CAAC;CACxE;AAED,eAAO,MAAM,8BAA8B;;6DAG1C,CAAC"}
|
@@ -4,9 +4,7 @@ export declare namespace ThreadListItemPrimitiveUnarchive {
|
|
4
4
|
type Element = ActionButtonElement;
|
5
5
|
type Props = ActionButtonProps<typeof useThreadListItemUnarchive>;
|
6
6
|
}
|
7
|
-
export declare const ThreadListItemPrimitiveUnarchive: import("react").ForwardRefExoticComponent<Omit<
|
8
|
-
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
9
|
-
} & {
|
7
|
+
export declare const ThreadListItemPrimitiveUnarchive: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
10
8
|
asChild?: boolean;
|
11
9
|
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
12
10
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadListItemUnarchive.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadListItem/ThreadListItemUnarchive.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAGxC,QAAA,MAAM,0BAA0B,kBAK/B,CAAC;AAEF,yBAAiB,gCAAgC,CAAC;IAChD,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,0BAA0B,CAAC,CAAC;CAC1E;AAED,eAAO,MAAM,gCAAgC
|
1
|
+
{"version":3,"file":"ThreadListItemUnarchive.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadListItem/ThreadListItemUnarchive.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAGxC,QAAA,MAAM,0BAA0B,kBAK/B,CAAC;AAEF,yBAAiB,gCAAgC,CAAC;IAChD,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,0BAA0B,CAAC,CAAC;CAC1E;AAED,eAAO,MAAM,gCAAgC;;6DAG5C,CAAC"}
|
@@ -14,6 +14,7 @@ type BaseThreadAdapters = {
|
|
14
14
|
export declare abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore {
|
15
15
|
private readonly _configProvider;
|
16
16
|
private _subscriptions;
|
17
|
+
private _isInitialized;
|
17
18
|
protected readonly repository: MessageRepository;
|
18
19
|
abstract get adapters(): BaseThreadAdapters | undefined;
|
19
20
|
abstract get isDisabled(): boolean;
|
@@ -47,6 +48,7 @@ export declare abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore
|
|
47
48
|
speech: SpeechState | undefined;
|
48
49
|
speak(messageId: string): void;
|
49
50
|
stopSpeaking(): void;
|
51
|
+
protected ensureInitialized(): void;
|
50
52
|
export(): ExportedMessageRepository;
|
51
53
|
import(data: ExportedMessageRepository): void;
|
52
54
|
private _eventSubscribers;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"BaseThreadRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/core/BaseThreadRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACb,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAChG,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlD,KAAK,kBAAkB,GAAG;IACxB,MAAM,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IACvC,WAAW,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,8BAAsB,qBAAsB,YAAW,iBAAiB;
|
1
|
+
{"version":3,"file":"BaseThreadRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/core/BaseThreadRuntimeCore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C,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;aACvC,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI;aAClD,SAAS,IAAI,IAAI;IAEjC,IAAW,QAAQ,oCAElB;IAED,SAAgB,QAAQ,mCAA8C;gBAEzC,eAAe,EAAE,mBAAmB;IAE1D,cAAc;IAIrB,OAAO,CAAC,cAAc,CAAqD;IACpE,eAAe,CAAC,SAAS,EAAE,MAAM;IAGjC,SAAS,CAAC,SAAS,EAAE,MAAM;IAe3B,cAAc,CAAC,SAAS,EAAE,MAAM;;;;IAIhC,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE;IAIxC,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAK7C,SAAS,CAAC,kBAAkB;IAIrB,uBAAuB,CAAC,KAAK,EAAE,sBAAsB;IAOrD,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,WAAW;IAKnD,OAAO,CAAC,kBAAkB,CAAyC;IAE5D,oBAAoB,CAAC,SAAS,EAAE,MAAM;IAItC,cAAc,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,qBAAqB;IAWhE,OAAO,CAAC,aAAa,CAA0B;IACxC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAEhC,KAAK,CAAC,SAAS,EAAE,MAAM;IA8BvB,YAAY;IAMnB,SAAS,CAAC,iBAAiB;IAOpB,MAAM;IAIN,MAAM,CAAC,IAAI,EAAE,yBAAyB;IAO7C,OAAO,CAAC,iBAAiB,CAAsC;IAExD,WAAW,CAAC,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,IAAI;CAiBvE"}
|
@@ -32,6 +32,7 @@ var BaseThreadRuntimeCore = class {
|
|
32
32
|
this._configProvider = _configProvider;
|
33
33
|
}
|
34
34
|
_subscriptions = /* @__PURE__ */ new Set();
|
35
|
+
_isInitialized = false;
|
35
36
|
repository = new import_MessageRepository.MessageRepository();
|
36
37
|
get messages() {
|
37
38
|
return this.repository.getMessages();
|
@@ -122,10 +123,17 @@ var BaseThreadRuntimeCore = class {
|
|
122
123
|
this._stopSpeaking();
|
123
124
|
this._notifySubscribers();
|
124
125
|
}
|
126
|
+
ensureInitialized() {
|
127
|
+
if (!this._isInitialized) {
|
128
|
+
this._isInitialized = true;
|
129
|
+
this._notifyEventSubscribers("initialize");
|
130
|
+
}
|
131
|
+
}
|
125
132
|
export() {
|
126
133
|
return this.repository.export();
|
127
134
|
}
|
128
135
|
import(data) {
|
136
|
+
this.ensureInitialized();
|
129
137
|
this.repository.import(data);
|
130
138
|
this._notifySubscribers();
|
131
139
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/core/BaseThreadRuntimeCore.tsx"],"sourcesContent":["import type {\n ModelConfigProvider,\n AppendMessage,\n Unsubscribe,\n} from \"../../types\";\nimport {\n ExportedMessageRepository,\n MessageRepository,\n} from \"../utils/MessageRepository\";\nimport { DefaultThreadComposerRuntimeCore } from \"../composer/DefaultThreadComposerRuntimeCore\";\nimport {\n AddToolResultOptions,\n ThreadSuggestion,\n SubmitFeedbackOptions,\n ThreadRuntimeCore,\n SpeechState,\n RuntimeCapabilities,\n SubmittedFeedback,\n ThreadRuntimeEventType,\n} from \"../core/ThreadRuntimeCore\";\nimport { DefaultEditComposerRuntimeCore } from \"../composer/DefaultEditComposerRuntimeCore\";\nimport { SpeechSynthesisAdapter } from \"../speech/SpeechAdapterTypes\";\nimport { FeedbackAdapter } from \"../feedback/FeedbackAdapter\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport { getThreadMessageText } from \"../../utils/getThreadMessageText\";\n\ntype BaseThreadAdapters = {\n speech?: SpeechSynthesisAdapter | undefined;\n feedback?: FeedbackAdapter | undefined;\n attachments?: AttachmentAdapter | undefined;\n};\n\nexport abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore {\n private _subscriptions = new Set<() => void>();\n\n protected readonly repository = new MessageRepository();\n public abstract get adapters(): BaseThreadAdapters | undefined;\n public abstract get isDisabled(): boolean;\n public abstract get suggestions(): readonly ThreadSuggestion[];\n public abstract get extras(): unknown;\n\n public abstract get capabilities(): RuntimeCapabilities;\n public abstract append(message: AppendMessage): void;\n public abstract startRun(parentId: string | null): void;\n public abstract addToolResult(options: AddToolResultOptions): void;\n public abstract cancelRun(): void;\n\n public get messages() {\n return this.repository.getMessages();\n }\n\n public readonly composer = new DefaultThreadComposerRuntimeCore(this);\n\n constructor(private readonly _configProvider: ModelConfigProvider) {}\n\n public getModelConfig() {\n return this._configProvider.getModelConfig();\n }\n\n private _editComposers = new Map<string, DefaultEditComposerRuntimeCore>();\n public getEditComposer(messageId: string) {\n return this._editComposers.get(messageId);\n }\n public beginEdit(messageId: string) {\n if (this._editComposers.has(messageId))\n throw new Error(\"Edit already in progress\");\n\n this._editComposers.set(\n messageId,\n new DefaultEditComposerRuntimeCore(\n this,\n () => this._editComposers.delete(messageId),\n this.repository.getMessage(messageId),\n ),\n );\n this._notifySubscribers();\n }\n\n public getMessageById(messageId: string) {\n return this.repository.getMessage(messageId);\n }\n\n public getBranches(messageId: string): string[] {\n return this.repository.getBranches(messageId);\n }\n\n public switchToBranch(branchId: string): void {\n this.repository.switchToBranch(branchId);\n this._notifySubscribers();\n }\n\n protected _notifySubscribers() {\n for (const callback of this._subscriptions) callback();\n }\n\n public _notifyEventSubscribers(event: ThreadRuntimeEventType) {\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) return;\n\n for (const callback of subscribers) callback();\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n this._subscriptions.add(callback);\n return () => this._subscriptions.delete(callback);\n }\n\n private _submittedFeedback: Record<string, SubmittedFeedback> = {};\n\n public getSubmittedFeedback(messageId: string) {\n return this._submittedFeedback[messageId];\n }\n\n public submitFeedback({ messageId, type }: SubmitFeedbackOptions) {\n const adapter = this.adapters?.feedback;\n if (!adapter) throw new Error(\"Feedback adapter not configured\");\n\n const { message } = this.repository.getMessage(messageId);\n adapter.submit({ message, type });\n\n this._submittedFeedback[messageId] = { type };\n this._notifySubscribers();\n }\n\n private _stopSpeaking: Unsubscribe | undefined;\n public speech: SpeechState | undefined;\n\n public speak(messageId: string) {\n const adapter = this.adapters?.speech;\n if (!adapter) throw new Error(\"Speech adapter not configured\");\n\n const { message } = this.repository.getMessage(messageId);\n\n this._stopSpeaking?.();\n\n const utterance = adapter.speak(getThreadMessageText(message));\n const unsub = utterance.subscribe(() => {\n if (utterance.status.type === \"ended\") {\n this._stopSpeaking = undefined;\n this.speech = undefined;\n } else {\n this.speech = { messageId, status: utterance.status };\n }\n this._notifySubscribers();\n });\n\n this.speech = { messageId, status: utterance.status };\n this._notifySubscribers();\n\n this._stopSpeaking = () => {\n utterance.cancel();\n unsub();\n this.speech = undefined;\n this._stopSpeaking = undefined;\n };\n }\n\n public stopSpeaking() {\n if (!this._stopSpeaking) throw new Error(\"No message is being spoken\");\n this._stopSpeaking();\n this._notifySubscribers();\n }\n\n public export() {\n return this.repository.export();\n }\n\n public import(data: ExportedMessageRepository) {\n this.repository.import(data);\n this._notifySubscribers();\n }\n\n private _eventSubscribers = new Map<string, Set<() => void>>();\n\n public unstable_on(event: ThreadRuntimeEventType, callback: () => void) {\n if (event === \"model-config-update\") {\n return this._configProvider.subscribe?.(callback) ?? (() => {});\n }\n\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) {\n this._eventSubscribers.set(event, new Set([callback]));\n } else {\n subscribers.add(callback);\n }\n\n return () => {\n const subscribers = this._eventSubscribers.get(event)!;\n subscribers.delete(callback);\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,+BAGO;AACP,8CAAiD;AAWjD,4CAA+C;AAI/C,kCAAqC;AAQ9B,IAAe,wBAAf,MAAkE;AAAA,
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/core/BaseThreadRuntimeCore.tsx"],"sourcesContent":["import type {\n ModelConfigProvider,\n AppendMessage,\n Unsubscribe,\n} from \"../../types\";\nimport {\n ExportedMessageRepository,\n MessageRepository,\n} from \"../utils/MessageRepository\";\nimport { DefaultThreadComposerRuntimeCore } from \"../composer/DefaultThreadComposerRuntimeCore\";\nimport {\n AddToolResultOptions,\n ThreadSuggestion,\n SubmitFeedbackOptions,\n ThreadRuntimeCore,\n SpeechState,\n RuntimeCapabilities,\n SubmittedFeedback,\n ThreadRuntimeEventType,\n} from \"../core/ThreadRuntimeCore\";\nimport { DefaultEditComposerRuntimeCore } from \"../composer/DefaultEditComposerRuntimeCore\";\nimport { SpeechSynthesisAdapter } from \"../speech/SpeechAdapterTypes\";\nimport { FeedbackAdapter } from \"../feedback/FeedbackAdapter\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport { getThreadMessageText } from \"../../utils/getThreadMessageText\";\n\ntype BaseThreadAdapters = {\n speech?: SpeechSynthesisAdapter | undefined;\n feedback?: FeedbackAdapter | undefined;\n attachments?: AttachmentAdapter | undefined;\n};\n\nexport abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore {\n private _subscriptions = new Set<() => void>();\n private _isInitialized = false;\n\n protected readonly repository = new MessageRepository();\n public abstract get adapters(): BaseThreadAdapters | undefined;\n public abstract get isDisabled(): boolean;\n public abstract get suggestions(): readonly ThreadSuggestion[];\n public abstract get extras(): unknown;\n\n public abstract get capabilities(): RuntimeCapabilities;\n public abstract append(message: AppendMessage): void;\n public abstract startRun(parentId: string | null): void;\n public abstract addToolResult(options: AddToolResultOptions): void;\n public abstract cancelRun(): void;\n\n public get messages() {\n return this.repository.getMessages();\n }\n\n public readonly composer = new DefaultThreadComposerRuntimeCore(this);\n\n constructor(private readonly _configProvider: ModelConfigProvider) {}\n\n public getModelConfig() {\n return this._configProvider.getModelConfig();\n }\n\n private _editComposers = new Map<string, DefaultEditComposerRuntimeCore>();\n public getEditComposer(messageId: string) {\n return this._editComposers.get(messageId);\n }\n public beginEdit(messageId: string) {\n if (this._editComposers.has(messageId))\n throw new Error(\"Edit already in progress\");\n\n this._editComposers.set(\n messageId,\n new DefaultEditComposerRuntimeCore(\n this,\n () => this._editComposers.delete(messageId),\n this.repository.getMessage(messageId),\n ),\n );\n this._notifySubscribers();\n }\n\n public getMessageById(messageId: string) {\n return this.repository.getMessage(messageId);\n }\n\n public getBranches(messageId: string): string[] {\n return this.repository.getBranches(messageId);\n }\n\n public switchToBranch(branchId: string): void {\n this.repository.switchToBranch(branchId);\n this._notifySubscribers();\n }\n\n protected _notifySubscribers() {\n for (const callback of this._subscriptions) callback();\n }\n\n public _notifyEventSubscribers(event: ThreadRuntimeEventType) {\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) return;\n\n for (const callback of subscribers) callback();\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n this._subscriptions.add(callback);\n return () => this._subscriptions.delete(callback);\n }\n\n private _submittedFeedback: Record<string, SubmittedFeedback> = {};\n\n public getSubmittedFeedback(messageId: string) {\n return this._submittedFeedback[messageId];\n }\n\n public submitFeedback({ messageId, type }: SubmitFeedbackOptions) {\n const adapter = this.adapters?.feedback;\n if (!adapter) throw new Error(\"Feedback adapter not configured\");\n\n const { message } = this.repository.getMessage(messageId);\n adapter.submit({ message, type });\n\n this._submittedFeedback[messageId] = { type };\n this._notifySubscribers();\n }\n\n private _stopSpeaking: Unsubscribe | undefined;\n public speech: SpeechState | undefined;\n\n public speak(messageId: string) {\n const adapter = this.adapters?.speech;\n if (!adapter) throw new Error(\"Speech adapter not configured\");\n\n const { message } = this.repository.getMessage(messageId);\n\n this._stopSpeaking?.();\n\n const utterance = adapter.speak(getThreadMessageText(message));\n const unsub = utterance.subscribe(() => {\n if (utterance.status.type === \"ended\") {\n this._stopSpeaking = undefined;\n this.speech = undefined;\n } else {\n this.speech = { messageId, status: utterance.status };\n }\n this._notifySubscribers();\n });\n\n this.speech = { messageId, status: utterance.status };\n this._notifySubscribers();\n\n this._stopSpeaking = () => {\n utterance.cancel();\n unsub();\n this.speech = undefined;\n this._stopSpeaking = undefined;\n };\n }\n\n public stopSpeaking() {\n if (!this._stopSpeaking) throw new Error(\"No message is being spoken\");\n this._stopSpeaking();\n this._notifySubscribers();\n }\n\n protected ensureInitialized() {\n if (!this._isInitialized) {\n this._isInitialized = true;\n this._notifyEventSubscribers(\"initialize\");\n }\n }\n\n public export() {\n return this.repository.export();\n }\n\n public import(data: ExportedMessageRepository) {\n this.ensureInitialized();\n\n this.repository.import(data);\n this._notifySubscribers();\n }\n\n private _eventSubscribers = new Map<string, Set<() => void>>();\n\n public unstable_on(event: ThreadRuntimeEventType, callback: () => void) {\n if (event === \"model-config-update\") {\n return this._configProvider.subscribe?.(callback) ?? (() => {});\n }\n\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) {\n this._eventSubscribers.set(event, new Set([callback]));\n } else {\n subscribers.add(callback);\n }\n\n return () => {\n const subscribers = this._eventSubscribers.get(event)!;\n subscribers.delete(callback);\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,+BAGO;AACP,8CAAiD;AAWjD,4CAA+C;AAI/C,kCAAqC;AAQ9B,IAAe,wBAAf,MAAkE;AAAA,EAsBvE,YAA6B,iBAAsC;AAAtC;AAAA,EAAuC;AAAA,EArB5D,iBAAiB,oBAAI,IAAgB;AAAA,EACrC,iBAAiB;AAAA,EAEN,aAAa,IAAI,2CAAkB;AAAA,EAYtD,IAAW,WAAW;AACpB,WAAO,KAAK,WAAW,YAAY;AAAA,EACrC;AAAA,EAEgB,WAAW,IAAI,yEAAiC,IAAI;AAAA,EAI7D,iBAAiB;AACtB,WAAO,KAAK,gBAAgB,eAAe;AAAA,EAC7C;AAAA,EAEQ,iBAAiB,oBAAI,IAA4C;AAAA,EAClE,gBAAgB,WAAmB;AACxC,WAAO,KAAK,eAAe,IAAI,SAAS;AAAA,EAC1C;AAAA,EACO,UAAU,WAAmB;AAClC,QAAI,KAAK,eAAe,IAAI,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;AAAA,IAC/D;AAEA,UAAM,cAAc,KAAK,kBAAkB,IAAI,KAAK;AACpD,QAAI,CAAC,aAAa;AAChB,WAAK,kBAAkB,IAAI,OAAO,oBAAI,IAAI,CAAC,QAAQ,CAAC,CAAC;AAAA,IACvD,OAAO;AACL,kBAAY,IAAI,QAAQ;AAAA,IAC1B;AAEA,WAAO,MAAM;AACX,YAAMA,eAAc,KAAK,kBAAkB,IAAI,KAAK;AACpD,MAAAA,aAAY,OAAO,QAAQ;AAAA,IAC7B;AAAA,EACF;AACF;","names":["subscribers"]}
|
@@ -10,6 +10,7 @@ var BaseThreadRuntimeCore = class {
|
|
10
10
|
this._configProvider = _configProvider;
|
11
11
|
}
|
12
12
|
_subscriptions = /* @__PURE__ */ new Set();
|
13
|
+
_isInitialized = false;
|
13
14
|
repository = new MessageRepository();
|
14
15
|
get messages() {
|
15
16
|
return this.repository.getMessages();
|
@@ -100,10 +101,17 @@ var BaseThreadRuntimeCore = class {
|
|
100
101
|
this._stopSpeaking();
|
101
102
|
this._notifySubscribers();
|
102
103
|
}
|
104
|
+
ensureInitialized() {
|
105
|
+
if (!this._isInitialized) {
|
106
|
+
this._isInitialized = true;
|
107
|
+
this._notifyEventSubscribers("initialize");
|
108
|
+
}
|
109
|
+
}
|
103
110
|
export() {
|
104
111
|
return this.repository.export();
|
105
112
|
}
|
106
113
|
import(data) {
|
114
|
+
this.ensureInitialized();
|
107
115
|
this.repository.import(data);
|
108
116
|
this._notifySubscribers();
|
109
117
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/core/BaseThreadRuntimeCore.tsx"],"sourcesContent":["import type {\n ModelConfigProvider,\n AppendMessage,\n Unsubscribe,\n} from \"../../types\";\nimport {\n ExportedMessageRepository,\n MessageRepository,\n} from \"../utils/MessageRepository\";\nimport { DefaultThreadComposerRuntimeCore } from \"../composer/DefaultThreadComposerRuntimeCore\";\nimport {\n AddToolResultOptions,\n ThreadSuggestion,\n SubmitFeedbackOptions,\n ThreadRuntimeCore,\n SpeechState,\n RuntimeCapabilities,\n SubmittedFeedback,\n ThreadRuntimeEventType,\n} from \"../core/ThreadRuntimeCore\";\nimport { DefaultEditComposerRuntimeCore } from \"../composer/DefaultEditComposerRuntimeCore\";\nimport { SpeechSynthesisAdapter } from \"../speech/SpeechAdapterTypes\";\nimport { FeedbackAdapter } from \"../feedback/FeedbackAdapter\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport { getThreadMessageText } from \"../../utils/getThreadMessageText\";\n\ntype BaseThreadAdapters = {\n speech?: SpeechSynthesisAdapter | undefined;\n feedback?: FeedbackAdapter | undefined;\n attachments?: AttachmentAdapter | undefined;\n};\n\nexport abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore {\n private _subscriptions = new Set<() => void>();\n\n protected readonly repository = new MessageRepository();\n public abstract get adapters(): BaseThreadAdapters | undefined;\n public abstract get isDisabled(): boolean;\n public abstract get suggestions(): readonly ThreadSuggestion[];\n public abstract get extras(): unknown;\n\n public abstract get capabilities(): RuntimeCapabilities;\n public abstract append(message: AppendMessage): void;\n public abstract startRun(parentId: string | null): void;\n public abstract addToolResult(options: AddToolResultOptions): void;\n public abstract cancelRun(): void;\n\n public get messages() {\n return this.repository.getMessages();\n }\n\n public readonly composer = new DefaultThreadComposerRuntimeCore(this);\n\n constructor(private readonly _configProvider: ModelConfigProvider) {}\n\n public getModelConfig() {\n return this._configProvider.getModelConfig();\n }\n\n private _editComposers = new Map<string, DefaultEditComposerRuntimeCore>();\n public getEditComposer(messageId: string) {\n return this._editComposers.get(messageId);\n }\n public beginEdit(messageId: string) {\n if (this._editComposers.has(messageId))\n throw new Error(\"Edit already in progress\");\n\n this._editComposers.set(\n messageId,\n new DefaultEditComposerRuntimeCore(\n this,\n () => this._editComposers.delete(messageId),\n this.repository.getMessage(messageId),\n ),\n );\n this._notifySubscribers();\n }\n\n public getMessageById(messageId: string) {\n return this.repository.getMessage(messageId);\n }\n\n public getBranches(messageId: string): string[] {\n return this.repository.getBranches(messageId);\n }\n\n public switchToBranch(branchId: string): void {\n this.repository.switchToBranch(branchId);\n this._notifySubscribers();\n }\n\n protected _notifySubscribers() {\n for (const callback of this._subscriptions) callback();\n }\n\n public _notifyEventSubscribers(event: ThreadRuntimeEventType) {\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) return;\n\n for (const callback of subscribers) callback();\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n this._subscriptions.add(callback);\n return () => this._subscriptions.delete(callback);\n }\n\n private _submittedFeedback: Record<string, SubmittedFeedback> = {};\n\n public getSubmittedFeedback(messageId: string) {\n return this._submittedFeedback[messageId];\n }\n\n public submitFeedback({ messageId, type }: SubmitFeedbackOptions) {\n const adapter = this.adapters?.feedback;\n if (!adapter) throw new Error(\"Feedback adapter not configured\");\n\n const { message } = this.repository.getMessage(messageId);\n adapter.submit({ message, type });\n\n this._submittedFeedback[messageId] = { type };\n this._notifySubscribers();\n }\n\n private _stopSpeaking: Unsubscribe | undefined;\n public speech: SpeechState | undefined;\n\n public speak(messageId: string) {\n const adapter = this.adapters?.speech;\n if (!adapter) throw new Error(\"Speech adapter not configured\");\n\n const { message } = this.repository.getMessage(messageId);\n\n this._stopSpeaking?.();\n\n const utterance = adapter.speak(getThreadMessageText(message));\n const unsub = utterance.subscribe(() => {\n if (utterance.status.type === \"ended\") {\n this._stopSpeaking = undefined;\n this.speech = undefined;\n } else {\n this.speech = { messageId, status: utterance.status };\n }\n this._notifySubscribers();\n });\n\n this.speech = { messageId, status: utterance.status };\n this._notifySubscribers();\n\n this._stopSpeaking = () => {\n utterance.cancel();\n unsub();\n this.speech = undefined;\n this._stopSpeaking = undefined;\n };\n }\n\n public stopSpeaking() {\n if (!this._stopSpeaking) throw new Error(\"No message is being spoken\");\n this._stopSpeaking();\n this._notifySubscribers();\n }\n\n public export() {\n return this.repository.export();\n }\n\n public import(data: ExportedMessageRepository) {\n this.repository.import(data);\n this._notifySubscribers();\n }\n\n private _eventSubscribers = new Map<string, Set<() => void>>();\n\n public unstable_on(event: ThreadRuntimeEventType, callback: () => void) {\n if (event === \"model-config-update\") {\n return this._configProvider.subscribe?.(callback) ?? (() => {});\n }\n\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) {\n this._eventSubscribers.set(event, new Set([callback]));\n } else {\n subscribers.add(callback);\n }\n\n return () => {\n const subscribers = this._eventSubscribers.get(event)!;\n subscribers.delete(callback);\n };\n }\n}\n"],"mappings":";AAKA;AAAA,EAEE;AAAA,OACK;AACP,SAAS,wCAAwC;AAWjD,SAAS,sCAAsC;AAI/C,SAAS,4BAA4B;AAQ9B,IAAe,wBAAf,MAAkE;AAAA,
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/core/BaseThreadRuntimeCore.tsx"],"sourcesContent":["import type {\n ModelConfigProvider,\n AppendMessage,\n Unsubscribe,\n} from \"../../types\";\nimport {\n ExportedMessageRepository,\n MessageRepository,\n} from \"../utils/MessageRepository\";\nimport { DefaultThreadComposerRuntimeCore } from \"../composer/DefaultThreadComposerRuntimeCore\";\nimport {\n AddToolResultOptions,\n ThreadSuggestion,\n SubmitFeedbackOptions,\n ThreadRuntimeCore,\n SpeechState,\n RuntimeCapabilities,\n SubmittedFeedback,\n ThreadRuntimeEventType,\n} from \"../core/ThreadRuntimeCore\";\nimport { DefaultEditComposerRuntimeCore } from \"../composer/DefaultEditComposerRuntimeCore\";\nimport { SpeechSynthesisAdapter } from \"../speech/SpeechAdapterTypes\";\nimport { FeedbackAdapter } from \"../feedback/FeedbackAdapter\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport { getThreadMessageText } from \"../../utils/getThreadMessageText\";\n\ntype BaseThreadAdapters = {\n speech?: SpeechSynthesisAdapter | undefined;\n feedback?: FeedbackAdapter | undefined;\n attachments?: AttachmentAdapter | undefined;\n};\n\nexport abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore {\n private _subscriptions = new Set<() => void>();\n private _isInitialized = false;\n\n protected readonly repository = new MessageRepository();\n public abstract get adapters(): BaseThreadAdapters | undefined;\n public abstract get isDisabled(): boolean;\n public abstract get suggestions(): readonly ThreadSuggestion[];\n public abstract get extras(): unknown;\n\n public abstract get capabilities(): RuntimeCapabilities;\n public abstract append(message: AppendMessage): void;\n public abstract startRun(parentId: string | null): void;\n public abstract addToolResult(options: AddToolResultOptions): void;\n public abstract cancelRun(): void;\n\n public get messages() {\n return this.repository.getMessages();\n }\n\n public readonly composer = new DefaultThreadComposerRuntimeCore(this);\n\n constructor(private readonly _configProvider: ModelConfigProvider) {}\n\n public getModelConfig() {\n return this._configProvider.getModelConfig();\n }\n\n private _editComposers = new Map<string, DefaultEditComposerRuntimeCore>();\n public getEditComposer(messageId: string) {\n return this._editComposers.get(messageId);\n }\n public beginEdit(messageId: string) {\n if (this._editComposers.has(messageId))\n throw new Error(\"Edit already in progress\");\n\n this._editComposers.set(\n messageId,\n new DefaultEditComposerRuntimeCore(\n this,\n () => this._editComposers.delete(messageId),\n this.repository.getMessage(messageId),\n ),\n );\n this._notifySubscribers();\n }\n\n public getMessageById(messageId: string) {\n return this.repository.getMessage(messageId);\n }\n\n public getBranches(messageId: string): string[] {\n return this.repository.getBranches(messageId);\n }\n\n public switchToBranch(branchId: string): void {\n this.repository.switchToBranch(branchId);\n this._notifySubscribers();\n }\n\n protected _notifySubscribers() {\n for (const callback of this._subscriptions) callback();\n }\n\n public _notifyEventSubscribers(event: ThreadRuntimeEventType) {\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) return;\n\n for (const callback of subscribers) callback();\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n this._subscriptions.add(callback);\n return () => this._subscriptions.delete(callback);\n }\n\n private _submittedFeedback: Record<string, SubmittedFeedback> = {};\n\n public getSubmittedFeedback(messageId: string) {\n return this._submittedFeedback[messageId];\n }\n\n public submitFeedback({ messageId, type }: SubmitFeedbackOptions) {\n const adapter = this.adapters?.feedback;\n if (!adapter) throw new Error(\"Feedback adapter not configured\");\n\n const { message } = this.repository.getMessage(messageId);\n adapter.submit({ message, type });\n\n this._submittedFeedback[messageId] = { type };\n this._notifySubscribers();\n }\n\n private _stopSpeaking: Unsubscribe | undefined;\n public speech: SpeechState | undefined;\n\n public speak(messageId: string) {\n const adapter = this.adapters?.speech;\n if (!adapter) throw new Error(\"Speech adapter not configured\");\n\n const { message } = this.repository.getMessage(messageId);\n\n this._stopSpeaking?.();\n\n const utterance = adapter.speak(getThreadMessageText(message));\n const unsub = utterance.subscribe(() => {\n if (utterance.status.type === \"ended\") {\n this._stopSpeaking = undefined;\n this.speech = undefined;\n } else {\n this.speech = { messageId, status: utterance.status };\n }\n this._notifySubscribers();\n });\n\n this.speech = { messageId, status: utterance.status };\n this._notifySubscribers();\n\n this._stopSpeaking = () => {\n utterance.cancel();\n unsub();\n this.speech = undefined;\n this._stopSpeaking = undefined;\n };\n }\n\n public stopSpeaking() {\n if (!this._stopSpeaking) throw new Error(\"No message is being spoken\");\n this._stopSpeaking();\n this._notifySubscribers();\n }\n\n protected ensureInitialized() {\n if (!this._isInitialized) {\n this._isInitialized = true;\n this._notifyEventSubscribers(\"initialize\");\n }\n }\n\n public export() {\n return this.repository.export();\n }\n\n public import(data: ExportedMessageRepository) {\n this.ensureInitialized();\n\n this.repository.import(data);\n this._notifySubscribers();\n }\n\n private _eventSubscribers = new Map<string, Set<() => void>>();\n\n public unstable_on(event: ThreadRuntimeEventType, callback: () => void) {\n if (event === \"model-config-update\") {\n return this._configProvider.subscribe?.(callback) ?? (() => {});\n }\n\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) {\n this._eventSubscribers.set(event, new Set([callback]));\n } else {\n subscribers.add(callback);\n }\n\n return () => {\n const subscribers = this._eventSubscribers.get(event)!;\n subscribers.delete(callback);\n };\n }\n}\n"],"mappings":";AAKA;AAAA,EAEE;AAAA,OACK;AACP,SAAS,wCAAwC;AAWjD,SAAS,sCAAsC;AAI/C,SAAS,4BAA4B;AAQ9B,IAAe,wBAAf,MAAkE;AAAA,EAsBvE,YAA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EAC1B;AAAA,EAEU,oBAAoB;AAC5B,QAAI,CAAC,KAAK,gBAAgB;AACxB,WAAK,iBAAiB;AACtB,WAAK,wBAAwB,YAAY;AAAA,IAC3C;AAAA,EACF;AAAA,EAEO,SAAS;AACd,WAAO,KAAK,WAAW,OAAO;AAAA,EAChC;AAAA,EAEO,OAAO,MAAiC;AAC7C,SAAK,kBAAkB;AAEvB,SAAK,WAAW,OAAO,IAAI;AAC3B,SAAK,mBAAmB;AAAA,EAC1B;AAAA,EAEQ,oBAAoB,oBAAI,IAA6B;AAAA,EAEtD,YAAY,OAA+B,UAAsB;AACtE,QAAI,UAAU,uBAAuB;AACnC,aAAO,KAAK,gBAAgB,YAAY,QAAQ,MAAM,MAAM;AAAA,MAAC;AAAA,IAC/D;AAEA,UAAM,cAAc,KAAK,kBAAkB,IAAI,KAAK;AACpD,QAAI,CAAC,aAAa;AAChB,WAAK,kBAAkB,IAAI,OAAO,oBAAI,IAAI,CAAC,QAAQ,CAAC,CAAC;AAAA,IACvD,OAAO;AACL,kBAAY,IAAI,QAAQ;AAAA,IAC1B;AAEA,WAAO,MAAM;AACX,YAAMA,eAAc,KAAK,kBAAkB,IAAI,KAAK;AACpD,MAAAA,aAAY,OAAO,QAAQ;AAAA,IAC7B;AAAA,EACF;AACF;","names":["subscribers"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"assistantDecoderStream.d.ts","sourceRoot":"","sources":["../../../../src/runtimes/edge/streams/assistantDecoderStream.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAErB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,wBAAgB,sBAAsB,
|
1
|
+
{"version":3,"file":"assistantDecoderStream.d.ts","sourceRoot":"","sources":["../../../../src/runtimes/edge/streams/assistantDecoderStream.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAErB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,wBAAgB,sBAAsB,4EA4IrC"}
|
@@ -27,17 +27,21 @@ var import_AssistantStreamChunkType = require("./AssistantStreamChunkType.js");
|
|
27
27
|
function assistantDecoderStream() {
|
28
28
|
const toolCallNames = /* @__PURE__ */ new Map();
|
29
29
|
let currentToolCall;
|
30
|
+
const endCurrentToolCall = (controller) => {
|
31
|
+
if (!currentToolCall) return;
|
32
|
+
controller.enqueue({
|
33
|
+
type: "tool-call",
|
34
|
+
toolCallType: "function",
|
35
|
+
toolCallId: currentToolCall.id,
|
36
|
+
toolName: currentToolCall.name,
|
37
|
+
args: currentToolCall.argsText
|
38
|
+
});
|
39
|
+
currentToolCall = void 0;
|
40
|
+
};
|
30
41
|
return new TransformStream({
|
31
42
|
transform({ type, value }, controller) {
|
32
|
-
if (
|
33
|
-
controller
|
34
|
-
type: "tool-call",
|
35
|
-
toolCallType: "function",
|
36
|
-
toolCallId: currentToolCall.id,
|
37
|
-
toolName: currentToolCall.name,
|
38
|
-
args: currentToolCall.argsText
|
39
|
-
});
|
40
|
-
currentToolCall = void 0;
|
43
|
+
if (type !== import_AssistantStreamChunkType.AssistantStreamChunkType.ToolCallDelta && type !== import_AssistantStreamChunkType.AssistantStreamChunkType.Error) {
|
44
|
+
endCurrentToolCall(controller);
|
41
45
|
}
|
42
46
|
switch (type) {
|
43
47
|
case import_AssistantStreamChunkType.AssistantStreamChunkType.TextDelta: {
|
@@ -134,6 +138,9 @@ function assistantDecoderStream() {
|
|
134
138
|
throw new Error(`Unhandled chunk type: ${unhandledType}`);
|
135
139
|
}
|
136
140
|
}
|
141
|
+
},
|
142
|
+
flush(controller) {
|
143
|
+
endCurrentToolCall(controller);
|
137
144
|
}
|
138
145
|
});
|
139
146
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtimes/edge/streams/assistantDecoderStream.ts"],"sourcesContent":["import {\n AssistantStreamChunk,\n AssistantStreamChunkType,\n} from \"./AssistantStreamChunkType\";\nimport { StreamPart } from \"./utils/StreamPart\";\nimport { ToolResultStreamPart } from \"./toolResultStream\";\n\nexport function assistantDecoderStream() {\n const toolCallNames = new Map<string, string>();\n let currentToolCall:\n | { id: string; name: string; argsText: string }\n | undefined;\n\n
|
1
|
+
{"version":3,"sources":["../../../../src/runtimes/edge/streams/assistantDecoderStream.ts"],"sourcesContent":["import {\n AssistantStreamChunk,\n AssistantStreamChunkType,\n} from \"./AssistantStreamChunkType\";\nimport { StreamPart } from \"./utils/StreamPart\";\nimport { ToolResultStreamPart } from \"./toolResultStream\";\n\nexport function assistantDecoderStream() {\n const toolCallNames = new Map<string, string>();\n let currentToolCall:\n | { id: string; name: string; argsText: string }\n | undefined;\n\n const endCurrentToolCall = (\n controller: TransformStreamDefaultController<ToolResultStreamPart>,\n ) => {\n if (!currentToolCall) return;\n controller.enqueue({\n type: \"tool-call\",\n toolCallType: \"function\",\n toolCallId: currentToolCall.id,\n toolName: currentToolCall.name,\n args: currentToolCall.argsText,\n });\n currentToolCall = undefined;\n };\n\n return new TransformStream<\n StreamPart<AssistantStreamChunk>,\n ToolResultStreamPart\n >({\n transform({ type, value }, controller) {\n if (\n type !== AssistantStreamChunkType.ToolCallDelta &&\n type !== AssistantStreamChunkType.Error\n ) {\n endCurrentToolCall(controller);\n }\n\n switch (type) {\n case AssistantStreamChunkType.TextDelta: {\n controller.enqueue({\n type: \"text-delta\",\n textDelta: value,\n });\n break;\n }\n case AssistantStreamChunkType.ToolCallBegin: {\n const { toolCallId: id, toolName: name } = value;\n toolCallNames.set(id, name);\n\n currentToolCall = { id, name, argsText: \"\" };\n\n controller.enqueue({\n type: \"tool-call-delta\",\n toolCallType: \"function\",\n toolCallId: id,\n toolName: name,\n argsTextDelta: \"\",\n });\n break;\n }\n case AssistantStreamChunkType.ToolCallDelta: {\n const { toolCallId, argsTextDelta } = value;\n\n const toolName = toolCallNames.get(toolCallId)!;\n if (currentToolCall?.id === toolCallId) {\n currentToolCall.argsText += argsTextDelta;\n }\n controller.enqueue({\n type: \"tool-call-delta\",\n toolCallType: \"function\",\n toolCallId,\n toolName,\n argsTextDelta: argsTextDelta,\n });\n break;\n }\n case AssistantStreamChunkType.ToolCallResult: {\n controller.enqueue({\n type: \"tool-result\",\n toolCallType: \"function\",\n toolCallId: value.toolCallId,\n toolName: toolCallNames.get(value.toolCallId)!,\n result: value.result,\n });\n break;\n }\n case AssistantStreamChunkType.Finish: {\n controller.enqueue({\n type: \"finish\",\n ...value,\n });\n break;\n }\n case AssistantStreamChunkType.Error: {\n controller.enqueue({\n type: \"error\",\n error: value,\n });\n break;\n }\n\n case AssistantStreamChunkType.ToolCall: {\n const { toolCallId, toolName, args } = value;\n toolCallNames.set(toolCallId, toolName);\n\n const argsText = JSON.stringify(args);\n controller.enqueue({\n type: \"tool-call-delta\",\n toolCallType: \"function\",\n toolCallId,\n toolName,\n argsTextDelta: argsText,\n });\n controller.enqueue({\n type: \"tool-call\",\n toolCallType: \"function\",\n toolCallId: toolCallId,\n toolName: toolName,\n args: argsText,\n });\n break;\n }\n\n case AssistantStreamChunkType.StepFinish: {\n controller.enqueue({\n type: \"step-finish\",\n ...value,\n });\n break;\n }\n\n // TODO\n case AssistantStreamChunkType.Data:\n break;\n\n default: {\n const unhandledType: never = type;\n throw new Error(`Unhandled chunk type: ${unhandledType}`);\n }\n }\n },\n flush(controller) {\n endCurrentToolCall(controller);\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sCAGO;AAIA,SAAS,yBAAyB;AACvC,QAAM,gBAAgB,oBAAI,IAAoB;AAC9C,MAAI;AAIJ,QAAM,qBAAqB,CACzB,eACG;AACH,QAAI,CAAC,gBAAiB;AACtB,eAAW,QAAQ;AAAA,M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,UAChB,CAAC;AACD;AAAA,QACF;AAAA,QACA,KAAK,yDAAyB,QAAQ;AACpC,qBAAW,QAAQ;AAAA,YACjB,MAAM;AAAA,YACN,GAAG;AAAA,UACL,CAAC;AACD;AAAA,QACF;AAAA,QACA,KAAK,yDAAyB,OAAO;AACnC,qBAAW,QAAQ;AAAA,YACjB,MAAM;AAAA,YACN,OAAO;AAAA,UACT,CAAC;AACD;AAAA,QACF;AAAA,QAEA,KAAK,yDAAyB,UAAU;AACtC,gBAAM,EAAE,YAAY,UAAU,KAAK,IAAI;AACvC,wBAAc,IAAI,YAAY,QAAQ;AAEtC,gBAAM,WAAW,KAAK,UAAU,IAAI;AACpC,qBAAW,QAAQ;AAAA,YACjB,MAAM;AAAA,YACN,cAAc;AAAA,YACd;AAAA,YACA;AAAA,YACA,eAAe;AAAA,UACjB,CAAC;AACD,qBAAW,QAAQ;AAAA,YACjB,MAAM;AAAA,YACN,cAAc;AAAA,YACd;AAAA,YACA;AAAA,YACA,MAAM;AAAA,UACR,CAAC;AACD;AAAA,QACF;AAAA,QAEA,KAAK,yDAAyB,YAAY;AACxC,qBAAW,QAAQ;AAAA,YACjB,MAAM;AAAA,YACN,GAAG;AAAA,UACL,CAAC;AACD;AAAA,QACF;AAAA;AAAA,QAGA,KAAK,yDAAyB;AAC5B;AAAA,QAEF,SAAS;AACP,gBAAM,gBAAuB;AAC7B,gBAAM,IAAI,MAAM,yBAAyB,aAAa,EAAE;AAAA,QAC1D;AAAA,MACF;AAAA,IACF;AAAA,IACA,MAAM,YAAY;AAChB,yBAAmB,UAAU;AAAA,IAC/B;AAAA,EACF,CAAC;AACH;","names":[]}
|
@@ -5,17 +5,21 @@ import {
|
|
5
5
|
function assistantDecoderStream() {
|
6
6
|
const toolCallNames = /* @__PURE__ */ new Map();
|
7
7
|
let currentToolCall;
|
8
|
+
const endCurrentToolCall = (controller) => {
|
9
|
+
if (!currentToolCall) return;
|
10
|
+
controller.enqueue({
|
11
|
+
type: "tool-call",
|
12
|
+
toolCallType: "function",
|
13
|
+
toolCallId: currentToolCall.id,
|
14
|
+
toolName: currentToolCall.name,
|
15
|
+
args: currentToolCall.argsText
|
16
|
+
});
|
17
|
+
currentToolCall = void 0;
|
18
|
+
};
|
8
19
|
return new TransformStream({
|
9
20
|
transform({ type, value }, controller) {
|
10
|
-
if (
|
11
|
-
controller
|
12
|
-
type: "tool-call",
|
13
|
-
toolCallType: "function",
|
14
|
-
toolCallId: currentToolCall.id,
|
15
|
-
toolName: currentToolCall.name,
|
16
|
-
args: currentToolCall.argsText
|
17
|
-
});
|
18
|
-
currentToolCall = void 0;
|
21
|
+
if (type !== AssistantStreamChunkType.ToolCallDelta && type !== AssistantStreamChunkType.Error) {
|
22
|
+
endCurrentToolCall(controller);
|
19
23
|
}
|
20
24
|
switch (type) {
|
21
25
|
case AssistantStreamChunkType.TextDelta: {
|
@@ -112,6 +116,9 @@ function assistantDecoderStream() {
|
|
112
116
|
throw new Error(`Unhandled chunk type: ${unhandledType}`);
|
113
117
|
}
|
114
118
|
}
|
119
|
+
},
|
120
|
+
flush(controller) {
|
121
|
+
endCurrentToolCall(controller);
|
115
122
|
}
|
116
123
|
});
|
117
124
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtimes/edge/streams/assistantDecoderStream.ts"],"sourcesContent":["import {\n AssistantStreamChunk,\n AssistantStreamChunkType,\n} from \"./AssistantStreamChunkType\";\nimport { StreamPart } from \"./utils/StreamPart\";\nimport { ToolResultStreamPart } from \"./toolResultStream\";\n\nexport function assistantDecoderStream() {\n const toolCallNames = new Map<string, string>();\n let currentToolCall:\n | { id: string; name: string; argsText: string }\n | undefined;\n\n
|
1
|
+
{"version":3,"sources":["../../../../src/runtimes/edge/streams/assistantDecoderStream.ts"],"sourcesContent":["import {\n AssistantStreamChunk,\n AssistantStreamChunkType,\n} from \"./AssistantStreamChunkType\";\nimport { StreamPart } from \"./utils/StreamPart\";\nimport { ToolResultStreamPart } from \"./toolResultStream\";\n\nexport function assistantDecoderStream() {\n const toolCallNames = new Map<string, string>();\n let currentToolCall:\n | { id: string; name: string; argsText: string }\n | undefined;\n\n const endCurrentToolCall = (\n controller: TransformStreamDefaultController<ToolResultStreamPart>,\n ) => {\n if (!currentToolCall) return;\n controller.enqueue({\n type: \"tool-call\",\n toolCallType: \"function\",\n toolCallId: currentToolCall.id,\n toolName: currentToolCall.name,\n args: currentToolCall.argsText,\n });\n currentToolCall = undefined;\n };\n\n return new TransformStream<\n StreamPart<AssistantStreamChunk>,\n ToolResultStreamPart\n >({\n transform({ type, value }, controller) {\n if (\n type !== AssistantStreamChunkType.ToolCallDelta &&\n type !== AssistantStreamChunkType.Error\n ) {\n endCurrentToolCall(controller);\n }\n\n switch (type) {\n case AssistantStreamChunkType.TextDelta: {\n controller.enqueue({\n type: \"text-delta\",\n textDelta: value,\n });\n break;\n }\n case AssistantStreamChunkType.ToolCallBegin: {\n const { toolCallId: id, toolName: name } = value;\n toolCallNames.set(id, name);\n\n currentToolCall = { id, name, argsText: \"\" };\n\n controller.enqueue({\n type: \"tool-call-delta\",\n toolCallType: \"function\",\n toolCallId: id,\n toolName: name,\n argsTextDelta: \"\",\n });\n break;\n }\n case AssistantStreamChunkType.ToolCallDelta: {\n const { toolCallId, argsTextDelta } = value;\n\n const toolName = toolCallNames.get(toolCallId)!;\n if (currentToolCall?.id === toolCallId) {\n currentToolCall.argsText += argsTextDelta;\n }\n controller.enqueue({\n type: \"tool-call-delta\",\n toolCallType: \"function\",\n toolCallId,\n toolName,\n argsTextDelta: argsTextDelta,\n });\n break;\n }\n case AssistantStreamChunkType.ToolCallResult: {\n controller.enqueue({\n type: \"tool-result\",\n toolCallType: \"function\",\n toolCallId: value.toolCallId,\n toolName: toolCallNames.get(value.toolCallId)!,\n result: value.result,\n });\n break;\n }\n case AssistantStreamChunkType.Finish: {\n controller.enqueue({\n type: \"finish\",\n ...value,\n });\n break;\n }\n case AssistantStreamChunkType.Error: {\n controller.enqueue({\n type: \"error\",\n error: value,\n });\n break;\n }\n\n case AssistantStreamChunkType.ToolCall: {\n const { toolCallId, toolName, args } = value;\n toolCallNames.set(toolCallId, toolName);\n\n const argsText = JSON.stringify(args);\n controller.enqueue({\n type: \"tool-call-delta\",\n toolCallType: \"function\",\n toolCallId,\n toolName,\n argsTextDelta: argsText,\n });\n controller.enqueue({\n type: \"tool-call\",\n toolCallType: \"function\",\n toolCallId: toolCallId,\n toolName: toolName,\n args: argsText,\n });\n break;\n }\n\n case AssistantStreamChunkType.StepFinish: {\n controller.enqueue({\n type: \"step-finish\",\n ...value,\n });\n break;\n }\n\n // TODO\n case AssistantStreamChunkType.Data:\n break;\n\n default: {\n const unhandledType: never = type;\n throw new Error(`Unhandled chunk type: ${unhandledType}`);\n }\n }\n },\n flush(controller) {\n endCurrentToolCall(controller);\n },\n });\n}\n"],"mappings":";AAAA;AAAA,EAEE;AAAA,OACK;AAIA,SAAS,yBAAyB;AACvC,QAAM,gBAAgB,oBAAI,IAAoB;AAC9C,MAAI;AAIJ,QAAM,qBAAqB,CACzB,eACG;AACH,QAAI,CAAC,gBAAiB;AACtB,eAAW,QAAQ;AAAA,MACjB,MAAM;AAAA,MACN,cAAc;AAAA,MACd,YAAY,gBAAgB;AAAA,MAC5B,UAAU,gBAAgB;AAAA,MAC1B,MAAM,gBAAgB;AAAA,IACxB,CAAC;AACD,sBAAkB;AAAA,EACpB;AAEA,SAAO,IAAI,gBAGT;AAAA,IACA,UAAU,EAAE,MAAM,MAAM,GAAG,YAAY;AACrC,UACE,SAAS,yBAAyB,iBAClC,SAAS,yBAAyB,OAClC;AACA,2BAAmB,UAAU;AAAA,MAC/B;AAEA,cAAQ,MAAM;AAAA,QACZ,KAAK,yBAAyB,WAAW;AACvC,qBAAW,QAAQ;AAAA,YACjB,MAAM;AAAA,YACN,WAAW;AAAA,UACb,CAAC;AACD;AAAA,QACF;AAAA,QACA,KAAK,yBAAyB,eAAe;AAC3C,gBAAM,EAAE,YAAY,IAAI,UAAU,K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,CAAC;AACD,qBAAW,QAAQ;AAAA,YACjB,MAAM;AAAA,YACN,cAAc;AAAA,YACd;AAAA,YACA;AAAA,YACA,MAAM;AAAA,UACR,CAAC;AACD;AAAA,QACF;AAAA,QAEA,KAAK,yBAAyB,YAAY;AACxC,qBAAW,QAAQ;AAAA,YACjB,MAAM;AAAA,YACN,GAAG;AAAA,UACL,CAAC;AACD;AAAA,QACF;AAAA;AAAA,QAGA,KAAK,yBAAyB;AAC5B;AAAA,QAEF,SAAS;AACP,gBAAM,gBAAuB;AAC7B,gBAAM,IAAI,MAAM,yBAAyB,aAAa,EAAE;AAAA,QAC1D;AAAA,MACF;AAAA,IACF;AAAA,IACA,MAAM,YAAY;AAChB,yBAAmB,UAAU;AAAA,IAC/B;AAAA,EACF,CAAC;AACH;","names":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ExternalStoreThreadRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAS9D,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAItE,eAAO,MAAM,kBAAkB,cAClB,OAAO,YACR,aAAa,EAAE,YAG1B,CAAC;AAEF,qBAAa,8BACX,SAAQ,qBACR,YAAW,iBAAiB;IAE5B,OAAO,CAAC,qBAAqB,CAAuB;IAEpD,OAAO,CAAC,aAAa,CASnB;IAEF,IAAW,YAAY,wBAEtB;IAED,OAAO,CAAC,SAAS,CAAmB;IAC7B,UAAU,EAAG,OAAO,CAAC;IAE5B,IAAoB,QAAQ,oBAE3B;IAED,IAAW,QAAQ;;;;;kBAElB;IAEM,WAAW,EAAE,SAAS,gBAAgB,EAAE,CAAM;IAC9C,MAAM,EAAE,OAAO,CAAa;IAEnC,OAAO,CAAC,UAAU,CAAgC;IAElD,OAAO,CAAC,MAAM,CAA6B;IAE3B,SAAS,CAAC,SAAS,EAAE,MAAM;gBAQzC,cAAc,EAAE,mBAAmB,EACnC,KAAK,EAAE,oBAAoB,CAAC,GAAG,CAAC;IAM3B,mBAAmB,CAAC,KAAK,EAAE,oBAAoB,CAAC,GAAG,CAAC;
|
1
|
+
{"version":3,"file":"ExternalStoreThreadRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAS9D,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAItE,eAAO,MAAM,kBAAkB,cAClB,OAAO,YACR,aAAa,EAAE,YAG1B,CAAC;AAEF,qBAAa,8BACX,SAAQ,qBACR,YAAW,iBAAiB;IAE5B,OAAO,CAAC,qBAAqB,CAAuB;IAEpD,OAAO,CAAC,aAAa,CASnB;IAEF,IAAW,YAAY,wBAEtB;IAED,OAAO,CAAC,SAAS,CAAmB;IAC7B,UAAU,EAAG,OAAO,CAAC;IAE5B,IAAoB,QAAQ,oBAE3B;IAED,IAAW,QAAQ;;;;;kBAElB;IAEM,WAAW,EAAE,SAAS,gBAAgB,EAAE,CAAM;IAC9C,MAAM,EAAE,OAAO,CAAa;IAEnC,OAAO,CAAC,UAAU,CAAgC;IAElD,OAAO,CAAC,MAAM,CAA6B;IAE3B,SAAS,CAAC,SAAS,EAAE,MAAM;gBAQzC,cAAc,EAAE,mBAAmB,EACnC,KAAK,EAAE,oBAAoB,CAAC,GAAG,CAAC;IAM3B,mBAAmB,CAAC,KAAK,EAAE,oBAAoB,CAAC,GAAG,CAAC;IA4F3C,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQzC,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAU7C,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAOtD,SAAS,IAAI,IAAI;IAiCjB,aAAa,CAAC,OAAO,EAAE,oBAAoB;IAMlD,OAAO,CAAC,cAAc,CASpB;CACH"}
|
@@ -103,14 +103,16 @@ var ExternalStoreThreadRuntimeCore = class extends import_BaseThreadRuntimeCore.
|
|
103
103
|
const autoStatus = (0, import_auto_status.getAutoStatus)(isLast, isRunning);
|
104
104
|
if (cache && (cache.role !== "assistant" || !(0, import_auto_status.isAutoStatus)(cache.status) || cache.status === autoStatus))
|
105
105
|
return cache;
|
106
|
+
const messageLike = store.convertMessage(m, idx);
|
106
107
|
const newMessage = (0, import_ThreadMessageLike.fromThreadMessageLike)(
|
107
|
-
|
108
|
+
messageLike,
|
108
109
|
idx.toString(),
|
109
110
|
autoStatus
|
110
111
|
);
|
111
112
|
newMessage[import_getExternalStoreMessage.symbolInnerMessage] = m;
|
112
113
|
return newMessage;
|
113
114
|
});
|
115
|
+
if (messages.length > 0) this.ensureInitialized();
|
114
116
|
for (let i = 0; i < messages.length; i++) {
|
115
117
|
const message = messages[i];
|
116
118
|
const parent = messages[i - 1];
|