@assistant-ui/core 0.2.10 → 0.2.12
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/adapters/attachment.d.ts.map +1 -1
- package/dist/adapters/attachment.js +22 -12
- package/dist/adapters/attachment.js.map +1 -1
- package/dist/adapters/directive-formatter.js.map +1 -1
- package/dist/adapters/speech.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/model-context/frame/host.js.map +1 -1
- package/dist/model-context/frame/provider.js.map +1 -1
- package/dist/model-context/registry.js.map +1 -1
- package/dist/model-context/types.js.map +1 -1
- package/dist/react/AssistantProvider.js +1 -1
- package/dist/react/AssistantRuntimeProvider.d.ts +1 -1
- package/dist/react/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/react/AssistantRuntimeProvider.js +1 -1
- package/dist/react/RuntimeAdapter.js +4 -2
- package/dist/react/RuntimeAdapter.js.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
- package/dist/react/client/DataRenderers.d.ts.map +1 -1
- package/dist/react/client/DataRenderers.js +6 -5
- package/dist/react/client/DataRenderers.js.map +1 -1
- package/dist/react/client/Interactables.d.ts.map +1 -1
- package/dist/react/client/Interactables.js +30 -29
- package/dist/react/client/Interactables.js.map +1 -1
- package/dist/react/client/Tools.d.ts.map +1 -1
- package/dist/react/client/Tools.js +10 -9
- package/dist/react/client/Tools.js.map +1 -1
- package/dist/react/index.d.ts +5 -4
- package/dist/react/index.js +3 -2
- package/dist/react/model-context/define-mcp-toolkit.js.map +1 -1
- package/dist/react/model-context/define-toolkit.d.ts +9 -12
- package/dist/react/model-context/define-toolkit.d.ts.map +1 -1
- package/dist/react/model-context/define-toolkit.js +1 -1
- package/dist/react/model-context/define-toolkit.js.map +1 -1
- package/dist/react/model-context/external-tool.d.ts +14 -0
- package/dist/react/model-context/external-tool.d.ts.map +1 -0
- package/dist/react/model-context/external-tool.js +17 -0
- package/dist/react/model-context/external-tool.js.map +1 -0
- package/dist/react/model-context/human-tool.d.ts +27 -0
- package/dist/react/model-context/human-tool.d.ts.map +1 -0
- package/dist/react/model-context/human-tool.js +30 -0
- package/dist/react/model-context/human-tool.js.map +1 -0
- package/dist/react/model-context/toolbox.d.ts +3 -3
- package/dist/react/model-context/toolbox.js.map +1 -1
- package/dist/react/model-context/useAssistantContext.js +1 -1
- package/dist/react/model-context/useAssistantContext.js.map +1 -1
- package/dist/react/model-context/useAssistantDataUI.js +1 -1
- package/dist/react/model-context/useAssistantDataUI.js.map +1 -1
- package/dist/react/model-context/useAssistantInstructions.js +1 -1
- package/dist/react/model-context/useAssistantInstructions.js.map +1 -1
- package/dist/react/model-context/useAssistantInteractable.js +1 -1
- package/dist/react/model-context/useAssistantInteractable.js.map +1 -1
- package/dist/react/model-context/useAssistantTool.js +1 -1
- package/dist/react/model-context/useAssistantTool.js.map +1 -1
- package/dist/react/model-context/useAssistantToolUI.js +1 -1
- package/dist/react/model-context/useAssistantToolUI.js.map +1 -1
- package/dist/react/model-context/useAuiToolOverrides.js +1 -1
- package/dist/react/model-context/useAuiToolOverrides.js.map +1 -1
- package/dist/react/model-context/useInlineRender.js +1 -1
- package/dist/react/model-context/useInlineRender.js.map +1 -1
- package/dist/react/model-context/useInteractableState.js +1 -1
- package/dist/react/model-context/useInteractableState.js.map +1 -1
- package/dist/react/model-context/useToolArgsStatus.js +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.js +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.js +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.js +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.js +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.js +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.js +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.js +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.js +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.js +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.js +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.js +1 -1
- package/dist/react/primitive-hooks/useComposerSend.js.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.js +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.js.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.js +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.js +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageReload.js +1 -1
- package/dist/react/primitive-hooks/useMessageReload.js.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.js +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.js +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.js +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.js +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.js +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.js +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.js +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.js.map +1 -1
- package/dist/react/primitive-hooks/useVoice.js +1 -1
- package/dist/react/primitive-hooks/useVoice.js.map +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js.map +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.js +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/react/primitives/composer/ComposerQueue.js +1 -1
- package/dist/react/primitives/composer/ComposerQueue.js.map +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.js +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.js.map +1 -1
- package/dist/react/primitives/message/MessageAttachments.js +1 -1
- package/dist/react/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.js +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.js.map +1 -1
- package/dist/react/primitives/message/MessageParts.d.ts +1 -1
- package/dist/react/primitives/message/MessageParts.js +1 -1
- package/dist/react/primitives/message/MessageParts.js.map +1 -1
- package/dist/react/primitives/message/MessageQuote.js +1 -1
- package/dist/react/primitives/part/PartMessages.d.ts +2 -2
- package/dist/react/primitives/part/PartMessages.js +3 -3
- package/dist/react/primitives/part/PartMessages.js.map +1 -1
- package/dist/react/primitives/thread/ThreadMessages.js +1 -1
- package/dist/react/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.js +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.js.map +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.js +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/react/providers/AttachmentByIndexProvider.js.map +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.js.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js.map +1 -1
- package/dist/react/providers/MessageByIndexProvider.js.map +1 -1
- package/dist/react/providers/PartByIndexProvider.js.map +1 -1
- package/dist/react/providers/QueueItemByIndexProvider.js.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.js +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.js.map +1 -1
- package/dist/react/providers/SuggestionByIndexProvider.js.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.js +4 -3
- package/dist/react/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +7 -0
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +7 -0
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/react/runtimes/RuntimeAdapterProvider.js +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js.map +1 -1
- package/dist/react/runtimes/createMessageConverter.d.ts +2 -2
- package/dist/react/runtimes/createMessageConverter.d.ts.map +1 -1
- package/dist/react/runtimes/createMessageConverter.js.map +1 -1
- package/dist/react/runtimes/external-message-converter.d.ts +4 -3
- package/dist/react/runtimes/external-message-converter.d.ts.map +1 -1
- package/dist/react/runtimes/external-message-converter.js +1 -1
- package/dist/react/runtimes/external-message-converter.js.map +1 -1
- package/dist/react/runtimes/useExternalStoreRuntime.js +1 -1
- package/dist/react/runtimes/useExternalStoreSharedOptions.js +1 -1
- package/dist/react/runtimes/useLocalRuntime.d.ts +2 -1
- package/dist/react/runtimes/useLocalRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.js +4 -3
- package/dist/react/runtimes/useLocalRuntime.js.map +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.js +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/react/utils/groupParts.d.ts +1 -1
- package/dist/react/utils/groupParts.js.map +1 -1
- package/dist/runtime/api/attachment-runtime.js.map +1 -1
- package/dist/runtime/api/composer-runtime.d.ts +8 -2
- package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.js +14 -0
- package/dist/runtime/api/composer-runtime.js.map +1 -1
- package/dist/runtime/api/message-part-runtime.js.map +1 -1
- package/dist/runtime/api/message-runtime.js +1 -1
- package/dist/runtime/api/message-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.js.map +1 -1
- package/dist/runtime/api/thread-runtime.d.ts +7 -0
- package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-runtime.js.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.d.ts +4 -0
- package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.js +7 -1
- package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +4 -0
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js +17 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
- package/dist/runtime/interfaces/composer-runtime-core.d.ts +6 -1
- package/dist/runtime/interfaces/composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-runtime-core.d.ts +4 -0
- package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts +20 -0
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts.map +1 -0
- package/dist/runtime/queue/external-thread-queue-adapter.js +0 -0
- package/dist/runtime/queue/message-queue.d.ts +20 -0
- package/dist/runtime/queue/message-queue.d.ts.map +1 -0
- package/dist/runtime/queue/message-queue.js +97 -0
- package/dist/runtime/queue/message-queue.js.map +1 -0
- package/dist/runtime/utils/message-repository.js.map +1 -1
- package/dist/runtime/utils/thread-message-like.js.map +1 -1
- package/dist/runtimes/external-store/external-store-adapter.d.ts +3 -1
- package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +4 -0
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js +20 -2
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/local/local-runtime-core.js.map +1 -1
- package/dist/runtimes/local/local-runtime-options.d.ts +5 -0
- package/dist/runtimes/local/local-runtime-options.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.d.ts +7 -0
- package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.js +45 -0
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +3 -0
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js +3 -0
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.js +3 -0
- package/dist/runtimes/remote-thread-list/empty-thread-core.js.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.js.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js.map +1 -1
- package/dist/store/clients/chain-of-thought-client.d.ts.map +1 -1
- package/dist/store/clients/chain-of-thought-client.js +6 -5
- package/dist/store/clients/chain-of-thought-client.js.map +1 -1
- package/dist/store/clients/model-context-client.d.ts.map +1 -1
- package/dist/store/clients/model-context-client.js +6 -5
- package/dist/store/clients/model-context-client.js.map +1 -1
- package/dist/store/clients/no-op-composer-client.d.ts.map +1 -1
- package/dist/store/clients/no-op-composer-client.js +4 -3
- package/dist/store/clients/no-op-composer-client.js.map +1 -1
- package/dist/store/clients/runtime-adapter.d.ts.map +1 -1
- package/dist/store/clients/runtime-adapter.js +7 -6
- package/dist/store/clients/runtime-adapter.js.map +1 -1
- package/dist/store/clients/suggestions.d.ts.map +1 -1
- package/dist/store/clients/suggestions.js +7 -6
- package/dist/store/clients/suggestions.js.map +1 -1
- package/dist/store/clients/thread-message-client.d.ts.map +1 -1
- package/dist/store/clients/thread-message-client.js +13 -12
- package/dist/store/clients/thread-message-client.js.map +1 -1
- package/dist/store/index.d.ts +1 -1
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/attachment-runtime-client.js +3 -3
- package/dist/store/runtime-clients/attachment-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.d.ts +12 -5
- package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.js +32 -16
- package/dist/store/runtime-clients/composer-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.js +3 -3
- package/dist/store/runtime-clients/message-part-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.d.ts +6 -3
- package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.js +17 -16
- package/dist/store/runtime-clients/message-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.js +8 -7
- package/dist/store/runtime-clients/thread-list-item-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.js +11 -10
- package/dist/store/runtime-clients/thread-list-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.js +15 -14
- package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/useSubscribable.d.ts +7 -0
- package/dist/store/runtime-clients/useSubscribable.d.ts.map +1 -0
- package/dist/store/runtime-clients/useSubscribable.js +16 -0
- package/dist/store/runtime-clients/useSubscribable.js.map +1 -0
- package/dist/store/scope-registration.d.ts +1 -1
- package/dist/store/scopes/composer.d.ts +1 -1
- package/dist/store/scopes/queue-item.d.ts +2 -1
- package/dist/store/scopes/queue-item.d.ts.map +1 -1
- package/dist/store/scopes/queue-item.js +6 -0
- package/dist/store/scopes/queue-item.js.map +1 -0
- package/dist/store/scopes/thread.d.ts +1 -1
- package/dist/store/scopes/threads.d.ts +1 -1
- package/dist/types/message.d.ts +2 -1
- package/dist/types/message.d.ts.map +1 -1
- package/dist/types/message.js.map +1 -1
- package/dist/utils/composite-context-provider.d.ts +1 -1
- package/dist/utils/composite-context-provider.js +3 -1
- package/dist/utils/composite-context-provider.js.map +1 -1
- package/dist/utils/json/is-json.js.map +1 -1
- package/dist/utils/text.js.map +1 -1
- package/package.json +14 -10
- package/src/adapters/attachment.ts +24 -4
- package/src/index.ts +8 -0
- package/src/react/RuntimeAdapter.ts +6 -4
- package/src/react/client/DataRenderers.ts +48 -42
- package/src/react/client/Interactables.ts +263 -267
- package/src/react/client/Tools.ts +122 -129
- package/src/react/index.ts +3 -1
- package/src/react/model-context/define-toolkit.test.ts +14 -7
- package/src/react/model-context/define-toolkit.ts +18 -19
- package/src/react/model-context/external-tool.ts +16 -0
- package/src/react/model-context/{hitl.ts → human-tool.ts} +13 -8
- package/src/react/model-context/toolbox.ts +3 -3
- package/src/react/primitives/message/MessageGroupedParts.tsx +1 -1
- package/src/react/primitives/part/PartMessages.tsx +2 -2
- package/src/react/providers/TextMessagePartProvider.tsx +31 -32
- package/src/react/runtimes/createMessageConverter.ts +2 -1
- package/src/react/runtimes/external-message-converter.ts +5 -3
- package/src/react/runtimes/useLocalRuntime.ts +2 -0
- package/src/runtime/api/composer-runtime.ts +26 -0
- package/src/runtime/base/base-composer-runtime-core.ts +11 -0
- package/src/runtime/base/default-thread-composer-runtime-core.ts +22 -0
- package/src/runtime/interfaces/composer-runtime-core.ts +7 -0
- package/src/runtime/interfaces/thread-runtime-core.ts +5 -0
- package/src/runtime/queue/external-thread-queue-adapter.ts +14 -0
- package/src/runtime/queue/message-queue.ts +128 -0
- package/src/runtimes/external-store/external-store-adapter.ts +3 -0
- package/src/runtimes/external-store/external-store-thread-runtime-core.ts +31 -2
- package/src/runtimes/local/local-runtime-options.ts +6 -0
- package/src/runtimes/local/local-thread-runtime-core.ts +70 -0
- package/src/runtimes/readonly/ReadonlyThreadRuntimeCore.ts +4 -0
- package/src/runtimes/remote-thread-list/empty-thread-core.ts +4 -0
- package/src/store/clients/chain-of-thought-client.ts +24 -25
- package/src/store/clients/model-context-client.ts +22 -19
- package/src/store/clients/no-op-composer-client.ts +69 -66
- package/src/store/clients/runtime-adapter.ts +9 -6
- package/src/store/clients/suggestions.ts +41 -40
- package/src/store/clients/thread-message-client.ts +127 -132
- package/src/store/runtime-clients/attachment-runtime-client.ts +7 -3
- package/src/store/runtime-clients/composer-runtime-client.ts +142 -113
- package/src/store/runtime-clients/message-part-runtime-client.ts +16 -14
- package/src/store/runtime-clients/message-runtime-client.ts +124 -122
- package/src/store/runtime-clients/thread-list-item-runtime-client.ts +44 -45
- package/src/store/runtime-clients/thread-list-runtime-client.ts +83 -80
- package/src/store/runtime-clients/thread-runtime-client.ts +113 -119
- package/src/store/runtime-clients/{tap-subscribable.ts → useSubscribable.ts} +4 -4
- package/src/store/scopes/queue-item.ts +2 -0
- package/src/tests/attachment-adapters.test.ts +86 -0
- package/src/tests/external-store-thread-runtime-core.test.ts +125 -0
- package/src/tests/message-queue.test.ts +168 -0
- package/src/types/message.ts +2 -0
- package/src/utils/composite-context-provider.ts +3 -1
- package/dist/react/model-context/hitl.d.ts +0 -23
- package/dist/react/model-context/hitl.d.ts.map +0 -1
- package/dist/react/model-context/hitl.js +0 -26
- package/dist/react/model-context/hitl.js.map +0 -1
- package/dist/store/runtime-clients/tap-subscribable.d.ts +0 -7
- package/dist/store/runtime-clients/tap-subscribable.d.ts.map +0 -1
- package/dist/store/runtime-clients/tap-subscribable.js +0 -16
- package/dist/store/runtime-clients/tap-subscribable.js.map +0 -1
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import type { Unsubscribe } from "../../types/unsubscribe";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
tapMemo,
|
|
5
|
-
tapEffect,
|
|
6
|
-
tapResource,
|
|
7
|
-
type tapRef,
|
|
8
|
-
withKey,
|
|
9
|
-
} from "@assistant-ui/tap";
|
|
2
|
+
import { useMemo, useEffect } from "react";
|
|
3
|
+
import { useResource, resource, withKey } from "@assistant-ui/tap";
|
|
10
4
|
import {
|
|
11
5
|
type ClientOutput,
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
useAssistantEmit,
|
|
7
|
+
useClientLookup,
|
|
14
8
|
} from "@assistant-ui/store";
|
|
15
9
|
import type {
|
|
16
10
|
ComposerRuntime,
|
|
17
11
|
EditComposerRuntime,
|
|
18
12
|
} from "../../runtime/api/composer-runtime";
|
|
19
13
|
import type { ComposerState } from "../scopes/composer";
|
|
14
|
+
import type { QueueItemState } from "../scopes/queue-item";
|
|
20
15
|
import { AttachmentRuntimeClient } from "./attachment-runtime-client";
|
|
21
|
-
import {
|
|
16
|
+
import { useSubscribable } from "./useSubscribable";
|
|
22
17
|
|
|
23
18
|
const ComposerAttachmentClientByIndex = resource(
|
|
24
|
-
({
|
|
25
|
-
|
|
19
|
+
function ComposerAttachmentClientByIndex({
|
|
20
|
+
runtime,
|
|
21
|
+
index,
|
|
22
|
+
}: {
|
|
23
|
+
runtime: ComposerRuntime;
|
|
24
|
+
index: number;
|
|
25
|
+
}) {
|
|
26
|
+
const attachmentRuntime = useMemo(
|
|
26
27
|
() => runtime.getAttachmentByIndex(index),
|
|
27
28
|
[runtime, index],
|
|
28
29
|
);
|
|
29
30
|
|
|
30
|
-
return
|
|
31
|
+
return useResource(
|
|
31
32
|
AttachmentRuntimeClient({
|
|
32
33
|
runtime: attachmentRuntime,
|
|
33
34
|
}),
|
|
@@ -35,113 +36,141 @@ const ComposerAttachmentClientByIndex = resource(
|
|
|
35
36
|
},
|
|
36
37
|
);
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
const QueueItemClient = resource(function QueueItemClient({
|
|
40
|
+
item,
|
|
41
|
+
onSteer,
|
|
42
|
+
onRemove,
|
|
43
|
+
}: {
|
|
44
|
+
item: QueueItemState;
|
|
45
|
+
onSteer: () => void;
|
|
46
|
+
onRemove: () => void;
|
|
47
|
+
}): ClientOutput<"queueItem"> {
|
|
48
|
+
return {
|
|
49
|
+
getState: () => item,
|
|
50
|
+
steer: onSteer,
|
|
51
|
+
remove: onRemove,
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export const ComposerClient = resource(function ComposerClient({
|
|
56
|
+
threadIdRef,
|
|
57
|
+
messageIdRef,
|
|
58
|
+
runtime,
|
|
59
|
+
}: {
|
|
60
|
+
threadIdRef: { current: string };
|
|
61
|
+
messageIdRef?: { current: string };
|
|
62
|
+
runtime: ComposerRuntime;
|
|
63
|
+
}): ClientOutput<"composer"> {
|
|
64
|
+
const runtimeState = useSubscribable(runtime);
|
|
65
|
+
const emit = useAssistantEmit();
|
|
50
66
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
67
|
+
// Bind composer events to event manager
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
const unsubscribers: Unsubscribe[] = [];
|
|
54
70
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
});
|
|
71
|
+
// Subscribe to composer events
|
|
72
|
+
for (const event of ["send", "attachmentAdd"] as const) {
|
|
73
|
+
const unsubscribe = runtime.unstable_on(event, () => {
|
|
74
|
+
emit(`composer.${event}`, {
|
|
75
|
+
threadId: threadIdRef.current,
|
|
76
|
+
...(messageIdRef && { messageId: messageIdRef.current }),
|
|
62
77
|
});
|
|
63
|
-
|
|
64
|
-
|
|
78
|
+
});
|
|
79
|
+
unsubscribers.push(unsubscribe);
|
|
80
|
+
}
|
|
65
81
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
unsubscribers.push(
|
|
83
|
+
runtime.unstable_on("attachmentAddError", (payload) => {
|
|
84
|
+
// payload.error omitted: raw Error is not store-serializable; use runtime.unstable_on for it.
|
|
85
|
+
emit("composer.attachmentAddError", {
|
|
86
|
+
threadId: threadIdRef.current,
|
|
87
|
+
...(messageIdRef && { messageId: messageIdRef.current }),
|
|
88
|
+
...(payload.attachmentId && { attachmentId: payload.attachmentId }),
|
|
89
|
+
reason: payload.reason,
|
|
90
|
+
message: payload.message,
|
|
91
|
+
});
|
|
92
|
+
}),
|
|
93
|
+
);
|
|
78
94
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
95
|
+
return () => {
|
|
96
|
+
for (const unsub of unsubscribers) unsub();
|
|
97
|
+
};
|
|
98
|
+
}, [runtime, emit, threadIdRef, messageIdRef]);
|
|
83
99
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
),
|
|
100
|
+
const attachments = useClientLookup(
|
|
101
|
+
() =>
|
|
102
|
+
runtimeState.attachments.map((attachment, idx) =>
|
|
103
|
+
withKey(
|
|
104
|
+
attachment.id,
|
|
105
|
+
ComposerAttachmentClientByIndex({
|
|
106
|
+
runtime,
|
|
107
|
+
index: idx,
|
|
108
|
+
}),
|
|
94
109
|
),
|
|
95
|
-
|
|
96
|
-
|
|
110
|
+
),
|
|
111
|
+
[runtimeState.attachments, runtime],
|
|
112
|
+
);
|
|
97
113
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
};
|
|
114
|
-
}, [runtimeState, attachments.state]);
|
|
114
|
+
const queue = runtimeState.queue;
|
|
115
|
+
const queueItems = useClientLookup(
|
|
116
|
+
() =>
|
|
117
|
+
queue.map((item) =>
|
|
118
|
+
withKey(
|
|
119
|
+
item.id,
|
|
120
|
+
QueueItemClient({
|
|
121
|
+
item,
|
|
122
|
+
onSteer: () => runtime.steerQueueItem(item.id),
|
|
123
|
+
onRemove: () => runtime.removeQueueItem(item.id),
|
|
124
|
+
}),
|
|
125
|
+
),
|
|
126
|
+
),
|
|
127
|
+
[queue, runtime],
|
|
128
|
+
);
|
|
115
129
|
|
|
130
|
+
const state = useMemo<ComposerState>(() => {
|
|
116
131
|
return {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}),
|
|
131
|
-
startDictation: runtime.startDictation,
|
|
132
|
-
stopDictation: runtime.stopDictation,
|
|
133
|
-
setQuote: runtime.setQuote,
|
|
134
|
-
attachment: (selector) => {
|
|
135
|
-
if ("id" in selector) {
|
|
136
|
-
return attachments.get({ key: selector.id });
|
|
137
|
-
} else {
|
|
138
|
-
return attachments.get(selector);
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
queueItem: () => {
|
|
142
|
-
throw new Error("Queue is not supported in this runtime");
|
|
143
|
-
},
|
|
144
|
-
__internal_getRuntime: () => runtime,
|
|
132
|
+
text: runtimeState.text,
|
|
133
|
+
role: runtimeState.role,
|
|
134
|
+
attachments: attachments.state,
|
|
135
|
+
runConfig: runtimeState.runConfig,
|
|
136
|
+
isEditing: runtimeState.isEditing,
|
|
137
|
+
canCancel: runtimeState.canCancel,
|
|
138
|
+
canSend: runtimeState.canSend,
|
|
139
|
+
attachmentAccept: runtimeState.attachmentAccept,
|
|
140
|
+
isEmpty: runtimeState.isEmpty,
|
|
141
|
+
type: runtimeState.type ?? "thread",
|
|
142
|
+
dictation: runtimeState.dictation,
|
|
143
|
+
quote: runtimeState.quote,
|
|
144
|
+
queue,
|
|
145
145
|
};
|
|
146
|
-
},
|
|
147
|
-
|
|
146
|
+
}, [runtimeState, attachments.state, queue]);
|
|
147
|
+
|
|
148
|
+
return {
|
|
149
|
+
getState: () => state,
|
|
150
|
+
setText: runtime.setText,
|
|
151
|
+
setRole: runtime.setRole,
|
|
152
|
+
setRunConfig: runtime.setRunConfig,
|
|
153
|
+
addAttachment: runtime.addAttachment,
|
|
154
|
+
reset: runtime.reset,
|
|
155
|
+
clearAttachments: runtime.clearAttachments,
|
|
156
|
+
send: runtime.send,
|
|
157
|
+
cancel: runtime.cancel,
|
|
158
|
+
beginEdit:
|
|
159
|
+
(runtime as EditComposerRuntime).beginEdit ??
|
|
160
|
+
(() => {
|
|
161
|
+
throw new Error("beginEdit is not supported in this runtime");
|
|
162
|
+
}),
|
|
163
|
+
startDictation: runtime.startDictation,
|
|
164
|
+
stopDictation: runtime.stopDictation,
|
|
165
|
+
setQuote: runtime.setQuote,
|
|
166
|
+
attachment: (selector) => {
|
|
167
|
+
if ("id" in selector) {
|
|
168
|
+
return attachments.get({ key: selector.id });
|
|
169
|
+
} else {
|
|
170
|
+
return attachments.get(selector);
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
queueItem: (selector) => queueItems.get(selector),
|
|
174
|
+
__internal_getRuntime: () => runtime,
|
|
175
|
+
};
|
|
176
|
+
});
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { resource } from "@assistant-ui/tap";
|
|
2
2
|
import type { ClientOutput } from "@assistant-ui/store";
|
|
3
3
|
import type { MessagePartRuntime } from "../../runtime/api/message-part-runtime";
|
|
4
|
-
import {
|
|
4
|
+
import { useSubscribable } from "./useSubscribable";
|
|
5
5
|
|
|
6
|
-
export const MessagePartClient = resource(
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export const MessagePartClient = resource(function MessagePartClient({
|
|
7
|
+
runtime,
|
|
8
|
+
}: {
|
|
9
|
+
runtime: MessagePartRuntime;
|
|
10
|
+
}): ClientOutput<"part"> {
|
|
11
|
+
const state = useSubscribable(runtime);
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
);
|
|
13
|
+
return {
|
|
14
|
+
getState: () => state,
|
|
15
|
+
addToolResult: (result) => runtime.addToolResult(result),
|
|
16
|
+
resumeToolCall: (payload) => runtime.resumeToolCall(payload),
|
|
17
|
+
respondToToolApproval: (response) =>
|
|
18
|
+
runtime.respondToToolApproval(response),
|
|
19
|
+
__internal_getRuntime: () => runtime,
|
|
20
|
+
};
|
|
21
|
+
});
|
|
@@ -1,145 +1,147 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
resource,
|
|
4
|
-
tapResource,
|
|
5
|
-
tapMemo,
|
|
6
|
-
tapState,
|
|
7
|
-
type tapRef,
|
|
8
|
-
} from "@assistant-ui/tap";
|
|
1
|
+
import { useMemo, useState } from "react";
|
|
2
|
+
import { useResource, withKey, resource } from "@assistant-ui/tap";
|
|
9
3
|
import {
|
|
10
4
|
type ClientOutput,
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
useClientLookup,
|
|
6
|
+
useClientResource,
|
|
13
7
|
} from "@assistant-ui/store";
|
|
14
8
|
import type { MessageRuntime } from "../../runtime/api/message-runtime";
|
|
15
|
-
import {
|
|
9
|
+
import { useSubscribable } from "./useSubscribable";
|
|
16
10
|
import { ComposerClient } from "./composer-runtime-client";
|
|
17
11
|
import { MessagePartClient } from "./message-part-runtime-client";
|
|
18
12
|
import type { MessageState } from "../scopes/message";
|
|
19
13
|
import { AttachmentRuntimeClient } from "./attachment-runtime-client";
|
|
20
14
|
|
|
21
15
|
const MessageAttachmentClientByIndex = resource(
|
|
22
|
-
({
|
|
23
|
-
|
|
16
|
+
function MessageAttachmentClientByIndex({
|
|
17
|
+
runtime,
|
|
18
|
+
index,
|
|
19
|
+
}: {
|
|
20
|
+
runtime: MessageRuntime;
|
|
21
|
+
index: number;
|
|
22
|
+
}) {
|
|
23
|
+
const attachmentRuntime = useMemo(
|
|
24
24
|
() => runtime.getAttachmentByIndex(index),
|
|
25
25
|
[runtime, index],
|
|
26
26
|
);
|
|
27
|
-
return
|
|
28
|
-
},
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
const MessagePartByIndex = resource(
|
|
32
|
-
({ runtime, index }: { runtime: MessageRuntime; index: number }) => {
|
|
33
|
-
const partRuntime = tapMemo(
|
|
34
|
-
() => runtime.getMessagePartByIndex(index),
|
|
35
|
-
[runtime, index],
|
|
36
|
-
);
|
|
37
|
-
return tapResource(MessagePartClient({ runtime: partRuntime }));
|
|
27
|
+
return useResource(AttachmentRuntimeClient({ runtime: attachmentRuntime }));
|
|
38
28
|
},
|
|
39
29
|
);
|
|
40
30
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
31
|
+
const MessagePartByIndex = resource(function MessagePartByIndex({
|
|
32
|
+
runtime,
|
|
33
|
+
index,
|
|
34
|
+
}: {
|
|
35
|
+
runtime: MessageRuntime;
|
|
36
|
+
index: number;
|
|
37
|
+
}) {
|
|
38
|
+
const partRuntime = useMemo(
|
|
39
|
+
() => runtime.getMessagePartByIndex(index),
|
|
40
|
+
[runtime, index],
|
|
41
|
+
);
|
|
42
|
+
return useResource(MessagePartClient({ runtime: partRuntime }));
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export const MessageClient = resource(function MessageClient({
|
|
46
|
+
runtime,
|
|
47
|
+
threadIdRef,
|
|
48
|
+
}: {
|
|
49
|
+
runtime: MessageRuntime;
|
|
50
|
+
threadIdRef: { current: string };
|
|
51
|
+
}): ClientOutput<"message"> {
|
|
52
|
+
const runtimeState = useSubscribable(runtime);
|
|
53
|
+
|
|
54
|
+
const [isCopiedState, setIsCopied] = useState(false);
|
|
55
|
+
const [isHoveringState, setIsHovering] = useState(false);
|
|
56
|
+
|
|
57
|
+
const messageIdRef = useMemo(
|
|
58
|
+
() => ({
|
|
59
|
+
get current() {
|
|
60
|
+
return runtime.getState().id;
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
[runtime],
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const composer = useClientResource(
|
|
67
|
+
ComposerClient({
|
|
68
|
+
runtime: runtime.composer,
|
|
69
|
+
threadIdRef,
|
|
70
|
+
messageIdRef,
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
73
|
+
const parts = useClientLookup(
|
|
74
|
+
() =>
|
|
75
|
+
runtimeState.content.map((part, idx) =>
|
|
76
|
+
withKey(
|
|
77
|
+
"toolCallId" in part && part.toolCallId != null
|
|
78
|
+
? `toolCallId-${part.toolCallId}`
|
|
79
|
+
: `index-${idx}`,
|
|
80
|
+
MessagePartByIndex({ runtime, index: idx }),
|
|
79
81
|
),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
),
|
|
82
|
+
),
|
|
83
|
+
[runtimeState.content, runtime],
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const attachments = useClientLookup(
|
|
87
|
+
() =>
|
|
88
|
+
(runtimeState.attachments ?? []).map((attachment, idx) =>
|
|
89
|
+
withKey(
|
|
90
|
+
attachment.id,
|
|
91
|
+
MessageAttachmentClientByIndex({ runtime, index: idx }),
|
|
90
92
|
),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const state = tapMemo<MessageState>(() => {
|
|
95
|
-
return {
|
|
96
|
-
...(runtimeState as MessageState),
|
|
97
|
-
|
|
98
|
-
parts: parts.state,
|
|
99
|
-
composer: composer.state,
|
|
100
|
-
|
|
101
|
-
isCopied: isCopiedState,
|
|
102
|
-
isHovering: isHoveringState,
|
|
103
|
-
};
|
|
104
|
-
}, [
|
|
105
|
-
runtimeState,
|
|
106
|
-
parts.state,
|
|
107
|
-
composer.state,
|
|
108
|
-
isCopiedState,
|
|
109
|
-
isHoveringState,
|
|
110
|
-
]);
|
|
93
|
+
),
|
|
94
|
+
[runtimeState.attachments, runtime],
|
|
95
|
+
);
|
|
111
96
|
|
|
97
|
+
const state = useMemo<MessageState>(() => {
|
|
112
98
|
return {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
composer: () => composer.methods,
|
|
116
|
-
|
|
117
|
-
reload: (config) => runtime.reload(config),
|
|
118
|
-
speak: () => runtime.speak(),
|
|
119
|
-
stopSpeaking: () => runtime.stopSpeaking(),
|
|
120
|
-
submitFeedback: (feedback) => runtime.submitFeedback(feedback),
|
|
121
|
-
switchToBranch: (options) => runtime.switchToBranch(options),
|
|
122
|
-
getCopyText: () => runtime.unstable_getCopyText(),
|
|
123
|
-
part: (selector) => {
|
|
124
|
-
if ("index" in selector) {
|
|
125
|
-
return parts.get({ index: selector.index });
|
|
126
|
-
} else {
|
|
127
|
-
return parts.get({ key: `toolCallId-${selector.toolCallId}` });
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
attachment: (selector) => {
|
|
132
|
-
if ("id" in selector) {
|
|
133
|
-
return attachments.get({ key: selector.id });
|
|
134
|
-
} else {
|
|
135
|
-
return attachments.get(selector);
|
|
136
|
-
}
|
|
137
|
-
},
|
|
99
|
+
...(runtimeState as MessageState),
|
|
138
100
|
|
|
139
|
-
|
|
140
|
-
|
|
101
|
+
parts: parts.state,
|
|
102
|
+
composer: composer.state,
|
|
141
103
|
|
|
142
|
-
|
|
104
|
+
isCopied: isCopiedState,
|
|
105
|
+
isHovering: isHoveringState,
|
|
143
106
|
};
|
|
144
|
-
},
|
|
145
|
-
|
|
107
|
+
}, [
|
|
108
|
+
runtimeState,
|
|
109
|
+
parts.state,
|
|
110
|
+
composer.state,
|
|
111
|
+
isCopiedState,
|
|
112
|
+
isHoveringState,
|
|
113
|
+
]);
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
getState: () => state,
|
|
117
|
+
|
|
118
|
+
composer: () => composer.methods,
|
|
119
|
+
|
|
120
|
+
reload: (config) => runtime.reload(config),
|
|
121
|
+
speak: () => runtime.speak(),
|
|
122
|
+
stopSpeaking: () => runtime.stopSpeaking(),
|
|
123
|
+
submitFeedback: (feedback) => runtime.submitFeedback(feedback),
|
|
124
|
+
switchToBranch: (options) => runtime.switchToBranch(options),
|
|
125
|
+
getCopyText: () => runtime.unstable_getCopyText(),
|
|
126
|
+
part: (selector) => {
|
|
127
|
+
if ("index" in selector) {
|
|
128
|
+
return parts.get({ index: selector.index });
|
|
129
|
+
} else {
|
|
130
|
+
return parts.get({ key: `toolCallId-${selector.toolCallId}` });
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
attachment: (selector) => {
|
|
135
|
+
if ("id" in selector) {
|
|
136
|
+
return attachments.get({ key: selector.id });
|
|
137
|
+
} else {
|
|
138
|
+
return attachments.get(selector);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
setIsCopied,
|
|
143
|
+
setIsHovering,
|
|
144
|
+
|
|
145
|
+
__internal_getRuntime: () => runtime,
|
|
146
|
+
};
|
|
147
|
+
});
|