@assistant-ui/core 0.3.19 → 0.3.21
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 +50 -43
- package/dist/adapters/attachment.d.ts.map +1 -1
- package/dist/adapters/attachment.js +52 -21
- package/dist/adapters/attachment.js.map +1 -1
- package/dist/adapters/directive-formatter.d.ts +2 -5
- package/dist/adapters/directive-formatter.d.ts.map +1 -1
- package/dist/adapters/feedback.d.ts +7 -8
- package/dist/adapters/feedback.d.ts.map +1 -1
- package/dist/adapters/index.d.ts +14 -9
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +1 -1
- package/dist/adapters/speech.d.ts +63 -65
- package/dist/adapters/speech.d.ts.map +1 -1
- package/dist/adapters/speech.js +16 -2
- package/dist/adapters/speech.js.map +1 -1
- package/dist/adapters/suggestion.d.ts +19 -22
- package/dist/adapters/suggestion.d.ts.map +1 -1
- package/dist/adapters/thread-history.d.ts +60 -58
- package/dist/adapters/thread-history.d.ts.map +1 -1
- package/dist/adapters/trigger.d.ts +8 -11
- package/dist/adapters/trigger.d.ts.map +1 -1
- package/dist/adapters/voice.d.ts +50 -45
- package/dist/adapters/voice.d.ts.map +1 -1
- package/dist/adapters/voice.js +17 -3
- package/dist/adapters/voice.js.map +1 -1
- package/dist/index.d.ts +70 -56
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/internal/duplicate-detection.d.ts +1 -4
- package/dist/internal/duplicate-detection.d.ts.map +1 -1
- package/dist/internal.d.ts +27 -58
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +8 -6
- package/dist/model-context/frame/host.d.ts +20 -23
- package/dist/model-context/frame/host.d.ts.map +1 -1
- package/dist/model-context/frame/host.js +3 -1
- package/dist/model-context/frame/host.js.map +1 -1
- package/dist/model-context/frame/provider.d.ts +28 -30
- package/dist/model-context/frame/provider.d.ts.map +1 -1
- package/dist/model-context/frame/provider.js +6 -0
- package/dist/model-context/frame/provider.js.map +1 -1
- package/dist/model-context/frame/types.d.ts +24 -27
- package/dist/model-context/frame/types.d.ts.map +1 -1
- package/dist/model-context/frame/validate.d.ts +3 -0
- package/dist/model-context/frame/validate.d.ts.map +1 -0
- package/dist/model-context/frame/validate.js +26 -0
- package/dist/model-context/frame/validate.js.map +1 -0
- package/dist/model-context/interactable-composer-metadata.d.ts +51 -39
- package/dist/model-context/interactable-composer-metadata.d.ts.map +1 -1
- package/dist/model-context/interactable-composer-metadata.js +30 -6
- package/dist/model-context/interactable-composer-metadata.js.map +1 -1
- package/dist/model-context/registry-handles.d.ts +9 -12
- package/dist/model-context/registry-handles.d.ts.map +1 -1
- package/dist/model-context/registry.d.ts +15 -18
- package/dist/model-context/registry.d.ts.map +1 -1
- package/dist/model-context/tool-call-text.d.ts +15 -17
- package/dist/model-context/tool-call-text.d.ts.map +1 -1
- package/dist/model-context/tool.d.ts +12 -14
- package/dist/model-context/tool.d.ts.map +1 -1
- package/dist/model-context/types.d.ts +40 -43
- package/dist/model-context/types.d.ts.map +1 -1
- package/dist/react/AssistantProvider.d.ts +9 -12
- package/dist/react/AssistantProvider.d.ts.map +1 -1
- package/dist/react/AssistantRuntimeProvider.d.ts +23 -26
- package/dist/react/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/react/RuntimeAdapter.d.ts +4 -8
- package/dist/react/RuntimeAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts +28 -23
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js +77 -58
- package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
- package/dist/react/adapters/TitleGenerationAdapter.d.ts +4 -7
- package/dist/react/adapters/TitleGenerationAdapter.d.ts.map +1 -1
- package/dist/react/client/AdaptedRemoteThread.d.ts +6 -9
- package/dist/react/client/AdaptedRemoteThread.d.ts.map +1 -1
- package/dist/react/client/DataRenderers.d.ts +2 -5
- package/dist/react/client/DataRenderers.d.ts.map +1 -1
- package/dist/react/client/InMemoryThreadList.d.ts +9 -12
- package/dist/react/client/InMemoryThreadList.d.ts.map +1 -1
- package/dist/react/client/Interactables.d.ts +3 -6
- package/dist/react/client/Interactables.d.ts.map +1 -1
- package/dist/react/client/Interactables.js +306 -101
- package/dist/react/client/Interactables.js.map +1 -1
- package/dist/react/client/RemoteThreadList.d.ts +34 -37
- package/dist/react/client/RemoteThreadList.d.ts.map +1 -1
- package/dist/react/client/RemoteThreadList.js +2 -1
- package/dist/react/client/RemoteThreadList.js.map +1 -1
- package/dist/react/client/Tools.d.ts +10 -12
- package/dist/react/client/Tools.d.ts.map +1 -1
- package/dist/react/client/Tools.js +4 -8
- package/dist/react/client/Tools.js.map +1 -1
- package/dist/react/client/interactable-model-context.d.ts +9 -11
- package/dist/react/client/interactable-model-context.d.ts.map +1 -1
- package/dist/react/client/interactable-model-context.js +32 -22
- package/dist/react/client/interactable-model-context.js.map +1 -1
- package/dist/react/index.d.ts +160 -122
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +5 -5
- package/dist/react/interactables-legacy/Interactables.d.ts +2 -5
- package/dist/react/interactables-legacy/Interactables.d.ts.map +1 -1
- package/dist/react/interactables-legacy/Interactables.js +15 -8
- package/dist/react/interactables-legacy/Interactables.js.map +1 -1
- package/dist/react/interactables-legacy/interactable-model-context.d.ts +6 -9
- package/dist/react/interactables-legacy/interactable-model-context.d.ts.map +1 -1
- package/dist/react/interactables-legacy/interactable-model-context.js +13 -14
- package/dist/react/interactables-legacy/interactable-model-context.js.map +1 -1
- package/dist/react/interactables-legacy/scopes.d.ts +42 -46
- package/dist/react/interactables-legacy/scopes.d.ts.map +1 -1
- package/dist/react/interactables-legacy/useAssistantInteractable.d.ts +8 -11
- package/dist/react/interactables-legacy/useAssistantInteractable.d.ts.map +1 -1
- package/dist/react/interactables-legacy/useInteractableState.d.ts +7 -9
- package/dist/react/interactables-legacy/useInteractableState.d.ts.map +1 -1
- package/dist/react/interactables-shared/useInteractablePersistenceQueue.d.ts +23 -14
- package/dist/react/interactables-shared/useInteractablePersistenceQueue.d.ts.map +1 -1
- package/dist/react/interactables-shared/useInteractablePersistenceQueue.js +54 -25
- package/dist/react/interactables-shared/useInteractablePersistenceQueue.js.map +1 -1
- package/dist/react/model-context/define-mcp-toolkit.d.ts +15 -18
- package/dist/react/model-context/define-mcp-toolkit.d.ts.map +1 -1
- package/dist/react/model-context/define-toolkit.d.ts +13 -6
- package/dist/react/model-context/define-toolkit.d.ts.map +1 -1
- package/dist/react/model-context/external-tool.d.ts +1 -4
- package/dist/react/model-context/external-tool.d.ts.map +1 -1
- package/dist/react/model-context/human-tool.d.ts +3 -6
- package/dist/react/model-context/human-tool.d.ts.map +1 -1
- package/dist/react/model-context/interactableTool.d.ts +26 -29
- package/dist/react/model-context/interactableTool.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantDataUI.d.ts +6 -9
- package/dist/react/model-context/makeAssistantDataUI.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantTool.d.ts +6 -9
- package/dist/react/model-context/makeAssistantTool.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantToolUI.d.ts +6 -9
- package/dist/react/model-context/makeAssistantToolUI.d.ts.map +1 -1
- package/dist/react/model-context/provider-tool.d.ts +5 -7
- package/dist/react/model-context/provider-tool.d.ts.map +1 -1
- package/dist/react/model-context/stub-tool.d.ts +1 -4
- package/dist/react/model-context/stub-tool.d.ts.map +1 -1
- package/dist/react/model-context/toolbox.d.ts +44 -32
- package/dist/react/model-context/toolbox.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantContext.d.ts +3 -6
- package/dist/react/model-context/useAssistantContext.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantDataUI.d.ts +7 -10
- package/dist/react/model-context/useAssistantDataUI.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantInstructions.d.ts +3 -6
- package/dist/react/model-context/useAssistantInstructions.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantTool.d.ts +9 -13
- package/dist/react/model-context/useAssistantTool.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantToolUI.d.ts +13 -16
- package/dist/react/model-context/useAssistantToolUI.d.ts.map +1 -1
- package/dist/react/model-context/useAuiToolOverrides.d.ts +3 -5
- package/dist/react/model-context/useAuiToolOverrides.d.ts.map +1 -1
- package/dist/react/model-context/useInlineRender.d.ts +3 -6
- package/dist/react/model-context/useInlineRender.d.ts.map +1 -1
- package/dist/react/model-context/useInteractable.d.ts +40 -40
- package/dist/react/model-context/useInteractable.d.ts.map +1 -1
- package/dist/react/model-context/useInteractableState.d.ts +10 -9
- package/dist/react/model-context/useInteractableState.d.ts.map +1 -1
- package/dist/react/model-context/useInteractableVersions.d.ts +4 -7
- package/dist/react/model-context/useInteractableVersions.d.ts.map +1 -1
- package/dist/react/model-context/useToolArgsStatus.d.ts +7 -9
- package/dist/react/model-context/useToolArgsStatus.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.d.ts +7 -10
- package/dist/react/primitive-hooks/useActionBarCopy.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.d.ts +3 -6
- package/dist/react/primitive-hooks/useActionBarEdit.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.d.ts +6 -9
- package/dist/react/primitive-hooks/useActionBarFeedback.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.d.ts +3 -6
- package/dist/react/primitive-hooks/useActionBarReload.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.d.ts +3 -6
- package/dist/react/primitive-hooks/useActionBarSpeak.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts +3 -6
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.d.ts +3 -6
- package/dist/react/primitive-hooks/useBranchPickerNext.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts +3 -6
- package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts +4 -7
- package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.d.ts +3 -6
- package/dist/react/primitive-hooks/useComposerCancel.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.d.ts +3 -6
- package/dist/react/primitive-hooks/useComposerDictate.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.d.ts +4 -7
- package/dist/react/primitive-hooks/useComposerSend.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.d.ts +2 -5
- package/dist/react/primitive-hooks/useEditComposerCancel.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.d.ts +3 -6
- package/dist/react/primitive-hooks/useEditComposerSend.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.d.ts +5 -8
- package/dist/react/primitive-hooks/useMessageBranching.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageError.d.ts +1 -4
- package/dist/react/primitive-hooks/useMessageError.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageReload.d.ts +3 -6
- package/dist/react/primitive-hooks/useMessageReload.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts +7 -10
- package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.js +4 -4
- package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts +1 -4
- package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsRunning.d.ts +1 -4
- package/dist/react/primitive-hooks/useThreadIsRunning.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts +2 -5
- package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts +2 -5
- package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts +2 -5
- package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts +2 -5
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.d.ts +3 -6
- package/dist/react/primitive-hooks/useThreadListLoadMore.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.d.ts +2 -5
- package/dist/react/primitive-hooks/useThreadListNew.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadMessageIds.d.ts +1 -4
- package/dist/react/primitive-hooks/useThreadMessageIds.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadMessages.d.ts +2 -5
- package/dist/react/primitive-hooks/useThreadMessages.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useVoice.d.ts +8 -11
- package/dist/react/primitive-hooks/useVoice.d.ts.map +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts +27 -29
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.d.ts +26 -28
- package/dist/react/primitives/composer/ComposerAttachments.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerIf.d.ts +13 -13
- package/dist/react/primitives/composer/ComposerIf.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerQueue.d.ts +13 -17
- package/dist/react/primitives/composer/ComposerQueue.d.ts.map +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.d.ts +30 -33
- package/dist/react/primitives/generativeUI/GenerativeUI.d.ts.map +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.js +42 -33
- package/dist/react/primitives/generativeUI/GenerativeUI.js.map +1 -1
- package/dist/react/primitives/message/MessageAttachments.d.ts +30 -28
- package/dist/react/primitives/message/MessageAttachments.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageAttachments.js +14 -15
- package/dist/react/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.d.ts +122 -120
- package/dist/react/primitives/message/MessageGroupedParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.js +3 -3
- package/dist/react/primitives/message/MessageGroupedParts.js.map +1 -1
- package/dist/react/primitives/message/MessageParts.d.ts +208 -194
- package/dist/react/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageParts.js +124 -82
- package/dist/react/primitives/message/MessageParts.js.map +1 -1
- package/dist/react/primitives/message/MessageQuote.d.ts +8 -11
- package/dist/react/primitives/message/MessageQuote.d.ts.map +1 -1
- package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts +4 -7
- package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts.map +1 -1
- package/dist/react/primitives/part/PartMessages.d.ts +16 -19
- package/dist/react/primitives/part/PartMessages.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadMessages.d.ts +61 -64
- package/dist/react/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.d.ts +25 -27
- package/dist/react/primitives/thread/ThreadSuggestions.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.js +24 -5
- package/dist/react/primitives/thread/ThreadSuggestions.js.map +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.d.ts +26 -28
- package/dist/react/primitives/threadList/ThreadListItems.d.ts.map +1 -1
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts +6 -9
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -1
- package/dist/react/providers/AttachmentByIndexProvider.d.ts +5 -8
- package/dist/react/providers/AttachmentByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts +4 -7
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts +3 -6
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/MessageByIdProvider.d.ts +3 -6
- package/dist/react/providers/MessageByIdProvider.d.ts.map +1 -1
- package/dist/react/providers/MessageByIndexProvider.d.ts +3 -6
- package/dist/react/providers/MessageByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/PartByIndexProvider.d.ts +3 -6
- package/dist/react/providers/PartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/QueueItemByIndexProvider.d.ts +4 -7
- package/dist/react/providers/QueueItemByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.d.ts +7 -10
- package/dist/react/providers/ReadonlyThreadProvider.d.ts.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.js.map +1 -1
- package/dist/react/providers/SuggestionByIndexProvider.d.ts +4 -7
- package/dist/react/providers/SuggestionByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.d.ts +4 -7
- package/dist/react/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.js +5 -1
- package/dist/react/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.d.ts +4 -7
- package/dist/react/providers/ThreadListItemByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts +4 -8
- package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +210 -219
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +70 -46
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +186 -198
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +13 -4
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadResource.d.ts +17 -23
- package/dist/react/runtimes/RemoteThreadResource.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadResource.js +3 -1
- package/dist/react/runtimes/RemoteThreadResource.js.map +1 -1
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts +10 -11
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/commandQueue.d.ts +11 -14
- package/dist/react/runtimes/assistant-transport/commandQueue.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.d.ts +6 -8
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.js +9 -2
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.js.map +1 -1
- package/dist/react/runtimes/assistant-transport/runManager.d.ts +9 -12
- package/dist/react/runtimes/assistant-transport/runManager.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/runManager.js +4 -1
- package/dist/react/runtimes/assistant-transport/runManager.js.map +1 -1
- package/dist/react/runtimes/assistant-transport/types.d.ts +123 -118
- package/dist/react/runtimes/assistant-transport/types.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.d.ts +7 -10
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.js +17 -6
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
- package/dist/react/runtimes/assistant-transport/useConvertedState.d.ts +3 -6
- package/dist/react/runtimes/assistant-transport/useConvertedState.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/useLatestRef.d.ts +2 -5
- package/dist/react/runtimes/assistant-transport/useLatestRef.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts +7 -10
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +426 -216
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts +15 -18
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js +8 -4
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.d.ts +146 -125
- package/dist/react/runtimes/cloud/auiV0.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.js +120 -8
- package/dist/react/runtimes/cloud/auiV0.js.map +1 -1
- package/dist/react/runtimes/cloud/createCloudThreadListAdapter.d.ts +13 -15
- package/dist/react/runtimes/cloud/createCloudThreadListAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/createCloudThreadListAdapterCreateFallback.d.ts +5 -7
- package/dist/react/runtimes/cloud/createCloudThreadListAdapterCreateFallback.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/sdkIdentity.d.ts +2 -5
- package/dist/react/runtimes/cloud/sdkIdentity.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/sdkIdentity.js +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts +3 -6
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListRuntime.d.ts +9 -11
- package/dist/react/runtimes/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/createMessageConverter.d.ts +15 -19
- package/dist/react/runtimes/createMessageConverter.d.ts.map +1 -1
- package/dist/react/runtimes/createMessageConverter.js.map +1 -1
- package/dist/react/runtimes/createRuntimeExtras.d.ts +14 -17
- package/dist/react/runtimes/createRuntimeExtras.d.ts.map +1 -1
- package/dist/react/runtimes/external-message-converter.d.ts +17 -21
- package/dist/react/runtimes/external-message-converter.d.ts.map +1 -1
- package/dist/react/runtimes/external-store-history-copy.d.ts +25 -0
- package/dist/react/runtimes/external-store-history-copy.d.ts.map +1 -0
- package/dist/react/runtimes/external-store-history-copy.js +148 -0
- package/dist/react/runtimes/external-store-history-copy.js.map +1 -0
- package/dist/react/runtimes/useExternalStoreRuntime.d.ts +3 -6
- package/dist/react/runtimes/useExternalStoreRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useExternalStoreRuntime.js +72 -35
- package/dist/react/runtimes/useExternalStoreRuntime.js.map +1 -1
- package/dist/react/runtimes/useExternalStoreSharedOptions.d.ts +2 -5
- package/dist/react/runtimes/useExternalStoreSharedOptions.d.ts.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.d.ts +29 -41
- package/dist/react/runtimes/useLocalRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.js +142 -34
- package/dist/react/runtimes/useLocalRuntime.js.map +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts +3 -6
- package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.js +2 -2
- package/dist/react/runtimes/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/react/runtimes/useRuntimeAdapters.d.ts +5 -7
- package/dist/react/runtimes/useRuntimeAdapters.d.ts.map +1 -1
- package/dist/react/runtimes/useStreamingTiming.d.ts +4 -6
- package/dist/react/runtimes/useStreamingTiming.d.ts.map +1 -1
- package/dist/react/types/MessagePartComponentTypes.d.ts +72 -70
- package/dist/react/types/MessagePartComponentTypes.d.ts.map +1 -1
- package/dist/react/types/scopes/dataRenderers.d.ts +11 -15
- package/dist/react/types/scopes/dataRenderers.d.ts.map +1 -1
- package/dist/react/types/scopes/interactables.d.ts +60 -60
- package/dist/react/types/scopes/interactables.d.ts.map +1 -1
- package/dist/react/types/scopes/tools.d.ts +21 -24
- package/dist/react/types/scopes/tools.d.ts.map +1 -1
- package/dist/react/types/store-augmentation.d.ts +10 -11
- package/dist/react/types/store-augmentation.d.ts.map +1 -1
- package/dist/react/utils/getMessageQuote.d.ts +6 -8
- package/dist/react/utils/getMessageQuote.d.ts.map +1 -1
- package/dist/react/utils/groupParts.d.ts +35 -37
- package/dist/react/utils/groupParts.d.ts.map +1 -1
- package/dist/react/utils/useJSONEqual.d.ts +3 -6
- package/dist/react/utils/useJSONEqual.d.ts.map +1 -1
- package/dist/react/utils/useJSONSchemaDependency.d.ts +3 -6
- package/dist/react/utils/useJSONSchemaDependency.d.ts.map +1 -1
- package/dist/runtime/api/assistant-runtime.d.ts +28 -31
- package/dist/runtime/api/assistant-runtime.d.ts.map +1 -1
- package/dist/runtime/api/attachment-runtime.d.ts +51 -49
- package/dist/runtime/api/attachment-runtime.d.ts.map +1 -1
- package/dist/runtime/api/attachment-runtime.js.map +1 -1
- package/dist/runtime/api/bindings.d.ts +35 -35
- package/dist/runtime/api/bindings.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.d.ts +215 -201
- package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.js +4 -0
- package/dist/runtime/api/composer-runtime.js.map +1 -1
- package/dist/runtime/api/message-part-runtime.d.ts +31 -30
- package/dist/runtime/api/message-part-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-part-runtime.js +25 -2
- package/dist/runtime/api/message-part-runtime.js.map +1 -1
- package/dist/runtime/api/message-runtime.d.ts +87 -82
- package/dist/runtime/api/message-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-runtime.js +4 -3
- package/dist/runtime/api/message-runtime.js.map +1 -1
- package/dist/runtime/api/paths.d.ts +54 -57
- package/dist/runtime/api/paths.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.d.ts +70 -72
- package/dist/runtime/api/thread-list-item-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-runtime.d.ts +77 -81
- package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-runtime.js.map +1 -1
- package/dist/runtime/api/thread-runtime.d.ts +306 -308
- package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-runtime.js +2 -1
- package/dist/runtime/api/thread-runtime.js.map +1 -1
- package/dist/runtime/base/base-assistant-runtime-core.d.ts +9 -12
- package/dist/runtime/base/base-assistant-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.d.ts +150 -101
- package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.js +400 -122
- package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.d.ts +121 -104
- package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js +174 -62
- package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts +30 -31
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.js +21 -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 +28 -31
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js +23 -2
- package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
- package/dist/runtime/branch/external-thread-branch-adapter.d.ts +15 -18
- package/dist/runtime/branch/external-thread-branch-adapter.d.ts.map +1 -1
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts +8 -11
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/composer-runtime-core.d.ts +98 -83
- package/dist/runtime/interfaces/composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts +67 -70
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-runtime-core.d.ts +225 -211
- package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +25 -20
- package/dist/runtime/internal.d.ts.map +1 -0
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts +37 -40
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts.map +1 -1
- package/dist/runtime/queue/message-queue.d.ts +32 -33
- package/dist/runtime/queue/message-queue.d.ts.map +1 -1
- package/dist/runtime/queue/message-queue.js +10 -2
- package/dist/runtime/queue/message-queue.js.map +1 -1
- package/dist/runtime/queue/queue-item.d.ts +7 -10
- package/dist/runtime/queue/queue-item.d.ts.map +1 -1
- package/dist/runtime/utils/abortable-thread-load.d.ts +9 -11
- package/dist/runtime/utils/abortable-thread-load.d.ts.map +1 -1
- package/dist/runtime/utils/attachment-add-operations.d.ts +16 -15
- package/dist/runtime/utils/attachment-add-operations.d.ts.map +1 -1
- package/dist/runtime/utils/attachment-add-operations.js +24 -2
- package/dist/runtime/utils/attachment-add-operations.js.map +1 -1
- package/dist/runtime/utils/attachment-send-operations.d.ts +12 -0
- package/dist/runtime/utils/attachment-send-operations.d.ts.map +1 -0
- package/dist/runtime/utils/attachment-send-operations.js +34 -0
- package/dist/runtime/utils/attachment-send-operations.js.map +1 -0
- package/dist/runtime/utils/auto-status.d.ts +11 -13
- package/dist/runtime/utils/auto-status.d.ts.map +1 -1
- package/dist/runtime/utils/auto-status.js +3 -5
- package/dist/runtime/utils/auto-status.js.map +1 -1
- package/dist/runtime/utils/chat-model-adapter.d.ts +31 -33
- package/dist/runtime/utils/chat-model-adapter.d.ts.map +1 -1
- package/dist/runtime/utils/external-message-conversion.d.ts +47 -48
- package/dist/runtime/utils/external-message-conversion.d.ts.map +1 -1
- package/dist/runtime/utils/external-message-conversion.js +6 -5
- package/dist/runtime/utils/external-message-conversion.js.map +1 -1
- package/dist/runtime/utils/external-store-message.d.ts +6 -9
- package/dist/runtime/utils/external-store-message.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository-session.d.ts +24 -27
- package/dist/runtime/utils/message-repository-session.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository.d.ts +52 -54
- package/dist/runtime/utils/message-repository.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository.js +8 -7
- package/dist/runtime/utils/message-repository.js.map +1 -1
- package/dist/runtime/utils/pending-tool-calls.d.ts +12 -14
- package/dist/runtime/utils/pending-tool-calls.d.ts.map +1 -1
- package/dist/runtime/utils/resolveToolApprovalResponse.d.ts +7 -10
- package/dist/runtime/utils/resolveToolApprovalResponse.d.ts.map +1 -1
- package/dist/runtime/utils/runtime-extras-brand.d.ts +6 -9
- package/dist/runtime/utils/runtime-extras-brand.d.ts.map +1 -1
- package/dist/runtime/utils/stored-message-parts.d.ts +21 -0
- package/dist/runtime/utils/stored-message-parts.d.ts.map +1 -0
- package/dist/runtime/utils/stored-message-parts.js +103 -0
- package/dist/runtime/utils/stored-message-parts.js.map +1 -0
- package/dist/runtime/utils/streaming-timing.d.ts +23 -26
- package/dist/runtime/utils/streaming-timing.d.ts.map +1 -1
- package/dist/runtime/utils/thread-message-like.d.ts +38 -34
- package/dist/runtime/utils/thread-message-like.d.ts.map +1 -1
- package/dist/runtime/utils/thread-message-like.js +16 -6
- package/dist/runtime/utils/thread-message-like.js.map +1 -1
- package/dist/runtime/utils/thread-runtime-lifecycle.d.ts +5 -7
- package/dist/runtime/utils/thread-runtime-lifecycle.d.ts.map +1 -1
- package/dist/runtime/utils/thread-runtime-lifecycle.js +31 -4
- package/dist/runtime/utils/thread-runtime-lifecycle.js.map +1 -1
- package/dist/runtime/utils/tool-call-tree.d.ts +10 -13
- package/dist/runtime/utils/tool-call-tree.d.ts.map +1 -1
- package/dist/runtime/utils/tool-interactions.d.ts +10 -0
- package/dist/runtime/utils/tool-interactions.d.ts.map +1 -0
- package/dist/runtime/utils/tool-interactions.js +92 -0
- package/dist/runtime/utils/tool-interactions.js.map +1 -0
- package/dist/runtimes/assistant-transport/utils.d.ts +1 -4
- package/dist/runtimes/assistant-transport/utils.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-adapter.d.ts +220 -200
- package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts +6 -8
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-runtime-core.js +4 -1
- package/dist/runtimes/external-store/external-store-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/external-store-shared-options.d.ts +3 -6
- package/dist/runtimes/external-store/external-store-shared-options.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts +40 -43
- 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 +2 -2
- 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 +119 -125
- 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 +71 -18
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/thread-message-converter.d.ts +5 -8
- package/dist/runtimes/external-store/thread-message-converter.d.ts.map +1 -1
- package/dist/runtimes/inert/InertThreadRuntimeCore.d.ts +96 -98
- package/dist/runtimes/inert/InertThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/inert/InertThreadRuntimeCore.js +3 -0
- package/dist/runtimes/inert/InertThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/internal.d.ts +20 -16
- package/dist/runtimes/internal.d.ts.map +1 -0
- package/dist/runtimes/local/local-runtime-core.d.ts +7 -10
- package/dist/runtimes/local/local-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-runtime-options.d.ts +41 -44
- package/dist/runtimes/local/local-runtime-options.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts +42 -45
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.d.ts +94 -93
- package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.js +220 -29
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/local/should-continue.d.ts +2 -5
- package/dist/runtimes/local/should-continue.d.ts.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +77 -55
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js +28 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts +12 -15
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter-changed.d.ts +3 -6
- package/dist/runtimes/remote-thread-list/adapter-changed.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts +2 -5
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts +34 -31
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/optimistic-state.js +8 -3
- package/dist/runtimes/remote-thread-list/optimistic-state.js.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts +60 -63
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.js +1 -1
- package/dist/runtimes/remote-thread-list/title-generation.d.ts +31 -33
- package/dist/runtimes/remote-thread-list/title-generation.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/title.d.ts +5 -8
- package/dist/runtimes/remote-thread-list/title.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/types.d.ts +119 -121
- package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts +147 -149
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js +22 -7
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js.map +1 -1
- package/dist/store/clients/chain-of-thought-client.d.ts +8 -11
- package/dist/store/clients/chain-of-thought-client.d.ts.map +1 -1
- package/dist/store/clients/external-thread.d.ts +56 -58
- package/dist/store/clients/external-thread.d.ts.map +1 -1
- package/dist/store/clients/external-thread.js +1270 -741
- package/dist/store/clients/external-thread.js.map +1 -1
- package/dist/store/clients/model-context-client.d.ts +2 -5
- package/dist/store/clients/model-context-client.d.ts.map +1 -1
- package/dist/store/clients/no-op-composer-client.d.ts +3 -6
- package/dist/store/clients/no-op-composer-client.d.ts.map +1 -1
- package/dist/store/clients/no-op-composer-client.js +3 -1
- package/dist/store/clients/no-op-composer-client.js.map +1 -1
- package/dist/store/clients/runtime-adapter.d.ts +2 -5
- package/dist/store/clients/runtime-adapter.d.ts.map +1 -1
- package/dist/store/clients/single-thread-list.d.ts +4 -6
- package/dist/store/clients/single-thread-list.d.ts.map +1 -1
- package/dist/store/clients/submission-message.d.ts +8 -0
- package/dist/store/clients/submission-message.d.ts.map +1 -0
- package/dist/store/clients/submission-message.js +22 -0
- package/dist/store/clients/submission-message.js.map +1 -0
- package/dist/store/clients/suggestions.d.ts +8 -11
- package/dist/store/clients/suggestions.d.ts.map +1 -1
- package/dist/store/clients/thread-message-client.d.ts +12 -12
- package/dist/store/clients/thread-message-client.d.ts.map +1 -1
- package/dist/store/clients/thread-message-client.js +81 -82
- package/dist/store/clients/thread-message-client.js.map +1 -1
- package/dist/store/clients/thread-selection-events.d.ts +1 -4
- package/dist/store/clients/thread-selection-events.d.ts.map +1 -1
- package/dist/store/clients/thread-tasks.d.ts +7 -10
- package/dist/store/clients/thread-tasks.d.ts.map +1 -1
- package/dist/store/env.d.ts +1 -4
- package/dist/store/env.d.ts.map +1 -1
- package/dist/store/index.d.ts +33 -36
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +5 -5
- package/dist/store/internal.d.ts +12 -12
- package/dist/store/internal.d.ts.map +1 -0
- package/dist/store/internal.js +2 -2
- package/dist/store/primitive-predicates.d.ts +14 -16
- package/dist/store/primitive-predicates.d.ts.map +1 -1
- package/dist/store/primitive-predicates.js +10 -5
- package/dist/store/primitive-predicates.js.map +1 -1
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts +4 -7
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.d.ts +11 -14
- package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.js +65 -62
- package/dist/store/runtime-clients/composer-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/handle-runtime-action.d.ts +1 -4
- package/dist/store/runtime-clients/handle-runtime-action.d.ts.map +1 -1
- package/dist/store/runtime-clients/handle-thread-list-action.d.ts +1 -4
- package/dist/store/runtime-clients/handle-thread-list-action.d.ts.map +1 -1
- package/dist/store/runtime-clients/liveRef.d.ts +2 -5
- package/dist/store/runtime-clients/liveRef.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts +4 -7
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.js +26 -16
- package/dist/store/runtime-clients/message-part-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.d.ts +10 -11
- package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.js +121 -113
- package/dist/store/runtime-clients/message-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts +5 -8
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts +6 -9
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.d.ts +4 -7
- package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.js +221 -158
- package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/useSubscribable.d.ts +3 -6
- package/dist/store/runtime-clients/useSubscribable.d.ts.map +1 -1
- package/dist/store/scope-registration.d.ts +28 -29
- package/dist/store/scope-registration.d.ts.map +1 -1
- package/dist/store/scopes/attachment.d.ts +19 -22
- package/dist/store/scopes/attachment.d.ts.map +1 -1
- package/dist/store/scopes/chain-of-thought.d.ts +33 -35
- package/dist/store/scopes/chain-of-thought.d.ts.map +1 -1
- package/dist/store/scopes/composer.d.ts +147 -135
- package/dist/store/scopes/composer.d.ts.map +1 -1
- package/dist/store/scopes/message.d.ts +119 -112
- package/dist/store/scopes/message.d.ts.map +1 -1
- package/dist/store/scopes/model-context.d.ts +10 -13
- package/dist/store/scopes/model-context.d.ts.map +1 -1
- package/dist/store/scopes/part.d.ts +53 -50
- package/dist/store/scopes/part.d.ts.map +1 -1
- package/dist/store/scopes/queue-item.d.ts +21 -23
- package/dist/store/scopes/queue-item.d.ts.map +1 -1
- package/dist/store/scopes/suggestion.d.ts +14 -17
- package/dist/store/scopes/suggestion.d.ts.map +1 -1
- package/dist/store/scopes/suggestions.d.ts +18 -21
- package/dist/store/scopes/suggestions.d.ts.map +1 -1
- package/dist/store/scopes/task.d.ts +27 -30
- package/dist/store/scopes/task.d.ts.map +1 -1
- package/dist/store/scopes/thread-list-item.d.ts +68 -71
- package/dist/store/scopes/thread-list-item.d.ts.map +1 -1
- package/dist/store/scopes/thread.d.ts +197 -200
- package/dist/store/scopes/thread.d.ts.map +1 -1
- package/dist/store/scopes/threads.d.ts +49 -52
- package/dist/store/scopes/threads.d.ts.map +1 -1
- package/dist/subscribable/subscribable.d.ts +73 -69
- package/dist/subscribable/subscribable.d.ts.map +1 -1
- package/dist/subscribable/subscribable.js +35 -7
- package/dist/subscribable/subscribable.js.map +1 -1
- package/dist/types/attachment.d.ts +35 -37
- package/dist/types/attachment.d.ts.map +1 -1
- package/dist/types/augmentations.d.ts +7 -8
- package/dist/types/augmentations.d.ts.map +1 -1
- package/dist/types/directive.d.ts +13 -16
- package/dist/types/directive.d.ts.map +1 -1
- package/dist/types/error.d.ts +15 -17
- package/dist/types/error.d.ts.map +1 -1
- package/dist/types/index.d.ts +7 -7
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/message.d.ts +358 -318
- package/dist/types/message.d.ts.map +1 -1
- package/dist/types/message.js.map +1 -1
- package/dist/types/quote.d.ts +3 -6
- package/dist/types/quote.d.ts.map +1 -1
- package/dist/types/trigger.d.ts +10 -13
- package/dist/types/trigger.d.ts.map +1 -1
- package/dist/types/unsubscribe.d.ts +1 -4
- package/dist/types/unsubscribe.d.ts.map +1 -1
- package/dist/utils/abortable-iterable.d.ts +2 -5
- package/dist/utils/abortable-iterable.d.ts.map +1 -1
- package/dist/utils/composite-context-provider.d.ts +9 -13
- package/dist/utils/composite-context-provider.d.ts.map +1 -1
- package/dist/utils/data-url.d.ts +16 -19
- package/dist/utils/data-url.d.ts.map +1 -1
- package/dist/utils/getGroupStatus.d.ts +19 -21
- package/dist/utils/getGroupStatus.d.ts.map +1 -1
- package/dist/utils/id.d.ts +3 -6
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/image-media-type.d.ts +1 -4
- package/dist/utils/image-media-type.d.ts.map +1 -1
- package/dist/utils/invoke-user-callback.d.ts +1 -4
- package/dist/utils/invoke-user-callback.d.ts.map +1 -1
- package/dist/utils/json/is-json-equal.d.ts +1 -4
- package/dist/utils/json/is-json-equal.d.ts.map +1 -1
- package/dist/utils/json/is-json.d.ts +5 -8
- package/dist/utils/json/is-json.d.ts.map +1 -1
- package/dist/utils/json/stable-stringify-tool-args.d.ts +3 -6
- package/dist/utils/json/stable-stringify-tool-args.d.ts.map +1 -1
- package/dist/utils/normalizePartStatus.d.ts +6 -8
- package/dist/utils/normalizePartStatus.d.ts.map +1 -1
- package/dist/utils/normalizePartStatus.js +3 -2
- package/dist/utils/normalizePartStatus.js.map +1 -1
- package/dist/utils/notify-event-listeners.d.ts +2 -4
- package/dist/utils/notify-event-listeners.d.ts.map +1 -1
- package/dist/utils/record.d.ts +1 -4
- package/dist/utils/record.d.ts.map +1 -1
- package/dist/utils/silent-runtime-action.d.ts +2 -5
- package/dist/utils/silent-runtime-action.d.ts.map +1 -1
- package/dist/utils/text.d.ts +2 -5
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/wire-media.d.ts +3 -6
- package/dist/utils/wire-media.d.ts.map +1 -1
- package/package.json +15 -13
- package/src/adapters/attachment.test.ts +98 -1
- package/src/adapters/attachment.ts +77 -20
- package/src/adapters/feedback.ts +1 -0
- package/src/adapters/speech.test.ts +94 -0
- package/src/adapters/speech.ts +16 -2
- package/src/adapters/thread-history.ts +16 -5
- package/src/adapters/voice.test.ts +169 -0
- package/src/adapters/voice.ts +25 -4
- package/src/index.ts +14 -2
- package/src/internal.ts +7 -0
- package/src/model-context/frame/host.test.ts +51 -1
- package/src/model-context/frame/host.ts +3 -1
- package/src/model-context/frame/provider.test.ts +106 -20
- package/src/model-context/frame/provider.ts +8 -1
- package/src/model-context/frame/validate.ts +57 -0
- package/src/model-context/interactable-composer-metadata.test.ts +82 -0
- package/src/model-context/interactable-composer-metadata.ts +45 -2
- package/src/react/RuntimeAdapter.test.ts +4 -1
- package/src/react/adapters/LocalStorageThreadListAdapter.test.ts +711 -0
- package/src/react/adapters/LocalStorageThreadListAdapter.tsx +125 -109
- package/src/react/client/Interactables.test.ts +865 -8
- package/src/react/client/Interactables.ts +325 -45
- package/src/react/client/RemoteThreadList.concurrent.test.tsx +9 -3
- package/src/react/client/RemoteThreadList.initialize-failure.test.ts +124 -0
- package/src/react/client/RemoteThreadList.test.ts +5 -6
- package/src/react/client/RemoteThreadList.ts +6 -0
- package/src/react/client/Tools.ts +2 -3
- package/src/react/client/interactable-model-context.test.ts +56 -13
- package/src/react/client/interactable-model-context.ts +48 -23
- package/src/react/index.ts +2 -2
- package/src/react/interactables-legacy/Interactables.test.ts +221 -4
- package/src/react/interactables-legacy/Interactables.ts +25 -14
- package/src/react/interactables-legacy/interactable-model-context.ts +26 -24
- package/src/react/interactables-legacy/useAssistantInteractable.test.tsx +40 -22
- package/src/react/interactables-shared/useInteractablePersistenceQueue.test.tsx +22 -2
- package/src/react/interactables-shared/useInteractablePersistenceQueue.ts +63 -11
- package/src/react/model-context/useInteractable.test.tsx +56 -29
- package/src/react/primitive-hooks/useActionBarCopy.test.ts +5 -5
- package/src/react/primitive-hooks/useSuggestionTrigger.test.ts +33 -0
- package/src/react/primitive-hooks/useSuggestionTrigger.ts +7 -4
- package/src/react/primitives/generativeUI/GenerativeUI.test.tsx +170 -0
- package/src/react/primitives/generativeUI/GenerativeUI.tsx +43 -28
- package/src/react/primitives/message/MessageAttachments.test.tsx +2 -6
- package/src/react/primitives/message/MessageAttachments.tsx +14 -8
- package/src/react/primitives/message/MessageGroupedParts.test.tsx +155 -8
- package/src/react/primitives/message/MessageGroupedParts.tsx +19 -6
- package/src/react/primitives/message/MessageParts.test.tsx +84 -0
- package/src/react/primitives/message/MessageParts.tool-interaction.test.tsx +69 -0
- package/src/react/primitives/message/MessageParts.tsx +29 -8
- package/src/react/primitives/thread/ThreadMessages.test.tsx +25 -7
- package/src/react/primitives/thread/ThreadSuggestions.test.tsx +97 -0
- package/src/react/primitives/thread/ThreadSuggestions.tsx +29 -6
- package/src/react/providers/ReadonlyThreadProvider.tsx +2 -2
- package/src/react/providers/TextMessagePartProvider.tsx +3 -0
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.layout.test.tsx +62 -0
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.retry.test.tsx +2 -2
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.running.test.tsx +93 -0
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.test.tsx +181 -21
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.title.test.tsx +62 -17
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.tsx +112 -77
- package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +19 -3
- package/src/react/runtimes/RemoteThreadResource.ts +5 -2
- package/src/react/runtimes/assistant-transport/replayBoundaryStream.test.ts +3 -1
- package/src/react/runtimes/assistant-transport/replayBoundaryStream.ts +10 -2
- package/src/react/runtimes/assistant-transport/runManager.ts +3 -0
- package/src/react/runtimes/assistant-transport/transport-parentid.test.tsx +57 -0
- package/src/react/runtimes/assistant-transport/transport-scheduling.test.ts +73 -46
- package/src/react/runtimes/assistant-transport/transport-thread-id.test.tsx +571 -0
- package/src/react/runtimes/assistant-transport/types.ts +9 -1
- package/src/react/runtimes/assistant-transport/useAssistantTransport.spec.md +10 -0
- package/src/react/runtimes/assistant-transport/useAssistantTransportRuntime.test.tsx +108 -1
- package/src/react/runtimes/assistant-transport/useAssistantTransportRuntime.ts +33 -9
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.copy.integration.test.tsx +289 -0
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.copy.test.tsx +471 -0
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.engagement.test.tsx +330 -0
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.ts +78 -2
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.tsx +463 -2
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.ts +595 -227
- package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.test.ts +33 -4
- package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.ts +7 -3
- package/src/react/runtimes/cloud/auiV0.ts +275 -6
- package/src/react/runtimes/cloud/auiV0DecodeSafely.test.ts +873 -0
- package/src/react/runtimes/createMessageConverter.ts +9 -3
- package/src/react/runtimes/external-message-converter.test.ts +7 -3
- package/src/react/runtimes/external-store-history-copy.ts +223 -0
- package/src/react/runtimes/remote-thread-hook-on-tap.test.ts +2 -1
- package/src/react/runtimes/useExternalStoreRuntime.history-copy.test.tsx +483 -0
- package/src/react/runtimes/useExternalStoreRuntime.lifecycle.test.tsx +84 -3
- package/src/react/runtimes/useExternalStoreRuntime.suggestions.test.tsx +6 -2
- package/src/react/runtimes/useExternalStoreRuntime.ts +25 -5
- package/src/react/runtimes/useLocalRuntime.test.tsx +145 -1
- package/src/react/runtimes/useLocalRuntime.ts +8 -5
- package/src/react/runtimes/useRemoteThreadListRuntime.concurrent.test.tsx +84 -4
- package/src/react/runtimes/useRemoteThreadListRuntime.ts +5 -1
- package/src/react/types/MessagePartComponentTypes.ts +10 -0
- package/src/react/types/scopes/interactables.ts +3 -0
- package/src/runtime/api/attachment-runtime.ts +10 -5
- package/src/runtime/api/bindings.ts +6 -1
- package/src/runtime/api/composer-runtime.ts +29 -6
- package/src/runtime/api/message-part-runtime.test.ts +215 -0
- package/src/runtime/api/message-part-runtime.ts +44 -1
- package/src/runtime/api/message-runtime.test.ts +112 -2
- package/src/runtime/api/message-runtime.ts +25 -7
- package/src/runtime/api/thread-list-item-runtime.ts +5 -5
- package/src/runtime/api/thread-list-runtime.ts +3 -3
- package/src/runtime/api/thread-runtime.test.ts +59 -0
- package/src/runtime/api/thread-runtime.ts +21 -11
- package/src/runtime/base/base-composer-runtime-core.ts +548 -153
- package/src/runtime/base/base-thread-runtime-core.test.ts +1614 -136
- package/src/runtime/base/base-thread-runtime-core.ts +236 -46
- package/src/runtime/base/default-edit-composer-runtime-core.ts +24 -2
- package/src/runtime/base/default-thread-composer-runtime-core.ts +33 -3
- package/src/runtime/interfaces/composer-runtime-core.ts +19 -0
- package/src/runtime/interfaces/thread-runtime-core.ts +24 -1
- package/src/runtime/queue/message-queue.ts +11 -1
- package/src/runtime/utils/attachment-add-operations.ts +45 -2
- package/src/runtime/utils/attachment-send-operations.ts +54 -0
- package/src/runtime/utils/auto-status.test.ts +54 -0
- package/src/runtime/utils/auto-status.ts +3 -10
- package/src/runtime/utils/external-message-conversion.test.ts +91 -0
- package/src/runtime/utils/external-message-conversion.ts +9 -6
- package/src/runtime/utils/message-repository.test.ts +69 -1
- package/src/runtime/utils/message-repository.ts +14 -7
- package/src/runtime/utils/stored-message-parts.ts +216 -0
- package/src/runtime/utils/thread-message-like.test.ts +58 -0
- package/src/runtime/utils/thread-message-like.ts +79 -48
- package/src/runtime/utils/thread-runtime-lifecycle.test.ts +67 -0
- package/src/runtime/utils/thread-runtime-lifecycle.ts +42 -8
- package/src/runtime/utils/tool-interactions.test.ts +193 -0
- package/src/runtime/utils/tool-interactions.ts +147 -0
- package/src/runtimes/external-store/external-store-adapter.ts +25 -0
- package/src/runtimes/external-store/external-store-runtime-core.ts +10 -2
- package/src/runtimes/external-store/external-store-thread-list-runtime-core.ts +2 -2
- package/src/runtimes/external-store/external-store-thread-runtime-core.test.ts +49 -0
- package/src/runtimes/external-store/external-store-thread-runtime-core.ts +114 -32
- package/src/runtimes/inert/InertThreadRuntimeCore.test.ts +127 -56
- package/src/runtimes/inert/InertThreadRuntimeCore.ts +10 -1
- package/src/runtimes/local/local-thread-runtime-core.edit-cancellation.test.ts +70 -0
- package/src/runtimes/local/local-thread-runtime-core.test.ts +1866 -169
- package/src/runtimes/local/local-thread-runtime-core.ts +365 -40
- package/src/runtimes/readonly/ReadonlyThreadRuntimeCore.ts +53 -1
- package/src/runtimes/remote-thread-list/optimistic-state.ts +8 -3
- package/src/runtimes/tool-invocations/EDGE_CASES.md +19 -4
- package/src/runtimes/tool-invocations/ToolInvocationTracker.test.ts +392 -39
- package/src/runtimes/tool-invocations/ToolInvocationTracker.ts +31 -8
- package/src/store/clients/external-thread.test.ts +145 -0
- package/src/store/clients/external-thread.ts +669 -144
- package/src/store/clients/model-context-client.test.ts +8 -8
- package/src/store/clients/no-op-composer-client.ts +2 -0
- package/src/store/clients/submission-message.ts +27 -0
- package/src/store/clients/thread-message-client.test.ts +39 -0
- package/src/store/clients/thread-message-client.ts +13 -6
- package/src/store/index.ts +2 -2
- package/src/store/internal.ts +1 -0
- package/src/store/primitive-predicates.test.ts +119 -0
- package/src/store/primitive-predicates.ts +19 -4
- package/src/store/runtime-clients/composer-runtime-client.ts +4 -3
- package/src/store/runtime-clients/message-part-runtime-client.test.ts +42 -0
- package/src/store/runtime-clients/message-part-runtime-client.ts +4 -0
- package/src/store/runtime-clients/message-runtime-client.ts +5 -0
- package/src/store/runtime-clients/thread-runtime-client.test.tsx +243 -0
- package/src/store/runtime-clients/thread-runtime-client.ts +46 -9
- package/src/store/scopes/composer.ts +22 -4
- package/src/store/scopes/message.ts +12 -1
- package/src/store/scopes/part.ts +8 -0
- package/src/subscribable/subscribable.test.ts +205 -3
- package/src/subscribable/subscribable.ts +49 -7
- package/src/tests/RemoteThreadListThreadListRuntimeCore-errors.test.ts +95 -1
- package/src/tests/attachment-adapters.test.ts +16 -1
- package/src/tests/auiV0Encode.test.ts +412 -1
- package/src/tests/base-composer-runtime-core-addAttachment.test.ts +6 -6
- package/src/tests/base-composer-runtime-core-send.test.ts +722 -29
- package/src/tests/base-composer-runtime-core.test.ts +212 -5
- package/src/tests/composer-can-cancel.test.ts +35 -6
- package/src/tests/composer-can-send.test.ts +120 -1
- package/src/tests/composer-submission.test.tsx +796 -0
- package/src/tests/default-edit-composer-runtime-core.test.ts +149 -2
- package/src/tests/external-store-thread-list-runtime-core.test.ts +111 -0
- package/src/tests/external-store-thread-runtime-core-adapter.test.ts +810 -28
- package/src/tests/external-store-thread-runtime-core.test.ts +217 -0
- package/src/tests/external-thread-attachments.test.tsx +763 -26
- package/src/tests/external-thread-feedback.test.tsx +20 -7
- package/src/tests/external-thread-isLast.test.tsx +69 -0
- package/src/tests/external-thread-parity.test.tsx +1 -1
- package/src/tests/get-thread-state-isRunning.test.ts +2 -2
- package/src/tests/message-queue.test.ts +45 -10
- package/src/tests/remote-thread-list-adapter-switch.test.ts +45 -1
- package/src/tests/thread-switch-events.test.tsx +11 -7
- package/src/tests/useRemoteThreadListRuntime-controlled.test.tsx +2 -1
- package/src/types/message.test.ts +19 -0
- package/src/types/message.ts +65 -10
- package/src/utils/normalizePartStatus.ts +14 -1
- package/dist/tests/remote-thread-list-test-helpers.d.ts +0 -16
- package/dist/tests/remote-thread-list-test-helpers.d.ts.map +0 -1
- package/dist/tests/remote-thread-list-test-helpers.js +0 -59
- package/dist/tests/remote-thread-list-test-helpers.js.map +0 -1
|
@@ -876,6 +876,12 @@ const useRemoteThreadList = (
|
|
|
876
876
|
}
|
|
877
877
|
let lastAwaitedTask: Promise<void> | undefined;
|
|
878
878
|
while (isSameThread(store.value, threadId, session.mainThreadId)) {
|
|
879
|
+
// Rechecked each pass: the draft can become the new thread again
|
|
880
|
+
// mid-loop when its failed first save rolls it back, and switching to
|
|
881
|
+
// a new thread then re-adopts it, so no switch can move main off it.
|
|
882
|
+
if (threadId === store.value.newThreadId) {
|
|
883
|
+
throw new Error("Cannot ensure new thread is not main");
|
|
884
|
+
}
|
|
879
885
|
let switchTask = session.switchTask;
|
|
880
886
|
const startedFallback = !switchTask || switchTask === lastAwaitedTask;
|
|
881
887
|
if (startedFallback) {
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
import type { ToolCallMessagePartComponent } from "../types/MessagePartComponentTypes";
|
|
23
23
|
import { ModelContext } from "../../store/clients/model-context-client";
|
|
24
24
|
import { nullProtoRecord } from "../../utils/record";
|
|
25
|
+
import { runCleanups } from "../../subscribable/subscribable";
|
|
25
26
|
|
|
26
27
|
export type { McpAppResourceOutput };
|
|
27
28
|
|
|
@@ -127,9 +128,7 @@ const useTools = ({
|
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
|
|
130
|
-
return () =>
|
|
131
|
-
unsubscribes.forEach((fn) => fn());
|
|
132
|
-
};
|
|
131
|
+
return () => runCleanups(unsubscribes);
|
|
133
132
|
}, [toolkit, setToolUI]);
|
|
134
133
|
|
|
135
134
|
useAssistantScopeEffect(
|
|
@@ -9,7 +9,7 @@ vi.mock("../../utils/id", async (importOriginal) => ({
|
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
buildInteractableModelContext,
|
|
12
|
-
type
|
|
12
|
+
type StateJSONSchema,
|
|
13
13
|
} from "./interactable-model-context";
|
|
14
14
|
import type { Unstable_InteractableDefinition } from "../types/scopes/interactables";
|
|
15
15
|
|
|
@@ -26,12 +26,13 @@ const def = (
|
|
|
26
26
|
initialState: state,
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
const
|
|
29
|
+
const noteSchema = {
|
|
30
30
|
type: "object" as const,
|
|
31
31
|
properties: { title: { type: "string" as const } },
|
|
32
|
+
required: ["title"],
|
|
32
33
|
};
|
|
33
34
|
|
|
34
|
-
const
|
|
35
|
+
const taskBoardSchema = {
|
|
35
36
|
type: "object" as const,
|
|
36
37
|
properties: {
|
|
37
38
|
tasks: {
|
|
@@ -51,15 +52,23 @@ const partialTaskBoardSchema = {
|
|
|
51
52
|
|
|
52
53
|
const build = (
|
|
53
54
|
definitions: Record<string, Unstable_InteractableDefinition>,
|
|
54
|
-
cache: Map<string,
|
|
55
|
+
cache: Map<string, StateJSONSchema> = new Map([["n1", noteSchema]]),
|
|
56
|
+
// The tool is built from a snapshot, so a caller can pass a separate map to
|
|
57
|
+
// model what the runtime holds by the time the call arrives.
|
|
58
|
+
live: Record<string, Unstable_InteractableDefinition> = definitions,
|
|
55
59
|
) => {
|
|
56
60
|
const setDefState = vi.fn(
|
|
57
61
|
(id: string, updater: (prev: unknown) => unknown) => {
|
|
58
|
-
const d =
|
|
59
|
-
if (d)
|
|
62
|
+
const d = live[id];
|
|
63
|
+
if (d) live[id] = { ...d, state: updater(d.state) };
|
|
60
64
|
},
|
|
61
65
|
);
|
|
62
|
-
const ctx = buildInteractableModelContext(
|
|
66
|
+
const ctx = buildInteractableModelContext(
|
|
67
|
+
definitions,
|
|
68
|
+
cache,
|
|
69
|
+
setDefState,
|
|
70
|
+
() => live,
|
|
71
|
+
);
|
|
63
72
|
return { ctx, setDefState };
|
|
64
73
|
};
|
|
65
74
|
|
|
@@ -86,7 +95,7 @@ describe("buildInteractableModelContext", () => {
|
|
|
86
95
|
]);
|
|
87
96
|
});
|
|
88
97
|
|
|
89
|
-
it("
|
|
98
|
+
it("replaces the root required list with the id parameter", () => {
|
|
90
99
|
const { ctx } = build({ n1: def("n1", "note") });
|
|
91
100
|
const params = ctx!.tools["update_note"]!.parameters as {
|
|
92
101
|
properties: Record<string, unknown>;
|
|
@@ -148,7 +157,7 @@ describe("buildInteractableModelContext", () => {
|
|
|
148
157
|
it("exposes operation schemas for array fields", () => {
|
|
149
158
|
const { ctx } = build(
|
|
150
159
|
{ b1: def("b1", "taskBoard") },
|
|
151
|
-
new Map([["b1",
|
|
160
|
+
new Map([["b1", taskBoardSchema]]),
|
|
152
161
|
);
|
|
153
162
|
const params = ctx!.tools["update_taskBoard"]!.parameters as {
|
|
154
163
|
properties: {
|
|
@@ -171,7 +180,7 @@ describe("buildInteractableModelContext", () => {
|
|
|
171
180
|
it("omits id from add items but keeps it for update", () => {
|
|
172
181
|
const { ctx } = build(
|
|
173
182
|
{ b1: def("b1", "taskBoard") },
|
|
174
|
-
new Map([["b1",
|
|
183
|
+
new Map([["b1", taskBoardSchema]]),
|
|
175
184
|
);
|
|
176
185
|
const tasks = (
|
|
177
186
|
ctx!.tools["update_taskBoard"]!.parameters as {
|
|
@@ -220,7 +229,7 @@ describe("buildInteractableModelContext", () => {
|
|
|
220
229
|
|
|
221
230
|
it("mints an id for an added item that has none", async () => {
|
|
222
231
|
const defs = { b1: def("b1", "taskBoard", { tasks: [] }) };
|
|
223
|
-
const { ctx } = build(defs, new Map([["b1",
|
|
232
|
+
const { ctx } = build(defs, new Map([["b1", taskBoardSchema]]));
|
|
224
233
|
const result = await ctx!.tools["update_taskBoard"]!.execute!(
|
|
225
234
|
{ id: "b1", tasks: { add: [{ title: "Write tests", done: false }] } },
|
|
226
235
|
{} as never,
|
|
@@ -298,6 +307,40 @@ describe("buildInteractableModelContext", () => {
|
|
|
298
307
|
expect(setDefState).not.toHaveBeenCalled();
|
|
299
308
|
});
|
|
300
309
|
|
|
310
|
+
it("rejects a target that unmounted after the tool was built", async () => {
|
|
311
|
+
const built = { n1: def("n1", "note"), n2: def("n2", "note") };
|
|
312
|
+
const live: Record<string, Unstable_InteractableDefinition> = {
|
|
313
|
+
n2: def("n2", "note"),
|
|
314
|
+
};
|
|
315
|
+
const { ctx, setDefState } = build(built, undefined, live);
|
|
316
|
+
|
|
317
|
+
const result = (await ctx!.tools["update_note"]!.execute!(
|
|
318
|
+
{ id: "n1", title: "B" },
|
|
319
|
+
{} as never,
|
|
320
|
+
)) as { success: boolean; error?: string };
|
|
321
|
+
|
|
322
|
+
expect(result.success).toBe(false);
|
|
323
|
+
expect(result.error).toContain("Valid ids: n2");
|
|
324
|
+
expect(setDefState).not.toHaveBeenCalled();
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
it("rejects a same-id replacement registered under another name", async () => {
|
|
328
|
+
const built = { n1: def("n1", "note", { title: "A" }) };
|
|
329
|
+
const live: Record<string, Unstable_InteractableDefinition> = {
|
|
330
|
+
n1: def("n1", "board", { title: "replacement" }),
|
|
331
|
+
};
|
|
332
|
+
const { ctx, setDefState } = build(built, undefined, live);
|
|
333
|
+
|
|
334
|
+
const result = (await ctx!.tools["update_note"]!.execute!(
|
|
335
|
+
{ id: "n1", title: "B" },
|
|
336
|
+
{} as never,
|
|
337
|
+
)) as { success: boolean; error?: string };
|
|
338
|
+
|
|
339
|
+
expect(result.success).toBe(false);
|
|
340
|
+
expect(setDefState).not.toHaveBeenCalled();
|
|
341
|
+
expect(live["n1"]!.state).toEqual({ title: "replacement" });
|
|
342
|
+
});
|
|
343
|
+
|
|
301
344
|
it("rejects an id-less call when multiple instances exist", async () => {
|
|
302
345
|
const defs = { n1: def("n1", "note"), n2: def("n2", "note") };
|
|
303
346
|
const { ctx, setDefState } = build(defs);
|
|
@@ -328,7 +371,7 @@ describe("buildInteractableModelContext", () => {
|
|
|
328
371
|
],
|
|
329
372
|
}),
|
|
330
373
|
};
|
|
331
|
-
const { ctx } = build(defs, new Map([["b1",
|
|
374
|
+
const { ctx } = build(defs, new Map([["b1", taskBoardSchema]]));
|
|
332
375
|
|
|
333
376
|
await ctx!.tools["update_taskBoard"]!.execute!(
|
|
334
377
|
{
|
|
@@ -422,7 +465,7 @@ describe("buildInteractableModelContext", () => {
|
|
|
422
465
|
tasks: [{ id: "a", title: "A", done: false }],
|
|
423
466
|
}),
|
|
424
467
|
};
|
|
425
|
-
const { ctx } = build(defs, new Map([["b1",
|
|
468
|
+
const { ctx } = build(defs, new Map([["b1", taskBoardSchema]]));
|
|
426
469
|
const context = { toolCallId: "call-1" } as never;
|
|
427
470
|
|
|
428
471
|
await ctx!.tools["update_taskBoard"]!.streamCall!(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Tool } from "assistant-stream";
|
|
2
2
|
import { toJSONSchema } from "assistant-stream";
|
|
3
|
+
import { getPartialJsonObjectMeta } from "assistant-stream/utils";
|
|
3
4
|
import type { Unstable_InteractableDefinition } from "../types/scopes/interactables";
|
|
4
5
|
import {
|
|
5
6
|
interactableToolName,
|
|
@@ -10,7 +11,7 @@ import { generateId } from "../../utils/id";
|
|
|
10
11
|
import { isRecord } from "../../utils/json/is-json";
|
|
11
12
|
import { nullProtoRecord } from "../../utils/record";
|
|
12
13
|
|
|
13
|
-
export type
|
|
14
|
+
export type StateJSONSchema = ReturnType<typeof toJSONSchema>;
|
|
14
15
|
|
|
15
16
|
const ID_PROPERTY = {
|
|
16
17
|
type: "string" as const,
|
|
@@ -110,12 +111,13 @@ const withArrayUpdateSchemas = (properties: Record<string, unknown>) =>
|
|
|
110
111
|
);
|
|
111
112
|
|
|
112
113
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
114
|
+
* Replaces the state schema's root `required` list with the `id` parameter,
|
|
115
|
+
* so every top-level field is optional while nested objects keep theirs and
|
|
116
|
+
* travel whole through the shallow merge. Falls back to a permissive schema
|
|
117
|
+
* when the JSON Schema conversion failed at registration time.
|
|
116
118
|
*/
|
|
117
|
-
function withRequiredId(
|
|
118
|
-
if (!
|
|
119
|
+
function withRequiredId(schema: StateJSONSchema | undefined) {
|
|
120
|
+
if (!schema || typeof schema !== "object" || schema.type !== "object") {
|
|
119
121
|
return {
|
|
120
122
|
type: "object" as const,
|
|
121
123
|
properties: { id: ID_PROPERTY },
|
|
@@ -123,16 +125,16 @@ function withRequiredId(partial: PartialJSONSchema | undefined) {
|
|
|
123
125
|
additionalProperties: true,
|
|
124
126
|
};
|
|
125
127
|
}
|
|
126
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
128
|
+
if (process.env.NODE_ENV !== "production" && schema.properties?.id) {
|
|
127
129
|
console.warn(
|
|
128
130
|
`[Interactables] a top-level "id" field in an interactable's stateSchema is ` +
|
|
129
131
|
`reserved for instance addressing by the update tool and cannot be updated ` +
|
|
130
132
|
`by the model. Rename the field to make it model-writable.`,
|
|
131
133
|
);
|
|
132
134
|
}
|
|
133
|
-
const { id: _reserved, ...properties } =
|
|
135
|
+
const { id: _reserved, ...properties } = schema.properties ?? {};
|
|
134
136
|
return {
|
|
135
|
-
...
|
|
137
|
+
...schema,
|
|
136
138
|
properties: { id: ID_PROPERTY, ...withArrayUpdateSchemas(properties) },
|
|
137
139
|
required: ["id"],
|
|
138
140
|
};
|
|
@@ -140,8 +142,9 @@ function withRequiredId(partial: PartialJSONSchema | undefined) {
|
|
|
140
142
|
|
|
141
143
|
export function buildInteractableModelContext(
|
|
142
144
|
definitions: Record<string, Unstable_InteractableDefinition>,
|
|
143
|
-
|
|
145
|
+
schemaCache: Map<string, StateJSONSchema>,
|
|
144
146
|
setDefState: (id: string, updater: (prev: unknown) => unknown) => void,
|
|
147
|
+
getCurrentDefinitions: () => Record<string, Unstable_InteractableDefinition>,
|
|
145
148
|
streamBaselines = new Map<string, { targetId: string; state: unknown }>(),
|
|
146
149
|
):
|
|
147
150
|
| {
|
|
@@ -174,10 +177,10 @@ export function buildInteractableModelContext(
|
|
|
174
177
|
}
|
|
175
178
|
|
|
176
179
|
const first = instances[0]!;
|
|
177
|
-
const
|
|
180
|
+
const jsonSchema = schemaCache.get(first.id);
|
|
178
181
|
const idKeyedFields =
|
|
179
|
-
|
|
180
|
-
? idKeyedArrayFieldNames(
|
|
182
|
+
jsonSchema && isRecord(jsonSchema.properties)
|
|
183
|
+
? idKeyedArrayFieldNames(jsonSchema.properties)
|
|
181
184
|
: new Set<string>();
|
|
182
185
|
|
|
183
186
|
// `id` resolves to a definition of this name; an id-less call is accepted
|
|
@@ -198,8 +201,9 @@ export function buildInteractableModelContext(
|
|
|
198
201
|
`Update the state of interactable component "${name}". ${first.description} ` +
|
|
199
202
|
`Pass the id of the instance to update — instance ids and current state ` +
|
|
200
203
|
`appear in the conversation as state snapshots. Only include the fields ` +
|
|
201
|
-
`you want to change; omitted fields keep their current values
|
|
202
|
-
|
|
204
|
+
`you want to change; omitted fields keep their current values. A nested ` +
|
|
205
|
+
`object replaces the existing one, so send it complete.`,
|
|
206
|
+
parameters: withRequiredId(jsonSchema),
|
|
203
207
|
streamCall: async (reader, { toolCallId }) => {
|
|
204
208
|
try {
|
|
205
209
|
for await (const partialArgs of reader.args.streamValues()) {
|
|
@@ -213,19 +217,29 @@ export function buildInteractableModelContext(
|
|
|
213
217
|
if (Object.keys(partial).length === 0) continue;
|
|
214
218
|
const target = resolveTarget(id);
|
|
215
219
|
if (!target) continue;
|
|
220
|
+
const currentTarget = getCurrentDefinitions()[target.id];
|
|
221
|
+
if (currentTarget?.name !== name) continue;
|
|
216
222
|
|
|
217
223
|
const baseline = streamBaselines.get(toolCallId);
|
|
218
224
|
const arrayBaseline =
|
|
219
|
-
baseline?.targetId === target.id
|
|
225
|
+
baseline?.targetId === target.id
|
|
226
|
+
? baseline.state
|
|
227
|
+
: currentTarget.state;
|
|
220
228
|
if (!baseline || baseline.targetId !== target.id) {
|
|
221
229
|
streamBaselines.set(toolCallId, {
|
|
222
230
|
targetId: target.id,
|
|
223
|
-
state:
|
|
231
|
+
state: currentTarget.state,
|
|
224
232
|
});
|
|
225
233
|
}
|
|
226
234
|
|
|
235
|
+
const partialPath = getPartialJsonObjectMeta(
|
|
236
|
+
args as Record<symbol, unknown>,
|
|
237
|
+
)?.partialPath;
|
|
227
238
|
setDefState(target.id, (prev) =>
|
|
228
|
-
shallowMergeInteractableState(prev, partial, {
|
|
239
|
+
shallowMergeInteractableState(prev, partial, {
|
|
240
|
+
arrayBaseline,
|
|
241
|
+
partialPath,
|
|
242
|
+
}),
|
|
229
243
|
);
|
|
230
244
|
}
|
|
231
245
|
} catch {
|
|
@@ -235,8 +249,17 @@ export function buildInteractableModelContext(
|
|
|
235
249
|
execute: async (args: unknown, { toolCallId }) => {
|
|
236
250
|
const { id, ...partial } = (args ?? {}) as Record<string, unknown>;
|
|
237
251
|
const target = resolveTarget(id);
|
|
238
|
-
|
|
239
|
-
|
|
252
|
+
// The tool was built from a snapshot, so the target may have unmounted
|
|
253
|
+
// or been replaced under the same id since; mutating either would
|
|
254
|
+
// report success for a write nothing receives.
|
|
255
|
+
const currentDefinitions = getCurrentDefinitions();
|
|
256
|
+
const currentTarget = target
|
|
257
|
+
? currentDefinitions[target.id]
|
|
258
|
+
: undefined;
|
|
259
|
+
if (!currentTarget || currentTarget.name !== name) {
|
|
260
|
+
const validIds = Object.values(currentDefinitions)
|
|
261
|
+
.filter((def) => def.name === name)
|
|
262
|
+
.map((def) => def.id);
|
|
240
263
|
return {
|
|
241
264
|
success: false,
|
|
242
265
|
error: `Unknown id ${JSON.stringify(id)} for interactable "${name}". Valid ids: ${validIds.join(", ")}`,
|
|
@@ -245,10 +268,12 @@ export function buildInteractableModelContext(
|
|
|
245
268
|
const baseline = streamBaselines.get(toolCallId);
|
|
246
269
|
streamBaselines.delete(toolCallId);
|
|
247
270
|
const addedItemIds = nullProtoRecord<string[]>();
|
|
248
|
-
setDefState(
|
|
271
|
+
setDefState(currentTarget.id, (prev) =>
|
|
249
272
|
shallowMergeInteractableState(prev, partial, {
|
|
250
273
|
arrayBaseline:
|
|
251
|
-
baseline?.targetId ===
|
|
274
|
+
baseline?.targetId === currentTarget.id
|
|
275
|
+
? baseline.state
|
|
276
|
+
: undefined,
|
|
252
277
|
idFactory: (field) => {
|
|
253
278
|
const itemId = generateId();
|
|
254
279
|
(addedItemIds[field] ??= []).push(itemId);
|
|
@@ -263,7 +288,7 @@ export function buildInteractableModelContext(
|
|
|
263
288
|
success: true;
|
|
264
289
|
id: string;
|
|
265
290
|
addedItemIds?: Record<string, string[]>;
|
|
266
|
-
} = { success: true, id:
|
|
291
|
+
} = { success: true, id: currentTarget.id };
|
|
267
292
|
if (Object.keys(addedItemIds).length > 0) {
|
|
268
293
|
result.addedItemIds = { ...addedItemIds };
|
|
269
294
|
}
|
package/src/react/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference path="../store/scope-registration.ts" />
|
|
2
|
-
/// <reference path="./types/store-augmentation.ts" />
|
|
1
|
+
/// <reference path="../store/scope-registration.ts" preserve="true" />
|
|
2
|
+
/// <reference path="./types/store-augmentation.ts" preserve="true" />
|
|
3
3
|
|
|
4
4
|
// model-context
|
|
5
5
|
export {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
2
|
import { createTapRoot, flushTapSync, useResource } from "@assistant-ui/tap";
|
|
3
|
+
import { parsePartialJsonObject } from "assistant-stream/utils";
|
|
4
|
+
import { z } from "zod";
|
|
3
5
|
import type {
|
|
6
|
+
InteractablePersistedState,
|
|
4
7
|
InteractablePersistenceAdapter,
|
|
5
8
|
InteractableRegistration,
|
|
6
9
|
} from "./scopes";
|
|
@@ -8,7 +11,12 @@ import type {
|
|
|
8
11
|
const clientHolder: { client: unknown } = { client: null };
|
|
9
12
|
const clientListeners = new Set<() => void>();
|
|
10
13
|
let registeredModelContextProvider:
|
|
11
|
-
| {
|
|
14
|
+
| {
|
|
15
|
+
getModelContext?: () => {
|
|
16
|
+
tools?: Record<string, { parameters?: unknown }>;
|
|
17
|
+
};
|
|
18
|
+
subscribe?: (callback: () => void) => () => void;
|
|
19
|
+
}
|
|
12
20
|
| undefined;
|
|
13
21
|
|
|
14
22
|
vi.mock("@assistant-ui/store", async (importOriginal) => {
|
|
@@ -89,7 +97,10 @@ const reg = (id: string): InteractableRegistration => ({
|
|
|
89
97
|
id,
|
|
90
98
|
name: "note",
|
|
91
99
|
description: "a note",
|
|
92
|
-
stateSchema: {
|
|
100
|
+
stateSchema: {
|
|
101
|
+
type: "object",
|
|
102
|
+
properties: {},
|
|
103
|
+
} satisfies InteractableRegistration["stateSchema"],
|
|
93
104
|
initialState: { v: 0 },
|
|
94
105
|
});
|
|
95
106
|
|
|
@@ -110,6 +121,139 @@ afterEach(() => {
|
|
|
110
121
|
vi.restoreAllMocks();
|
|
111
122
|
});
|
|
112
123
|
|
|
124
|
+
describe("legacy Interactables update tool", () => {
|
|
125
|
+
it("relaxes only the root requirement of the update tool", async () => {
|
|
126
|
+
const stateSchema = z.object({
|
|
127
|
+
title: z.string(),
|
|
128
|
+
settings: z.object({ name: z.string(), size: z.number() }),
|
|
129
|
+
});
|
|
130
|
+
root = mount();
|
|
131
|
+
await flushMicrotasks();
|
|
132
|
+
root.getValue().register({
|
|
133
|
+
...reg("n1"),
|
|
134
|
+
stateSchema,
|
|
135
|
+
initialState: { title: "old", settings: { name: "n", size: 1 } },
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const tool = registeredModelContextProvider?.getModelContext?.().tools
|
|
139
|
+
?.update_note as
|
|
140
|
+
| {
|
|
141
|
+
parameters: {
|
|
142
|
+
required?: string[];
|
|
143
|
+
properties: { settings: { required?: string[] } };
|
|
144
|
+
};
|
|
145
|
+
execute(
|
|
146
|
+
args: Record<string, unknown>,
|
|
147
|
+
context: { toolCallId: string },
|
|
148
|
+
): Promise<unknown>;
|
|
149
|
+
}
|
|
150
|
+
| undefined;
|
|
151
|
+
expect(tool).toBeDefined();
|
|
152
|
+
const { parameters } = tool!;
|
|
153
|
+
expect("~standard" in parameters).toBe(false);
|
|
154
|
+
expect(parameters.required).toBeUndefined();
|
|
155
|
+
expect(parameters.properties.settings.required).toEqual(["name", "size"]);
|
|
156
|
+
|
|
157
|
+
await tool!.execute({ title: "new" }, { toolCallId: "call-1" });
|
|
158
|
+
await tool!.execute(
|
|
159
|
+
{ settings: { name: "new", size: 2 } },
|
|
160
|
+
{ toolCallId: "call-2" },
|
|
161
|
+
);
|
|
162
|
+
await flushMicrotasks();
|
|
163
|
+
expect(
|
|
164
|
+
stateSchema.parse(root.getValue().getState().definitions["n1"]?.state),
|
|
165
|
+
).toEqual({ title: "new", settings: { name: "new", size: 2 } });
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it("keeps a streaming nested object parseable at every token", async () => {
|
|
169
|
+
const stateSchema = z.object({
|
|
170
|
+
title: z.string(),
|
|
171
|
+
settings: z.object({ name: z.string(), size: z.number() }),
|
|
172
|
+
});
|
|
173
|
+
root = mount();
|
|
174
|
+
await flushMicrotasks();
|
|
175
|
+
root.getValue().register({
|
|
176
|
+
...reg("n1"),
|
|
177
|
+
stateSchema,
|
|
178
|
+
initialState: { title: "old", settings: { name: "n", size: 1 } },
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const tool = registeredModelContextProvider?.getModelContext?.().tools
|
|
182
|
+
?.update_note as
|
|
183
|
+
| {
|
|
184
|
+
streamCall(reader: {
|
|
185
|
+
args: { streamValues(): AsyncIterable<unknown> };
|
|
186
|
+
}): Promise<unknown>;
|
|
187
|
+
execute(
|
|
188
|
+
args: Record<string, unknown>,
|
|
189
|
+
context: { toolCallId: string },
|
|
190
|
+
): Promise<unknown>;
|
|
191
|
+
}
|
|
192
|
+
| undefined;
|
|
193
|
+
expect(tool).toBeDefined();
|
|
194
|
+
|
|
195
|
+
const text = '{"settings":{"name":"medium","size":2}}';
|
|
196
|
+
const ticks: { prefix: string; state: unknown }[] = [];
|
|
197
|
+
await tool!.streamCall({
|
|
198
|
+
args: {
|
|
199
|
+
async *streamValues() {
|
|
200
|
+
for (let end = 1; end <= text.length; end++) {
|
|
201
|
+
const parsed = parsePartialJsonObject(text.slice(0, end));
|
|
202
|
+
if (!parsed) continue;
|
|
203
|
+
yield parsed;
|
|
204
|
+
await flushMicrotasks();
|
|
205
|
+
ticks.push({
|
|
206
|
+
prefix: text.slice(0, end),
|
|
207
|
+
state: root!.getValue().getState().definitions["n1"]?.state,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
for (const { prefix, state } of ticks) {
|
|
214
|
+
expect(stateSchema.safeParse(state).success, prefix).toBe(true);
|
|
215
|
+
}
|
|
216
|
+
const distinct = ticks
|
|
217
|
+
.map(({ state }) => JSON.stringify(state))
|
|
218
|
+
.filter((state, index, all) => state !== all[index - 1])
|
|
219
|
+
.map((state) => JSON.parse(state));
|
|
220
|
+
expect(distinct).toEqual(
|
|
221
|
+
["n", "", "m", "me", "med", "medi", "mediu", "medium"]
|
|
222
|
+
.map((name) => ({ title: "old", settings: { name, size: 1 } }))
|
|
223
|
+
.concat({ title: "old", settings: { name: "medium", size: 2 } }),
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
await tool!.execute(JSON.parse(text), { toolCallId: "call-1" });
|
|
227
|
+
await flushMicrotasks();
|
|
228
|
+
expect(
|
|
229
|
+
stateSchema.parse(root.getValue().getState().definitions["n1"]?.state),
|
|
230
|
+
).toEqual({ title: "old", settings: { name: "medium", size: 2 } });
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it("falls back to the raw schema when a re-registration cannot convert", async () => {
|
|
234
|
+
const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
|
|
235
|
+
const unconvertible = {
|
|
236
|
+
"~standard": {
|
|
237
|
+
version: 1 as const,
|
|
238
|
+
vendor: "zod",
|
|
239
|
+
validate: () => ({ value: {} }),
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
root = mount();
|
|
243
|
+
await flushMicrotasks();
|
|
244
|
+
root
|
|
245
|
+
.getValue()
|
|
246
|
+
.register({ ...reg("n1"), stateSchema: z.object({ v: z.number() }) });
|
|
247
|
+
root.getValue().register({ ...reg("n1"), stateSchema: unconvertible });
|
|
248
|
+
|
|
249
|
+
expect(
|
|
250
|
+
registeredModelContextProvider?.getModelContext?.().tools?.update_note
|
|
251
|
+
?.parameters,
|
|
252
|
+
).toBe(unconvertible);
|
|
253
|
+
expect(warn).toHaveBeenCalledOnce();
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
|
|
113
257
|
describe("legacy Interactables persistence", () => {
|
|
114
258
|
it("notifies every model-context subscriber when one throws", async () => {
|
|
115
259
|
root = mount();
|
|
@@ -152,9 +296,24 @@ describe("legacy Interactables persistence", () => {
|
|
|
152
296
|
expect(secondSave).not.toHaveBeenCalled();
|
|
153
297
|
});
|
|
154
298
|
|
|
299
|
+
it("does not retain edits made before an adapter attaches", async () => {
|
|
300
|
+
const save = vi.fn();
|
|
301
|
+
root = mount();
|
|
302
|
+
await flushMicrotasks();
|
|
303
|
+
root.getValue().register(reg("n1"));
|
|
304
|
+
root.getValue().setState("n1", () => ({ v: 1 }));
|
|
305
|
+
|
|
306
|
+
root.getValue().setPersistenceAdapter({ save });
|
|
307
|
+
await root.getValue().flush();
|
|
308
|
+
|
|
309
|
+
expect(save).not.toHaveBeenCalled();
|
|
310
|
+
});
|
|
311
|
+
|
|
155
312
|
it("keeps edits queued during an in-flight flush with the outgoing adapter", async () => {
|
|
156
313
|
const saveResolvers: Array<() => void> = [];
|
|
157
|
-
const firstSave = vi.fn
|
|
314
|
+
const firstSave = vi.fn<
|
|
315
|
+
(state: InteractablePersistedState) => Promise<void>
|
|
316
|
+
>(
|
|
158
317
|
() =>
|
|
159
318
|
new Promise<void>((resolve) => {
|
|
160
319
|
saveResolvers.push(resolve);
|
|
@@ -177,7 +336,7 @@ describe("legacy Interactables persistence", () => {
|
|
|
177
336
|
saveResolvers[0]!();
|
|
178
337
|
await flushMicrotasks();
|
|
179
338
|
expect(firstSave).toHaveBeenCalledTimes(2);
|
|
180
|
-
expect(firstSave.mock.calls[1]
|
|
339
|
+
expect(firstSave.mock.calls[1]?.[0]).toEqual({
|
|
181
340
|
n1: { name: "note", state: { v: 2 } },
|
|
182
341
|
});
|
|
183
342
|
expect(firstSave.mock.calls.at(-1)?.[0]).toEqual({
|
|
@@ -283,6 +442,64 @@ describe("legacy Interactables persistence", () => {
|
|
|
283
442
|
expect(root.getValue().getState().persistence["n1"]).toBeUndefined();
|
|
284
443
|
});
|
|
285
444
|
|
|
445
|
+
it("does not publish a previous adapter's failure into the new adapter's scope", async () => {
|
|
446
|
+
let rejectFirstSave!: (reason: unknown) => void;
|
|
447
|
+
const firstSave = vi.fn(
|
|
448
|
+
() =>
|
|
449
|
+
new Promise<void>((_resolve, reject) => {
|
|
450
|
+
rejectFirstSave = reject;
|
|
451
|
+
}),
|
|
452
|
+
);
|
|
453
|
+
const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
|
|
454
|
+
root = mount();
|
|
455
|
+
await flushMicrotasks();
|
|
456
|
+
root.getValue().setPersistenceAdapter({ save: firstSave });
|
|
457
|
+
root.getValue().register(reg("n1"));
|
|
458
|
+
|
|
459
|
+
root.getValue().setState("n1", () => ({ v: 1 }));
|
|
460
|
+
await vi.advanceTimersByTimeAsync(500);
|
|
461
|
+
root.getValue().setPersistenceAdapter({ save: vi.fn() });
|
|
462
|
+
await flushMicrotasks();
|
|
463
|
+
|
|
464
|
+
rejectFirstSave(new Error("stale adapter save failed"));
|
|
465
|
+
await flushMicrotasks();
|
|
466
|
+
|
|
467
|
+
expect(root.getValue().getState().persistence["n1"]?.error).toBeUndefined();
|
|
468
|
+
expect(warn).toHaveBeenCalledWith(
|
|
469
|
+
"[Interactables] Persistence save failed after the adapter changed.",
|
|
470
|
+
expect.any(Error),
|
|
471
|
+
);
|
|
472
|
+
warn.mockRestore();
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
it("keeps an in-flight save failure in the same scope across a detach and reattach", async () => {
|
|
476
|
+
let rejectSave!: (reason: unknown) => void;
|
|
477
|
+
const save = vi.fn(
|
|
478
|
+
() =>
|
|
479
|
+
new Promise<void>((_resolve, reject) => {
|
|
480
|
+
rejectSave = reject;
|
|
481
|
+
}),
|
|
482
|
+
);
|
|
483
|
+
const adapter: InteractablePersistenceAdapter = { save };
|
|
484
|
+
root = mount();
|
|
485
|
+
await flushMicrotasks();
|
|
486
|
+
root.getValue().setPersistenceAdapter(adapter);
|
|
487
|
+
root.getValue().register(reg("n1"));
|
|
488
|
+
|
|
489
|
+
root.getValue().setState("n1", () => ({ v: 1 }));
|
|
490
|
+
await vi.advanceTimersByTimeAsync(500);
|
|
491
|
+
root.getValue().setPersistenceAdapter(undefined);
|
|
492
|
+
root.getValue().setPersistenceAdapter(adapter);
|
|
493
|
+
await flushMicrotasks();
|
|
494
|
+
|
|
495
|
+
rejectSave(new Error("same scope save failed"));
|
|
496
|
+
await flushMicrotasks();
|
|
497
|
+
|
|
498
|
+
expect(root.getValue().getState().persistence["n1"]?.error).toBeInstanceOf(
|
|
499
|
+
Error,
|
|
500
|
+
);
|
|
501
|
+
});
|
|
502
|
+
|
|
286
503
|
it("keeps an interactable pending while its newer edit is queued", async () => {
|
|
287
504
|
const saveResolvers: Array<() => void> = [];
|
|
288
505
|
const firstSave = vi.fn(
|