@assistant-ui/core 0.2.22 → 0.3.0
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/thread-history.d.ts +8 -0
- package/dist/adapters/thread-history.d.ts.map +1 -1
- package/dist/internal.d.ts +3 -2
- package/dist/internal.js +3 -2
- package/dist/model-context/frame/host.d.ts.map +1 -1
- package/dist/model-context/frame/host.js +36 -21
- package/dist/model-context/frame/host.js.map +1 -1
- package/dist/model-context/types.d.ts.map +1 -1
- package/dist/model-context/types.js +13 -4
- package/dist/model-context/types.js.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js +3 -2
- package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
- package/dist/react/client/Tools.d.ts.map +1 -1
- package/dist/react/client/Tools.js +40 -55
- package/dist/react/client/Tools.js.map +1 -1
- package/dist/react/client/interactable-model-context.js +1 -0
- package/dist/react/client/interactable-model-context.js.map +1 -1
- package/dist/react/interactables-legacy/useAssistantInteractable.js +1 -1
- package/dist/react/interactables-legacy/useAssistantInteractable.js.map +1 -1
- package/dist/react/interactables-legacy/useInteractableState.js +4 -3
- package/dist/react/interactables-legacy/useInteractableState.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/useAssistantTool.js +29 -25
- 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/useInteractable.js +1 -1
- package/dist/react/model-context/useInteractable.js.map +1 -1
- package/dist/react/model-context/useInteractableState.js +3 -2
- package/dist/react/model-context/useInteractableState.js.map +1 -1
- package/dist/react/model-context/useInteractableVersions.js +1 -0
- package/dist/react/model-context/useInteractableVersions.js.map +1 -1
- package/dist/react/model-context/useToolArgsStatus.js +1 -0
- package/dist/react/model-context/useToolArgsStatus.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.js +4 -3
- package/dist/react/primitive-hooks/useActionBarCopy.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.js +2 -1
- package/dist/react/primitive-hooks/useActionBarEdit.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.js +3 -2
- package/dist/react/primitive-hooks/useActionBarFeedback.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.js +2 -1
- package/dist/react/primitive-hooks/useActionBarReload.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.js +2 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.js +2 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.js +2 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js +2 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.js +2 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.js +2 -1
- package/dist/react/primitive-hooks/useComposerCancel.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.js +2 -1
- package/dist/react/primitive-hooks/useComposerDictate.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.js +2 -1
- package/dist/react/primitive-hooks/useComposerSend.js.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.js +2 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.js.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.js +2 -1
- package/dist/react/primitive-hooks/useEditComposerSend.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.js +3 -2
- package/dist/react/primitive-hooks/useMessageBranching.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageReload.js +2 -1
- package/dist/react/primitive-hooks/useMessageReload.js.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.js +8 -7
- package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.js +2 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.js +2 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.js +2 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.js +2 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.js +2 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.js +2 -1
- package/dist/react/primitive-hooks/useThreadListNew.js.map +1 -1
- package/dist/react/primitive-hooks/useVoice.js +5 -13
- package/dist/react/primitive-hooks/useVoice.js.map +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.d.ts.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/message/MessageAttachments.d.ts.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/MessageParts.js +84 -122
- package/dist/react/primitives/message/MessageParts.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 +2 -2
- package/dist/react/providers/AttachmentByIndexProvider.js.map +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.js +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.js.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js +30 -18
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js.map +1 -1
- package/dist/react/providers/MessageByIdProvider.js +2 -2
- package/dist/react/providers/MessageByIdProvider.js.map +1 -1
- package/dist/react/providers/MessageByIndexProvider.js +2 -2
- package/dist/react/providers/MessageByIndexProvider.js.map +1 -1
- package/dist/react/providers/PartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/PartByIndexProvider.js +30 -18
- package/dist/react/providers/PartByIndexProvider.js.map +1 -1
- package/dist/react/providers/QueueItemByIndexProvider.js +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 +1 -1
- package/dist/react/providers/SuggestionByIndexProvider.js.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.js +1 -0
- package/dist/react/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.js +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +3 -3
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +6 -4
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts +31 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +42 -20
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.d.ts +12 -1
- package/dist/react/runtimes/cloud/auiV0.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.js +2 -1
- package/dist/react/runtimes/cloud/auiV0.js.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js +75 -73
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js.map +1 -1
- package/dist/react/runtimes/createRuntimeExtras.js +1 -1
- package/dist/react/runtimes/createRuntimeExtras.js.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/useExternalStoreSharedOptions.js +1 -0
- package/dist/react/runtimes/useExternalStoreSharedOptions.js.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.d.ts +0 -1
- package/dist/react/runtimes/useLocalRuntime.d.ts.map +1 -1
- package/dist/react/types/scopes/tools.d.ts +0 -6
- package/dist/react/types/scopes/tools.d.ts.map +1 -1
- package/dist/react/utils/groupParts.d.ts +1 -3
- package/dist/react/utils/groupParts.d.ts.map +1 -1
- package/dist/react/utils/groupParts.js +1 -3
- package/dist/react/utils/groupParts.js.map +1 -1
- package/dist/runtime/api/assistant-runtime.d.ts +1 -1
- package/dist/runtime/api/assistant-runtime.d.ts.map +1 -1
- package/dist/runtime/api/assistant-runtime.js +1 -1
- package/dist/runtime/api/assistant-runtime.js.map +1 -1
- package/dist/runtime/api/attachment-runtime.d.ts +1 -1
- package/dist/runtime/api/attachment-runtime.d.ts.map +1 -1
- package/dist/runtime/api/attachment-runtime.js +1 -1
- package/dist/runtime/api/attachment-runtime.js.map +1 -1
- package/dist/runtime/api/composer-runtime.d.ts +2 -2
- package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.js +2 -2
- package/dist/runtime/api/composer-runtime.js.map +1 -1
- package/dist/runtime/api/message-part-runtime.d.ts +4 -4
- package/dist/runtime/api/message-part-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-part-runtime.js +3 -3
- package/dist/runtime/api/message-part-runtime.js.map +1 -1
- package/dist/runtime/api/message-runtime.d.ts +1 -1
- package/dist/runtime/api/message-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-runtime.js +2 -2
- package/dist/runtime/api/message-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.d.ts +1 -1
- package/dist/runtime/api/thread-list-item-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.js +2 -2
- package/dist/runtime/api/thread-list-item-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-runtime.d.ts +1 -1
- package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-runtime.js +1 -1
- package/dist/runtime/api/thread-list-runtime.js.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.d.ts +1 -1
- package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts +2 -2
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.js +2 -2
- package/dist/runtime/base/default-edit-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
- package/dist/runtime/utils/message-repository.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository.js +4 -2
- package/dist/runtime/utils/message-repository.js.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js.map +1 -1
- 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 +12 -0
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/internal.d.ts +2 -1
- package/dist/runtimes/internal.js +2 -1
- package/dist/runtimes/local/local-thread-runtime-core.d.ts +3 -0
- package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.js +44 -13
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts +32 -27
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js +2 -0
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js.map +1 -1
- package/dist/store/clients/no-op-composer-client.js +1 -0
- package/dist/store/clients/no-op-composer-client.js.map +1 -1
- package/dist/store/clients/runtime-adapter.js +3 -3
- package/dist/store/clients/runtime-adapter.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.js +1 -0
- 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 +17 -15
- package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
- package/dist/store/scopes/thread.d.ts +1 -0
- package/dist/store/scopes/thread.d.ts.map +1 -1
- package/dist/subscribable/subscribable.d.ts +3 -3
- package/dist/subscribable/subscribable.d.ts.map +1 -1
- package/dist/subscribable/subscribable.js +3 -3
- package/dist/subscribable/subscribable.js.map +1 -1
- package/package.json +8 -8
- package/src/adapters/thread-history.ts +8 -0
- package/src/internal.ts +1 -1
- package/src/model-context/frame/host.test.ts +47 -0
- package/src/model-context/frame/host.ts +46 -19
- package/src/model-context/types.ts +16 -6
- package/src/react/adapters/LocalStorageThreadListAdapter.tsx +17 -7
- package/src/react/client/Tools.ts +0 -7
- package/src/react/interactables-legacy/useAssistantInteractable.ts +1 -1
- package/src/react/interactables-legacy/useInteractableState.ts +3 -3
- package/src/react/model-context/useAssistantContext.ts +1 -1
- package/src/react/model-context/useAssistantDataUI.ts +1 -1
- package/src/react/model-context/useAssistantInstructions.ts +1 -1
- package/src/react/model-context/useAssistantTool.ts +2 -2
- package/src/react/model-context/useAssistantToolUI.ts +1 -1
- package/src/react/model-context/useAuiToolOverrides.ts +1 -1
- package/src/react/model-context/useInteractable.ts +1 -1
- package/src/react/model-context/useInteractableState.ts +2 -2
- package/src/react/primitive-hooks/useActionBarCopy.test.ts +2 -2
- package/src/react/primitive-hooks/useActionBarCopy.ts +3 -3
- package/src/react/primitive-hooks/useActionBarEdit.ts +1 -1
- package/src/react/primitive-hooks/useActionBarFeedback.ts +2 -2
- package/src/react/primitive-hooks/useActionBarReload.ts +1 -1
- package/src/react/primitive-hooks/useActionBarSpeak.ts +1 -1
- package/src/react/primitive-hooks/useActionBarStopSpeaking.ts +1 -1
- package/src/react/primitive-hooks/useBranchPickerNext.ts +1 -1
- package/src/react/primitive-hooks/useBranchPickerPrevious.ts +1 -1
- package/src/react/primitive-hooks/useComposerAddAttachment.ts +1 -1
- package/src/react/primitive-hooks/useComposerCancel.ts +1 -1
- package/src/react/primitive-hooks/useComposerDictate.ts +1 -1
- package/src/react/primitive-hooks/useComposerSend.ts +1 -1
- package/src/react/primitive-hooks/useEditComposerCancel.ts +1 -1
- package/src/react/primitive-hooks/useEditComposerSend.ts +1 -1
- package/src/react/primitive-hooks/useMessageBranching.ts +2 -2
- package/src/react/primitive-hooks/useMessageReload.ts +1 -1
- package/src/react/primitive-hooks/useSuggestionTrigger.ts +9 -9
- package/src/react/primitive-hooks/useThreadListItemArchive.ts +1 -1
- package/src/react/primitive-hooks/useThreadListItemDelete.ts +1 -1
- package/src/react/primitive-hooks/useThreadListItemTrigger.ts +1 -1
- package/src/react/primitive-hooks/useThreadListItemUnarchive.ts +1 -1
- package/src/react/primitive-hooks/useThreadListLoadMore.ts +1 -1
- package/src/react/primitive-hooks/useThreadListNew.ts +1 -1
- package/src/react/primitive-hooks/useVoice.ts +5 -5
- package/src/react/primitives/chainOfThought/ChainOfThoughtParts.tsx +1 -1
- package/src/react/primitives/composer/ComposerAttachments.tsx +1 -1
- package/src/react/primitives/composer/ComposerQueue.tsx +1 -3
- package/src/react/primitives/message/MessageAttachments.tsx +1 -3
- package/src/react/primitives/message/MessageParts.tsx +9 -9
- package/src/react/primitives/thread/ThreadMessages.tsx +1 -1
- package/src/react/primitives/thread/ThreadSuggestions.tsx +1 -1
- package/src/react/primitives/threadList/ThreadListItems.tsx +1 -1
- package/src/react/providers/AttachmentByIndexProvider.tsx +2 -2
- package/src/react/providers/ChainOfThoughtByIndicesProvider.tsx +1 -1
- package/src/react/providers/ChainOfThoughtPartByIndexProvider.tsx +2 -19
- package/src/react/providers/MessageByIdProvider.tsx +2 -2
- package/src/react/providers/MessageByIndexProvider.tsx +2 -2
- package/src/react/providers/PartByIndexProvider.tsx +2 -16
- package/src/react/providers/QueueItemByIndexProvider.tsx +1 -1
- package/src/react/providers/ReadonlyThreadProvider.tsx +1 -1
- package/src/react/providers/SuggestionByIndexProvider.tsx +1 -1
- package/src/react/providers/ThreadListItemByIndexProvider.tsx +1 -1
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.tsx +3 -3
- package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +20 -6
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.ts +34 -0
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.tsx +32 -7
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.ts +47 -16
- package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.ts +5 -1
- package/src/react/runtimes/cloud/auiV0.ts +14 -0
- package/src/react/runtimes/cloud/useCloudThreadListAdapter.tsx +90 -88
- package/src/react/runtimes/createRuntimeExtras.test.ts +1 -1
- package/src/react/runtimes/createRuntimeExtras.ts +1 -1
- package/src/react/runtimes/external-message-converter.test.ts +346 -0
- package/src/react/runtimes/external-message-converter.ts +1 -1
- package/src/react/runtimes/useLocalRuntime.test.tsx +43 -0
- package/src/react/types/scopes/tools.ts +0 -6
- package/src/react/utils/groupParts.ts +1 -7
- package/src/runtime/api/assistant-runtime.ts +4 -1
- package/src/runtime/api/attachment-runtime.ts +8 -2
- package/src/runtime/api/composer-runtime.ts +9 -5
- package/src/runtime/api/message-part-runtime.ts +10 -3
- package/src/runtime/api/message-runtime.ts +7 -2
- package/src/runtime/api/thread-list-item-runtime.ts +7 -2
- package/src/runtime/api/thread-list-runtime.ts +10 -2
- package/src/runtime/base/base-thread-runtime-core.ts +5 -1
- package/src/runtime/base/default-edit-composer-runtime-core.ts +14 -2
- package/src/runtime/base/default-thread-composer-runtime-core.ts +11 -1
- package/src/runtime/utils/message-repository.ts +19 -13
- package/src/runtimes/external-store/external-store-thread-list-runtime-core.ts +4 -1
- package/src/runtimes/external-store/external-store-thread-runtime-core.ts +15 -0
- package/src/runtimes/internal.ts +3 -0
- package/src/runtimes/local/local-thread-runtime-core.test.ts +596 -0
- package/src/runtimes/local/local-thread-runtime-core.ts +85 -21
- package/src/runtimes/local/should-continue.test.ts +122 -0
- package/src/runtimes/tool-invocations/ToolInvocationTracker.test.ts +9 -10
- package/src/runtimes/tool-invocations/ToolInvocationTracker.ts +38 -32
- package/src/store/clients/model-context-client.test.ts +21 -1
- package/src/store/clients/runtime-adapter.ts +3 -3
- package/src/store/runtime-clients/thread-runtime-client.ts +2 -1
- package/src/store/scopes/thread.ts +1 -0
- package/src/subscribable/subscribable.ts +16 -8
- package/src/tests/MessageRepository.test.ts +12 -0
- package/src/tests/RemoteThreadListThreadListRuntimeCore-switchToThread-position.test.ts +121 -0
- package/src/tests/auiV0Encode.test.ts +74 -0
- package/src/tests/base-composer-runtime-core.test.ts +422 -0
- package/src/tests/external-store-thread-list-runtime-core.test.ts +6 -6
- package/src/tests/external-store-thread-runtime-core-adapter.test.ts +575 -0
- package/src/tests/external-store-thread-runtime-core.test.ts +55 -1
- package/src/tests/groupParts.test.ts +3 -48
- package/src/tests/OptimisticState-delete-crash.test.ts +0 -208
|
@@ -6,20 +6,22 @@ import { describe, expect, it, vi } from "vitest";
|
|
|
6
6
|
import { useAssistantCloudThreadHistoryAdapter } from "./AssistantCloudThreadHistoryAdapter";
|
|
7
7
|
|
|
8
8
|
const mocks = vi.hoisted(() => {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const makeClient = (remoteId: string) =>
|
|
10
|
+
({
|
|
11
|
+
threadListItem: {
|
|
12
|
+
getState: () => ({ remoteId }),
|
|
13
|
+
},
|
|
14
|
+
}) as unknown as import("@assistant-ui/store").AssistantClient;
|
|
12
15
|
|
|
13
16
|
return {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
+
makeClient,
|
|
18
|
+
aui: makeClient("thread-1"),
|
|
17
19
|
};
|
|
18
20
|
});
|
|
19
21
|
|
|
20
22
|
vi.mock("@assistant-ui/store", async (importOriginal) => ({
|
|
21
23
|
...(await importOriginal<typeof import("@assistant-ui/store")>()),
|
|
22
|
-
useAui: () => mocks.
|
|
24
|
+
useAui: () => mocks.aui,
|
|
23
25
|
}));
|
|
24
26
|
|
|
25
27
|
const makeCloud = () =>
|
|
@@ -33,6 +35,7 @@ const makeCloud = () =>
|
|
|
33
35
|
|
|
34
36
|
describe("useAssistantCloudThreadHistoryAdapter", () => {
|
|
35
37
|
it("refreshes formatted persistence when the Cloud client changes", async () => {
|
|
38
|
+
mocks.aui = mocks.makeClient("thread-1");
|
|
36
39
|
const firstCloud = makeCloud();
|
|
37
40
|
const secondCloud = makeCloud();
|
|
38
41
|
const cloudRef = { current: firstCloud };
|
|
@@ -66,4 +69,26 @@ describe("useAssistantCloudThreadHistoryAdapter", () => {
|
|
|
66
69
|
format: "test",
|
|
67
70
|
});
|
|
68
71
|
});
|
|
72
|
+
|
|
73
|
+
it("resolves the aui client at call time instead of capturing it", async () => {
|
|
74
|
+
mocks.aui = mocks.makeClient("thread-1");
|
|
75
|
+
const cloud = makeCloud();
|
|
76
|
+
const cloudRef = { current: cloud };
|
|
77
|
+
const { result, rerender } = renderHook(() =>
|
|
78
|
+
useAssistantCloudThreadHistoryAdapter(cloudRef),
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
await result.current.load();
|
|
82
|
+
expect(cloud.threads.messages.list).toHaveBeenCalledWith("thread-1", {
|
|
83
|
+
format: "aui/v0",
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
mocks.aui = mocks.makeClient("thread-2");
|
|
87
|
+
rerender();
|
|
88
|
+
|
|
89
|
+
await result.current.load();
|
|
90
|
+
expect(cloud.threads.messages.list).toHaveBeenCalledWith("thread-2", {
|
|
91
|
+
format: "aui/v0",
|
|
92
|
+
});
|
|
93
|
+
});
|
|
69
94
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type RefObject, useState } from "react";
|
|
1
|
+
import { type RefObject, useEffect, useRef, useState } from "react";
|
|
2
2
|
import type {
|
|
3
3
|
GenericThreadHistoryAdapter,
|
|
4
4
|
ThreadHistoryAdapter,
|
|
@@ -13,22 +13,31 @@ import {
|
|
|
13
13
|
createFormattedPersistence,
|
|
14
14
|
} from "assistant-cloud";
|
|
15
15
|
import { auiV0Decode, auiV0Encode } from "./auiV0";
|
|
16
|
-
import { type AssistantClient, useAui } from "@assistant-ui/store";
|
|
17
|
-
import type { ThreadListItemMethods } from "../../../store/scopes/thread-list-item";
|
|
16
|
+
import { type AssistantClient, getClientId, useAui } from "@assistant-ui/store";
|
|
18
17
|
|
|
19
18
|
const globalPersistence = new WeakMap<
|
|
20
|
-
|
|
19
|
+
getClientId.ClientId,
|
|
21
20
|
CloudMessagePersistence
|
|
22
21
|
>();
|
|
23
22
|
|
|
24
23
|
class AssistantCloudThreadHistoryAdapter implements ThreadHistoryAdapter {
|
|
24
|
+
private cloudRef: RefObject<AssistantCloud>;
|
|
25
|
+
private auiRef: RefObject<AssistantClient>;
|
|
26
|
+
|
|
25
27
|
constructor(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
) {
|
|
28
|
+
cloudRef: RefObject<AssistantCloud>,
|
|
29
|
+
auiRef: RefObject<AssistantClient>,
|
|
30
|
+
) {
|
|
31
|
+
this.cloudRef = cloudRef;
|
|
32
|
+
this.auiRef = auiRef;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private get aui(): AssistantClient {
|
|
36
|
+
return this.auiRef.current;
|
|
37
|
+
}
|
|
29
38
|
|
|
30
39
|
private get _persistence(): CloudMessagePersistence {
|
|
31
|
-
const key = this.aui.threadListItem
|
|
40
|
+
const key = getClientId(this.aui.threadListItem);
|
|
32
41
|
if (!globalPersistence.has(key)) {
|
|
33
42
|
globalPersistence.set(
|
|
34
43
|
key,
|
|
@@ -49,11 +58,11 @@ class AssistantCloudThreadHistoryAdapter implements ThreadHistoryAdapter {
|
|
|
49
58
|
return {
|
|
50
59
|
// Note: callers must also call reportTelemetry() for run tracking
|
|
51
60
|
async append(item: MessageFormatItem<TMessage>) {
|
|
52
|
-
const { remoteId } = await adapter.aui.threadListItem
|
|
61
|
+
const { remoteId } = await adapter.aui.threadListItem.initialize();
|
|
53
62
|
await formatted.append(remoteId, item);
|
|
54
63
|
},
|
|
55
64
|
async update(item: MessageFormatItem<TMessage>, localMessageId: string) {
|
|
56
|
-
const remoteId = adapter.aui.threadListItem
|
|
65
|
+
const remoteId = adapter.aui.threadListItem.getState().remoteId;
|
|
57
66
|
if (!remoteId) return;
|
|
58
67
|
await formatted.update?.(remoteId, item, localMessageId);
|
|
59
68
|
},
|
|
@@ -79,7 +88,7 @@ class AssistantCloudThreadHistoryAdapter implements ThreadHistoryAdapter {
|
|
|
79
88
|
);
|
|
80
89
|
},
|
|
81
90
|
async load(): Promise<MessageFormatRepository<TMessage>> {
|
|
82
|
-
const remoteId = adapter.aui.threadListItem
|
|
91
|
+
const remoteId = adapter.aui.threadListItem.getState().remoteId;
|
|
83
92
|
if (!remoteId) return { messages: [] };
|
|
84
93
|
return formatted.load(remoteId);
|
|
85
94
|
},
|
|
@@ -87,7 +96,7 @@ class AssistantCloudThreadHistoryAdapter implements ThreadHistoryAdapter {
|
|
|
87
96
|
}
|
|
88
97
|
|
|
89
98
|
async append({ parentId, message }: ExportedMessageRepositoryItem) {
|
|
90
|
-
const { remoteId } = await this.aui.threadListItem
|
|
99
|
+
const { remoteId } = await this.aui.threadListItem.initialize();
|
|
91
100
|
const encoded = auiV0Encode(message);
|
|
92
101
|
await this._persistence.append(
|
|
93
102
|
remoteId,
|
|
@@ -102,6 +111,21 @@ class AssistantCloudThreadHistoryAdapter implements ThreadHistoryAdapter {
|
|
|
102
111
|
}
|
|
103
112
|
}
|
|
104
113
|
|
|
114
|
+
async update(item: ExportedMessageRepositoryItem) {
|
|
115
|
+
if (!this._persistence.isPersisted(item.message.id)) {
|
|
116
|
+
return this.append(item);
|
|
117
|
+
}
|
|
118
|
+
const { message } = item;
|
|
119
|
+
const remoteId = this.aui.threadListItem.getState().remoteId;
|
|
120
|
+
if (!remoteId) return;
|
|
121
|
+
const encoded = auiV0Encode(message);
|
|
122
|
+
await this._persistence.update(remoteId, message.id, "aui/v0", encoded);
|
|
123
|
+
|
|
124
|
+
if (this.cloudRef.current.telemetry.enabled) {
|
|
125
|
+
this._maybeReportRun(remoteId, "aui/v0", encoded);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
105
129
|
async delete() {
|
|
106
130
|
throw new Error(
|
|
107
131
|
"Assistant Cloud does not support deleting thread messages yet.",
|
|
@@ -109,7 +133,7 @@ class AssistantCloudThreadHistoryAdapter implements ThreadHistoryAdapter {
|
|
|
109
133
|
}
|
|
110
134
|
|
|
111
135
|
async load() {
|
|
112
|
-
const remoteId = this.aui.threadListItem
|
|
136
|
+
const remoteId = this.aui.threadListItem.getState().remoteId;
|
|
113
137
|
if (!remoteId) return { messages: [] };
|
|
114
138
|
const messages = await this._persistence.load(remoteId, "aui/v0");
|
|
115
139
|
return {
|
|
@@ -132,7 +156,7 @@ class AssistantCloudThreadHistoryAdapter implements ThreadHistoryAdapter {
|
|
|
132
156
|
) {
|
|
133
157
|
if (!this.cloudRef.current.telemetry.enabled) return;
|
|
134
158
|
|
|
135
|
-
const remoteId = this.aui.threadListItem
|
|
159
|
+
const remoteId = this.aui.threadListItem.getState().remoteId;
|
|
136
160
|
if (!remoteId) return;
|
|
137
161
|
|
|
138
162
|
const extracted = extractRunTelemetry(format, runMessages);
|
|
@@ -341,7 +365,7 @@ const AUI_STATUS_MAP: Record<string, TelemetryData["status"]> = {
|
|
|
341
365
|
incomplete: "incomplete",
|
|
342
366
|
};
|
|
343
367
|
|
|
344
|
-
function extractAuiV0<T>(content: T): TelemetryData | null {
|
|
368
|
+
export function extractAuiV0<T>(content: T): TelemetryData | null {
|
|
345
369
|
const msg = content as {
|
|
346
370
|
role?: string;
|
|
347
371
|
status?: { type: string };
|
|
@@ -369,6 +393,9 @@ function extractAuiV0<T>(content: T): TelemetryData | null {
|
|
|
369
393
|
};
|
|
370
394
|
|
|
371
395
|
if (msg.role !== "assistant") return null;
|
|
396
|
+
// A paused (requires-action) write is not a finished run; reporting it would
|
|
397
|
+
// mislabel it "completed" and double-count steps once the terminal write reports.
|
|
398
|
+
if (msg.status?.type === "requires-action") return null;
|
|
372
399
|
|
|
373
400
|
const toolCalls = msg.content
|
|
374
401
|
?.filter((p) => p.type === "tool-call" && p.toolName && p.toolCallId)
|
|
@@ -789,8 +816,12 @@ export function useAssistantCloudThreadHistoryAdapter(
|
|
|
789
816
|
cloudRef: RefObject<AssistantCloud>,
|
|
790
817
|
): ThreadHistoryAdapter {
|
|
791
818
|
const aui = useAui();
|
|
819
|
+
const auiRef = useRef(aui);
|
|
820
|
+
useEffect(() => {
|
|
821
|
+
auiRef.current = aui;
|
|
822
|
+
});
|
|
792
823
|
const [adapter] = useState(
|
|
793
|
-
() => new AssistantCloudThreadHistoryAdapter(cloudRef,
|
|
824
|
+
() => new AssistantCloudThreadHistoryAdapter(cloudRef, auiRef),
|
|
794
825
|
);
|
|
795
826
|
return adapter;
|
|
796
827
|
}
|
|
@@ -19,7 +19,11 @@ const guessAttachmentType = (
|
|
|
19
19
|
export class CloudFileAttachmentAdapter implements AttachmentAdapter {
|
|
20
20
|
public accept = "*";
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
private cloud: AssistantCloud;
|
|
23
|
+
|
|
24
|
+
constructor(cloud: AssistantCloud) {
|
|
25
|
+
this.cloud = cloud;
|
|
26
|
+
}
|
|
23
27
|
|
|
24
28
|
private uploadedUrls = new Map<string, string>();
|
|
25
29
|
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
SourceProviderMetadata,
|
|
7
7
|
ThreadMessage,
|
|
8
8
|
TextMessagePart,
|
|
9
|
+
ToolApprovalOption,
|
|
9
10
|
Unstable_AudioMessagePart,
|
|
10
11
|
} from "../../../types/message";
|
|
11
12
|
import type { CompleteAttachment } from "../../../types/attachment";
|
|
@@ -18,6 +19,16 @@ import type {
|
|
|
18
19
|
} from "assistant-stream/utils";
|
|
19
20
|
import type { ExportedMessageRepositoryItem } from "../../../runtime/utils/message-repository";
|
|
20
21
|
|
|
22
|
+
type AuiV0ToolApproval = {
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly approved?: boolean;
|
|
25
|
+
readonly reason?: string;
|
|
26
|
+
readonly isAutomatic?: boolean;
|
|
27
|
+
readonly options?: readonly ToolApprovalOption[];
|
|
28
|
+
readonly optionId?: string;
|
|
29
|
+
readonly resolution?: "cancelled" | "expired";
|
|
30
|
+
};
|
|
31
|
+
|
|
21
32
|
type AuiV0MessagePart =
|
|
22
33
|
| {
|
|
23
34
|
readonly type: "text";
|
|
@@ -51,6 +62,7 @@ type AuiV0MessagePart =
|
|
|
51
62
|
readonly args: ReadonlyJSONObject;
|
|
52
63
|
readonly result?: ReadonlyJSONValue;
|
|
53
64
|
readonly isError?: true;
|
|
65
|
+
readonly approval?: AuiV0ToolApproval;
|
|
54
66
|
}
|
|
55
67
|
| {
|
|
56
68
|
readonly type: "tool-call";
|
|
@@ -59,6 +71,7 @@ type AuiV0MessagePart =
|
|
|
59
71
|
readonly argsText: string;
|
|
60
72
|
readonly result?: ReadonlyJSONValue;
|
|
61
73
|
readonly isError?: true;
|
|
74
|
+
readonly approval?: AuiV0ToolApproval;
|
|
62
75
|
}
|
|
63
76
|
| {
|
|
64
77
|
readonly type: "image";
|
|
@@ -216,6 +229,7 @@ export function auiV0Encode(message: ThreadMessage): AuiV0Message {
|
|
|
216
229
|
? { result: part.result as ReadonlyJSONValue }
|
|
217
230
|
: undefined),
|
|
218
231
|
...(part.isError ? { isError: true } : undefined),
|
|
232
|
+
...(part.approval ? { approval: part.approval } : undefined),
|
|
219
233
|
};
|
|
220
234
|
}
|
|
221
235
|
|
|
@@ -76,94 +76,96 @@ export const useCloudThreadListAdapter = (
|
|
|
76
76
|
);
|
|
77
77
|
|
|
78
78
|
const cloud = adapter.cloud ?? autoCloud;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return inMemory;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
list: async () => {
|
|
91
|
-
const { threads } = await cloud.threads.list();
|
|
92
|
-
return {
|
|
93
|
-
threads: threads.map((t) => ({
|
|
94
|
-
status: t.is_archived ? "archived" : "regular",
|
|
95
|
-
remoteId: t.id,
|
|
96
|
-
title: t.title,
|
|
97
|
-
lastMessageAt: t.last_message_at
|
|
98
|
-
? new Date(t.last_message_at)
|
|
99
|
-
: undefined,
|
|
100
|
-
externalId: t.external_id ?? undefined,
|
|
101
|
-
custom: toCustom(t.metadata),
|
|
102
|
-
})),
|
|
79
|
+
return useMemo<RemoteThreadListAdapter>(() => {
|
|
80
|
+
if (!cloud) {
|
|
81
|
+
const ref = adapterRef;
|
|
82
|
+
const inMemory = new InMemoryThreadListAdapter();
|
|
83
|
+
inMemory.initialize = async (threadId: string) => {
|
|
84
|
+
const result = await ref.current.create?.();
|
|
85
|
+
return { remoteId: threadId, externalId: result?.externalId };
|
|
103
86
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
)
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
87
|
+
return inMemory;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
list: async () => {
|
|
92
|
+
const { threads } = await cloud.threads.list();
|
|
93
|
+
return {
|
|
94
|
+
threads: threads.map((t) => ({
|
|
95
|
+
status: t.is_archived ? "archived" : "regular",
|
|
96
|
+
remoteId: t.id,
|
|
97
|
+
title: t.title,
|
|
98
|
+
lastMessageAt: t.last_message_at
|
|
99
|
+
? new Date(t.last_message_at)
|
|
100
|
+
: undefined,
|
|
101
|
+
externalId: t.external_id ?? undefined,
|
|
102
|
+
custom: toCustom(t.metadata),
|
|
103
|
+
})),
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
initialize: async () => {
|
|
108
|
+
const createTask = adapterRef.current.create?.() ?? Promise.resolve();
|
|
109
|
+
const t = await createTask;
|
|
110
|
+
const external_id = t ? t.externalId : undefined;
|
|
111
|
+
const { thread_id: remoteId } = await cloud.threads.create({
|
|
112
|
+
last_message_at: new Date(),
|
|
113
|
+
external_id,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
return { externalId: external_id, remoteId: remoteId };
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
rename: async (threadId, newTitle) => {
|
|
120
|
+
return cloud.threads.update(threadId, { title: newTitle });
|
|
121
|
+
},
|
|
122
|
+
updateCustom: async (threadId, custom) => {
|
|
123
|
+
return cloud.threads.update(threadId, { metadata: custom ?? null });
|
|
124
|
+
},
|
|
125
|
+
archive: async (threadId) => {
|
|
126
|
+
return cloud.threads.update(threadId, { is_archived: true });
|
|
127
|
+
},
|
|
128
|
+
unarchive: async (threadId) => {
|
|
129
|
+
return cloud.threads.update(threadId, { is_archived: false });
|
|
130
|
+
},
|
|
131
|
+
delete: async (threadId) => {
|
|
132
|
+
await adapterRef.current.delete?.(threadId);
|
|
133
|
+
return cloud.threads.delete(threadId);
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
generateTitle: async (threadId, messages) => {
|
|
137
|
+
// Filter messages to only include content types the title generator understands
|
|
138
|
+
// (reasoning, source, etc. are not needed for title generation)
|
|
139
|
+
// TODO serialize these to a more efficient format
|
|
140
|
+
const filteredMessages = messages.map((msg) => ({
|
|
141
|
+
...msg,
|
|
142
|
+
content: msg.content.filter(
|
|
143
|
+
(part) => part.type === "text" || part.type === "tool-call",
|
|
144
|
+
),
|
|
145
|
+
}));
|
|
146
|
+
|
|
147
|
+
return cloud.runs.stream({
|
|
148
|
+
thread_id: threadId,
|
|
149
|
+
assistant_id: "system/thread_title",
|
|
150
|
+
messages: filteredMessages,
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
fetch: async (threadId: string) => {
|
|
155
|
+
const thread = await cloud.threads.get(threadId);
|
|
156
|
+
return {
|
|
157
|
+
status: thread.is_archived ? "archived" : "regular",
|
|
158
|
+
remoteId: thread.id,
|
|
159
|
+
title: thread.title,
|
|
160
|
+
lastMessageAt: thread.last_message_at
|
|
161
|
+
? new Date(thread.last_message_at)
|
|
162
|
+
: undefined,
|
|
163
|
+
externalId: thread.external_id ?? undefined,
|
|
164
|
+
custom: toCustom(thread.metadata),
|
|
165
|
+
};
|
|
166
|
+
},
|
|
166
167
|
|
|
167
|
-
|
|
168
|
-
|
|
168
|
+
unstable_Provider,
|
|
169
|
+
};
|
|
170
|
+
}, [cloud, unstable_Provider]);
|
|
169
171
|
};
|
|
@@ -6,7 +6,7 @@ type Extras = { value: number; greet: () => string };
|
|
|
6
6
|
|
|
7
7
|
const clientWith = (extras: unknown) =>
|
|
8
8
|
({
|
|
9
|
-
thread:
|
|
9
|
+
thread: { getState: () => ({ extras }) },
|
|
10
10
|
}) as unknown as AssistantClient;
|
|
11
11
|
|
|
12
12
|
describe("createRuntimeExtras", () => {
|
|
@@ -46,7 +46,7 @@ export const createRuntimeExtras = <T extends object>(
|
|
|
46
46
|
is(extras) ? extras : undefined;
|
|
47
47
|
|
|
48
48
|
const get = (client: AssistantClient): T =>
|
|
49
|
-
assert(client.thread
|
|
49
|
+
assert(client.thread.getState().extras);
|
|
50
50
|
|
|
51
51
|
function use<S>(
|
|
52
52
|
select?: (extras: T) => S,
|