@assistant-ui/core 0.2.10 → 0.2.11
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,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { resource } from "@assistant-ui/tap";
|
|
2
3
|
import type { ClientOutput } from "@assistant-ui/store";
|
|
3
4
|
import { CompositeContextProvider } from "../../utils/composite-context-provider";
|
|
4
5
|
import type { ModelContextState } from "../scopes/model-context";
|
|
@@ -28,23 +29,25 @@ const deriveState = (
|
|
|
28
29
|
return { modelName, toolNames };
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
export const ModelContext = resource(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
export const ModelContext = resource(
|
|
33
|
+
function ModelContext(): ClientOutput<"modelContext"> {
|
|
34
|
+
const composite = useMemo(() => new CompositeContextProvider(), []);
|
|
35
|
+
const [state, setState] = useState<ModelContextState>(() =>
|
|
36
|
+
deriveState(composite, INITIAL_STATE),
|
|
37
|
+
);
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
setState((prev) => deriveState(composite, prev));
|
|
39
|
-
return composite.subscribe(() => {
|
|
39
|
+
useEffect(() => {
|
|
40
40
|
setState((prev) => deriveState(composite, prev));
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
return composite.subscribe(() => {
|
|
42
|
+
setState((prev) => deriveState(composite, prev));
|
|
43
|
+
});
|
|
44
|
+
}, [composite]);
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
getState: () => deriveState(composite, state),
|
|
48
|
+
getModelContext: () => composite.getModelContext(),
|
|
49
|
+
subscribe: (callback) => composite.subscribe(callback),
|
|
50
|
+
register: (provider) => composite.registerModelContextProvider(provider),
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
);
|
|
@@ -1,71 +1,74 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { resource } from "@assistant-ui/tap";
|
|
2
3
|
import type { ClientOutput } from "@assistant-ui/store";
|
|
3
4
|
import type { ComposerState } from "../scopes/composer";
|
|
4
5
|
|
|
5
|
-
export const NoOpComposerClient = resource(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
text: "",
|
|
12
|
-
attachmentAccept: "*",
|
|
13
|
-
attachments: [],
|
|
14
|
-
role: "user",
|
|
15
|
-
runConfig: {},
|
|
16
|
-
canCancel: false,
|
|
17
|
-
canSend: false,
|
|
18
|
-
type: type,
|
|
19
|
-
dictation: undefined,
|
|
20
|
-
quote: undefined,
|
|
21
|
-
queue: [],
|
|
22
|
-
};
|
|
23
|
-
}, [type]);
|
|
24
|
-
|
|
6
|
+
export const NoOpComposerClient = resource(function NoOpComposerClient({
|
|
7
|
+
type,
|
|
8
|
+
}: {
|
|
9
|
+
type: "edit" | "thread";
|
|
10
|
+
}): ClientOutput<"composer"> {
|
|
11
|
+
const state = useMemo<ComposerState>(() => {
|
|
25
12
|
return {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
clearAttachments: () => {
|
|
40
|
-
throw new Error("Not supported");
|
|
41
|
-
},
|
|
42
|
-
attachment: () => {
|
|
43
|
-
throw new Error("Not supported");
|
|
44
|
-
},
|
|
45
|
-
reset: () => {
|
|
46
|
-
throw new Error("Not supported");
|
|
47
|
-
},
|
|
48
|
-
send: () => {
|
|
49
|
-
throw new Error("Not supported");
|
|
50
|
-
},
|
|
51
|
-
cancel: () => {
|
|
52
|
-
throw new Error("Not supported");
|
|
53
|
-
},
|
|
54
|
-
startDictation: () => {
|
|
55
|
-
throw new Error("Not supported");
|
|
56
|
-
},
|
|
57
|
-
stopDictation: () => {
|
|
58
|
-
throw new Error("Not supported");
|
|
59
|
-
},
|
|
60
|
-
beginEdit: () => {
|
|
61
|
-
throw new Error("Not supported");
|
|
62
|
-
},
|
|
63
|
-
setQuote: () => {
|
|
64
|
-
throw new Error("Not supported");
|
|
65
|
-
},
|
|
66
|
-
queueItem: () => {
|
|
67
|
-
throw new Error("Not supported");
|
|
68
|
-
},
|
|
13
|
+
isEditing: false,
|
|
14
|
+
isEmpty: true,
|
|
15
|
+
text: "",
|
|
16
|
+
attachmentAccept: "*",
|
|
17
|
+
attachments: [],
|
|
18
|
+
role: "user",
|
|
19
|
+
runConfig: {},
|
|
20
|
+
canCancel: false,
|
|
21
|
+
canSend: false,
|
|
22
|
+
type: type,
|
|
23
|
+
dictation: undefined,
|
|
24
|
+
quote: undefined,
|
|
25
|
+
queue: [],
|
|
69
26
|
};
|
|
70
|
-
},
|
|
71
|
-
|
|
27
|
+
}, [type]);
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
getState: () => state,
|
|
31
|
+
setText: () => {
|
|
32
|
+
throw new Error("Not supported");
|
|
33
|
+
},
|
|
34
|
+
setRole: () => {
|
|
35
|
+
throw new Error("Not supported");
|
|
36
|
+
},
|
|
37
|
+
setRunConfig: () => {
|
|
38
|
+
throw new Error("Not supported");
|
|
39
|
+
},
|
|
40
|
+
addAttachment: () => {
|
|
41
|
+
throw new Error("Not supported");
|
|
42
|
+
},
|
|
43
|
+
clearAttachments: () => {
|
|
44
|
+
throw new Error("Not supported");
|
|
45
|
+
},
|
|
46
|
+
attachment: () => {
|
|
47
|
+
throw new Error("Not supported");
|
|
48
|
+
},
|
|
49
|
+
reset: () => {
|
|
50
|
+
throw new Error("Not supported");
|
|
51
|
+
},
|
|
52
|
+
send: () => {
|
|
53
|
+
throw new Error("Not supported");
|
|
54
|
+
},
|
|
55
|
+
cancel: () => {
|
|
56
|
+
throw new Error("Not supported");
|
|
57
|
+
},
|
|
58
|
+
startDictation: () => {
|
|
59
|
+
throw new Error("Not supported");
|
|
60
|
+
},
|
|
61
|
+
stopDictation: () => {
|
|
62
|
+
throw new Error("Not supported");
|
|
63
|
+
},
|
|
64
|
+
beginEdit: () => {
|
|
65
|
+
throw new Error("Not supported");
|
|
66
|
+
},
|
|
67
|
+
setQuote: () => {
|
|
68
|
+
throw new Error("Not supported");
|
|
69
|
+
},
|
|
70
|
+
queueItem: () => {
|
|
71
|
+
throw new Error("Not supported");
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useResource, resource } from "@assistant-ui/tap";
|
|
2
3
|
import type { AssistantRuntime } from "../../runtime/api/assistant-runtime";
|
|
3
4
|
import { ThreadListClient } from "../runtime-clients/thread-list-runtime-client";
|
|
4
5
|
import {
|
|
5
|
-
|
|
6
|
+
useAssistantClientRef,
|
|
6
7
|
Derived,
|
|
7
8
|
type ScopesConfig,
|
|
8
9
|
type AssistantClient,
|
|
@@ -10,16 +11,18 @@ import {
|
|
|
10
11
|
import { ModelContext } from "./model-context-client";
|
|
11
12
|
import { Suggestions } from "./suggestions";
|
|
12
13
|
|
|
13
|
-
export const RuntimeAdapterResource = resource((
|
|
14
|
-
|
|
14
|
+
export const RuntimeAdapterResource = resource(function RuntimeAdapterResource(
|
|
15
|
+
runtime: AssistantRuntime,
|
|
16
|
+
) {
|
|
17
|
+
const clientRef = useAssistantClientRef();
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
useEffect(() => {
|
|
17
20
|
return runtime.registerModelContextProvider(
|
|
18
21
|
clientRef.current!.modelContext(),
|
|
19
22
|
);
|
|
20
23
|
}, [runtime, clientRef]);
|
|
21
24
|
|
|
22
|
-
return
|
|
25
|
+
return useResource(
|
|
23
26
|
ThreadListClient({
|
|
24
27
|
runtime: runtime.threads,
|
|
25
28
|
__internal_assistantRuntime: runtime,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { resource, withKey } from "@assistant-ui/tap";
|
|
2
3
|
import type { ClientOutput } from "@assistant-ui/store";
|
|
3
|
-
import {
|
|
4
|
+
import { useClientLookup } from "@assistant-ui/store";
|
|
4
5
|
import type { SuggestionsState } from "../scopes/suggestions";
|
|
5
6
|
import type { SuggestionState } from "../scopes/suggestion";
|
|
6
7
|
|
|
@@ -8,53 +9,53 @@ export type SuggestionConfig =
|
|
|
8
9
|
| string
|
|
9
10
|
| { title: string; label: string; prompt: string };
|
|
10
11
|
|
|
11
|
-
const SuggestionClient = resource(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
);
|
|
12
|
+
const SuggestionClient = resource(function SuggestionClient(
|
|
13
|
+
state: SuggestionState,
|
|
14
|
+
): ClientOutput<"suggestion"> {
|
|
15
|
+
return {
|
|
16
|
+
getState: () => state,
|
|
17
|
+
};
|
|
18
|
+
});
|
|
18
19
|
|
|
19
|
-
const SuggestionsResource = resource(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
title: s,
|
|
26
|
-
label: "",
|
|
27
|
-
prompt: s,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
20
|
+
const SuggestionsResource = resource(function SuggestionsResource(
|
|
21
|
+
suggestions?: SuggestionConfig[],
|
|
22
|
+
): ClientOutput<"suggestions"> {
|
|
23
|
+
const [state] = useState<SuggestionsState>(() => {
|
|
24
|
+
const normalizedSuggestions = (suggestions ?? []).map((s) => {
|
|
25
|
+
if (typeof s === "string") {
|
|
30
26
|
return {
|
|
31
|
-
title: s
|
|
32
|
-
label:
|
|
33
|
-
prompt: s
|
|
27
|
+
title: s,
|
|
28
|
+
label: "",
|
|
29
|
+
prompt: s,
|
|
34
30
|
};
|
|
35
|
-
}
|
|
36
|
-
|
|
31
|
+
}
|
|
37
32
|
return {
|
|
38
|
-
|
|
33
|
+
title: s.title,
|
|
34
|
+
label: s.label,
|
|
35
|
+
prompt: s.prompt,
|
|
39
36
|
};
|
|
40
37
|
});
|
|
41
38
|
|
|
42
|
-
const suggestionClients = tapClientLookup(
|
|
43
|
-
() =>
|
|
44
|
-
state.suggestions.map((suggestion, index) =>
|
|
45
|
-
withKey(index, SuggestionClient(suggestion)),
|
|
46
|
-
),
|
|
47
|
-
[state.suggestions],
|
|
48
|
-
);
|
|
49
|
-
|
|
50
39
|
return {
|
|
51
|
-
|
|
52
|
-
suggestion: ({ index }: { index: number }) => {
|
|
53
|
-
return suggestionClients.get({ index });
|
|
54
|
-
},
|
|
40
|
+
suggestions: normalizedSuggestions,
|
|
55
41
|
};
|
|
56
|
-
}
|
|
57
|
-
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const suggestionClients = useClientLookup(
|
|
45
|
+
() =>
|
|
46
|
+
state.suggestions.map((suggestion, index) =>
|
|
47
|
+
withKey(index, SuggestionClient(suggestion)),
|
|
48
|
+
),
|
|
49
|
+
[state.suggestions],
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
getState: () => state,
|
|
54
|
+
suggestion: ({ index }: { index: number }) => {
|
|
55
|
+
return suggestionClients.get({ index });
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
});
|
|
58
59
|
|
|
59
60
|
export const Suggestions: {
|
|
60
61
|
(): import("@assistant-ui/tap").ResourceElement<
|
|
@@ -4,49 +4,46 @@ import type {
|
|
|
4
4
|
ThreadMessage,
|
|
5
5
|
} from "../../types/message";
|
|
6
6
|
import type { Attachment } from "../../types/attachment";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
tapMemo,
|
|
10
|
-
tapState,
|
|
11
|
-
tapResource,
|
|
12
|
-
withKey,
|
|
13
|
-
} from "@assistant-ui/tap";
|
|
7
|
+
import { useMemo, useState } from "react";
|
|
8
|
+
import { useResource, resource, withKey } from "@assistant-ui/tap";
|
|
14
9
|
import type { ClientOutput } from "@assistant-ui/store";
|
|
15
|
-
import {
|
|
10
|
+
import { useClientLookup } from "@assistant-ui/store";
|
|
16
11
|
import type { MessageState } from "../scopes/message";
|
|
17
12
|
import type { PartState } from "../scopes/part";
|
|
18
13
|
import { NoOpComposerClient } from "./no-op-composer-client";
|
|
19
14
|
|
|
20
|
-
const ThreadMessagePartClient = resource(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const state = tapMemo<PartState>(() => {
|
|
27
|
-
return {
|
|
28
|
-
...part,
|
|
29
|
-
status: { type: "complete" },
|
|
30
|
-
};
|
|
31
|
-
}, [part]);
|
|
32
|
-
|
|
15
|
+
const ThreadMessagePartClient = resource(function ThreadMessagePartClient({
|
|
16
|
+
part,
|
|
17
|
+
}: {
|
|
18
|
+
part: ThreadAssistantMessagePart | ThreadUserMessagePart;
|
|
19
|
+
}): ClientOutput<"part"> {
|
|
20
|
+
const state = useMemo<PartState>(() => {
|
|
33
21
|
return {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
throw new Error("Not supported");
|
|
37
|
-
},
|
|
38
|
-
resumeToolCall: () => {
|
|
39
|
-
throw new Error("Not supported");
|
|
40
|
-
},
|
|
41
|
-
respondToToolApproval: () => {
|
|
42
|
-
throw new Error("Not supported");
|
|
43
|
-
},
|
|
22
|
+
...part,
|
|
23
|
+
status: { type: "complete" },
|
|
44
24
|
};
|
|
45
|
-
},
|
|
46
|
-
|
|
25
|
+
}, [part]);
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
getState: () => state,
|
|
29
|
+
addToolResult: () => {
|
|
30
|
+
throw new Error("Not supported");
|
|
31
|
+
},
|
|
32
|
+
resumeToolCall: () => {
|
|
33
|
+
throw new Error("Not supported");
|
|
34
|
+
},
|
|
35
|
+
respondToToolApproval: () => {
|
|
36
|
+
throw new Error("Not supported");
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
});
|
|
47
40
|
|
|
48
41
|
const ThreadMessageAttachmentClient = resource(
|
|
49
|
-
({
|
|
42
|
+
function ThreadMessageAttachmentClient({
|
|
43
|
+
attachment,
|
|
44
|
+
}: {
|
|
45
|
+
attachment: Attachment;
|
|
46
|
+
}): ClientOutput<"attachment"> {
|
|
50
47
|
return {
|
|
51
48
|
getState: () => attachment,
|
|
52
49
|
remove: () => {
|
|
@@ -63,111 +60,109 @@ export type ThreadMessageClientProps = {
|
|
|
63
60
|
branchCount?: number;
|
|
64
61
|
};
|
|
65
62
|
|
|
66
|
-
export const ThreadMessageClient = resource(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const [isHoveringState, setIsHovering] = tapState(false);
|
|
63
|
+
export const ThreadMessageClient = resource(function ThreadMessageClient({
|
|
64
|
+
message,
|
|
65
|
+
index,
|
|
66
|
+
isLast = true,
|
|
67
|
+
branchNumber = 1,
|
|
68
|
+
branchCount = 1,
|
|
69
|
+
}: ThreadMessageClientProps): ClientOutput<"message"> {
|
|
70
|
+
const [isCopiedState, setIsCopied] = useState(false);
|
|
71
|
+
const [isHoveringState, setIsHovering] = useState(false);
|
|
76
72
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
),
|
|
73
|
+
const parts = useClientLookup(
|
|
74
|
+
() =>
|
|
75
|
+
message.content.map((part, idx) =>
|
|
76
|
+
withKey(
|
|
77
|
+
"toolCallId" in part && part.toolCallId != null
|
|
78
|
+
? `toolCallId-${part.toolCallId}`
|
|
79
|
+
: `index-${idx}`,
|
|
80
|
+
ThreadMessagePartClient({ part }),
|
|
86
81
|
),
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
),
|
|
83
|
+
[message.content],
|
|
84
|
+
);
|
|
89
85
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
const attachments = useClientLookup(
|
|
87
|
+
() =>
|
|
88
|
+
(message.attachments ?? []).map((attachment) =>
|
|
89
|
+
withKey(attachment.id, ThreadMessageAttachmentClient({ attachment })),
|
|
90
|
+
),
|
|
91
|
+
[message.attachments],
|
|
92
|
+
);
|
|
97
93
|
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
const composer = useResource(NoOpComposerClient({ type: "edit" }));
|
|
95
|
+
const composerState = composer.getState();
|
|
100
96
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
index,
|
|
108
|
-
isLast,
|
|
109
|
-
branchNumber,
|
|
110
|
-
branchCount,
|
|
111
|
-
speech: undefined,
|
|
112
|
-
isCopied: isCopiedState,
|
|
113
|
-
isHovering: isHoveringState,
|
|
114
|
-
};
|
|
115
|
-
}, [
|
|
116
|
-
message,
|
|
97
|
+
const state = useMemo<MessageState>(() => {
|
|
98
|
+
return {
|
|
99
|
+
...message,
|
|
100
|
+
parts: parts.state,
|
|
101
|
+
composer: composerState,
|
|
102
|
+
parentId: null,
|
|
117
103
|
index,
|
|
118
|
-
isCopiedState,
|
|
119
|
-
isHoveringState,
|
|
120
104
|
isLast,
|
|
121
|
-
parts.state,
|
|
122
|
-
composerState,
|
|
123
105
|
branchNumber,
|
|
124
106
|
branchCount,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
getState: () => state,
|
|
129
|
-
composer: () => composer,
|
|
130
|
-
part: (selector) => {
|
|
131
|
-
if ("index" in selector) {
|
|
132
|
-
return parts.get({ index: selector.index });
|
|
133
|
-
} else {
|
|
134
|
-
return parts.get({ key: `toolCallId-${selector.toolCallId}` });
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
attachment: (selector) => {
|
|
138
|
-
if ("id" in selector) {
|
|
139
|
-
return attachments.get({ key: selector.id });
|
|
140
|
-
} else {
|
|
141
|
-
return attachments.get(selector);
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
reload: () => {
|
|
145
|
-
throw new Error("Not supported in ThreadMessageProvider");
|
|
146
|
-
},
|
|
147
|
-
speak: () => {
|
|
148
|
-
throw new Error("Not supported in ThreadMessageProvider");
|
|
149
|
-
},
|
|
150
|
-
stopSpeaking: () => {
|
|
151
|
-
throw new Error("Not supported in ThreadMessageProvider");
|
|
152
|
-
},
|
|
153
|
-
submitFeedback: () => {
|
|
154
|
-
throw new Error("Not supported in ThreadMessageProvider");
|
|
155
|
-
},
|
|
156
|
-
switchToBranch: () => {
|
|
157
|
-
throw new Error("Not supported in ThreadMessageProvider");
|
|
158
|
-
},
|
|
159
|
-
getCopyText: () => {
|
|
160
|
-
return message.content
|
|
161
|
-
.map((part) => {
|
|
162
|
-
if ("text" in part && typeof part.text === "string") {
|
|
163
|
-
return part.text;
|
|
164
|
-
}
|
|
165
|
-
return "";
|
|
166
|
-
})
|
|
167
|
-
.join("\n");
|
|
168
|
-
},
|
|
169
|
-
setIsCopied,
|
|
170
|
-
setIsHovering,
|
|
107
|
+
speech: undefined,
|
|
108
|
+
isCopied: isCopiedState,
|
|
109
|
+
isHovering: isHoveringState,
|
|
171
110
|
};
|
|
172
|
-
},
|
|
173
|
-
|
|
111
|
+
}, [
|
|
112
|
+
message,
|
|
113
|
+
index,
|
|
114
|
+
isCopiedState,
|
|
115
|
+
isHoveringState,
|
|
116
|
+
isLast,
|
|
117
|
+
parts.state,
|
|
118
|
+
composerState,
|
|
119
|
+
branchNumber,
|
|
120
|
+
branchCount,
|
|
121
|
+
]);
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
getState: () => state,
|
|
125
|
+
composer: () => composer,
|
|
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
|
+
attachment: (selector) => {
|
|
134
|
+
if ("id" in selector) {
|
|
135
|
+
return attachments.get({ key: selector.id });
|
|
136
|
+
} else {
|
|
137
|
+
return attachments.get(selector);
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
reload: () => {
|
|
141
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
142
|
+
},
|
|
143
|
+
speak: () => {
|
|
144
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
145
|
+
},
|
|
146
|
+
stopSpeaking: () => {
|
|
147
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
148
|
+
},
|
|
149
|
+
submitFeedback: () => {
|
|
150
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
151
|
+
},
|
|
152
|
+
switchToBranch: () => {
|
|
153
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
154
|
+
},
|
|
155
|
+
getCopyText: () => {
|
|
156
|
+
return message.content
|
|
157
|
+
.map((part) => {
|
|
158
|
+
if ("text" in part && typeof part.text === "string") {
|
|
159
|
+
return part.text;
|
|
160
|
+
}
|
|
161
|
+
return "";
|
|
162
|
+
})
|
|
163
|
+
.join("\n");
|
|
164
|
+
},
|
|
165
|
+
setIsCopied,
|
|
166
|
+
setIsHovering,
|
|
167
|
+
};
|
|
168
|
+
});
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { resource } from "@assistant-ui/tap";
|
|
2
2
|
import type { ClientOutput } from "@assistant-ui/store";
|
|
3
3
|
import type { AttachmentRuntime } from "../../runtime/api/attachment-runtime";
|
|
4
|
-
import {
|
|
4
|
+
import { useSubscribable } from "./useSubscribable";
|
|
5
5
|
|
|
6
6
|
export const AttachmentRuntimeClient = resource(
|
|
7
|
-
({
|
|
8
|
-
|
|
7
|
+
function AttachmentRuntimeClient({
|
|
8
|
+
runtime,
|
|
9
|
+
}: {
|
|
10
|
+
runtime: AttachmentRuntime;
|
|
11
|
+
}): ClientOutput<"attachment"> {
|
|
12
|
+
const state = useSubscribable(runtime);
|
|
9
13
|
|
|
10
14
|
return {
|
|
11
15
|
getState: () => state,
|