@assistant-ui/core 0.3.19 → 0.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/attachment.d.ts +50 -43
- package/dist/adapters/attachment.d.ts.map +1 -1
- package/dist/adapters/attachment.js +52 -21
- package/dist/adapters/attachment.js.map +1 -1
- package/dist/adapters/directive-formatter.d.ts +2 -5
- package/dist/adapters/directive-formatter.d.ts.map +1 -1
- package/dist/adapters/feedback.d.ts +7 -8
- package/dist/adapters/feedback.d.ts.map +1 -1
- package/dist/adapters/index.d.ts +14 -9
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +1 -1
- package/dist/adapters/speech.d.ts +63 -65
- package/dist/adapters/speech.d.ts.map +1 -1
- package/dist/adapters/speech.js +16 -2
- package/dist/adapters/speech.js.map +1 -1
- package/dist/adapters/suggestion.d.ts +19 -22
- package/dist/adapters/suggestion.d.ts.map +1 -1
- package/dist/adapters/thread-history.d.ts +60 -58
- package/dist/adapters/thread-history.d.ts.map +1 -1
- package/dist/adapters/trigger.d.ts +8 -11
- package/dist/adapters/trigger.d.ts.map +1 -1
- package/dist/adapters/voice.d.ts +50 -45
- package/dist/adapters/voice.d.ts.map +1 -1
- package/dist/adapters/voice.js +17 -3
- package/dist/adapters/voice.js.map +1 -1
- package/dist/index.d.ts +70 -56
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/internal/duplicate-detection.d.ts +1 -4
- package/dist/internal/duplicate-detection.d.ts.map +1 -1
- package/dist/internal.d.ts +27 -58
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +8 -6
- package/dist/model-context/frame/host.d.ts +20 -23
- package/dist/model-context/frame/host.d.ts.map +1 -1
- package/dist/model-context/frame/host.js +3 -1
- package/dist/model-context/frame/host.js.map +1 -1
- package/dist/model-context/frame/provider.d.ts +28 -30
- package/dist/model-context/frame/provider.d.ts.map +1 -1
- package/dist/model-context/frame/provider.js +6 -0
- package/dist/model-context/frame/provider.js.map +1 -1
- package/dist/model-context/frame/types.d.ts +24 -27
- package/dist/model-context/frame/types.d.ts.map +1 -1
- package/dist/model-context/frame/validate.d.ts +3 -0
- package/dist/model-context/frame/validate.d.ts.map +1 -0
- package/dist/model-context/frame/validate.js +26 -0
- package/dist/model-context/frame/validate.js.map +1 -0
- package/dist/model-context/interactable-composer-metadata.d.ts +51 -39
- package/dist/model-context/interactable-composer-metadata.d.ts.map +1 -1
- package/dist/model-context/interactable-composer-metadata.js +30 -6
- package/dist/model-context/interactable-composer-metadata.js.map +1 -1
- package/dist/model-context/registry-handles.d.ts +9 -12
- package/dist/model-context/registry-handles.d.ts.map +1 -1
- package/dist/model-context/registry.d.ts +15 -18
- package/dist/model-context/registry.d.ts.map +1 -1
- package/dist/model-context/tool-call-text.d.ts +15 -17
- package/dist/model-context/tool-call-text.d.ts.map +1 -1
- package/dist/model-context/tool.d.ts +12 -14
- package/dist/model-context/tool.d.ts.map +1 -1
- package/dist/model-context/types.d.ts +40 -43
- package/dist/model-context/types.d.ts.map +1 -1
- package/dist/react/AssistantProvider.d.ts +9 -12
- package/dist/react/AssistantProvider.d.ts.map +1 -1
- package/dist/react/AssistantRuntimeProvider.d.ts +23 -26
- package/dist/react/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/react/RuntimeAdapter.d.ts +4 -8
- package/dist/react/RuntimeAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts +28 -23
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js +77 -58
- package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
- package/dist/react/adapters/TitleGenerationAdapter.d.ts +4 -7
- package/dist/react/adapters/TitleGenerationAdapter.d.ts.map +1 -1
- package/dist/react/client/AdaptedRemoteThread.d.ts +6 -9
- package/dist/react/client/AdaptedRemoteThread.d.ts.map +1 -1
- package/dist/react/client/DataRenderers.d.ts +2 -5
- package/dist/react/client/DataRenderers.d.ts.map +1 -1
- package/dist/react/client/InMemoryThreadList.d.ts +9 -12
- package/dist/react/client/InMemoryThreadList.d.ts.map +1 -1
- package/dist/react/client/Interactables.d.ts +3 -6
- package/dist/react/client/Interactables.d.ts.map +1 -1
- package/dist/react/client/Interactables.js +306 -101
- package/dist/react/client/Interactables.js.map +1 -1
- package/dist/react/client/RemoteThreadList.d.ts +34 -37
- package/dist/react/client/RemoteThreadList.d.ts.map +1 -1
- package/dist/react/client/RemoteThreadList.js +2 -1
- package/dist/react/client/RemoteThreadList.js.map +1 -1
- package/dist/react/client/Tools.d.ts +10 -12
- package/dist/react/client/Tools.d.ts.map +1 -1
- package/dist/react/client/Tools.js +4 -8
- package/dist/react/client/Tools.js.map +1 -1
- package/dist/react/client/interactable-model-context.d.ts +9 -11
- package/dist/react/client/interactable-model-context.d.ts.map +1 -1
- package/dist/react/client/interactable-model-context.js +32 -22
- package/dist/react/client/interactable-model-context.js.map +1 -1
- package/dist/react/index.d.ts +160 -122
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +5 -5
- package/dist/react/interactables-legacy/Interactables.d.ts +2 -5
- package/dist/react/interactables-legacy/Interactables.d.ts.map +1 -1
- package/dist/react/interactables-legacy/Interactables.js +15 -8
- package/dist/react/interactables-legacy/Interactables.js.map +1 -1
- package/dist/react/interactables-legacy/interactable-model-context.d.ts +6 -9
- package/dist/react/interactables-legacy/interactable-model-context.d.ts.map +1 -1
- package/dist/react/interactables-legacy/interactable-model-context.js +13 -14
- package/dist/react/interactables-legacy/interactable-model-context.js.map +1 -1
- package/dist/react/interactables-legacy/scopes.d.ts +42 -46
- package/dist/react/interactables-legacy/scopes.d.ts.map +1 -1
- package/dist/react/interactables-legacy/useAssistantInteractable.d.ts +8 -11
- package/dist/react/interactables-legacy/useAssistantInteractable.d.ts.map +1 -1
- package/dist/react/interactables-legacy/useInteractableState.d.ts +7 -9
- package/dist/react/interactables-legacy/useInteractableState.d.ts.map +1 -1
- package/dist/react/interactables-shared/useInteractablePersistenceQueue.d.ts +23 -14
- package/dist/react/interactables-shared/useInteractablePersistenceQueue.d.ts.map +1 -1
- package/dist/react/interactables-shared/useInteractablePersistenceQueue.js +54 -25
- package/dist/react/interactables-shared/useInteractablePersistenceQueue.js.map +1 -1
- package/dist/react/model-context/define-mcp-toolkit.d.ts +15 -18
- package/dist/react/model-context/define-mcp-toolkit.d.ts.map +1 -1
- package/dist/react/model-context/define-toolkit.d.ts +13 -6
- package/dist/react/model-context/define-toolkit.d.ts.map +1 -1
- package/dist/react/model-context/external-tool.d.ts +1 -4
- package/dist/react/model-context/external-tool.d.ts.map +1 -1
- package/dist/react/model-context/human-tool.d.ts +3 -6
- package/dist/react/model-context/human-tool.d.ts.map +1 -1
- package/dist/react/model-context/interactableTool.d.ts +26 -29
- package/dist/react/model-context/interactableTool.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantDataUI.d.ts +6 -9
- package/dist/react/model-context/makeAssistantDataUI.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantTool.d.ts +6 -9
- package/dist/react/model-context/makeAssistantTool.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantToolUI.d.ts +6 -9
- package/dist/react/model-context/makeAssistantToolUI.d.ts.map +1 -1
- package/dist/react/model-context/provider-tool.d.ts +5 -7
- package/dist/react/model-context/provider-tool.d.ts.map +1 -1
- package/dist/react/model-context/stub-tool.d.ts +1 -4
- package/dist/react/model-context/stub-tool.d.ts.map +1 -1
- package/dist/react/model-context/toolbox.d.ts +44 -32
- package/dist/react/model-context/toolbox.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantContext.d.ts +3 -6
- package/dist/react/model-context/useAssistantContext.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantDataUI.d.ts +7 -10
- package/dist/react/model-context/useAssistantDataUI.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantInstructions.d.ts +3 -6
- package/dist/react/model-context/useAssistantInstructions.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantTool.d.ts +9 -13
- package/dist/react/model-context/useAssistantTool.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantToolUI.d.ts +13 -16
- package/dist/react/model-context/useAssistantToolUI.d.ts.map +1 -1
- package/dist/react/model-context/useAuiToolOverrides.d.ts +3 -5
- package/dist/react/model-context/useAuiToolOverrides.d.ts.map +1 -1
- package/dist/react/model-context/useInlineRender.d.ts +3 -6
- package/dist/react/model-context/useInlineRender.d.ts.map +1 -1
- package/dist/react/model-context/useInteractable.d.ts +40 -40
- package/dist/react/model-context/useInteractable.d.ts.map +1 -1
- package/dist/react/model-context/useInteractableState.d.ts +10 -9
- package/dist/react/model-context/useInteractableState.d.ts.map +1 -1
- package/dist/react/model-context/useInteractableVersions.d.ts +4 -7
- package/dist/react/model-context/useInteractableVersions.d.ts.map +1 -1
- package/dist/react/model-context/useToolArgsStatus.d.ts +7 -9
- package/dist/react/model-context/useToolArgsStatus.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.d.ts +7 -10
- package/dist/react/primitive-hooks/useActionBarCopy.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.d.ts +3 -6
- package/dist/react/primitive-hooks/useActionBarEdit.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.d.ts +6 -9
- package/dist/react/primitive-hooks/useActionBarFeedback.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.d.ts +3 -6
- package/dist/react/primitive-hooks/useActionBarReload.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.d.ts +3 -6
- package/dist/react/primitive-hooks/useActionBarSpeak.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts +3 -6
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.d.ts +3 -6
- package/dist/react/primitive-hooks/useBranchPickerNext.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts +3 -6
- package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts +4 -7
- package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.d.ts +3 -6
- package/dist/react/primitive-hooks/useComposerCancel.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.d.ts +3 -6
- package/dist/react/primitive-hooks/useComposerDictate.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.d.ts +4 -7
- package/dist/react/primitive-hooks/useComposerSend.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.d.ts +2 -5
- package/dist/react/primitive-hooks/useEditComposerCancel.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.d.ts +3 -6
- package/dist/react/primitive-hooks/useEditComposerSend.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.d.ts +5 -8
- package/dist/react/primitive-hooks/useMessageBranching.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageError.d.ts +1 -4
- package/dist/react/primitive-hooks/useMessageError.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageReload.d.ts +3 -6
- package/dist/react/primitive-hooks/useMessageReload.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts +7 -10
- package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.js +4 -4
- package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts +1 -4
- package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsRunning.d.ts +1 -4
- package/dist/react/primitive-hooks/useThreadIsRunning.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts +2 -5
- package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts +2 -5
- package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts +2 -5
- package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts +2 -5
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.d.ts +3 -6
- package/dist/react/primitive-hooks/useThreadListLoadMore.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.d.ts +2 -5
- package/dist/react/primitive-hooks/useThreadListNew.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadMessageIds.d.ts +1 -4
- package/dist/react/primitive-hooks/useThreadMessageIds.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadMessages.d.ts +2 -5
- package/dist/react/primitive-hooks/useThreadMessages.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useVoice.d.ts +8 -11
- package/dist/react/primitive-hooks/useVoice.d.ts.map +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts +27 -29
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.d.ts +26 -28
- package/dist/react/primitives/composer/ComposerAttachments.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerIf.d.ts +13 -13
- package/dist/react/primitives/composer/ComposerIf.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerQueue.d.ts +13 -17
- package/dist/react/primitives/composer/ComposerQueue.d.ts.map +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.d.ts +30 -33
- package/dist/react/primitives/generativeUI/GenerativeUI.d.ts.map +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.js +42 -33
- package/dist/react/primitives/generativeUI/GenerativeUI.js.map +1 -1
- package/dist/react/primitives/message/MessageAttachments.d.ts +30 -28
- package/dist/react/primitives/message/MessageAttachments.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageAttachments.js +14 -15
- package/dist/react/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.d.ts +122 -120
- package/dist/react/primitives/message/MessageGroupedParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.js +3 -3
- package/dist/react/primitives/message/MessageGroupedParts.js.map +1 -1
- package/dist/react/primitives/message/MessageParts.d.ts +208 -194
- package/dist/react/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageParts.js +124 -82
- package/dist/react/primitives/message/MessageParts.js.map +1 -1
- package/dist/react/primitives/message/MessageQuote.d.ts +8 -11
- package/dist/react/primitives/message/MessageQuote.d.ts.map +1 -1
- package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts +4 -7
- package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts.map +1 -1
- package/dist/react/primitives/part/PartMessages.d.ts +16 -19
- package/dist/react/primitives/part/PartMessages.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadMessages.d.ts +61 -64
- package/dist/react/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.d.ts +25 -27
- package/dist/react/primitives/thread/ThreadSuggestions.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.js +24 -5
- package/dist/react/primitives/thread/ThreadSuggestions.js.map +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.d.ts +26 -28
- package/dist/react/primitives/threadList/ThreadListItems.d.ts.map +1 -1
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts +6 -9
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -1
- package/dist/react/providers/AttachmentByIndexProvider.d.ts +5 -8
- package/dist/react/providers/AttachmentByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts +4 -7
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts +3 -6
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/MessageByIdProvider.d.ts +3 -6
- package/dist/react/providers/MessageByIdProvider.d.ts.map +1 -1
- package/dist/react/providers/MessageByIndexProvider.d.ts +3 -6
- package/dist/react/providers/MessageByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/PartByIndexProvider.d.ts +3 -6
- package/dist/react/providers/PartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/QueueItemByIndexProvider.d.ts +4 -7
- package/dist/react/providers/QueueItemByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.d.ts +7 -10
- package/dist/react/providers/ReadonlyThreadProvider.d.ts.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.js.map +1 -1
- package/dist/react/providers/SuggestionByIndexProvider.d.ts +4 -7
- package/dist/react/providers/SuggestionByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.d.ts +4 -7
- package/dist/react/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.js +5 -1
- package/dist/react/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.d.ts +4 -7
- package/dist/react/providers/ThreadListItemByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts +4 -8
- package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +210 -219
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +70 -46
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +186 -198
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +13 -4
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadResource.d.ts +17 -23
- package/dist/react/runtimes/RemoteThreadResource.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadResource.js +3 -1
- package/dist/react/runtimes/RemoteThreadResource.js.map +1 -1
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts +10 -11
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/commandQueue.d.ts +11 -14
- package/dist/react/runtimes/assistant-transport/commandQueue.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.d.ts +6 -8
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.js +9 -2
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.js.map +1 -1
- package/dist/react/runtimes/assistant-transport/runManager.d.ts +9 -12
- package/dist/react/runtimes/assistant-transport/runManager.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/runManager.js +4 -1
- package/dist/react/runtimes/assistant-transport/runManager.js.map +1 -1
- package/dist/react/runtimes/assistant-transport/types.d.ts +123 -118
- package/dist/react/runtimes/assistant-transport/types.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.d.ts +7 -10
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.js +17 -6
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
- package/dist/react/runtimes/assistant-transport/useConvertedState.d.ts +3 -6
- package/dist/react/runtimes/assistant-transport/useConvertedState.d.ts.map +1 -1
- package/dist/react/runtimes/assistant-transport/useLatestRef.d.ts +2 -5
- package/dist/react/runtimes/assistant-transport/useLatestRef.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts +7 -10
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +426 -216
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts +15 -18
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js +8 -4
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.d.ts +146 -125
- package/dist/react/runtimes/cloud/auiV0.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.js +120 -8
- package/dist/react/runtimes/cloud/auiV0.js.map +1 -1
- package/dist/react/runtimes/cloud/createCloudThreadListAdapter.d.ts +13 -15
- package/dist/react/runtimes/cloud/createCloudThreadListAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/createCloudThreadListAdapterCreateFallback.d.ts +5 -7
- package/dist/react/runtimes/cloud/createCloudThreadListAdapterCreateFallback.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/sdkIdentity.d.ts +2 -5
- package/dist/react/runtimes/cloud/sdkIdentity.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/sdkIdentity.js +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts +3 -6
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListRuntime.d.ts +9 -11
- package/dist/react/runtimes/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/createMessageConverter.d.ts +15 -19
- package/dist/react/runtimes/createMessageConverter.d.ts.map +1 -1
- package/dist/react/runtimes/createMessageConverter.js.map +1 -1
- package/dist/react/runtimes/createRuntimeExtras.d.ts +14 -17
- package/dist/react/runtimes/createRuntimeExtras.d.ts.map +1 -1
- package/dist/react/runtimes/external-message-converter.d.ts +17 -21
- package/dist/react/runtimes/external-message-converter.d.ts.map +1 -1
- package/dist/react/runtimes/external-store-history-copy.d.ts +25 -0
- package/dist/react/runtimes/external-store-history-copy.d.ts.map +1 -0
- package/dist/react/runtimes/external-store-history-copy.js +148 -0
- package/dist/react/runtimes/external-store-history-copy.js.map +1 -0
- package/dist/react/runtimes/useExternalStoreRuntime.d.ts +3 -6
- package/dist/react/runtimes/useExternalStoreRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useExternalStoreRuntime.js +72 -35
- package/dist/react/runtimes/useExternalStoreRuntime.js.map +1 -1
- package/dist/react/runtimes/useExternalStoreSharedOptions.d.ts +2 -5
- package/dist/react/runtimes/useExternalStoreSharedOptions.d.ts.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.d.ts +29 -41
- package/dist/react/runtimes/useLocalRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.js +142 -34
- package/dist/react/runtimes/useLocalRuntime.js.map +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts +3 -6
- package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.js +2 -2
- package/dist/react/runtimes/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/react/runtimes/useRuntimeAdapters.d.ts +5 -7
- package/dist/react/runtimes/useRuntimeAdapters.d.ts.map +1 -1
- package/dist/react/runtimes/useStreamingTiming.d.ts +4 -6
- package/dist/react/runtimes/useStreamingTiming.d.ts.map +1 -1
- package/dist/react/types/MessagePartComponentTypes.d.ts +72 -70
- package/dist/react/types/MessagePartComponentTypes.d.ts.map +1 -1
- package/dist/react/types/scopes/dataRenderers.d.ts +11 -15
- package/dist/react/types/scopes/dataRenderers.d.ts.map +1 -1
- package/dist/react/types/scopes/interactables.d.ts +60 -60
- package/dist/react/types/scopes/interactables.d.ts.map +1 -1
- package/dist/react/types/scopes/tools.d.ts +21 -24
- package/dist/react/types/scopes/tools.d.ts.map +1 -1
- package/dist/react/types/store-augmentation.d.ts +10 -11
- package/dist/react/types/store-augmentation.d.ts.map +1 -1
- package/dist/react/utils/getMessageQuote.d.ts +6 -8
- package/dist/react/utils/getMessageQuote.d.ts.map +1 -1
- package/dist/react/utils/groupParts.d.ts +35 -37
- package/dist/react/utils/groupParts.d.ts.map +1 -1
- package/dist/react/utils/useJSONEqual.d.ts +3 -6
- package/dist/react/utils/useJSONEqual.d.ts.map +1 -1
- package/dist/react/utils/useJSONSchemaDependency.d.ts +3 -6
- package/dist/react/utils/useJSONSchemaDependency.d.ts.map +1 -1
- package/dist/runtime/api/assistant-runtime.d.ts +28 -31
- package/dist/runtime/api/assistant-runtime.d.ts.map +1 -1
- package/dist/runtime/api/attachment-runtime.d.ts +51 -49
- package/dist/runtime/api/attachment-runtime.d.ts.map +1 -1
- package/dist/runtime/api/attachment-runtime.js.map +1 -1
- package/dist/runtime/api/bindings.d.ts +35 -35
- package/dist/runtime/api/bindings.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.d.ts +215 -201
- package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.js +4 -0
- package/dist/runtime/api/composer-runtime.js.map +1 -1
- package/dist/runtime/api/message-part-runtime.d.ts +31 -30
- package/dist/runtime/api/message-part-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-part-runtime.js +25 -2
- package/dist/runtime/api/message-part-runtime.js.map +1 -1
- package/dist/runtime/api/message-runtime.d.ts +87 -82
- package/dist/runtime/api/message-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-runtime.js +4 -3
- package/dist/runtime/api/message-runtime.js.map +1 -1
- package/dist/runtime/api/paths.d.ts +54 -57
- package/dist/runtime/api/paths.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.d.ts +70 -72
- package/dist/runtime/api/thread-list-item-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-runtime.d.ts +77 -81
- package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-runtime.js.map +1 -1
- package/dist/runtime/api/thread-runtime.d.ts +306 -308
- package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-runtime.js +2 -1
- package/dist/runtime/api/thread-runtime.js.map +1 -1
- package/dist/runtime/base/base-assistant-runtime-core.d.ts +9 -12
- package/dist/runtime/base/base-assistant-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.d.ts +150 -101
- package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.js +400 -122
- package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.d.ts +121 -104
- package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js +174 -62
- package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts +30 -31
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.js +21 -2
- package/dist/runtime/base/default-edit-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +28 -31
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js +23 -2
- package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
- package/dist/runtime/branch/external-thread-branch-adapter.d.ts +15 -18
- package/dist/runtime/branch/external-thread-branch-adapter.d.ts.map +1 -1
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts +8 -11
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/composer-runtime-core.d.ts +98 -83
- package/dist/runtime/interfaces/composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts +67 -70
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-runtime-core.d.ts +225 -211
- package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +25 -20
- package/dist/runtime/internal.d.ts.map +1 -0
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts +37 -40
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts.map +1 -1
- package/dist/runtime/queue/message-queue.d.ts +32 -33
- package/dist/runtime/queue/message-queue.d.ts.map +1 -1
- package/dist/runtime/queue/message-queue.js +10 -2
- package/dist/runtime/queue/message-queue.js.map +1 -1
- package/dist/runtime/queue/queue-item.d.ts +7 -10
- package/dist/runtime/queue/queue-item.d.ts.map +1 -1
- package/dist/runtime/utils/abortable-thread-load.d.ts +9 -11
- package/dist/runtime/utils/abortable-thread-load.d.ts.map +1 -1
- package/dist/runtime/utils/attachment-add-operations.d.ts +16 -15
- package/dist/runtime/utils/attachment-add-operations.d.ts.map +1 -1
- package/dist/runtime/utils/attachment-add-operations.js +24 -2
- package/dist/runtime/utils/attachment-add-operations.js.map +1 -1
- package/dist/runtime/utils/attachment-send-operations.d.ts +12 -0
- package/dist/runtime/utils/attachment-send-operations.d.ts.map +1 -0
- package/dist/runtime/utils/attachment-send-operations.js +34 -0
- package/dist/runtime/utils/attachment-send-operations.js.map +1 -0
- package/dist/runtime/utils/auto-status.d.ts +11 -13
- package/dist/runtime/utils/auto-status.d.ts.map +1 -1
- package/dist/runtime/utils/auto-status.js +3 -5
- package/dist/runtime/utils/auto-status.js.map +1 -1
- package/dist/runtime/utils/chat-model-adapter.d.ts +31 -33
- package/dist/runtime/utils/chat-model-adapter.d.ts.map +1 -1
- package/dist/runtime/utils/external-message-conversion.d.ts +47 -48
- package/dist/runtime/utils/external-message-conversion.d.ts.map +1 -1
- package/dist/runtime/utils/external-message-conversion.js +6 -5
- package/dist/runtime/utils/external-message-conversion.js.map +1 -1
- package/dist/runtime/utils/external-store-message.d.ts +6 -9
- package/dist/runtime/utils/external-store-message.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository-session.d.ts +24 -27
- package/dist/runtime/utils/message-repository-session.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository.d.ts +52 -54
- package/dist/runtime/utils/message-repository.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository.js +8 -7
- package/dist/runtime/utils/message-repository.js.map +1 -1
- package/dist/runtime/utils/pending-tool-calls.d.ts +12 -14
- package/dist/runtime/utils/pending-tool-calls.d.ts.map +1 -1
- package/dist/runtime/utils/resolveToolApprovalResponse.d.ts +7 -10
- package/dist/runtime/utils/resolveToolApprovalResponse.d.ts.map +1 -1
- package/dist/runtime/utils/runtime-extras-brand.d.ts +6 -9
- package/dist/runtime/utils/runtime-extras-brand.d.ts.map +1 -1
- package/dist/runtime/utils/stored-message-parts.d.ts +21 -0
- package/dist/runtime/utils/stored-message-parts.d.ts.map +1 -0
- package/dist/runtime/utils/stored-message-parts.js +103 -0
- package/dist/runtime/utils/stored-message-parts.js.map +1 -0
- package/dist/runtime/utils/streaming-timing.d.ts +23 -26
- package/dist/runtime/utils/streaming-timing.d.ts.map +1 -1
- package/dist/runtime/utils/thread-message-like.d.ts +38 -34
- package/dist/runtime/utils/thread-message-like.d.ts.map +1 -1
- package/dist/runtime/utils/thread-message-like.js +16 -6
- package/dist/runtime/utils/thread-message-like.js.map +1 -1
- package/dist/runtime/utils/thread-runtime-lifecycle.d.ts +5 -7
- package/dist/runtime/utils/thread-runtime-lifecycle.d.ts.map +1 -1
- package/dist/runtime/utils/thread-runtime-lifecycle.js +31 -4
- package/dist/runtime/utils/thread-runtime-lifecycle.js.map +1 -1
- package/dist/runtime/utils/tool-call-tree.d.ts +10 -13
- package/dist/runtime/utils/tool-call-tree.d.ts.map +1 -1
- package/dist/runtime/utils/tool-interactions.d.ts +10 -0
- package/dist/runtime/utils/tool-interactions.d.ts.map +1 -0
- package/dist/runtime/utils/tool-interactions.js +92 -0
- package/dist/runtime/utils/tool-interactions.js.map +1 -0
- package/dist/runtimes/assistant-transport/utils.d.ts +1 -4
- package/dist/runtimes/assistant-transport/utils.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-adapter.d.ts +220 -200
- package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts +6 -8
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-runtime-core.js +4 -1
- package/dist/runtimes/external-store/external-store-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/external-store-shared-options.d.ts +3 -6
- package/dist/runtimes/external-store/external-store-shared-options.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts +40 -43
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js +2 -2
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +119 -125
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js +71 -18
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/thread-message-converter.d.ts +5 -8
- package/dist/runtimes/external-store/thread-message-converter.d.ts.map +1 -1
- package/dist/runtimes/inert/InertThreadRuntimeCore.d.ts +96 -98
- package/dist/runtimes/inert/InertThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/inert/InertThreadRuntimeCore.js +3 -0
- package/dist/runtimes/inert/InertThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/internal.d.ts +20 -16
- package/dist/runtimes/internal.d.ts.map +1 -0
- package/dist/runtimes/local/local-runtime-core.d.ts +7 -10
- package/dist/runtimes/local/local-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-runtime-options.d.ts +41 -44
- package/dist/runtimes/local/local-runtime-options.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts +42 -45
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.d.ts +94 -93
- package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.js +220 -29
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/local/should-continue.d.ts +2 -5
- package/dist/runtimes/local/should-continue.d.ts.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +77 -55
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js +28 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts +12 -15
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter-changed.d.ts +3 -6
- package/dist/runtimes/remote-thread-list/adapter-changed.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts +2 -5
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts +34 -31
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/optimistic-state.js +8 -3
- package/dist/runtimes/remote-thread-list/optimistic-state.js.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts +60 -63
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.js +1 -1
- package/dist/runtimes/remote-thread-list/title-generation.d.ts +31 -33
- package/dist/runtimes/remote-thread-list/title-generation.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/title.d.ts +5 -8
- package/dist/runtimes/remote-thread-list/title.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/types.d.ts +119 -121
- package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts +147 -149
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js +22 -7
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js.map +1 -1
- package/dist/store/clients/chain-of-thought-client.d.ts +8 -11
- package/dist/store/clients/chain-of-thought-client.d.ts.map +1 -1
- package/dist/store/clients/external-thread.d.ts +56 -58
- package/dist/store/clients/external-thread.d.ts.map +1 -1
- package/dist/store/clients/external-thread.js +1270 -741
- package/dist/store/clients/external-thread.js.map +1 -1
- package/dist/store/clients/model-context-client.d.ts +2 -5
- package/dist/store/clients/model-context-client.d.ts.map +1 -1
- package/dist/store/clients/no-op-composer-client.d.ts +3 -6
- package/dist/store/clients/no-op-composer-client.d.ts.map +1 -1
- package/dist/store/clients/no-op-composer-client.js +3 -1
- package/dist/store/clients/no-op-composer-client.js.map +1 -1
- package/dist/store/clients/runtime-adapter.d.ts +2 -5
- package/dist/store/clients/runtime-adapter.d.ts.map +1 -1
- package/dist/store/clients/single-thread-list.d.ts +4 -6
- package/dist/store/clients/single-thread-list.d.ts.map +1 -1
- package/dist/store/clients/submission-message.d.ts +8 -0
- package/dist/store/clients/submission-message.d.ts.map +1 -0
- package/dist/store/clients/submission-message.js +22 -0
- package/dist/store/clients/submission-message.js.map +1 -0
- package/dist/store/clients/suggestions.d.ts +8 -11
- package/dist/store/clients/suggestions.d.ts.map +1 -1
- package/dist/store/clients/thread-message-client.d.ts +12 -12
- package/dist/store/clients/thread-message-client.d.ts.map +1 -1
- package/dist/store/clients/thread-message-client.js +81 -82
- package/dist/store/clients/thread-message-client.js.map +1 -1
- package/dist/store/clients/thread-selection-events.d.ts +1 -4
- package/dist/store/clients/thread-selection-events.d.ts.map +1 -1
- package/dist/store/clients/thread-tasks.d.ts +7 -10
- package/dist/store/clients/thread-tasks.d.ts.map +1 -1
- package/dist/store/env.d.ts +1 -4
- package/dist/store/env.d.ts.map +1 -1
- package/dist/store/index.d.ts +33 -36
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +5 -5
- package/dist/store/internal.d.ts +12 -12
- package/dist/store/internal.d.ts.map +1 -0
- package/dist/store/internal.js +2 -2
- package/dist/store/primitive-predicates.d.ts +14 -16
- package/dist/store/primitive-predicates.d.ts.map +1 -1
- package/dist/store/primitive-predicates.js +10 -5
- package/dist/store/primitive-predicates.js.map +1 -1
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts +4 -7
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.d.ts +11 -14
- package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.js +65 -62
- package/dist/store/runtime-clients/composer-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/handle-runtime-action.d.ts +1 -4
- package/dist/store/runtime-clients/handle-runtime-action.d.ts.map +1 -1
- package/dist/store/runtime-clients/handle-thread-list-action.d.ts +1 -4
- package/dist/store/runtime-clients/handle-thread-list-action.d.ts.map +1 -1
- package/dist/store/runtime-clients/liveRef.d.ts +2 -5
- package/dist/store/runtime-clients/liveRef.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts +4 -7
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.js +26 -16
- package/dist/store/runtime-clients/message-part-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.d.ts +10 -11
- package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.js +121 -113
- package/dist/store/runtime-clients/message-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts +5 -8
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts +6 -9
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.d.ts +4 -7
- package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.js +221 -158
- package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/useSubscribable.d.ts +3 -6
- package/dist/store/runtime-clients/useSubscribable.d.ts.map +1 -1
- package/dist/store/scope-registration.d.ts +28 -29
- package/dist/store/scope-registration.d.ts.map +1 -1
- package/dist/store/scopes/attachment.d.ts +19 -22
- package/dist/store/scopes/attachment.d.ts.map +1 -1
- package/dist/store/scopes/chain-of-thought.d.ts +33 -35
- package/dist/store/scopes/chain-of-thought.d.ts.map +1 -1
- package/dist/store/scopes/composer.d.ts +147 -135
- package/dist/store/scopes/composer.d.ts.map +1 -1
- package/dist/store/scopes/message.d.ts +119 -112
- package/dist/store/scopes/message.d.ts.map +1 -1
- package/dist/store/scopes/model-context.d.ts +10 -13
- package/dist/store/scopes/model-context.d.ts.map +1 -1
- package/dist/store/scopes/part.d.ts +53 -50
- package/dist/store/scopes/part.d.ts.map +1 -1
- package/dist/store/scopes/queue-item.d.ts +21 -23
- package/dist/store/scopes/queue-item.d.ts.map +1 -1
- package/dist/store/scopes/suggestion.d.ts +14 -17
- package/dist/store/scopes/suggestion.d.ts.map +1 -1
- package/dist/store/scopes/suggestions.d.ts +18 -21
- package/dist/store/scopes/suggestions.d.ts.map +1 -1
- package/dist/store/scopes/task.d.ts +27 -30
- package/dist/store/scopes/task.d.ts.map +1 -1
- package/dist/store/scopes/thread-list-item.d.ts +68 -71
- package/dist/store/scopes/thread-list-item.d.ts.map +1 -1
- package/dist/store/scopes/thread.d.ts +197 -200
- package/dist/store/scopes/thread.d.ts.map +1 -1
- package/dist/store/scopes/threads.d.ts +49 -52
- package/dist/store/scopes/threads.d.ts.map +1 -1
- package/dist/subscribable/subscribable.d.ts +73 -69
- package/dist/subscribable/subscribable.d.ts.map +1 -1
- package/dist/subscribable/subscribable.js +35 -7
- package/dist/subscribable/subscribable.js.map +1 -1
- package/dist/types/attachment.d.ts +35 -37
- package/dist/types/attachment.d.ts.map +1 -1
- package/dist/types/augmentations.d.ts +7 -8
- package/dist/types/augmentations.d.ts.map +1 -1
- package/dist/types/directive.d.ts +13 -16
- package/dist/types/directive.d.ts.map +1 -1
- package/dist/types/error.d.ts +15 -17
- package/dist/types/error.d.ts.map +1 -1
- package/dist/types/index.d.ts +7 -7
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/message.d.ts +358 -318
- package/dist/types/message.d.ts.map +1 -1
- package/dist/types/message.js.map +1 -1
- package/dist/types/quote.d.ts +3 -6
- package/dist/types/quote.d.ts.map +1 -1
- package/dist/types/trigger.d.ts +10 -13
- package/dist/types/trigger.d.ts.map +1 -1
- package/dist/types/unsubscribe.d.ts +1 -4
- package/dist/types/unsubscribe.d.ts.map +1 -1
- package/dist/utils/abortable-iterable.d.ts +2 -5
- package/dist/utils/abortable-iterable.d.ts.map +1 -1
- package/dist/utils/composite-context-provider.d.ts +9 -13
- package/dist/utils/composite-context-provider.d.ts.map +1 -1
- package/dist/utils/data-url.d.ts +16 -19
- package/dist/utils/data-url.d.ts.map +1 -1
- package/dist/utils/getGroupStatus.d.ts +19 -21
- package/dist/utils/getGroupStatus.d.ts.map +1 -1
- package/dist/utils/id.d.ts +3 -6
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/image-media-type.d.ts +1 -4
- package/dist/utils/image-media-type.d.ts.map +1 -1
- package/dist/utils/invoke-user-callback.d.ts +1 -4
- package/dist/utils/invoke-user-callback.d.ts.map +1 -1
- package/dist/utils/json/is-json-equal.d.ts +1 -4
- package/dist/utils/json/is-json-equal.d.ts.map +1 -1
- package/dist/utils/json/is-json.d.ts +5 -8
- package/dist/utils/json/is-json.d.ts.map +1 -1
- package/dist/utils/json/stable-stringify-tool-args.d.ts +3 -6
- package/dist/utils/json/stable-stringify-tool-args.d.ts.map +1 -1
- package/dist/utils/normalizePartStatus.d.ts +6 -8
- package/dist/utils/normalizePartStatus.d.ts.map +1 -1
- package/dist/utils/normalizePartStatus.js +3 -2
- package/dist/utils/normalizePartStatus.js.map +1 -1
- package/dist/utils/notify-event-listeners.d.ts +2 -4
- package/dist/utils/notify-event-listeners.d.ts.map +1 -1
- package/dist/utils/record.d.ts +1 -4
- package/dist/utils/record.d.ts.map +1 -1
- package/dist/utils/silent-runtime-action.d.ts +2 -5
- package/dist/utils/silent-runtime-action.d.ts.map +1 -1
- package/dist/utils/text.d.ts +2 -5
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/wire-media.d.ts +3 -6
- package/dist/utils/wire-media.d.ts.map +1 -1
- package/package.json +15 -13
- package/src/adapters/attachment.test.ts +98 -1
- package/src/adapters/attachment.ts +77 -20
- package/src/adapters/feedback.ts +1 -0
- package/src/adapters/speech.test.ts +94 -0
- package/src/adapters/speech.ts +16 -2
- package/src/adapters/thread-history.ts +16 -5
- package/src/adapters/voice.test.ts +169 -0
- package/src/adapters/voice.ts +25 -4
- package/src/index.ts +14 -2
- package/src/internal.ts +7 -0
- package/src/model-context/frame/host.test.ts +51 -1
- package/src/model-context/frame/host.ts +3 -1
- package/src/model-context/frame/provider.test.ts +106 -20
- package/src/model-context/frame/provider.ts +8 -1
- package/src/model-context/frame/validate.ts +57 -0
- package/src/model-context/interactable-composer-metadata.test.ts +82 -0
- package/src/model-context/interactable-composer-metadata.ts +45 -2
- package/src/react/RuntimeAdapter.test.ts +4 -1
- package/src/react/adapters/LocalStorageThreadListAdapter.test.ts +711 -0
- package/src/react/adapters/LocalStorageThreadListAdapter.tsx +125 -109
- package/src/react/client/Interactables.test.ts +865 -8
- package/src/react/client/Interactables.ts +325 -45
- package/src/react/client/RemoteThreadList.concurrent.test.tsx +9 -3
- package/src/react/client/RemoteThreadList.initialize-failure.test.ts +124 -0
- package/src/react/client/RemoteThreadList.test.ts +5 -6
- package/src/react/client/RemoteThreadList.ts +6 -0
- package/src/react/client/Tools.ts +2 -3
- package/src/react/client/interactable-model-context.test.ts +56 -13
- package/src/react/client/interactable-model-context.ts +48 -23
- package/src/react/index.ts +2 -2
- package/src/react/interactables-legacy/Interactables.test.ts +221 -4
- package/src/react/interactables-legacy/Interactables.ts +25 -14
- package/src/react/interactables-legacy/interactable-model-context.ts +26 -24
- package/src/react/interactables-legacy/useAssistantInteractable.test.tsx +40 -22
- package/src/react/interactables-shared/useInteractablePersistenceQueue.test.tsx +22 -2
- package/src/react/interactables-shared/useInteractablePersistenceQueue.ts +63 -11
- package/src/react/model-context/useInteractable.test.tsx +56 -29
- package/src/react/primitive-hooks/useActionBarCopy.test.ts +5 -5
- package/src/react/primitive-hooks/useSuggestionTrigger.test.ts +33 -0
- package/src/react/primitive-hooks/useSuggestionTrigger.ts +7 -4
- package/src/react/primitives/generativeUI/GenerativeUI.test.tsx +170 -0
- package/src/react/primitives/generativeUI/GenerativeUI.tsx +43 -28
- package/src/react/primitives/message/MessageAttachments.test.tsx +2 -6
- package/src/react/primitives/message/MessageAttachments.tsx +14 -8
- package/src/react/primitives/message/MessageGroupedParts.test.tsx +155 -8
- package/src/react/primitives/message/MessageGroupedParts.tsx +19 -6
- package/src/react/primitives/message/MessageParts.test.tsx +84 -0
- package/src/react/primitives/message/MessageParts.tool-interaction.test.tsx +69 -0
- package/src/react/primitives/message/MessageParts.tsx +29 -8
- package/src/react/primitives/thread/ThreadMessages.test.tsx +25 -7
- package/src/react/primitives/thread/ThreadSuggestions.test.tsx +97 -0
- package/src/react/primitives/thread/ThreadSuggestions.tsx +29 -6
- package/src/react/providers/ReadonlyThreadProvider.tsx +2 -2
- package/src/react/providers/TextMessagePartProvider.tsx +3 -0
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.layout.test.tsx +62 -0
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.retry.test.tsx +2 -2
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.running.test.tsx +93 -0
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.test.tsx +181 -21
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.title.test.tsx +62 -17
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.tsx +112 -77
- package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +19 -3
- package/src/react/runtimes/RemoteThreadResource.ts +5 -2
- package/src/react/runtimes/assistant-transport/replayBoundaryStream.test.ts +3 -1
- package/src/react/runtimes/assistant-transport/replayBoundaryStream.ts +10 -2
- package/src/react/runtimes/assistant-transport/runManager.ts +3 -0
- package/src/react/runtimes/assistant-transport/transport-parentid.test.tsx +57 -0
- package/src/react/runtimes/assistant-transport/transport-scheduling.test.ts +73 -46
- package/src/react/runtimes/assistant-transport/transport-thread-id.test.tsx +571 -0
- package/src/react/runtimes/assistant-transport/types.ts +9 -1
- package/src/react/runtimes/assistant-transport/useAssistantTransport.spec.md +10 -0
- package/src/react/runtimes/assistant-transport/useAssistantTransportRuntime.test.tsx +108 -1
- package/src/react/runtimes/assistant-transport/useAssistantTransportRuntime.ts +33 -9
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.copy.integration.test.tsx +289 -0
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.copy.test.tsx +471 -0
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.engagement.test.tsx +330 -0
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.ts +78 -2
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.tsx +463 -2
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.ts +595 -227
- package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.test.ts +33 -4
- package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.ts +7 -3
- package/src/react/runtimes/cloud/auiV0.ts +275 -6
- package/src/react/runtimes/cloud/auiV0DecodeSafely.test.ts +873 -0
- package/src/react/runtimes/createMessageConverter.ts +9 -3
- package/src/react/runtimes/external-message-converter.test.ts +7 -3
- package/src/react/runtimes/external-store-history-copy.ts +223 -0
- package/src/react/runtimes/remote-thread-hook-on-tap.test.ts +2 -1
- package/src/react/runtimes/useExternalStoreRuntime.history-copy.test.tsx +483 -0
- package/src/react/runtimes/useExternalStoreRuntime.lifecycle.test.tsx +84 -3
- package/src/react/runtimes/useExternalStoreRuntime.suggestions.test.tsx +6 -2
- package/src/react/runtimes/useExternalStoreRuntime.ts +25 -5
- package/src/react/runtimes/useLocalRuntime.test.tsx +145 -1
- package/src/react/runtimes/useLocalRuntime.ts +8 -5
- package/src/react/runtimes/useRemoteThreadListRuntime.concurrent.test.tsx +84 -4
- package/src/react/runtimes/useRemoteThreadListRuntime.ts +5 -1
- package/src/react/types/MessagePartComponentTypes.ts +10 -0
- package/src/react/types/scopes/interactables.ts +3 -0
- package/src/runtime/api/attachment-runtime.ts +10 -5
- package/src/runtime/api/bindings.ts +6 -1
- package/src/runtime/api/composer-runtime.ts +29 -6
- package/src/runtime/api/message-part-runtime.test.ts +215 -0
- package/src/runtime/api/message-part-runtime.ts +44 -1
- package/src/runtime/api/message-runtime.test.ts +112 -2
- package/src/runtime/api/message-runtime.ts +25 -7
- package/src/runtime/api/thread-list-item-runtime.ts +5 -5
- package/src/runtime/api/thread-list-runtime.ts +3 -3
- package/src/runtime/api/thread-runtime.test.ts +59 -0
- package/src/runtime/api/thread-runtime.ts +21 -11
- package/src/runtime/base/base-composer-runtime-core.ts +548 -153
- package/src/runtime/base/base-thread-runtime-core.test.ts +1614 -136
- package/src/runtime/base/base-thread-runtime-core.ts +236 -46
- package/src/runtime/base/default-edit-composer-runtime-core.ts +24 -2
- package/src/runtime/base/default-thread-composer-runtime-core.ts +33 -3
- package/src/runtime/interfaces/composer-runtime-core.ts +19 -0
- package/src/runtime/interfaces/thread-runtime-core.ts +24 -1
- package/src/runtime/queue/message-queue.ts +11 -1
- package/src/runtime/utils/attachment-add-operations.ts +45 -2
- package/src/runtime/utils/attachment-send-operations.ts +54 -0
- package/src/runtime/utils/auto-status.test.ts +54 -0
- package/src/runtime/utils/auto-status.ts +3 -10
- package/src/runtime/utils/external-message-conversion.test.ts +91 -0
- package/src/runtime/utils/external-message-conversion.ts +9 -6
- package/src/runtime/utils/message-repository.test.ts +69 -1
- package/src/runtime/utils/message-repository.ts +14 -7
- package/src/runtime/utils/stored-message-parts.ts +216 -0
- package/src/runtime/utils/thread-message-like.test.ts +58 -0
- package/src/runtime/utils/thread-message-like.ts +79 -48
- package/src/runtime/utils/thread-runtime-lifecycle.test.ts +67 -0
- package/src/runtime/utils/thread-runtime-lifecycle.ts +42 -8
- package/src/runtime/utils/tool-interactions.test.ts +193 -0
- package/src/runtime/utils/tool-interactions.ts +147 -0
- package/src/runtimes/external-store/external-store-adapter.ts +25 -0
- package/src/runtimes/external-store/external-store-runtime-core.ts +10 -2
- package/src/runtimes/external-store/external-store-thread-list-runtime-core.ts +2 -2
- package/src/runtimes/external-store/external-store-thread-runtime-core.test.ts +49 -0
- package/src/runtimes/external-store/external-store-thread-runtime-core.ts +114 -32
- package/src/runtimes/inert/InertThreadRuntimeCore.test.ts +127 -56
- package/src/runtimes/inert/InertThreadRuntimeCore.ts +10 -1
- package/src/runtimes/local/local-thread-runtime-core.edit-cancellation.test.ts +70 -0
- package/src/runtimes/local/local-thread-runtime-core.test.ts +1866 -169
- package/src/runtimes/local/local-thread-runtime-core.ts +365 -40
- package/src/runtimes/readonly/ReadonlyThreadRuntimeCore.ts +53 -1
- package/src/runtimes/remote-thread-list/optimistic-state.ts +8 -3
- package/src/runtimes/tool-invocations/EDGE_CASES.md +19 -4
- package/src/runtimes/tool-invocations/ToolInvocationTracker.test.ts +392 -39
- package/src/runtimes/tool-invocations/ToolInvocationTracker.ts +31 -8
- package/src/store/clients/external-thread.test.ts +145 -0
- package/src/store/clients/external-thread.ts +669 -144
- package/src/store/clients/model-context-client.test.ts +8 -8
- package/src/store/clients/no-op-composer-client.ts +2 -0
- package/src/store/clients/submission-message.ts +27 -0
- package/src/store/clients/thread-message-client.test.ts +39 -0
- package/src/store/clients/thread-message-client.ts +13 -6
- package/src/store/index.ts +2 -2
- package/src/store/internal.ts +1 -0
- package/src/store/primitive-predicates.test.ts +119 -0
- package/src/store/primitive-predicates.ts +19 -4
- package/src/store/runtime-clients/composer-runtime-client.ts +4 -3
- package/src/store/runtime-clients/message-part-runtime-client.test.ts +42 -0
- package/src/store/runtime-clients/message-part-runtime-client.ts +4 -0
- package/src/store/runtime-clients/message-runtime-client.ts +5 -0
- package/src/store/runtime-clients/thread-runtime-client.test.tsx +243 -0
- package/src/store/runtime-clients/thread-runtime-client.ts +46 -9
- package/src/store/scopes/composer.ts +22 -4
- package/src/store/scopes/message.ts +12 -1
- package/src/store/scopes/part.ts +8 -0
- package/src/subscribable/subscribable.test.ts +205 -3
- package/src/subscribable/subscribable.ts +49 -7
- package/src/tests/RemoteThreadListThreadListRuntimeCore-errors.test.ts +95 -1
- package/src/tests/attachment-adapters.test.ts +16 -1
- package/src/tests/auiV0Encode.test.ts +412 -1
- package/src/tests/base-composer-runtime-core-addAttachment.test.ts +6 -6
- package/src/tests/base-composer-runtime-core-send.test.ts +722 -29
- package/src/tests/base-composer-runtime-core.test.ts +212 -5
- package/src/tests/composer-can-cancel.test.ts +35 -6
- package/src/tests/composer-can-send.test.ts +120 -1
- package/src/tests/composer-submission.test.tsx +796 -0
- package/src/tests/default-edit-composer-runtime-core.test.ts +149 -2
- package/src/tests/external-store-thread-list-runtime-core.test.ts +111 -0
- package/src/tests/external-store-thread-runtime-core-adapter.test.ts +810 -28
- package/src/tests/external-store-thread-runtime-core.test.ts +217 -0
- package/src/tests/external-thread-attachments.test.tsx +763 -26
- package/src/tests/external-thread-feedback.test.tsx +20 -7
- package/src/tests/external-thread-isLast.test.tsx +69 -0
- package/src/tests/external-thread-parity.test.tsx +1 -1
- package/src/tests/get-thread-state-isRunning.test.ts +2 -2
- package/src/tests/message-queue.test.ts +45 -10
- package/src/tests/remote-thread-list-adapter-switch.test.ts +45 -1
- package/src/tests/thread-switch-events.test.tsx +11 -7
- package/src/tests/useRemoteThreadListRuntime-controlled.test.tsx +2 -1
- package/src/types/message.test.ts +19 -0
- package/src/types/message.ts +65 -10
- package/src/utils/normalizePartStatus.ts +14 -1
- package/dist/tests/remote-thread-list-test-helpers.d.ts +0 -16
- package/dist/tests/remote-thread-list-test-helpers.d.ts.map +0 -1
- package/dist/tests/remote-thread-list-test-helpers.js +0 -59
- package/dist/tests/remote-thread-list-test-helpers.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-runtime-core.d.ts","
|
|
1
|
+
{"version":3,"file":"thread-runtime-core.d.ts","sourceRoot":"","sources":["../../../src/runtime/interfaces/thread-runtime-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,qCAAkC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,mCAAgC;AAC3D,OAAO,KAAK,EACV,a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,EAAE,OAAO,CAAC;IAEhB,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,WAAW,CAAC;IAEjD,cAAc,EAAE,MAAM,MAAM,CAAC;IAC7B,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,WAAW,CAAC;IAE5D,MAAM,CAAC,UAAU,EAAE,yBAAyB,GAAG,IAAI,CAAC;IACpD,MAAM,IAAI,yBAAyB,CAAC;IAEpC,mBAAmB,IAAI,GAAG,CAAC;IAC3B,mBAAmB,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC;IAEtC,KAAK,CAAC,eAAe,CAAC,EAAE,SAAS,iBAAiB,EAAE,GAAG,IAAI,CAAC;IAE5D;;;;;;;;;;OAUG;IACH,sBAAsB,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;IAE3D;;;;OAIG;IACH,WAAW,CAAC,CAAC,SAAS,sBAAsB,EAC1C,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,0BAA0B,CAAC,CAAC,CAAC,GACtC,WAAW,CAAC;CAChB,CAAC,CAAC"}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export {
|
|
1
|
+
export type { ComposerRuntimeCoreBinding, ThreadComposerRuntimeCoreBinding, EditComposerRuntimeCoreBinding, MessageStateBinding, } from "./api/bindings.js";
|
|
2
|
+
export { BaseAssistantRuntimeCore } from "./base/base-assistant-runtime-core.js";
|
|
3
|
+
export { BaseThreadRuntimeCore } from "./base/base-thread-runtime-core.js";
|
|
4
|
+
export { BaseComposerRuntimeCore } from "./base/base-composer-runtime-core.js";
|
|
5
|
+
export { DefaultThreadComposerRuntimeCore } from "./base/default-thread-composer-runtime-core.js";
|
|
6
|
+
export { DefaultEditComposerRuntimeCore } from "./base/default-edit-composer-runtime-core.js";
|
|
7
|
+
export { AssistantRuntimeImpl } from "./api/assistant-runtime.js";
|
|
8
|
+
export { getThreadState, ThreadRuntimeImpl } from "./api/thread-runtime.js";
|
|
9
|
+
export type { ThreadRuntimeCoreBinding, ThreadListItemRuntimeBinding, } from "./api/thread-runtime.js";
|
|
10
|
+
export { ThreadListRuntimeImpl } from "./api/thread-list-runtime.js";
|
|
11
|
+
export type { ThreadListRuntimeCoreBinding } from "./api/thread-list-runtime.js";
|
|
12
|
+
export { ThreadListItemRuntimeImpl } from "./api/thread-list-item-runtime.js";
|
|
13
|
+
export type { ThreadListItemStateBinding } from "./api/thread-list-item-runtime.js";
|
|
14
|
+
export { MessageRuntimeImpl } from "./api/message-runtime.js";
|
|
15
|
+
export { MessagePartRuntimeImpl } from "./api/message-part-runtime.js";
|
|
16
|
+
export { ComposerRuntimeImpl, ThreadComposerRuntimeImpl, EditComposerRuntimeImpl, } from "./api/composer-runtime.js";
|
|
17
|
+
export { AttachmentRuntimeImpl, ThreadComposerAttachmentRuntimeImpl, EditComposerAttachmentRuntimeImpl, MessageAttachmentRuntimeImpl, } from "./api/attachment-runtime.js";
|
|
18
|
+
export { fromThreadMessageLike } from "./utils/thread-message-like.js";
|
|
19
|
+
export { symbolInnerMessage } from "./utils/external-store-message.js";
|
|
20
|
+
export { isAutoStatus, getAutoStatus } from "./utils/auto-status.js";
|
|
21
|
+
export { ExportedMessageRepository, MessageRepository, } from "./utils/message-repository.js";
|
|
22
|
+
export type { ExportedMessageRepositoryItem } from "./utils/message-repository.js";
|
|
23
|
+
export { createMessageRepositorySession } from "./utils/message-repository-session.js";
|
|
24
|
+
export type { MessageRepositorySession, MessageRepositorySessionOptions, } from "./utils/message-repository-session.js";
|
|
25
|
+
//# sour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,EAAE,8CAA2C;AACpF,YAAY,EACV,wBAAwB,EACxB,+BAA+B,GAChC,8CAA2C"}
|
|
@@ -1,47 +1,44 @@
|
|
|
1
|
-
import { AppendMessage } from "../../types/message.js";
|
|
2
|
-
import { QueueItemState } from "./queue-item.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
readonly insertBefore?: string | null;
|
|
1
|
+
import type { AppendMessage } from "../../types/message.js";
|
|
2
|
+
import type { QueueItemState } from "./queue-item.js";
|
|
3
|
+
export type QueuePlacement = {
|
|
4
|
+
readonly lane?: "queue" | "steer";
|
|
5
|
+
readonly insertAfter?: string | null;
|
|
6
|
+
readonly insertBefore?: string | null;
|
|
8
7
|
};
|
|
9
8
|
/**
|
|
10
9
|
* The queue surface a runtime exposes so the composer can stay usable during a
|
|
11
10
|
* run and render the pending messages.
|
|
12
11
|
*/
|
|
13
|
-
type ExternalThreadQueueAdapter = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
12
|
+
export type ExternalThreadQueueAdapter = {
|
|
13
|
+
items: readonly QueueItemState[];
|
|
14
|
+
steerItems: readonly QueueItemState[];
|
|
15
|
+
/** Send a message into the queue lane, processed in order. */
|
|
16
|
+
enqueue: (message: AppendMessage) => void;
|
|
17
|
+
/** Send a message into the steer lane, processed next. */
|
|
18
|
+
steer: (message: AppendMessage) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Move a queued message between lanes or within a lane. An unanchored move
|
|
21
|
+
* into the steer lane mid-run interrupts — cancels the live run and
|
|
22
|
+
* dispatches the item — when the runtime supports cancellation; a move with
|
|
23
|
+
* `insertAfter`/`insertBefore` only places the item and never interrupts.
|
|
24
|
+
*/
|
|
25
|
+
move: (queueItemId: string, placement: QueuePlacement) => void;
|
|
26
|
+
edit: (queueItemId: string, message: AppendMessage) => void;
|
|
27
|
+
remove: (queueItemId: string) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Installed by the owning runtime, applied to a message as it leaves a lane.
|
|
30
|
+
* A message can wait through an entire run, so state the runtime attaches at
|
|
31
|
+
* send time is recomputed against the thread it actually lands on. Adapters
|
|
32
|
+
* from `createMessageQueue` provide this; a hand-rolled adapter that omits
|
|
33
|
+
* it dispatches whatever was enqueued.
|
|
34
|
+
*/
|
|
35
|
+
__internal_setDispatchTransform?: ((transform: (message: AppendMessage) => AppendMessage) => void) | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Called by the owning runtime when the user cancels the run, before the run
|
|
38
|
+
* is aborted. Pauses the queue so the cancelled run's settle keeps the
|
|
39
|
+
* pending items instead of dispatching the next one; the next send re-arms
|
|
40
|
+
* draining. A hand-rolled adapter that omits it drains on cancel.
|
|
41
|
+
*/
|
|
42
|
+
__internal_notifyCancelled?: (() => void) | undefined;
|
|
44
43
|
};
|
|
45
|
-
//#endregion
|
|
46
|
-
export { ExternalThreadQueueAdapter, QueuePlacement };
|
|
47
44
|
//# sourceMappingURL=external-thread-queue-adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-thread-queue-adapter.d.ts","
|
|
1
|
+
{"version":3,"file":"external-thread-queue-adapter.d.ts","sourceRoot":"","sources":["../../../src/runtime/queue/external-thread-queue-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA4B;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,wBAAqB;AAEnD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAClC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;IACjC,UAAU,EAAE,SAAS,cAAc,EAAE,CAAC;IACtC,8DAA8D;IAC9D,OAAO,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,0DAA0D;IAC1D,KAAK,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC;;;;;OAKG;IACH,IAAI,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,KAAK,IAAI,CAAC;IAC/D,IAAI,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IAC5D,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC;;;;;;OAMG;IACH,+BAA+B,CAAC,EAC5B,CAAC,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,aAAa,KAAK,IAAI,CAAC,GAChE,SAAS,CAAC;IACd;;;;;OAKG;IACH,0BAA0B,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CACvD,CAAC"}
|
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
import { AppendMessage } from "../../types/message.js";
|
|
2
|
-
import { ExternalThreadQueueAdapter } from "./external-thread-queue-adapter.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
cancel?: (() => void) | undefined;
|
|
1
|
+
import type { AppendMessage } from "../../types/message.js";
|
|
2
|
+
import type { ExternalThreadQueueAdapter } from "./external-thread-queue-adapter.js";
|
|
3
|
+
export type MessageQueueDriver = {
|
|
4
|
+
/**
|
|
5
|
+
* A synchronous throw is treated as a run that never started and restores
|
|
6
|
+
* the message. A driver that already started work must call `notifyBusy`
|
|
7
|
+
* before throwing.
|
|
8
|
+
*/
|
|
9
|
+
run: (message: AppendMessage, options: {
|
|
10
|
+
steer: boolean;
|
|
11
|
+
}) => void;
|
|
12
|
+
/** When omitted, steering degrades to "process next" instead of interrupting. */
|
|
13
|
+
cancel?: (() => void) | undefined;
|
|
15
14
|
};
|
|
16
|
-
type MessageQueueController = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
15
|
+
export type MessageQueueController = {
|
|
16
|
+
readonly adapter: ExternalThreadQueueAdapter;
|
|
17
|
+
hold: () => void;
|
|
18
|
+
release: () => void;
|
|
19
|
+
/** Mark a run as in flight so concurrent sends buffer; call on the rising edge. */
|
|
20
|
+
notifyBusy: () => void;
|
|
21
|
+
/** Advances to the next pending message; call on the run's falling edge. */
|
|
22
|
+
notifyIdle: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Pauses queue advance for a user-initiated cancel, so the cancelled run's
|
|
25
|
+
* settle keeps the pending items instead of dispatching the next one; the
|
|
26
|
+
* next explicit send or run start re-arms draining. Call before aborting
|
|
27
|
+
* the run.
|
|
28
|
+
*/
|
|
29
|
+
notifyCancelled: () => void;
|
|
30
|
+
/** Empties both lanes without dispatching. */
|
|
31
|
+
clear: () => void;
|
|
32
|
+
subscribe: (callback: () => void) => () => void;
|
|
32
33
|
};
|
|
33
|
-
declare const createMessageQueue: (driver: MessageQueueDriver) => MessageQueueController;
|
|
34
|
-
//#endregion
|
|
35
|
-
export { MessageQueueController, MessageQueueDriver, createMessageQueue };
|
|
34
|
+
export declare const createMessageQueue: (driver: MessageQueueDriver) => MessageQueueController;
|
|
36
35
|
//# sourceMappingURL=message-queue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-queue.d.ts","
|
|
1
|
+
{"version":3,"file":"message-queue.d.ts","sourceRoot":"","sources":["../../../src/runtime/queue/message-queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAGd,+BAA4B;AAK7B,OAAO,KAAK,EACV,0BAA0B,EAE3B,2CAAwC;AAEzC,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;OAIG;IACH,GAAG,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IACnE,iFAAiF;IACjF,MAAM,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,OAAO,EAAE,0BAA0B,CAAC;IAC7C,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,mFAAmF;IACnF,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB;;;;;OAKG;IACH,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,8CAA8C;IAC9C,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;CACjD,CAAC;AAqCF,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,kBAAkB,KACzB,sBAsSF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { notifyEventListeners } from "../../utils/notify-event-listeners.js";
|
|
2
1
|
import { generateId } from "../../utils/id.js";
|
|
2
|
+
import { notifyEventListeners } from "../../utils/notify-event-listeners.js";
|
|
3
3
|
import { getThreadMessageText } from "../../utils/text.js";
|
|
4
4
|
import { EMPTY_QUEUE_ITEMS } from "./queue-item.js";
|
|
5
5
|
//#region src/runtime/queue/message-queue.ts
|
|
@@ -24,6 +24,7 @@ const createMessageQueue = (driver) => {
|
|
|
24
24
|
const subscribers = /* @__PURE__ */ new Set();
|
|
25
25
|
let running = false;
|
|
26
26
|
let paused = false;
|
|
27
|
+
let held = false;
|
|
27
28
|
let dispatchTransform = (m) => m;
|
|
28
29
|
let suppressIdle = 0;
|
|
29
30
|
let cancelSettles = 0;
|
|
@@ -60,7 +61,7 @@ const createMessageQueue = (driver) => {
|
|
|
60
61
|
if (lanes.queue.some((item) => item.id === queueItemId)) return "queue";
|
|
61
62
|
};
|
|
62
63
|
const advance = () => {
|
|
63
|
-
if (running || paused) return;
|
|
64
|
+
if (running || paused || held) return;
|
|
64
65
|
const lane = lanes.steer.length > 0 ? "steer" : "queue";
|
|
65
66
|
const head = lanes[lane][0];
|
|
66
67
|
if (!head) return;
|
|
@@ -230,6 +231,13 @@ const createMessageQueue = (driver) => {
|
|
|
230
231
|
};
|
|
231
232
|
return {
|
|
232
233
|
adapter,
|
|
234
|
+
hold: () => {
|
|
235
|
+
held = true;
|
|
236
|
+
},
|
|
237
|
+
release: () => {
|
|
238
|
+
held = false;
|
|
239
|
+
advance();
|
|
240
|
+
},
|
|
233
241
|
notifyBusy: () => {
|
|
234
242
|
paused = false;
|
|
235
243
|
suppressIdle += cancelSettles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-queue.js","names":["AppendMessage","FileMessagePart","TextMessagePart","EMPTY_QUEUE_ITEMS","QueueItemState","generateId","notifyEventListeners","getThreadMessageText","ExternalThreadQueueAdapter","QueuePlacement","MessageQueueDriver","run","message","options","steer","cancel","MessageQueueController","adapter","notifyBusy","notifyIdle","notifyCancelled","clear","subscribe","callback","Lane","DispatchItem","id","item","getQueueItemParts","source","content","attachments","flatMap","attachment","filter","part","type","parts","push","data","image","mimeType","filename","undefined","createMessageQueue","driver","lanes","Record","queue","messages","Map","subscribers","Set","running","paused","dispatchTransform","m","suppressIdle","cancelSettles","interrupting","busyEdges","notify","setLanes","next","items","steerItems","toItem","prompt","restore","lane","dispatch","index","set","slice","laneOf","queueItemId","some","advance","length","head","get","delete","busyEdgesBeforeRun","error","interrupt","restoreLane","restoreIndex","Math","max","restoreInterrupted","replacementStarted","pendingSettles","enqueue","move","placement","fromLane","Error","toLane","fromIndex","findIndex","i","dest","anchorIndex","anchor","insertAfter","insertBefore","after","before","nextDest","edit","map","remove","__internal_setDispatchTransform","transform","__internal_notifyCancelled","add"],"sources":["../../../src/runtime/queue/message-queue.ts"],"sourcesContent":["import type {\n AppendMessage,\n FileMessagePart,\n TextMessagePart,\n} from \"../../types/message\";\nimport { EMPTY_QUEUE_ITEMS, type QueueItemState } from \"./queue-item\";\nimport { generateId } from \"../../utils/id\";\nimport { notifyEventListeners } from \"../../utils/notify-event-listeners\";\nimport { getThreadMessageText } from \"../../utils/text\";\nimport type {\n ExternalThreadQueueAdapter,\n QueuePlacement,\n} from \"./external-thread-queue-adapter\";\n\nexport type MessageQueueDriver = {\n /**\n * A synchronous throw is treated as a run that never started and restores\n * the message. A driver that already started work must call `notifyBusy`\n * before throwing.\n */\n run: (message: AppendMessage, options: { steer: boolean }) => void;\n /** When omitted, steering degrades to \"process next\" instead of interrupting. */\n cancel?: (() => void) | undefined;\n};\n\nexport type MessageQueueController = {\n readonly adapter: ExternalThreadQueueAdapter;\n /** Mark a run as in flight so concurrent sends buffer; call on the rising edge. */\n notifyBusy: () => void;\n /** Advances to the next pending message; call on the run's falling edge. */\n notifyIdle: () => void;\n /**\n * Pauses queue advance for a user-initiated cancel, so the cancelled run's\n * settle keeps the pending items instead of dispatching the next one; the\n * next explicit send or run start re-arms draining. Call before aborting\n * the run.\n */\n notifyCancelled: () => void;\n /** Empties both lanes without dispatching. */\n clear: () => void;\n subscribe: (callback: () => void) => () => void;\n};\n\ntype Lane = \"queue\" | \"steer\";\n\ntype DispatchItem = {\n id: string;\n item: QueueItemState;\n message: AppendMessage;\n};\n\nconst getQueueItemParts = (\n message: AppendMessage,\n): readonly (FileMessagePart | TextMessagePart)[] => {\n // attachment-derived text is the file body, not user-authored prose;\n // project only the file/image content of attachments\n const source = [\n ...message.content,\n ...(message.attachments ?? []).flatMap((attachment) =>\n (attachment.content ?? []).filter((part) => part.type !== \"text\"),\n ),\n ];\n const parts: (FileMessagePart | TextMessagePart)[] = [];\n for (const part of source) {\n if (part.type === \"file\" || part.type === \"text\") {\n parts.push(part);\n } else if (part.type === \"image\") {\n parts.push({\n type: \"file\",\n data: part.image,\n mimeType: \"image/*\",\n ...(part.filename !== undefined && { filename: part.filename }),\n });\n }\n }\n return parts;\n};\n\nexport const createMessageQueue = (\n driver: MessageQueueDriver,\n): MessageQueueController => {\n let lanes: Record<Lane, readonly QueueItemState[]> = {\n queue: EMPTY_QUEUE_ITEMS,\n steer: EMPTY_QUEUE_ITEMS,\n };\n const messages = new Map<string, AppendMessage>();\n const subscribers = new Set<() => void>();\n\n let running = false;\n let paused = false;\n let dispatchTransform: (message: AppendMessage) => AppendMessage = (m) => m;\n // swallow the cancelled run's settle when steering so it does not double-advance\n let suppressIdle = 0;\n // settles from cancelled runs that must drop `running` without advancing\n let cancelSettles = 0;\n let interrupting = false;\n let busyEdges = 0;\n\n const notify = () => {\n notifyEventListeners(subscribers, undefined, \"Message queue\");\n };\n\n const setLanes = (next: Record<Lane, readonly QueueItemState[]>) => {\n lanes = next;\n adapter.items = next.queue;\n adapter.steerItems = next.steer;\n notify();\n };\n\n const toItem = (id: string, message: AppendMessage): QueueItemState => ({\n id,\n prompt: getThreadMessageText(message),\n parts: getQueueItemParts(message),\n });\n\n const restore = (lane: Lane, dispatch: DispatchItem, index = 0) => {\n paused = true;\n messages.set(dispatch.id, dispatch.message);\n setLanes({\n ...lanes,\n [lane]: [\n ...lanes[lane].slice(0, index),\n dispatch.item,\n ...lanes[lane].slice(index),\n ],\n });\n };\n\n const laneOf = (queueItemId: string): Lane | undefined => {\n if (lanes.steer.some((item) => item.id === queueItemId)) return \"steer\";\n if (lanes.queue.some((item) => item.id === queueItemId)) return \"queue\";\n return undefined;\n };\n\n const advance = () => {\n if (running || paused) return;\n const lane: Lane = lanes.steer.length > 0 ? \"steer\" : \"queue\";\n const head = lanes[lane][0];\n if (!head) return;\n const message = messages.get(head.id);\n messages.delete(head.id);\n setLanes({ ...lanes, [lane]: lanes[lane].slice(1) });\n if (!message) return;\n const dispatch = { id: head.id, item: head, message };\n running = true;\n const busyEdgesBeforeRun = busyEdges;\n try {\n driver.run(dispatchTransform(message), { steer: false });\n } catch (error) {\n if (busyEdges === busyEdgesBeforeRun) {\n running = false;\n restore(lane, dispatch);\n }\n throw error;\n }\n };\n\n const interrupt = (\n dispatch: DispatchItem,\n restoreLane: Lane = \"steer\",\n restoreIndex = 0,\n ) => {\n paused = false;\n // the interrupted run settles exactly once, whether or not it was\n // already cancel-notified\n suppressIdle += Math.max(cancelSettles, 1);\n cancelSettles = 0;\n const restoreInterrupted = (replacementStarted = false) => {\n if (replacementStarted) return;\n // The live count distinguishes an outstanding cancellation settle\n // from one delivered synchronously by cancel().\n const pendingSettles = suppressIdle;\n suppressIdle = Math.max(pendingSettles - 1, 0);\n cancelSettles = pendingSettles > 0 ? 1 : 0;\n running = pendingSettles > 0;\n restore(restoreLane, dispatch, restoreIndex);\n };\n // a driver whose cancel routes through the runtime notifies this queue\n // back; the interrupt already accounted for that settle and is dispatching\n // in its place\n interrupting = true;\n try {\n driver.cancel!();\n } catch (error) {\n restoreInterrupted();\n throw error;\n } finally {\n interrupting = false;\n }\n running = true;\n const busyEdgesBeforeRun = busyEdges;\n try {\n driver.run(dispatchTransform(dispatch.message), { steer: true });\n } catch (error) {\n const replacementStarted = busyEdges !== busyEdgesBeforeRun;\n restoreInterrupted(replacementStarted);\n throw error;\n }\n };\n\n const push = (lane: Lane, message: AppendMessage) => {\n paused = false;\n const id = generateId();\n messages.set(id, message);\n setLanes({ ...lanes, [lane]: [...lanes[lane], toItem(id, message)] });\n advance();\n };\n\n const enqueue = (message: AppendMessage) => {\n push(\"queue\", message);\n };\n\n const steer = (message: AppendMessage) => {\n if (running && driver.cancel) {\n const id = generateId();\n interrupt({ id, item: toItem(id, message), message });\n return;\n }\n push(\"steer\", message);\n };\n\n const move = (queueItemId: string, placement: QueuePlacement) => {\n const fromLane = laneOf(queueItemId);\n if (!fromLane) throw new Error(`Unknown queue item \"${queueItemId}\".`);\n const toLane = placement.lane ?? fromLane;\n\n const fromIndex = lanes[fromLane].findIndex((i) => i.id === queueItemId);\n const item = lanes[fromLane][fromIndex]!;\n const dest = (toLane === fromLane ? lanes[fromLane] : lanes[toLane]).filter(\n (i) => i.id !== queueItemId,\n );\n\n const anchorIndex = (anchor: string) => {\n if (anchor === queueItemId)\n throw new Error(`Queue item \"${queueItemId}\" cannot anchor itself.`);\n const index = dest.findIndex((i) => i.id === anchor);\n if (index === -1)\n throw new Error(`Unknown anchor \"${anchor}\" in lane \"${toLane}\".`);\n return index;\n };\n\n const { insertAfter, insertBefore } = placement;\n let index: number;\n if (insertAfter === undefined && insertBefore === undefined) {\n index =\n toLane === fromLane\n ? lanes[fromLane].findIndex((i) => i.id === queueItemId)\n : dest.length;\n } else if (insertAfter !== undefined && insertBefore !== undefined) {\n const after = insertAfter === null ? -1 : anchorIndex(insertAfter);\n const before =\n insertBefore === null ? dest.length : anchorIndex(insertBefore);\n if (before !== after + 1)\n throw new Error(\n `insertAfter \"${insertAfter}\" and insertBefore \"${insertBefore}\" are not adjacent in lane \"${toLane}\".`,\n );\n index = after + 1;\n } else if (insertAfter !== undefined) {\n index = insertAfter === null ? 0 : anchorIndex(insertAfter) + 1;\n } else {\n index = insertBefore === null ? dest.length : anchorIndex(insertBefore!);\n }\n\n // placement and immediate dispatch cannot coexist: an anchored move into\n // the steer lane places without interrupting; only an unanchored one\n // cancels the live run and dispatches\n if (\n insertAfter === undefined &&\n insertBefore === undefined &&\n toLane === \"steer\" &&\n fromLane !== \"steer\" &&\n running &&\n driver.cancel\n ) {\n const message = messages.get(queueItemId)!;\n messages.delete(queueItemId);\n setLanes({\n queue: lanes.queue.filter((i) => i.id !== queueItemId),\n steer: lanes.steer,\n });\n interrupt({ id: queueItemId, item, message }, fromLane, fromIndex);\n return;\n }\n\n const nextDest = [...dest.slice(0, index), item, ...dest.slice(index)];\n const next = { ...lanes, [toLane]: nextDest };\n if (toLane !== fromLane)\n next[fromLane] = lanes[fromLane].filter((i) => i.id !== queueItemId);\n setLanes(next);\n advance();\n };\n\n const edit = (queueItemId: string, message: AppendMessage) => {\n const lane = laneOf(queueItemId);\n if (!lane) throw new Error(`Unknown queue item \"${queueItemId}\".`);\n messages.set(queueItemId, message);\n setLanes({\n ...lanes,\n [lane]: lanes[lane].map((item) =>\n item.id === queueItemId ? toItem(queueItemId, message) : item,\n ),\n });\n };\n\n const remove = (queueItemId: string) => {\n if (!messages.delete(queueItemId)) return;\n setLanes({\n queue: lanes.queue.filter((item) => item.id !== queueItemId),\n steer: lanes.steer.filter((item) => item.id !== queueItemId),\n });\n };\n\n const notifyCancelled = () => {\n if (interrupting) return;\n if (running && cancelSettles === 0) {\n paused = true;\n cancelSettles = 1;\n }\n };\n\n const adapter: ExternalThreadQueueAdapter = {\n items: lanes.queue,\n steerItems: lanes.steer,\n enqueue,\n steer,\n move,\n edit,\n remove,\n __internal_setDispatchTransform: (transform) => {\n dispatchTransform = transform;\n },\n __internal_notifyCancelled: notifyCancelled,\n };\n\n return {\n adapter,\n notifyBusy: () => {\n paused = false;\n // a cancelled run's settle that is still outstanding belongs to a run\n // this new one replaces; swallow it entirely\n suppressIdle += cancelSettles;\n cancelSettles = 0;\n running = true;\n busyEdges++;\n },\n notifyIdle: () => {\n if (suppressIdle > 0) {\n suppressIdle--;\n return;\n }\n if (cancelSettles > 0) cancelSettles--;\n running = false;\n advance();\n },\n notifyCancelled,\n clear: () => {\n messages.clear();\n setLanes({ queue: EMPTY_QUEUE_ITEMS, steer: EMPTY_QUEUE_ITEMS });\n },\n subscribe: (callback) => {\n subscribers.add(callback);\n return () => {\n subscribers.delete(callback);\n };\n },\n };\n};\n"],"mappings":";;;;;AAmDA,MAAM4B,qBACJhB,YACmD;CAGnD,MAAMiB,SAAS,CACb,GAAGjB,QAAQkB,SACX,IAAIlB,QAAQmB,eAAe,CAAA,EAAA,CAAIC,SAASC,gBACrCA,WAAWH,WAAW,CAAA,EAAA,CAAII,QAAQC,SAASA,KAAKC,SAAS,MAAM,CAClE,CAAC;CAEH,MAAMC,QAA+C,CAAA;CACrD,KAAK,MAAMF,QAAQN,QACjB,IAAIM,KAAKC,SAAS,UAAUD,KAAKC,SAAS,QACxCC,MAAMC,KAAKH,IAAI;MACV,IAAIA,KAAKC,SAAS,SACvBC,MAAMC,KAAK;EACTF,MAAM;EACNG,MAAMJ,KAAKK;EACXC,UAAU;EACV,GAAIN,KAAKO,aAAaC,KAAAA,KAAa,EAAED,UAAUP,KAAKO,SAAS;CAC/D,CAAC;CAGL,OAAOL;AACT;AAEA,MAAaO,sBACXC,WAC2B;CAC3B,IAAIC,QAAiD;EACnDE,OAAO7C;EACPW,OAAOX;CACT;CACA,MAAM8C,2BAAW,IAAIC,IAA2B;CAChD,MAAMC,8BAAc,IAAIC,IAAgB;CAExC,IAAIC,UAAU;CACd,IAAIC,SAAS;CACb,IAAIC,qBAAgEC,MAAMA;CAE1E,IAAIC,eAAe;CAEnB,IAAIC,gBAAgB;CACpB,IAAIC,eAAe;CACnB,IAAIC,YAAY;CAEhB,MAAMC,eAAe;EACnBvD,qBAAqB6C,aAAaR,KAAAA,GAAW,eAAe;CAC9D;CAEA,MAAMmB,YAAYC,SAAkD;EAClEjB,QAAQiB;EACR9C,QAAQ+C,QAAQD,KAAKf;EACrB/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OAAO,IAAIe,IAC3D;EACF,CAAC;CACH;CAEA,MAAMoF,UAAUpC,gBAAwB;EACtC,IAAI,CAAC1B,SAASgC,OAAON,WAAW,GAAG;EACnCb,SAAS;GACPd,OAAOF,MAAME,MAAMd,QAAQP,SAASA,KAAKD,OAAOiD,WAAW;GAC3D7D,OAAOgC,MAAMhC,MAAMoB,QAAQP,SAASA,KAAKD,OAAOiD,WAAW;EAC7D,CAAC;CACH;CAEA,MAAMvD,wBAAwB;EAC5B,IAAIuC,cAAc;EAClB,IAAIN,WAAWK,kBAAkB,GAAG;GAClCJ,SAAS;GACTI,gBAAgB;EAClB;CACF;CAEA,MAAMzC,UAAsC;EAC1C+C,OAAOlB,MAAME;EACbiB,YAAYnB,MAAMhC;EAClB8E;EACA9E;EACA+E;EACAgB;EACAE;EACAC,kCAAkCC,cAAc;GAC9C1D,oBAAoB0D;EACtB;EACAC,4BAA4B9F;CAC9B;CAEA,OAAO;EACLH;EACAC,kBAAkB;GAChBoC,SAAS;GAGTG,gBAAgBC;GAChBA,gBAAgB;GAChBL,UAAU;GACVO;EACF;EACAzC,kBAAkB;GAChB,IAAIsC,eAAe,GAAG;IACpBA;IACA;GACF;GACA,IAAIC,gBAAgB,GAAGA;GACvBL,UAAU;GACVwB,QAAQ;EACV;EACAzD;EACAC,aAAa;GACX4B,SAAS5B,MAAM;GACfyC,SAAS;IAAEd,OAAO7C;IAAmBW,OAAOX;GAAkB,CAAC;EACjE;EACAmB,YAAYC,aAAa;GACvB4B,YAAYgE,IAAI5F,QAAQ;GACxB,aAAa;IACX4B,YAAY8B,OAAO1D,QAAQ;GAC7B;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"message-queue.js","names":["AppendMessage","FileMessagePart","TextMessagePart","EMPTY_QUEUE_ITEMS","QueueItemState","generateId","notifyEventListeners","getThreadMessageText","ExternalThreadQueueAdapter","QueuePlacement","MessageQueueDriver","run","message","options","steer","cancel","MessageQueueController","adapter","hold","release","notifyBusy","notifyIdle","notifyCancelled","clear","subscribe","callback","Lane","DispatchItem","id","item","getQueueItemParts","source","content","attachments","flatMap","attachment","filter","part","type","parts","push","data","image","mimeType","filename","undefined","createMessageQueue","driver","lanes","Record","queue","messages","Map","subscribers","Set","running","paused","held","dispatchTransform","m","suppressIdle","cancelSettles","interrupting","busyEdges","notify","setLanes","next","items","steerItems","toItem","prompt","restore","lane","dispatch","index","set","slice","laneOf","queueItemId","some","advance","length","head","get","delete","busyEdgesBeforeRun","error","interrupt","restoreLane","restoreIndex","Math","max","restoreInterrupted","replacementStarted","pendingSettles","enqueue","move","placement","fromLane","Error","toLane","fromIndex","findIndex","i","dest","anchorIndex","anchor","insertAfter","insertBefore","after","before","nextDest","edit","map","remove","__internal_setDispatchTransform","transform","__internal_notifyCancelled","add"],"sources":["../../../src/runtime/queue/message-queue.ts"],"sourcesContent":["import type {\n AppendMessage,\n FileMessagePart,\n TextMessagePart,\n} from \"../../types/message\";\nimport { EMPTY_QUEUE_ITEMS, type QueueItemState } from \"./queue-item\";\nimport { generateId } from \"../../utils/id\";\nimport { notifyEventListeners } from \"../../utils/notify-event-listeners\";\nimport { getThreadMessageText } from \"../../utils/text\";\nimport type {\n ExternalThreadQueueAdapter,\n QueuePlacement,\n} from \"./external-thread-queue-adapter\";\n\nexport type MessageQueueDriver = {\n /**\n * A synchronous throw is treated as a run that never started and restores\n * the message. A driver that already started work must call `notifyBusy`\n * before throwing.\n */\n run: (message: AppendMessage, options: { steer: boolean }) => void;\n /** When omitted, steering degrades to \"process next\" instead of interrupting. */\n cancel?: (() => void) | undefined;\n};\n\nexport type MessageQueueController = {\n readonly adapter: ExternalThreadQueueAdapter;\n hold: () => void;\n release: () => void;\n /** Mark a run as in flight so concurrent sends buffer; call on the rising edge. */\n notifyBusy: () => void;\n /** Advances to the next pending message; call on the run's falling edge. */\n notifyIdle: () => void;\n /**\n * Pauses queue advance for a user-initiated cancel, so the cancelled run's\n * settle keeps the pending items instead of dispatching the next one; the\n * next explicit send or run start re-arms draining. Call before aborting\n * the run.\n */\n notifyCancelled: () => void;\n /** Empties both lanes without dispatching. */\n clear: () => void;\n subscribe: (callback: () => void) => () => void;\n};\n\ntype Lane = \"queue\" | \"steer\";\n\ntype DispatchItem = {\n id: string;\n item: QueueItemState;\n message: AppendMessage;\n};\n\nconst getQueueItemParts = (\n message: AppendMessage,\n): readonly (FileMessagePart | TextMessagePart)[] => {\n // attachment-derived text is the file body, not user-authored prose;\n // project only the file/image content of attachments\n const source = [\n ...message.content,\n ...(message.attachments ?? []).flatMap((attachment) =>\n (attachment.content ?? []).filter((part) => part.type !== \"text\"),\n ),\n ];\n const parts: (FileMessagePart | TextMessagePart)[] = [];\n for (const part of source) {\n if (part.type === \"file\" || part.type === \"text\") {\n parts.push(part);\n } else if (part.type === \"image\") {\n parts.push({\n type: \"file\",\n data: part.image,\n mimeType: \"image/*\",\n ...(part.filename !== undefined && { filename: part.filename }),\n });\n }\n }\n return parts;\n};\n\nexport const createMessageQueue = (\n driver: MessageQueueDriver,\n): MessageQueueController => {\n let lanes: Record<Lane, readonly QueueItemState[]> = {\n queue: EMPTY_QUEUE_ITEMS,\n steer: EMPTY_QUEUE_ITEMS,\n };\n const messages = new Map<string, AppendMessage>();\n const subscribers = new Set<() => void>();\n\n let running = false;\n let paused = false;\n let held = false;\n let dispatchTransform: (message: AppendMessage) => AppendMessage = (m) => m;\n // swallow the cancelled run's settle when steering so it does not double-advance\n let suppressIdle = 0;\n // settles from cancelled runs that must drop `running` without advancing\n let cancelSettles = 0;\n let interrupting = false;\n let busyEdges = 0;\n\n const notify = () => {\n notifyEventListeners(subscribers, undefined, \"Message queue\");\n };\n\n const setLanes = (next: Record<Lane, readonly QueueItemState[]>) => {\n lanes = next;\n adapter.items = next.queue;\n adapter.steerItems = next.steer;\n notify();\n };\n\n const toItem = (id: string, message: AppendMessage): QueueItemState => ({\n id,\n prompt: getThreadMessageText(message),\n parts: getQueueItemParts(message),\n });\n\n const restore = (lane: Lane, dispatch: DispatchItem, index = 0) => {\n paused = true;\n messages.set(dispatch.id, dispatch.message);\n setLanes({\n ...lanes,\n [lane]: [\n ...lanes[lane].slice(0, index),\n dispatch.item,\n ...lanes[lane].slice(index),\n ],\n });\n };\n\n const laneOf = (queueItemId: string): Lane | undefined => {\n if (lanes.steer.some((item) => item.id === queueItemId)) return \"steer\";\n if (lanes.queue.some((item) => item.id === queueItemId)) return \"queue\";\n return undefined;\n };\n\n const advance = () => {\n if (running || paused || held) return;\n const lane: Lane = lanes.steer.length > 0 ? \"steer\" : \"queue\";\n const head = lanes[lane][0];\n if (!head) return;\n const message = messages.get(head.id);\n messages.delete(head.id);\n setLanes({ ...lanes, [lane]: lanes[lane].slice(1) });\n if (!message) return;\n const dispatch = { id: head.id, item: head, message };\n running = true;\n const busyEdgesBeforeRun = busyEdges;\n try {\n driver.run(dispatchTransform(message), { steer: false });\n } catch (error) {\n if (busyEdges === busyEdgesBeforeRun) {\n running = false;\n restore(lane, dispatch);\n }\n throw error;\n }\n };\n\n const interrupt = (\n dispatch: DispatchItem,\n restoreLane: Lane = \"steer\",\n restoreIndex = 0,\n ) => {\n paused = false;\n // the interrupted run settles exactly once, whether or not it was\n // already cancel-notified\n suppressIdle += Math.max(cancelSettles, 1);\n cancelSettles = 0;\n const restoreInterrupted = (replacementStarted = false) => {\n if (replacementStarted) return;\n // The live count distinguishes an outstanding cancellation settle\n // from one delivered synchronously by cancel().\n const pendingSettles = suppressIdle;\n suppressIdle = Math.max(pendingSettles - 1, 0);\n cancelSettles = pendingSettles > 0 ? 1 : 0;\n running = pendingSettles > 0;\n restore(restoreLane, dispatch, restoreIndex);\n };\n // a driver whose cancel routes through the runtime notifies this queue\n // back; the interrupt already accounted for that settle and is dispatching\n // in its place\n interrupting = true;\n try {\n driver.cancel!();\n } catch (error) {\n restoreInterrupted();\n throw error;\n } finally {\n interrupting = false;\n }\n running = true;\n const busyEdgesBeforeRun = busyEdges;\n try {\n driver.run(dispatchTransform(dispatch.message), { steer: true });\n } catch (error) {\n const replacementStarted = busyEdges !== busyEdgesBeforeRun;\n restoreInterrupted(replacementStarted);\n throw error;\n }\n };\n\n const push = (lane: Lane, message: AppendMessage) => {\n paused = false;\n const id = generateId();\n messages.set(id, message);\n setLanes({ ...lanes, [lane]: [...lanes[lane], toItem(id, message)] });\n advance();\n };\n\n const enqueue = (message: AppendMessage) => {\n push(\"queue\", message);\n };\n\n const steer = (message: AppendMessage) => {\n if (running && driver.cancel) {\n const id = generateId();\n interrupt({ id, item: toItem(id, message), message });\n return;\n }\n push(\"steer\", message);\n };\n\n const move = (queueItemId: string, placement: QueuePlacement) => {\n const fromLane = laneOf(queueItemId);\n if (!fromLane) throw new Error(`Unknown queue item \"${queueItemId}\".`);\n const toLane = placement.lane ?? fromLane;\n\n const fromIndex = lanes[fromLane].findIndex((i) => i.id === queueItemId);\n const item = lanes[fromLane][fromIndex]!;\n const dest = (toLane === fromLane ? lanes[fromLane] : lanes[toLane]).filter(\n (i) => i.id !== queueItemId,\n );\n\n const anchorIndex = (anchor: string) => {\n if (anchor === queueItemId)\n throw new Error(`Queue item \"${queueItemId}\" cannot anchor itself.`);\n const index = dest.findIndex((i) => i.id === anchor);\n if (index === -1)\n throw new Error(`Unknown anchor \"${anchor}\" in lane \"${toLane}\".`);\n return index;\n };\n\n const { insertAfter, insertBefore } = placement;\n let index: number;\n if (insertAfter === undefined && insertBefore === undefined) {\n index =\n toLane === fromLane\n ? lanes[fromLane].findIndex((i) => i.id === queueItemId)\n : dest.length;\n } else if (insertAfter !== undefined && insertBefore !== undefined) {\n const after = insertAfter === null ? -1 : anchorIndex(insertAfter);\n const before =\n insertBefore === null ? dest.length : anchorIndex(insertBefore);\n if (before !== after + 1)\n throw new Error(\n `insertAfter \"${insertAfter}\" and insertBefore \"${insertBefore}\" are not adjacent in lane \"${toLane}\".`,\n );\n index = after + 1;\n } else if (insertAfter !== undefined) {\n index = insertAfter === null ? 0 : anchorIndex(insertAfter) + 1;\n } else {\n index = insertBefore === null ? dest.length : anchorIndex(insertBefore!);\n }\n\n // placement and immediate dispatch cannot coexist: an anchored move into\n // the steer lane places without interrupting; only an unanchored one\n // cancels the live run and dispatches\n if (\n insertAfter === undefined &&\n insertBefore === undefined &&\n toLane === \"steer\" &&\n fromLane !== \"steer\" &&\n running &&\n driver.cancel\n ) {\n const message = messages.get(queueItemId)!;\n messages.delete(queueItemId);\n setLanes({\n queue: lanes.queue.filter((i) => i.id !== queueItemId),\n steer: lanes.steer,\n });\n interrupt({ id: queueItemId, item, message }, fromLane, fromIndex);\n return;\n }\n\n const nextDest = [...dest.slice(0, index), item, ...dest.slice(index)];\n const next = { ...lanes, [toLane]: nextDest };\n if (toLane !== fromLane)\n next[fromLane] = lanes[fromLane].filter((i) => i.id !== queueItemId);\n setLanes(next);\n advance();\n };\n\n const edit = (queueItemId: string, message: AppendMessage) => {\n const lane = laneOf(queueItemId);\n if (!lane) throw new Error(`Unknown queue item \"${queueItemId}\".`);\n messages.set(queueItemId, message);\n setLanes({\n ...lanes,\n [lane]: lanes[lane].map((item) =>\n item.id === queueItemId ? toItem(queueItemId, message) : item,\n ),\n });\n };\n\n const remove = (queueItemId: string) => {\n if (!messages.delete(queueItemId)) return;\n setLanes({\n queue: lanes.queue.filter((item) => item.id !== queueItemId),\n steer: lanes.steer.filter((item) => item.id !== queueItemId),\n });\n };\n\n const notifyCancelled = () => {\n if (interrupting) return;\n if (running && cancelSettles === 0) {\n paused = true;\n cancelSettles = 1;\n }\n };\n\n const adapter: ExternalThreadQueueAdapter = {\n items: lanes.queue,\n steerItems: lanes.steer,\n enqueue,\n steer,\n move,\n edit,\n remove,\n __internal_setDispatchTransform: (transform) => {\n dispatchTransform = transform;\n },\n __internal_notifyCancelled: notifyCancelled,\n };\n\n return {\n adapter,\n hold: () => {\n held = true;\n },\n release: () => {\n held = false;\n advance();\n },\n notifyBusy: () => {\n paused = false;\n // a cancelled run's settle that is still outstanding belongs to a run\n // this new one replaces; swallow it entirely\n suppressIdle += cancelSettles;\n cancelSettles = 0;\n running = true;\n busyEdges++;\n },\n notifyIdle: () => {\n if (suppressIdle > 0) {\n suppressIdle--;\n return;\n }\n if (cancelSettles > 0) cancelSettles--;\n running = false;\n advance();\n },\n notifyCancelled,\n clear: () => {\n messages.clear();\n setLanes({ queue: EMPTY_QUEUE_ITEMS, steer: EMPTY_QUEUE_ITEMS });\n },\n subscribe: (callback) => {\n subscribers.add(callback);\n return () => {\n subscribers.delete(callback);\n };\n },\n };\n};\n"],"mappings":";;;;;AAqDA,MAAM8B,qBACJlB,YACmD;CAGnD,MAAMmB,SAAS,CACb,GAAGnB,QAAQoB,SACX,IAAIpB,QAAQqB,eAAe,CAAA,EAAA,CAAIC,SAASC,gBACrCA,WAAWH,WAAW,CAAA,EAAA,CAAII,QAAQC,SAASA,KAAKC,SAAS,MAAM,CAClE,CAAC;CAEH,MAAMC,QAA+C,CAAA;CACrD,KAAK,MAAMF,QAAQN,QACjB,IAAIM,KAAKC,SAAS,UAAUD,KAAKC,SAAS,QACxCC,MAAMC,KAAKH,IAAI;MACV,IAAIA,KAAKC,SAAS,SACvBC,MAAMC,KAAK;EACTF,MAAM;EACNG,MAAMJ,KAAKK;EACXC,UAAU;EACV,GAAIN,KAAKO,aAAaC,KAAAA,KAAa,EAAED,UAAUP,KAAKO,SAAS;CAC/D,CAAC;CAGL,OAAOL;AACT;AAEA,MAAaO,sBACXC,WAC2B;CAC3B,IAAIC,QAAiD;EACnDE,OAAO/C;EACPW,OAAOX;CACT;CACA,MAAMgD,2BAAW,IAAIC,IAA2B;CAChD,MAAMC,8BAAc,IAAIC,IAAgB;CAExC,IAAIC,UAAU;CACd,IAAIC,SAAS;CACb,IAAIC,OAAO;CACX,IAAIC,qBAAgEC,MAAMA;CAE1E,IAAIC,eAAe;CAEnB,IAAIC,gBAAgB;CACpB,IAAIC,eAAe;CACnB,IAAIC,YAAY;CAEhB,MAAMC,eAAe;EACnB1D,qBAAqB+C,aAAaR,KAAAA,GAAW,eAAe;CAC9D;CAEA,MAAMo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TextMessagePart } from "../../types/message.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
readonly parts: readonly (FileMessagePart | TextMessagePart)[];
|
|
1
|
+
import type { FileMessagePart, TextMessagePart } from "../../types/message.js";
|
|
2
|
+
export type QueueItemState = {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
/** @deprecated Derive from the text parts of `parts` instead. Removal after 2026-11-05. */
|
|
5
|
+
readonly prompt: string;
|
|
6
|
+
readonly parts: readonly (FileMessagePart | TextMessagePart)[];
|
|
8
7
|
};
|
|
9
|
-
declare const EMPTY_QUEUE_ITEMS: readonly QueueItemState[];
|
|
10
|
-
//#endregion
|
|
11
|
-
export { EMPTY_QUEUE_ITEMS, QueueItemState };
|
|
8
|
+
export declare const EMPTY_QUEUE_ITEMS: readonly QueueItemState[];
|
|
12
9
|
//# sourceMappingURL=queue-item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue-item.d.ts","
|
|
1
|
+
{"version":3,"file":"queue-item.d.ts","sourceRoot":"","sources":["../../../src/runtime/queue/queue-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,+BAA4B;AAE5E,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,2FAA2F;IAC3F,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,eAAe,GAAG,eAAe,CAAC,EAAE,CAAC;CAChE,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,SAAS,cAAc,EAAsB,CAAC"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
type AbortableThreadLoadPurpose = "initial" | "reload";
|
|
1
|
+
export type AbortableThreadLoadPurpose = "initial" | "reload";
|
|
3
2
|
type AbortableThreadLoadOptions = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
purpose?: AbortableThreadLoadPurpose;
|
|
4
|
+
load: (signal: AbortSignal) => Promise<void>;
|
|
5
|
+
onSettled: () => void;
|
|
6
|
+
onInitialError: (error: unknown) => void;
|
|
8
7
|
};
|
|
9
|
-
declare const createAbortableThreadLoad: () => {
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export declare const createAbortableThreadLoad: () => {
|
|
9
|
+
abort(purpose?: AbortableThreadLoadPurpose): void;
|
|
10
|
+
run({ purpose, load, onSettled, onInitialError, }: AbortableThreadLoadOptions): Promise<void>;
|
|
12
11
|
};
|
|
13
|
-
|
|
14
|
-
export { AbortableThreadLoadPurpose, createAbortableThreadLoad };
|
|
12
|
+
export {};
|
|
15
13
|
//# sourceMappingURL=abortable-thread-load.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abortable-thread-load.d.ts","
|
|
1
|
+
{"version":3,"file":"abortable-thread-load.d.ts","sourceRoot":"","sources":["../../../src/runtime/utils/abortable-thread-load.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,0BAA0B,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE9D,KAAK,0BAA0B,GAAG;IAChC,OAAO,CAAC,EAAE,0BAA0B,CAAC;IACrC,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,yBAAyB;oBAQlB,0BAA0B;uDASvC,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;CA0BhD,CAAC"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
type AttachmentAddOperation = {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { Attachment } from "../../types/attachment.js";
|
|
2
|
+
export type AttachmentAddOperation = {
|
|
3
|
+
cancelled: boolean;
|
|
4
|
+
attachmentIds: Set<string>;
|
|
5
5
|
};
|
|
6
|
-
declare class AttachmentAddOperations {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
export declare class AttachmentAddOperations {
|
|
7
|
+
private readonly operations;
|
|
8
|
+
private readonly uploading;
|
|
9
|
+
start(): AttachmentAddOperation;
|
|
10
|
+
accept(operation: AttachmentAddOperation, attachment: Pick<Attachment, "id" | "status">): boolean;
|
|
11
|
+
finish(operation: AttachmentAddOperation): void;
|
|
12
|
+
isCancelled(operation: AttachmentAddOperation): boolean;
|
|
13
|
+
cancel(attachmentId: string): void;
|
|
14
|
+
cancelAll(): void;
|
|
15
|
+
whenSendable(attachmentId: string): Promise<void> | undefined;
|
|
16
|
+
private settle;
|
|
14
17
|
}
|
|
15
|
-
declare const drainAttachmentAdd: <T>(result: Promise<T> | AsyncIterable<T>, accept: (attachment: T) => boolean) => Promise<void>;
|
|
16
|
-
//#endregion
|
|
17
|
-
export { AttachmentAddOperation, AttachmentAddOperations, drainAttachmentAdd };
|
|
18
|
+
export declare const drainAttachmentAdd: <T>(result: Promise<T> | AsyncIterable<T>, accept: (attachment: T) => boolean) => Promise<void>;
|
|
18
19
|
//# sourceMappingURL=attachment-add-operations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-add-operations.d.ts","
|
|
1
|
+
{"version":3,"file":"attachment-add-operations.d.ts","sourceRoot":"","sources":["../../../src/runtime/utils/attachment-add-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kCAA+B;AAEzD,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC5B,CAAC;AAEF,qBAAa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqC;IAChE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAGtB;IAEJ,KAAK;IASL,MAAM,CACJ,SAAS,EAAE,sBAAsB,EACjC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,GAAG,QAAQ,CAAC;IAoB/C,MAAM,CAAC,SAAS,EAAE,sBAAsB;IAMxC,WAAW,CAAC,SAAS,EAAE,sBAAsB;IAI7C,MAAM,CAAC,YAAY,EAAE,MAAM;IAS3B,SAAS;IAST,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS;IAQ7D,OAAO,CAAC,MAAM;CAOf;AAED,eAAO,MAAM,kBAAkB,GAAU,CAAC,EACxC,QAAQ,OAAO,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,EACrC,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAK,OAAO,kBASnC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//#region src/runtime/utils/attachment-add-operations.ts
|
|
2
2
|
var AttachmentAddOperations = class {
|
|
3
3
|
operations = /* @__PURE__ */ new Set();
|
|
4
|
+
uploading = /* @__PURE__ */ new Map();
|
|
4
5
|
start() {
|
|
5
6
|
const operation = {
|
|
6
7
|
cancelled: false,
|
|
@@ -9,13 +10,20 @@ var AttachmentAddOperations = class {
|
|
|
9
10
|
this.operations.add(operation);
|
|
10
11
|
return operation;
|
|
11
12
|
}
|
|
12
|
-
accept(operation,
|
|
13
|
+
accept(operation, attachment) {
|
|
13
14
|
if (operation.cancelled) return false;
|
|
14
|
-
operation.attachmentIds.add(
|
|
15
|
+
operation.attachmentIds.add(attachment.id);
|
|
16
|
+
const entry = this.uploading.get(attachment.id);
|
|
17
|
+
if (entry?.operation !== operation && (entry || attachment.status.type === "running")) this.uploading.set(attachment.id, {
|
|
18
|
+
operation,
|
|
19
|
+
waiters: entry?.waiters ?? /* @__PURE__ */ new Set()
|
|
20
|
+
});
|
|
21
|
+
if (attachment.status.type !== "running") this.settle(attachment.id, operation);
|
|
15
22
|
return true;
|
|
16
23
|
}
|
|
17
24
|
finish(operation) {
|
|
18
25
|
this.operations.delete(operation);
|
|
26
|
+
for (const attachmentId of operation.attachmentIds) this.settle(attachmentId, operation);
|
|
19
27
|
}
|
|
20
28
|
isCancelled(operation) {
|
|
21
29
|
return operation.cancelled;
|
|
@@ -26,10 +34,24 @@ var AttachmentAddOperations = class {
|
|
|
26
34
|
operation.cancelled = true;
|
|
27
35
|
this.operations.delete(operation);
|
|
28
36
|
}
|
|
37
|
+
this.settle(attachmentId);
|
|
29
38
|
}
|
|
30
39
|
cancelAll() {
|
|
31
40
|
for (const operation of this.operations) operation.cancelled = true;
|
|
32
41
|
this.operations.clear();
|
|
42
|
+
for (const attachmentId of [...this.uploading.keys()]) this.settle(attachmentId);
|
|
43
|
+
}
|
|
44
|
+
whenSendable(attachmentId) {
|
|
45
|
+
const entry = this.uploading.get(attachmentId);
|
|
46
|
+
if (!entry) return void 0;
|
|
47
|
+
return new Promise((resolve) => entry.waiters.add(resolve));
|
|
48
|
+
}
|
|
49
|
+
settle(attachmentId, operation) {
|
|
50
|
+
const entry = this.uploading.get(attachmentId);
|
|
51
|
+
if (!entry) return;
|
|
52
|
+
if (operation && entry.operation !== operation) return;
|
|
53
|
+
this.uploading.delete(attachmentId);
|
|
54
|
+
for (const resolve of entry.waiters) resolve();
|
|
33
55
|
}
|
|
34
56
|
};
|
|
35
57
|
const drainAttachmentAdd = async (result, accept) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-add-operations.js","names":["AttachmentAddOperation","cancelled","attachmentIds","Set","AttachmentAddOperations","operations","
|
|
1
|
+
{"version":3,"file":"attachment-add-operations.js","names":["Attachment","AttachmentAddOperation","cancelled","attachmentIds","Set","AttachmentAddOperations","operations","uploading","Map","operation","waiters","start","add","accept","attachment","Pick","id","entry","get","status","type","set","settle","finish","delete","attachmentId","isCancelled","cancel","has","cancelAll","clear","keys","whenSendable","Promise","undefined","resolve","drainAttachmentAdd","result","T","AsyncIterable","Symbol","asyncIterator"],"sources":["../../../src/runtime/utils/attachment-add-operations.ts"],"sourcesContent":["import type { Attachment } from \"../../types/attachment\";\n\nexport type AttachmentAddOperation = {\n cancelled: boolean;\n attachmentIds: Set<string>;\n};\n\nexport class AttachmentAddOperations {\n private readonly operations = new Set<AttachmentAddOperation>();\n private readonly uploading = new Map<\n string,\n { operation: AttachmentAddOperation; waiters: Set<() => void> }\n >();\n\n start() {\n const operation: AttachmentAddOperation = {\n cancelled: false,\n attachmentIds: new Set(),\n };\n this.operations.add(operation);\n return operation;\n }\n\n accept(\n operation: AttachmentAddOperation,\n attachment: Pick<Attachment, \"id\" | \"status\">,\n ) {\n if (operation.cancelled) return false;\n operation.attachmentIds.add(attachment.id);\n // The composer shows one attachment per id, so the add that updated it\n // last owns its upload; an add that ended earlier no longer speaks for it.\n const entry = this.uploading.get(attachment.id);\n if (\n entry?.operation !== operation &&\n (entry || attachment.status.type === \"running\")\n )\n this.uploading.set(attachment.id, {\n operation,\n waiters: entry?.waiters ?? new Set(),\n });\n if (attachment.status.type !== \"running\")\n this.settle(attachment.id, operation);\n return true;\n }\n\n finish(operation: AttachmentAddOperation) {\n this.operations.delete(operation);\n for (const attachmentId of operation.attachmentIds)\n this.settle(attachmentId, operation);\n }\n\n isCancelled(operation: AttachmentAddOperation) {\n return operation.cancelled;\n }\n\n cancel(attachmentId: string) {\n for (const operation of [...this.operations]) {\n if (!operation.attachmentIds.has(attachmentId)) continue;\n operation.cancelled = true;\n this.operations.delete(operation);\n }\n this.settle(attachmentId);\n }\n\n cancelAll() {\n for (const operation of this.operations) {\n operation.cancelled = true;\n }\n this.operations.clear();\n for (const attachmentId of [...this.uploading.keys()])\n this.settle(attachmentId);\n }\n\n whenSendable(attachmentId: string): Promise<void> | undefined {\n const entry = this.uploading.get(attachmentId);\n if (!entry) return undefined;\n return new Promise((resolve) => entry.waiters.add(resolve));\n }\n\n // An attachment id outlives the add that produced it, so an add that ends\n // after a newer one took the id over must not release its upload.\n private settle(attachmentId: string, operation?: AttachmentAddOperation) {\n const entry = this.uploading.get(attachmentId);\n if (!entry) return;\n if (operation && entry.operation !== operation) return;\n this.uploading.delete(attachmentId);\n for (const resolve of entry.waiters) resolve();\n }\n}\n\nexport const drainAttachmentAdd = async <T>(\n result: Promise<T> | AsyncIterable<T>,\n accept: (attachment: T) => boolean,\n) => {\n if (Symbol.asyncIterator in result) {\n for await (const attachment of result) {\n if (!accept(attachment)) break;\n }\n } else {\n accept(await result);\n }\n};\n"],"mappings":";AAOA,IAAaK,0BAAb,MAAqC;CACnC,6BAA8B,IAAID,IAA4B;CAC9D,4BAA6B,IAAII,IAG/B;CAEFG,QAAQ;EACN,MAAMF,YAAoC;GACxCP,WAAW;GACXC,+BAAe,IAAIC,IAAI;EACzB;EACA,KAAKE,WAAWM,IAAIH,SAAS;EAC7B,OAAOA;CACT;CAEAI,OACEJ,WACAK,YACA;EACA,IAAIL,UAAUP,WAAW,OAAO;EAChCO,UAAUN,cAAcS,IAAIE,WAAWE,EAAE;EAGzC,MAAMC,QAAQ,KAAKV,UAAUW,IAAIJ,WAAWE,EAAE;EAC9C,IACEC,OAAOR,cAAcA,cACpBQ,SAASH,WAAWK,OAAOC,SAAS,YAErC,KAAKb,UAAUc,IAAIP,WAAWE,IAAI;GAChCP;GACAC,SAASO,OAAOP,2BAAW,IAAIN,IAAI;EACrC,CAAC;EACH,IAAIU,WAAWK,OAAOC,SAAS,WAC7B,KAAKE,OAAOR,WAAWE,IAAIP,SAAS;EACtC,OAAO;CACT;CAEAc,OAAOd,WAAmC;EACxC,KAAKH,WAAWkB,OAAOf,SAAS;EAChC,KAAK,MAAMgB,gBAAgBhB,UAAUN,eACnC,KAAKmB,OAAOG,cAAchB,SAAS;CACvC;CAEAiB,YAAYjB,WAAmC;EAC7C,OAAOA,UAAUP;CACnB;CAEAyB,OAAOF,cAAsB;EAC3B,KAAK,MAAMhB,aAAa,CAAC,GAAG,KAAKH,UAAU,GAAG;GAC5C,IAAI,CAACG,UAAUN,cAAcyB,IAAIH,YAAY,GAAG;GAChDhB,UAAUP,YAAY;GACtB,KAAKI,WAAWkB,OAAOf,SAAS;EAClC;EACA,KAAKa,OAAOG,YAAY;CAC1B;CAEAI,YAAY;EACV,KAAK,MAAMpB,aAAa,KAAKH,YAC3BG,UAAUP,YAAY;EAExB,KAAKI,WAAWwB,MAAM;EACtB,KAAK,MAAML,gBAAgB,CAAC,GAAG,KAAKlB,UAAUwB,KAAK,CAAC,GAClD,KAAKT,OAAOG,YAAY;CAC5B;CAEAO,aAAaP,cAAiD;EAC5D,MAAMR,QAAQ,KAAKV,UAAUW,IAAIO,YAAY;EAC7C,IAAI,CAACR,OAAO,OAAOiB,KAAAA;EACnB,OAAO,IAAID,SAASE,YAAYlB,MAAMP,QAAQE,IAAIuB,OAAO,CAAC;CAC5D;CAIA,OAAeV,cAAsBhB,WAAoC;EACvE,MAAMQ,QAAQ,KAAKV,UAAUW,IAAIO,YAAY;EAC7C,IAAI,CAACR,OAAO;EACZ,IAAIR,aAAaQ,MAAMR,cAAcA,WAAW;EAChD,KAAKF,UAAUiB,OAAOC,YAAY;EAClC,KAAK,MAAMU,WAAWlB,MAAMP,SAASyB,QAAQ;CAC/C;AACF;AAEA,MAAaC,qBAAqB,OAChCC,QACAxB,WACG;CACH,IAAI2B,OAAOC,iBAAiBJ,QACf;aAAA,MAAMvB,cAAcuB,QAC7B,IAAI,CAACxB,OAAOC,UAAU,GAAG;CAAA,OAG3BD,OAAO,MAAMwB,MAAM;AAEvB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AttachmentAdapter } from "../../adapters/attachment.js";
|
|
2
|
+
import { type Attachment, type CompleteAttachment } from "../../types/attachment.js";
|
|
3
|
+
export declare class AttachmentSendOperations {
|
|
4
|
+
private readonly entries;
|
|
5
|
+
private readonly removed;
|
|
6
|
+
markRemoved(attachment: Attachment): void;
|
|
7
|
+
unmarkRemoved(attachment: Attachment): void;
|
|
8
|
+
isRemoved(attachment: Attachment): boolean;
|
|
9
|
+
send(attachment: Attachment, adapter: AttachmentAdapter | undefined, signal?: AbortSignal): Promise<CompleteAttachment>;
|
|
10
|
+
transfer(original: Attachment, replacement: Attachment): Attachment;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=attachment-send-operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment-send-operations.d.ts","sourceRoot":"","sources":["../../../src/runtime/utils/attachment-send-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qCAAkC;AACnE,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,kBAAkB,EACxB,kCAA+B;AAEhC,qBAAa,wBAAwB;IAEnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAGpB;IAIJ,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IAErD,WAAW,CAAC,UAAU,EAAE,UAAU;IAIlC,aAAa,CAAC,UAAU,EAAE,UAAU;IAIpC,SAAS,CAAC,UAAU,EAAE,UAAU;IAI1B,IAAI,CACR,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,kBAAkB,CAAC;IAc9B,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU;CAKvD"}
|