@assistant-ui/core 0.3.20 → 0.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/attachment.d.ts +42 -34
- package/dist/adapters/attachment.d.ts.map +1 -1
- package/dist/adapters/attachment.js +51 -21
- package/dist/adapters/attachment.js.map +1 -1
- package/dist/adapters/directive-formatter.d.ts +1 -3
- package/dist/adapters/directive-formatter.d.ts.map +1 -1
- package/dist/adapters/feedback.d.ts +6 -7
- package/dist/adapters/feedback.d.ts.map +1 -1
- package/dist/adapters/index.d.ts +14 -9
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +1 -1
- package/dist/adapters/speech.d.ts +57 -58
- package/dist/adapters/speech.d.ts.map +1 -1
- package/dist/adapters/speech.js +16 -2
- package/dist/adapters/speech.js.map +1 -1
- package/dist/adapters/suggestion.d.ts +14 -16
- package/dist/adapters/suggestion.d.ts.map +1 -1
- package/dist/adapters/thread-history.d.ts +54 -51
- package/dist/adapters/thread-history.d.ts.map +1 -1
- package/dist/adapters/trigger.d.ts +7 -9
- package/dist/adapters/trigger.d.ts.map +1 -1
- package/dist/adapters/voice.d.ts +46 -40
- package/dist/adapters/voice.d.ts.map +1 -1
- package/dist/adapters/voice.js +17 -3
- package/dist/adapters/voice.js.map +1 -1
- package/dist/index.d.ts +70 -56
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/internal/duplicate-detection.d.ts +0 -2
- package/dist/internal/duplicate-detection.d.ts.map +1 -1
- package/dist/internal.d.ts +27 -58
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +8 -6
- package/dist/model-context/frame/host.d.ts +19 -21
- package/dist/model-context/frame/host.d.ts.map +1 -1
- package/dist/model-context/frame/host.js +3 -1
- package/dist/model-context/frame/host.js.map +1 -1
- package/dist/model-context/frame/provider.d.ts +27 -28
- package/dist/model-context/frame/provider.d.ts.map +1 -1
- package/dist/model-context/frame/provider.js +6 -0
- package/dist/model-context/frame/provider.js.map +1 -1
- package/dist/model-context/frame/types.d.ts +19 -21
- package/dist/model-context/frame/types.d.ts.map +1 -1
- package/dist/model-context/frame/validate.d.ts +3 -0
- package/dist/model-context/frame/validate.d.ts.map +1 -0
- package/dist/model-context/frame/validate.js +26 -0
- package/dist/model-context/frame/validate.js.map +1 -0
- package/dist/model-context/interactable-composer-metadata.d.ts +42 -29
- package/dist/model-context/interactable-composer-metadata.d.ts.map +1 -1
- package/dist/model-context/interactable-composer-metadata.js +30 -6
- package/dist/model-context/interactable-composer-metadata.js.map +1 -1
- package/dist/model-context/registry-handles.d.ts +6 -8
- package/dist/model-context/registry-handles.d.ts.map +1 -1
- package/dist/model-context/registry.d.ts +14 -16
- package/dist/model-context/registry.d.ts.map +1 -1
- package/dist/model-context/tool-call-text.d.ts +13 -14
- package/dist/model-context/tool-call-text.d.ts.map +1 -1
- package/dist/model-context/tool.d.ts +10 -11
- package/dist/model-context/tool.d.ts.map +1 -1
- package/dist/model-context/types.d.ts +32 -34
- package/dist/model-context/types.d.ts.map +1 -1
- package/dist/react/AssistantProvider.d.ts +6 -8
- package/dist/react/AssistantProvider.d.ts.map +1 -1
- package/dist/react/AssistantRuntimeProvider.d.ts +23 -25
- package/dist/react/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/react/RuntimeAdapter.d.ts +2 -5
- package/dist/react/RuntimeAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts +24 -18
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js +58 -25
- package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
- package/dist/react/adapters/TitleGenerationAdapter.d.ts +2 -4
- package/dist/react/adapters/TitleGenerationAdapter.d.ts.map +1 -1
- package/dist/react/client/AdaptedRemoteThread.d.ts +5 -7
- package/dist/react/client/AdaptedRemoteThread.d.ts.map +1 -1
- package/dist/react/client/DataRenderers.d.ts +1 -3
- package/dist/react/client/DataRenderers.d.ts.map +1 -1
- package/dist/react/client/InMemoryThreadList.d.ts +6 -8
- package/dist/react/client/InMemoryThreadList.d.ts.map +1 -1
- package/dist/react/client/Interactables.d.ts +2 -4
- package/dist/react/client/Interactables.d.ts.map +1 -1
- package/dist/react/client/Interactables.js +306 -101
- package/dist/react/client/Interactables.js.map +1 -1
- package/dist/react/client/RemoteThreadList.d.ts +32 -34
- package/dist/react/client/RemoteThreadList.d.ts.map +1 -1
- package/dist/react/client/RemoteThreadList.js +2 -1
- package/dist/react/client/RemoteThreadList.js.map +1 -1
- package/dist/react/client/Tools.d.ts +9 -11
- package/dist/react/client/Tools.d.ts.map +1 -1
- package/dist/react/client/Tools.js +4 -8
- package/dist/react/client/Tools.js.map +1 -1
- package/dist/react/client/interactable-model-context.d.ts +9 -10
- package/dist/react/client/interactable-model-context.d.ts.map +1 -1
- package/dist/react/client/interactable-model-context.js +32 -22
- package/dist/react/client/interactable-model-context.js.map +1 -1
- package/dist/react/index.d.ts +160 -122
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +5 -5
- package/dist/react/interactables-legacy/Interactables.d.ts +1 -3
- package/dist/react/interactables-legacy/Interactables.d.ts.map +1 -1
- package/dist/react/interactables-legacy/Interactables.js +15 -8
- package/dist/react/interactables-legacy/Interactables.js.map +1 -1
- package/dist/react/interactables-legacy/interactable-model-context.d.ts +6 -8
- package/dist/react/interactables-legacy/interactable-model-context.d.ts.map +1 -1
- package/dist/react/interactables-legacy/interactable-model-context.js +13 -14
- package/dist/react/interactables-legacy/interactable-model-context.js.map +1 -1
- package/dist/react/interactables-legacy/scopes.d.ts +33 -36
- package/dist/react/interactables-legacy/scopes.d.ts.map +1 -1
- package/dist/react/interactables-legacy/useAssistantInteractable.d.ts +6 -8
- package/dist/react/interactables-legacy/useAssistantInteractable.d.ts.map +1 -1
- package/dist/react/interactables-legacy/useInteractableState.d.ts +6 -7
- package/dist/react/interactables-legacy/useInteractableState.d.ts.map +1 -1
- package/dist/react/interactables-shared/useInteractablePersistenceQueue.d.ts +23 -13
- package/dist/react/interactables-shared/useInteractablePersistenceQueue.d.ts.map +1 -1
- package/dist/react/interactables-shared/useInteractablePersistenceQueue.js +54 -25
- package/dist/react/interactables-shared/useInteractablePersistenceQueue.js.map +1 -1
- package/dist/react/model-context/define-mcp-toolkit.d.ts +11 -13
- package/dist/react/model-context/define-mcp-toolkit.d.ts.map +1 -1
- package/dist/react/model-context/define-toolkit.d.ts +12 -4
- package/dist/react/model-context/define-toolkit.d.ts.map +1 -1
- package/dist/react/model-context/external-tool.d.ts +0 -2
- package/dist/react/model-context/external-tool.d.ts.map +1 -1
- package/dist/react/model-context/human-tool.d.ts +0 -2
- package/dist/react/model-context/human-tool.d.ts.map +1 -1
- package/dist/react/model-context/interactableTool.d.ts +23 -25
- package/dist/react/model-context/interactableTool.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantDataUI.d.ts +4 -6
- package/dist/react/model-context/makeAssistantDataUI.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantTool.d.ts +4 -6
- package/dist/react/model-context/makeAssistantTool.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantToolUI.d.ts +4 -6
- package/dist/react/model-context/makeAssistantToolUI.d.ts.map +1 -1
- package/dist/react/model-context/provider-tool.d.ts +3 -4
- package/dist/react/model-context/provider-tool.d.ts.map +1 -1
- package/dist/react/model-context/stub-tool.d.ts +0 -2
- package/dist/react/model-context/stub-tool.d.ts.map +1 -1
- package/dist/react/model-context/toolbox.d.ts +37 -24
- package/dist/react/model-context/toolbox.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantContext.d.ts +2 -5
- package/dist/react/model-context/useAssistantContext.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantDataUI.d.ts +5 -7
- package/dist/react/model-context/useAssistantDataUI.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantInstructions.d.ts +2 -5
- package/dist/react/model-context/useAssistantInstructions.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantTool.d.ts +8 -11
- package/dist/react/model-context/useAssistantTool.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantToolUI.d.ts +11 -13
- package/dist/react/model-context/useAssistantToolUI.d.ts.map +1 -1
- package/dist/react/model-context/useAuiToolOverrides.d.ts +2 -3
- package/dist/react/model-context/useAuiToolOverrides.d.ts.map +1 -1
- package/dist/react/model-context/useInlineRender.d.ts +2 -4
- package/dist/react/model-context/useInlineRender.d.ts.map +1 -1
- package/dist/react/model-context/useInteractable.d.ts +37 -36
- package/dist/react/model-context/useInteractable.d.ts.map +1 -1
- package/dist/react/model-context/useInteractableState.d.ts +10 -8
- package/dist/react/model-context/useInteractableState.d.ts.map +1 -1
- package/dist/react/model-context/useInteractableVersions.d.ts +3 -5
- package/dist/react/model-context/useInteractableVersions.d.ts.map +1 -1
- package/dist/react/model-context/useToolArgsStatus.d.ts +5 -6
- package/dist/react/model-context/useToolArgsStatus.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.d.ts +6 -8
- package/dist/react/primitive-hooks/useActionBarCopy.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.d.ts +2 -4
- package/dist/react/primitive-hooks/useActionBarEdit.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.d.ts +4 -6
- package/dist/react/primitive-hooks/useActionBarFeedback.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.d.ts +2 -4
- package/dist/react/primitive-hooks/useActionBarReload.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.d.ts +2 -4
- package/dist/react/primitive-hooks/useActionBarSpeak.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts +2 -4
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.d.ts +2 -4
- package/dist/react/primitive-hooks/useBranchPickerNext.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts +2 -4
- package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts +3 -5
- package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.d.ts +2 -4
- package/dist/react/primitive-hooks/useComposerCancel.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.d.ts +2 -4
- package/dist/react/primitive-hooks/useComposerDictate.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.d.ts +3 -5
- package/dist/react/primitive-hooks/useComposerSend.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.d.ts +1 -3
- package/dist/react/primitive-hooks/useEditComposerCancel.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.d.ts +2 -4
- package/dist/react/primitive-hooks/useEditComposerSend.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.d.ts +4 -6
- package/dist/react/primitive-hooks/useMessageBranching.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageError.d.ts +0 -2
- package/dist/react/primitive-hooks/useMessageError.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageReload.d.ts +2 -4
- package/dist/react/primitive-hooks/useMessageReload.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts +6 -8
- package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.js +4 -4
- package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts +0 -2
- package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsRunning.d.ts +0 -2
- package/dist/react/primitive-hooks/useThreadIsRunning.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts +1 -3
- package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts +1 -3
- package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts +1 -3
- package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts +1 -3
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.d.ts +2 -4
- package/dist/react/primitive-hooks/useThreadListLoadMore.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.d.ts +1 -3
- package/dist/react/primitive-hooks/useThreadListNew.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadMessageIds.d.ts +0 -2
- package/dist/react/primitive-hooks/useThreadMessageIds.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadMessages.d.ts +1 -3
- package/dist/react/primitive-hooks/useThreadMessages.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useVoice.d.ts +5 -7
- package/dist/react/primitive-hooks/useVoice.d.ts.map +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts +25 -26
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.d.ts +22 -23
- package/dist/react/primitives/composer/ComposerAttachments.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerIf.d.ts +10 -9
- package/dist/react/primitives/composer/ComposerIf.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerQueue.d.ts +11 -14
- package/dist/react/primitives/composer/ComposerQueue.d.ts.map +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.d.ts +26 -28
- package/dist/react/primitives/generativeUI/GenerativeUI.d.ts.map +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.js +16 -6
- package/dist/react/primitives/generativeUI/GenerativeUI.js.map +1 -1
- package/dist/react/primitives/message/MessageAttachments.d.ts +26 -23
- package/dist/react/primitives/message/MessageAttachments.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageAttachments.js +14 -15
- package/dist/react/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.d.ts +120 -117
- package/dist/react/primitives/message/MessageGroupedParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.js +3 -3
- package/dist/react/primitives/message/MessageGroupedParts.js.map +1 -1
- package/dist/react/primitives/message/MessageParts.d.ts +199 -185
- package/dist/react/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageParts.js +124 -82
- package/dist/react/primitives/message/MessageParts.js.map +1 -1
- package/dist/react/primitives/message/MessageQuote.d.ts +6 -8
- package/dist/react/primitives/message/MessageQuote.d.ts.map +1 -1
- package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts +2 -4
- package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts.map +1 -1
- package/dist/react/primitives/part/PartMessages.d.ts +13 -15
- package/dist/react/primitives/part/PartMessages.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadMessages.d.ts +54 -56
- package/dist/react/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.d.ts +20 -21
- package/dist/react/primitives/thread/ThreadSuggestions.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.js +24 -5
- package/dist/react/primitives/thread/ThreadSuggestions.js.map +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.d.ts +22 -23
- package/dist/react/primitives/threadList/ThreadListItems.d.ts.map +1 -1
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts +4 -6
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -1
- package/dist/react/providers/AttachmentByIndexProvider.d.ts +3 -5
- package/dist/react/providers/AttachmentByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts +3 -5
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts +2 -4
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/MessageByIdProvider.d.ts +2 -4
- package/dist/react/providers/MessageByIdProvider.d.ts.map +1 -1
- package/dist/react/providers/MessageByIndexProvider.d.ts +2 -4
- package/dist/react/providers/MessageByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/PartByIndexProvider.d.ts +2 -4
- package/dist/react/providers/PartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/QueueItemByIndexProvider.d.ts +2 -4
- package/dist/react/providers/QueueItemByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.d.ts +5 -7
- package/dist/react/providers/ReadonlyThreadProvider.d.ts.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.js.map +1 -1
- package/dist/react/providers/SuggestionByIndexProvider.d.ts +2 -4
- package/dist/react/providers/SuggestionByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.d.ts +3 -5
- package/dist/react/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.js +5 -1
- package/dist/react/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.d.ts +3 -5
- package/dist/react/providers/ThreadListItemByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts +3 -6
- package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +209 -219
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +53 -39
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +185 -196
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +13 -4
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadResource.d.ts +14 -19
- package/dist/react/runtimes/RemoteThreadResource.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadResource.js +3 -1
- package/dist/react/runtimes/RemoteThreadResource.js.map +1 -1
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts +8 -9
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/commandQueue.d.ts +9 -11
- package/dist/react/runtimes/assistant-transport/commandQueue.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.d.ts +4 -5
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.js +9 -2
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.js.map +1 -1
- package/dist/react/runtimes/assistant-transport/runManager.d.ts +7 -9
- package/dist/react/runtimes/assistant-transport/runManager.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/runManager.js +4 -1
- package/dist/react/runtimes/assistant-transport/runManager.js.map +1 -1
- package/dist/react/runtimes/assistant-transport/types.d.ts +106 -100
- package/dist/react/runtimes/assistant-transport/types.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.d.ts +3 -5
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.js +17 -6
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
- package/dist/react/runtimes/assistant-transport/useConvertedState.d.ts +2 -4
- package/dist/react/runtimes/assistant-transport/useConvertedState.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/useLatestRef.d.ts +1 -3
- package/dist/react/runtimes/assistant-transport/useLatestRef.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts +5 -7
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +410 -213
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts +14 -16
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js +8 -4
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.d.ts +136 -123
- package/dist/react/runtimes/cloud/auiV0.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.js +60 -9
- package/dist/react/runtimes/cloud/auiV0.js.map +1 -1
- package/dist/react/runtimes/cloud/createCloudThreadListAdapter.d.ts +9 -10
- package/dist/react/runtimes/cloud/createCloudThreadListAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/createCloudThreadListAdapterCreateFallback.d.ts +4 -5
- package/dist/react/runtimes/cloud/createCloudThreadListAdapterCreateFallback.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/sdkIdentity.d.ts +1 -3
- package/dist/react/runtimes/cloud/sdkIdentity.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/sdkIdentity.js +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts +2 -4
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListRuntime.d.ts +8 -9
- package/dist/react/runtimes/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/createMessageConverter.d.ts +14 -17
- package/dist/react/runtimes/createMessageConverter.d.ts.map +1 -1
- package/dist/react/runtimes/createMessageConverter.js.map +1 -1
- package/dist/react/runtimes/createRuntimeExtras.d.ts +11 -13
- package/dist/react/runtimes/createRuntimeExtras.d.ts.map +1 -1
- package/dist/react/runtimes/external-message-converter.d.ts +14 -18
- package/dist/react/runtimes/external-message-converter.d.ts.map +1 -1
- package/dist/react/runtimes/external-store-history-copy.d.ts +25 -0
- package/dist/react/runtimes/external-store-history-copy.d.ts.map +1 -0
- package/dist/react/runtimes/external-store-history-copy.js +148 -0
- package/dist/react/runtimes/external-store-history-copy.js.map +1 -0
- package/dist/react/runtimes/useExternalStoreRuntime.d.ts +2 -4
- package/dist/react/runtimes/useExternalStoreRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useExternalStoreRuntime.js +72 -35
- package/dist/react/runtimes/useExternalStoreRuntime.js.map +1 -1
- package/dist/react/runtimes/useExternalStoreSharedOptions.d.ts +1 -3
- package/dist/react/runtimes/useExternalStoreSharedOptions.d.ts.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.d.ts +26 -37
- package/dist/react/runtimes/useLocalRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.js +142 -34
- package/dist/react/runtimes/useLocalRuntime.js.map +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts +2 -4
- package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useRuntimeAdapters.d.ts +1 -3
- package/dist/react/runtimes/useRuntimeAdapters.d.ts.map +1 -1
- package/dist/react/runtimes/useStreamingTiming.d.ts +3 -5
- package/dist/react/runtimes/useStreamingTiming.d.ts.map +1 -1
- package/dist/react/types/MessagePartComponentTypes.d.ts +46 -43
- package/dist/react/types/MessagePartComponentTypes.d.ts.map +1 -1
- package/dist/react/types/scopes/dataRenderers.d.ts +8 -11
- package/dist/react/types/scopes/dataRenderers.d.ts.map +1 -1
- package/dist/react/types/scopes/interactables.d.ts +50 -49
- package/dist/react/types/scopes/interactables.d.ts.map +1 -1
- package/dist/react/types/scopes/tools.d.ts +17 -19
- package/dist/react/types/scopes/tools.d.ts.map +1 -1
- package/dist/react/types/store-augmentation.d.ts +10 -11
- package/dist/react/types/store-augmentation.d.ts.map +1 -1
- package/dist/react/utils/getMessageQuote.d.ts +5 -6
- package/dist/react/utils/getMessageQuote.d.ts.map +1 -1
- package/dist/react/utils/groupParts.d.ts +28 -29
- package/dist/react/utils/groupParts.d.ts.map +1 -1
- package/dist/react/utils/useJSONEqual.d.ts +1 -3
- package/dist/react/utils/useJSONEqual.d.ts.map +1 -1
- package/dist/react/utils/useJSONSchemaDependency.d.ts +2 -4
- package/dist/react/utils/useJSONSchemaDependency.d.ts.map +1 -1
- package/dist/runtime/api/assistant-runtime.d.ts +26 -28
- package/dist/runtime/api/assistant-runtime.d.ts.map +1 -1
- package/dist/runtime/api/attachment-runtime.d.ts +46 -43
- package/dist/runtime/api/attachment-runtime.d.ts.map +1 -1
- package/dist/runtime/api/attachment-runtime.js.map +1 -1
- package/dist/runtime/api/bindings.d.ts +31 -30
- package/dist/runtime/api/bindings.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.d.ts +207 -193
- package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.js +4 -0
- package/dist/runtime/api/composer-runtime.js.map +1 -1
- package/dist/runtime/api/message-part-runtime.d.ts +28 -26
- package/dist/runtime/api/message-part-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-part-runtime.js +22 -0
- package/dist/runtime/api/message-part-runtime.js.map +1 -1
- package/dist/runtime/api/message-runtime.d.ts +87 -84
- package/dist/runtime/api/message-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-runtime.js +1 -1
- package/dist/runtime/api/message-runtime.js.map +1 -1
- package/dist/runtime/api/paths.d.ts +48 -50
- package/dist/runtime/api/paths.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.d.ts +64 -66
- package/dist/runtime/api/thread-list-item-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-runtime.d.ts +73 -76
- package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-runtime.js.map +1 -1
- package/dist/runtime/api/thread-runtime.d.ts +299 -300
- package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-runtime.js +2 -1
- package/dist/runtime/api/thread-runtime.js.map +1 -1
- package/dist/runtime/base/base-assistant-runtime-core.d.ts +8 -10
- package/dist/runtime/base/base-assistant-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.d.ts +149 -99
- package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.js +400 -122
- package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.d.ts +120 -108
- package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js +109 -41
- package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts +29 -29
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.js +10 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +27 -29
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js +21 -6
- package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
- package/dist/runtime/branch/external-thread-branch-adapter.d.ts +14 -16
- package/dist/runtime/branch/external-thread-branch-adapter.d.ts.map +1 -1
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts +7 -9
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/composer-runtime-core.d.ts +88 -72
- package/dist/runtime/interfaces/composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts +63 -65
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-runtime-core.d.ts +210 -197
- package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +25 -20
- package/dist/runtime/internal.d.ts.map +1 -0
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts +35 -37
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts.map +1 -1
- package/dist/runtime/queue/message-queue.d.ts +29 -31
- package/dist/runtime/queue/message-queue.d.ts.map +1 -1
- package/dist/runtime/queue/message-queue.js +1 -1
- package/dist/runtime/queue/queue-item.d.ts +5 -7
- package/dist/runtime/queue/queue-item.d.ts.map +1 -1
- package/dist/runtime/utils/abortable-thread-load.d.ts +7 -8
- package/dist/runtime/utils/abortable-thread-load.d.ts.map +1 -1
- package/dist/runtime/utils/attachment-add-operations.d.ts +13 -11
- package/dist/runtime/utils/attachment-add-operations.d.ts.map +1 -1
- package/dist/runtime/utils/attachment-add-operations.js +24 -2
- package/dist/runtime/utils/attachment-add-operations.js.map +1 -1
- package/dist/runtime/utils/attachment-send-operations.d.ts +12 -0
- package/dist/runtime/utils/attachment-send-operations.d.ts.map +1 -0
- package/dist/runtime/utils/attachment-send-operations.js +34 -0
- package/dist/runtime/utils/attachment-send-operations.js.map +1 -0
- package/dist/runtime/utils/auto-status.d.ts +4 -5
- package/dist/runtime/utils/auto-status.d.ts.map +1 -1
- package/dist/runtime/utils/auto-status.js +3 -5
- package/dist/runtime/utils/auto-status.js.map +1 -1
- package/dist/runtime/utils/chat-model-adapter.d.ts +26 -27
- package/dist/runtime/utils/chat-model-adapter.d.ts.map +1 -1
- package/dist/runtime/utils/external-message-conversion.d.ts +32 -32
- package/dist/runtime/utils/external-message-conversion.d.ts.map +1 -1
- package/dist/runtime/utils/external-message-conversion.js +3 -3
- package/dist/runtime/utils/external-message-conversion.js.map +1 -1
- package/dist/runtime/utils/external-store-message.d.ts +2 -4
- package/dist/runtime/utils/external-store-message.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository-session.d.ts +21 -23
- package/dist/runtime/utils/message-repository-session.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository.d.ts +50 -51
- package/dist/runtime/utils/message-repository.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository.js +8 -7
- package/dist/runtime/utils/message-repository.js.map +1 -1
- package/dist/runtime/utils/pending-tool-calls.d.ts +10 -11
- package/dist/runtime/utils/pending-tool-calls.d.ts.map +1 -1
- package/dist/runtime/utils/resolveToolApprovalResponse.d.ts +6 -8
- package/dist/runtime/utils/resolveToolApprovalResponse.d.ts.map +1 -1
- package/dist/runtime/utils/runtime-extras-brand.d.ts +4 -6
- package/dist/runtime/utils/runtime-extras-brand.d.ts.map +1 -1
- package/dist/runtime/utils/stored-message-parts.d.ts +5 -5
- package/dist/runtime/utils/stored-message-parts.d.ts.map +1 -1
- package/dist/runtime/utils/stored-message-parts.js +22 -2
- package/dist/runtime/utils/stored-message-parts.js.map +1 -1
- package/dist/runtime/utils/streaming-timing.d.ts +19 -21
- package/dist/runtime/utils/streaming-timing.d.ts.map +1 -1
- package/dist/runtime/utils/thread-message-like.d.ts +36 -32
- package/dist/runtime/utils/thread-message-like.d.ts.map +1 -1
- package/dist/runtime/utils/thread-message-like.js +16 -6
- package/dist/runtime/utils/thread-message-like.js.map +1 -1
- package/dist/runtime/utils/thread-runtime-lifecycle.d.ts +4 -5
- package/dist/runtime/utils/thread-runtime-lifecycle.d.ts.map +1 -1
- package/dist/runtime/utils/thread-runtime-lifecycle.js +31 -4
- package/dist/runtime/utils/thread-runtime-lifecycle.js.map +1 -1
- package/dist/runtime/utils/tool-call-tree.d.ts +6 -8
- package/dist/runtime/utils/tool-call-tree.d.ts.map +1 -1
- package/dist/runtime/utils/tool-interactions.d.ts +10 -0
- package/dist/runtime/utils/tool-interactions.d.ts.map +1 -0
- package/dist/runtime/utils/tool-interactions.js +92 -0
- package/dist/runtime/utils/tool-interactions.js.map +1 -0
- package/dist/runtimes/assistant-transport/utils.d.ts +0 -2
- package/dist/runtimes/assistant-transport/utils.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-adapter.d.ts +215 -198
- package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts +5 -6
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-runtime-core.js +4 -1
- package/dist/runtimes/external-store/external-store-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/external-store-shared-options.d.ts +1 -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 +38 -40
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js +2 -2
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +117 -124
- 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 +44 -14
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/thread-message-converter.d.ts +3 -5
- package/dist/runtimes/external-store/thread-message-converter.d.ts.map +1 -1
- package/dist/runtimes/inert/InertThreadRuntimeCore.d.ts +94 -95
- package/dist/runtimes/inert/InertThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/inert/InertThreadRuntimeCore.js +3 -0
- package/dist/runtimes/inert/InertThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/internal.d.ts +20 -16
- package/dist/runtimes/internal.d.ts.map +1 -0
- package/dist/runtimes/local/local-runtime-core.d.ts +6 -8
- package/dist/runtimes/local/local-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-runtime-options.d.ts +40 -42
- package/dist/runtimes/local/local-runtime-options.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts +40 -42
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.d.ts +93 -97
- package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.js +178 -31
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/local/should-continue.d.ts +1 -3
- package/dist/runtimes/local/should-continue.d.ts.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +76 -53
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js +28 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts +11 -13
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter-changed.d.ts +2 -4
- 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 -3
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts +33 -29
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/optimistic-state.js +8 -3
- package/dist/runtimes/remote-thread-list/optimistic-state.js.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts +44 -46
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.js +1 -1
- package/dist/runtimes/remote-thread-list/title-generation.d.ts +25 -26
- package/dist/runtimes/remote-thread-list/title-generation.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/title.d.ts +3 -5
- package/dist/runtimes/remote-thread-list/title.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/types.d.ts +111 -112
- package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts +144 -145
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js +22 -7
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js.map +1 -1
- package/dist/store/clients/chain-of-thought-client.d.ts +7 -9
- package/dist/store/clients/chain-of-thought-client.d.ts.map +1 -1
- package/dist/store/clients/external-thread.d.ts +53 -54
- package/dist/store/clients/external-thread.d.ts.map +1 -1
- package/dist/store/clients/external-thread.js +1256 -731
- package/dist/store/clients/external-thread.js.map +1 -1
- package/dist/store/clients/model-context-client.d.ts +1 -3
- package/dist/store/clients/model-context-client.d.ts.map +1 -1
- package/dist/store/clients/no-op-composer-client.d.ts +2 -4
- package/dist/store/clients/no-op-composer-client.d.ts.map +1 -1
- package/dist/store/clients/no-op-composer-client.js +3 -1
- package/dist/store/clients/no-op-composer-client.js.map +1 -1
- package/dist/store/clients/runtime-adapter.d.ts +1 -3
- package/dist/store/clients/runtime-adapter.d.ts.map +1 -1
- package/dist/store/clients/single-thread-list.d.ts +3 -4
- package/dist/store/clients/single-thread-list.d.ts.map +1 -1
- package/dist/store/clients/submission-message.d.ts +8 -0
- package/dist/store/clients/submission-message.d.ts.map +1 -0
- package/dist/store/clients/submission-message.js +22 -0
- package/dist/store/clients/submission-message.js.map +1 -0
- package/dist/store/clients/suggestions.d.ts +5 -7
- package/dist/store/clients/suggestions.d.ts.map +1 -1
- package/dist/store/clients/thread-message-client.d.ts +10 -9
- package/dist/store/clients/thread-message-client.d.ts.map +1 -1
- package/dist/store/clients/thread-message-client.js +81 -82
- package/dist/store/clients/thread-message-client.js.map +1 -1
- package/dist/store/clients/thread-selection-events.d.ts +0 -2
- package/dist/store/clients/thread-selection-events.d.ts.map +1 -1
- package/dist/store/clients/thread-tasks.d.ts +4 -6
- package/dist/store/clients/thread-tasks.d.ts.map +1 -1
- package/dist/store/env.d.ts +0 -2
- package/dist/store/env.d.ts.map +1 -1
- package/dist/store/index.d.ts +33 -36
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +5 -5
- package/dist/store/internal.d.ts +12 -12
- package/dist/store/internal.d.ts.map +1 -0
- package/dist/store/internal.js +2 -2
- package/dist/store/primitive-predicates.d.ts +3 -4
- package/dist/store/primitive-predicates.d.ts.map +1 -1
- package/dist/store/primitive-predicates.js +9 -4
- package/dist/store/primitive-predicates.js.map +1 -1
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts +3 -5
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.d.ts +10 -12
- package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.js +65 -62
- package/dist/store/runtime-clients/composer-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/handle-runtime-action.d.ts +0 -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 +0 -2
- package/dist/store/runtime-clients/handle-thread-list-action.d.ts.map +1 -1
- package/dist/store/runtime-clients/liveRef.d.ts +1 -3
- package/dist/store/runtime-clients/liveRef.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts +3 -5
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.js +26 -16
- package/dist/store/runtime-clients/message-part-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.d.ts +9 -9
- package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.js +121 -113
- package/dist/store/runtime-clients/message-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts +4 -6
- 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 +5 -7
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.d.ts +3 -5
- package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.js +221 -158
- package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/useSubscribable.d.ts +2 -4
- package/dist/store/runtime-clients/useSubscribable.d.ts.map +1 -1
- package/dist/store/scope-registration.d.ts +28 -29
- package/dist/store/scope-registration.d.ts.map +1 -1
- package/dist/store/scopes/attachment.d.ts +15 -17
- package/dist/store/scopes/attachment.d.ts.map +1 -1
- package/dist/store/scopes/chain-of-thought.d.ts +28 -29
- package/dist/store/scopes/chain-of-thought.d.ts.map +1 -1
- package/dist/store/scopes/composer.d.ts +141 -128
- package/dist/store/scopes/composer.d.ts.map +1 -1
- package/dist/store/scopes/message.d.ts +114 -107
- package/dist/store/scopes/message.d.ts.map +1 -1
- package/dist/store/scopes/model-context.d.ts +7 -9
- package/dist/store/scopes/model-context.d.ts.map +1 -1
- package/dist/store/scopes/part.d.ts +49 -45
- package/dist/store/scopes/part.d.ts.map +1 -1
- package/dist/store/scopes/queue-item.d.ts +18 -20
- package/dist/store/scopes/queue-item.d.ts.map +1 -1
- package/dist/store/scopes/suggestion.d.ts +10 -12
- package/dist/store/scopes/suggestion.d.ts.map +1 -1
- package/dist/store/scopes/suggestions.d.ts +13 -15
- package/dist/store/scopes/suggestions.d.ts.map +1 -1
- package/dist/store/scopes/task.d.ts +23 -25
- package/dist/store/scopes/task.d.ts.map +1 -1
- package/dist/store/scopes/thread-list-item.d.ts +63 -65
- package/dist/store/scopes/thread-list-item.d.ts.map +1 -1
- package/dist/store/scopes/thread.d.ts +192 -194
- package/dist/store/scopes/thread.d.ts.map +1 -1
- package/dist/store/scopes/threads.d.ts +45 -47
- package/dist/store/scopes/threads.d.ts.map +1 -1
- package/dist/subscribable/subscribable.d.ts +58 -53
- package/dist/subscribable/subscribable.d.ts.map +1 -1
- package/dist/subscribable/subscribable.js +35 -7
- package/dist/subscribable/subscribable.js.map +1 -1
- package/dist/types/attachment.d.ts +26 -27
- package/dist/types/attachment.d.ts.map +1 -1
- package/dist/types/augmentations.d.ts +4 -4
- package/dist/types/augmentations.d.ts.map +1 -1
- package/dist/types/directive.d.ts +11 -13
- package/dist/types/directive.d.ts.map +1 -1
- package/dist/types/error.d.ts +7 -8
- package/dist/types/error.d.ts.map +1 -1
- package/dist/types/index.d.ts +7 -7
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/message.d.ts +322 -284
- package/dist/types/message.d.ts.map +1 -1
- package/dist/types/message.js.map +1 -1
- package/dist/types/quote.d.ts +2 -4
- package/dist/types/quote.d.ts.map +1 -1
- package/dist/types/trigger.d.ts +8 -10
- package/dist/types/trigger.d.ts.map +1 -1
- package/dist/types/unsubscribe.d.ts +0 -2
- package/dist/types/unsubscribe.d.ts.map +1 -1
- package/dist/utils/abortable-iterable.d.ts +0 -2
- package/dist/utils/abortable-iterable.d.ts.map +1 -1
- package/dist/utils/composite-context-provider.d.ts +8 -11
- package/dist/utils/composite-context-provider.d.ts.map +1 -1
- package/dist/utils/data-url.d.ts +10 -12
- package/dist/utils/data-url.d.ts.map +1 -1
- package/dist/utils/getGroupStatus.d.ts +17 -18
- package/dist/utils/getGroupStatus.d.ts.map +1 -1
- package/dist/utils/id.d.ts +0 -2
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/image-media-type.d.ts +0 -2
- package/dist/utils/image-media-type.d.ts.map +1 -1
- package/dist/utils/invoke-user-callback.d.ts +0 -2
- package/dist/utils/invoke-user-callback.d.ts.map +1 -1
- package/dist/utils/json/is-json-equal.d.ts +0 -2
- package/dist/utils/json/is-json-equal.d.ts.map +1 -1
- package/dist/utils/json/is-json.d.ts +1 -3
- package/dist/utils/json/is-json.d.ts.map +1 -1
- package/dist/utils/json/stable-stringify-tool-args.d.ts +1 -3
- package/dist/utils/json/stable-stringify-tool-args.d.ts.map +1 -1
- package/dist/utils/normalizePartStatus.d.ts +2 -3
- package/dist/utils/normalizePartStatus.d.ts.map +1 -1
- package/dist/utils/normalizePartStatus.js +3 -2
- package/dist/utils/normalizePartStatus.js.map +1 -1
- package/dist/utils/notify-event-listeners.d.ts +1 -2
- package/dist/utils/notify-event-listeners.d.ts.map +1 -1
- package/dist/utils/record.d.ts +0 -2
- package/dist/utils/record.d.ts.map +1 -1
- package/dist/utils/silent-runtime-action.d.ts +0 -2
- package/dist/utils/silent-runtime-action.d.ts.map +1 -1
- package/dist/utils/text.d.ts +1 -3
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/wire-media.d.ts +0 -2
- package/dist/utils/wire-media.d.ts.map +1 -1
- package/package.json +11 -10
- package/src/adapters/attachment.test.ts +98 -1
- package/src/adapters/attachment.ts +70 -20
- package/src/adapters/speech.test.ts +94 -0
- package/src/adapters/speech.ts +16 -2
- package/src/adapters/thread-history.ts +16 -5
- package/src/adapters/voice.test.ts +169 -0
- package/src/adapters/voice.ts +25 -4
- package/src/index.ts +14 -2
- package/src/internal.ts +7 -0
- package/src/model-context/frame/host.test.ts +51 -1
- package/src/model-context/frame/host.ts +3 -1
- package/src/model-context/frame/provider.test.ts +61 -0
- package/src/model-context/frame/provider.ts +8 -1
- package/src/model-context/frame/validate.ts +57 -0
- package/src/model-context/interactable-composer-metadata.test.ts +82 -0
- package/src/model-context/interactable-composer-metadata.ts +45 -2
- package/src/react/adapters/LocalStorageThreadListAdapter.test.ts +594 -0
- package/src/react/adapters/LocalStorageThreadListAdapter.tsx +98 -35
- package/src/react/client/Interactables.test.ts +853 -1
- package/src/react/client/Interactables.ts +325 -45
- package/src/react/client/RemoteThreadList.initialize-failure.test.ts +124 -0
- package/src/react/client/RemoteThreadList.ts +6 -0
- package/src/react/client/Tools.ts +2 -3
- package/src/react/client/interactable-model-context.test.ts +56 -13
- package/src/react/client/interactable-model-context.ts +48 -23
- package/src/react/index.ts +2 -2
- package/src/react/interactables-legacy/Interactables.test.ts +212 -1
- package/src/react/interactables-legacy/Interactables.ts +25 -14
- package/src/react/interactables-legacy/interactable-model-context.ts +26 -24
- package/src/react/interactables-shared/useInteractablePersistenceQueue.test.tsx +22 -2
- package/src/react/interactables-shared/useInteractablePersistenceQueue.ts +63 -11
- package/src/react/primitive-hooks/useSuggestionTrigger.test.ts +33 -0
- package/src/react/primitive-hooks/useSuggestionTrigger.ts +7 -4
- package/src/react/primitives/generativeUI/GenerativeUI.test.tsx +124 -8
- package/src/react/primitives/generativeUI/GenerativeUI.tsx +35 -15
- package/src/react/primitives/message/MessageAttachments.test.tsx +2 -6
- package/src/react/primitives/message/MessageAttachments.tsx +14 -8
- package/src/react/primitives/message/MessageGroupedParts.test.tsx +151 -7
- package/src/react/primitives/message/MessageGroupedParts.tsx +19 -6
- package/src/react/primitives/message/MessageParts.test.tsx +84 -0
- package/src/react/primitives/message/MessageParts.tool-interaction.test.tsx +69 -0
- package/src/react/primitives/message/MessageParts.tsx +29 -8
- package/src/react/primitives/thread/ThreadSuggestions.test.tsx +97 -0
- package/src/react/primitives/thread/ThreadSuggestions.tsx +29 -6
- package/src/react/providers/ReadonlyThreadProvider.tsx +2 -2
- package/src/react/providers/TextMessagePartProvider.tsx +3 -0
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.running.test.tsx +93 -0
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.test.tsx +160 -3
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.title.test.tsx +38 -0
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.tsx +73 -53
- package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +19 -3
- package/src/react/runtimes/RemoteThreadResource.ts +5 -2
- package/src/react/runtimes/assistant-transport/replayBoundaryStream.test.ts +3 -1
- package/src/react/runtimes/assistant-transport/replayBoundaryStream.ts +10 -2
- package/src/react/runtimes/assistant-transport/runManager.ts +3 -0
- package/src/react/runtimes/assistant-transport/transport-parentid.test.tsx +57 -0
- package/src/react/runtimes/assistant-transport/transport-thread-id.test.tsx +571 -0
- package/src/react/runtimes/assistant-transport/types.ts +9 -1
- package/src/react/runtimes/assistant-transport/useAssistantTransport.spec.md +10 -0
- package/src/react/runtimes/assistant-transport/useAssistantTransportRuntime.test.tsx +42 -0
- package/src/react/runtimes/assistant-transport/useAssistantTransportRuntime.ts +33 -9
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.copy.integration.test.tsx +289 -0
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.copy.test.tsx +471 -0
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.engagement.test.tsx +330 -0
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.ts +78 -2
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.tsx +361 -2
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.ts +571 -216
- package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.test.ts +25 -0
- package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.ts +7 -3
- package/src/react/runtimes/cloud/auiV0.ts +158 -9
- package/src/react/runtimes/cloud/auiV0DecodeSafely.test.ts +352 -1
- package/src/react/runtimes/createMessageConverter.ts +9 -3
- package/src/react/runtimes/external-store-history-copy.ts +223 -0
- package/src/react/runtimes/useExternalStoreRuntime.history-copy.test.tsx +483 -0
- package/src/react/runtimes/useExternalStoreRuntime.lifecycle.test.tsx +76 -1
- package/src/react/runtimes/useExternalStoreRuntime.ts +25 -5
- package/src/react/runtimes/useLocalRuntime.test.tsx +145 -1
- package/src/react/runtimes/useLocalRuntime.ts +8 -5
- package/src/react/types/MessagePartComponentTypes.ts +10 -0
- package/src/react/types/scopes/interactables.ts +3 -0
- package/src/runtime/api/attachment-runtime.ts +10 -5
- package/src/runtime/api/bindings.ts +6 -1
- package/src/runtime/api/composer-runtime.ts +29 -6
- package/src/runtime/api/message-part-runtime.test.ts +215 -0
- package/src/runtime/api/message-part-runtime.ts +40 -0
- package/src/runtime/api/message-runtime.test.ts +112 -2
- package/src/runtime/api/message-runtime.ts +10 -5
- package/src/runtime/api/thread-list-item-runtime.ts +5 -5
- package/src/runtime/api/thread-list-runtime.ts +3 -3
- package/src/runtime/api/thread-runtime.test.ts +59 -0
- package/src/runtime/api/thread-runtime.ts +21 -11
- package/src/runtime/base/base-composer-runtime-core.ts +548 -153
- package/src/runtime/base/base-thread-runtime-core.test.ts +744 -9
- package/src/runtime/base/base-thread-runtime-core.ts +154 -27
- package/src/runtime/base/default-edit-composer-runtime-core.ts +13 -1
- package/src/runtime/base/default-thread-composer-runtime-core.ts +29 -10
- package/src/runtime/interfaces/composer-runtime-core.ts +19 -0
- package/src/runtime/interfaces/thread-runtime-core.ts +22 -1
- package/src/runtime/utils/attachment-add-operations.ts +45 -2
- package/src/runtime/utils/attachment-send-operations.ts +54 -0
- package/src/runtime/utils/auto-status.test.ts +54 -0
- package/src/runtime/utils/auto-status.ts +3 -10
- package/src/runtime/utils/external-message-conversion.test.ts +48 -0
- package/src/runtime/utils/external-message-conversion.ts +3 -4
- package/src/runtime/utils/message-repository.test.ts +69 -1
- package/src/runtime/utils/message-repository.ts +14 -7
- package/src/runtime/utils/stored-message-parts.ts +43 -1
- package/src/runtime/utils/thread-message-like.test.ts +58 -0
- package/src/runtime/utils/thread-message-like.ts +72 -46
- package/src/runtime/utils/thread-runtime-lifecycle.test.ts +67 -0
- package/src/runtime/utils/thread-runtime-lifecycle.ts +42 -8
- package/src/runtime/utils/tool-interactions.test.ts +193 -0
- package/src/runtime/utils/tool-interactions.ts +147 -0
- package/src/runtimes/external-store/external-store-adapter.ts +22 -1
- package/src/runtimes/external-store/external-store-runtime-core.ts +10 -2
- package/src/runtimes/external-store/external-store-thread-list-runtime-core.ts +2 -2
- package/src/runtimes/external-store/external-store-thread-runtime-core.test.ts +49 -0
- package/src/runtimes/external-store/external-store-thread-runtime-core.ts +76 -29
- package/src/runtimes/inert/InertThreadRuntimeCore.test.ts +127 -56
- package/src/runtimes/inert/InertThreadRuntimeCore.ts +10 -1
- package/src/runtimes/local/local-thread-runtime-core.edit-cancellation.test.ts +70 -0
- package/src/runtimes/local/local-thread-runtime-core.test.ts +1649 -108
- package/src/runtimes/local/local-thread-runtime-core.ts +301 -47
- package/src/runtimes/readonly/ReadonlyThreadRuntimeCore.ts +53 -1
- package/src/runtimes/remote-thread-list/optimistic-state.ts +8 -3
- package/src/runtimes/tool-invocations/EDGE_CASES.md +19 -4
- package/src/runtimes/tool-invocations/ToolInvocationTracker.test.ts +392 -39
- package/src/runtimes/tool-invocations/ToolInvocationTracker.ts +31 -8
- package/src/store/clients/external-thread.test.ts +145 -0
- package/src/store/clients/external-thread.ts +635 -131
- package/src/store/clients/model-context-client.test.ts +8 -8
- package/src/store/clients/no-op-composer-client.ts +2 -0
- package/src/store/clients/submission-message.ts +27 -0
- package/src/store/clients/thread-message-client.test.ts +39 -0
- package/src/store/clients/thread-message-client.ts +13 -6
- package/src/store/index.ts +2 -2
- package/src/store/internal.ts +1 -0
- package/src/store/primitive-predicates.test.ts +103 -0
- package/src/store/primitive-predicates.ts +15 -3
- package/src/store/runtime-clients/composer-runtime-client.ts +4 -3
- package/src/store/runtime-clients/message-part-runtime-client.test.ts +42 -0
- package/src/store/runtime-clients/message-part-runtime-client.ts +4 -0
- package/src/store/runtime-clients/message-runtime-client.ts +5 -0
- package/src/store/runtime-clients/thread-runtime-client.test.tsx +138 -5
- package/src/store/runtime-clients/thread-runtime-client.ts +46 -9
- package/src/store/scopes/composer.ts +22 -4
- package/src/store/scopes/message.ts +8 -0
- package/src/store/scopes/part.ts +8 -0
- package/src/subscribable/subscribable.test.ts +198 -1
- package/src/subscribable/subscribable.ts +49 -7
- package/src/tests/RemoteThreadListThreadListRuntimeCore-errors.test.ts +95 -1
- package/src/tests/auiV0Encode.test.ts +408 -1
- package/src/tests/base-composer-runtime-core-send.test.ts +722 -29
- package/src/tests/base-composer-runtime-core.test.ts +196 -0
- package/src/tests/composer-can-send.test.ts +98 -1
- package/src/tests/composer-submission.test.tsx +796 -0
- package/src/tests/default-edit-composer-runtime-core.test.ts +102 -2
- package/src/tests/external-store-thread-list-runtime-core.test.ts +111 -0
- package/src/tests/external-store-thread-runtime-core-adapter.test.ts +581 -1
- package/src/tests/external-store-thread-runtime-core.test.ts +186 -0
- package/src/tests/external-thread-attachments.test.tsx +741 -3
- package/src/tests/external-thread-isLast.test.tsx +69 -0
- package/src/tests/get-thread-state-isRunning.test.ts +2 -2
- package/src/tests/remote-thread-list-adapter-switch.test.ts +45 -1
- package/src/types/message.ts +49 -2
- package/src/utils/normalizePartStatus.ts +14 -1
- package/dist/tests/remote-thread-list-test-helpers.d.ts +0 -15
- package/dist/tests/remote-thread-list-test-helpers.d.ts.map +0 -1
- package/dist/tests/remote-thread-list-test-helpers.js +0 -59
- package/dist/tests/remote-thread-list-test-helpers.js.map +0 -1
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { generateId } from "../../utils/id.js";
|
|
2
2
|
import { fileMatchesAccept } from "../../adapters/attachment.js";
|
|
3
3
|
import { getThreadMessageText } from "../../utils/text.js";
|
|
4
|
+
import { createToolInteraction } from "../../runtime/utils/tool-interactions.js";
|
|
4
5
|
import { toMessagePartStatus } from "../../utils/normalizePartStatus.js";
|
|
5
6
|
import { resolveToolApprovalResponse } from "../../runtime/utils/resolveToolApprovalResponse.js";
|
|
6
7
|
import { isAttachmentComplete, isCreateAttachment } from "../../types/attachment.js";
|
|
7
8
|
import { AttachmentAddOperations, drainAttachmentAdd } from "../../runtime/utils/attachment-add-operations.js";
|
|
9
|
+
import { AttachmentSendOperations } from "../../runtime/utils/attachment-send-operations.js";
|
|
10
|
+
import { ThreadMessageClient } from "./thread-message-client.js";
|
|
11
|
+
import { submissionThreadMessage } from "./submission-message.js";
|
|
8
12
|
import { ThreadSuggestions } from "./suggestions.js";
|
|
9
13
|
import { TaskClient, createTaskDeriver, getTaskKey } from "./thread-tasks.js";
|
|
10
14
|
import { ModelContext } from "./model-context-client.js";
|
|
@@ -16,6 +20,7 @@ import { ToolResponse } from "assistant-stream";
|
|
|
16
20
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
17
21
|
import { useEffect, useRef, useState } from "@assistant-ui/tap/react-shim";
|
|
18
22
|
import { resource, withKey } from "@assistant-ui/tap";
|
|
23
|
+
import { useAssistantClientDestroySignal } from "@assistant-ui/store/internal";
|
|
19
24
|
//#region src/store/clients/external-thread.ts
|
|
20
25
|
const EMPTY_QUEUE_ITEMS = [];
|
|
21
26
|
const EMPTY_BRANCH_IDS = [];
|
|
@@ -26,17 +31,18 @@ const derivePartStatus = (message, partIndex, part) => {
|
|
|
26
31
|
return toMessagePartStatus(message, partIndex, part);
|
|
27
32
|
};
|
|
28
33
|
const useMessageClient = (t0) => {
|
|
29
|
-
const $ = c(
|
|
30
|
-
const { message, index, parentId, onEdit, onReload, queue, branches, onRespondToToolApproval, onAddToolResult, onResumeToolCall, attachmentAdapter, submittedFeedback, onSubmitFeedback, speech, onSpeak, onStopSpeaking } = t0;
|
|
34
|
+
const $ = c(73);
|
|
35
|
+
const { message, index, isLast, parentId, onEdit, onReload, queue, branches, onRespondToToolApproval, unstable_onRecordToolInteraction, onAddToolResult, onResumeToolCall, attachmentAdapter, submittedFeedback, onSubmitFeedback, speech, onSpeak, onStopSpeaking } = t0;
|
|
31
36
|
const [isCopied, setIsCopied] = useState(false);
|
|
32
37
|
const [isHovering, setIsHovering] = useState(false);
|
|
33
38
|
let t1;
|
|
34
|
-
if ($[0] !== message || $[1] !== onAddToolResult || $[2] !== onRespondToToolApproval || $[3] !== onResumeToolCall) {
|
|
39
|
+
if ($[0] !== message || $[1] !== onAddToolResult || $[2] !== onRespondToToolApproval || $[3] !== onResumeToolCall || $[4] !== unstable_onRecordToolInteraction) {
|
|
35
40
|
t1 = message.content.map((part, idx) => withKey(idx, PartResource({
|
|
36
41
|
part,
|
|
37
42
|
status: derivePartStatus(message, idx, part),
|
|
38
43
|
messageId: message.id,
|
|
39
44
|
onRespondToToolApproval,
|
|
45
|
+
unstable_onRecordToolInteraction,
|
|
40
46
|
onAddToolResult,
|
|
41
47
|
onResumeToolCall
|
|
42
48
|
})));
|
|
@@ -44,33 +50,34 @@ const useMessageClient = (t0) => {
|
|
|
44
50
|
$[1] = onAddToolResult;
|
|
45
51
|
$[2] = onRespondToToolApproval;
|
|
46
52
|
$[3] = onResumeToolCall;
|
|
47
|
-
$[4] =
|
|
48
|
-
|
|
53
|
+
$[4] = unstable_onRecordToolInteraction;
|
|
54
|
+
$[5] = t1;
|
|
55
|
+
} else t1 = $[5];
|
|
49
56
|
const partClients = useClientLookup(t1);
|
|
50
57
|
let t2;
|
|
51
|
-
if ($[
|
|
58
|
+
if ($[6] !== message.attachments) {
|
|
52
59
|
t2 = message.attachments ?? [];
|
|
53
|
-
$[
|
|
54
|
-
$[
|
|
55
|
-
} else t2 = $[
|
|
60
|
+
$[6] = message.attachments;
|
|
61
|
+
$[7] = t2;
|
|
62
|
+
} else t2 = $[7];
|
|
56
63
|
let t3;
|
|
57
|
-
if ($[
|
|
64
|
+
if ($[8] !== t2) {
|
|
58
65
|
t3 = t2.map(_temp2);
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
61
|
-
} else t3 = $[
|
|
66
|
+
$[8] = t2;
|
|
67
|
+
$[9] = t3;
|
|
68
|
+
} else t3 = $[9];
|
|
62
69
|
const attachmentClients = useClientLookup(t3);
|
|
63
70
|
let t4;
|
|
64
|
-
if ($[
|
|
71
|
+
if ($[10] !== onEdit) {
|
|
65
72
|
t4 = () => {
|
|
66
73
|
if (!onEdit) throw new Error("Runtime does not support editing.");
|
|
67
74
|
};
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
} else t4 = $[
|
|
75
|
+
$[10] = onEdit;
|
|
76
|
+
$[11] = t4;
|
|
77
|
+
} else t4 = $[11];
|
|
71
78
|
const handleBeginEdit = t4;
|
|
72
79
|
let t5;
|
|
73
|
-
if ($[
|
|
80
|
+
if ($[12] !== message.id || $[13] !== onEdit || $[14] !== parentId) {
|
|
74
81
|
t5 = (msg) => {
|
|
75
82
|
if (!onEdit) throw new Error("Runtime does not support editing.");
|
|
76
83
|
onEdit({
|
|
@@ -79,14 +86,14 @@ const useMessageClient = (t0) => {
|
|
|
79
86
|
sourceId: message.id
|
|
80
87
|
});
|
|
81
88
|
};
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
} else t5 = $[
|
|
89
|
+
$[12] = message.id;
|
|
90
|
+
$[13] = onEdit;
|
|
91
|
+
$[14] = parentId;
|
|
92
|
+
$[15] = t5;
|
|
93
|
+
} else t5 = $[15];
|
|
87
94
|
const handleSendEdit = t5;
|
|
88
95
|
let t6;
|
|
89
|
-
if ($[
|
|
96
|
+
if ($[16] !== attachmentAdapter || $[17] !== handleBeginEdit || $[18] !== handleSendEdit || $[19] !== message || $[20] !== queue) {
|
|
90
97
|
t6 = ComposerClientResource({
|
|
91
98
|
type: "edit",
|
|
92
99
|
canCancel: true,
|
|
@@ -96,32 +103,32 @@ const useMessageClient = (t0) => {
|
|
|
96
103
|
queue,
|
|
97
104
|
attachmentAdapter
|
|
98
105
|
});
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
} else t6 = $[
|
|
106
|
+
$[16] = attachmentAdapter;
|
|
107
|
+
$[17] = handleBeginEdit;
|
|
108
|
+
$[18] = handleSendEdit;
|
|
109
|
+
$[19] = message;
|
|
110
|
+
$[20] = queue;
|
|
111
|
+
$[21] = t6;
|
|
112
|
+
} else t6 = $[21];
|
|
106
113
|
const composerClient = useClientResource(t6);
|
|
107
114
|
let branchIds;
|
|
108
115
|
let t7;
|
|
109
|
-
if ($[
|
|
116
|
+
if ($[22] !== branches || $[23] !== message.id) {
|
|
110
117
|
branchIds = branches?.getBranches(message.id) ?? EMPTY_BRANCH_IDS;
|
|
111
118
|
t7 = branchIds.indexOf(message.id);
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
119
|
+
$[22] = branches;
|
|
120
|
+
$[23] = message.id;
|
|
121
|
+
$[24] = branchIds;
|
|
122
|
+
$[25] = t7;
|
|
116
123
|
} else {
|
|
117
|
-
branchIds = $[
|
|
118
|
-
t7 = $[
|
|
124
|
+
branchIds = $[24];
|
|
125
|
+
t7 = $[25];
|
|
119
126
|
}
|
|
120
127
|
const branchIndex = t7;
|
|
121
128
|
const branchNumber = branchIndex === -1 ? 1 : branchIndex + 1;
|
|
122
129
|
const branchCount = branchIndex === -1 ? 1 : branchIds.length;
|
|
123
130
|
let t8;
|
|
124
|
-
if ($[
|
|
131
|
+
if ($[26] !== message || $[27] !== submittedFeedback) {
|
|
125
132
|
t8 = submittedFeedback && message.role === "assistant" ? {
|
|
126
133
|
...message,
|
|
127
134
|
metadata: {
|
|
@@ -129,24 +136,24 @@ const useMessageClient = (t0) => {
|
|
|
129
136
|
submittedFeedback
|
|
130
137
|
}
|
|
131
138
|
} : message;
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
} else t8 = $[
|
|
139
|
+
$[26] = message;
|
|
140
|
+
$[27] = submittedFeedback;
|
|
141
|
+
$[28] = t8;
|
|
142
|
+
} else t8 = $[28];
|
|
136
143
|
const messageWithFeedback = t8;
|
|
137
144
|
let t9;
|
|
138
|
-
if ($[
|
|
145
|
+
if ($[29] !== message.attachments) {
|
|
139
146
|
t9 = message.attachments ?? [];
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
} else t9 = $[
|
|
147
|
+
$[29] = message.attachments;
|
|
148
|
+
$[30] = t9;
|
|
149
|
+
} else t9 = $[30];
|
|
143
150
|
let t10;
|
|
144
|
-
if ($[
|
|
151
|
+
if ($[31] !== branchCount || $[32] !== branchNumber || $[33] !== composerClient.state || $[34] !== index || $[35] !== isCopied || $[36] !== isHovering || $[37] !== isLast || $[38] !== messageWithFeedback || $[39] !== parentId || $[40] !== partClients.state || $[41] !== speech || $[42] !== t9) {
|
|
145
152
|
t10 = {
|
|
146
153
|
...messageWithFeedback,
|
|
147
154
|
attachments: t9,
|
|
148
155
|
parentId,
|
|
149
|
-
isLast
|
|
156
|
+
isLast,
|
|
150
157
|
branchNumber,
|
|
151
158
|
branchCount,
|
|
152
159
|
speech,
|
|
@@ -156,82 +163,83 @@ const useMessageClient = (t0) => {
|
|
|
156
163
|
index,
|
|
157
164
|
composer: composerClient.state
|
|
158
165
|
};
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
|
|
166
|
+
$[31] = branchCount;
|
|
167
|
+
$[32] = branchNumber;
|
|
168
|
+
$[33] = composerClient.state;
|
|
169
|
+
$[34] = index;
|
|
170
|
+
$[35] = isCopied;
|
|
171
|
+
$[36] = isHovering;
|
|
172
|
+
$[37] = isLast;
|
|
173
|
+
$[38] = messageWithFeedback;
|
|
174
|
+
$[39] = parentId;
|
|
175
|
+
$[40] = partClients.state;
|
|
176
|
+
$[41] = speech;
|
|
177
|
+
$[42] = t9;
|
|
178
|
+
$[43] = t10;
|
|
179
|
+
} else t10 = $[43];
|
|
172
180
|
const state = t10;
|
|
173
181
|
let t11;
|
|
174
|
-
if ($[
|
|
182
|
+
if ($[44] !== state) {
|
|
175
183
|
t11 = () => state;
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
} else t11 = $[
|
|
184
|
+
$[44] = state;
|
|
185
|
+
$[45] = t11;
|
|
186
|
+
} else t11 = $[45];
|
|
179
187
|
let t12;
|
|
180
|
-
if ($[
|
|
188
|
+
if ($[46] !== composerClient.methods) {
|
|
181
189
|
t12 = () => composerClient.methods;
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
184
|
-
} else t12 = $[
|
|
190
|
+
$[46] = composerClient.methods;
|
|
191
|
+
$[47] = t12;
|
|
192
|
+
} else t12 = $[47];
|
|
185
193
|
let t13;
|
|
186
|
-
if ($[
|
|
194
|
+
if ($[48] !== onReload) {
|
|
187
195
|
t13 = () => {
|
|
188
196
|
onReload?.();
|
|
189
197
|
};
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
} else t13 = $[
|
|
198
|
+
$[48] = onReload;
|
|
199
|
+
$[49] = t13;
|
|
200
|
+
} else t13 = $[49];
|
|
193
201
|
let t14;
|
|
194
|
-
if ($[
|
|
202
|
+
if ($[50] !== branchIds || $[51] !== branchIndex || $[52] !== branches || $[53] !== message.id) {
|
|
195
203
|
t14 = (t15) => {
|
|
196
204
|
const { position, branchId } = t15;
|
|
197
205
|
if (!branches) return;
|
|
198
206
|
const target = branchId ?? (branchIndex === -1 ? void 0 : position === "previous" ? branchIds[branchIndex - 1] : position === "next" ? branchIds[branchIndex + 1] : void 0);
|
|
199
207
|
if (target !== void 0 && target !== message.id) branches.switchToBranch(target);
|
|
200
208
|
};
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
$[
|
|
206
|
-
} else t14 = $[
|
|
209
|
+
$[50] = branchIds;
|
|
210
|
+
$[51] = branchIndex;
|
|
211
|
+
$[52] = branches;
|
|
212
|
+
$[53] = message.id;
|
|
213
|
+
$[54] = t14;
|
|
214
|
+
} else t14 = $[54];
|
|
207
215
|
let t15;
|
|
208
|
-
if ($[
|
|
216
|
+
if ($[55] !== message) {
|
|
209
217
|
t15 = () => getThreadMessageText(message);
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
212
|
-
} else t15 = $[
|
|
218
|
+
$[55] = message;
|
|
219
|
+
$[56] = t15;
|
|
220
|
+
} else t15 = $[56];
|
|
213
221
|
let t16;
|
|
214
|
-
if ($[
|
|
222
|
+
if ($[57] !== partClients || $[58] !== state) {
|
|
215
223
|
t16 = (selector) => {
|
|
216
224
|
if ("index" in selector) return partClients.get(selector);
|
|
217
225
|
const partIndex = state.parts.findIndex((p) => p.type === "tool-call" && p.toolCallId === selector.toolCallId);
|
|
218
226
|
return partClients.get({ index: partIndex });
|
|
219
227
|
};
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
} else t16 = $[
|
|
228
|
+
$[57] = partClients;
|
|
229
|
+
$[58] = state;
|
|
230
|
+
$[59] = t16;
|
|
231
|
+
} else t16 = $[59];
|
|
224
232
|
let t17;
|
|
225
|
-
if ($[
|
|
233
|
+
if ($[60] !== attachmentClients) {
|
|
226
234
|
t17 = (selector_0) => {
|
|
227
235
|
if ("id" in selector_0) return attachmentClients.get({ key: selector_0.id });
|
|
228
236
|
return attachmentClients.get(selector_0);
|
|
229
237
|
};
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
} else t17 = $[
|
|
238
|
+
$[60] = attachmentClients;
|
|
239
|
+
$[61] = t17;
|
|
240
|
+
} else t17 = $[61];
|
|
233
241
|
let t18;
|
|
234
|
-
if ($[
|
|
242
|
+
if ($[62] !== onSpeak || $[63] !== onStopSpeaking || $[64] !== onSubmitFeedback || $[65] !== t11 || $[66] !== t12 || $[67] !== t13 || $[68] !== t14 || $[69] !== t15 || $[70] !== t16 || $[71] !== t17) {
|
|
235
243
|
t18 = {
|
|
236
244
|
getState: t11,
|
|
237
245
|
composer: t12,
|
|
@@ -247,24 +255,24 @@ const useMessageClient = (t0) => {
|
|
|
247
255
|
setIsCopied,
|
|
248
256
|
setIsHovering
|
|
249
257
|
};
|
|
250
|
-
$[
|
|
251
|
-
$[
|
|
252
|
-
$[
|
|
253
|
-
$[
|
|
254
|
-
$[
|
|
255
|
-
$[
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
} else t18 = $[
|
|
258
|
+
$[62] = onSpeak;
|
|
259
|
+
$[63] = onStopSpeaking;
|
|
260
|
+
$[64] = onSubmitFeedback;
|
|
261
|
+
$[65] = t11;
|
|
262
|
+
$[66] = t12;
|
|
263
|
+
$[67] = t13;
|
|
264
|
+
$[68] = t14;
|
|
265
|
+
$[69] = t15;
|
|
266
|
+
$[70] = t16;
|
|
267
|
+
$[71] = t17;
|
|
268
|
+
$[72] = t18;
|
|
269
|
+
} else t18 = $[72];
|
|
262
270
|
return t18;
|
|
263
271
|
};
|
|
264
272
|
const MessageClient = resource(useMessageClient);
|
|
265
273
|
const usePartResource = (t0) => {
|
|
266
|
-
const $ = c(
|
|
267
|
-
const { part, status, messageId, onRespondToToolApproval, onAddToolResult, onResumeToolCall } = t0;
|
|
274
|
+
const $ = c(27);
|
|
275
|
+
const { part, status, messageId, onRespondToToolApproval, unstable_onRecordToolInteraction, onAddToolResult, onResumeToolCall } = t0;
|
|
268
276
|
const t1 = status;
|
|
269
277
|
let t2;
|
|
270
278
|
if ($[0] !== part || $[1] !== t1) {
|
|
@@ -305,7 +313,7 @@ const usePartResource = (t0) => {
|
|
|
305
313
|
$[8] = t4;
|
|
306
314
|
} else t4 = $[8];
|
|
307
315
|
let t5;
|
|
308
|
-
if ($[9] !==
|
|
316
|
+
if ($[9] !== messageId || $[10] !== onResumeToolCall || $[11] !== part || $[12] !== unstable_onRecordToolInteraction) {
|
|
309
317
|
t5 = (payload) => {
|
|
310
318
|
if (!onResumeToolCall) throw new Error("Runtime does not support resuming tool calls (onResumeToolCall is not set).");
|
|
311
319
|
if (part.type !== "tool-call") throw new Error("Tried to resume tool call on non-tool message part");
|
|
@@ -313,13 +321,23 @@ const usePartResource = (t0) => {
|
|
|
313
321
|
toolCallId: part.toolCallId,
|
|
314
322
|
payload
|
|
315
323
|
});
|
|
324
|
+
Promise.resolve().then(() => unstable_onRecordToolInteraction?.({
|
|
325
|
+
messageId,
|
|
326
|
+
toolCallId: part.toolCallId,
|
|
327
|
+
interaction: createToolInteraction({
|
|
328
|
+
type: "human-response",
|
|
329
|
+
payload
|
|
330
|
+
})
|
|
331
|
+
})).catch(_temp4);
|
|
316
332
|
};
|
|
317
|
-
$[9] =
|
|
318
|
-
$[10] =
|
|
319
|
-
$[11] =
|
|
320
|
-
|
|
333
|
+
$[9] = messageId;
|
|
334
|
+
$[10] = onResumeToolCall;
|
|
335
|
+
$[11] = part;
|
|
336
|
+
$[12] = unstable_onRecordToolInteraction;
|
|
337
|
+
$[13] = t5;
|
|
338
|
+
} else t5 = $[13];
|
|
321
339
|
let t6;
|
|
322
|
-
if ($[
|
|
340
|
+
if ($[14] !== onRespondToToolApproval || $[15] !== part) {
|
|
323
341
|
t6 = (response_0) => {
|
|
324
342
|
if (!onRespondToToolApproval) throw new Error("Runtime does not support tool approvals.");
|
|
325
343
|
if (part.type !== "tool-call") throw new Error("Tried to respond to tool approval on non-tool message part");
|
|
@@ -332,25 +350,43 @@ const usePartResource = (t0) => {
|
|
|
332
350
|
return Promise.reject(error);
|
|
333
351
|
}
|
|
334
352
|
};
|
|
335
|
-
$[
|
|
336
|
-
$[
|
|
337
|
-
$[
|
|
338
|
-
} else t6 = $[
|
|
353
|
+
$[14] = onRespondToToolApproval;
|
|
354
|
+
$[15] = part;
|
|
355
|
+
$[16] = t6;
|
|
356
|
+
} else t6 = $[16];
|
|
339
357
|
let t7;
|
|
340
|
-
if ($[
|
|
341
|
-
t7 = {
|
|
358
|
+
if ($[17] !== messageId || $[18] !== part || $[19] !== unstable_onRecordToolInteraction) {
|
|
359
|
+
t7 = async (input) => {
|
|
360
|
+
if (!unstable_onRecordToolInteraction) throw new Error("Runtime does not support recording tool interactions.");
|
|
361
|
+
if (part.type !== "tool-call") throw new Error("Tried to record interaction on non-tool message part");
|
|
362
|
+
await unstable_onRecordToolInteraction({
|
|
363
|
+
messageId,
|
|
364
|
+
toolCallId: part.toolCallId,
|
|
365
|
+
interaction: createToolInteraction(input)
|
|
366
|
+
});
|
|
367
|
+
};
|
|
368
|
+
$[17] = messageId;
|
|
369
|
+
$[18] = part;
|
|
370
|
+
$[19] = unstable_onRecordToolInteraction;
|
|
371
|
+
$[20] = t7;
|
|
372
|
+
} else t7 = $[20];
|
|
373
|
+
let t8;
|
|
374
|
+
if ($[21] !== t3 || $[22] !== t4 || $[23] !== t5 || $[24] !== t6 || $[25] !== t7) {
|
|
375
|
+
t8 = {
|
|
342
376
|
getState: t3,
|
|
343
377
|
addToolResult: t4,
|
|
344
378
|
resumeToolCall: t5,
|
|
345
|
-
respondToToolApproval: t6
|
|
379
|
+
respondToToolApproval: t6,
|
|
380
|
+
unstable_recordInteraction: t7
|
|
346
381
|
};
|
|
347
|
-
$[
|
|
348
|
-
$[
|
|
349
|
-
$[
|
|
350
|
-
$[
|
|
351
|
-
$[
|
|
352
|
-
|
|
353
|
-
|
|
382
|
+
$[21] = t3;
|
|
383
|
+
$[22] = t4;
|
|
384
|
+
$[23] = t5;
|
|
385
|
+
$[24] = t6;
|
|
386
|
+
$[25] = t7;
|
|
387
|
+
$[26] = t8;
|
|
388
|
+
} else t8 = $[26];
|
|
389
|
+
return t8;
|
|
354
390
|
};
|
|
355
391
|
const PartResource = resource(usePartResource);
|
|
356
392
|
const useAttachmentResource = ({ attachment, onRemove }) => {
|
|
@@ -362,6 +398,7 @@ const useAttachmentResource = ({ attachment, onRemove }) => {
|
|
|
362
398
|
};
|
|
363
399
|
};
|
|
364
400
|
const AttachmentResource = resource(useAttachmentResource);
|
|
401
|
+
const EMPTY_MESSAGE_KEYS = Object.freeze([]);
|
|
365
402
|
const useQueueItemClient = ({ item, onMove, onRemove }) => {
|
|
366
403
|
return {
|
|
367
404
|
getState: () => item,
|
|
@@ -399,144 +436,327 @@ const useLiveState = (initial) => {
|
|
|
399
436
|
} else t1 = $[2];
|
|
400
437
|
return t1;
|
|
401
438
|
};
|
|
402
|
-
const removeAttachmentThroughAdapter = async (attachment, attachmentAdapter,
|
|
439
|
+
const removeAttachmentThroughAdapter = async (attachment, attachmentAdapter, onError) => {
|
|
403
440
|
try {
|
|
404
441
|
await attachmentAdapter?.remove(attachment);
|
|
405
442
|
} catch (error) {
|
|
406
|
-
|
|
407
|
-
setAttachments((prev) => prev.map((candidate) => candidate.id === attachment.id && !isAttachmentComplete(candidate) ? {
|
|
408
|
-
...candidate,
|
|
409
|
-
status: {
|
|
410
|
-
type: "incomplete",
|
|
411
|
-
reason: "error",
|
|
412
|
-
message
|
|
413
|
-
}
|
|
414
|
-
} : candidate));
|
|
443
|
+
onError(error instanceof Error ? error.message : String(error));
|
|
415
444
|
throw error;
|
|
416
445
|
}
|
|
417
446
|
};
|
|
447
|
+
const dispatchSafely = (dispatch) => {
|
|
448
|
+
try {
|
|
449
|
+
dispatch();
|
|
450
|
+
return;
|
|
451
|
+
} catch (error) {
|
|
452
|
+
return { error };
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
const abortOnDestroy = (destroySignal, controller) => {
|
|
456
|
+
if (!destroySignal) return () => {};
|
|
457
|
+
const abort = () => controller.abort(destroySignal.reason);
|
|
458
|
+
if (destroySignal.aborted) {
|
|
459
|
+
abort();
|
|
460
|
+
return () => {};
|
|
461
|
+
}
|
|
462
|
+
const unlink = () => {
|
|
463
|
+
destroySignal.removeEventListener("abort", abort);
|
|
464
|
+
controller.signal.removeEventListener("abort", unlink);
|
|
465
|
+
};
|
|
466
|
+
destroySignal.addEventListener("abort", abort, { once: true });
|
|
467
|
+
controller.signal.addEventListener("abort", unlink, { once: true });
|
|
468
|
+
return unlink;
|
|
469
|
+
};
|
|
470
|
+
const EMPTY_IN_TRANSIT = Object.freeze([]);
|
|
418
471
|
const useComposerClientResource = (t0) => {
|
|
419
|
-
const $ = c(
|
|
420
|
-
const { type, canCancel, isRunning: t1, isSendDisabled: t2, onCancel, onBeginEdit, onSend, message, queue, attachmentAdapter } = t0;
|
|
472
|
+
const $ = c(190);
|
|
473
|
+
const { type, canCancel, isRunning: t1, isSendDisabled: t2, onCancel, onBeginEdit, onSend, message, queue, attachmentAdapter, messageKeys: t3 } = t0;
|
|
421
474
|
const isRunning = t1 === void 0 ? false : t1;
|
|
422
475
|
const isSendDisabled = t2 === void 0 ? false : t2;
|
|
476
|
+
const messageKeys = t3 === void 0 ? EMPTY_MESSAGE_KEYS : t3;
|
|
423
477
|
const [isEditing, setIsEditing, isEditingRef] = useLiveState(type === "thread");
|
|
424
478
|
const [text, setText, textRef] = useLiveState("");
|
|
425
479
|
const [role, setRole, roleRef] = useLiveState("user");
|
|
426
|
-
let t3;
|
|
427
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
428
|
-
t3 = {};
|
|
429
|
-
$[0] = t3;
|
|
430
|
-
} else t3 = $[0];
|
|
431
|
-
const [runConfig, setRunConfig, runConfigRef] = useLiveState(t3);
|
|
432
480
|
let t4;
|
|
481
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
482
|
+
t4 = {};
|
|
483
|
+
$[0] = t4;
|
|
484
|
+
} else t4 = $[0];
|
|
485
|
+
const [runConfig, setRunConfig, runConfigRef] = useLiveState(t4);
|
|
486
|
+
let t5;
|
|
433
487
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
434
|
-
|
|
435
|
-
$[1] =
|
|
436
|
-
} else
|
|
437
|
-
const [attachments, setAttachments, attachmentsRef] = useLiveState(
|
|
488
|
+
t5 = [];
|
|
489
|
+
$[1] = t5;
|
|
490
|
+
} else t5 = $[1];
|
|
491
|
+
const [attachments, setAttachments, attachmentsRef] = useLiveState(t5);
|
|
438
492
|
const [quote, setQuote, quoteRef] = useLiveState(void 0);
|
|
439
|
-
let t5;
|
|
440
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
441
|
-
t5 = new AttachmentAddOperations();
|
|
442
|
-
$[2] = t5;
|
|
443
|
-
} else t5 = $[2];
|
|
444
|
-
const attachmentAddOperations = t5;
|
|
445
493
|
let t6;
|
|
446
|
-
if ($[
|
|
447
|
-
t6 = ()
|
|
494
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
495
|
+
t6 = new AttachmentAddOperations();
|
|
496
|
+
$[2] = t6;
|
|
497
|
+
} else t6 = $[2];
|
|
498
|
+
const attachmentAddOperations = t6;
|
|
499
|
+
let t7;
|
|
500
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
501
|
+
t7 = new AttachmentSendOperations();
|
|
502
|
+
$[3] = t7;
|
|
503
|
+
} else t7 = $[3];
|
|
504
|
+
const attachmentSends = t7;
|
|
505
|
+
const destroySignal = useAssistantClientDestroySignal();
|
|
506
|
+
const [submission, setSubmission, submissionRef] = useLiveState(void 0);
|
|
507
|
+
const submissionSend = useRef(void 0);
|
|
508
|
+
const [inTransit, setInTransit] = useLiveState(EMPTY_IN_TRANSIT);
|
|
509
|
+
const messageKeysRef = useRef(messageKeys);
|
|
510
|
+
const sendGeneration = useRef(0);
|
|
511
|
+
let claimed;
|
|
512
|
+
let landed;
|
|
513
|
+
if ($[4] !== inTransit || $[5] !== messageKeys) {
|
|
514
|
+
claimed = /* @__PURE__ */ new Set();
|
|
515
|
+
landed = /* @__PURE__ */ new Set();
|
|
516
|
+
for (const entry of inTransit) {
|
|
517
|
+
const key = messageKeys.find((candidate) => !entry.known.has(candidate) && !claimed.has(candidate) && candidate.endsWith(`|${entry.submission.role}`));
|
|
518
|
+
if (key === void 0) continue;
|
|
519
|
+
claimed.add(key);
|
|
520
|
+
landed.add(entry);
|
|
521
|
+
}
|
|
522
|
+
$[4] = inTransit;
|
|
523
|
+
$[5] = messageKeys;
|
|
524
|
+
$[6] = claimed;
|
|
525
|
+
$[7] = landed;
|
|
526
|
+
} else {
|
|
527
|
+
claimed = $[6];
|
|
528
|
+
landed = $[7];
|
|
529
|
+
}
|
|
530
|
+
let t8;
|
|
531
|
+
if ($[8] !== claimed || $[9] !== landed) {
|
|
532
|
+
t8 = {
|
|
533
|
+
landed,
|
|
534
|
+
claimed
|
|
535
|
+
};
|
|
536
|
+
$[8] = claimed;
|
|
537
|
+
$[9] = landed;
|
|
538
|
+
$[10] = t8;
|
|
539
|
+
} else t8 = $[10];
|
|
540
|
+
const shown = t8;
|
|
541
|
+
let t9;
|
|
542
|
+
if ($[11] !== inTransit || $[12] !== shown.landed) {
|
|
543
|
+
let t10;
|
|
544
|
+
if ($[14] !== shown.landed) {
|
|
545
|
+
t10 = (entry_0) => !shown.landed.has(entry_0);
|
|
546
|
+
$[14] = shown.landed;
|
|
547
|
+
$[15] = t10;
|
|
548
|
+
} else t10 = $[15];
|
|
549
|
+
t9 = inTransit.filter(t10).map(_temp5);
|
|
550
|
+
$[11] = inTransit;
|
|
551
|
+
$[12] = shown.landed;
|
|
552
|
+
$[13] = t9;
|
|
553
|
+
} else t9 = $[13];
|
|
554
|
+
const inTransitSubmissions = t9;
|
|
555
|
+
let t10;
|
|
556
|
+
if ($[16] !== messageKeys || $[17] !== setInTransit || $[18] !== shown.claimed || $[19] !== shown.landed) {
|
|
557
|
+
t10 = () => {
|
|
558
|
+
messageKeysRef.current = messageKeys;
|
|
559
|
+
if (shown.landed.size === 0) return;
|
|
560
|
+
setInTransit((prev) => prev.filter((entry_2) => !shown.landed.has(entry_2)).map((entry_3) => ({
|
|
561
|
+
...entry_3,
|
|
562
|
+
known: /* @__PURE__ */ new Set([...entry_3.known, ...shown.claimed])
|
|
563
|
+
})));
|
|
564
|
+
};
|
|
565
|
+
$[16] = messageKeys;
|
|
566
|
+
$[17] = setInTransit;
|
|
567
|
+
$[18] = shown.claimed;
|
|
568
|
+
$[19] = shown.landed;
|
|
569
|
+
$[20] = t10;
|
|
570
|
+
} else t10 = $[20];
|
|
571
|
+
let t11;
|
|
572
|
+
if ($[21] !== messageKeys || $[22] !== setInTransit || $[23] !== shown) {
|
|
573
|
+
t11 = [
|
|
574
|
+
messageKeys,
|
|
575
|
+
shown,
|
|
576
|
+
setInTransit
|
|
577
|
+
];
|
|
578
|
+
$[21] = messageKeys;
|
|
579
|
+
$[22] = setInTransit;
|
|
580
|
+
$[23] = shown;
|
|
581
|
+
$[24] = t11;
|
|
582
|
+
} else t11 = $[24];
|
|
583
|
+
useEffect(t10, t11);
|
|
584
|
+
let t12;
|
|
585
|
+
if ($[25] !== message || $[26] !== setAttachments || $[27] !== setRole || $[28] !== setText) {
|
|
586
|
+
t12 = () => {
|
|
448
587
|
if (!message) return;
|
|
449
|
-
const messageText = message.content.filter(
|
|
588
|
+
const messageText = message.content.filter(_temp6).map(_temp7).join("\n\n");
|
|
450
589
|
setText(messageText);
|
|
451
590
|
setRole(message.role);
|
|
452
|
-
|
|
591
|
+
const restored = message.attachments ?? [];
|
|
592
|
+
for (const attachment of restored) attachmentSends.unmarkRemoved(attachment);
|
|
593
|
+
setAttachments(restored);
|
|
453
594
|
};
|
|
454
|
-
$[
|
|
455
|
-
$[
|
|
456
|
-
$[
|
|
457
|
-
$[
|
|
458
|
-
$[
|
|
459
|
-
} else
|
|
460
|
-
const updateFromMessage =
|
|
461
|
-
let
|
|
462
|
-
if ($[
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
595
|
+
$[25] = message;
|
|
596
|
+
$[26] = setAttachments;
|
|
597
|
+
$[27] = setRole;
|
|
598
|
+
$[28] = setText;
|
|
599
|
+
$[29] = t12;
|
|
600
|
+
} else t12 = $[29];
|
|
601
|
+
const updateFromMessage = t12;
|
|
602
|
+
let t13;
|
|
603
|
+
if ($[30] !== attachmentAdapter || $[31] !== setAttachments) {
|
|
604
|
+
t13 = async (attachment_0) => {
|
|
605
|
+
attachmentAddOperations.cancel(attachment_0.id);
|
|
606
|
+
attachmentSends.markRemoved(attachment_0);
|
|
607
|
+
if (!isAttachmentComplete(attachment_0)) await removeAttachmentThroughAdapter(attachment_0, attachmentAdapter, (message_0) => setAttachments((prev_0) => prev_0.map((candidate_0) => candidate_0.id === attachment_0.id && !isAttachmentComplete(candidate_0) ? attachmentSends.transfer(candidate_0, {
|
|
608
|
+
...candidate_0,
|
|
609
|
+
status: {
|
|
610
|
+
type: "incomplete",
|
|
611
|
+
reason: "error",
|
|
612
|
+
message: message_0
|
|
471
613
|
}
|
|
614
|
+
}) : candidate_0)));
|
|
615
|
+
setAttachments((prev_1) => prev_1.filter((a) => a.id !== attachment_0.id));
|
|
616
|
+
};
|
|
617
|
+
$[30] = attachmentAdapter;
|
|
618
|
+
$[31] = setAttachments;
|
|
619
|
+
$[32] = t13;
|
|
620
|
+
} else t13 = $[32];
|
|
621
|
+
const handleRemoveAttachment = t13;
|
|
622
|
+
let t14;
|
|
623
|
+
if ($[33] !== attachmentAdapter || $[34] !== setSubmission) {
|
|
624
|
+
t14 = async (attachment_1) => {
|
|
625
|
+
attachmentAddOperations.cancel(attachment_1.id);
|
|
626
|
+
attachmentSends.markRemoved(attachment_1);
|
|
627
|
+
if (!isAttachmentComplete(attachment_1)) await removeAttachmentThroughAdapter(attachment_1, attachmentAdapter, (message_1) => setSubmission((prev_2) => prev_2 ? {
|
|
628
|
+
...prev_2,
|
|
629
|
+
attachments: prev_2.attachments.map((candidate_1) => {
|
|
630
|
+
if (candidate_1.id !== attachment_1.id || isAttachmentComplete(candidate_1)) return candidate_1;
|
|
631
|
+
const failed = attachmentSends.transfer(candidate_1, {
|
|
632
|
+
...candidate_1,
|
|
633
|
+
status: {
|
|
634
|
+
type: "incomplete",
|
|
635
|
+
reason: "error",
|
|
636
|
+
message: message_1
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
attachmentSends.markRemoved(failed);
|
|
640
|
+
return failed;
|
|
641
|
+
})
|
|
642
|
+
} : prev_2));
|
|
643
|
+
setSubmission((prev_3) => prev_3 ? {
|
|
644
|
+
...prev_3,
|
|
645
|
+
attachments: prev_3.attachments.filter((a_0) => a_0.id !== attachment_1.id)
|
|
646
|
+
} : prev_3);
|
|
647
|
+
};
|
|
648
|
+
$[33] = attachmentAdapter;
|
|
649
|
+
$[34] = setSubmission;
|
|
650
|
+
$[35] = t14;
|
|
651
|
+
} else t14 = $[35];
|
|
652
|
+
const handleRemoveSubmittedAttachment = t14;
|
|
653
|
+
let t15;
|
|
654
|
+
if ($[36] !== attachments || $[37] !== handleRemoveAttachment) {
|
|
655
|
+
let t16;
|
|
656
|
+
if ($[39] !== handleRemoveAttachment) {
|
|
657
|
+
t16 = (attachment_2) => withKey(attachment_2.id, AttachmentResource({
|
|
658
|
+
attachment: attachment_2,
|
|
659
|
+
onRemove: () => handleRemoveAttachment(attachment_2)
|
|
472
660
|
}));
|
|
473
|
-
$[
|
|
474
|
-
$[
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
$[
|
|
479
|
-
$[
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
661
|
+
$[39] = handleRemoveAttachment;
|
|
662
|
+
$[40] = t16;
|
|
663
|
+
} else t16 = $[40];
|
|
664
|
+
t15 = attachments.map(t16);
|
|
665
|
+
$[36] = attachments;
|
|
666
|
+
$[37] = handleRemoveAttachment;
|
|
667
|
+
$[38] = t15;
|
|
668
|
+
} else t15 = $[38];
|
|
669
|
+
const attachmentClients = useClientLookup(t15);
|
|
670
|
+
let t16;
|
|
671
|
+
if ($[41] !== attachments || $[42] !== handleRemoveSubmittedAttachment || $[43] !== submission?.attachments) {
|
|
672
|
+
let t17;
|
|
673
|
+
if ($[45] !== attachments) {
|
|
674
|
+
t17 = (attachment_3) => !attachments.some((a_1) => a_1.id === attachment_3.id);
|
|
675
|
+
$[45] = attachments;
|
|
676
|
+
$[46] = t17;
|
|
677
|
+
} else t17 = $[46];
|
|
678
|
+
let t18;
|
|
679
|
+
if ($[47] !== handleRemoveSubmittedAttachment) {
|
|
680
|
+
t18 = (attachment_4) => withKey(attachment_4.id, AttachmentResource({
|
|
681
|
+
attachment: attachment_4,
|
|
682
|
+
onRemove: () => handleRemoveSubmittedAttachment(attachment_4)
|
|
683
|
+
}));
|
|
684
|
+
$[47] = handleRemoveSubmittedAttachment;
|
|
685
|
+
$[48] = t18;
|
|
686
|
+
} else t18 = $[48];
|
|
687
|
+
t16 = (submission?.attachments ?? []).filter(t17).map(t18);
|
|
688
|
+
$[41] = attachments;
|
|
689
|
+
$[42] = handleRemoveSubmittedAttachment;
|
|
690
|
+
$[43] = submission?.attachments;
|
|
691
|
+
$[44] = t16;
|
|
692
|
+
} else t16 = $[44];
|
|
693
|
+
const submittedAttachmentClients = useClientLookup(t16);
|
|
694
|
+
let t17;
|
|
695
|
+
if ($[49] !== attachmentAdapter) {
|
|
696
|
+
t17 = async (removed) => {
|
|
487
697
|
if (!attachmentAdapter) return;
|
|
488
|
-
await Promise.all(removed.filter(
|
|
698
|
+
await Promise.all(removed.filter(_temp8).map(async (a_3) => attachmentAdapter.remove(a_3)));
|
|
489
699
|
};
|
|
490
|
-
$[
|
|
491
|
-
$[
|
|
492
|
-
} else
|
|
493
|
-
const removePendingAttachments =
|
|
494
|
-
let
|
|
495
|
-
if ($[
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
700
|
+
$[49] = attachmentAdapter;
|
|
701
|
+
$[50] = t17;
|
|
702
|
+
} else t17 = $[50];
|
|
703
|
+
const removePendingAttachments = t17;
|
|
704
|
+
let t18;
|
|
705
|
+
if ($[51] !== setAttachments || $[52] !== setSubmission || $[53] !== submissionRef) {
|
|
706
|
+
t18 = (attachment_5) => {
|
|
707
|
+
const current = submissionRef.current;
|
|
708
|
+
if (current?.attachments.some((a_5) => a_5.id === attachment_5.id)) {
|
|
709
|
+
setSubmission({
|
|
710
|
+
...current,
|
|
711
|
+
attachments: current.attachments.map((a_4) => a_4.id === attachment_5.id ? attachmentSends.transfer(a_4, attachment_5) : a_4)
|
|
712
|
+
});
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
setAttachments((prev_4) => {
|
|
716
|
+
const idx = prev_4.findIndex((a_6) => a_6.id === attachment_5.id);
|
|
717
|
+
if (idx === -1) return [...prev_4, attachment_5];
|
|
718
|
+
const next = [...prev_4];
|
|
719
|
+
next[idx] = attachment_5;
|
|
502
720
|
return next;
|
|
503
721
|
});
|
|
504
722
|
};
|
|
505
|
-
$[
|
|
506
|
-
$[
|
|
507
|
-
|
|
508
|
-
|
|
723
|
+
$[51] = setAttachments;
|
|
724
|
+
$[52] = setSubmission;
|
|
725
|
+
$[53] = submissionRef;
|
|
726
|
+
$[54] = t18;
|
|
727
|
+
} else t18 = $[54];
|
|
728
|
+
const upsertAttachment = t18;
|
|
509
729
|
const steerItems = queue?.steerItems ?? EMPTY_QUEUE_ITEMS;
|
|
510
730
|
const laneItems = queue?.items ?? EMPTY_QUEUE_ITEMS;
|
|
511
|
-
let
|
|
512
|
-
if ($[
|
|
513
|
-
|
|
514
|
-
$[
|
|
515
|
-
$[
|
|
516
|
-
$[
|
|
517
|
-
} else
|
|
518
|
-
const queueItems =
|
|
519
|
-
let
|
|
520
|
-
if ($[
|
|
521
|
-
let
|
|
522
|
-
if ($[
|
|
523
|
-
|
|
731
|
+
let t19;
|
|
732
|
+
if ($[55] !== laneItems || $[56] !== steerItems) {
|
|
733
|
+
t19 = steerItems.length === 0 ? laneItems : laneItems.length === 0 ? steerItems : [...steerItems, ...laneItems];
|
|
734
|
+
$[55] = laneItems;
|
|
735
|
+
$[56] = steerItems;
|
|
736
|
+
$[57] = t19;
|
|
737
|
+
} else t19 = $[57];
|
|
738
|
+
const queueItems = t19;
|
|
739
|
+
let t20;
|
|
740
|
+
if ($[58] !== queue || $[59] !== queueItems) {
|
|
741
|
+
let t21;
|
|
742
|
+
if ($[61] !== queue) {
|
|
743
|
+
t21 = (item) => withKey(item.id, QueueItemClient({
|
|
524
744
|
item,
|
|
525
745
|
onMove: (placement) => queue?.move(item.id, placement),
|
|
526
746
|
onRemove: () => queue?.remove(item.id)
|
|
527
747
|
}));
|
|
528
|
-
$[
|
|
529
|
-
$[
|
|
530
|
-
} else
|
|
531
|
-
|
|
532
|
-
$[
|
|
533
|
-
$[
|
|
534
|
-
$[
|
|
535
|
-
} else
|
|
536
|
-
const queueItemClients = useClientLookup(
|
|
537
|
-
let
|
|
538
|
-
if ($[
|
|
539
|
-
|
|
748
|
+
$[61] = queue;
|
|
749
|
+
$[62] = t21;
|
|
750
|
+
} else t21 = $[62];
|
|
751
|
+
t20 = queueItems.map(t21);
|
|
752
|
+
$[58] = queue;
|
|
753
|
+
$[59] = queueItems;
|
|
754
|
+
$[60] = t20;
|
|
755
|
+
} else t20 = $[60];
|
|
756
|
+
const queueItemClients = useClientLookup(t20);
|
|
757
|
+
let t21;
|
|
758
|
+
if ($[63] !== attachmentAdapter?.accept || $[64] !== attachmentClients.state || $[65] !== attachments.length || $[66] !== canCancel || $[67] !== inTransitSubmissions || $[68] !== isEditing || $[69] !== isSendDisabled || $[70] !== queueItems || $[71] !== quote || $[72] !== role || $[73] !== runConfig || $[74] !== submission || $[75] !== text || $[76] !== type) {
|
|
759
|
+
t21 = () => {
|
|
540
760
|
const isEmpty = !text.trim() && !attachments.length;
|
|
541
761
|
return {
|
|
542
762
|
text,
|
|
@@ -544,47 +764,248 @@ const useComposerClientResource = (t0) => {
|
|
|
544
764
|
attachments: attachmentClients.state,
|
|
545
765
|
runConfig,
|
|
546
766
|
isEditing,
|
|
547
|
-
canCancel,
|
|
548
|
-
canSend: isEditing && !isEmpty && !isSendDisabled,
|
|
767
|
+
canCancel: canCancel || submission !== void 0,
|
|
768
|
+
canSend: isEditing && !isEmpty && !isSendDisabled && submission === void 0,
|
|
549
769
|
attachmentAccept: attachmentAdapter?.accept ?? "*",
|
|
550
770
|
isEmpty,
|
|
551
771
|
type,
|
|
552
772
|
dictation: void 0,
|
|
553
773
|
quote,
|
|
554
|
-
queue: queueItems
|
|
774
|
+
queue: queueItems,
|
|
775
|
+
submission,
|
|
776
|
+
inTransit: inTransitSubmissions
|
|
555
777
|
};
|
|
556
778
|
};
|
|
557
|
-
$[
|
|
558
|
-
$[
|
|
559
|
-
$[
|
|
560
|
-
$[
|
|
561
|
-
$[
|
|
562
|
-
$[
|
|
563
|
-
$[
|
|
564
|
-
$[
|
|
565
|
-
$[
|
|
566
|
-
$[
|
|
567
|
-
$[
|
|
568
|
-
$[
|
|
569
|
-
$[
|
|
570
|
-
|
|
779
|
+
$[63] = attachmentAdapter?.accept;
|
|
780
|
+
$[64] = attachmentClients.state;
|
|
781
|
+
$[65] = attachments.length;
|
|
782
|
+
$[66] = canCancel;
|
|
783
|
+
$[67] = inTransitSubmissions;
|
|
784
|
+
$[68] = isEditing;
|
|
785
|
+
$[69] = isSendDisabled;
|
|
786
|
+
$[70] = queueItems;
|
|
787
|
+
$[71] = quote;
|
|
788
|
+
$[72] = role;
|
|
789
|
+
$[73] = runConfig;
|
|
790
|
+
$[74] = submission;
|
|
791
|
+
$[75] = text;
|
|
792
|
+
$[76] = type;
|
|
793
|
+
$[77] = t21;
|
|
794
|
+
} else t21 = $[77];
|
|
571
795
|
attachmentAdapter?.accept;
|
|
572
|
-
let
|
|
573
|
-
if ($[
|
|
574
|
-
|
|
575
|
-
$[
|
|
576
|
-
$[
|
|
577
|
-
} else
|
|
578
|
-
const state =
|
|
579
|
-
let
|
|
580
|
-
if ($[
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
796
|
+
let t22;
|
|
797
|
+
if ($[78] !== t21) {
|
|
798
|
+
t22 = t21();
|
|
799
|
+
$[78] = t21;
|
|
800
|
+
$[79] = t22;
|
|
801
|
+
} else t22 = $[79];
|
|
802
|
+
const state = t22;
|
|
803
|
+
let t23;
|
|
804
|
+
if ($[80] !== setSubmission) {
|
|
805
|
+
t23 = () => {
|
|
806
|
+
sendGeneration.current = sendGeneration.current + 1;
|
|
807
|
+
submissionSend.current = void 0;
|
|
808
|
+
setSubmission(void 0);
|
|
809
|
+
};
|
|
810
|
+
$[80] = setSubmission;
|
|
811
|
+
$[81] = t23;
|
|
812
|
+
} else t23 = $[81];
|
|
813
|
+
const endSubmission = t23;
|
|
814
|
+
let t24;
|
|
815
|
+
if ($[82] !== setAttachments || $[83] !== setQuote || $[84] !== setText || $[85] !== type) {
|
|
816
|
+
t24 = (content) => {
|
|
817
|
+
if (type !== "thread") {
|
|
818
|
+
const returned = new Map(content.attachments.map(_temp9));
|
|
819
|
+
setAttachments((prev_5) => prev_5.map((attachment_7) => returned.get(attachment_7.id) ?? attachment_7));
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
const kept = content.attachments.filter((attachment_8) => !attachmentSends.isRemoved(attachment_8));
|
|
823
|
+
setAttachments((prev_6) => [...kept, ...prev_6]);
|
|
824
|
+
setText((prev_7) => [content.text, prev_7].filter(Boolean).join("\n"));
|
|
825
|
+
setQuote((prev_8) => prev_8 ?? content.quote);
|
|
826
|
+
};
|
|
827
|
+
$[82] = setAttachments;
|
|
828
|
+
$[83] = setQuote;
|
|
829
|
+
$[84] = setText;
|
|
830
|
+
$[85] = type;
|
|
831
|
+
$[86] = t24;
|
|
832
|
+
} else t24 = $[86];
|
|
833
|
+
const returnToDraft = t24;
|
|
834
|
+
let t25;
|
|
835
|
+
if ($[87] !== endSubmission || $[88] !== returnToDraft || $[89] !== submissionRef) {
|
|
836
|
+
t25 = () => {
|
|
837
|
+
const current_0 = submissionRef.current;
|
|
838
|
+
if (!current_0) return;
|
|
839
|
+
submissionSend.current?.controller.abort();
|
|
840
|
+
endSubmission();
|
|
841
|
+
returnToDraft(current_0);
|
|
842
|
+
};
|
|
843
|
+
$[87] = endSubmission;
|
|
844
|
+
$[88] = returnToDraft;
|
|
845
|
+
$[89] = submissionRef;
|
|
846
|
+
$[90] = t25;
|
|
847
|
+
} else t25 = $[90];
|
|
848
|
+
const cancelSubmission = t25;
|
|
849
|
+
let t26;
|
|
850
|
+
if ($[91] !== attachmentsRef || $[92] !== endSubmission || $[93] !== removePendingAttachments || $[94] !== submissionRef) {
|
|
851
|
+
t26 = async () => {
|
|
852
|
+
const current_1 = submissionRef.current;
|
|
853
|
+
if (!current_1) return;
|
|
854
|
+
submissionSend.current?.controller.abort();
|
|
855
|
+
endSubmission();
|
|
856
|
+
const drafted = new Set(attachmentsRef.current.map(_temp0));
|
|
857
|
+
await removePendingAttachments(current_1.attachments.filter((attachment_9) => !drafted.has(attachment_9.id)));
|
|
858
|
+
};
|
|
859
|
+
$[91] = attachmentsRef;
|
|
860
|
+
$[92] = endSubmission;
|
|
861
|
+
$[93] = removePendingAttachments;
|
|
862
|
+
$[94] = submissionRef;
|
|
863
|
+
$[95] = t26;
|
|
864
|
+
} else t26 = $[95];
|
|
865
|
+
const discardSubmission = t26;
|
|
866
|
+
let t27;
|
|
867
|
+
if ($[96] !== endSubmission || $[97] !== returnToDraft || $[98] !== submissionRef) {
|
|
868
|
+
t27 = (sent, settled, reason) => {
|
|
869
|
+
const current_2 = submissionRef.current;
|
|
870
|
+
if (!current_2) return;
|
|
871
|
+
const failures = /* @__PURE__ */ new Map();
|
|
872
|
+
settled.forEach((result, index) => {
|
|
873
|
+
if (result.status === "rejected") failures.set(sent[index].id, result.reason);
|
|
874
|
+
});
|
|
875
|
+
const attachments_0 = current_2.attachments.map((attachment_10) => {
|
|
876
|
+
if (!failures.has(attachment_10.id) || isAttachmentComplete(attachment_10)) return attachment_10;
|
|
877
|
+
const failure = failures.get(attachment_10.id);
|
|
878
|
+
return attachmentSends.transfer(attachment_10, {
|
|
879
|
+
...attachment_10,
|
|
880
|
+
status: {
|
|
881
|
+
type: "incomplete",
|
|
882
|
+
reason: "error",
|
|
883
|
+
message: failure instanceof Error ? failure.message : String(failure)
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
});
|
|
887
|
+
endSubmission();
|
|
888
|
+
returnToDraft({
|
|
889
|
+
...current_2,
|
|
890
|
+
attachments: attachments_0
|
|
891
|
+
});
|
|
892
|
+
console.error("Failed to send attachments", reason);
|
|
893
|
+
};
|
|
894
|
+
$[96] = endSubmission;
|
|
895
|
+
$[97] = returnToDraft;
|
|
896
|
+
$[98] = submissionRef;
|
|
897
|
+
$[99] = t27;
|
|
898
|
+
} else t27 = $[99];
|
|
899
|
+
const returnSubmissionToDraft = t27;
|
|
900
|
+
let t28;
|
|
901
|
+
if ($[100] !== isRunning || $[101] !== onSend || $[102] !== queue || $[103] !== returnToDraft || $[104] !== setAttachments || $[105] !== setInTransit || $[106] !== setIsEditing || $[107] !== setSubmission || $[108] !== type) {
|
|
902
|
+
t28 = (current_3, attachments_1, context, isSubmission) => {
|
|
903
|
+
const composedMessage = {
|
|
904
|
+
role: current_3.role,
|
|
905
|
+
content: current_3.text ? [{
|
|
906
|
+
type: "text",
|
|
907
|
+
text: current_3.text
|
|
908
|
+
}] : [],
|
|
909
|
+
attachments: attachments_1,
|
|
910
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
911
|
+
parentId: null,
|
|
912
|
+
sourceId: null,
|
|
913
|
+
runConfig: context.runConfig,
|
|
914
|
+
startRun: context.options?.startRun,
|
|
915
|
+
metadata: { custom: { ...current_3.quote ? { quote: current_3.quote } : {} } }
|
|
916
|
+
};
|
|
917
|
+
const sent_0 = {
|
|
918
|
+
...current_3,
|
|
919
|
+
attachments: attachments_1
|
|
920
|
+
};
|
|
921
|
+
const queued = queue && type === "thread";
|
|
922
|
+
if (isSubmission) {
|
|
923
|
+
submissionSend.current = void 0;
|
|
924
|
+
setSubmission(void 0);
|
|
925
|
+
}
|
|
926
|
+
if (isSubmission && type !== "thread") {
|
|
927
|
+
const delivered = new Map(attachments_1.map(_temp1));
|
|
928
|
+
setAttachments((prev_9) => prev_9.map((attachment_12) => delivered.get(attachment_12.id) ?? attachment_12));
|
|
929
|
+
}
|
|
930
|
+
const entry_4 = isSubmission && type === "thread" && !queued ? {
|
|
931
|
+
submission: sent_0,
|
|
932
|
+
known: new Set(messageKeysRef.current)
|
|
933
|
+
} : void 0;
|
|
934
|
+
if (entry_4) setInTransit((prev_10) => [...prev_10, entry_4]);
|
|
935
|
+
const failure_0 = dispatchSafely(() => {
|
|
936
|
+
if (queued) {
|
|
937
|
+
if (context.options?.steer ?? isRunning) queue.steer(composedMessage);
|
|
938
|
+
else queue.enqueue(composedMessage);
|
|
939
|
+
} else onSend?.(composedMessage);
|
|
940
|
+
});
|
|
941
|
+
if (failure_0) {
|
|
942
|
+
console.error("[assistant-ui] Failed to send the message", failure_0.error);
|
|
943
|
+
if (entry_4) setInTransit((prev_11) => prev_11.filter((candidate_2) => candidate_2 !== entry_4));
|
|
944
|
+
returnToDraft(sent_0);
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
947
|
+
if (type === "edit") {
|
|
948
|
+
attachmentAddOperations.cancelAll();
|
|
949
|
+
setIsEditing(false);
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
$[100] = isRunning;
|
|
953
|
+
$[101] = onSend;
|
|
954
|
+
$[102] = queue;
|
|
955
|
+
$[103] = returnToDraft;
|
|
956
|
+
$[104] = setAttachments;
|
|
957
|
+
$[105] = setInTransit;
|
|
958
|
+
$[106] = setIsEditing;
|
|
959
|
+
$[107] = setSubmission;
|
|
960
|
+
$[108] = type;
|
|
961
|
+
$[109] = t28;
|
|
962
|
+
} else t28 = $[109];
|
|
963
|
+
const dispatchMessage = t28;
|
|
964
|
+
let t29;
|
|
965
|
+
if ($[110] !== attachmentAdapter || $[111] !== dispatchMessage || $[112] !== returnSubmissionToDraft || $[113] !== submissionRef) {
|
|
966
|
+
t29 = async (generation) => {
|
|
967
|
+
const context_0 = submissionSend.current;
|
|
968
|
+
if (!context_0) return;
|
|
969
|
+
const { signal } = context_0.controller;
|
|
970
|
+
if (signal.aborted) return;
|
|
971
|
+
const uploads = (submissionRef.current?.attachments ?? []).flatMap((attachment_13) => {
|
|
972
|
+
const upload = attachmentAddOperations.whenSendable(attachment_13.id);
|
|
973
|
+
return upload ? [upload] : [];
|
|
974
|
+
});
|
|
975
|
+
if (uploads.length > 0) {
|
|
976
|
+
await Promise.all(uploads);
|
|
977
|
+
if (generation !== sendGeneration.current || signal.aborted) return;
|
|
978
|
+
}
|
|
979
|
+
const current_4 = submissionRef.current;
|
|
980
|
+
if (!current_4) return;
|
|
981
|
+
const sent_1 = current_4.attachments.filter((attachment_14) => !attachmentSends.isRemoved(attachment_14));
|
|
982
|
+
for (const attachment_15 of sent_1) attachmentAddOperations.cancel(attachment_15.id);
|
|
983
|
+
const settled_0 = await Promise.allSettled(sent_1.map((attachment_16) => attachmentSends.send(attachment_16, attachmentAdapter, signal)));
|
|
984
|
+
if (generation !== sendGeneration.current || signal.aborted) return;
|
|
985
|
+
const rejection = settled_0.find(_temp10);
|
|
986
|
+
if (rejection) {
|
|
987
|
+
returnSubmissionToDraft(sent_1, settled_0, rejection.reason);
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
const finalAttachments = settled_0.flatMap((result_1, index_0) => attachmentSends.isRemoved(sent_1[index_0]) || result_1.status === "rejected" ? [] : [result_1.value]);
|
|
991
|
+
dispatchMessage(submissionRef.current ?? current_4, finalAttachments, context_0, true);
|
|
992
|
+
};
|
|
993
|
+
$[110] = attachmentAdapter;
|
|
994
|
+
$[111] = dispatchMessage;
|
|
995
|
+
$[112] = returnSubmissionToDraft;
|
|
996
|
+
$[113] = submissionRef;
|
|
997
|
+
$[114] = t29;
|
|
998
|
+
} else t29 = $[114];
|
|
999
|
+
const prepareSubmission = t29;
|
|
1000
|
+
let t30;
|
|
1001
|
+
if ($[115] !== state) {
|
|
1002
|
+
t30 = () => state;
|
|
1003
|
+
$[115] = state;
|
|
1004
|
+
$[116] = t30;
|
|
1005
|
+
} else t30 = $[116];
|
|
1006
|
+
let t31;
|
|
1007
|
+
if ($[117] !== attachmentAdapter || $[118] !== setAttachments || $[119] !== upsertAttachment) {
|
|
1008
|
+
t31 = async (fileOrAttachment) => {
|
|
588
1009
|
if (attachmentAdapter) {
|
|
589
1010
|
const file = isCreateAttachment(fileOrAttachment) ? {
|
|
590
1011
|
name: fileOrAttachment.name,
|
|
@@ -598,14 +1019,14 @@ const useComposerClientResource = (t0) => {
|
|
|
598
1019
|
if (!isCreateAttachment(fileOrAttachment) && attachmentAdapter) {
|
|
599
1020
|
const operation = attachmentAddOperations.start();
|
|
600
1021
|
try {
|
|
601
|
-
await drainAttachmentAdd(attachmentAdapter.add({ file: fileOrAttachment }), (
|
|
602
|
-
if (!attachmentAddOperations.accept(operation,
|
|
603
|
-
upsertAttachment(
|
|
1022
|
+
await drainAttachmentAdd(attachmentAdapter.add({ file: fileOrAttachment }), (attachment_17) => {
|
|
1023
|
+
if (!attachmentAddOperations.accept(operation, attachment_17)) return false;
|
|
1024
|
+
upsertAttachment(attachment_17);
|
|
604
1025
|
return true;
|
|
605
1026
|
});
|
|
606
1027
|
attachmentAddOperations.finish(operation);
|
|
607
|
-
} catch (
|
|
608
|
-
const error =
|
|
1028
|
+
} catch (t32) {
|
|
1029
|
+
const error = t32;
|
|
609
1030
|
attachmentAddOperations.finish(operation);
|
|
610
1031
|
if (!attachmentAddOperations.isCancelled(operation)) throw error;
|
|
611
1032
|
}
|
|
@@ -619,7 +1040,7 @@ const useComposerClientResource = (t0) => {
|
|
|
619
1040
|
status: { type: "complete" },
|
|
620
1041
|
content: []
|
|
621
1042
|
};
|
|
622
|
-
setAttachments((
|
|
1043
|
+
setAttachments((prev_12) => [...prev_12, newAttachment]);
|
|
623
1044
|
} else {
|
|
624
1045
|
const newAttachment_0 = {
|
|
625
1046
|
id: fileOrAttachment.id ?? generateId(),
|
|
@@ -629,199 +1050,220 @@ const useComposerClientResource = (t0) => {
|
|
|
629
1050
|
content: fileOrAttachment.content,
|
|
630
1051
|
status: { type: "complete" }
|
|
631
1052
|
};
|
|
632
|
-
setAttachments((
|
|
1053
|
+
setAttachments((prev_13) => [...prev_13, newAttachment_0]);
|
|
633
1054
|
}
|
|
634
1055
|
};
|
|
635
|
-
$[
|
|
636
|
-
$[
|
|
637
|
-
$[
|
|
638
|
-
$[
|
|
639
|
-
} else
|
|
640
|
-
let
|
|
641
|
-
if ($[
|
|
642
|
-
|
|
1056
|
+
$[117] = attachmentAdapter;
|
|
1057
|
+
$[118] = setAttachments;
|
|
1058
|
+
$[119] = upsertAttachment;
|
|
1059
|
+
$[120] = t31;
|
|
1060
|
+
} else t31 = $[120];
|
|
1061
|
+
let t32;
|
|
1062
|
+
if ($[121] !== attachmentsRef || $[122] !== removePendingAttachments || $[123] !== setAttachments || $[124] !== submissionRef) {
|
|
1063
|
+
t32 = async () => {
|
|
643
1064
|
attachmentAddOperations.cancelAll();
|
|
644
1065
|
const removed_0 = attachmentsRef.current;
|
|
1066
|
+
if (submissionRef.current) for (const attachment_18 of removed_0) attachmentSends.markRemoved(attachment_18);
|
|
645
1067
|
setAttachments([]);
|
|
646
1068
|
await removePendingAttachments(removed_0);
|
|
647
1069
|
};
|
|
648
|
-
$[
|
|
649
|
-
$[
|
|
650
|
-
$[
|
|
651
|
-
$[
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
1070
|
+
$[121] = attachmentsRef;
|
|
1071
|
+
$[122] = removePendingAttachments;
|
|
1072
|
+
$[123] = setAttachments;
|
|
1073
|
+
$[124] = submissionRef;
|
|
1074
|
+
$[125] = t32;
|
|
1075
|
+
} else t32 = $[125];
|
|
1076
|
+
let t33;
|
|
1077
|
+
if ($[126] !== attachmentClients || $[127] !== attachments || $[128] !== submission?.attachments || $[129] !== submittedAttachmentClients) {
|
|
1078
|
+
t33 = (selector) => {
|
|
1079
|
+
if ("id" in selector) {
|
|
1080
|
+
const submitted = submission?.attachments.some((attachment_19) => attachment_19.id === selector.id);
|
|
1081
|
+
const inDraft = attachments.some((attachment_20) => attachment_20.id === selector.id);
|
|
1082
|
+
if (submitted && !inDraft) return submittedAttachmentClients.get({ key: selector.id });
|
|
1083
|
+
return attachmentClients.get({ key: selector.id });
|
|
1084
|
+
}
|
|
657
1085
|
return attachmentClients.get(selector);
|
|
658
1086
|
};
|
|
659
|
-
$[
|
|
660
|
-
$[
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
1087
|
+
$[126] = attachmentClients;
|
|
1088
|
+
$[127] = attachments;
|
|
1089
|
+
$[128] = submission?.attachments;
|
|
1090
|
+
$[129] = submittedAttachmentClients;
|
|
1091
|
+
$[130] = t33;
|
|
1092
|
+
} else t33 = $[130];
|
|
1093
|
+
let t34;
|
|
1094
|
+
if ($[131] !== attachmentsRef || $[132] !== discardSubmission || $[133] !== removePendingAttachments || $[134] !== setAttachments || $[135] !== setQuote || $[136] !== setRole || $[137] !== setRunConfig || $[138] !== setText) {
|
|
1095
|
+
t34 = async () => {
|
|
665
1096
|
attachmentAddOperations.cancelAll();
|
|
1097
|
+
sendGeneration.current = sendGeneration.current + 1;
|
|
1098
|
+
const discarded = discardSubmission();
|
|
666
1099
|
const removed_1 = attachmentsRef.current;
|
|
667
1100
|
setText("");
|
|
668
1101
|
setRole("user");
|
|
669
1102
|
setRunConfig({});
|
|
670
1103
|
setAttachments([]);
|
|
671
1104
|
setQuote(void 0);
|
|
672
|
-
await removePendingAttachments(removed_1);
|
|
1105
|
+
await Promise.all([removePendingAttachments(removed_1), discarded]);
|
|
673
1106
|
};
|
|
674
|
-
$[
|
|
675
|
-
$[
|
|
676
|
-
$[
|
|
677
|
-
$[
|
|
678
|
-
$[
|
|
679
|
-
$[
|
|
680
|
-
$[
|
|
681
|
-
$[
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
const
|
|
688
|
-
const
|
|
689
|
-
const currentRunConfig = runConfigRef.current;
|
|
690
|
-
const currentAttachments = attachmentsRef.current;
|
|
691
|
-
const isEmpty_0 = !currentText.trim() && !currentAttachments.length;
|
|
1107
|
+
$[131] = attachmentsRef;
|
|
1108
|
+
$[132] = discardSubmission;
|
|
1109
|
+
$[133] = removePendingAttachments;
|
|
1110
|
+
$[134] = setAttachments;
|
|
1111
|
+
$[135] = setQuote;
|
|
1112
|
+
$[136] = setRole;
|
|
1113
|
+
$[137] = setRunConfig;
|
|
1114
|
+
$[138] = setText;
|
|
1115
|
+
$[139] = t34;
|
|
1116
|
+
} else t34 = $[139];
|
|
1117
|
+
let t35;
|
|
1118
|
+
if ($[140] !== attachmentsRef || $[141] !== destroySignal || $[142] !== dispatchMessage || $[143] !== isEditingRef || $[144] !== isSendDisabled || $[145] !== prepareSubmission || $[146] !== quoteRef || $[147] !== roleRef || $[148] !== runConfigRef || $[149] !== setAttachments || $[150] !== setQuote || $[151] !== setSubmission || $[152] !== setText || $[153] !== submissionRef || $[154] !== textRef || $[155] !== type) {
|
|
1119
|
+
t35 = (opts) => {
|
|
1120
|
+
const currentAttachments = attachmentsRef.current.filter((attachment_21) => !attachmentSends.isRemoved(attachment_21));
|
|
1121
|
+
const isEmpty_0 = !textRef.current.trim() && !currentAttachments.length;
|
|
692
1122
|
if (!isEditingRef.current) throw new Error("Composer is not available");
|
|
693
|
-
if (isEmpty_0 || isSendDisabled) return;
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
role: currentRole,
|
|
701
|
-
content: currentText ? [{
|
|
702
|
-
type: "text",
|
|
703
|
-
text: currentText
|
|
704
|
-
}] : [],
|
|
705
|
-
attachments: sendAttachments,
|
|
706
|
-
createdAt: /* @__PURE__ */ new Date(),
|
|
707
|
-
parentId: null,
|
|
708
|
-
sourceId: null,
|
|
709
|
-
runConfig: currentRunConfig,
|
|
710
|
-
startRun: opts?.startRun,
|
|
711
|
-
metadata: { custom: { ...currentQuote ? { quote: currentQuote } : {} } }
|
|
712
|
-
};
|
|
713
|
-
if (queue && type === "thread") {
|
|
714
|
-
if (opts?.steer ?? isRunning) queue.steer(composedMessage);
|
|
715
|
-
else queue.enqueue(composedMessage);
|
|
716
|
-
} else onSend?.(composedMessage);
|
|
717
|
-
if (type === "edit") setIsEditing(false);
|
|
1123
|
+
if (isEmpty_0 || isSendDisabled || submissionRef.current) return;
|
|
1124
|
+
const submitted_0 = {
|
|
1125
|
+
id: generateId(),
|
|
1126
|
+
role: roleRef.current,
|
|
1127
|
+
text: textRef.current,
|
|
1128
|
+
quote: quoteRef.current,
|
|
1129
|
+
attachments: currentAttachments
|
|
718
1130
|
};
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
1131
|
+
const context_1 = {
|
|
1132
|
+
options: opts,
|
|
1133
|
+
runConfig: runConfigRef.current
|
|
1134
|
+
};
|
|
1135
|
+
const complete = currentAttachments.filter(isAttachmentComplete);
|
|
1136
|
+
const controller = complete.length === currentAttachments.length ? void 0 : new AbortController();
|
|
1137
|
+
if (controller) {
|
|
1138
|
+
submissionSend.current = {
|
|
1139
|
+
...context_1,
|
|
1140
|
+
controller
|
|
1141
|
+
};
|
|
1142
|
+
setSubmission(submitted_0);
|
|
1143
|
+
}
|
|
1144
|
+
if (type === "thread") {
|
|
1145
|
+
const detached = new Set(currentAttachments);
|
|
1146
|
+
setAttachments((prev_14) => prev_14.filter((attachment_22) => !detached.has(attachment_22)));
|
|
1147
|
+
setText("");
|
|
1148
|
+
setQuote(void 0);
|
|
1149
|
+
}
|
|
1150
|
+
const generation_0 = sendGeneration.current = sendGeneration.current + 1;
|
|
1151
|
+
if (!controller) {
|
|
1152
|
+
dispatchMessage(submitted_0, complete, context_1, false);
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1155
|
+
const release = abortOnDestroy(destroySignal, controller);
|
|
1156
|
+
prepareSubmission(generation_0).finally(release);
|
|
726
1157
|
};
|
|
727
|
-
$[
|
|
728
|
-
$[
|
|
729
|
-
$[
|
|
730
|
-
$[
|
|
731
|
-
$[
|
|
732
|
-
$[
|
|
733
|
-
$[
|
|
734
|
-
$[
|
|
735
|
-
$[
|
|
736
|
-
$[
|
|
737
|
-
$[
|
|
738
|
-
$[
|
|
739
|
-
$[
|
|
740
|
-
$[
|
|
741
|
-
$[
|
|
742
|
-
$[
|
|
743
|
-
$[
|
|
744
|
-
} else
|
|
745
|
-
let
|
|
746
|
-
if ($[
|
|
747
|
-
|
|
1158
|
+
$[140] = attachmentsRef;
|
|
1159
|
+
$[141] = destroySignal;
|
|
1160
|
+
$[142] = dispatchMessage;
|
|
1161
|
+
$[143] = isEditingRef;
|
|
1162
|
+
$[144] = isSendDisabled;
|
|
1163
|
+
$[145] = prepareSubmission;
|
|
1164
|
+
$[146] = quoteRef;
|
|
1165
|
+
$[147] = roleRef;
|
|
1166
|
+
$[148] = runConfigRef;
|
|
1167
|
+
$[149] = setAttachments;
|
|
1168
|
+
$[150] = setQuote;
|
|
1169
|
+
$[151] = setSubmission;
|
|
1170
|
+
$[152] = setText;
|
|
1171
|
+
$[153] = submissionRef;
|
|
1172
|
+
$[154] = textRef;
|
|
1173
|
+
$[155] = type;
|
|
1174
|
+
$[156] = t35;
|
|
1175
|
+
} else t35 = $[156];
|
|
1176
|
+
let t36;
|
|
1177
|
+
if ($[157] !== attachmentsRef || $[158] !== canCancel || $[159] !== cancelSubmission || $[160] !== discardSubmission || $[161] !== onCancel || $[162] !== removePendingAttachments || $[163] !== setAttachments || $[164] !== setIsEditing || $[165] !== submissionRef || $[166] !== type) {
|
|
1178
|
+
t36 = () => {
|
|
1179
|
+
if (type === "thread" && submissionRef.current) {
|
|
1180
|
+
cancelSubmission();
|
|
1181
|
+
if (canCancel) onCancel?.();
|
|
1182
|
+
return;
|
|
1183
|
+
}
|
|
748
1184
|
if (type === "edit") {
|
|
749
1185
|
attachmentAddOperations.cancelAll();
|
|
1186
|
+
sendGeneration.current = sendGeneration.current + 1;
|
|
1187
|
+
discardSubmission();
|
|
750
1188
|
const removed_2 = attachmentsRef.current;
|
|
751
1189
|
setAttachments([]);
|
|
752
|
-
removePendingAttachments(removed_2).catch(
|
|
1190
|
+
removePendingAttachments(removed_2).catch(_temp11);
|
|
753
1191
|
}
|
|
754
1192
|
onCancel?.();
|
|
755
1193
|
if (type === "edit") setIsEditing(false);
|
|
756
1194
|
};
|
|
757
|
-
$[
|
|
758
|
-
$[
|
|
759
|
-
$[
|
|
760
|
-
$[
|
|
761
|
-
$[
|
|
762
|
-
$[
|
|
763
|
-
$[
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
1195
|
+
$[157] = attachmentsRef;
|
|
1196
|
+
$[158] = canCancel;
|
|
1197
|
+
$[159] = cancelSubmission;
|
|
1198
|
+
$[160] = discardSubmission;
|
|
1199
|
+
$[161] = onCancel;
|
|
1200
|
+
$[162] = removePendingAttachments;
|
|
1201
|
+
$[163] = setAttachments;
|
|
1202
|
+
$[164] = setIsEditing;
|
|
1203
|
+
$[165] = submissionRef;
|
|
1204
|
+
$[166] = type;
|
|
1205
|
+
$[167] = t36;
|
|
1206
|
+
} else t36 = $[167];
|
|
1207
|
+
let t37;
|
|
1208
|
+
if ($[168] !== isEditingRef || $[169] !== onBeginEdit || $[170] !== setIsEditing || $[171] !== type || $[172] !== updateFromMessage) {
|
|
1209
|
+
t37 = () => {
|
|
768
1210
|
onBeginEdit?.();
|
|
769
1211
|
if (type === "thread") return;
|
|
770
1212
|
if (isEditingRef.current) throw new Error("Edit already in progress");
|
|
771
1213
|
setIsEditing(true);
|
|
772
1214
|
updateFromMessage();
|
|
773
1215
|
};
|
|
774
|
-
$[
|
|
775
|
-
$[
|
|
776
|
-
$[
|
|
777
|
-
$[
|
|
778
|
-
$[
|
|
779
|
-
$[
|
|
780
|
-
} else
|
|
781
|
-
let
|
|
782
|
-
if ($[
|
|
783
|
-
|
|
1216
|
+
$[168] = isEditingRef;
|
|
1217
|
+
$[169] = onBeginEdit;
|
|
1218
|
+
$[170] = setIsEditing;
|
|
1219
|
+
$[171] = type;
|
|
1220
|
+
$[172] = updateFromMessage;
|
|
1221
|
+
$[173] = t37;
|
|
1222
|
+
} else t37 = $[173];
|
|
1223
|
+
let t38;
|
|
1224
|
+
if ($[174] !== queueItemClients) {
|
|
1225
|
+
t38 = (selector_0) => {
|
|
784
1226
|
if ("id" in selector_0) return queueItemClients.get({ key: selector_0.id });
|
|
785
1227
|
return queueItemClients.get(selector_0);
|
|
786
1228
|
};
|
|
787
|
-
$[
|
|
788
|
-
$[
|
|
789
|
-
} else
|
|
790
|
-
let
|
|
791
|
-
if ($[
|
|
792
|
-
|
|
793
|
-
getState:
|
|
1229
|
+
$[174] = queueItemClients;
|
|
1230
|
+
$[175] = t38;
|
|
1231
|
+
} else t38 = $[175];
|
|
1232
|
+
let t39;
|
|
1233
|
+
if ($[176] !== setQuote || $[177] !== setRole || $[178] !== setRunConfig || $[179] !== setText || $[180] !== t30 || $[181] !== t31 || $[182] !== t32 || $[183] !== t33 || $[184] !== t34 || $[185] !== t35 || $[186] !== t36 || $[187] !== t37 || $[188] !== t38) {
|
|
1234
|
+
t39 = {
|
|
1235
|
+
getState: t30,
|
|
794
1236
|
setText,
|
|
795
1237
|
setRole,
|
|
796
1238
|
setRunConfig,
|
|
797
|
-
addAttachment:
|
|
798
|
-
clearAttachments:
|
|
799
|
-
attachment:
|
|
800
|
-
reset:
|
|
801
|
-
send:
|
|
802
|
-
cancel:
|
|
803
|
-
beginEdit:
|
|
804
|
-
startDictation:
|
|
805
|
-
stopDictation:
|
|
1239
|
+
addAttachment: t31,
|
|
1240
|
+
clearAttachments: t32,
|
|
1241
|
+
attachment: t33,
|
|
1242
|
+
reset: t34,
|
|
1243
|
+
send: t35,
|
|
1244
|
+
cancel: t36,
|
|
1245
|
+
beginEdit: t37,
|
|
1246
|
+
startDictation: _temp12,
|
|
1247
|
+
stopDictation: _temp13,
|
|
806
1248
|
setQuote,
|
|
807
|
-
queueItem:
|
|
1249
|
+
queueItem: t38
|
|
808
1250
|
};
|
|
809
|
-
$[
|
|
810
|
-
$[
|
|
811
|
-
$[
|
|
812
|
-
$[
|
|
813
|
-
$[
|
|
814
|
-
$[
|
|
815
|
-
$[
|
|
816
|
-
$[
|
|
817
|
-
$[
|
|
818
|
-
$[
|
|
819
|
-
$[
|
|
820
|
-
$[
|
|
821
|
-
$[
|
|
822
|
-
$[
|
|
823
|
-
} else
|
|
824
|
-
return
|
|
1251
|
+
$[176] = setQuote;
|
|
1252
|
+
$[177] = setRole;
|
|
1253
|
+
$[178] = setRunConfig;
|
|
1254
|
+
$[179] = setText;
|
|
1255
|
+
$[180] = t30;
|
|
1256
|
+
$[181] = t31;
|
|
1257
|
+
$[182] = t32;
|
|
1258
|
+
$[183] = t33;
|
|
1259
|
+
$[184] = t34;
|
|
1260
|
+
$[185] = t35;
|
|
1261
|
+
$[186] = t36;
|
|
1262
|
+
$[187] = t37;
|
|
1263
|
+
$[188] = t38;
|
|
1264
|
+
$[189] = t39;
|
|
1265
|
+
} else t39 = $[189];
|
|
1266
|
+
return t39;
|
|
825
1267
|
};
|
|
826
1268
|
const ComposerClientResource = resource(useComposerClientResource);
|
|
827
1269
|
const createSpeechController = (notify) => {
|
|
@@ -890,8 +1332,8 @@ const dedupeMessagesById = (messages) => {
|
|
|
890
1332
|
return deduped.length === messages.length ? messages : deduped.reverse();
|
|
891
1333
|
};
|
|
892
1334
|
const useExternalThread = (t0) => {
|
|
893
|
-
const $ = c(
|
|
894
|
-
const { messages: messagesProp, isRunning: t1, isLoading: t2, state: threadState, extras, isSendDisabled: t3, onNew, onEdit, onReload, onStartRun, onCancel, onResume, onRefetchThread, onAddToolResult, onResumeToolCall, onLoadExternalState, attachmentAdapter, feedbackAdapter, speechAdapter, queue, branches, onRespondToToolApproval } = t0;
|
|
1335
|
+
const $ = c(146);
|
|
1336
|
+
const { messages: messagesProp, isRunning: t1, isLoading: t2, state: threadState, extras, isSendDisabled: t3, onNew, onEdit, onReload, onStartRun, onCancel, onResume, onRefetchThread, onAddToolResult, onResumeToolCall, unstable_onRecordToolInteraction, onLoadExternalState, attachmentAdapter, feedbackAdapter, speechAdapter, queue, branches, onRespondToToolApproval } = t0;
|
|
895
1337
|
const isRunning = t1 === void 0 ? false : t1;
|
|
896
1338
|
const isLoading = t2 === void 0 ? false : t2;
|
|
897
1339
|
const isSendDisabled = t3 === void 0 ? false : t3;
|
|
@@ -1028,146 +1470,209 @@ const useExternalThread = (t0) => {
|
|
|
1028
1470
|
} else t16 = $[23];
|
|
1029
1471
|
const handleReload = t16;
|
|
1030
1472
|
let t17;
|
|
1031
|
-
if ($[24] !==
|
|
1032
|
-
t17 = messages.map(
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
onReload: () => handleReload(msg_1.id),
|
|
1038
|
-
queue,
|
|
1039
|
-
branches,
|
|
1040
|
-
onRespondToToolApproval,
|
|
1041
|
-
onAddToolResult,
|
|
1042
|
-
onResumeToolCall,
|
|
1043
|
-
attachmentAdapter,
|
|
1044
|
-
submittedFeedback: feedbackFor(msg_1),
|
|
1045
|
-
onSubmitFeedback: (feedback_0) => handleSubmitFeedback(msg_1, feedback_0),
|
|
1046
|
-
speech: speech?.messageId === msg_1.id ? speech : void 0,
|
|
1047
|
-
onSpeak: () => handleSpeak(msg_1),
|
|
1048
|
-
onStopSpeaking: () => speechController.stopMessage(msg_1.id)
|
|
1049
|
-
};
|
|
1050
|
-
if (onEdit) props.onEdit = onEdit;
|
|
1051
|
-
return withKey(msg_1.id, MessageClient(props));
|
|
1052
|
-
});
|
|
1053
|
-
$[24] = attachmentAdapter;
|
|
1054
|
-
$[25] = branches;
|
|
1055
|
-
$[26] = feedbackFor;
|
|
1056
|
-
$[27] = handleReload;
|
|
1057
|
-
$[28] = handleSpeak;
|
|
1058
|
-
$[29] = handleSubmitFeedback;
|
|
1059
|
-
$[30] = messages;
|
|
1060
|
-
$[31] = onAddToolResult;
|
|
1061
|
-
$[32] = onEdit;
|
|
1062
|
-
$[33] = onRespondToToolApproval;
|
|
1063
|
-
$[34] = onResumeToolCall;
|
|
1064
|
-
$[35] = queue;
|
|
1065
|
-
$[36] = speech;
|
|
1066
|
-
$[37] = speechController;
|
|
1067
|
-
$[38] = t17;
|
|
1068
|
-
} else t17 = $[38];
|
|
1069
|
-
const messageClients = useClientLookup(t17);
|
|
1473
|
+
if ($[24] !== messages) {
|
|
1474
|
+
t17 = messages.map(_temp14);
|
|
1475
|
+
$[24] = messages;
|
|
1476
|
+
$[25] = t17;
|
|
1477
|
+
} else t17 = $[25];
|
|
1478
|
+
const messageKeys = t17;
|
|
1070
1479
|
let t18;
|
|
1071
|
-
if ($[
|
|
1072
|
-
t18 =
|
|
1073
|
-
$[39] = t18;
|
|
1074
|
-
} else t18 = $[39];
|
|
1075
|
-
const taskDeriver = t18;
|
|
1076
|
-
let t19;
|
|
1077
|
-
if ($[40] !== messages) {
|
|
1078
|
-
t19 = taskDeriver(messages);
|
|
1079
|
-
$[40] = messages;
|
|
1080
|
-
$[41] = t19;
|
|
1081
|
-
} else t19 = $[41];
|
|
1082
|
-
const tasks = t19;
|
|
1083
|
-
let t20;
|
|
1084
|
-
if ($[42] !== tasks) {
|
|
1085
|
-
t20 = tasks.map(_temp0);
|
|
1086
|
-
$[42] = tasks;
|
|
1087
|
-
$[43] = t20;
|
|
1088
|
-
} else t20 = $[43];
|
|
1089
|
-
const taskClients = useClientLookup(t20);
|
|
1090
|
-
let t21;
|
|
1091
|
-
if ($[44] !== onCancel || $[45] !== queue) {
|
|
1092
|
-
t21 = () => {
|
|
1480
|
+
if ($[26] !== onCancel || $[27] !== queue) {
|
|
1481
|
+
t18 = () => {
|
|
1093
1482
|
if (!onCancel) return;
|
|
1094
1483
|
queue?.__internal_notifyCancelled?.();
|
|
1095
1484
|
onCancel();
|
|
1096
1485
|
};
|
|
1097
|
-
$[
|
|
1098
|
-
$[
|
|
1099
|
-
$[
|
|
1100
|
-
} else
|
|
1101
|
-
const handleCancelRun =
|
|
1102
|
-
let
|
|
1103
|
-
if ($[
|
|
1104
|
-
|
|
1486
|
+
$[26] = onCancel;
|
|
1487
|
+
$[27] = queue;
|
|
1488
|
+
$[28] = t18;
|
|
1489
|
+
} else t18 = $[28];
|
|
1490
|
+
const handleCancelRun = t18;
|
|
1491
|
+
let t19;
|
|
1492
|
+
if ($[29] !== messages || $[30] !== onNew) {
|
|
1493
|
+
t19 = (message_2) => {
|
|
1105
1494
|
onNew?.({
|
|
1106
|
-
...
|
|
1495
|
+
...message_2,
|
|
1107
1496
|
parentId: messages.at(-1)?.id ?? null
|
|
1108
1497
|
});
|
|
1109
1498
|
};
|
|
1110
|
-
$[
|
|
1111
|
-
$[
|
|
1112
|
-
$[
|
|
1113
|
-
} else
|
|
1114
|
-
const handleSendNew =
|
|
1115
|
-
let
|
|
1116
|
-
if ($[
|
|
1117
|
-
|
|
1118
|
-
$[
|
|
1119
|
-
$[
|
|
1120
|
-
} else
|
|
1121
|
-
const headId =
|
|
1499
|
+
$[29] = messages;
|
|
1500
|
+
$[30] = onNew;
|
|
1501
|
+
$[31] = t19;
|
|
1502
|
+
} else t19 = $[31];
|
|
1503
|
+
const handleSendNew = t19;
|
|
1504
|
+
let t20;
|
|
1505
|
+
if ($[32] !== messages) {
|
|
1506
|
+
t20 = messages.at(-1)?.id ?? null;
|
|
1507
|
+
$[32] = messages;
|
|
1508
|
+
$[33] = t20;
|
|
1509
|
+
} else t20 = $[33];
|
|
1510
|
+
const headId = t20;
|
|
1122
1511
|
const hasCancel = !!onCancel;
|
|
1123
1512
|
const hasRefetchThread = !!onRefetchThread;
|
|
1124
|
-
let
|
|
1125
|
-
if ($[
|
|
1126
|
-
|
|
1513
|
+
let t21;
|
|
1514
|
+
if ($[34] !== headId || $[35] !== queue) {
|
|
1515
|
+
t21 = queue && {
|
|
1127
1516
|
...queue,
|
|
1128
|
-
enqueue: (
|
|
1129
|
-
...message_2,
|
|
1130
|
-
parentId: message_2.parentId ?? headId
|
|
1131
|
-
}),
|
|
1132
|
-
steer: (message_3) => queue.steer({
|
|
1517
|
+
enqueue: (message_3) => queue.enqueue({
|
|
1133
1518
|
...message_3,
|
|
1134
1519
|
parentId: message_3.parentId ?? headId
|
|
1520
|
+
}),
|
|
1521
|
+
steer: (message_4) => queue.steer({
|
|
1522
|
+
...message_4,
|
|
1523
|
+
parentId: message_4.parentId ?? headId
|
|
1135
1524
|
})
|
|
1136
1525
|
};
|
|
1137
|
-
$[
|
|
1138
|
-
$[
|
|
1139
|
-
$[
|
|
1140
|
-
} else
|
|
1141
|
-
const composerQueue =
|
|
1142
|
-
const
|
|
1143
|
-
let
|
|
1144
|
-
if ($[
|
|
1145
|
-
|
|
1526
|
+
$[34] = headId;
|
|
1527
|
+
$[35] = queue;
|
|
1528
|
+
$[36] = t21;
|
|
1529
|
+
} else t21 = $[36];
|
|
1530
|
+
const composerQueue = t21;
|
|
1531
|
+
const t22 = isRunning && hasCancel;
|
|
1532
|
+
let t23;
|
|
1533
|
+
if ($[37] !== attachmentAdapter || $[38] !== composerQueue || $[39] !== handleCancelRun || $[40] !== handleSendNew || $[41] !== isRunning || $[42] !== isSendDisabled || $[43] !== messageKeys || $[44] !== t22) {
|
|
1534
|
+
t23 = ComposerClientResource({
|
|
1146
1535
|
type: "thread",
|
|
1147
|
-
canCancel:
|
|
1536
|
+
canCancel: t22,
|
|
1148
1537
|
isRunning,
|
|
1149
1538
|
isSendDisabled,
|
|
1150
1539
|
onCancel: handleCancelRun,
|
|
1151
1540
|
onSend: handleSendNew,
|
|
1152
1541
|
queue: composerQueue,
|
|
1153
|
-
attachmentAdapter
|
|
1542
|
+
attachmentAdapter,
|
|
1543
|
+
messageKeys
|
|
1154
1544
|
});
|
|
1155
|
-
$[
|
|
1156
|
-
$[
|
|
1157
|
-
$[
|
|
1158
|
-
$[
|
|
1159
|
-
$[
|
|
1160
|
-
$[
|
|
1161
|
-
$[
|
|
1162
|
-
$[
|
|
1163
|
-
|
|
1164
|
-
|
|
1545
|
+
$[37] = attachmentAdapter;
|
|
1546
|
+
$[38] = composerQueue;
|
|
1547
|
+
$[39] = handleCancelRun;
|
|
1548
|
+
$[40] = handleSendNew;
|
|
1549
|
+
$[41] = isRunning;
|
|
1550
|
+
$[42] = isSendDisabled;
|
|
1551
|
+
$[43] = messageKeys;
|
|
1552
|
+
$[44] = t22;
|
|
1553
|
+
$[45] = t23;
|
|
1554
|
+
} else t23 = $[45];
|
|
1555
|
+
const composerClient = useClientResource(t23);
|
|
1556
|
+
const submission = composerClient.state.submission;
|
|
1557
|
+
const inTransit = composerClient.state.inTransit;
|
|
1558
|
+
let t24;
|
|
1559
|
+
if ($[46] !== inTransit) {
|
|
1560
|
+
t24 = inTransit ?? [];
|
|
1561
|
+
$[46] = inTransit;
|
|
1562
|
+
$[47] = t24;
|
|
1563
|
+
} else t24 = $[47];
|
|
1564
|
+
let t25;
|
|
1565
|
+
if ($[48] !== submission) {
|
|
1566
|
+
t25 = submission ? [submission] : [];
|
|
1567
|
+
$[48] = submission;
|
|
1568
|
+
$[49] = t25;
|
|
1569
|
+
} else t25 = $[49];
|
|
1570
|
+
let t26;
|
|
1571
|
+
if ($[50] !== t24 || $[51] !== t25) {
|
|
1572
|
+
t26 = [...t24, ...t25];
|
|
1573
|
+
$[50] = t24;
|
|
1574
|
+
$[51] = t25;
|
|
1575
|
+
$[52] = t26;
|
|
1576
|
+
} else t26 = $[52];
|
|
1577
|
+
const pending = t26;
|
|
1578
|
+
const hasPending = pending.length > 0;
|
|
1165
1579
|
let t27;
|
|
1166
|
-
if ($[63]
|
|
1167
|
-
t27 =
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1580
|
+
if ($[53] !== attachmentAdapter || $[54] !== branches || $[55] !== feedbackFor || $[56] !== handleReload || $[57] !== handleSpeak || $[58] !== handleSubmitFeedback || $[59] !== hasPending || $[60] !== messages || $[61] !== onAddToolResult || $[62] !== onEdit || $[63] !== onRespondToToolApproval || $[64] !== onResumeToolCall || $[65] !== queue || $[66] !== speech || $[67] !== speechController || $[68] !== unstable_onRecordToolInteraction) {
|
|
1581
|
+
t27 = messages.map((msg_1, index) => {
|
|
1582
|
+
const props = {
|
|
1583
|
+
message: msg_1,
|
|
1584
|
+
index,
|
|
1585
|
+
isLast: index === messages.length - 1 && !hasPending,
|
|
1586
|
+
parentId: index > 0 ? messages[index - 1].id : null,
|
|
1587
|
+
onReload: () => handleReload(msg_1.id),
|
|
1588
|
+
queue,
|
|
1589
|
+
branches,
|
|
1590
|
+
onRespondToToolApproval,
|
|
1591
|
+
unstable_onRecordToolInteraction,
|
|
1592
|
+
onAddToolResult,
|
|
1593
|
+
onResumeToolCall,
|
|
1594
|
+
attachmentAdapter,
|
|
1595
|
+
submittedFeedback: feedbackFor(msg_1),
|
|
1596
|
+
onSubmitFeedback: (feedback_0) => handleSubmitFeedback(msg_1, feedback_0),
|
|
1597
|
+
speech: speech?.messageId === msg_1.id ? speech : void 0,
|
|
1598
|
+
onSpeak: () => handleSpeak(msg_1),
|
|
1599
|
+
onStopSpeaking: () => speechController.stopMessage(msg_1.id)
|
|
1600
|
+
};
|
|
1601
|
+
if (onEdit) props.onEdit = onEdit;
|
|
1602
|
+
return withKey(msg_1.id, MessageClient(props));
|
|
1603
|
+
});
|
|
1604
|
+
$[53] = attachmentAdapter;
|
|
1605
|
+
$[54] = branches;
|
|
1606
|
+
$[55] = feedbackFor;
|
|
1607
|
+
$[56] = handleReload;
|
|
1608
|
+
$[57] = handleSpeak;
|
|
1609
|
+
$[58] = handleSubmitFeedback;
|
|
1610
|
+
$[59] = hasPending;
|
|
1611
|
+
$[60] = messages;
|
|
1612
|
+
$[61] = onAddToolResult;
|
|
1613
|
+
$[62] = onEdit;
|
|
1614
|
+
$[63] = onRespondToToolApproval;
|
|
1615
|
+
$[64] = onResumeToolCall;
|
|
1616
|
+
$[65] = queue;
|
|
1617
|
+
$[66] = speech;
|
|
1618
|
+
$[67] = speechController;
|
|
1619
|
+
$[68] = unstable_onRecordToolInteraction;
|
|
1620
|
+
$[69] = t27;
|
|
1621
|
+
} else t27 = $[69];
|
|
1622
|
+
const messageClients = useClientLookup(t27);
|
|
1623
|
+
let t28;
|
|
1624
|
+
if ($[70] !== pending) {
|
|
1625
|
+
t28 = pending.map(submissionThreadMessage);
|
|
1626
|
+
$[70] = pending;
|
|
1627
|
+
$[71] = t28;
|
|
1628
|
+
} else t28 = $[71];
|
|
1629
|
+
const pendingMessages = t28;
|
|
1630
|
+
let t29;
|
|
1631
|
+
if ($[72] !== messages.length || $[73] !== pending || $[74] !== pendingMessages) {
|
|
1632
|
+
t29 = pending.map((row, index_0) => withKey(row.id, ThreadMessageClient({
|
|
1633
|
+
message: pendingMessages[index_0],
|
|
1634
|
+
submission: row,
|
|
1635
|
+
index: messages.length + index_0,
|
|
1636
|
+
isLast: index_0 === pending.length - 1
|
|
1637
|
+
}), [
|
|
1638
|
+
pendingMessages[index_0],
|
|
1639
|
+
row,
|
|
1640
|
+
messages.length,
|
|
1641
|
+
index_0,
|
|
1642
|
+
pending.length
|
|
1643
|
+
]));
|
|
1644
|
+
$[72] = messages.length;
|
|
1645
|
+
$[73] = pending;
|
|
1646
|
+
$[74] = pendingMessages;
|
|
1647
|
+
$[75] = t29;
|
|
1648
|
+
} else t29 = $[75];
|
|
1649
|
+
const pendingClients = useClientLookup(t29);
|
|
1650
|
+
let t30;
|
|
1651
|
+
if ($[76] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1652
|
+
t30 = createTaskDeriver();
|
|
1653
|
+
$[76] = t30;
|
|
1654
|
+
} else t30 = $[76];
|
|
1655
|
+
const taskDeriver = t30;
|
|
1656
|
+
let t31;
|
|
1657
|
+
if ($[77] !== messages) {
|
|
1658
|
+
t31 = taskDeriver(messages);
|
|
1659
|
+
$[77] = messages;
|
|
1660
|
+
$[78] = t31;
|
|
1661
|
+
} else t31 = $[78];
|
|
1662
|
+
const tasks = t31;
|
|
1663
|
+
let t32;
|
|
1664
|
+
if ($[79] !== tasks) {
|
|
1665
|
+
t32 = tasks.map(_temp15);
|
|
1666
|
+
$[79] = tasks;
|
|
1667
|
+
$[80] = t32;
|
|
1668
|
+
} else t32 = $[80];
|
|
1669
|
+
const taskClients = useClientLookup(t32);
|
|
1670
|
+
let t33;
|
|
1671
|
+
if ($[81] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1672
|
+
t33 = ThreadSuggestions(EMPTY_SUGGESTIONS);
|
|
1673
|
+
$[81] = t33;
|
|
1674
|
+
} else t33 = $[81];
|
|
1675
|
+
const suggestionsClient = useClientResource(t33);
|
|
1171
1676
|
const hasQueue = !!queue;
|
|
1172
1677
|
const hasBranches = !!branches;
|
|
1173
1678
|
const hasEdit = !!onEdit;
|
|
@@ -1175,17 +1680,18 @@ const useExternalThread = (t0) => {
|
|
|
1175
1680
|
const hasAttachments = !!attachmentAdapter;
|
|
1176
1681
|
const hasFeedback = !!feedbackAdapter;
|
|
1177
1682
|
const hasSpeech = !!speechAdapter;
|
|
1178
|
-
let
|
|
1179
|
-
if ($[
|
|
1180
|
-
|
|
1181
|
-
$[
|
|
1182
|
-
$[
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1683
|
+
let t34;
|
|
1684
|
+
if ($[82] !== messageClients.state || $[83] !== pendingClients.state) {
|
|
1685
|
+
t34 = pendingClients.state.length === 0 ? messageClients.state : [...messageClients.state, ...pendingClients.state];
|
|
1686
|
+
$[82] = messageClients.state;
|
|
1687
|
+
$[83] = pendingClients.state;
|
|
1688
|
+
$[84] = t34;
|
|
1689
|
+
} else t34 = $[84];
|
|
1690
|
+
const messageStates = t34;
|
|
1691
|
+
const t35 = messageStates.length === 0 && !isLoading;
|
|
1692
|
+
let t36;
|
|
1693
|
+
if ($[85] !== hasAttachments || $[86] !== hasBranches || $[87] !== hasCancel || $[88] !== hasEdit || $[89] !== hasFeedback || $[90] !== hasQueue || $[91] !== hasRefetchThread || $[92] !== hasReload || $[93] !== hasSpeech) {
|
|
1694
|
+
t36 = {
|
|
1189
1695
|
edit: hasEdit,
|
|
1190
1696
|
delete: false,
|
|
1191
1697
|
reload: hasReload,
|
|
@@ -1201,88 +1707,88 @@ const useExternalThread = (t0) => {
|
|
|
1201
1707
|
dictation: false,
|
|
1202
1708
|
queue: hasQueue
|
|
1203
1709
|
};
|
|
1204
|
-
$[
|
|
1205
|
-
$[
|
|
1206
|
-
$[
|
|
1207
|
-
$[
|
|
1208
|
-
$[
|
|
1209
|
-
$[
|
|
1210
|
-
$[
|
|
1211
|
-
$[
|
|
1212
|
-
$[
|
|
1213
|
-
$[
|
|
1214
|
-
} else
|
|
1215
|
-
let
|
|
1216
|
-
if ($[
|
|
1217
|
-
|
|
1218
|
-
$[
|
|
1219
|
-
$[
|
|
1220
|
-
} else
|
|
1221
|
-
let
|
|
1222
|
-
if ($[
|
|
1223
|
-
|
|
1224
|
-
isEmpty:
|
|
1710
|
+
$[85] = hasAttachments;
|
|
1711
|
+
$[86] = hasBranches;
|
|
1712
|
+
$[87] = hasCancel;
|
|
1713
|
+
$[88] = hasEdit;
|
|
1714
|
+
$[89] = hasFeedback;
|
|
1715
|
+
$[90] = hasQueue;
|
|
1716
|
+
$[91] = hasRefetchThread;
|
|
1717
|
+
$[92] = hasReload;
|
|
1718
|
+
$[93] = hasSpeech;
|
|
1719
|
+
$[94] = t36;
|
|
1720
|
+
} else t36 = $[94];
|
|
1721
|
+
let t37;
|
|
1722
|
+
if ($[95] !== threadState) {
|
|
1723
|
+
t37 = threadState ?? {};
|
|
1724
|
+
$[95] = threadState;
|
|
1725
|
+
$[96] = t37;
|
|
1726
|
+
} else t37 = $[96];
|
|
1727
|
+
let t38;
|
|
1728
|
+
if ($[97] !== composerClient.state || $[98] !== extras || $[99] !== isLoading || $[100] !== isRunning || $[101] !== messageStates || $[102] !== speech || $[103] !== t35 || $[104] !== t36 || $[105] !== t37 || $[106] !== tasks) {
|
|
1729
|
+
t38 = {
|
|
1730
|
+
isEmpty: t35,
|
|
1225
1731
|
isDisabled: false,
|
|
1226
1732
|
isLoading,
|
|
1227
1733
|
isRunning,
|
|
1228
|
-
capabilities:
|
|
1734
|
+
capabilities: t36,
|
|
1229
1735
|
messages: messageStates,
|
|
1230
1736
|
tasks,
|
|
1231
|
-
state:
|
|
1737
|
+
state: t37,
|
|
1232
1738
|
suggestions: EMPTY_SUGGESTIONS,
|
|
1233
1739
|
extras,
|
|
1234
1740
|
speech,
|
|
1235
1741
|
voice: void 0,
|
|
1236
1742
|
composer: composerClient.state
|
|
1237
1743
|
};
|
|
1238
|
-
$[
|
|
1239
|
-
$[
|
|
1240
|
-
$[
|
|
1241
|
-
$[
|
|
1242
|
-
$[
|
|
1243
|
-
$[
|
|
1244
|
-
$[
|
|
1245
|
-
$[
|
|
1246
|
-
$[
|
|
1247
|
-
$[
|
|
1248
|
-
$[
|
|
1249
|
-
} else
|
|
1250
|
-
const state =
|
|
1251
|
-
let
|
|
1252
|
-
if ($[
|
|
1253
|
-
|
|
1254
|
-
$[
|
|
1255
|
-
$[
|
|
1256
|
-
} else
|
|
1257
|
-
let
|
|
1258
|
-
if ($[
|
|
1259
|
-
|
|
1260
|
-
$[
|
|
1261
|
-
$[
|
|
1262
|
-
} else
|
|
1263
|
-
let
|
|
1264
|
-
if ($[
|
|
1265
|
-
|
|
1266
|
-
$[
|
|
1267
|
-
$[
|
|
1268
|
-
} else
|
|
1269
|
-
let
|
|
1270
|
-
if ($[
|
|
1271
|
-
|
|
1744
|
+
$[97] = composerClient.state;
|
|
1745
|
+
$[98] = extras;
|
|
1746
|
+
$[99] = isLoading;
|
|
1747
|
+
$[100] = isRunning;
|
|
1748
|
+
$[101] = messageStates;
|
|
1749
|
+
$[102] = speech;
|
|
1750
|
+
$[103] = t35;
|
|
1751
|
+
$[104] = t36;
|
|
1752
|
+
$[105] = t37;
|
|
1753
|
+
$[106] = tasks;
|
|
1754
|
+
$[107] = t38;
|
|
1755
|
+
} else t38 = $[107];
|
|
1756
|
+
const state = t38;
|
|
1757
|
+
let t39;
|
|
1758
|
+
if ($[108] !== state) {
|
|
1759
|
+
t39 = () => state;
|
|
1760
|
+
$[108] = state;
|
|
1761
|
+
$[109] = t39;
|
|
1762
|
+
} else t39 = $[109];
|
|
1763
|
+
let t40;
|
|
1764
|
+
if ($[110] !== composerClient.methods) {
|
|
1765
|
+
t40 = () => composerClient.methods;
|
|
1766
|
+
$[110] = composerClient.methods;
|
|
1767
|
+
$[111] = t40;
|
|
1768
|
+
} else t40 = $[111];
|
|
1769
|
+
let t41;
|
|
1770
|
+
if ($[112] !== suggestionsClient) {
|
|
1771
|
+
t41 = () => suggestionsClient.methods;
|
|
1772
|
+
$[112] = suggestionsClient;
|
|
1773
|
+
$[113] = t41;
|
|
1774
|
+
} else t41 = $[113];
|
|
1775
|
+
let t42;
|
|
1776
|
+
if ($[114] !== taskClients || $[115] !== tasks) {
|
|
1777
|
+
t42 = (selector) => {
|
|
1272
1778
|
if ("id" in selector) {
|
|
1273
1779
|
const task_0 = tasks.find((candidate) => candidate.id === selector.id);
|
|
1274
1780
|
return taskClients.get({ key: task_0 ? getTaskKey(task_0) : selector.id });
|
|
1275
1781
|
}
|
|
1276
1782
|
return taskClients.get(selector);
|
|
1277
1783
|
};
|
|
1278
|
-
$[
|
|
1279
|
-
$[
|
|
1280
|
-
$[
|
|
1281
|
-
} else
|
|
1282
|
-
let
|
|
1283
|
-
if ($[
|
|
1284
|
-
|
|
1285
|
-
const appendMessage = typeof
|
|
1784
|
+
$[114] = taskClients;
|
|
1785
|
+
$[115] = tasks;
|
|
1786
|
+
$[116] = t42;
|
|
1787
|
+
} else t42 = $[116];
|
|
1788
|
+
let t43;
|
|
1789
|
+
if ($[117] !== messages || $[118] !== onNew || $[119] !== queue) {
|
|
1790
|
+
t43 = (message_5) => {
|
|
1791
|
+
const appendMessage = typeof message_5 === "string" ? {
|
|
1286
1792
|
createdAt: /* @__PURE__ */ new Date(),
|
|
1287
1793
|
parentId: messages.at(-1)?.id ?? null,
|
|
1288
1794
|
sourceId: null,
|
|
@@ -1290,112 +1796,118 @@ const useExternalThread = (t0) => {
|
|
|
1290
1796
|
role: "user",
|
|
1291
1797
|
content: [{
|
|
1292
1798
|
type: "text",
|
|
1293
|
-
text:
|
|
1799
|
+
text: message_5
|
|
1294
1800
|
}],
|
|
1295
1801
|
attachments: [],
|
|
1296
1802
|
metadata: { custom: {} }
|
|
1297
1803
|
} : {
|
|
1298
|
-
createdAt:
|
|
1299
|
-
parentId:
|
|
1300
|
-
sourceId:
|
|
1301
|
-
role:
|
|
1302
|
-
content:
|
|
1303
|
-
attachments:
|
|
1304
|
-
metadata:
|
|
1305
|
-
runConfig:
|
|
1306
|
-
startRun:
|
|
1804
|
+
createdAt: message_5.createdAt ?? /* @__PURE__ */ new Date(),
|
|
1805
|
+
parentId: message_5.parentId === void 0 ? messages.at(-1)?.id ?? null : message_5.parentId,
|
|
1806
|
+
sourceId: message_5.sourceId ?? null,
|
|
1807
|
+
role: message_5.role ?? "user",
|
|
1808
|
+
content: message_5.content,
|
|
1809
|
+
attachments: message_5.attachments ?? [],
|
|
1810
|
+
metadata: message_5.metadata ?? { custom: {} },
|
|
1811
|
+
runConfig: message_5.runConfig ?? {},
|
|
1812
|
+
startRun: message_5.startRun
|
|
1307
1813
|
};
|
|
1308
1814
|
if (queue) queue.enqueue(appendMessage);
|
|
1309
1815
|
else onNew?.(appendMessage);
|
|
1310
1816
|
};
|
|
1311
|
-
$[
|
|
1312
|
-
$[
|
|
1313
|
-
$[
|
|
1314
|
-
$[
|
|
1315
|
-
} else
|
|
1316
|
-
let
|
|
1317
|
-
if ($[
|
|
1318
|
-
|
|
1817
|
+
$[117] = messages;
|
|
1818
|
+
$[118] = onNew;
|
|
1819
|
+
$[119] = queue;
|
|
1820
|
+
$[120] = t43;
|
|
1821
|
+
} else t43 = $[120];
|
|
1822
|
+
let t44;
|
|
1823
|
+
if ($[121] !== onStartRun) {
|
|
1824
|
+
t44 = () => {
|
|
1319
1825
|
onStartRun?.();
|
|
1320
1826
|
};
|
|
1321
|
-
$[
|
|
1322
|
-
$[
|
|
1323
|
-
} else
|
|
1324
|
-
let
|
|
1325
|
-
if ($[
|
|
1326
|
-
|
|
1827
|
+
$[121] = onStartRun;
|
|
1828
|
+
$[122] = t44;
|
|
1829
|
+
} else t44 = $[122];
|
|
1830
|
+
let t45;
|
|
1831
|
+
if ($[123] !== onResume) {
|
|
1832
|
+
t45 = () => {
|
|
1327
1833
|
if (!onResume) throw new Error("Runtime does not support resuming runs (onResume is not set).");
|
|
1328
1834
|
onResume();
|
|
1329
1835
|
};
|
|
1330
|
-
$[
|
|
1331
|
-
$[
|
|
1332
|
-
} else
|
|
1333
|
-
let
|
|
1334
|
-
if ($[
|
|
1335
|
-
|
|
1336
|
-
$[
|
|
1337
|
-
$[
|
|
1338
|
-
} else
|
|
1339
|
-
let
|
|
1340
|
-
if ($[
|
|
1341
|
-
|
|
1836
|
+
$[123] = onResume;
|
|
1837
|
+
$[124] = t45;
|
|
1838
|
+
} else t45 = $[124];
|
|
1839
|
+
let t46;
|
|
1840
|
+
if ($[125] !== onRefetchThread) {
|
|
1841
|
+
t46 = onRefetchThread && { unstable_refetchThread: onRefetchThread };
|
|
1842
|
+
$[125] = onRefetchThread;
|
|
1843
|
+
$[126] = t46;
|
|
1844
|
+
} else t46 = $[126];
|
|
1845
|
+
let t47;
|
|
1846
|
+
if ($[127] !== onLoadExternalState) {
|
|
1847
|
+
t47 = (state_0) => {
|
|
1342
1848
|
if (!onLoadExternalState) throw new Error("Runtime does not support importing external states (onLoadExternalState is not set).");
|
|
1343
1849
|
onLoadExternalState(state_0);
|
|
1344
1850
|
};
|
|
1345
|
-
$[
|
|
1346
|
-
$[
|
|
1347
|
-
} else
|
|
1348
|
-
let
|
|
1349
|
-
if ($[
|
|
1350
|
-
|
|
1351
|
-
if ("id" in selector_0)
|
|
1851
|
+
$[127] = onLoadExternalState;
|
|
1852
|
+
$[128] = t47;
|
|
1853
|
+
} else t47 = $[128];
|
|
1854
|
+
let t48;
|
|
1855
|
+
if ($[129] !== messageClients || $[130] !== pending || $[131] !== pendingClients) {
|
|
1856
|
+
t48 = (selector_0) => {
|
|
1857
|
+
if ("id" in selector_0) {
|
|
1858
|
+
if (pending.some((row_0) => row_0.id === selector_0.id)) return pendingClients.get({ key: selector_0.id });
|
|
1859
|
+
return messageClients.get({ key: selector_0.id });
|
|
1860
|
+
}
|
|
1861
|
+
if (selector_0.index >= messageClients.state.length) return pendingClients.get({ index: selector_0.index - messageClients.state.length });
|
|
1352
1862
|
return messageClients.get(selector_0);
|
|
1353
1863
|
};
|
|
1354
|
-
$[
|
|
1355
|
-
$[
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1864
|
+
$[129] = messageClients;
|
|
1865
|
+
$[130] = pending;
|
|
1866
|
+
$[131] = pendingClients;
|
|
1867
|
+
$[132] = t48;
|
|
1868
|
+
} else t48 = $[132];
|
|
1869
|
+
let t49;
|
|
1870
|
+
if ($[133] !== handleCancelRun || $[134] !== speechController.stop || $[135] !== t39 || $[136] !== t40 || $[137] !== t41 || $[138] !== t42 || $[139] !== t43 || $[140] !== t44 || $[141] !== t45 || $[142] !== t46 || $[143] !== t47 || $[144] !== t48) {
|
|
1871
|
+
t49 = {
|
|
1872
|
+
getState: t39,
|
|
1873
|
+
composer: t40,
|
|
1874
|
+
suggestions: t41,
|
|
1875
|
+
task: t42,
|
|
1876
|
+
append: t43,
|
|
1877
|
+
deleteMessage: _temp16,
|
|
1878
|
+
startRun: t44,
|
|
1879
|
+
resumeRun: t45,
|
|
1368
1880
|
cancelRun: handleCancelRun,
|
|
1369
|
-
...
|
|
1370
|
-
importExternalState:
|
|
1371
|
-
getModelContext:
|
|
1372
|
-
export:
|
|
1373
|
-
import:
|
|
1374
|
-
reset:
|
|
1375
|
-
message:
|
|
1881
|
+
...t46,
|
|
1882
|
+
importExternalState: t47,
|
|
1883
|
+
getModelContext: _temp17,
|
|
1884
|
+
export: _temp18,
|
|
1885
|
+
import: _temp19,
|
|
1886
|
+
reset: _temp20,
|
|
1887
|
+
message: t48,
|
|
1376
1888
|
stopSpeaking: speechController.stop,
|
|
1377
|
-
connectVoice:
|
|
1378
|
-
disconnectVoice:
|
|
1379
|
-
getVoiceVolume:
|
|
1380
|
-
subscribeVoiceVolume:
|
|
1381
|
-
muteVoice:
|
|
1382
|
-
unmuteVoice:
|
|
1889
|
+
connectVoice: _temp21,
|
|
1890
|
+
disconnectVoice: _temp22,
|
|
1891
|
+
getVoiceVolume: _temp23,
|
|
1892
|
+
subscribeVoiceVolume: _temp25,
|
|
1893
|
+
muteVoice: _temp26,
|
|
1894
|
+
unmuteVoice: _temp27
|
|
1383
1895
|
};
|
|
1384
|
-
$[
|
|
1385
|
-
$[
|
|
1386
|
-
$[
|
|
1387
|
-
$[
|
|
1388
|
-
$[
|
|
1389
|
-
$[
|
|
1390
|
-
$[
|
|
1391
|
-
$[
|
|
1392
|
-
$[
|
|
1393
|
-
$[
|
|
1394
|
-
$[
|
|
1395
|
-
$[
|
|
1396
|
-
$[
|
|
1397
|
-
} else
|
|
1398
|
-
return
|
|
1896
|
+
$[133] = handleCancelRun;
|
|
1897
|
+
$[134] = speechController.stop;
|
|
1898
|
+
$[135] = t39;
|
|
1899
|
+
$[136] = t40;
|
|
1900
|
+
$[137] = t41;
|
|
1901
|
+
$[138] = t42;
|
|
1902
|
+
$[139] = t43;
|
|
1903
|
+
$[140] = t44;
|
|
1904
|
+
$[141] = t45;
|
|
1905
|
+
$[142] = t46;
|
|
1906
|
+
$[143] = t47;
|
|
1907
|
+
$[144] = t48;
|
|
1908
|
+
$[145] = t49;
|
|
1909
|
+
} else t49 = $[145];
|
|
1910
|
+
return t49;
|
|
1399
1911
|
};
|
|
1400
1912
|
const ExternalThread = resource(useExternalThread);
|
|
1401
1913
|
attachTransformScopes(useExternalThread, (scopes, parent) => {
|
|
@@ -1436,52 +1948,65 @@ function _temp2(attachment) {
|
|
|
1436
1948
|
}));
|
|
1437
1949
|
}
|
|
1438
1950
|
function _temp3() {}
|
|
1439
|
-
function _temp4(
|
|
1951
|
+
function _temp4() {}
|
|
1952
|
+
function _temp5(entry_1) {
|
|
1953
|
+
return entry_1.submission;
|
|
1954
|
+
}
|
|
1955
|
+
function _temp6(part) {
|
|
1440
1956
|
return part.type === "text";
|
|
1441
1957
|
}
|
|
1442
|
-
function
|
|
1958
|
+
function _temp7(part_0) {
|
|
1443
1959
|
return part_0.text;
|
|
1444
1960
|
}
|
|
1445
|
-
function
|
|
1446
|
-
return
|
|
1961
|
+
function _temp8(a_2) {
|
|
1962
|
+
return a_2.status.type !== "complete";
|
|
1447
1963
|
}
|
|
1448
|
-
function
|
|
1449
|
-
|
|
1964
|
+
function _temp9(attachment_6) {
|
|
1965
|
+
return [attachment_6.id, attachment_6];
|
|
1450
1966
|
}
|
|
1451
|
-
function
|
|
1452
|
-
|
|
1453
|
-
function _temp0(task) {
|
|
1454
|
-
return withKey(getTaskKey(task), TaskClient({ task }), [task]);
|
|
1967
|
+
function _temp0(a_7) {
|
|
1968
|
+
return a_7.id;
|
|
1455
1969
|
}
|
|
1456
|
-
function _temp1(
|
|
1457
|
-
return
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1970
|
+
function _temp1(attachment_11) {
|
|
1971
|
+
return [attachment_11.id, attachment_11];
|
|
1972
|
+
}
|
|
1973
|
+
function _temp10(result_0) {
|
|
1974
|
+
return result_0.status === "rejected";
|
|
1975
|
+
}
|
|
1976
|
+
function _temp11(error_0) {
|
|
1977
|
+
console.error("Failed to remove cancelled edit attachments", error_0);
|
|
1978
|
+
}
|
|
1979
|
+
function _temp12() {}
|
|
1980
|
+
function _temp13() {}
|
|
1981
|
+
function _temp14(message_1) {
|
|
1982
|
+
return `${message_1.id}|${message_1.role}`;
|
|
1983
|
+
}
|
|
1984
|
+
function _temp15(task) {
|
|
1985
|
+
return withKey(getTaskKey(task), TaskClient({ task }), [task]);
|
|
1461
1986
|
}
|
|
1462
|
-
function
|
|
1463
|
-
function
|
|
1987
|
+
function _temp16() {}
|
|
1988
|
+
function _temp17() {
|
|
1464
1989
|
return {
|
|
1465
1990
|
tools: {},
|
|
1466
1991
|
config: {}
|
|
1467
1992
|
};
|
|
1468
1993
|
}
|
|
1469
|
-
function
|
|
1994
|
+
function _temp18() {
|
|
1470
1995
|
return { messages: [] };
|
|
1471
1996
|
}
|
|
1472
|
-
function
|
|
1473
|
-
function
|
|
1474
|
-
function
|
|
1475
|
-
function
|
|
1476
|
-
function
|
|
1997
|
+
function _temp19() {}
|
|
1998
|
+
function _temp20() {}
|
|
1999
|
+
function _temp21() {}
|
|
2000
|
+
function _temp22() {}
|
|
2001
|
+
function _temp23() {
|
|
1477
2002
|
return 0;
|
|
1478
2003
|
}
|
|
1479
|
-
function
|
|
1480
|
-
function
|
|
1481
|
-
return
|
|
2004
|
+
function _temp24() {}
|
|
2005
|
+
function _temp25() {
|
|
2006
|
+
return _temp24;
|
|
1482
2007
|
}
|
|
1483
|
-
function
|
|
1484
|
-
function
|
|
2008
|
+
function _temp26() {}
|
|
2009
|
+
function _temp27() {}
|
|
1485
2010
|
//#endregion
|
|
1486
2011
|
export { ExternalThread };
|
|
1487
2012
|
|