@assistant-ui/core 0.3.18 → 0.3.20
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 +9 -10
- package/dist/adapters/attachment.d.ts.map +1 -1
- package/dist/adapters/attachment.js +2 -1
- package/dist/adapters/attachment.js.map +1 -1
- package/dist/adapters/directive-formatter.d.ts +1 -2
- package/dist/adapters/directive-formatter.d.ts.map +1 -1
- package/dist/adapters/feedback.d.ts +2 -2
- package/dist/adapters/feedback.d.ts.map +1 -1
- package/dist/adapters/speech.d.ts +6 -7
- package/dist/adapters/speech.d.ts.map +1 -1
- package/dist/adapters/speech.js +13 -3
- package/dist/adapters/speech.js.map +1 -1
- package/dist/adapters/suggestion.d.ts +5 -6
- package/dist/adapters/suggestion.d.ts.map +1 -1
- package/dist/adapters/thread-history.d.ts +10 -7
- package/dist/adapters/thread-history.d.ts.map +1 -1
- package/dist/adapters/trigger.d.ts +1 -2
- package/dist/adapters/trigger.d.ts.map +1 -1
- package/dist/adapters/voice.d.ts +5 -6
- package/dist/adapters/voice.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/internal/duplicate-detection.d.ts +1 -2
- package/dist/internal/duplicate-detection.d.ts.map +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/model-context/frame/host.d.ts +1 -2
- package/dist/model-context/frame/host.d.ts.map +1 -1
- package/dist/model-context/frame/host.js +26 -11
- package/dist/model-context/frame/host.js.map +1 -1
- package/dist/model-context/frame/provider.d.ts +1 -2
- package/dist/model-context/frame/provider.d.ts.map +1 -1
- package/dist/model-context/frame/types.d.ts +5 -6
- package/dist/model-context/frame/types.d.ts.map +1 -1
- package/dist/model-context/interactable-composer-metadata.d.ts +9 -10
- package/dist/model-context/interactable-composer-metadata.d.ts.map +1 -1
- package/dist/model-context/interactable-composer-metadata.js +11 -9
- package/dist/model-context/interactable-composer-metadata.js.map +1 -1
- package/dist/model-context/registry-handles.d.ts +3 -4
- package/dist/model-context/registry-handles.d.ts.map +1 -1
- package/dist/model-context/registry.d.ts +1 -2
- package/dist/model-context/registry.d.ts.map +1 -1
- package/dist/model-context/tool-call-text.d.ts +2 -3
- package/dist/model-context/tool-call-text.d.ts.map +1 -1
- package/dist/model-context/tool.d.ts +2 -3
- package/dist/model-context/tool.d.ts.map +1 -1
- package/dist/model-context/types.d.ts +8 -9
- package/dist/model-context/types.d.ts.map +1 -1
- package/dist/react/AssistantProvider.d.ts +3 -4
- package/dist/react/AssistantProvider.d.ts.map +1 -1
- package/dist/react/AssistantRuntimeProvider.d.ts +1 -2
- package/dist/react/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/react/RuntimeAdapter.d.ts +2 -3
- package/dist/react/RuntimeAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts +4 -5
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js +43 -19
- package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
- package/dist/react/adapters/TitleGenerationAdapter.d.ts +2 -3
- package/dist/react/adapters/TitleGenerationAdapter.d.ts.map +1 -1
- package/dist/react/client/AdaptedRemoteThread.d.ts +1 -2
- package/dist/react/client/AdaptedRemoteThread.d.ts.map +1 -1
- package/dist/react/client/DataRenderers.d.ts +1 -2
- package/dist/react/client/DataRenderers.d.ts.map +1 -1
- package/dist/react/client/DataRenderers.js +20 -15
- package/dist/react/client/DataRenderers.js.map +1 -1
- package/dist/react/client/InMemoryThreadList.d.ts +3 -4
- package/dist/react/client/InMemoryThreadList.d.ts.map +1 -1
- package/dist/react/client/Interactables.d.ts +1 -2
- package/dist/react/client/Interactables.d.ts.map +1 -1
- package/dist/react/client/Interactables.js +11 -5
- package/dist/react/client/Interactables.js.map +1 -1
- package/dist/react/client/RemoteThreadList.d.ts +2 -3
- package/dist/react/client/RemoteThreadList.d.ts.map +1 -1
- package/dist/react/client/RemoteThreadList.js +3 -2
- package/dist/react/client/RemoteThreadList.js.map +1 -1
- package/dist/react/client/Tools.d.ts +2 -2
- package/dist/react/client/Tools.d.ts.map +1 -1
- package/dist/react/client/interactable-model-context.d.ts +2 -3
- package/dist/react/client/interactable-model-context.d.ts.map +1 -1
- package/dist/react/client/interactable-model-context.js +3 -2
- package/dist/react/client/interactable-model-context.js.map +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -2
- package/dist/react/interactables-legacy/Interactables.d.ts +1 -2
- package/dist/react/interactables-legacy/Interactables.d.ts.map +1 -1
- package/dist/react/interactables-legacy/interactable-model-context.d.ts +2 -3
- package/dist/react/interactables-legacy/interactable-model-context.d.ts.map +1 -1
- package/dist/react/interactables-legacy/scopes.d.ts +9 -10
- package/dist/react/interactables-legacy/scopes.d.ts.map +1 -1
- package/dist/react/interactables-legacy/useAssistantInteractable.d.ts +2 -3
- package/dist/react/interactables-legacy/useAssistantInteractable.d.ts.map +1 -1
- package/dist/react/interactables-legacy/useAssistantInteractable.js +3 -0
- package/dist/react/interactables-legacy/useAssistantInteractable.js.map +1 -1
- package/dist/react/interactables-legacy/useInteractableState.d.ts +1 -2
- package/dist/react/interactables-legacy/useInteractableState.d.ts.map +1 -1
- package/dist/react/interactables-shared/useInteractablePersistenceQueue.d.ts +1 -2
- package/dist/react/interactables-shared/useInteractablePersistenceQueue.d.ts.map +1 -1
- package/dist/react/model-context/define-mcp-toolkit.d.ts +4 -5
- package/dist/react/model-context/define-mcp-toolkit.d.ts.map +1 -1
- package/dist/react/model-context/define-toolkit.d.ts +2 -3
- package/dist/react/model-context/define-toolkit.d.ts.map +1 -1
- package/dist/react/model-context/external-tool.d.ts +1 -2
- package/dist/react/model-context/external-tool.d.ts.map +1 -1
- package/dist/react/model-context/human-tool.d.ts +3 -4
- package/dist/react/model-context/human-tool.d.ts.map +1 -1
- package/dist/react/model-context/interactableTool.d.ts +3 -4
- package/dist/react/model-context/interactableTool.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantDataUI.d.ts +2 -3
- package/dist/react/model-context/makeAssistantDataUI.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantTool.d.ts +2 -3
- package/dist/react/model-context/makeAssistantTool.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantToolUI.d.ts +2 -3
- package/dist/react/model-context/makeAssistantToolUI.d.ts.map +1 -1
- package/dist/react/model-context/provider-tool.d.ts +2 -3
- package/dist/react/model-context/provider-tool.d.ts.map +1 -1
- package/dist/react/model-context/stub-tool.d.ts +1 -2
- package/dist/react/model-context/stub-tool.d.ts.map +1 -1
- package/dist/react/model-context/toolbox.d.ts +9 -10
- package/dist/react/model-context/toolbox.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantContext.d.ts +2 -2
- package/dist/react/model-context/useAssistantContext.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantDataUI.d.ts +2 -3
- package/dist/react/model-context/useAssistantDataUI.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantInstructions.d.ts +2 -2
- package/dist/react/model-context/useAssistantInstructions.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantTool.d.ts +2 -3
- package/dist/react/model-context/useAssistantTool.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantToolUI.d.ts +2 -3
- package/dist/react/model-context/useAssistantToolUI.d.ts.map +1 -1
- package/dist/react/model-context/useAuiToolOverrides.d.ts +1 -2
- package/dist/react/model-context/useAuiToolOverrides.d.ts.map +1 -1
- package/dist/react/model-context/useInlineRender.d.ts +1 -2
- package/dist/react/model-context/useInlineRender.d.ts.map +1 -1
- package/dist/react/model-context/useInteractable.d.ts +4 -5
- package/dist/react/model-context/useInteractable.d.ts.map +1 -1
- package/dist/react/model-context/useInteractable.js +4 -1
- package/dist/react/model-context/useInteractable.js.map +1 -1
- package/dist/react/model-context/useInteractableState.d.ts +1 -2
- package/dist/react/model-context/useInteractableState.d.ts.map +1 -1
- package/dist/react/model-context/useInteractableVersions.d.ts +1 -2
- package/dist/react/model-context/useInteractableVersions.d.ts.map +1 -1
- package/dist/react/model-context/useInteractableVersions.js +1 -1
- package/dist/react/model-context/useToolArgsStatus.d.ts +2 -3
- package/dist/react/model-context/useToolArgsStatus.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.d.ts +2 -3
- package/dist/react/primitive-hooks/useActionBarCopy.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.d.ts +1 -2
- package/dist/react/primitive-hooks/useActionBarEdit.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.d.ts +2 -3
- package/dist/react/primitive-hooks/useActionBarFeedback.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.d.ts +1 -2
- package/dist/react/primitive-hooks/useActionBarReload.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.d.ts +1 -2
- package/dist/react/primitive-hooks/useActionBarSpeak.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts +1 -2
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.d.ts +1 -2
- package/dist/react/primitive-hooks/useBranchPickerNext.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts +1 -2
- package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts +1 -2
- package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.d.ts +1 -2
- package/dist/react/primitive-hooks/useComposerCancel.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.d.ts +1 -2
- package/dist/react/primitive-hooks/useComposerDictate.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.d.ts +1 -2
- package/dist/react/primitive-hooks/useComposerSend.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.d.ts +1 -2
- package/dist/react/primitive-hooks/useEditComposerCancel.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.d.ts +1 -2
- package/dist/react/primitive-hooks/useEditComposerSend.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.d.ts +1 -2
- package/dist/react/primitive-hooks/useMessageBranching.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageError.d.ts +1 -2
- package/dist/react/primitive-hooks/useMessageError.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageReload.d.ts +1 -2
- package/dist/react/primitive-hooks/useMessageReload.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts +2 -3
- package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts +1 -2
- package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsRunning.d.ts +1 -2
- package/dist/react/primitive-hooks/useThreadIsRunning.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts +1 -2
- package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts +1 -2
- package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts +1 -2
- package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts +1 -2
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.d.ts +1 -2
- package/dist/react/primitive-hooks/useThreadListLoadMore.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.d.ts +1 -2
- package/dist/react/primitive-hooks/useThreadListNew.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadMessageIds.d.ts +1 -2
- package/dist/react/primitive-hooks/useThreadMessageIds.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadMessages.d.ts +1 -2
- package/dist/react/primitive-hooks/useThreadMessages.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useVoice.d.ts +3 -4
- package/dist/react/primitive-hooks/useVoice.d.ts.map +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts +2 -3
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.d.ts +4 -5
- package/dist/react/primitives/composer/ComposerAttachments.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerIf.d.ts +4 -5
- package/dist/react/primitives/composer/ComposerIf.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerQueue.d.ts +2 -3
- package/dist/react/primitives/composer/ComposerQueue.d.ts.map +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.d.ts +4 -5
- package/dist/react/primitives/generativeUI/GenerativeUI.d.ts.map +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.js +27 -28
- package/dist/react/primitives/generativeUI/GenerativeUI.js.map +1 -1
- package/dist/react/primitives/message/MessageAttachments.d.ts +4 -5
- package/dist/react/primitives/message/MessageAttachments.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.d.ts +13 -5
- package/dist/react/primitives/message/MessageGroupedParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.js +3 -2
- package/dist/react/primitives/message/MessageGroupedParts.js.map +1 -1
- package/dist/react/primitives/message/MessageParts.d.ts +10 -10
- package/dist/react/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageQuote.d.ts +2 -3
- package/dist/react/primitives/message/MessageQuote.d.ts.map +1 -1
- package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts +2 -3
- package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts.map +1 -1
- package/dist/react/primitives/part/PartMessages.d.ts +4 -4
- package/dist/react/primitives/part/PartMessages.d.ts.map +1 -1
- package/dist/react/primitives/part/PartMessages.js +1 -0
- package/dist/react/primitives/part/PartMessages.js.map +1 -1
- package/dist/react/primitives/thread/ThreadMessages.d.ts +7 -8
- package/dist/react/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadMessages.js +6 -5
- package/dist/react/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.d.ts +5 -6
- package/dist/react/primitives/thread/ThreadSuggestions.d.ts.map +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.d.ts +4 -5
- package/dist/react/primitives/threadList/ThreadListItems.d.ts.map +1 -1
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts +2 -3
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -1
- package/dist/react/providers/AttachmentByIndexProvider.d.ts +2 -3
- package/dist/react/providers/AttachmentByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts +1 -2
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts +1 -2
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/MessageByIdProvider.d.ts +1 -2
- package/dist/react/providers/MessageByIdProvider.d.ts.map +1 -1
- package/dist/react/providers/MessageByIndexProvider.d.ts +1 -2
- package/dist/react/providers/MessageByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/PartByIndexProvider.d.ts +1 -2
- package/dist/react/providers/PartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/QueueItemByIndexProvider.d.ts +2 -3
- package/dist/react/providers/QueueItemByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.d.ts +2 -3
- package/dist/react/providers/ReadonlyThreadProvider.d.ts.map +1 -1
- package/dist/react/providers/SuggestionByIndexProvider.d.ts +2 -3
- package/dist/react/providers/SuggestionByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.d.ts +1 -2
- package/dist/react/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.d.ts +1 -2
- package/dist/react/providers/ThreadListItemByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts +1 -2
- package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +3 -2
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +17 -7
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +1 -2
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +2 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadResource.d.ts +4 -5
- package/dist/react/runtimes/RemoteThreadResource.d.ts.map +1 -1
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts +3 -3
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/commandQueue.d.ts +2 -3
- package/dist/react/runtimes/assistant-transport/commandQueue.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.d.ts +3 -4
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/runManager.d.ts +2 -3
- package/dist/react/runtimes/assistant-transport/runManager.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/types.d.ts +17 -18
- package/dist/react/runtimes/assistant-transport/types.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.d.ts +4 -5
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/useConvertedState.d.ts +1 -2
- package/dist/react/runtimes/assistant-transport/useConvertedState.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/useLatestRef.d.ts +1 -2
- package/dist/react/runtimes/assistant-transport/useLatestRef.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts +3 -26
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +152 -378
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts +2 -2
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js +22 -2
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.d.ts +51 -18
- package/dist/react/runtimes/cloud/auiV0.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.js +125 -17
- package/dist/react/runtimes/cloud/auiV0.js.map +1 -1
- package/dist/react/runtimes/cloud/createCloudThreadListAdapter.d.ts +6 -6
- package/dist/react/runtimes/cloud/createCloudThreadListAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/createCloudThreadListAdapter.js +4 -0
- package/dist/react/runtimes/cloud/createCloudThreadListAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/createCloudThreadListAdapterCreateFallback.d.ts +1 -2
- package/dist/react/runtimes/cloud/createCloudThreadListAdapterCreateFallback.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/sdkIdentity.d.ts +5 -0
- package/dist/react/runtimes/cloud/sdkIdentity.d.ts.map +1 -0
- package/dist/react/runtimes/cloud/sdkIdentity.js +9 -0
- package/dist/react/runtimes/cloud/sdkIdentity.js.map +1 -0
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts +1 -2
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListRuntime.d.ts +1 -2
- package/dist/react/runtimes/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/createMessageConverter.d.ts +1 -2
- package/dist/react/runtimes/createMessageConverter.d.ts.map +1 -1
- package/dist/react/runtimes/createRuntimeExtras.d.ts +3 -4
- package/dist/react/runtimes/createRuntimeExtras.d.ts.map +1 -1
- package/dist/react/runtimes/external-message-converter.d.ts +14 -4
- package/dist/react/runtimes/external-message-converter.d.ts.map +1 -1
- package/dist/react/runtimes/external-message-converter.js +26 -61
- package/dist/react/runtimes/external-message-converter.js.map +1 -1
- package/dist/react/runtimes/useExternalStoreRuntime.d.ts +1 -2
- package/dist/react/runtimes/useExternalStoreRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useExternalStoreSharedOptions.d.ts +1 -2
- package/dist/react/runtimes/useExternalStoreSharedOptions.d.ts.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.d.ts +3 -4
- package/dist/react/runtimes/useLocalRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts +1 -2
- package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.js +3 -3
- package/dist/react/runtimes/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/react/runtimes/useRuntimeAdapters.d.ts +4 -4
- package/dist/react/runtimes/useRuntimeAdapters.d.ts.map +1 -1
- package/dist/react/runtimes/useStreamingTiming.d.ts +2 -2
- package/dist/react/runtimes/useStreamingTiming.d.ts.map +1 -1
- package/dist/react/types/MessagePartComponentTypes.d.ts +26 -27
- package/dist/react/types/MessagePartComponentTypes.d.ts.map +1 -1
- package/dist/react/types/scopes/dataRenderers.d.ts +3 -4
- package/dist/react/types/scopes/dataRenderers.d.ts.map +1 -1
- package/dist/react/types/scopes/interactables.d.ts +10 -11
- package/dist/react/types/scopes/interactables.d.ts.map +1 -1
- package/dist/react/types/scopes/tools.d.ts +4 -5
- package/dist/react/types/scopes/tools.d.ts.map +1 -1
- package/dist/react/utils/getMessageQuote.d.ts +1 -2
- package/dist/react/utils/getMessageQuote.d.ts.map +1 -1
- package/dist/react/utils/groupParts.d.ts +13 -9
- package/dist/react/utils/groupParts.d.ts.map +1 -1
- package/dist/react/utils/groupParts.js +6 -0
- package/dist/react/utils/groupParts.js.map +1 -1
- package/dist/react/utils/useJSONEqual.d.ts +3 -2
- package/dist/react/utils/useJSONEqual.d.ts.map +1 -1
- package/dist/react/utils/useJSONEqual.js +6 -1
- package/dist/react/utils/useJSONEqual.js.map +1 -1
- package/dist/react/utils/useJSONSchemaDependency.d.ts +6 -0
- package/dist/react/utils/useJSONSchemaDependency.d.ts.map +1 -0
- package/dist/react/utils/useJSONSchemaDependency.js +20 -0
- package/dist/react/utils/useJSONSchemaDependency.js.map +1 -0
- package/dist/runtime/api/assistant-runtime.d.ts +2 -3
- package/dist/runtime/api/assistant-runtime.d.ts.map +1 -1
- package/dist/runtime/api/attachment-runtime.d.ts +6 -7
- package/dist/runtime/api/attachment-runtime.d.ts.map +1 -1
- package/dist/runtime/api/bindings.d.ts +5 -6
- package/dist/runtime/api/bindings.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.d.ts +10 -10
- package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-part-runtime.d.ts +3 -4
- package/dist/runtime/api/message-part-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-part-runtime.js +3 -2
- package/dist/runtime/api/message-part-runtime.js.map +1 -1
- package/dist/runtime/api/message-runtime.d.ts +8 -6
- package/dist/runtime/api/message-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-runtime.js +3 -2
- package/dist/runtime/api/message-runtime.js.map +1 -1
- package/dist/runtime/api/paths.d.ts +6 -7
- package/dist/runtime/api/paths.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.d.ts +8 -8
- package/dist/runtime/api/thread-list-item-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-runtime.d.ts +4 -5
- package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-runtime.d.ts +10 -11
- package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-runtime.js +2 -5
- package/dist/runtime/api/thread-runtime.js.map +1 -1
- package/dist/runtime/base/base-assistant-runtime-core.d.ts +1 -2
- package/dist/runtime/base/base-assistant-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.d.ts +2 -2
- package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.js +46 -10
- package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.d.ts +10 -3
- package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js +212 -77
- package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts +1 -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 +12 -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 -2
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js +7 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
- package/dist/runtime/branch/external-thread-branch-adapter.d.ts +1 -2
- package/dist/runtime/branch/external-thread-branch-adapter.d.ts.map +1 -1
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts +1 -2
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/composer-runtime-core.d.ts +10 -11
- package/dist/runtime/interfaces/composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts +4 -5
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-runtime-core.d.ts +23 -16
- package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts +2 -3
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts.map +1 -1
- package/dist/runtime/queue/message-queue.d.ts +10 -4
- package/dist/runtime/queue/message-queue.d.ts.map +1 -1
- package/dist/runtime/queue/message-queue.js +70 -7
- package/dist/runtime/queue/message-queue.js.map +1 -1
- package/dist/runtime/queue/queue-item.d.ts +2 -3
- package/dist/runtime/queue/queue-item.d.ts.map +1 -1
- package/dist/runtime/utils/abortable-thread-load.d.ts +2 -3
- package/dist/runtime/utils/abortable-thread-load.d.ts.map +1 -1
- package/dist/runtime/utils/attachment-add-operations.d.ts +3 -4
- package/dist/runtime/utils/attachment-add-operations.d.ts.map +1 -1
- package/dist/runtime/utils/auto-status.d.ts +9 -6
- package/dist/runtime/utils/auto-status.d.ts.map +1 -1
- package/dist/runtime/utils/auto-status.js +12 -4
- package/dist/runtime/utils/auto-status.js.map +1 -1
- package/dist/runtime/utils/chat-model-adapter.d.ts +5 -6
- package/dist/runtime/utils/chat-model-adapter.d.ts.map +1 -1
- package/dist/runtime/utils/external-message-conversion.d.ts +26 -15
- package/dist/runtime/utils/external-message-conversion.d.ts.map +1 -1
- package/dist/runtime/utils/external-message-conversion.js +51 -14
- package/dist/runtime/utils/external-message-conversion.js.map +1 -1
- package/dist/runtime/utils/external-store-message.d.ts +4 -5
- package/dist/runtime/utils/external-store-message.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository-session.d.ts +3 -4
- package/dist/runtime/utils/message-repository-session.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository.d.ts +4 -5
- package/dist/runtime/utils/message-repository.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository.js +3 -3
- package/dist/runtime/utils/message-repository.js.map +1 -1
- package/dist/runtime/utils/pending-tool-calls.d.ts +2 -3
- package/dist/runtime/utils/pending-tool-calls.d.ts.map +1 -1
- package/dist/runtime/utils/resolveToolApprovalResponse.d.ts +1 -2
- package/dist/runtime/utils/resolveToolApprovalResponse.d.ts.map +1 -1
- package/dist/runtime/utils/runtime-extras-brand.d.ts +2 -3
- 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 +83 -0
- package/dist/runtime/utils/stored-message-parts.js.map +1 -0
- package/dist/runtime/utils/streaming-timing.d.ts +4 -5
- package/dist/runtime/utils/streaming-timing.d.ts.map +1 -1
- package/dist/runtime/utils/thread-message-like.d.ts +7 -6
- package/dist/runtime/utils/thread-message-like.d.ts.map +1 -1
- package/dist/runtime/utils/thread-message-like.js +4 -2
- package/dist/runtime/utils/thread-message-like.js.map +1 -1
- package/dist/runtime/utils/thread-runtime-lifecycle.d.ts +3 -4
- package/dist/runtime/utils/thread-runtime-lifecycle.d.ts.map +1 -1
- package/dist/runtime/utils/tool-call-tree.d.ts +4 -5
- package/dist/runtime/utils/tool-call-tree.d.ts.map +1 -1
- package/dist/runtimes/assistant-transport/utils.d.ts +1 -2
- package/dist/runtimes/assistant-transport/utils.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-adapter.d.ts +9 -6
- package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts +1 -2
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-shared-options.d.ts +2 -3
- 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 +2 -3
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +4 -3
- 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 +36 -6
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/thread-message-converter.d.ts +2 -3
- package/dist/runtimes/external-store/thread-message-converter.d.ts.map +1 -1
- package/dist/runtimes/inert/InertThreadRuntimeCore.d.ts +2 -3
- package/dist/runtimes/inert/InertThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/internal.d.ts +1 -1
- package/dist/runtimes/local/local-runtime-core.d.ts +1 -2
- package/dist/runtimes/local/local-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-runtime-options.d.ts +1 -2
- package/dist/runtimes/local/local-runtime-options.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts +2 -3
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.d.ts +10 -5
- package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.js +57 -10
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/local/should-continue.d.ts +1 -2
- package/dist/runtimes/local/should-continue.d.ts.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +1 -2
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts +1 -2
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter-changed.d.ts +1 -2
- package/dist/runtimes/remote-thread-list/adapter-changed.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts +1 -2
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts +1 -2
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts +16 -17
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/title-generation.d.ts +7 -8
- package/dist/runtimes/remote-thread-list/title-generation.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/title.d.ts +2 -3
- package/dist/runtimes/remote-thread-list/title.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/types.d.ts +8 -9
- package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts +4 -5
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js +2 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js.map +1 -1
- package/dist/store/clients/chain-of-thought-client.d.ts +1 -2
- package/dist/store/clients/chain-of-thought-client.d.ts.map +1 -1
- package/dist/store/clients/external-thread.d.ts +3 -4
- package/dist/store/clients/external-thread.d.ts.map +1 -1
- package/dist/store/clients/external-thread.js +256 -211
- package/dist/store/clients/external-thread.js.map +1 -1
- package/dist/store/clients/model-context-client.d.ts +1 -2
- package/dist/store/clients/model-context-client.d.ts.map +1 -1
- package/dist/store/clients/no-op-composer-client.d.ts +1 -2
- package/dist/store/clients/no-op-composer-client.d.ts.map +1 -1
- package/dist/store/clients/runtime-adapter.d.ts +1 -2
- package/dist/store/clients/runtime-adapter.d.ts.map +1 -1
- package/dist/store/clients/single-thread-list.d.ts +1 -2
- package/dist/store/clients/single-thread-list.d.ts.map +1 -1
- package/dist/store/clients/suggestions.d.ts +3 -4
- package/dist/store/clients/suggestions.d.ts.map +1 -1
- package/dist/store/clients/thread-message-client.d.ts +2 -3
- package/dist/store/clients/thread-message-client.d.ts.map +1 -1
- package/dist/store/clients/thread-selection-events.d.ts +1 -2
- package/dist/store/clients/thread-selection-events.d.ts.map +1 -1
- package/dist/store/clients/thread-tasks.d.ts +12 -0
- package/dist/store/clients/thread-tasks.d.ts.map +1 -0
- package/dist/store/clients/thread-tasks.js +69 -0
- package/dist/store/clients/thread-tasks.js.map +1 -0
- package/dist/store/env.d.ts +1 -2
- package/dist/store/env.d.ts.map +1 -1
- package/dist/store/index.d.ts +3 -2
- package/dist/store/index.js +3 -3
- package/dist/store/primitive-predicates.d.ts +11 -12
- package/dist/store/primitive-predicates.d.ts.map +1 -1
- package/dist/store/primitive-predicates.js +4 -4
- package/dist/store/primitive-predicates.js.map +1 -1
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts +1 -2
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.d.ts +1 -2
- package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/handle-runtime-action.d.ts +1 -2
- 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 -2
- package/dist/store/runtime-clients/handle-thread-list-action.d.ts.map +1 -1
- package/dist/store/runtime-clients/liveRef.d.ts +1 -2
- package/dist/store/runtime-clients/liveRef.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts +1 -2
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.d.ts +1 -2
- package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts +1 -2
- 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 +1 -2
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.d.ts +1 -2
- package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.js +176 -128
- package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/useSubscribable.d.ts +1 -2
- package/dist/store/runtime-clients/useSubscribable.d.ts.map +1 -1
- package/dist/store/scope-registration.d.ts +2 -0
- package/dist/store/scope-registration.d.ts.map +1 -1
- package/dist/store/scopes/attachment.d.ts +4 -5
- package/dist/store/scopes/attachment.d.ts.map +1 -1
- package/dist/store/scopes/chain-of-thought.d.ts +5 -6
- package/dist/store/scopes/chain-of-thought.d.ts.map +1 -1
- package/dist/store/scopes/composer.d.ts +6 -7
- package/dist/store/scopes/composer.d.ts.map +1 -1
- package/dist/store/scopes/message.d.ts +6 -6
- package/dist/store/scopes/message.d.ts.map +1 -1
- package/dist/store/scopes/model-context.d.ts +3 -4
- package/dist/store/scopes/model-context.d.ts.map +1 -1
- package/dist/store/scopes/part.d.ts +4 -5
- package/dist/store/scopes/part.d.ts.map +1 -1
- package/dist/store/scopes/queue-item.d.ts +4 -4
- package/dist/store/scopes/queue-item.d.ts.map +1 -1
- package/dist/store/scopes/suggestion.d.ts +4 -5
- package/dist/store/scopes/suggestion.d.ts.map +1 -1
- package/dist/store/scopes/suggestions.d.ts +5 -6
- package/dist/store/scopes/suggestions.d.ts.map +1 -1
- package/dist/store/scopes/task.d.ts +35 -0
- package/dist/store/scopes/task.d.ts.map +1 -0
- package/dist/store/scopes/task.js +0 -0
- package/dist/store/scopes/thread-list-item.d.ts +5 -6
- package/dist/store/scopes/thread-list-item.d.ts.map +1 -1
- package/dist/store/scopes/thread.d.ts +25 -6
- package/dist/store/scopes/thread.d.ts.map +1 -1
- package/dist/store/scopes/threads.d.ts +4 -5
- package/dist/store/scopes/threads.d.ts.map +1 -1
- package/dist/subscribable/subscribable.d.ts +15 -15
- package/dist/subscribable/subscribable.d.ts.map +1 -1
- package/dist/subscribable/subscribable.js +23 -15
- package/dist/subscribable/subscribable.js.map +1 -1
- package/dist/tests/remote-thread-list-test-helpers.d.ts +5 -6
- package/dist/tests/remote-thread-list-test-helpers.d.ts.map +1 -1
- package/dist/types/attachment.d.ts +9 -10
- package/dist/types/attachment.d.ts.map +1 -1
- package/dist/types/augmentations.d.ts +3 -4
- package/dist/types/augmentations.d.ts.map +1 -1
- package/dist/types/directive.d.ts +2 -3
- package/dist/types/directive.d.ts.map +1 -1
- package/dist/types/error.d.ts +8 -9
- package/dist/types/error.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/message.d.ts +53 -44
- package/dist/types/message.d.ts.map +1 -1
- package/dist/types/message.js.map +1 -1
- package/dist/types/quote.d.ts +1 -2
- package/dist/types/quote.d.ts.map +1 -1
- package/dist/types/trigger.d.ts +2 -3
- package/dist/types/trigger.d.ts.map +1 -1
- package/dist/types/unsubscribe.d.ts +1 -2
- package/dist/types/unsubscribe.d.ts.map +1 -1
- package/dist/utils/abortable-iterable.d.ts +2 -3
- package/dist/utils/abortable-iterable.d.ts.map +1 -1
- package/dist/utils/abortable-iterable.js +30 -14
- package/dist/utils/abortable-iterable.js.map +1 -1
- package/dist/utils/composite-context-provider.d.ts +1 -2
- package/dist/utils/composite-context-provider.d.ts.map +1 -1
- package/dist/utils/data-url.d.ts +6 -7
- package/dist/utils/data-url.d.ts.map +1 -1
- package/dist/utils/getGroupStatus.d.ts +17 -2
- package/dist/utils/getGroupStatus.d.ts.map +1 -1
- package/dist/utils/getGroupStatus.js +32 -7
- package/dist/utils/getGroupStatus.js.map +1 -1
- package/dist/utils/id.d.ts +3 -4
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/image-media-type.d.ts +1 -2
- package/dist/utils/image-media-type.d.ts.map +1 -1
- package/dist/utils/invoke-user-callback.d.ts +1 -2
- package/dist/utils/invoke-user-callback.d.ts.map +1 -1
- package/dist/utils/json/is-json-equal.d.ts +1 -2
- package/dist/utils/json/is-json-equal.d.ts.map +1 -1
- package/dist/utils/json/is-json.d.ts +4 -5
- package/dist/utils/json/is-json.d.ts.map +1 -1
- package/dist/utils/json/stable-stringify-tool-args.d.ts +2 -3
- package/dist/utils/json/stable-stringify-tool-args.d.ts.map +1 -1
- package/dist/utils/normalizePartStatus.d.ts +4 -5
- package/dist/utils/normalizePartStatus.d.ts.map +1 -1
- package/dist/utils/notify-event-listeners.d.ts +1 -2
- package/dist/utils/notify-event-listeners.d.ts.map +1 -1
- package/dist/utils/record.d.ts +1 -2
- package/dist/utils/record.d.ts.map +1 -1
- package/dist/utils/silent-runtime-action.d.ts +2 -3
- package/dist/utils/silent-runtime-action.d.ts.map +1 -1
- package/dist/utils/text.d.ts +1 -2
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/wire-media.d.ts +3 -4
- package/dist/utils/wire-media.d.ts.map +1 -1
- package/dist/utils/wire-media.js +2 -2
- package/dist/utils/wire-media.js.map +1 -1
- package/package.json +15 -14
- package/src/adapters/attachment.ts +8 -1
- package/src/adapters/feedback.ts +1 -0
- package/src/adapters/speech.test.ts +236 -0
- package/src/adapters/speech.ts +17 -10
- package/src/adapters/thread-history.ts +3 -0
- package/src/index.ts +1 -0
- package/src/model-context/frame/host.test.ts +113 -1
- package/src/model-context/frame/host.ts +39 -12
- package/src/model-context/frame/provider.test.ts +45 -20
- package/src/model-context/interactable-composer-metadata.test.ts +30 -0
- package/src/model-context/interactable-composer-metadata.ts +10 -10
- package/src/react/RuntimeAdapter.test.ts +4 -1
- package/src/react/adapters/LocalStorageThreadListAdapter.test.ts +361 -0
- package/src/react/adapters/LocalStorageThreadListAdapter.tsx +69 -19
- package/src/react/client/DataRenderers.test.tsx +45 -0
- package/src/react/client/DataRenderers.ts +13 -9
- package/src/react/client/Interactables.test.ts +52 -4
- package/src/react/client/Interactables.ts +7 -1
- package/src/react/client/RemoteThreadList.concurrent.test.tsx +9 -3
- package/src/react/client/RemoteThreadList.test.ts +46 -7
- package/src/react/client/RemoteThreadList.ts +15 -2
- package/src/react/client/interactable-model-context.test.ts +44 -0
- package/src/react/client/interactable-model-context.ts +3 -2
- package/src/react/index.ts +5 -1
- package/src/react/interactables-legacy/Interactables.test.ts +9 -3
- package/src/react/interactables-legacy/useAssistantInteractable.test.tsx +150 -0
- package/src/react/interactables-legacy/useAssistantInteractable.ts +10 -1
- package/src/react/model-context/useInteractable.test.tsx +204 -0
- package/src/react/model-context/useInteractable.ts +3 -0
- package/src/react/primitive-hooks/useActionBarCopy.test.ts +5 -6
- package/src/react/primitive-hooks/useSuggestionTrigger.test.ts +0 -1
- package/src/react/primitives/generativeUI/GenerativeUI.test.tsx +54 -0
- package/src/react/primitives/generativeUI/GenerativeUI.tsx +13 -18
- package/src/react/primitives/message/MessageGroupedParts.test.tsx +99 -0
- package/src/react/primitives/message/MessageGroupedParts.tsx +15 -4
- package/src/react/primitives/part/PartMessages.test.tsx +104 -1
- package/src/react/primitives/part/PartMessages.tsx +1 -0
- package/src/react/primitives/thread/ThreadMessages.test.tsx +160 -0
- package/src/react/primitives/thread/ThreadMessages.tsx +8 -5
- package/src/react/providers/ReadonlyThreadProvider.test.tsx +56 -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.test.tsx +23 -20
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.title.test.tsx +24 -17
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.tsx +39 -24
- package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +7 -1
- package/src/react/runtimes/assistant-transport/transport-scheduling.test.ts +73 -46
- package/src/react/runtimes/assistant-transport/useAssistantTransportRuntime.test.tsx +66 -1
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.ts +20 -14
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.tsx +323 -1
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.ts +190 -523
- package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.test.ts +81 -0
- package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.ts +27 -1
- package/src/react/runtimes/cloud/auiV0.ts +281 -26
- package/src/react/runtimes/cloud/auiV0DecodeSafely.test.ts +522 -0
- package/src/react/runtimes/cloud/createCloudThreadListAdapter.test.ts +21 -0
- package/src/react/runtimes/cloud/createCloudThreadListAdapter.ts +7 -1
- package/src/react/runtimes/cloud/sdkIdentity.ts +9 -0
- package/src/react/runtimes/cloud/useCloudThreadListAdapter.test.tsx +18 -4
- package/src/react/runtimes/external-message-converter.test.ts +143 -4
- package/src/react/runtimes/external-message-converter.ts +39 -93
- package/src/react/runtimes/remote-thread-hook-on-tap.test.ts +2 -1
- package/src/react/runtimes/useExternalStoreRuntime.lifecycle.test.tsx +8 -2
- package/src/react/runtimes/useExternalStoreRuntime.suggestions.test.tsx +6 -2
- package/src/react/runtimes/useRemoteThreadListRuntime.concurrent.test.tsx +84 -4
- package/src/react/runtimes/useRemoteThreadListRuntime.ts +6 -2
- package/src/react/utils/groupParts.ts +12 -1
- package/src/react/utils/useJSONEqual.ts +9 -0
- package/src/react/utils/useJSONSchemaDependency.ts +22 -0
- package/src/runtime/api/message-part-runtime.ts +4 -1
- package/src/runtime/api/message-runtime.ts +15 -2
- package/src/runtime/api/thread-runtime.test.ts +58 -0
- package/src/runtime/api/thread-runtime.ts +2 -4
- package/src/runtime/base/base-composer-runtime-core.ts +69 -16
- package/src/runtime/base/base-thread-runtime-core.test.ts +1799 -49
- package/src/runtime/base/base-thread-runtime-core.ts +296 -94
- package/src/runtime/base/default-edit-composer-runtime-core.ts +12 -2
- package/src/runtime/base/default-thread-composer-runtime-core.ts +12 -1
- package/src/runtime/interfaces/thread-runtime-core.ts +8 -0
- package/src/runtime/queue/message-queue.ts +79 -7
- package/src/runtime/utils/auto-status.test.ts +112 -1
- package/src/runtime/utils/auto-status.ts +31 -5
- package/src/runtime/utils/external-message-conversion.test.ts +177 -0
- package/src/runtime/utils/external-message-conversion.ts +128 -33
- package/src/runtime/utils/message-repository.test.ts +49 -0
- package/src/runtime/utils/message-repository.ts +3 -3
- package/src/runtime/utils/stored-message-parts.ts +174 -0
- package/src/runtime/utils/thread-message-like.test.ts +52 -0
- package/src/runtime/utils/thread-message-like.ts +11 -2
- package/src/runtimes/external-store/external-store-adapter.ts +4 -0
- package/src/runtimes/external-store/external-store-thread-runtime-core.ts +74 -9
- package/src/runtimes/local/local-thread-runtime-core.test.ts +189 -12
- package/src/runtimes/local/local-thread-runtime-core.ts +91 -10
- package/src/runtimes/tool-invocations/EDGE_CASES.md +2 -6
- package/src/runtimes/tool-invocations/ToolInvocationTracker.test.ts +133 -0
- package/src/runtimes/tool-invocations/ToolInvocationTracker.ts +10 -6
- package/src/store/clients/external-thread.ts +53 -14
- package/src/store/clients/thread-tasks.test.ts +274 -0
- package/src/store/clients/thread-tasks.ts +138 -0
- package/src/store/index.ts +8 -0
- package/src/store/primitive-predicates.test.ts +64 -5
- package/src/store/primitive-predicates.ts +10 -2
- package/src/store/runtime-clients/thread-runtime-client.test.tsx +110 -0
- package/src/store/runtime-clients/thread-runtime-client.ts +31 -1
- package/src/store/scope-registration.ts +2 -0
- package/src/store/scopes/message.ts +4 -1
- package/src/store/scopes/task.ts +34 -0
- package/src/store/scopes/thread.ts +16 -0
- package/src/store/thread-tasks.test.tsx +209 -0
- package/src/subscribable/subscribable.test.ts +161 -1
- package/src/subscribable/subscribable.ts +25 -15
- package/src/tests/MessageRepository.test.ts +1 -5
- package/src/tests/attachment-adapters.test.ts +16 -1
- package/src/tests/auiV0Encode.test.ts +304 -0
- package/src/tests/base-composer-runtime-core-addAttachment.test.ts +6 -6
- package/src/tests/base-composer-runtime-core-send.test.ts +51 -0
- package/src/tests/base-composer-runtime-core.test.ts +329 -6
- package/src/tests/composer-can-cancel.test.ts +35 -6
- package/src/tests/composer-can-send.test.ts +22 -0
- package/src/tests/default-edit-composer-runtime-core.test.ts +47 -0
- package/src/tests/external-store-thread-runtime-core-adapter.test.ts +369 -16
- package/src/tests/external-store-thread-runtime-core.test.ts +31 -0
- package/src/tests/external-thread-attachments.test.tsx +91 -23
- package/src/tests/external-thread-feedback.test.tsx +20 -7
- package/src/tests/external-thread-parity.test.tsx +35 -1
- package/src/tests/groupParts.test.ts +71 -0
- package/src/tests/message-queue.test.ts +290 -2
- package/src/tests/remote-thread-list-reactive-threadId.test.ts +51 -0
- package/src/tests/thread-switch-events.test.tsx +11 -7
- package/src/tests/useRemoteThreadListRuntime-controlled.test.tsx +45 -1
- package/src/types/index.ts +1 -0
- package/src/types/message.test.ts +19 -0
- package/src/types/message.ts +23 -7
- package/src/utils/abortable-iterable.test.ts +115 -0
- package/src/utils/abortable-iterable.ts +34 -23
- package/src/utils/getGroupStatus.test.ts +70 -4
- package/src/utils/getGroupStatus.ts +35 -12
- package/src/utils/wire-media.test.ts +10 -0
- package/src/utils/wire-media.ts +6 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ThreadUserMessagePart } from "../types/message.js";
|
|
2
2
|
import { Attachment, CompleteAttachment, PendingAttachment } from "../types/attachment.js";
|
|
3
3
|
//#region src/adapters/attachment.d.ts
|
|
4
|
-
type AttachmentAdapter = {
|
|
4
|
+
export type AttachmentAdapter = {
|
|
5
5
|
accept: string;
|
|
6
6
|
add(state: {
|
|
7
7
|
file: File;
|
|
@@ -9,7 +9,7 @@ type AttachmentAdapter = {
|
|
|
9
9
|
remove(attachment: Attachment): Promise<void>;
|
|
10
10
|
send(attachment: PendingAttachment): Promise<CompleteAttachment>;
|
|
11
11
|
};
|
|
12
|
-
declare class SimpleImageAttachmentAdapter implements AttachmentAdapter {
|
|
12
|
+
export declare class SimpleImageAttachmentAdapter implements AttachmentAdapter {
|
|
13
13
|
accept: string;
|
|
14
14
|
add(state: {
|
|
15
15
|
file: File;
|
|
@@ -17,8 +17,8 @@ declare class SimpleImageAttachmentAdapter implements AttachmentAdapter {
|
|
|
17
17
|
send(attachment: PendingAttachment): Promise<CompleteAttachment>;
|
|
18
18
|
remove(): Promise<void>;
|
|
19
19
|
}
|
|
20
|
-
declare const getFileDataURL: (file: File) => Promise<string>;
|
|
21
|
-
declare class SimpleTextAttachmentAdapter implements AttachmentAdapter {
|
|
20
|
+
export declare const getFileDataURL: (file: File) => Promise<string>;
|
|
21
|
+
export declare class SimpleTextAttachmentAdapter implements AttachmentAdapter {
|
|
22
22
|
accept: string;
|
|
23
23
|
add(state: {
|
|
24
24
|
file: File;
|
|
@@ -26,16 +26,16 @@ declare class SimpleTextAttachmentAdapter implements AttachmentAdapter {
|
|
|
26
26
|
send(attachment: PendingAttachment): Promise<CompleteAttachment>;
|
|
27
27
|
remove(): Promise<void>;
|
|
28
28
|
}
|
|
29
|
-
declare function fileMatchesAccept(file: {
|
|
29
|
+
export declare function fileMatchesAccept(file: {
|
|
30
30
|
name: string;
|
|
31
31
|
type: string;
|
|
32
32
|
}, acceptString: string): boolean;
|
|
33
|
-
declare function attachmentsEqual(a: readonly CompleteAttachment[], b: readonly CompleteAttachment[]): boolean;
|
|
34
|
-
declare function partToCompleteAttachment(part: Exclude<ThreadUserMessagePart, {
|
|
33
|
+
export declare function attachmentsEqual(a: readonly CompleteAttachment[], b: readonly CompleteAttachment[]): boolean;
|
|
34
|
+
export declare function partToCompleteAttachment(part: Exclude<ThreadUserMessagePart, {
|
|
35
35
|
type: "text";
|
|
36
36
|
}>): CompleteAttachment;
|
|
37
|
-
declare function liftNonTextParts(content: readonly ThreadUserMessagePart[]): CompleteAttachment[];
|
|
38
|
-
declare class CompositeAttachmentAdapter implements AttachmentAdapter {
|
|
37
|
+
export declare function liftNonTextParts(content: readonly ThreadUserMessagePart[]): CompleteAttachment[];
|
|
38
|
+
export declare class CompositeAttachmentAdapter implements AttachmentAdapter {
|
|
39
39
|
private _adapters;
|
|
40
40
|
accept: string;
|
|
41
41
|
constructor(adapters: AttachmentAdapter[]);
|
|
@@ -46,5 +46,4 @@ declare class CompositeAttachmentAdapter implements AttachmentAdapter {
|
|
|
46
46
|
remove(attachment: Attachment): Promise<void>;
|
|
47
47
|
}
|
|
48
48
|
//#endregion
|
|
49
|
-
export { AttachmentAdapter, CompositeAttachmentAdapter, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, attachmentsEqual, fileMatchesAccept, getFileDataURL, liftNonTextParts, partToCompleteAttachment };
|
|
50
49
|
//# sourceMappingURL=attachment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.d.ts","names":[],"sources":["../../src/adapters/attachment.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"attachment.d.ts","names":[],"sources":["../../src/adapters/attachment.ts"],"mappings":";;;YAQY;EACV;EACA,IAAI;IACF,MAAM;MACJ,QAAQ,qBAAqB,eAAe;EAChD,OAAO,YAAY,aAAa;EAChC,KAAK,YAAY,oBAAoB,QAAQ;;qBAGlC,wCAAwC;EAC5C;EAEM,IAAI;IAAS,MAAM;MAAS,QAAQ;EAWpC,KACX,YAAY,oBACX,QAAQ;EAaE,UAAM;;qBA0BR,iBAAwB,MAAM,SAAO;qBAoBrC,uCAAuC;EAC3C;EAGM,IAAI;IAAS,MAAM;MAAS,QAAQ;EAWpC,KACX,YAAY,oBACX,QAAQ;EAaE,UAAM;;wBAiBL,kBACd;EAAQ;EAAc;GACtB;wBAiCc,iBACd,YAAY,sBACZ,YAAY;wBASE,yBACd,MAAM,QAAQ;EAAyB;KACtC;wBA4Ca,iBACd,kBAAkB,0BACjB;qBAUU,sCAAsC;UACzC;EAED;EAEK,YAAA,UAAU;EAgBf,IAAI;IAAS,MAAM;MAAM,QAAA,qBAAA,eAAA;EASnB,KAAK,YAAY,oBAAiB,QAAA;EAUlC,OAAO,YAAY,aAAU"}
|
|
@@ -47,6 +47,7 @@ const getFileDataURL = async (file) => {
|
|
|
47
47
|
reader.readAsDataURL(file);
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
|
+
const escapeAttachmentName = (name) => name.replaceAll("&", "&").replaceAll("\"", """).replaceAll("<", "<").replaceAll(">", ">");
|
|
50
51
|
var SimpleTextAttachmentAdapter = class {
|
|
51
52
|
accept = "text/plain,text/html,text/markdown,text/csv,text/xml,text/json,application/json,text/css";
|
|
52
53
|
async add(state) {
|
|
@@ -68,7 +69,7 @@ var SimpleTextAttachmentAdapter = class {
|
|
|
68
69
|
status: { type: "complete" },
|
|
69
70
|
content: [{
|
|
70
71
|
type: "text",
|
|
71
|
-
text: `<attachment name
|
|
72
|
+
text: `<attachment name="${escapeAttachmentName(attachment.name)}">\n${await getFileText(attachment.file)}\n</attachment>`
|
|
72
73
|
}]
|
|
73
74
|
};
|
|
74
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.js","names":["Attachment","PendingAttachment","CompleteAttachment","ThreadUserMessagePart","generateId","AttachmentAdapter","accept","add","state","file","File","Promise","AsyncGenerator","remove","attachment","send","SimpleImageAttachmentAdapter","id","type","name","contentType","status","reason","content","image","getFileDataURL","bytesToBase64","bytes","Uint8Array","nodeBuffer","globalThis","Buffer","from","toString","encoding","binary","chunkSize","i","length","String","fromCharCode","subarray","btoa","FileReader","buffer","arrayBuffer","resolve","reject","reader","onload","result","onerror","error","readAsDataURL","SimpleTextAttachmentAdapter","text","getFileText","readAsText","fileMatchesAccept","acceptString","allowedTypes","split","map","trim","toLowerCase","fileName","fileMimeType","startsWith","endsWith","includes","generalType","attachmentsEqual","a","b","partToCompleteAttachment","part","Exclude","filename","mimeType","audio","format","liftNonTextParts","push","CompositeAttachmentAdapter","_adapters","constructor","adapters","wildcardIdx","findIndex","Error","join","adapter","slice"],"sources":["../../src/adapters/attachment.ts"],"sourcesContent":["import type {\n Attachment,\n PendingAttachment,\n CompleteAttachment,\n} from \"../types/attachment\";\nimport type { ThreadUserMessagePart } from \"../types/message\";\nimport { generateId } from \"../utils/id\";\n\nexport type AttachmentAdapter = {\n accept: string;\n add(state: {\n file: File;\n }): Promise<PendingAttachment> | AsyncGenerator<PendingAttachment, void>;\n remove(attachment: Attachment): Promise<void>;\n send(attachment: PendingAttachment): Promise<CompleteAttachment>;\n};\n\nexport class SimpleImageAttachmentAdapter implements AttachmentAdapter {\n public accept = \"image/*\";\n\n public async add(state: { file: File }): Promise<PendingAttachment> {\n return {\n id: generateId(),\n type: \"image\",\n name: state.file.name,\n contentType: state.file.type,\n file: state.file,\n status: { type: \"requires-action\", reason: \"composer-send\" },\n };\n }\n\n public async send(\n attachment: PendingAttachment,\n ): Promise<CompleteAttachment> {\n return {\n ...attachment,\n status: { type: \"complete\" },\n content: [\n {\n type: \"image\",\n image: await getFileDataURL(attachment.file),\n },\n ],\n };\n }\n\n public async remove() {\n // noop\n }\n}\n\nconst bytesToBase64 = (bytes: Uint8Array): string => {\n const nodeBuffer = (\n globalThis as {\n Buffer?: {\n from(bytes: Uint8Array): { toString(encoding: string): string };\n };\n }\n ).Buffer;\n if (nodeBuffer) {\n return nodeBuffer.from(bytes).toString(\"base64\");\n }\n let binary = \"\";\n const chunkSize = 0x8000;\n for (let i = 0; i < bytes.length; i += chunkSize) {\n binary += String.fromCharCode(...bytes.subarray(i, i + chunkSize));\n }\n return btoa(binary);\n};\n\n// React Native's Blob polyfill has FileReader but not file.text()/arrayBuffer(); Node has\n// the reverse. Prefer FileReader when present, falling back to the Blob methods otherwise.\nexport const getFileDataURL = async (file: File): Promise<string> => {\n if (typeof FileReader === \"undefined\") {\n const buffer = await file.arrayBuffer();\n return `data:${file.type || \"application/octet-stream\"};base64,${bytesToBase64(new Uint8Array(buffer))}`;\n }\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = (error) => reject(error);\n reader.readAsDataURL(file);\n });\n};\n\nexport class SimpleTextAttachmentAdapter implements AttachmentAdapter {\n public accept =\n \"text/plain,text/html,text/markdown,text/csv,text/xml,text/json,application/json,text/css\";\n\n public async add(state: { file: File }): Promise<PendingAttachment> {\n return {\n id: generateId(),\n type: \"document\",\n name: state.file.name,\n contentType: state.file.type,\n file: state.file,\n status: { type: \"requires-action\", reason: \"composer-send\" },\n };\n }\n\n public async send(\n attachment: PendingAttachment,\n ): Promise<CompleteAttachment> {\n return {\n ...attachment,\n status: { type: \"complete\" },\n content: [\n {\n type: \"text\",\n text: `<attachment name=${attachment.name}>\\n${await getFileText(attachment.file)}\\n</attachment>`,\n },\n ],\n };\n }\n\n public async remove() {\n // noop\n }\n}\n\nconst getFileText = async (file: File): Promise<string> => {\n if (typeof FileReader === \"undefined\") {\n return file.text();\n }\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = (error) => reject(error);\n reader.readAsText(file);\n });\n};\n\nexport function fileMatchesAccept(\n file: { name: string; type: string },\n acceptString: string,\n) {\n if (acceptString === \"*\") {\n return true;\n }\n\n const allowedTypes = acceptString\n .split(\",\")\n .map((type) => type.trim().toLowerCase());\n\n const fileName = file.name.toLowerCase();\n const fileMimeType = file.type.split(\";\", 1)[0]!.trim().toLowerCase();\n\n for (const type of allowedTypes) {\n if (type.startsWith(\".\") && fileName.endsWith(type)) {\n return true;\n }\n\n if (type.includes(\"/\") && type === fileMimeType) {\n return true;\n }\n\n if (type.endsWith(\"/*\")) {\n const generalType = type.split(\"/\")[0]!;\n if (fileMimeType.startsWith(`${generalType}/`)) {\n return true;\n }\n }\n }\n\n return false;\n}\n\nexport function attachmentsEqual(\n a: readonly CompleteAttachment[],\n b: readonly CompleteAttachment[],\n): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i]?.id !== b[i]?.id) return false;\n }\n return true;\n}\n\nexport function partToCompleteAttachment(\n part: Exclude<ThreadUserMessagePart, { type: \"text\" }>,\n): CompleteAttachment {\n const id = generateId();\n\n if (part.type === \"image\") {\n return {\n id,\n type: \"image\",\n name: part.filename ?? \"image\",\n content: [part],\n status: { type: \"complete\" },\n };\n }\n\n if (part.type === \"file\") {\n return {\n id,\n type: \"document\",\n name: part.filename ?? \"document\",\n contentType: part.mimeType,\n content: [part],\n status: { type: \"complete\" },\n };\n }\n\n if (part.type === \"audio\") {\n return {\n id,\n type: \"audio\",\n name: `audio.${part.audio.format}`,\n contentType: `audio/${part.audio.format}`,\n content: [part],\n status: { type: \"complete\" },\n };\n }\n\n return {\n id,\n type: \"data\",\n name: part.name,\n content: [part],\n status: { type: \"complete\" },\n };\n}\n\nexport function liftNonTextParts(\n content: readonly ThreadUserMessagePart[],\n): CompleteAttachment[] {\n const result: CompleteAttachment[] = [];\n for (const part of content) {\n if (part.type !== \"text\") {\n result.push(partToCompleteAttachment(part));\n }\n }\n return result;\n}\n\nexport class CompositeAttachmentAdapter implements AttachmentAdapter {\n private _adapters: AttachmentAdapter[];\n\n public accept: string;\n\n constructor(adapters: AttachmentAdapter[]) {\n this._adapters = adapters;\n\n const wildcardIdx = adapters.findIndex((a) => a.accept === \"*\");\n if (wildcardIdx !== -1) {\n if (wildcardIdx !== adapters.length - 1)\n throw new Error(\n \"A wildcard adapter (handling all files) can only be specified as the last adapter.\",\n );\n\n this.accept = \"*\";\n } else {\n this.accept = adapters.map((a) => a.accept).join(\",\");\n }\n }\n\n public add(state: { file: File }) {\n for (const adapter of this._adapters) {\n if (fileMatchesAccept(state.file, adapter.accept)) {\n return adapter.add(state);\n }\n }\n throw new Error(\"No matching adapter found for file\");\n }\n\n public async send(attachment: PendingAttachment) {\n const adapters = this._adapters.slice();\n for (const adapter of adapters) {\n if (fileMatchesAccept(attachment.file, adapter.accept)) {\n return adapter.send(attachment);\n }\n }\n throw new Error(\"No matching adapter found for attachment\");\n }\n\n public async remove(attachment: Attachment) {\n const adapters = this._adapters.slice();\n for (const adapter of adapters) {\n if (\n fileMatchesAccept(\n attachment.file ?? {\n name: attachment.name,\n type: attachment.contentType ?? \"\",\n },\n adapter.accept,\n )\n ) {\n return adapter.remove(attachment);\n }\n }\n throw new Error(\"No matching adapter found for attachment\");\n }\n}\n"],"mappings":";;AAiBA,IAAagB,+BAAb,MAAuE;CACrE,SAAgB;CAEhB,MAAaT,IAAIC,OAAmD;EAClE,OAAO;GACLS,IAAIb,WAAW;GACfc,MAAM;GACNC,MAAMX,MAAMC,KAAKU;GACjBC,aAAaZ,MAAMC,KAAKS;GACxBT,MAAMD,MAAMC;GACZY,QAAQ;IAAEH,MAAM;IAAmBI,QAAQ;GAAgB;EAC7D;CACF;CAEA,MAAaP,KACXD,YAC6B;EAC7B,OAAO;GACL,GAAGA;GACHO,QAAQ,EAAEH,MAAM,WAAW;GAC3BK,SAAS,CACP;IACEL,MAAM;IACNM,OAAO,MAAMC,eAAeX,WAAWL,IAAI;GAC7C,CAAC;EAEL;CACF;CAEA,MAAaI,SAAS,CACpB;AAEJ;AAEA,MAAMa,iBAAiBC,UAA8B;CACnD,MAAME,aACJC,WAKAC;CACF,IAAIF,YACF,OAAOA,WAAWG,KAAKL,KAAK,CAAC,CAACM,SAAS,QAAQ;CAEjD,IAAIE,SAAS;CACb,MAAMC,YAAY;CAClB,KAAK,IAAIC,IAAI,GAAGA,IAAIV,MAAMW,QAAQD,KAAKD,WACrCD,UAAUI,OAAOC,aAAa,GAAGb,MAAMc,SAASJ,GAAGA,IAAID,SAAS,CAAC;CAEnE,OAAOM,KAAKP,MAAM;AACpB;AAIA,MAAaV,iBAAiB,OAAOhB,SAAgC;CACnE,IAAI,OAAOkC,eAAe,aAAa;EACrC,MAAMC,SAAS,MAAMnC,KAAKoC,YAAY;EACtC,OAAO,QAAQpC,KAAKS,QAAQ,2BAA0B,UAAWQ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UQ,MAAM;EACtC,KAAK,MAAMD,WAAWL,UACpB,IACE5B,kBACE5C,WAAWL,QAAQ;GACjBU,MAAML,WAAWK;GACjBD,MAAMJ,WAAWM,eAAe;EAClC,GACAuE,QAAQrF,MACV,GAEA,OAAOqF,QAAQ9E,OAAOC,UAAU;EAGpC,MAAM,IAAI2E,MAAM,0CAA0C;CAC5D;AACF"}
|
|
1
|
+
{"version":3,"file":"attachment.js","names":["Attachment","PendingAttachment","CompleteAttachment","ThreadUserMessagePart","generateId","AttachmentAdapter","accept","add","state","file","File","Promise","AsyncGenerator","remove","attachment","send","SimpleImageAttachmentAdapter","id","type","name","contentType","status","reason","content","image","getFileDataURL","bytesToBase64","bytes","Uint8Array","nodeBuffer","globalThis","Buffer","from","toString","encoding","binary","chunkSize","i","length","String","fromCharCode","subarray","btoa","FileReader","buffer","arrayBuffer","resolve","reject","reader","onload","result","onerror","error","readAsDataURL","escapeAttachmentName","replaceAll","SimpleTextAttachmentAdapter","text","getFileText","readAsText","fileMatchesAccept","acceptString","allowedTypes","split","map","trim","toLowerCase","fileName","fileMimeType","startsWith","endsWith","includes","generalType","attachmentsEqual","a","b","partToCompleteAttachment","part","Exclude","filename","mimeType","audio","format","liftNonTextParts","push","CompositeAttachmentAdapter","_adapters","constructor","adapters","wildcardIdx","findIndex","Error","join","adapter","slice"],"sources":["../../src/adapters/attachment.ts"],"sourcesContent":["import type {\n Attachment,\n PendingAttachment,\n CompleteAttachment,\n} from \"../types/attachment\";\nimport type { ThreadUserMessagePart } from \"../types/message\";\nimport { generateId } from \"../utils/id\";\n\nexport type AttachmentAdapter = {\n accept: string;\n add(state: {\n file: File;\n }): Promise<PendingAttachment> | AsyncGenerator<PendingAttachment, void>;\n remove(attachment: Attachment): Promise<void>;\n send(attachment: PendingAttachment): Promise<CompleteAttachment>;\n};\n\nexport class SimpleImageAttachmentAdapter implements AttachmentAdapter {\n public accept = \"image/*\";\n\n public async add(state: { file: File }): Promise<PendingAttachment> {\n return {\n id: generateId(),\n type: \"image\",\n name: state.file.name,\n contentType: state.file.type,\n file: state.file,\n status: { type: \"requires-action\", reason: \"composer-send\" },\n };\n }\n\n public async send(\n attachment: PendingAttachment,\n ): Promise<CompleteAttachment> {\n return {\n ...attachment,\n status: { type: \"complete\" },\n content: [\n {\n type: \"image\",\n image: await getFileDataURL(attachment.file),\n },\n ],\n };\n }\n\n public async remove() {\n // noop\n }\n}\n\nconst bytesToBase64 = (bytes: Uint8Array): string => {\n const nodeBuffer = (\n globalThis as {\n Buffer?: {\n from(bytes: Uint8Array): { toString(encoding: string): string };\n };\n }\n ).Buffer;\n if (nodeBuffer) {\n return nodeBuffer.from(bytes).toString(\"base64\");\n }\n let binary = \"\";\n const chunkSize = 0x8000;\n for (let i = 0; i < bytes.length; i += chunkSize) {\n binary += String.fromCharCode(...bytes.subarray(i, i + chunkSize));\n }\n return btoa(binary);\n};\n\n// React Native's Blob polyfill has FileReader but not file.text()/arrayBuffer(); Node has\n// the reverse. Prefer FileReader when present, falling back to the Blob methods otherwise.\nexport const getFileDataURL = async (file: File): Promise<string> => {\n if (typeof FileReader === \"undefined\") {\n const buffer = await file.arrayBuffer();\n return `data:${file.type || \"application/octet-stream\"};base64,${bytesToBase64(new Uint8Array(buffer))}`;\n }\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = (error) => reject(error);\n reader.readAsDataURL(file);\n });\n};\n\nconst escapeAttachmentName = (name: string) =>\n name\n .replaceAll(\"&\", \"&\")\n .replaceAll('\"', \""\")\n .replaceAll(\"<\", \"<\")\n .replaceAll(\">\", \">\");\n\nexport class SimpleTextAttachmentAdapter implements AttachmentAdapter {\n public accept =\n \"text/plain,text/html,text/markdown,text/csv,text/xml,text/json,application/json,text/css\";\n\n public async add(state: { file: File }): Promise<PendingAttachment> {\n return {\n id: generateId(),\n type: \"document\",\n name: state.file.name,\n contentType: state.file.type,\n file: state.file,\n status: { type: \"requires-action\", reason: \"composer-send\" },\n };\n }\n\n public async send(\n attachment: PendingAttachment,\n ): Promise<CompleteAttachment> {\n return {\n ...attachment,\n status: { type: \"complete\" },\n content: [\n {\n type: \"text\",\n text: `<attachment name=\"${escapeAttachmentName(attachment.name)}\">\\n${await getFileText(attachment.file)}\\n</attachment>`,\n },\n ],\n };\n }\n\n public async remove() {\n // noop\n }\n}\n\nconst getFileText = async (file: File): Promise<string> => {\n if (typeof FileReader === \"undefined\") {\n return file.text();\n }\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = (error) => reject(error);\n reader.readAsText(file);\n });\n};\n\nexport function fileMatchesAccept(\n file: { name: string; type: string },\n acceptString: string,\n) {\n if (acceptString === \"*\") {\n return true;\n }\n\n const allowedTypes = acceptString\n .split(\",\")\n .map((type) => type.trim().toLowerCase());\n\n const fileName = file.name.toLowerCase();\n const fileMimeType = file.type.split(\";\", 1)[0]!.trim().toLowerCase();\n\n for (const type of allowedTypes) {\n if (type.startsWith(\".\") && fileName.endsWith(type)) {\n return true;\n }\n\n if (type.includes(\"/\") && type === fileMimeType) {\n return true;\n }\n\n if (type.endsWith(\"/*\")) {\n const generalType = type.split(\"/\")[0]!;\n if (fileMimeType.startsWith(`${generalType}/`)) {\n return true;\n }\n }\n }\n\n return false;\n}\n\nexport function attachmentsEqual(\n a: readonly CompleteAttachment[],\n b: readonly CompleteAttachment[],\n): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i]?.id !== b[i]?.id) return false;\n }\n return true;\n}\n\nexport function partToCompleteAttachment(\n part: Exclude<ThreadUserMessagePart, { type: \"text\" }>,\n): CompleteAttachment {\n const id = generateId();\n\n if (part.type === \"image\") {\n return {\n id,\n type: \"image\",\n name: part.filename ?? \"image\",\n content: [part],\n status: { type: \"complete\" },\n };\n }\n\n if (part.type === \"file\") {\n return {\n id,\n type: \"document\",\n name: part.filename ?? \"document\",\n contentType: part.mimeType,\n content: [part],\n status: { type: \"complete\" },\n };\n }\n\n if (part.type === \"audio\") {\n return {\n id,\n type: \"audio\",\n name: `audio.${part.audio.format}`,\n contentType: `audio/${part.audio.format}`,\n content: [part],\n status: { type: \"complete\" },\n };\n }\n\n return {\n id,\n type: \"data\",\n name: part.name,\n content: [part],\n status: { type: \"complete\" },\n };\n}\n\nexport function liftNonTextParts(\n content: readonly ThreadUserMessagePart[],\n): CompleteAttachment[] {\n const result: CompleteAttachment[] = [];\n for (const part of content) {\n if (part.type !== \"text\") {\n result.push(partToCompleteAttachment(part));\n }\n }\n return result;\n}\n\nexport class CompositeAttachmentAdapter implements AttachmentAdapter {\n private _adapters: AttachmentAdapter[];\n\n public accept: string;\n\n constructor(adapters: AttachmentAdapter[]) {\n this._adapters = adapters;\n\n const wildcardIdx = adapters.findIndex((a) => a.accept === \"*\");\n if (wildcardIdx !== -1) {\n if (wildcardIdx !== adapters.length - 1)\n throw new Error(\n \"A wildcard adapter (handling all files) can only be specified as the last adapter.\",\n );\n\n this.accept = \"*\";\n } else {\n this.accept = adapters.map((a) => a.accept).join(\",\");\n }\n }\n\n public add(state: { file: File }) {\n for (const adapter of this._adapters) {\n if (fileMatchesAccept(state.file, adapter.accept)) {\n return adapter.add(state);\n }\n }\n throw new Error(\"No matching adapter found for file\");\n }\n\n public async send(attachment: PendingAttachment) {\n const adapters = this._adapters.slice();\n for (const adapter of adapters) {\n if (fileMatchesAccept(attachment.file, adapter.accept)) {\n return adapter.send(attachment);\n }\n }\n throw new Error(\"No matching adapter found for attachment\");\n }\n\n public async remove(attachment: Attachment) {\n const adapters = this._adapters.slice();\n for (const adapter of adapters) {\n if (\n fileMatchesAccept(\n attachment.file ?? {\n name: attachment.name,\n type: attachment.contentType ?? \"\",\n },\n adapter.accept,\n )\n ) {\n return adapter.remove(attachment);\n }\n }\n throw new Error(\"No matching adapter found for attachment\");\n }\n}\n"],"mappings":";;AAiBA,IAAagB,+BAAb,MAAuE;CACrE,SAAgB;CAEhB,MAAaT,I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OAAOuF,QAAQhF,OAAOC,UAAU;EAGpC,MAAM,IAAI6E,MAAM,0CAA0C;CAC5D;AACF"}
|
|
@@ -5,7 +5,6 @@ import { Unstable_DirectiveFormatter } from "../types/directive.js";
|
|
|
5
5
|
*
|
|
6
6
|
* When `id` equals `label`, the `{name=…}` attribute is omitted for brevity.
|
|
7
7
|
*/
|
|
8
|
-
declare const unstable_defaultDirectiveFormatter: Unstable_DirectiveFormatter;
|
|
8
|
+
export declare const unstable_defaultDirectiveFormatter: Unstable_DirectiveFormatter;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { unstable_defaultDirectiveFormatter };
|
|
11
10
|
//# sourceMappingURL=directive-formatter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directive-formatter.d.ts","names":[],"sources":["../../src/adapters/directive-formatter.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"directive-formatter.d.ts","names":[],"sources":["../../src/adapters/directive-formatter.ts"],"mappings":";;;;;;;qBAca,oCAAoC"}
|
|
@@ -3,10 +3,10 @@ import { ThreadMessage } from "../types/message.js";
|
|
|
3
3
|
type FeedbackAdapterFeedback = {
|
|
4
4
|
message: ThreadMessage;
|
|
5
5
|
type: "positive" | "negative";
|
|
6
|
+
comment?: string;
|
|
6
7
|
};
|
|
7
|
-
type FeedbackAdapter = {
|
|
8
|
+
export type FeedbackAdapter = {
|
|
8
9
|
submit: (feedback: FeedbackAdapterFeedback) => void;
|
|
9
10
|
};
|
|
10
11
|
//#endregion
|
|
11
|
-
export { FeedbackAdapter };
|
|
12
12
|
//# sourceMappingURL=feedback.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feedback.d.ts","names":[],"sources":["../../src/adapters/feedback.ts"],"mappings":";;KAEK;EACH,SAAS;EACT;;
|
|
1
|
+
{"version":3,"file":"feedback.d.ts","names":[],"sources":["../../src/adapters/feedback.ts"],"mappings":";;KAEK;EACH,SAAS;EACT;EACA;;YAGU;EACV,SAAS,UAAU"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Unsubscribe } from "../types/unsubscribe.js";
|
|
2
2
|
//#region src/adapters/speech.d.ts
|
|
3
|
-
declare namespace SpeechSynthesisAdapter {
|
|
3
|
+
export declare namespace SpeechSynthesisAdapter {
|
|
4
4
|
type Status = {
|
|
5
5
|
type: "starting" | "running";
|
|
6
6
|
} | {
|
|
@@ -14,10 +14,10 @@ declare namespace SpeechSynthesisAdapter {
|
|
|
14
14
|
subscribe: (callback: () => void) => Unsubscribe;
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
type SpeechSynthesisAdapter = {
|
|
17
|
+
export type SpeechSynthesisAdapter = {
|
|
18
18
|
speak: (text: string) => SpeechSynthesisAdapter.Utterance;
|
|
19
19
|
};
|
|
20
|
-
declare namespace DictationAdapter {
|
|
20
|
+
export declare namespace DictationAdapter {
|
|
21
21
|
type Status = {
|
|
22
22
|
type: "starting" | "running";
|
|
23
23
|
} | {
|
|
@@ -37,11 +37,11 @@ declare namespace DictationAdapter {
|
|
|
37
37
|
onSpeech: (callback: (result: Result) => void) => Unsubscribe;
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
type DictationAdapter = {
|
|
40
|
+
export type DictationAdapter = {
|
|
41
41
|
listen: () => DictationAdapter.Session;
|
|
42
42
|
disableInputDuringDictation?: boolean;
|
|
43
43
|
};
|
|
44
|
-
declare class WebSpeechSynthesisAdapter implements SpeechSynthesisAdapter {
|
|
44
|
+
export declare class WebSpeechSynthesisAdapter implements SpeechSynthesisAdapter {
|
|
45
45
|
speak(text: string): SpeechSynthesisAdapter.Utterance;
|
|
46
46
|
}
|
|
47
47
|
interface SpeechRecognitionInstance extends EventTarget {
|
|
@@ -61,7 +61,7 @@ declare global {
|
|
|
61
61
|
webkitSpeechRecognition?: SpeechRecognitionConstructor;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
declare class WebSpeechDictationAdapter implements DictationAdapter {
|
|
64
|
+
export declare class WebSpeechDictationAdapter implements DictationAdapter {
|
|
65
65
|
private _language;
|
|
66
66
|
private _continuous;
|
|
67
67
|
private _interimResults;
|
|
@@ -74,5 +74,4 @@ declare class WebSpeechDictationAdapter implements DictationAdapter {
|
|
|
74
74
|
listen(): DictationAdapter.Session;
|
|
75
75
|
}
|
|
76
76
|
//#endregion
|
|
77
|
-
export { DictationAdapter, SpeechSynthesisAdapter, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter };
|
|
78
77
|
//# sourceMappingURL=speech.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech.d.ts","names":[],"sources":["../../src/adapters/speech.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"speech.d.ts","names":[],"sources":["../../src/adapters/speech.ts"],"mappings":";;yBAGiB;OACH;IAEN;;IAGA;IACA;IACA;;OAGM;IACV,QAAQ;IACR;IACA,YAAY,yBAAyB;;;YAI7B;EACV,QAAQ,iBAAiB,uBAAuB;;yBAGjC;OACH;IAEN;;IAGA;IACA;;OAGM;IACV;IACA;;OAGU;IACV,QAAQ;IACR,YAAY;IACZ;IACA,gBAAgB,yBAAyB;IACzC,cAAc,WAAW,QAAQ,oBAAoB;IACrD,WAAW,WAAW,QAAQ,oBAAoB;;;YAI1C;EACV,cAAc,iBAAiB;EAC/B;;qBAGW,qCAAqC;EAChD,MAAM,eAAe,uBAAuB;;UA6EpC,kCAAkC;EAC1C;EACA;EACA;EACA;EACA;EACA;;UAGQ;UACA;;QAGF;YACI;IACR,oBAAoB;IACpB,0BAA0B;;;qBAWjB,qCAAqC;UACxC;UACA;UACA;EAGN,YAAA;IACE;IACA;IACA;;SAYG;EAIP,UAAU,iBAAiB"}
|
package/dist/adapters/speech.js
CHANGED
|
@@ -19,6 +19,7 @@ var WebSpeechSynthesisAdapter = class {
|
|
|
19
19
|
const res = {
|
|
20
20
|
status: { type: "running" },
|
|
21
21
|
cancel: () => {
|
|
22
|
+
if (res.status.type === "ended") return;
|
|
22
23
|
window.speechSynthesis.cancel();
|
|
23
24
|
handleEnd("cancelled");
|
|
24
25
|
},
|
|
@@ -70,6 +71,8 @@ var WebSpeechDictationAdapter = class {
|
|
|
70
71
|
const speechEndCallbacks = /* @__PURE__ */ new Set();
|
|
71
72
|
const speechCallbacks = /* @__PURE__ */ new Set();
|
|
72
73
|
let finalTranscript = "";
|
|
74
|
+
let hasInterimTranscript = false;
|
|
75
|
+
let firstInterimIndex = 0;
|
|
73
76
|
const session = {
|
|
74
77
|
status: { type: "starting" },
|
|
75
78
|
stop: async () => {
|
|
@@ -115,18 +118,25 @@ var WebSpeechDictationAdapter = class {
|
|
|
115
118
|
});
|
|
116
119
|
recognition.addEventListener("result", (event) => {
|
|
117
120
|
const speechEvent = event;
|
|
118
|
-
|
|
121
|
+
let interimTranscript = "";
|
|
122
|
+
for (let i = firstInterimIndex; i < speechEvent.results.length; i++) {
|
|
119
123
|
const result = speechEvent.results[i];
|
|
120
124
|
if (!result) continue;
|
|
121
125
|
const transcript = result[0]?.transcript ?? "";
|
|
122
126
|
if (result.isFinal) {
|
|
127
|
+
firstInterimIndex = i + 1;
|
|
123
128
|
finalTranscript += transcript;
|
|
129
|
+
hasInterimTranscript = false;
|
|
124
130
|
notifyEventListeners(speechCallbacks, () => ({
|
|
125
131
|
transcript,
|
|
126
132
|
isFinal: true
|
|
127
133
|
}), "Dictation");
|
|
128
|
-
} else
|
|
129
|
-
|
|
134
|
+
} else interimTranscript += transcript;
|
|
135
|
+
}
|
|
136
|
+
if (interimTranscript || hasInterimTranscript) {
|
|
137
|
+
hasInterimTranscript = interimTranscript.length > 0;
|
|
138
|
+
notifyEventListeners(speechCallbacks, () => ({
|
|
139
|
+
transcript: interimTranscript,
|
|
130
140
|
isFinal: false
|
|
131
141
|
}), "Dictation");
|
|
132
142
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech.js","names":["Unsubscribe","notifyEventListeners","SpeechSynthesisAdapter","Status","type","reason","error","Utterance","status","cancel","subscribe","callback","speak","text","DictationAdapter","Result","transcript","isFinal","Session","stop","Promise","onSpeechStart","onSpeechEnd","result","onSpeech","listen","disableInputDuringDictation","WebSpeechSynthesisAdapter","utterance","SpeechSynthesisUtterance","subscribers","Set","handleEnd","res","undefined","addEventListener","e","window","speechSynthesis","cancelled","queueMicrotask","add","delete","SpeechRecognitionResultItem","confidence","SpeechRecognitionResult","length","item","index","SpeechRecognitionResultList","SpeechRecognitionEvent","Event","resultIndex","results","SpeechRecognitionErrorEvent","message","SpeechRecognitionInstance","EventTarget","lang","continuous","interimResults","start","abort","SpeechRecognitionConstructor","global","Window","SpeechRecognition","webkitSpeechRecognition","getSpeechRecognitionAPI","WebSpeechDictationAdapter","_language","_continuous","_interimResults","constructor","options","language","defaultLanguage","navigator","isSupported","SpeechRecognitionAPI","Error","recognition","speechStartCallbacks","speechEndCallbacks","speechCallbacks","finalTranscript","session","resolve","checkEnded","setTimeout","updateStatus","newStatus","event","speechEvent","i","currentStatus","errorEvent","console"],"sources":["../../src/adapters/speech.ts"],"sourcesContent":["import type { Unsubscribe } from \"../types/unsubscribe\";\nimport { notifyEventListeners } from \"../utils/notify-event-listeners\";\n\nexport namespace SpeechSynthesisAdapter {\n export type Status =\n | {\n type: \"starting\" | \"running\";\n }\n | {\n type: \"ended\";\n reason: \"finished\" | \"cancelled\" | \"error\";\n error?: unknown;\n };\n\n export type Utterance = {\n status: Status;\n cancel: () => void;\n subscribe: (callback: () => void) => Unsubscribe;\n };\n}\n\nexport type SpeechSynthesisAdapter = {\n speak: (text: string) => SpeechSynthesisAdapter.Utterance;\n};\n\nexport namespace DictationAdapter {\n export type Status =\n | {\n type: \"starting\" | \"running\";\n }\n | {\n type: \"ended\";\n reason: \"stopped\" | \"cancelled\" | \"error\";\n };\n\n export type Result = {\n transcript: string;\n isFinal?: boolean;\n };\n\n export type Session = {\n status: Status;\n stop: () => Promise<void>;\n cancel: () => void;\n onSpeechStart: (callback: () => void) => Unsubscribe;\n onSpeechEnd: (callback: (result: Result) => void) => Unsubscribe;\n onSpeech: (callback: (result: Result) => void) => Unsubscribe;\n };\n}\n\nexport type DictationAdapter = {\n listen: () => DictationAdapter.Session;\n disableInputDuringDictation?: boolean;\n};\n\nexport class WebSpeechSynthesisAdapter implements SpeechSynthesisAdapter {\n speak(text: string): SpeechSynthesisAdapter.Utterance {\n const utterance = new SpeechSynthesisUtterance(text);\n\n const subscribers = new Set<() => void>();\n const handleEnd = (\n reason: \"finished\" | \"error\" | \"cancelled\",\n error?: unknown,\n ) => {\n if (res.status.type === \"ended\") return;\n\n res.status = { type: \"ended\", reason, error };\n notifyEventListeners(subscribers, undefined, \"Speech synthesis\");\n };\n\n utterance.addEventListener(\"end\", () => handleEnd(\"finished\"));\n utterance.addEventListener(\"error\", (e) => handleEnd(\"error\", e.error));\n\n window.speechSynthesis.speak(utterance);\n\n const res: SpeechSynthesisAdapter.Utterance = {\n status: { type: \"running\" },\n cancel: () => {\n window.speechSynthesis.cancel();\n handleEnd(\"cancelled\");\n },\n subscribe: (callback) => {\n if (res.status.type === \"ended\") {\n let cancelled = false;\n queueMicrotask(() => {\n if (!cancelled) {\n notifyEventListeners([callback], undefined, \"Speech synthesis\");\n }\n });\n return () => {\n cancelled = true;\n };\n } else {\n subscribers.add(callback);\n return () => {\n subscribers.delete(callback);\n };\n }\n },\n };\n return res;\n }\n}\n\ninterface SpeechRecognitionResultItem {\n transcript: string;\n confidence: number;\n}\n\ninterface SpeechRecognitionResult {\n readonly length: number;\n item(index: number): SpeechRecognitionResultItem;\n readonly isFinal: boolean;\n [index: number]: SpeechRecognitionResultItem;\n}\n\ninterface SpeechRecognitionResultList {\n readonly length: number;\n item(index: number): SpeechRecognitionResult;\n [index: number]: SpeechRecognitionResult;\n}\n\ninterface SpeechRecognitionEvent extends Event {\n readonly resultIndex: number;\n readonly results: SpeechRecognitionResultList;\n}\n\ninterface SpeechRecognitionErrorEvent extends Event {\n readonly error: string;\n readonly message: string;\n}\n\ninterface SpeechRecognitionInstance extends EventTarget {\n lang: string;\n continuous: boolean;\n interimResults: boolean;\n start(): void;\n stop(): void;\n abort(): void;\n}\n\ninterface SpeechRecognitionConstructor {\n new (): SpeechRecognitionInstance;\n}\n\ndeclare global {\n interface Window {\n SpeechRecognition?: SpeechRecognitionConstructor;\n webkitSpeechRecognition?: SpeechRecognitionConstructor;\n }\n}\n\nconst getSpeechRecognitionAPI = ():\n | SpeechRecognitionConstructor\n | undefined => {\n if (typeof window === \"undefined\") return undefined;\n return window.SpeechRecognition ?? window.webkitSpeechRecognition;\n};\n\nexport class WebSpeechDictationAdapter implements DictationAdapter {\n private _language: string;\n private _continuous: boolean;\n private _interimResults: boolean;\n\n constructor(\n options: {\n language?: string;\n continuous?: boolean;\n interimResults?: boolean;\n } = {},\n ) {\n const defaultLanguage =\n typeof navigator !== \"undefined\" && navigator.language\n ? navigator.language\n : \"en-US\";\n this._language = options.language ?? defaultLanguage;\n this._continuous = options.continuous ?? true;\n this._interimResults = options.interimResults ?? true;\n }\n\n static isSupported(): boolean {\n return getSpeechRecognitionAPI() !== undefined;\n }\n\n listen(): DictationAdapter.Session {\n const SpeechRecognitionAPI = getSpeechRecognitionAPI();\n if (!SpeechRecognitionAPI) {\n throw new Error(\n \"SpeechRecognition is not supported in this browser. \" +\n \"Try using Chrome, Edge, or Safari.\",\n );\n }\n\n const recognition = new SpeechRecognitionAPI();\n recognition.lang = this._language;\n recognition.continuous = this._continuous;\n recognition.interimResults = this._interimResults;\n\n const speechStartCallbacks = new Set<() => void>();\n const speechEndCallbacks = new Set<\n (result: DictationAdapter.Result) => void\n >();\n const speechCallbacks = new Set<\n (result: DictationAdapter.Result) => void\n >();\n\n let finalTranscript = \"\";\n\n const session: DictationAdapter.Session = {\n status: { type: \"starting\" },\n\n stop: async () => {\n recognition.stop();\n return new Promise<void>((resolve) => {\n const checkEnded = () => {\n if (session.status.type === \"ended\") {\n resolve();\n } else {\n setTimeout(checkEnded, 50);\n }\n };\n checkEnded();\n });\n },\n\n cancel: () => {\n recognition.abort();\n },\n\n onSpeechStart: (callback: () => void): Unsubscribe => {\n speechStartCallbacks.add(callback);\n return () => {\n speechStartCallbacks.delete(callback);\n };\n },\n\n onSpeechEnd: (\n callback: (result: DictationAdapter.Result) => void,\n ): Unsubscribe => {\n speechEndCallbacks.add(callback);\n return () => {\n speechEndCallbacks.delete(callback);\n };\n },\n\n onSpeech: (\n callback: (result: DictationAdapter.Result) => void,\n ): Unsubscribe => {\n speechCallbacks.add(callback);\n return () => {\n speechCallbacks.delete(callback);\n };\n },\n };\n\n const updateStatus = (newStatus: DictationAdapter.Status) => {\n session.status = newStatus;\n };\n\n recognition.addEventListener(\"speechstart\", () => {\n notifyEventListeners(speechStartCallbacks, undefined, \"Dictation\");\n });\n\n recognition.addEventListener(\"start\", () => {\n updateStatus({ type: \"running\" });\n });\n\n recognition.addEventListener(\"result\", (event) => {\n const speechEvent = event as unknown as SpeechRecognitionEvent;\n\n for (\n let i = speechEvent.resultIndex;\n i < speechEvent.results.length;\n i++\n ) {\n const result = speechEvent.results[i];\n if (!result) continue;\n\n const transcript = result[0]?.transcript ?? \"\";\n\n if (result.isFinal) {\n finalTranscript += transcript;\n notifyEventListeners(\n speechCallbacks,\n () => ({ transcript, isFinal: true }),\n \"Dictation\",\n );\n } else {\n notifyEventListeners(\n speechCallbacks,\n () => ({ transcript, isFinal: false }),\n \"Dictation\",\n );\n }\n }\n });\n\n recognition.addEventListener(\"speechend\", () => {\n // speechend fires when user stops speaking, but 'end' handles final cleanup\n });\n\n recognition.addEventListener(\"end\", () => {\n const currentStatus = session.status;\n if (currentStatus.type !== \"ended\") {\n updateStatus({ type: \"ended\", reason: \"stopped\" });\n }\n if (finalTranscript) {\n notifyEventListeners(\n speechEndCallbacks,\n () => ({ transcript: finalTranscript }),\n \"Dictation\",\n );\n finalTranscript = \"\";\n }\n });\n\n recognition.addEventListener(\"error\", (event) => {\n const errorEvent = event as unknown as SpeechRecognitionErrorEvent;\n if (errorEvent.error === \"aborted\") {\n updateStatus({ type: \"ended\", reason: \"cancelled\" });\n } else {\n updateStatus({ type: \"ended\", reason: \"error\" });\n console.error(\"Dictation error:\", errorEvent.error, errorEvent.message);\n }\n });\n\n try {\n recognition.start();\n } catch (error) {\n updateStatus({ type: \"ended\", reason: \"error\" });\n throw error;\n }\n\n return session;\n }\n}\n"],"mappings":";;AAuDA,IAAa2B,4BAAb,MAAyE;CACvEf,MAAMC,MAAgD;EACpD,MAAMe,YAAY,IAAIC,yBAAyBhB,IAAI;EAEnD,MAAMiB,8BAAc,IAAIC,IAAgB;EACxC,MAAMC,aACJ3B,QACAC,UACG;GACH,IAAI2B,IAAIzB,OAAOJ,SAAS,SAAS;GAEjC6B,IAAIzB,SAAS;IAAEJ,MAAM;IAASC;IAAQC;GAAM;GAC5CL,qBAAqB6B,aAAaI,KAAAA,GAAW,kBAAkB;EACjE;EAEAN,UAAUO,iBAAiB,aAAaH,UAAU,UAAU,CAAC;EAC7DJ,UAAUO,iBAAiB,UAAUC,MAAMJ,UAAU,SAASI,EAAE9B,KAAK,CAAC;EAEtE+B,OAAOC,gBAAgB1B,MAAMgB,SAAS;EAEtC,MAAMK,MAAwC;GAC5CzB,QAAQ,EAAEJ,MAAM,UAAU;GAC1BK,cAAc;IACZ4B,OAAOC,gBAAgB7B,OAAO;IAC9BuB,UAAU,WAAW;GACvB;GACAtB,YAAYC,aAAa;IACvB,IAAIsB,IAAIzB,OAAOJ,SAAS,SAAS;KAC/B,IAAImC,YAAY;KAChBC,qBAAqB;MACnB,IAAI,CAACD,WACHtC,qBAAqB,CAACU,QAAQ,GAAGuB,KAAAA,GAAW,kBAAkB;KAElE,CAAC;KACD,aAAa;MACXK,YAAY;KACd;IACF,OAAO;KACLT,YAAYW,IAAI9B,QAAQ;KACxB,aAAa;MACXmB,YAAYY,OAAO/B,QAAQ;KAC7B;IACF;GACF;EACF;EACA,OAAOsB;CACT;AACF;AAkDA,MAAMmC,gCAEW;C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AAU,WACvBoF,aAAa;IAAEtF,MAAM;IAASC,QAAQ;GAAY,CAAC;QAC9C;IACLqF,aAAa;KAAEtF,MAAM;KAASC,QAAQ;IAAQ,CAAC;IAC/C4F,QAAQ3F,MAAM,oBAAoB0F,WAAW1F,OAAO0F,WAAWzC,OAAO;GACxE;EACF,CAAC;EAED,IAAI;GACF0B,YAAYpB,MAAM;EACpB,SAASvD,OAAO;GACdoF,aAAa;IAAEtF,MAAM;IAASC,QAAQ;GAAQ,CAAC;GAC/C,MAAMC;EACR;EAEA,OAAOgF;CACT;AACF"}
|
|
1
|
+
{"version":3,"file":"speech.js","names":["Unsubscribe","notifyEventListeners","SpeechSynthesisAdapter","Status","type","reason","error","Utterance","status","cancel","subscribe","callback","speak","text","DictationAdapter","Result","transcript","isFinal","Session","stop","Promise","onSpeechStart","onSpeechEnd","result","onSpeech","listen","disableInputDuringDictation","WebSpeechSynthesisAdapter","utterance","SpeechSynthesisUtterance","subscribers","Set","handleEnd","res","undefined","addEventListener","e","window","speechSynthesis","cancelled","queueMicrotask","add","delete","SpeechRecognitionResultItem","confidence","SpeechRecognitionResult","length","item","index","SpeechRecognitionResultList","SpeechRecognitionEvent","Event","resultIndex","results","SpeechRecognitionErrorEvent","message","SpeechRecognitionInstance","EventTarget","lang","continuous","interimResults","start","abort","SpeechRecognitionConstructor","global","Window","SpeechRecognition","webkitSpeechRecognition","getSpeechRecognitionAPI","WebSpeechDictationAdapter","_language","_continuous","_interimResults","constructor","options","language","defaultLanguage","navigator","isSupported","SpeechRecognitionAPI","Error","recognition","speechStartCallbacks","speechEndCallbacks","speechCallbacks","finalTranscript","hasInterimTranscript","firstInterimIndex","session","resolve","checkEnded","setTimeout","updateStatus","newStatus","event","speechEvent","interimTranscript","i","currentStatus","errorEvent","console"],"sources":["../../src/adapters/speech.ts"],"sourcesContent":["import type { Unsubscribe } from \"../types/unsubscribe\";\nimport { notifyEventListeners } from \"../utils/notify-event-listeners\";\n\nexport namespace SpeechSynthesisAdapter {\n export type Status =\n | {\n type: \"starting\" | \"running\";\n }\n | {\n type: \"ended\";\n reason: \"finished\" | \"cancelled\" | \"error\";\n error?: unknown;\n };\n\n export type Utterance = {\n status: Status;\n cancel: () => void;\n subscribe: (callback: () => void) => Unsubscribe;\n };\n}\n\nexport type SpeechSynthesisAdapter = {\n speak: (text: string) => SpeechSynthesisAdapter.Utterance;\n};\n\nexport namespace DictationAdapter {\n export type Status =\n | {\n type: \"starting\" | \"running\";\n }\n | {\n type: \"ended\";\n reason: \"stopped\" | \"cancelled\" | \"error\";\n };\n\n export type Result = {\n transcript: string;\n isFinal?: boolean;\n };\n\n export type Session = {\n status: Status;\n stop: () => Promise<void>;\n cancel: () => void;\n onSpeechStart: (callback: () => void) => Unsubscribe;\n onSpeechEnd: (callback: (result: Result) => void) => Unsubscribe;\n onSpeech: (callback: (result: Result) => void) => Unsubscribe;\n };\n}\n\nexport type DictationAdapter = {\n listen: () => DictationAdapter.Session;\n disableInputDuringDictation?: boolean;\n};\n\nexport class WebSpeechSynthesisAdapter implements SpeechSynthesisAdapter {\n speak(text: string): SpeechSynthesisAdapter.Utterance {\n const utterance = new SpeechSynthesisUtterance(text);\n\n const subscribers = new Set<() => void>();\n const handleEnd = (\n reason: \"finished\" | \"error\" | \"cancelled\",\n error?: unknown,\n ) => {\n if (res.status.type === \"ended\") return;\n\n res.status = { type: \"ended\", reason, error };\n notifyEventListeners(subscribers, undefined, \"Speech synthesis\");\n };\n\n utterance.addEventListener(\"end\", () => handleEnd(\"finished\"));\n utterance.addEventListener(\"error\", (e) => handleEnd(\"error\", e.error));\n\n window.speechSynthesis.speak(utterance);\n\n const res: SpeechSynthesisAdapter.Utterance = {\n status: { type: \"running\" },\n cancel: () => {\n if (res.status.type === \"ended\") return;\n window.speechSynthesis.cancel();\n handleEnd(\"cancelled\");\n },\n subscribe: (callback) => {\n if (res.status.type === \"ended\") {\n let cancelled = false;\n queueMicrotask(() => {\n if (!cancelled) {\n notifyEventListeners([callback], undefined, \"Speech synthesis\");\n }\n });\n return () => {\n cancelled = true;\n };\n } else {\n subscribers.add(callback);\n return () => {\n subscribers.delete(callback);\n };\n }\n },\n };\n return res;\n }\n}\n\ninterface SpeechRecognitionResultItem {\n transcript: string;\n confidence: number;\n}\n\ninterface SpeechRecognitionResult {\n readonly length: number;\n item(index: number): SpeechRecognitionResultItem;\n readonly isFinal: boolean;\n [index: number]: SpeechRecognitionResultItem;\n}\n\ninterface SpeechRecognitionResultList {\n readonly length: number;\n item(index: number): SpeechRecognitionResult;\n [index: number]: SpeechRecognitionResult;\n}\n\ninterface SpeechRecognitionEvent extends Event {\n readonly resultIndex: number;\n readonly results: SpeechRecognitionResultList;\n}\n\ninterface SpeechRecognitionErrorEvent extends Event {\n readonly error: string;\n readonly message: string;\n}\n\ninterface SpeechRecognitionInstance extends EventTarget {\n lang: string;\n continuous: boolean;\n interimResults: boolean;\n start(): void;\n stop(): void;\n abort(): void;\n}\n\ninterface SpeechRecognitionConstructor {\n new (): SpeechRecognitionInstance;\n}\n\ndeclare global {\n interface Window {\n SpeechRecognition?: SpeechRecognitionConstructor;\n webkitSpeechRecognition?: SpeechRecognitionConstructor;\n }\n}\n\nconst getSpeechRecognitionAPI = ():\n | SpeechRecognitionConstructor\n | undefined => {\n if (typeof window === \"undefined\") return undefined;\n return window.SpeechRecognition ?? window.webkitSpeechRecognition;\n};\n\nexport class WebSpeechDictationAdapter implements DictationAdapter {\n private _language: string;\n private _continuous: boolean;\n private _interimResults: boolean;\n\n constructor(\n options: {\n language?: string;\n continuous?: boolean;\n interimResults?: boolean;\n } = {},\n ) {\n const defaultLanguage =\n typeof navigator !== \"undefined\" && navigator.language\n ? navigator.language\n : \"en-US\";\n this._language = options.language ?? defaultLanguage;\n this._continuous = options.continuous ?? true;\n this._interimResults = options.interimResults ?? true;\n }\n\n static isSupported(): boolean {\n return getSpeechRecognitionAPI() !== undefined;\n }\n\n listen(): DictationAdapter.Session {\n const SpeechRecognitionAPI = getSpeechRecognitionAPI();\n if (!SpeechRecognitionAPI) {\n throw new Error(\n \"SpeechRecognition is not supported in this browser. \" +\n \"Try using Chrome, Edge, or Safari.\",\n );\n }\n\n const recognition = new SpeechRecognitionAPI();\n recognition.lang = this._language;\n recognition.continuous = this._continuous;\n recognition.interimResults = this._interimResults;\n\n const speechStartCallbacks = new Set<() => void>();\n const speechEndCallbacks = new Set<\n (result: DictationAdapter.Result) => void\n >();\n const speechCallbacks = new Set<\n (result: DictationAdapter.Result) => void\n >();\n\n let finalTranscript = \"\";\n let hasInterimTranscript = false;\n let firstInterimIndex = 0;\n\n const session: DictationAdapter.Session = {\n status: { type: \"starting\" },\n\n stop: async () => {\n recognition.stop();\n return new Promise<void>((resolve) => {\n const checkEnded = () => {\n if (session.status.type === \"ended\") {\n resolve();\n } else {\n setTimeout(checkEnded, 50);\n }\n };\n checkEnded();\n });\n },\n\n cancel: () => {\n recognition.abort();\n },\n\n onSpeechStart: (callback: () => void): Unsubscribe => {\n speechStartCallbacks.add(callback);\n return () => {\n speechStartCallbacks.delete(callback);\n };\n },\n\n onSpeechEnd: (\n callback: (result: DictationAdapter.Result) => void,\n ): Unsubscribe => {\n speechEndCallbacks.add(callback);\n return () => {\n speechEndCallbacks.delete(callback);\n };\n },\n\n onSpeech: (\n callback: (result: DictationAdapter.Result) => void,\n ): Unsubscribe => {\n speechCallbacks.add(callback);\n return () => {\n speechCallbacks.delete(callback);\n };\n },\n };\n\n const updateStatus = (newStatus: DictationAdapter.Status) => {\n session.status = newStatus;\n };\n\n recognition.addEventListener(\"speechstart\", () => {\n notifyEventListeners(speechStartCallbacks, undefined, \"Dictation\");\n });\n\n recognition.addEventListener(\"start\", () => {\n updateStatus({ type: \"running\" });\n });\n\n recognition.addEventListener(\"result\", (event) => {\n const speechEvent = event as unknown as SpeechRecognitionEvent;\n let interimTranscript = \"\";\n\n for (let i = firstInterimIndex; i < speechEvent.results.length; i++) {\n const result = speechEvent.results[i];\n if (!result) continue;\n\n const transcript = result[0]?.transcript ?? \"\";\n\n if (result.isFinal) {\n firstInterimIndex = i + 1;\n finalTranscript += transcript;\n hasInterimTranscript = false;\n notifyEventListeners(\n speechCallbacks,\n () => ({ transcript, isFinal: true }),\n \"Dictation\",\n );\n } else {\n interimTranscript += transcript;\n }\n }\n\n if (interimTranscript || hasInterimTranscript) {\n hasInterimTranscript = interimTranscript.length > 0;\n notifyEventListeners(\n speechCallbacks,\n () => ({ transcript: interimTranscript, isFinal: false }),\n \"Dictation\",\n );\n }\n });\n\n recognition.addEventListener(\"speechend\", () => {\n // speechend fires when user stops speaking, but 'end' handles final cleanup\n });\n\n recognition.addEventListener(\"end\", () => {\n const currentStatus = session.status;\n if (currentStatus.type !== \"ended\") {\n updateStatus({ type: \"ended\", reason: \"stopped\" });\n }\n if (finalTranscript) {\n notifyEventListeners(\n speechEndCallbacks,\n () => ({ transcript: finalTranscript }),\n \"Dictation\",\n );\n finalTranscript = \"\";\n }\n });\n\n recognition.addEventListener(\"error\", (event) => {\n const errorEvent = event as unknown as SpeechRecognitionErrorEvent;\n if (errorEvent.error === \"aborted\") {\n updateStatus({ type: \"ended\", reason: \"cancelled\" });\n } else {\n updateStatus({ type: \"ended\", reason: \"error\" });\n console.error(\"Dictation error:\", errorEvent.error, errorEvent.message);\n }\n });\n\n try {\n recognition.start();\n } catch (error) {\n updateStatus({ type: \"ended\", reason: \"error\" });\n throw error;\n }\n\n return session;\n }\n}\n"],"mappings":";;AAuDA,IAAa2B,4BAAb,MAAyE;CACvEf,MAAMC,MAAgD;EACpD,MAAMe,YAAY,IAAIC,yBAAyBhB,IAAI;EAEnD,MAAMiB,8BAAc,IAAIC,IAAgB;EACxC,MAAMC,aACJ3B,QACAC,UACG;GACH,IAAI2B,IAAIzB,OAAOJ,SAAS,SAAS;GAEjC6B,IAAIzB,SAAS;IAAEJ,MAAM;IAASC;IAAQC;GAAM;GAC5CL,qBAAqB6B,aAAaI,KAAAA,GAAW,kBAAkB;EACjE;EAEAN,UAAUO,iBAAiB,aAAaH,UA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|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ThreadMessage } from "../types/message.js";
|
|
2
2
|
import { ThreadSuggestion } from "../runtime/interfaces/thread-runtime-core.js";
|
|
3
3
|
//#region src/adapters/suggestion.d.ts
|
|
4
|
-
type SuggestionAdapterGenerateOptions = {
|
|
4
|
+
export type SuggestionAdapterGenerateOptions = {
|
|
5
5
|
messages: readonly ThreadMessage[];
|
|
6
6
|
signal?: AbortSignal;
|
|
7
7
|
};
|
|
8
|
-
type SuggestionAdapter = {
|
|
8
|
+
export type SuggestionAdapter = {
|
|
9
9
|
generate: (options: SuggestionAdapterGenerateOptions) => Promise<readonly ThreadSuggestion[]> | AsyncGenerator<readonly ThreadSuggestion[], void>;
|
|
10
10
|
};
|
|
11
|
-
declare const consumeSuggestionResult: (result: ReturnType<SuggestionAdapter["generate"]>, options: {
|
|
11
|
+
export declare const consumeSuggestionResult: (result: ReturnType<SuggestionAdapter["generate"]>, options: {
|
|
12
12
|
signal: AbortSignal;
|
|
13
13
|
onUpdate: (suggestions: readonly ThreadSuggestion[]) => void;
|
|
14
14
|
}) => Promise<void>;
|
|
15
|
-
type CreateSuggestionAdapterOptions = {
|
|
15
|
+
export type CreateSuggestionAdapterOptions = {
|
|
16
16
|
complete: (options: {
|
|
17
17
|
prompt: string;
|
|
18
18
|
signal?: AbortSignal;
|
|
@@ -21,7 +21,6 @@ type CreateSuggestionAdapterOptions = {
|
|
|
21
21
|
instructions?: string | undefined;
|
|
22
22
|
maxMessages?: number | undefined;
|
|
23
23
|
};
|
|
24
|
-
declare const createSuggestionAdapter: (options: CreateSuggestionAdapterOptions) => SuggestionAdapter;
|
|
24
|
+
export declare const createSuggestionAdapter: (options: CreateSuggestionAdapterOptions) => SuggestionAdapter;
|
|
25
25
|
//#endregion
|
|
26
|
-
export { CreateSuggestionAdapterOptions, SuggestionAdapter, SuggestionAdapterGenerateOptions, consumeSuggestionResult, createSuggestionAdapter };
|
|
27
26
|
//# sourceMappingURL=suggestion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestion.d.ts","names":[],"sources":["../../src/adapters/suggestion.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"suggestion.d.ts","names":[],"sources":["../../src/adapters/suggestion.ts"],"mappings":";;;YAIY;EACV,mBAAmB;EACnB,SAAS;;YAGC;EACV,WACE,SAAS,qCAEP,iBAAiB,sBACjB,wBAAwB;;qBAGjB,0BACX,QAAQ,WAAW,gCACnB;EACE,QAAQ;EACR,WAAW,sBAAsB;MAElC;YAcS;EACV,WAAW;IACT;IACA,SAAS;QACL;EACN;EACA;EACA;;qBAGW,0BACX,SAAS,mCACR"}
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
+
import { ThreadMessage } from "../types/message.js";
|
|
1
2
|
import { ChatModelRunOptions, ChatModelRunResult } from "../runtime/utils/chat-model-adapter.js";
|
|
2
3
|
import { ExportedMessageRepository, ExportedMessageRepositoryItem } from "../runtime/utils/message-repository.js";
|
|
4
|
+
import "../types/index.js";
|
|
3
5
|
import { ReadonlyJSONValue } from "assistant-stream/utils";
|
|
4
6
|
//#region src/adapters/thread-history.d.ts
|
|
5
|
-
interface MessageStorageEntry<TPayload> {
|
|
7
|
+
export interface MessageStorageEntry<TPayload> {
|
|
6
8
|
id: string;
|
|
7
9
|
parent_id: string | null;
|
|
8
10
|
format: string;
|
|
9
11
|
content: TPayload;
|
|
10
12
|
}
|
|
11
|
-
interface MessageFormatItem<TMessage> {
|
|
13
|
+
export interface MessageFormatItem<TMessage> {
|
|
12
14
|
parentId: string | null;
|
|
13
15
|
message: TMessage;
|
|
14
16
|
}
|
|
15
|
-
interface MessageFormatRepository<TMessage> {
|
|
17
|
+
export interface MessageFormatRepository<TMessage> {
|
|
16
18
|
headId?: string | null;
|
|
17
19
|
messages: MessageFormatItem<TMessage>[];
|
|
18
20
|
}
|
|
19
|
-
interface MessageFormatAdapter<TMessage, TStorageFormat extends Record<string, unknown>> {
|
|
21
|
+
export interface MessageFormatAdapter<TMessage, TStorageFormat extends Record<string, unknown>> {
|
|
20
22
|
format: string;
|
|
21
23
|
encode(item: MessageFormatItem<TMessage>): TStorageFormat;
|
|
22
24
|
decode(stored: MessageStorageEntry<TStorageFormat>): MessageFormatItem<TMessage>;
|
|
23
25
|
getId(message: TMessage): string;
|
|
24
26
|
}
|
|
25
|
-
type GenericThreadHistoryAdapter<TMessage> = {
|
|
27
|
+
export type GenericThreadHistoryAdapter<TMessage> = {
|
|
26
28
|
load(): Promise<MessageFormatRepository<TMessage>>;
|
|
27
29
|
/** Snapshot the current thread so later writes survive a switch. */
|
|
28
30
|
pin?(): void;
|
|
@@ -35,9 +37,11 @@ type GenericThreadHistoryAdapter<TMessage> = {
|
|
|
35
37
|
start_ms: number;
|
|
36
38
|
end_ms: number;
|
|
37
39
|
}[];
|
|
40
|
+
/** The thread message the items were persisted from; its status and timing complete a report the stored format cannot carry. */
|
|
41
|
+
message?: ThreadMessage;
|
|
38
42
|
}): void;
|
|
39
43
|
};
|
|
40
|
-
type ThreadHistoryAdapter = {
|
|
44
|
+
export type ThreadHistoryAdapter = {
|
|
41
45
|
load(): Promise<ExportedMessageRepository & {
|
|
42
46
|
state?: ReadonlyJSONValue;
|
|
43
47
|
unstable_resume?: boolean;
|
|
@@ -57,5 +61,4 @@ type ThreadHistoryAdapter = {
|
|
|
57
61
|
withFormat?<TMessage, TStorageFormat extends Record<string, unknown>>(formatAdapter: MessageFormatAdapter<TMessage, TStorageFormat>): GenericThreadHistoryAdapter<TMessage>;
|
|
58
62
|
};
|
|
59
63
|
//#endregion
|
|
60
|
-
export { GenericThreadHistoryAdapter, MessageFormatAdapter, MessageFormatItem, MessageFormatRepository, MessageStorageEntry, ThreadHistoryAdapter };
|
|
61
64
|
//# sourceMappingURL=thread-history.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-history.d.ts","names":[],"sources":["../../src/adapters/thread-history.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"thread-history.d.ts","names":[],"sources":["../../src/adapters/thread-history.ts"],"mappings":";;;;;;iBAWiB,oBAAoB;EACnC;EACA;EACA;EACA,SAAS;;iBAGM,kBAAkB;EACjC;EACA,SAAS;;iBAGM,wBAAwB;EACvC;EACA,UAAU,kBAAkB;;iBAGb,qBACf,UACA,uBAAuB;EAEvB;EACA,OAAO,MAAM,kBAAkB,YAAY;EAC3C,OACE,QAAQ,oBAAoB,kBAC3B,kBAAkB;EACrB,MAAM,SAAS;;YAGL,4BAA4B;EACtC,QAAQ,QAAQ,wBAAwB;;EAExC;EACA,OAAO,MAAM,kBAAkB,YAAY;EAC3C,QACE,MAAM,kBAAkB,WACxB,yBACC;EACH,QAAQ,OAAO,kBAAkB,cAAc;EAC/C,iBACE,OAAO,kBAAkB,aACzB;IACE;IACA;MAAmB;MAAkB;;;IAErC,UAAU;;;YAKJ;EACV,QAAQ,QACN;IACE,QAAQ;IACR;;EAGJ,QACE,SAAS,sBACR,eAAe;EAClB,OAAO,MAAM,gCAAgC;;;;;;;;EAQ7C,QAAQ,MAAM,gCAAgC;EAC9C,QAAQ,OAAO,kCAAkC;;EAEjD,YAAY,UAAU,uBAAuB,yBAC3C,eAAe,qBAAqB,UAAU,kBAC7C,4BAA4B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Unstable_TriggerCategory, Unstable_TriggerItem } from "../types/trigger.js";
|
|
2
2
|
//#region src/adapters/trigger.d.ts
|
|
3
3
|
/** Adapter providing synchronous categories and items to a trigger popover. */
|
|
4
|
-
type Unstable_TriggerAdapter = {
|
|
4
|
+
export type Unstable_TriggerAdapter = {
|
|
5
5
|
/** Return the top-level categories for the trigger popover. */
|
|
6
6
|
categories(): readonly Unstable_TriggerCategory[];
|
|
7
7
|
/** Return items within a category. */
|
|
@@ -10,5 +10,4 @@ type Unstable_TriggerAdapter = {
|
|
|
10
10
|
search?(query: string): readonly Unstable_TriggerItem[];
|
|
11
11
|
};
|
|
12
12
|
//#endregion
|
|
13
|
-
export { Unstable_TriggerAdapter };
|
|
14
13
|
//# sourceMappingURL=trigger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.d.ts","names":[],"sources":["../../src/adapters/trigger.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"trigger.d.ts","names":[],"sources":["../../src/adapters/trigger.ts"],"mappings":";;;YAMY;;EAEV,uBAAuB;;EAGvB,cAAc,8BAA8B;;EAG5C,QAAQ,yBAAyB"}
|
package/dist/adapters/voice.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Unsubscribe } from "../types/unsubscribe.js";
|
|
2
2
|
//#region src/adapters/voice.d.ts
|
|
3
|
-
declare namespace RealtimeVoiceAdapter {
|
|
3
|
+
export declare namespace RealtimeVoiceAdapter {
|
|
4
4
|
type Status = {
|
|
5
5
|
type: "starting" | "running";
|
|
6
6
|
} | {
|
|
@@ -26,17 +26,17 @@ declare namespace RealtimeVoiceAdapter {
|
|
|
26
26
|
onVolumeChange: (callback: (volume: number) => void) => Unsubscribe;
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
type RealtimeVoiceAdapter = {
|
|
29
|
+
export type RealtimeVoiceAdapter = {
|
|
30
30
|
connect: (options: {
|
|
31
31
|
abortSignal?: AbortSignal;
|
|
32
32
|
}) => RealtimeVoiceAdapter.Session;
|
|
33
33
|
};
|
|
34
|
-
type VoiceSessionControls = {
|
|
34
|
+
export type VoiceSessionControls = {
|
|
35
35
|
disconnect: () => void;
|
|
36
36
|
mute: () => void;
|
|
37
37
|
unmute: () => void;
|
|
38
38
|
};
|
|
39
|
-
type VoiceSessionHelpers = {
|
|
39
|
+
export type VoiceSessionHelpers = {
|
|
40
40
|
setStatus: (status: RealtimeVoiceAdapter.Status) => void;
|
|
41
41
|
end: (reason: "finished" | "cancelled" | "error", error?: unknown) => void;
|
|
42
42
|
emitTranscript: (item: RealtimeVoiceAdapter.TranscriptItem) => void;
|
|
@@ -44,9 +44,8 @@ type VoiceSessionHelpers = {
|
|
|
44
44
|
emitVolume: (volume: number) => void;
|
|
45
45
|
isDisposed: () => boolean;
|
|
46
46
|
};
|
|
47
|
-
declare function createVoiceSession(options: {
|
|
47
|
+
export declare function createVoiceSession(options: {
|
|
48
48
|
abortSignal?: AbortSignal;
|
|
49
49
|
}, setup: (helpers: VoiceSessionHelpers) => Promise<VoiceSessionControls>): RealtimeVoiceAdapter.Session;
|
|
50
50
|
//#endregion
|
|
51
|
-
export { RealtimeVoiceAdapter, VoiceSessionControls, VoiceSessionHelpers, createVoiceSession };
|
|
52
51
|
//# sourceMappingURL=voice.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voice.d.ts","names":[],"sources":["../../src/adapters/voice.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"voice.d.ts","names":[],"sources":["../../src/adapters/voice.ts"],"mappings":";;yBAGiB;OACH;IAEN;;IAGA;IACA;IACA;;OAGM;OAEA;IACV;IACA;IACA;;OAGU;IACV,QAAQ;IACR;IAEA;IACA;IACA;IAEA,iBAAiB,WAAW,QAAQ,oBAAoB;IACxD,eACE,WAAW,YAAY,4BACpB;IACL,eAAe,WAAW,MAAM,kBAAkB;IAClD,iBAAiB,WAAW,4BAA4B;;;YAIhD;EACV,UAAU;IACR,cAAc;QACV,qBAAqB;;YAGjB;EACV;EACA;EACA;;YAGU;EACV,YAAY,QAAQ,qBAAqB;EACzC,MAAM,4CAA4C;EAClD,iBAAiB,MAAM,qBAAqB;EAC5C,WAAW,MAAM,qBAAqB;EACtC,aAAa;EACb;;wBAGc,mBACd;EAAW,cAAc;GACzB,QAAQ,SAAS,wBAAwB,QAAQ,wBAChD,qBAAqB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference path="./store/scope-registration.d.ts" />
|
|
2
|
-
import { AppendMessage, DataMessagePart, FileMessagePart, GenerativeUIMessagePart, GenerativeUINode, GenerativeUISpec, ImageMessagePart, MCP_APP_URI_SCHEME, McpAppMetadata, MessagePartStatus, MessagePartStreamStatus, MessageRole, MessageStatus, MessageTiming, PartProviderMetadata, ReasoningMessagePart, RunConfig, SourceMessagePart, SourceProviderMetadata, TextMessagePart, ThreadAssistantMessage, ThreadAssistantMessagePart, ThreadMessage, ThreadStep, ThreadSystemMessage, ThreadUserMessage, ThreadUserMessagePart, ToolApprovalDisplay, ToolApprovalOption, ToolApprovalOptionKind, ToolApprovalResponse, ToolCallMessagePart, ToolCallMessagePartMcpMetadata, ToolCallMessagePartStatus, ToolCallTiming, ToolModelContentPart, Unstable_AudioMessagePart, isMcpAppUri, toolApprovalAcceptsText } from "./types/message.js";
|
|
2
|
+
import { AppendMessage, DataMessagePart, FileMessagePart, GenerativeUIMessagePart, GenerativeUINode, GenerativeUISpec, ImageMessagePart, MCP_APP_URI_SCHEME, McpAppMetadata, MessageModality, MessagePartStatus, MessagePartStreamStatus, MessageRole, MessageStatus, MessageTiming, PartProviderMetadata, ReasoningMessagePart, RunConfig, SourceMessagePart, SourceProviderMetadata, TextMessagePart, ThreadAssistantMessage, ThreadAssistantMessagePart, ThreadMessage, ThreadStep, ThreadSystemMessage, ThreadUserMessage, ThreadUserMessagePart, ToolApprovalDisplay, ToolApprovalOption, ToolApprovalOptionKind, ToolApprovalResponse, ToolCallMessagePart, ToolCallMessagePartMcpMetadata, ToolCallMessagePartStatus, ToolCallTiming, ToolModelContentPart, Unstable_AudioMessagePart, isMcpAppUri, toolApprovalAcceptsText } from "./types/message.js";
|
|
3
3
|
import { Attachment, AttachmentStatus, CompleteAttachment, CompleteAttachmentStatus, CreateAttachment, PendingAttachment, PendingAttachmentStatus } from "./types/attachment.js";
|
|
4
4
|
import { AttachmentAdapter, CompositeAttachmentAdapter, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter } from "./adapters/attachment.js";
|
|
5
5
|
import { Unstable_TriggerCategory, Unstable_TriggerItem } from "./types/trigger.js";
|
|
@@ -53,4 +53,4 @@ import { ExternalStoreSharedOptions, pickExternalStoreSharedOptions } from "./ru
|
|
|
53
53
|
import { MessageQueueController, MessageQueueDriver, createMessageQueue } from "./runtime/queue/message-queue.js";
|
|
54
54
|
import { InMemoryThreadListAdapter } from "./runtimes/remote-thread-list/adapter/in-memory.js";
|
|
55
55
|
import { createRequestHeaders } from "./runtimes/assistant-transport/utils.js";
|
|
56
|
-
export { type AddToolResultOptions, type AppendMessage, type Assistant, type AssistantContextConfig, type AssistantError, type AssistantErrorCode, AssistantFrameHost, AssistantFrameProvider, type AssistantInstructionsConfig, type AssistantRuntime, type AssistantRuntimeCore, type AssistantToolProps, type Attachment, type AttachmentAdapter, type AttachmentAddErrorEvent, type AttachmentAddErrorReason, type AttachmentRuntime, type AttachmentRuntimePath, type AttachmentState, type AttachmentStatus, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, type CompleteAttachment, type CompleteAttachmentStatus, type ComposerRuntime, type ComposerRuntimeCore, type ComposerRuntimeEventCallback, type ComposerRuntimeEventPayload, type ComposerRuntimeEventType, type ComposerRuntimePath, type ComposerState, CompositeAttachmentAdapter, type CoreChatModelRunResult, type CreateAppendMessage, type CreateAttachment, type CreateResumeRunConfig, type CreateStartRunConfig, type CreateSuggestionAdapterOptions, type DataMessagePart, type DictationAdapter, type DictationState, type EditComposerRuntime, type EditComposerRuntimeCore, type EditComposerState, type ErrorDisplay, type ErrorSeverity, ExportedMessageRepository, type ExportedMessageRepositoryItem, type ExternalStoreAdapter, type ExternalStoreBranchChange, type ExternalStoreMessageConverter, type ExternalStoreSharedOptions, type ExternalStoreThreadData, type ExternalStoreThreadListAdapter, type ExternalThreadBranchAdapter, type ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, type FeedbackAdapter, type FileMessagePart, type FrameMessage, type FrameMessageType, type GenerativeUIMessagePart, type GenerativeUINode, type GenerativeUISpec, type GenericThreadHistoryAdapter, type ImageMessagePart, InMemoryThreadListAdapter, type LanguageModelConfig, type LanguageModelV1CallSettings, type LocalRuntimeOptionsBase, MCP_APP_URI_SCHEME, type McpAppMetadata, type MessageFormatAdapter, type MessageFormatItem, type MessageFormatRepository, MessageNotSentError, type MessagePartRuntime, type MessagePartRuntimePath, type MessagePartState, type MessagePartStatus, type MessagePartStreamStatus, type MessageQueueController, type MessageQueueDriver, type MessageRole, type MessageRuntime, type MessageRuntimePath, type MessageState, type MessageStatus, type MessageStorageEntry, type MessageTiming, type ModelContext, type ModelContextProvider, ModelContextRegistry, type ModelContextRegistryInstructionHandle, type ModelContextRegistryProviderHandle, type ModelContextRegistryToolHandle, type PartProviderMetadata, type PendingAttachment, type PendingAttachmentStatus, type QueuePlacement, type QuoteInfo, type RealtimeVoiceAdapter, type ReasoningMessagePart, type RemoteThreadInitializeResponse, type RemoteThreadListAdapter, type RemoteThreadListOptions, type RemoteThreadListPageOptions, type RemoteThreadListProviderComponent, type RemoteThreadListResponse, type RemoteThreadMetadata, type RespondToToolApprovalOptions, type ResumeRunConfig, type ResumeToolCallOptions, type RunConfig, type RuntimeAdapters, type RuntimeCapabilities, type SendOptions, type SerializedModelContext, type SerializedTool, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, type SourceMessagePart, type SourceProviderMetadata, type SpeechState, type SpeechSynthesisAdapter, type StartRunConfig, type StreamingTimingAccessors, type StreamingTimingOptions, type StreamingTimingState, type SubmitFeedbackOptions, type SubmittedFeedback, type SuggestionAdapter, type SuggestionAdapterGenerateOptions, type TextMessagePart, type ThreadAssistantMessage, type ThreadAssistantMessagePart, type ThreadComposerRuntime, type ThreadComposerRuntimeCore, type ThreadComposerState, type ThreadHistoryAdapter, type ThreadListItemCoreState, type ThreadListItemEventCallback, type ThreadListItemEventPayload, type ThreadListItemEventType, type ThreadListItemGenerateTitleOptions, type ThreadListItemRuntime, type ThreadListItemRuntimePath, type ThreadListItemState, type ThreadListItemStatus, type ThreadListRuntime, type ThreadListRuntimeCore, type ThreadListState, type ThreadMessage, type ThreadMessageLike, type ThreadRuntime, type ThreadRuntimeCore, type ThreadRuntimeEventCallback, type ThreadRuntimeEventPayload, type ThreadRuntimeEventType, type ThreadRuntimePath, type ThreadState, type ThreadStep, type ThreadSuggestion, type ThreadSystemMessage, type ThreadUserMessage, type ThreadUserMessagePart, type ToolApprovalDisplay, type ToolApprovalOption, type ToolApprovalOptionKind, type ToolApprovalResponse, type ToolCallMessagePart, type ToolCallMessagePartMcpMetadata, type ToolCallMessagePartStatus, type ToolCallTiming, type ToolExecutionStatus, type ToolModelContentPart, type Unstable_AudioMessagePart, type Unstable_DirectiveFormatter, type Unstable_DirectiveSegment, type Unstable_InteractableSnapshotEntry, type Unstable_InteractableVersion, type Unstable_TriggerAdapter, type Unstable_TriggerCategory, type Unstable_TriggerItem, type Unsubscribe, type UserCommands, type UserExternalState, type VoiceSessionControls, type VoiceSessionHelpers, type VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createRequestHeaders, createSuggestionAdapter, createVoiceSession, fromThreadMessageLike, generateId, getExternalStoreMessages, isAssistantError, isMcpAppUri, isMessageNotSentError, mergeModelContexts, pickExternalStoreSharedOptions, stepStreamingTiming, toAssistantError, tool, toolApprovalAcceptsText, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions };
|
|
56
|
+
export { type AddToolResultOptions, type AppendMessage, type Assistant, type AssistantContextConfig, type AssistantError, type AssistantErrorCode, AssistantFrameHost, AssistantFrameProvider, type AssistantInstructionsConfig, type AssistantRuntime, type AssistantRuntimeCore, type AssistantToolProps, type Attachment, type AttachmentAdapter, type AttachmentAddErrorEvent, type AttachmentAddErrorReason, type AttachmentRuntime, type AttachmentRuntimePath, type AttachmentState, type AttachmentStatus, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, type CompleteAttachment, type CompleteAttachmentStatus, type ComposerRuntime, type ComposerRuntimeCore, type ComposerRuntimeEventCallback, type ComposerRuntimeEventPayload, type ComposerRuntimeEventType, type ComposerRuntimePath, type ComposerState, CompositeAttachmentAdapter, type CoreChatModelRunResult, type CreateAppendMessage, type CreateAttachment, type CreateResumeRunConfig, type CreateStartRunConfig, type CreateSuggestionAdapterOptions, type DataMessagePart, type DictationAdapter, type DictationState, type EditComposerRuntime, type EditComposerRuntimeCore, type EditComposerState, type ErrorDisplay, type ErrorSeverity, ExportedMessageRepository, type ExportedMessageRepositoryItem, type ExternalStoreAdapter, type ExternalStoreBranchChange, type ExternalStoreMessageConverter, type ExternalStoreSharedOptions, type ExternalStoreThreadData, type ExternalStoreThreadListAdapter, type ExternalThreadBranchAdapter, type ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, type FeedbackAdapter, type FileMessagePart, type FrameMessage, type FrameMessageType, type GenerativeUIMessagePart, type GenerativeUINode, type GenerativeUISpec, type GenericThreadHistoryAdapter, type ImageMessagePart, InMemoryThreadListAdapter, type LanguageModelConfig, type LanguageModelV1CallSettings, type LocalRuntimeOptionsBase, MCP_APP_URI_SCHEME, type McpAppMetadata, type MessageFormatAdapter, type MessageFormatItem, type MessageFormatRepository, type MessageModality, MessageNotSentError, type MessagePartRuntime, type MessagePartRuntimePath, type MessagePartState, type MessagePartStatus, type MessagePartStreamStatus, type MessageQueueController, type MessageQueueDriver, type MessageRole, type MessageRuntime, type MessageRuntimePath, type MessageState, type MessageStatus, type MessageStorageEntry, type MessageTiming, type ModelContext, type ModelContextProvider, ModelContextRegistry, type ModelContextRegistryInstructionHandle, type ModelContextRegistryProviderHandle, type ModelContextRegistryToolHandle, type PartProviderMetadata, type PendingAttachment, type PendingAttachmentStatus, type QueuePlacement, type QuoteInfo, type RealtimeVoiceAdapter, type ReasoningMessagePart, type RemoteThreadInitializeResponse, type RemoteThreadListAdapter, type RemoteThreadListOptions, type RemoteThreadListPageOptions, type RemoteThreadListProviderComponent, type RemoteThreadListResponse, type RemoteThreadMetadata, type RespondToToolApprovalOptions, type ResumeRunConfig, type ResumeToolCallOptions, type RunConfig, type RuntimeAdapters, type RuntimeCapabilities, type SendOptions, type SerializedModelContext, type SerializedTool, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, type SourceMessagePart, type SourceProviderMetadata, type SpeechState, type SpeechSynthesisAdapter, type StartRunConfig, type StreamingTimingAccessors, type StreamingTimingOptions, type StreamingTimingState, type SubmitFeedbackOptions, type SubmittedFeedback, type SuggestionAdapter, type SuggestionAdapterGenerateOptions, type TextMessagePart, type ThreadAssistantMessage, type ThreadAssistantMessagePart, type ThreadComposerRuntime, type ThreadComposerRuntimeCore, type ThreadComposerState, type ThreadHistoryAdapter, type ThreadListItemCoreState, type ThreadListItemEventCallback, type ThreadListItemEventPayload, type ThreadListItemEventType, type ThreadListItemGenerateTitleOptions, type ThreadListItemRuntime, type ThreadListItemRuntimePath, type ThreadListItemState, type ThreadListItemStatus, type ThreadListRuntime, type ThreadListRuntimeCore, type ThreadListState, type ThreadMessage, type ThreadMessageLike, type ThreadRuntime, type ThreadRuntimeCore, type ThreadRuntimeEventCallback, type ThreadRuntimeEventPayload, type ThreadRuntimeEventType, type ThreadRuntimePath, type ThreadState, type ThreadStep, type ThreadSuggestion, type ThreadSystemMessage, type ThreadUserMessage, type ThreadUserMessagePart, type ToolApprovalDisplay, type ToolApprovalOption, type ToolApprovalOptionKind, type ToolApprovalResponse, type ToolCallMessagePart, type ToolCallMessagePartMcpMetadata, type ToolCallMessagePartStatus, type ToolCallTiming, type ToolExecutionStatus, type ToolModelContentPart, type Unstable_AudioMessagePart, type Unstable_DirectiveFormatter, type Unstable_DirectiveSegment, type Unstable_InteractableSnapshotEntry, type Unstable_InteractableVersion, type Unstable_TriggerAdapter, type Unstable_TriggerCategory, type Unstable_TriggerItem, type Unsubscribe, type UserCommands, type UserExternalState, type VoiceSessionControls, type VoiceSessionHelpers, type VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createRequestHeaders, createSuggestionAdapter, createVoiceSession, fromThreadMessageLike, generateId, getExternalStoreMessages, isAssistantError, isMcpAppUri, isMessageNotSentError, mergeModelContexts, pickExternalStoreSharedOptions, stepStreamingTiming, toAssistantError, tool, toolApprovalAcceptsText, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions };
|