@assistant-ui/core 0.2.20 → 0.2.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 +2 -2
- package/dist/adapters/attachment.d.ts.map +1 -1
- package/dist/adapters/attachment.js +14 -7
- package/dist/adapters/attachment.js.map +1 -1
- package/dist/adapters/directive-formatter.d.ts +0 -1
- package/dist/adapters/directive-formatter.d.ts.map +1 -1
- package/dist/adapters/feedback.d.ts +0 -1
- package/dist/adapters/feedback.d.ts.map +1 -1
- package/dist/adapters/index.d.ts +2 -2
- package/dist/adapters/index.js +2 -1
- package/dist/adapters/speech.d.ts +0 -1
- package/dist/adapters/speech.d.ts.map +1 -1
- package/dist/adapters/suggestion.d.ts +16 -2
- package/dist/adapters/suggestion.d.ts.map +1 -1
- package/dist/adapters/suggestion.js +36 -0
- package/dist/adapters/suggestion.js.map +1 -0
- package/dist/adapters/thread-history.d.ts +2 -2
- package/dist/adapters/thread-history.d.ts.map +1 -1
- package/dist/adapters/trigger.d.ts +5 -3
- package/dist/adapters/trigger.d.ts.map +1 -1
- package/dist/adapters/voice.d.ts +0 -1
- package/dist/adapters/voice.d.ts.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/duplicate-detection.d.ts.map +1 -1
- package/dist/internal.d.ts +7 -1
- package/dist/internal.js +6 -2
- package/dist/model-context/frame/host.d.ts +0 -1
- package/dist/model-context/frame/host.d.ts.map +1 -1
- package/dist/model-context/frame/provider.d.ts +0 -1
- package/dist/model-context/frame/provider.d.ts.map +1 -1
- package/dist/model-context/frame/types.d.ts.map +1 -1
- package/dist/model-context/interactable-composer-metadata.d.ts +4 -2
- package/dist/model-context/interactable-composer-metadata.d.ts.map +1 -1
- package/dist/model-context/registry-handles.d.ts +0 -1
- package/dist/model-context/registry-handles.d.ts.map +1 -1
- package/dist/model-context/registry.d.ts +0 -1
- package/dist/model-context/registry.d.ts.map +1 -1
- package/dist/model-context/tool.d.ts +23 -9
- package/dist/model-context/tool.d.ts.map +1 -1
- package/dist/model-context/tool.js +0 -25
- package/dist/model-context/tool.js.map +1 -1
- package/dist/model-context/types.d.ts +0 -1
- package/dist/model-context/types.d.ts.map +1 -1
- package/dist/react/AssistantProvider.d.ts +0 -1
- package/dist/react/AssistantProvider.d.ts.map +1 -1
- package/dist/react/AssistantRuntimeProvider.d.ts +1 -6
- package/dist/react/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/react/RuntimeAdapter.d.ts +1 -0
- package/dist/react/RuntimeAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts +13 -2
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js +122 -7
- package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
- package/dist/react/adapters/TitleGenerationAdapter.d.ts +0 -1
- package/dist/react/adapters/TitleGenerationAdapter.d.ts.map +1 -1
- package/dist/react/client/DataRenderers.d.ts +0 -1
- package/dist/react/client/DataRenderers.d.ts.map +1 -1
- package/dist/react/client/Interactables.d.ts +0 -1
- package/dist/react/client/Interactables.d.ts.map +1 -1
- package/dist/react/client/Tools.d.ts +3 -2
- package/dist/react/client/Tools.d.ts.map +1 -1
- package/dist/react/client/interactable-model-context.d.ts +0 -1
- package/dist/react/client/interactable-model-context.d.ts.map +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/interactables-legacy/Interactables.d.ts +0 -1
- package/dist/react/interactables-legacy/Interactables.d.ts.map +1 -1
- package/dist/react/interactables-legacy/interactable-model-context.d.ts +0 -1
- package/dist/react/interactables-legacy/interactable-model-context.d.ts.map +1 -1
- package/dist/react/interactables-legacy/scopes.d.ts +4 -2
- package/dist/react/interactables-legacy/scopes.d.ts.map +1 -1
- package/dist/react/interactables-legacy/useAssistantInteractable.d.ts +0 -1
- package/dist/react/interactables-legacy/useAssistantInteractable.d.ts.map +1 -1
- package/dist/react/interactables-legacy/useInteractableState.d.ts.map +1 -1
- package/dist/react/model-context/define-mcp-toolkit.d.ts +19 -4
- package/dist/react/model-context/define-mcp-toolkit.d.ts.map +1 -1
- package/dist/react/model-context/define-mcp-toolkit.js +17 -5
- package/dist/react/model-context/define-mcp-toolkit.js.map +1 -1
- package/dist/react/model-context/define-toolkit.d.ts +1 -2
- package/dist/react/model-context/define-toolkit.d.ts.map +1 -1
- package/dist/react/model-context/external-tool.d.ts.map +1 -1
- package/dist/react/model-context/human-tool.d.ts.map +1 -1
- package/dist/react/model-context/interactableTool.d.ts +2 -2
- package/dist/react/model-context/interactableTool.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantDataUI.d.ts +2 -2
- package/dist/react/model-context/makeAssistantDataUI.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantTool.d.ts +2 -2
- package/dist/react/model-context/makeAssistantTool.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantToolUI.d.ts +2 -2
- package/dist/react/model-context/makeAssistantToolUI.d.ts.map +1 -1
- package/dist/react/model-context/provider-tool.d.ts +0 -1
- package/dist/react/model-context/provider-tool.d.ts.map +1 -1
- package/dist/react/model-context/stub-tool.d.ts.map +1 -1
- package/dist/react/model-context/toolbox.d.ts +5 -5
- package/dist/react/model-context/toolbox.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantContext.d.ts +1 -0
- package/dist/react/model-context/useAssistantContext.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantDataUI.d.ts +3 -2
- package/dist/react/model-context/useAssistantDataUI.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantInstructions.d.ts +1 -0
- package/dist/react/model-context/useAssistantInstructions.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantTool.d.ts +4 -2
- package/dist/react/model-context/useAssistantTool.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantToolUI.d.ts +3 -2
- package/dist/react/model-context/useAssistantToolUI.d.ts.map +1 -1
- package/dist/react/model-context/useAuiToolOverrides.d.ts +0 -1
- package/dist/react/model-context/useAuiToolOverrides.d.ts.map +1 -1
- package/dist/react/model-context/useInlineRender.d.ts +0 -1
- package/dist/react/model-context/useInlineRender.d.ts.map +1 -1
- package/dist/react/model-context/useInteractable.d.ts +7 -4
- package/dist/react/model-context/useInteractable.d.ts.map +1 -1
- package/dist/react/model-context/useInteractableState.d.ts.map +1 -1
- package/dist/react/model-context/useInteractableVersions.d.ts +0 -1
- package/dist/react/model-context/useInteractableVersions.d.ts.map +1 -1
- package/dist/react/model-context/useToolArgsStatus.d.ts +3 -1
- package/dist/react/model-context/useToolArgsStatus.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.d.ts +1 -4
- package/dist/react/primitive-hooks/useActionBarCopy.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts +0 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.d.ts +0 -1
- package/dist/react/primitive-hooks/useComposerSend.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageError.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageError.js +5 -1
- package/dist/react/primitive-hooks/useMessageError.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageReload.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts +1 -5
- package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsRunning.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadMessageIds.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadMessages.d.ts +0 -1
- package/dist/react/primitive-hooks/useThreadMessages.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useVoice.d.ts +0 -1
- package/dist/react/primitive-hooks/useVoice.d.ts.map +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts +7 -4
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.d.ts +4 -3
- package/dist/react/primitives/composer/ComposerAttachments.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerIf.d.ts +4 -3
- package/dist/react/primitives/composer/ComposerIf.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerQueue.d.ts +2 -2
- package/dist/react/primitives/composer/ComposerQueue.d.ts.map +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.d.ts +2 -2
- package/dist/react/primitives/generativeUI/GenerativeUI.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageAttachments.d.ts +4 -3
- package/dist/react/primitives/message/MessageAttachments.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.d.ts +1 -6
- package/dist/react/primitives/message/MessageGroupedParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageParts.d.ts +42 -24
- package/dist/react/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageParts.js +2 -1
- package/dist/react/primitives/message/MessageParts.js.map +1 -1
- package/dist/react/primitives/message/MessageQuote.d.ts +2 -2
- package/dist/react/primitives/message/MessageQuote.d.ts.map +1 -1
- package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts +0 -1
- package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts.map +1 -1
- package/dist/react/primitives/part/PartMessages.d.ts +2 -2
- package/dist/react/primitives/part/PartMessages.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadMessages.d.ts +35 -17
- package/dist/react/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.d.ts +6 -4
- package/dist/react/primitives/thread/ThreadSuggestions.d.ts.map +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.d.ts +4 -3
- package/dist/react/primitives/threadList/ThreadListItems.d.ts.map +1 -1
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts +0 -1
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -1
- package/dist/react/providers/AttachmentByIndexProvider.d.ts +0 -1
- package/dist/react/providers/AttachmentByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts +0 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts +0 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/MessageByIdProvider.d.ts +0 -1
- package/dist/react/providers/MessageByIdProvider.d.ts.map +1 -1
- package/dist/react/providers/MessageByIndexProvider.d.ts +0 -1
- package/dist/react/providers/MessageByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/PartByIndexProvider.d.ts +0 -1
- package/dist/react/providers/PartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/QueueItemByIndexProvider.d.ts +0 -1
- package/dist/react/providers/QueueItemByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.d.ts +0 -1
- package/dist/react/providers/ReadonlyThreadProvider.d.ts.map +1 -1
- package/dist/react/providers/SuggestionByIndexProvider.d.ts +0 -1
- package/dist/react/providers/SuggestionByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.d.ts +0 -1
- package/dist/react/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.d.ts +0 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts +1 -1
- package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +2 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +3 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +21 -19
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts +0 -1
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts +0 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts +1 -4
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js +6 -3
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.d.ts +12 -2
- package/dist/react/runtimes/cloud/auiV0.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.js +30 -1
- package/dist/react/runtimes/cloud/auiV0.js.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts +0 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/createMessageConverter.d.ts +1 -7
- package/dist/react/runtimes/createMessageConverter.d.ts.map +1 -1
- package/dist/react/runtimes/createRuntimeExtras.d.ts +0 -1
- package/dist/react/runtimes/createRuntimeExtras.d.ts.map +1 -1
- package/dist/react/runtimes/external-message-converter.d.ts +1 -8
- package/dist/react/runtimes/external-message-converter.d.ts.map +1 -1
- package/dist/react/runtimes/external-message-converter.js +42 -44
- package/dist/react/runtimes/external-message-converter.js.map +1 -1
- package/dist/react/runtimes/useExternalStoreRuntime.d.ts +0 -1
- package/dist/react/runtimes/useExternalStoreRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useExternalStoreSharedOptions.d.ts +0 -1
- package/dist/react/runtimes/useExternalStoreSharedOptions.d.ts.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.d.ts +2 -5
- package/dist/react/runtimes/useLocalRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts +0 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useStreamingTiming.d.ts +0 -1
- package/dist/react/runtimes/useStreamingTiming.d.ts.map +1 -1
- package/dist/react/types/MessagePartComponentTypes.d.ts +6 -3
- package/dist/react/types/MessagePartComponentTypes.d.ts.map +1 -1
- package/dist/react/types/scopes/dataRenderers.d.ts +1 -1
- package/dist/react/types/scopes/dataRenderers.d.ts.map +1 -1
- package/dist/react/types/scopes/interactables.d.ts +4 -2
- package/dist/react/types/scopes/interactables.d.ts.map +1 -1
- package/dist/react/types/scopes/tools.d.ts +5 -3
- package/dist/react/types/scopes/tools.d.ts.map +1 -1
- package/dist/react/types/store-augmentation.d.ts +1 -2
- package/dist/react/types/store-augmentation.d.ts.map +1 -1
- package/dist/react/utils/getMessageQuote.d.ts +0 -1
- package/dist/react/utils/getMessageQuote.d.ts.map +1 -1
- package/dist/react/utils/groupParts.d.ts +2 -2
- package/dist/react/utils/groupParts.d.ts.map +1 -1
- package/dist/react/utils/useJSONEqual.d.ts.map +1 -1
- package/dist/runtime/api/assistant-runtime.d.ts +0 -1
- package/dist/runtime/api/assistant-runtime.d.ts.map +1 -1
- package/dist/runtime/api/attachment-runtime.d.ts +0 -1
- package/dist/runtime/api/attachment-runtime.d.ts.map +1 -1
- package/dist/runtime/api/bindings.d.ts +0 -1
- package/dist/runtime/api/bindings.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.d.ts +6 -4
- package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-part-runtime.d.ts +0 -1
- package/dist/runtime/api/message-part-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-runtime.d.ts +6 -16
- package/dist/runtime/api/message-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-runtime.js +1 -1
- package/dist/runtime/api/paths.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.d.ts +0 -1
- package/dist/runtime/api/thread-list-item-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-runtime.d.ts +0 -1
- package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-runtime.d.ts +3 -1
- package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
- package/dist/runtime/base/base-assistant-runtime-core.d.ts +0 -1
- package/dist/runtime/base/base-assistant-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.d.ts +0 -1
- package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.js +17 -3
- package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.d.ts +2 -4
- package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts +1 -5
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +1 -0
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/branch/external-thread-branch-adapter.d.ts.map +1 -1
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts +0 -1
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/composer-runtime-core.d.ts +2 -2
- package/dist/runtime/interfaces/composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts +0 -1
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-runtime-core.d.ts +2 -2
- package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts +0 -1
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts.map +1 -1
- package/dist/runtime/queue/message-queue.d.ts +6 -4
- package/dist/runtime/queue/message-queue.d.ts.map +1 -1
- package/dist/runtime/queue/message-queue.js +1 -1
- package/dist/runtime/utils/auto-status.d.ts +0 -1
- package/dist/runtime/utils/auto-status.d.ts.map +1 -1
- package/dist/runtime/utils/chat-model-adapter.d.ts +0 -1
- package/dist/runtime/utils/chat-model-adapter.d.ts.map +1 -1
- package/dist/runtime/utils/external-store-message.d.ts +0 -1
- package/dist/runtime/utils/external-store-message.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository.d.ts +1 -5
- package/dist/runtime/utils/message-repository.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository.js +3 -1
- package/dist/runtime/utils/message-repository.js.map +1 -1
- package/dist/runtime/utils/resolveToolApprovalResponse.d.ts +0 -1
- package/dist/runtime/utils/resolveToolApprovalResponse.d.ts.map +1 -1
- package/dist/runtime/utils/streaming-timing.d.ts +5 -3
- package/dist/runtime/utils/streaming-timing.d.ts.map +1 -1
- package/dist/runtime/utils/thread-message-like.d.ts +2 -2
- package/dist/runtime/utils/thread-message-like.d.ts.map +1 -1
- package/dist/runtime/utils/thread-message-like.js.map +1 -1
- package/dist/runtimes/assistant-transport/utils.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-adapter.d.ts +2 -2
- package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts +0 -1
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-shared-options.d.ts +0 -1
- 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 +0 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +2 -0
- 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 +1 -1
- package/dist/runtimes/external-store/thread-message-converter.d.ts +0 -1
- package/dist/runtimes/external-store/thread-message-converter.d.ts.map +1 -1
- package/dist/runtimes/local/local-runtime-core.d.ts +0 -1
- package/dist/runtimes/local/local-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-runtime-options.d.ts +0 -1
- package/dist/runtimes/local/local-runtime-options.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts +0 -1
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.d.ts +5 -21
- package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.js +24 -15
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/local/should-continue.d.ts +0 -1
- package/dist/runtimes/local/should-continue.d.ts.map +1 -1
- package/dist/runtimes/local/should-continue.js +2 -2
- package/dist/runtimes/local/should-continue.js.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +0 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts +1 -2
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/in-memory.js +5 -3
- package/dist/runtimes/remote-thread-list/adapter/in-memory.js.map +1 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts +0 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts +6 -4
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts +0 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/types.d.ts +0 -1
- package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts +2 -2
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts.map +1 -1
- package/dist/store/clients/chain-of-thought-client.d.ts +0 -1
- package/dist/store/clients/chain-of-thought-client.d.ts.map +1 -1
- package/dist/store/clients/model-context-client.d.ts +0 -1
- package/dist/store/clients/model-context-client.d.ts.map +1 -1
- package/dist/store/clients/no-op-composer-client.d.ts +0 -1
- package/dist/store/clients/no-op-composer-client.d.ts.map +1 -1
- package/dist/store/clients/runtime-adapter.d.ts +0 -1
- package/dist/store/clients/runtime-adapter.d.ts.map +1 -1
- package/dist/store/clients/suggestions.d.ts +0 -1
- package/dist/store/clients/suggestions.d.ts.map +1 -1
- package/dist/store/clients/thread-message-client.d.ts +0 -1
- package/dist/store/clients/thread-message-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts +0 -1
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.d.ts +0 -1
- package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/liveRef.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts +0 -1
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.d.ts +0 -1
- package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts +0 -1
- 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 +0 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.d.ts +0 -1
- package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/useSubscribable.d.ts +0 -1
- package/dist/store/runtime-clients/useSubscribable.d.ts.map +1 -1
- package/dist/store/scope-registration.d.ts +1 -2
- package/dist/store/scope-registration.d.ts.map +1 -1
- package/dist/store/scopes/attachment.d.ts +0 -1
- package/dist/store/scopes/attachment.d.ts.map +1 -1
- package/dist/store/scopes/chain-of-thought.d.ts +0 -1
- package/dist/store/scopes/chain-of-thought.d.ts.map +1 -1
- package/dist/store/scopes/composer.d.ts +0 -1
- package/dist/store/scopes/composer.d.ts.map +1 -1
- package/dist/store/scopes/message.d.ts +6 -4
- package/dist/store/scopes/message.d.ts.map +1 -1
- package/dist/store/scopes/model-context.d.ts +0 -1
- package/dist/store/scopes/model-context.d.ts.map +1 -1
- package/dist/store/scopes/part.d.ts +0 -1
- package/dist/store/scopes/part.d.ts.map +1 -1
- package/dist/store/scopes/queue-item.d.ts.map +1 -1
- package/dist/store/scopes/suggestion.d.ts.map +1 -1
- package/dist/store/scopes/suggestions.d.ts +0 -1
- package/dist/store/scopes/suggestions.d.ts.map +1 -1
- package/dist/store/scopes/thread-list-item.d.ts +0 -1
- package/dist/store/scopes/thread-list-item.d.ts.map +1 -1
- package/dist/store/scopes/thread.d.ts +4 -3
- package/dist/store/scopes/thread.d.ts.map +1 -1
- package/dist/store/scopes/threads.d.ts +0 -1
- package/dist/store/scopes/threads.d.ts.map +1 -1
- package/dist/subscribable/subscribable.d.ts +0 -1
- package/dist/subscribable/subscribable.d.ts.map +1 -1
- package/dist/tests/remote-thread-list-test-helpers.d.ts +0 -1
- package/dist/tests/remote-thread-list-test-helpers.d.ts.map +1 -1
- package/dist/types/attachment.d.ts +1 -1
- package/dist/types/attachment.d.ts.map +1 -1
- package/dist/types/directive.d.ts +3 -2
- package/dist/types/directive.d.ts.map +1 -1
- package/dist/types/error.d.ts +15 -0
- package/dist/types/error.d.ts.map +1 -0
- package/dist/types/error.js +46 -0
- package/dist/types/error.js.map +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/message.d.ts +70 -33
- package/dist/types/message.d.ts.map +1 -1
- package/dist/types/message.js.map +1 -1
- package/dist/types/quote.d.ts.map +1 -1
- package/dist/types/trigger.d.ts +0 -1
- package/dist/types/trigger.d.ts.map +1 -1
- package/dist/types/unsubscribe.d.ts.map +1 -1
- package/dist/utils/composite-context-provider.d.ts +1 -0
- package/dist/utils/composite-context-provider.d.ts.map +1 -1
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/json/is-json-equal.d.ts.map +1 -1
- package/dist/utils/json/is-json.d.ts +0 -1
- package/dist/utils/json/is-json.d.ts.map +1 -1
- package/dist/utils/json/is-json.js +1 -1
- package/dist/utils/json/is-json.js.map +1 -1
- package/dist/utils/json/stable-stringify-tool-args.d.ts +7 -0
- package/dist/utils/json/stable-stringify-tool-args.d.ts.map +1 -0
- package/dist/utils/json/stable-stringify-tool-args.js +32 -0
- package/dist/utils/json/stable-stringify-tool-args.js.map +1 -0
- package/dist/utils/text.d.ts +0 -1
- package/dist/utils/text.d.ts.map +1 -1
- package/package.json +12 -9
- package/src/adapters/attachment.test.ts +107 -0
- package/src/adapters/attachment.ts +20 -10
- package/src/adapters/index.ts +6 -1
- package/src/adapters/suggestion.test.ts +187 -0
- package/src/adapters/suggestion.ts +75 -1
- package/src/index.ts +15 -1
- package/src/internal.ts +16 -0
- package/src/model-context/tool.test.ts +110 -0
- package/src/model-context/tool.ts +31 -9
- package/src/react/adapters/LocalStorageThreadListAdapter.test.ts +222 -0
- package/src/react/adapters/LocalStorageThreadListAdapter.tsx +214 -7
- package/src/react/index.ts +2 -0
- package/src/react/model-context/define-mcp-toolkit.ts +39 -6
- package/src/react/model-context/define-toolkit.test.ts +107 -0
- package/src/react/primitive-hooks/useMessageError.test.ts +64 -0
- package/src/react/primitive-hooks/useMessageError.ts +19 -6
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.tsx +3 -1
- package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +48 -19
- package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.test.ts +111 -0
- package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.ts +13 -3
- package/src/react/runtimes/cloud/auiV0.ts +71 -2
- package/src/react/runtimes/external-message-converter.test.tsx +102 -0
- package/src/react/runtimes/external-message-converter.ts +35 -10
- package/src/runtime/base/base-composer-runtime-core.ts +26 -7
- package/src/runtime/utils/message-repository.ts +8 -3
- package/src/runtime/utils/thread-message-like.ts +2 -0
- package/src/runtimes/local/local-thread-runtime-core.test.ts +127 -3
- package/src/runtimes/local/local-thread-runtime-core.ts +25 -23
- package/src/runtimes/local/should-continue.ts +5 -2
- package/src/runtimes/remote-thread-list/adapter/in-memory.test.ts +14 -0
- package/src/runtimes/remote-thread-list/adapter/in-memory.ts +13 -5
- package/src/tests/MessageRepository.test.ts +26 -0
- package/src/tests/RemoteThreadListThreadListRuntimeCore-errors.test.ts +42 -0
- package/src/tests/attachment-adapters.test.ts +14 -2
- package/src/tests/auiV0Encode.test.ts +134 -1
- package/src/tests/base-composer-runtime-core-addAttachment.test.ts +79 -5
- package/src/tests/base-composer-runtime-core-send.test.ts +145 -0
- package/src/tests/thread-message-like.test.ts +40 -0
- package/src/types/attachment.ts +1 -0
- package/src/types/error.test.ts +122 -0
- package/src/types/error.ts +74 -0
- package/src/types/index.ts +1 -0
- package/src/types/message.ts +11 -3
- package/src/utils/json/is-json-equal.test.ts +84 -0
- package/src/utils/json/is-json.test.ts +123 -0
- package/src/utils/json/is-json.ts +1 -1
- package/src/utils/json/stable-stringify-tool-args.test.ts +105 -0
- package/src/utils/json/stable-stringify-tool-args.ts +70 -0
package/dist/internal.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { getFileDataURL } from "./adapters/attachment.js";
|
|
1
2
|
import { fromThreadMessageLike } from "./runtime/utils/thread-message-like.js";
|
|
2
3
|
import { ExportedMessageRepository, ExportedMessageRepositoryItem, MessageRepository } from "./runtime/utils/message-repository.js";
|
|
4
|
+
import { consumeSuggestionResult } from "./adapters/suggestion.js";
|
|
3
5
|
import { BaseSubject, BaseSubscribable, EventSubscribable, EventSubscriptionSubject, LazyMemoizeSubject, NestedSubscribable, NestedSubscriptionSubject, SKIP_UPDATE, ShallowMemoizeSubject, Subscribable, SubscribableWithState } from "./subscribable/subscribable.js";
|
|
4
6
|
import { generateErrorMessageId, generateId, isErrorMessageId } from "./utils/id.js";
|
|
5
7
|
import { getThreadMessageText } from "./utils/text.js";
|
|
6
8
|
import { resolveToolApprovalResponse } from "./runtime/utils/resolveToolApprovalResponse.js";
|
|
7
9
|
import { CompositeContextProvider } from "./utils/composite-context-provider.js";
|
|
10
|
+
import { stableStringifyToolArgs, trackToolArgsKeyOrder } from "./utils/json/stable-stringify-tool-args.js";
|
|
11
|
+
import { isJSONValue, isRecord } from "./utils/json/is-json.js";
|
|
8
12
|
import { RuntimeExtras, createRuntimeExtras } from "./react/runtimes/createRuntimeExtras.js";
|
|
9
13
|
import { ComposerRuntimeCoreBinding, EditComposerRuntimeCoreBinding, MessageStateBinding, ThreadComposerRuntimeCoreBinding } from "./runtime/api/bindings.js";
|
|
10
14
|
import { BaseAssistantRuntimeCore } from "./runtime/base/base-assistant-runtime-core.js";
|
|
@@ -20,6 +24,7 @@ import { MessagePartRuntimeImpl } from "./runtime/api/message-part-runtime.js";
|
|
|
20
24
|
import { MessageRuntimeImpl } from "./runtime/api/message-runtime.js";
|
|
21
25
|
import { symbolInnerMessage } from "./runtime/utils/external-store-message.js";
|
|
22
26
|
import { getAutoStatus, isAutoStatus } from "./runtime/utils/auto-status.js";
|
|
27
|
+
import "./runtime/internal.js";
|
|
23
28
|
import { LocalRuntimeOptionsBase } from "./runtimes/local/local-runtime-options.js";
|
|
24
29
|
import { LocalThreadRuntimeCore } from "./runtimes/local/local-thread-runtime-core.js";
|
|
25
30
|
import { LocalThreadFactory, LocalThreadListRuntimeCore } from "./runtimes/local/local-thread-list-runtime-core.js";
|
|
@@ -34,6 +39,7 @@ import { OptimisticState } from "./runtimes/remote-thread-list/optimistic-state.
|
|
|
34
39
|
import { EMPTY_THREAD_CORE } from "./runtimes/remote-thread-list/empty-thread-core.js";
|
|
35
40
|
import { RemoteThreadInitializeResponse, RemoteThreadListOptions } from "./runtimes/remote-thread-list/types.js";
|
|
36
41
|
import { RemoteThreadData, RemoteThreadState, THREAD_MAPPING_ID, createThreadMappingId, getThreadData, updateStatusReducer } from "./runtimes/remote-thread-list/remote-thread-state.js";
|
|
42
|
+
import "./runtimes/internal.js";
|
|
37
43
|
import { ThreadListItemRuntimeBinding, ThreadRuntimeCoreBinding, ThreadRuntimeImpl, getThreadState } from "./runtime/api/thread-runtime.js";
|
|
38
44
|
import { AssistantRuntimeImpl } from "./runtime/api/assistant-runtime.js";
|
|
39
|
-
export { AssistantRuntimeImpl, AttachmentRuntimeImpl, BaseAssistantRuntimeCore, BaseComposerRuntimeCore, BaseSubject, BaseSubscribable, BaseThreadRuntimeCore, type ComposerRuntimeCoreBinding, ComposerRuntimeImpl, CompositeContextProvider, type ConverterCallback, DefaultEditComposerRuntimeCore, DefaultThreadComposerRuntimeCore, EMPTY_THREAD_CORE, EditComposerAttachmentRuntimeImpl, type EditComposerRuntimeCoreBinding, EditComposerRuntimeImpl, type EventSubscribable, EventSubscriptionSubject, ExportedMessageRepository, type ExportedMessageRepositoryItem, ExternalStoreRuntimeCore, type ExternalStoreThreadFactory, ExternalStoreThreadListRuntimeCore, ExternalStoreThreadRuntimeCore, LazyMemoizeSubject, LocalRuntimeCore, type LocalRuntimeOptionsBase, type LocalThreadFactory, LocalThreadListRuntimeCore, LocalThreadRuntimeCore, MessageAttachmentRuntimeImpl, MessagePartRuntimeImpl, MessageRepository, MessageRuntimeImpl, type MessageStateBinding, type NestedSubscribable, NestedSubscriptionSubject, OptimisticState, ReadonlyThreadRuntimeCore, type RemoteThreadData, type RemoteThreadInitializeResponse, type RemoteThreadListOptions, type RemoteThreadState, type RuntimeExtras, SKIP_UPDATE, type SKIP_UPDATE as SKIP_UPDATE_TYPE, ShallowMemoizeSubject, type Subscribable, type SubscribableWithState, type THREAD_MAPPING_ID, ThreadComposerAttachmentRuntimeImpl, type ThreadComposerRuntimeCoreBinding, ThreadComposerRuntimeImpl, type ThreadListItemRuntimeBinding, ThreadListItemRuntimeImpl, type ThreadListItemStateBinding, type ThreadListRuntimeCoreBinding, ThreadListRuntimeImpl, ThreadMessageConverter, type ThreadRuntimeCoreBinding, ThreadRuntimeImpl, createRuntimeExtras, createThreadMappingId, fromThreadMessageLike, generateErrorMessageId, generateId, getAutoStatus, getThreadData, getThreadMessageText, getThreadState, hasUpcomingMessage, isAutoStatus, isErrorMessageId, resolveToolApprovalResponse, shouldContinue, symbolInnerMessage, updateStatusReducer };
|
|
45
|
+
export { AssistantRuntimeImpl, AttachmentRuntimeImpl, BaseAssistantRuntimeCore, BaseComposerRuntimeCore, BaseSubject, BaseSubscribable, BaseThreadRuntimeCore, type ComposerRuntimeCoreBinding, ComposerRuntimeImpl, CompositeContextProvider, type ConverterCallback, DefaultEditComposerRuntimeCore, DefaultThreadComposerRuntimeCore, EMPTY_THREAD_CORE, EditComposerAttachmentRuntimeImpl, type EditComposerRuntimeCoreBinding, EditComposerRuntimeImpl, type EventSubscribable, EventSubscriptionSubject, ExportedMessageRepository, type ExportedMessageRepositoryItem, ExternalStoreRuntimeCore, type ExternalStoreThreadFactory, ExternalStoreThreadListRuntimeCore, ExternalStoreThreadRuntimeCore, LazyMemoizeSubject, LocalRuntimeCore, type LocalRuntimeOptionsBase, type LocalThreadFactory, LocalThreadListRuntimeCore, LocalThreadRuntimeCore, MessageAttachmentRuntimeImpl, MessagePartRuntimeImpl, MessageRepository, MessageRuntimeImpl, type MessageStateBinding, type NestedSubscribable, NestedSubscriptionSubject, OptimisticState, ReadonlyThreadRuntimeCore, type RemoteThreadData, type RemoteThreadInitializeResponse, type RemoteThreadListOptions, type RemoteThreadState, type RuntimeExtras, SKIP_UPDATE, type SKIP_UPDATE as SKIP_UPDATE_TYPE, ShallowMemoizeSubject, type Subscribable, type SubscribableWithState, type THREAD_MAPPING_ID, ThreadComposerAttachmentRuntimeImpl, type ThreadComposerRuntimeCoreBinding, ThreadComposerRuntimeImpl, type ThreadListItemRuntimeBinding, ThreadListItemRuntimeImpl, type ThreadListItemStateBinding, type ThreadListRuntimeCoreBinding, ThreadListRuntimeImpl, ThreadMessageConverter, type ThreadRuntimeCoreBinding, ThreadRuntimeImpl, consumeSuggestionResult, createRuntimeExtras, createThreadMappingId, fromThreadMessageLike, generateErrorMessageId, generateId, getAutoStatus, getFileDataURL, getThreadData, getThreadMessageText, getThreadState, hasUpcomingMessage, isAutoStatus, isErrorMessageId, isJSONValue, isRecord, resolveToolApprovalResponse, shouldContinue, stableStringifyToolArgs, symbolInnerMessage, trackToolArgsKeyOrder, updateStatusReducer };
|
package/dist/internal.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { isJSONValue, isRecord } from "./utils/json/is-json.js";
|
|
1
2
|
import { generateErrorMessageId, generateId, isErrorMessageId } from "./utils/id.js";
|
|
3
|
+
import { getFileDataURL } from "./adapters/attachment.js";
|
|
4
|
+
import { getThreadMessageText } from "./utils/text.js";
|
|
5
|
+
import { consumeSuggestionResult } from "./adapters/suggestion.js";
|
|
2
6
|
import { fromThreadMessageLike } from "./runtime/utils/thread-message-like.js";
|
|
3
7
|
import { symbolInnerMessage } from "./runtime/utils/external-store-message.js";
|
|
4
8
|
import { getAutoStatus, isAutoStatus } from "./runtime/utils/auto-status.js";
|
|
5
9
|
import { ExportedMessageRepository, MessageRepository } from "./runtime/utils/message-repository.js";
|
|
6
|
-
import { getThreadMessageText } from "./utils/text.js";
|
|
7
10
|
import { BaseSubject, BaseSubscribable, EventSubscriptionSubject, LazyMemoizeSubject, NestedSubscriptionSubject, SKIP_UPDATE, ShallowMemoizeSubject } from "./subscribable/subscribable.js";
|
|
8
11
|
import { resolveToolApprovalResponse } from "./runtime/utils/resolveToolApprovalResponse.js";
|
|
9
12
|
import { CompositeContextProvider } from "./utils/composite-context-provider.js";
|
|
13
|
+
import { stableStringifyToolArgs, trackToolArgsKeyOrder } from "./utils/json/stable-stringify-tool-args.js";
|
|
10
14
|
import { createRuntimeExtras } from "./react/runtimes/createRuntimeExtras.js";
|
|
11
15
|
import { BaseAssistantRuntimeCore } from "./runtime/base/base-assistant-runtime-core.js";
|
|
12
16
|
import { BaseComposerRuntimeCore } from "./runtime/base/base-composer-runtime-core.js";
|
|
@@ -33,4 +37,4 @@ import { ReadonlyThreadRuntimeCore } from "./runtimes/readonly/ReadonlyThreadRun
|
|
|
33
37
|
import { OptimisticState } from "./runtimes/remote-thread-list/optimistic-state.js";
|
|
34
38
|
import { EMPTY_THREAD_CORE } from "./runtimes/remote-thread-list/empty-thread-core.js";
|
|
35
39
|
import { createThreadMappingId, getThreadData, updateStatusReducer } from "./runtimes/remote-thread-list/remote-thread-state.js";
|
|
36
|
-
export { AssistantRuntimeImpl, AttachmentRuntimeImpl, BaseAssistantRuntimeCore, BaseComposerRuntimeCore, BaseSubject, BaseSubscribable, BaseThreadRuntimeCore, ComposerRuntimeImpl, CompositeContextProvider, DefaultEditComposerRuntimeCore, DefaultThreadComposerRuntimeCore, EMPTY_THREAD_CORE, EditComposerAttachmentRuntimeImpl, EditComposerRuntimeImpl, EventSubscriptionSubject, ExportedMessageRepository, ExternalStoreRuntimeCore, ExternalStoreThreadListRuntimeCore, ExternalStoreThreadRuntimeCore, LazyMemoizeSubject, LocalRuntimeCore, LocalThreadListRuntimeCore, LocalThreadRuntimeCore, MessageAttachmentRuntimeImpl, MessagePartRuntimeImpl, MessageRepository, MessageRuntimeImpl, NestedSubscriptionSubject, OptimisticState, ReadonlyThreadRuntimeCore, SKIP_UPDATE, ShallowMemoizeSubject, ThreadComposerAttachmentRuntimeImpl, ThreadComposerRuntimeImpl, ThreadListItemRuntimeImpl, ThreadListRuntimeImpl, ThreadMessageConverter, ThreadRuntimeImpl, createRuntimeExtras, createThreadMappingId, fromThreadMessageLike, generateErrorMessageId, generateId, getAutoStatus, getThreadData, getThreadMessageText, getThreadState, hasUpcomingMessage, isAutoStatus, isErrorMessageId, resolveToolApprovalResponse, shouldContinue, symbolInnerMessage, updateStatusReducer };
|
|
40
|
+
export { AssistantRuntimeImpl, AttachmentRuntimeImpl, BaseAssistantRuntimeCore, BaseComposerRuntimeCore, BaseSubject, BaseSubscribable, BaseThreadRuntimeCore, ComposerRuntimeImpl, CompositeContextProvider, DefaultEditComposerRuntimeCore, DefaultThreadComposerRuntimeCore, EMPTY_THREAD_CORE, EditComposerAttachmentRuntimeImpl, EditComposerRuntimeImpl, EventSubscriptionSubject, ExportedMessageRepository, ExternalStoreRuntimeCore, ExternalStoreThreadListRuntimeCore, ExternalStoreThreadRuntimeCore, LazyMemoizeSubject, LocalRuntimeCore, LocalThreadListRuntimeCore, LocalThreadRuntimeCore, MessageAttachmentRuntimeImpl, MessagePartRuntimeImpl, MessageRepository, MessageRuntimeImpl, NestedSubscriptionSubject, OptimisticState, ReadonlyThreadRuntimeCore, SKIP_UPDATE, ShallowMemoizeSubject, ThreadComposerAttachmentRuntimeImpl, ThreadComposerRuntimeImpl, ThreadListItemRuntimeImpl, ThreadListRuntimeImpl, ThreadMessageConverter, ThreadRuntimeImpl, consumeSuggestionResult, createRuntimeExtras, createThreadMappingId, fromThreadMessageLike, generateErrorMessageId, generateId, getAutoStatus, getFileDataURL, getThreadData, getThreadMessageText, getThreadState, hasUpcomingMessage, isAutoStatus, isErrorMessageId, isJSONValue, isRecord, resolveToolApprovalResponse, shouldContinue, stableStringifyToolArgs, symbolInnerMessage, trackToolArgsKeyOrder, updateStatusReducer };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","names":[],"sources":["../../../src/model-context/frame/host.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"host.d.ts","names":[],"sources":["../../../src/model-context/frame/host.ts"],"mappings":";;;cA0Ca,8BAA8B;UACjC;UACA;UACA;UAOA;UACA;UACA;cAEI,cAAc,QAAQ;UAU1B;UA6BA;UAmBA;UAaA;UAqCA;UAYA;EAIR,mBAAmB;EAInB,UAAU,uBAAuB;EAKjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","names":[],"sources":["../../../src/model-context/frame/provider.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider.d.ts","names":[],"sources":["../../../src/model-context/frame/provider.ts"],"mappings":";;;cA+Ba;iBACI;UAEP;UACA;UAIA;UAED;iBAQQ;UASP;UAqBM;UAoCN;UAOA;UAkBA;SAcD,wBACL,UAAU,sBACV,wBACC;SAmBI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/model-context/frame/types.ts"],"mappings":";KAAY
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/model-context/frame/types.ts"],"mappings":";KAAY;EACV;EACA;EACA;EACA;;KAGU;EACV;EACA,QAAQ,eAAe;;KAGb;KAMA;EAEN;;EAGA;EACA,SAAS;;EAGT;EACA;EACA;EACA;;EAGA;EACA;EACA;EACA;;cAGO"}
|
|
@@ -64,8 +64,10 @@ declare function shallowMergeInteractableState(prev: unknown, partial: unknown,
|
|
|
64
64
|
* @deprecated Unstable / Experimental (not actually removed).
|
|
65
65
|
*/
|
|
66
66
|
type Unstable_InteractableVersion = {
|
|
67
|
-
/** The full state as of this version. */
|
|
68
|
-
|
|
67
|
+
/** The full state as of this version. */
|
|
68
|
+
state: unknown;
|
|
69
|
+
origin: "create" | "update" | "user-edit";
|
|
70
|
+
/** For create/update versions, the tool call that produced this version. */
|
|
69
71
|
toolCallId?: string | undefined;
|
|
70
72
|
};
|
|
71
73
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactable-composer-metadata.d.ts","names":[],"sources":["../../src/model-context/interactable-composer-metadata.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"interactable-composer-metadata.d.ts","names":[],"sources":["../../src/model-context/interactable-composer-metadata.ts"],"mappings":";;;;;KAOY;EACV;EACA;EACA;;;;;;EAMA;;;;;;;KAQG;EACH;EACA;EACA;;;;;;;;;;;iBAYc,kCAAkC;EAChD;IACE;;;;;;iBAgBY,oCACd,OAAO;;iBASO,qBAAqB;;;;;;iBA0DrB,8BACd,eACA,kBACA;EAEM;;;;;;EAMA,aAAa;EACb,gBAAgB;;;;;;KAgGZ;;EAEV;EACA;;EAEA;;;;;;;;;;;;;;;;;;iBA0Bc,iCACd,mBAAmB,0BACnB,YACA,eACC;;;;;iBAwEa,oBACd,mBAAmB,0BACnB,YACA;EACG;;;;;;;;;iBAaW,iCACd,MAAM,qCACN,mBAAmB,2BAClB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AssistantInstructionsConfig, AssistantToolProps } from "./types.js";
|
|
2
|
-
|
|
3
2
|
//#region src/model-context/registry-handles.d.ts
|
|
4
3
|
interface ModelContextRegistryToolHandle<TArgs extends Record<string, unknown> = any, TResult = any> {
|
|
5
4
|
update(tool: AssistantToolProps<TArgs, TResult>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-handles.d.ts","names":[],"sources":["../../src/model-context/registry-handles.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry-handles.d.ts","names":[],"sources":["../../src/model-context/registry-handles.ts"],"mappings":";;UAEiB,+BACf,cAAc,+BACd;EAEA,OAAO,MAAM,mBAAmB,OAAO;EACvC;;UAGe;EACf,OAAO,iBAAiB;EACxB;;UAGe;EACf"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Unsubscribe } from "../types/unsubscribe.js";
|
|
2
2
|
import { AssistantInstructionsConfig, AssistantToolProps, ModelContext, ModelContextProvider } from "./types.js";
|
|
3
3
|
import { ModelContextRegistryInstructionHandle, ModelContextRegistryProviderHandle, ModelContextRegistryToolHandle } from "./registry-handles.js";
|
|
4
|
-
|
|
5
4
|
//#region src/model-context/registry.d.ts
|
|
6
5
|
declare class ModelContextRegistry implements ModelContextProvider {
|
|
7
6
|
private _tools;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","names":[],"sources":["../../src/model-context/registry.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.d.ts","names":[],"sources":["../../src/model-context/registry.ts"],"mappings":";;;;cAea,gCAAgC;UACnC;UACA;UACA;UACA;UACA;EAER,mBAAmB;EAiDnB,UAAU,uBAAuB;UAKzB;EAMR,QAAQ,cAAc,yBAAyB,SAC7C,MAAM,mBAAmB,OAAO,WAC/B,+BAA+B,OAAO;EAoBzC,eACE,iBAAiB,8BAChB;EAiCH,YACE,UAAU,uBACT"}
|
|
@@ -1,31 +1,45 @@
|
|
|
1
1
|
import { Tool } from "assistant-stream";
|
|
2
|
-
|
|
3
2
|
//#region src/model-context/tool.d.ts
|
|
3
|
+
type StandardSchemaInput<TSchema> = TSchema extends {
|
|
4
|
+
readonly "~standard": {
|
|
5
|
+
readonly types?: {
|
|
6
|
+
readonly input: infer TInput;
|
|
7
|
+
} | undefined;
|
|
8
|
+
};
|
|
9
|
+
} ? TInput extends Record<string, unknown> ? TInput : Record<string, unknown> : Record<string, unknown>;
|
|
10
|
+
type StandardSchemaParameters = Extract<NonNullable<Extract<Tool<any>, {
|
|
11
|
+
parameters: unknown;
|
|
12
|
+
}>["parameters"]>, {
|
|
13
|
+
readonly "~standard": unknown;
|
|
14
|
+
}>;
|
|
4
15
|
/**
|
|
5
16
|
* Defines a model tool with its argument schema, execution behavior, and
|
|
6
17
|
* optional model-output conversion.
|
|
7
18
|
*
|
|
8
19
|
* This helper keeps reusable tool definitions type-checked and convenient to
|
|
9
20
|
* export for a {@link Toolkit} registered with {@link Tools}.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
21
|
+
* When `parameters` is a Standard Schema (for example Zod v4), its input type
|
|
22
|
+
* is inferred for `execute`, `streamCall`, and model-output callbacks. Plain
|
|
23
|
+
* JSON Schema objects do not carry TypeScript input types, so provide generic
|
|
24
|
+
* arguments or annotate callbacks when you need precise args for JSON Schema.
|
|
12
25
|
*
|
|
13
26
|
* @param tool - Tool definition to expose to the assistant model.
|
|
14
27
|
*
|
|
15
28
|
* @example
|
|
16
29
|
* ```ts
|
|
17
|
-
*
|
|
30
|
+
* import { z } from "zod";
|
|
31
|
+
*
|
|
32
|
+
* const getWeather = tool({
|
|
18
33
|
* type: "frontend",
|
|
19
34
|
* description: "Get the weather for a city.",
|
|
20
|
-
* parameters: {
|
|
21
|
-
* type: "object",
|
|
22
|
-
* properties: { city: { type: "string" } },
|
|
23
|
-
* required: ["city"],
|
|
24
|
-
* },
|
|
35
|
+
* parameters: z.object({ city: z.string() }),
|
|
25
36
|
* execute: async ({ city }) => `Sunny in ${city}`,
|
|
26
37
|
* });
|
|
27
38
|
* ```
|
|
28
39
|
*/
|
|
40
|
+
declare function tool<const TSchema extends StandardSchemaParameters, TResult = any>(tool: Tool<StandardSchemaInput<TSchema>, TResult> & {
|
|
41
|
+
parameters: TSchema;
|
|
42
|
+
}): Tool<StandardSchemaInput<TSchema>, TResult>;
|
|
29
43
|
declare function tool<TArgs extends Record<string, unknown>, TResult = any>(tool: Tool<TArgs, TResult>): Tool<TArgs, TResult>;
|
|
30
44
|
//#endregion
|
|
31
45
|
export { tool };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","names":[],"sources":["../../src/model-context/tool.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool.d.ts","names":[],"sources":["../../src/model-context/tool.ts"],"mappings":";;KAEK,oBAAoB,WAAW;WACzB;aACE;eAAmB,aAAa;;;IAGzC,eAAe,0BACb,SACA,0BACF;KAEC,2BAA2B,QAC9B,YAAY,QAAQ;EAAa;;WACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4BG,WACR,gBAAgB,0BACtB,eAEA,MAAM,KAAK,oBAAoB,UAAU;EAAa,YAAY;IACjE,KAAK,oBAAoB,UAAU;iBACtB,KAAK,cAAc,yBAAyB,eAC1D,MAAM,KAAK,OAAO,WACjB,KAAK,OAAO"}
|
|
@@ -1,29 +1,4 @@
|
|
|
1
1
|
//#region src/model-context/tool.ts
|
|
2
|
-
/**
|
|
3
|
-
* Defines a model tool with its argument schema, execution behavior, and
|
|
4
|
-
* optional model-output conversion.
|
|
5
|
-
*
|
|
6
|
-
* This helper keeps reusable tool definitions type-checked and convenient to
|
|
7
|
-
* export for a {@link Toolkit} registered with {@link Tools}.
|
|
8
|
-
* Inference from parameter schemas is currently limited, so provide generic
|
|
9
|
-
* arguments when you need precise args or result types.
|
|
10
|
-
*
|
|
11
|
-
* @param tool - Tool definition to expose to the assistant model.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* const getWeather = tool<{ city: string }, string>({
|
|
16
|
-
* type: "frontend",
|
|
17
|
-
* description: "Get the weather for a city.",
|
|
18
|
-
* parameters: {
|
|
19
|
-
* type: "object",
|
|
20
|
-
* properties: { city: { type: "string" } },
|
|
21
|
-
* required: ["city"],
|
|
22
|
-
* },
|
|
23
|
-
* execute: async ({ city }) => `Sunny in ${city}`,
|
|
24
|
-
* });
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
2
|
function tool(tool) {
|
|
28
3
|
return tool;
|
|
29
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.js","names":["Tool","
|
|
1
|
+
{"version":3,"file":"tool.js","names":["Tool","StandardSchemaInput","TSchema","types","input","TInput","Record","StandardSchemaParameters","Extract","NonNullable","parameters","tool","TResult","TArgs"],"sources":["../../src/model-context/tool.ts"],"sourcesContent":["import type { Tool } from \"assistant-stream\";\n\ntype StandardSchemaInput<TSchema> = TSchema extends {\n readonly \"~standard\": {\n readonly types?: { readonly input: infer TInput } | undefined;\n };\n}\n ? TInput extends Record<string, unknown>\n ? TInput\n : Record<string, unknown>\n : Record<string, unknown>;\n\ntype StandardSchemaParameters = Extract<\n NonNullable<Extract<Tool<any>, { parameters: unknown }>[\"parameters\"]>,\n { readonly \"~standard\": unknown }\n>;\n\n/**\n * Defines a model tool with its argument schema, execution behavior, and\n * optional model-output conversion.\n *\n * This helper keeps reusable tool definitions type-checked and convenient to\n * export for a {@link Toolkit} registered with {@link Tools}.\n * When `parameters` is a Standard Schema (for example Zod v4), its input type\n * is inferred for `execute`, `streamCall`, and model-output callbacks. Plain\n * JSON Schema objects do not carry TypeScript input types, so provide generic\n * arguments or annotate callbacks when you need precise args for JSON Schema.\n *\n * @param tool - Tool definition to expose to the assistant model.\n *\n * @example\n * ```ts\n * import { z } from \"zod\";\n *\n * const getWeather = tool({\n * type: \"frontend\",\n * description: \"Get the weather for a city.\",\n * parameters: z.object({ city: z.string() }),\n * execute: async ({ city }) => `Sunny in ${city}`,\n * });\n * ```\n */\nexport function tool<\n const TSchema extends StandardSchemaParameters,\n TResult = any,\n>(\n tool: Tool<StandardSchemaInput<TSchema>, TResult> & { parameters: TSchema },\n): Tool<StandardSchemaInput<TSchema>, TResult>;\nexport function tool<TArgs extends Record<string, unknown>, TResult = any>(\n tool: Tool<TArgs, TResult>,\n): Tool<TArgs, TResult>;\nexport function tool<TArgs extends Record<string, unknown>, TResult = any>(\n tool: Tool<TArgs, TResult>,\n): Tool<TArgs, TResult> {\n return tool;\n}\n"],"mappings":";AAmDA,SAAgBW,KACdA,MACsB;CACtB,OAAOA;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/model-context/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/model-context/types.ts"],"mappings":";;;KAGY;EACV;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;;KAGA;EACV;EACA;EACA;EACA;;KAGU;EACV;EACA;EACA,QAAQ,eAAe;EACvB,eAAe;EACf,SAAS;;;;;;EAMT,4BAA4B;;KAGlB;EACV,uBAAuB;EACvB,aAAa,yBAAyB;;KAG5B,mBACV,cAAc,yBACd,WACE,KAAK,OAAO;EACd;EACA;;KAGU;EACV;EACA;;KAGU;EACV;EACA;;cAGW,qBACX,WAAW,IAAI,0BACd"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AssistantRuntime } from "../runtime/api/assistant-runtime.js";
|
|
2
2
|
import { AssistantClient } from "@assistant-ui/store";
|
|
3
3
|
import { ComponentType, FC, PropsWithChildren } from "react";
|
|
4
|
-
|
|
5
4
|
//#region src/react/AssistantProvider.d.ts
|
|
6
5
|
declare const getRenderComponent: (runtime: AssistantRuntime) => ComponentType | undefined;
|
|
7
6
|
type AssistantProviderBaseProps = PropsWithChildren<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantProvider.d.ts","names":[],"sources":["../../src/react/AssistantProvider.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AssistantProvider.d.ts","names":[],"sources":["../../src/react/AssistantProvider.tsx"],"mappings":";;;;cAWa,qBAAsB,SAAS,qBAEnB;KAGb,6BAA6B;EACvC,SAAS;EACT,MAAM;;cAGK,uBAAuB,GAAG"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AssistantRuntime } from "../runtime/api/assistant-runtime.js";
|
|
2
2
|
import { AssistantClient } from "@assistant-ui/store";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
|
-
|
|
5
4
|
//#region src/react/AssistantRuntimeProvider.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Mounts an `AssistantRuntime` into the React tree.
|
|
@@ -25,11 +24,7 @@ import { ReactNode } from "react";
|
|
|
25
24
|
* }
|
|
26
25
|
* ```
|
|
27
26
|
*/
|
|
28
|
-
declare const AssistantRuntimeProvider: import("react").MemoExoticComponent<({
|
|
29
|
-
runtime,
|
|
30
|
-
aui,
|
|
31
|
-
children
|
|
32
|
-
}: {
|
|
27
|
+
declare const AssistantRuntimeProvider: import("react").MemoExoticComponent<({ runtime, aui, children }: {
|
|
33
28
|
/**
|
|
34
29
|
* The assistant runtime to expose to descendants. Build one with
|
|
35
30
|
* `useLocalRuntime`, `useExternalStoreRuntime`, or
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantRuntimeProvider.d.ts","names":[],"sources":["../../src/react/AssistantRuntimeProvider.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AssistantRuntimeProvider.d.ts","names":[],"sources":["../../src/react/AssistantRuntimeProvider.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;cA2Ba,0CAAwB,uBAAA,SAAA,KAAA;;;;;;EAWjC,SAAS;;;;;;;EAOT,MAAM;EACN,UAAU;sBACX,IAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AssistantRuntime } from "../runtime/api/assistant-runtime.js";
|
|
2
|
+
import "../index.js";
|
|
2
3
|
//#region src/react/RuntimeAdapter.d.ts
|
|
3
4
|
declare const RuntimeAdapter: import("@assistant-ui/tap").Resource<import("@assistant-ui/store").ClientOutput<"threads">, [runtime: AssistantRuntime]>;
|
|
4
5
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeAdapter.d.ts","names":[],"sources":["../../src/react/RuntimeAdapter.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"RuntimeAdapter.d.ts","names":[],"sources":["../../src/react/RuntimeAdapter.ts"],"mappings":";;;cA+Ba,4CAAc,uCAAA,0BAAA,SAAA"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ExportedMessageRepository } from "../../runtime/utils/message-repository.js";
|
|
1
2
|
import { RemoteThreadListAdapter } from "../../runtimes/remote-thread-list/types.js";
|
|
3
|
+
import "../../internal.js";
|
|
4
|
+
import "../../index.js";
|
|
2
5
|
import { TitleGenerationAdapter } from "./TitleGenerationAdapter.js";
|
|
3
|
-
|
|
4
6
|
//#region src/react/adapters/LocalStorageThreadListAdapter.d.ts
|
|
5
7
|
type AsyncStorageLike = {
|
|
6
8
|
getItem(key: string): Promise<string | null>;
|
|
@@ -12,7 +14,16 @@ type LocalStorageAdapterOptions = {
|
|
|
12
14
|
prefix?: string | undefined;
|
|
13
15
|
titleGenerator?: TitleGenerationAdapter | undefined;
|
|
14
16
|
};
|
|
17
|
+
type StoredThreadMetadata = {
|
|
18
|
+
remoteId: string;
|
|
19
|
+
externalId?: string;
|
|
20
|
+
status: "regular" | "archived";
|
|
21
|
+
title?: string;
|
|
22
|
+
custom?: Record<string, unknown> | undefined;
|
|
23
|
+
};
|
|
24
|
+
declare const parseStoredThreadMetadata: (raw: string | null) => StoredThreadMetadata[];
|
|
25
|
+
declare const parseStoredMessageRepository: (raw: string | null) => ExportedMessageRepository;
|
|
15
26
|
declare const createLocalStorageAdapter: (options: LocalStorageAdapterOptions) => RemoteThreadListAdapter;
|
|
16
27
|
//#endregion
|
|
17
|
-
export { AsyncStorageLike, createLocalStorageAdapter };
|
|
28
|
+
export { AsyncStorageLike, createLocalStorageAdapter, parseStoredMessageRepository, parseStoredThreadMetadata };
|
|
18
29
|
//# sourceMappingURL=LocalStorageThreadListAdapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalStorageThreadListAdapter.d.ts","names":[],"sources":["../../../src/react/adapters/LocalStorageThreadListAdapter.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"LocalStorageThreadListAdapter.d.ts","names":[],"sources":["../../../src/react/adapters/LocalStorageThreadListAdapter.tsx"],"mappings":";;;;;;KAmBY;EACV,QAAQ,cAAc;EACtB,QAAQ,aAAa,gBAAgB;EACrC,WAAW,cAAc;;KAGtB;EACH,SAAS;EACT;EACA,iBAAiB;;KAGd;EACH;EACA;EACA;EACA;EACA,SAAS;;cAwIE,4BACX,uBACC;cAoCU,+BACX,uBACC;cA8FU,4BACX,SAAS,+BACR"}
|
|
@@ -4,6 +4,121 @@ import { useAui } from "@assistant-ui/store";
|
|
|
4
4
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/react/adapters/LocalStorageThreadListAdapter.tsx
|
|
7
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8
|
+
const parseJSON = (raw) => {
|
|
9
|
+
if (!raw) return void 0;
|
|
10
|
+
try {
|
|
11
|
+
return JSON.parse(raw);
|
|
12
|
+
} catch {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const parseStoredThread = (value) => {
|
|
17
|
+
if (!isRecord(value) || typeof value.remoteId !== "string") return null;
|
|
18
|
+
const status = value.status ?? "regular";
|
|
19
|
+
if (status !== "regular" && status !== "archived") return null;
|
|
20
|
+
return {
|
|
21
|
+
remoteId: value.remoteId,
|
|
22
|
+
status,
|
|
23
|
+
...typeof value.externalId === "string" ? { externalId: value.externalId } : void 0,
|
|
24
|
+
...typeof value.title === "string" ? { title: value.title } : void 0,
|
|
25
|
+
...isRecord(value.custom) ? { custom: value.custom } : void 0
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const parseDate = (value) => {
|
|
29
|
+
if (value instanceof Date && !Number.isNaN(value.getTime())) return value;
|
|
30
|
+
if (typeof value !== "string" && typeof value !== "number") return null;
|
|
31
|
+
const date = new Date(value);
|
|
32
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
33
|
+
};
|
|
34
|
+
const isMessageRole = (value) => value === "system" || value === "user" || value === "assistant";
|
|
35
|
+
const parseStoredThreadMessage = (value) => {
|
|
36
|
+
if (!isRecord(value) || typeof value.id !== "string") return null;
|
|
37
|
+
if (!isMessageRole(value.role)) return null;
|
|
38
|
+
if (!Array.isArray(value.content)) return null;
|
|
39
|
+
const createdAt = parseDate(value.createdAt);
|
|
40
|
+
if (!createdAt) return null;
|
|
41
|
+
const metadata = value.metadata;
|
|
42
|
+
if (!isRecord(metadata) || !isRecord(metadata.custom)) return null;
|
|
43
|
+
if (value.role === "assistant") {
|
|
44
|
+
const status = value.status;
|
|
45
|
+
if (!isRecord(status) || typeof status.type !== "string") return null;
|
|
46
|
+
const submittedFeedbackType = (isRecord(metadata.submittedFeedback) ? metadata.submittedFeedback : void 0)?.type;
|
|
47
|
+
return {
|
|
48
|
+
id: value.id,
|
|
49
|
+
role: "assistant",
|
|
50
|
+
content: value.content,
|
|
51
|
+
status,
|
|
52
|
+
createdAt,
|
|
53
|
+
metadata: {
|
|
54
|
+
unstable_state: metadata.unstable_state ?? null,
|
|
55
|
+
unstable_annotations: Array.isArray(metadata.unstable_annotations) ? metadata.unstable_annotations : [],
|
|
56
|
+
unstable_data: Array.isArray(metadata.unstable_data) ? metadata.unstable_data : [],
|
|
57
|
+
steps: Array.isArray(metadata.steps) ? metadata.steps : [],
|
|
58
|
+
...submittedFeedbackType === "positive" || submittedFeedbackType === "negative" ? { submittedFeedback: { type: submittedFeedbackType } } : void 0,
|
|
59
|
+
...metadata.timing !== void 0 ? { timing: metadata.timing } : void 0,
|
|
60
|
+
...metadata.isOptimistic === true ? { isOptimistic: true } : void 0,
|
|
61
|
+
custom: metadata.custom
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
if (value.role === "user") return {
|
|
66
|
+
id: value.id,
|
|
67
|
+
role: "user",
|
|
68
|
+
content: value.content,
|
|
69
|
+
attachments: Array.isArray(value.attachments) ? value.attachments : [],
|
|
70
|
+
createdAt,
|
|
71
|
+
metadata: { custom: metadata.custom }
|
|
72
|
+
};
|
|
73
|
+
if (value.content.length !== 1) return null;
|
|
74
|
+
return {
|
|
75
|
+
id: value.id,
|
|
76
|
+
role: "system",
|
|
77
|
+
content: [value.content[0]],
|
|
78
|
+
createdAt,
|
|
79
|
+
metadata: { custom: metadata.custom }
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
const parseStoredThreadMetadata = (raw) => {
|
|
83
|
+
const parsed = parseJSON(raw);
|
|
84
|
+
if (!Array.isArray(parsed)) return [];
|
|
85
|
+
return parsed.flatMap((item) => {
|
|
86
|
+
const thread = parseStoredThread(item);
|
|
87
|
+
return thread ? [thread] : [];
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
const parseStoredMessageRepositoryItem = (value) => {
|
|
91
|
+
if (!isRecord(value)) return null;
|
|
92
|
+
const message = parseStoredThreadMessage(value.message);
|
|
93
|
+
if (!message) return null;
|
|
94
|
+
const parentId = value.parentId;
|
|
95
|
+
if (parentId !== void 0 && parentId !== null && typeof parentId !== "string") return null;
|
|
96
|
+
return {
|
|
97
|
+
message,
|
|
98
|
+
parentId: parentId ?? null,
|
|
99
|
+
...isRecord(value.runConfig) ? { runConfig: value.runConfig } : void 0
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
const parseStoredMessageRepository = (raw) => {
|
|
103
|
+
const parsed = parseJSON(raw);
|
|
104
|
+
if (!isRecord(parsed) || !Array.isArray(parsed.messages)) return { messages: [] };
|
|
105
|
+
const candidateMessages = parsed.messages.flatMap((item) => {
|
|
106
|
+
const parsedItem = parseStoredMessageRepositoryItem(item);
|
|
107
|
+
return parsedItem ? [parsedItem] : [];
|
|
108
|
+
});
|
|
109
|
+
const acceptedIds = /* @__PURE__ */ new Set();
|
|
110
|
+
const messages = candidateMessages.flatMap((item) => {
|
|
111
|
+
if (acceptedIds.has(item.message.id)) return [];
|
|
112
|
+
if (item.parentId !== null && !acceptedIds.has(item.parentId)) return [];
|
|
113
|
+
acceptedIds.add(item.message.id);
|
|
114
|
+
return [item];
|
|
115
|
+
});
|
|
116
|
+
const headId = parsed.headId === null || typeof parsed.headId === "string" && messages.some((item) => item.message.id === parsed.headId) ? parsed.headId : void 0;
|
|
117
|
+
return {
|
|
118
|
+
...headId !== void 0 ? { headId } : void 0,
|
|
119
|
+
messages
|
|
120
|
+
};
|
|
121
|
+
};
|
|
7
122
|
var AsyncStorageHistoryAdapter = class {
|
|
8
123
|
storage;
|
|
9
124
|
aui;
|
|
@@ -20,14 +135,13 @@ var AsyncStorageHistoryAdapter = class {
|
|
|
20
135
|
const remoteId = this.aui.threadListItem().getState().remoteId;
|
|
21
136
|
if (!remoteId) return { messages: [] };
|
|
22
137
|
const raw = await this.storage.getItem(this._messagesKey(remoteId));
|
|
23
|
-
|
|
24
|
-
return JSON.parse(raw);
|
|
138
|
+
return parseStoredMessageRepository(raw);
|
|
25
139
|
}
|
|
26
140
|
async append(item) {
|
|
27
141
|
const { remoteId } = await this.aui.threadListItem().initialize();
|
|
28
142
|
const key = this._messagesKey(remoteId);
|
|
29
143
|
const raw = await this.storage.getItem(key);
|
|
30
|
-
const repo =
|
|
144
|
+
const repo = parseStoredMessageRepository(raw);
|
|
31
145
|
const idx = repo.messages.findIndex((m) => m.message.id === item.message.id);
|
|
32
146
|
if (idx >= 0) repo.messages[idx] = item;
|
|
33
147
|
else repo.messages.push(item);
|
|
@@ -74,7 +188,7 @@ const createLocalStorageAdapter = (options) => {
|
|
|
74
188
|
const messagesKey = (threadId) => `${prefix}messages:${threadId}`;
|
|
75
189
|
const loadThreadMetadata = async () => {
|
|
76
190
|
const raw = await storage.getItem(threadsKey);
|
|
77
|
-
return
|
|
191
|
+
return parseStoredThreadMetadata(raw);
|
|
78
192
|
};
|
|
79
193
|
const saveThreadMetadata = async (threads) => {
|
|
80
194
|
await storage.setItem(threadsKey, JSON.stringify(threads));
|
|
@@ -138,12 +252,13 @@ const createLocalStorageAdapter = (options) => {
|
|
|
138
252
|
}
|
|
139
253
|
},
|
|
140
254
|
async delete(remoteId) {
|
|
141
|
-
|
|
255
|
+
const filtered = (await loadThreadMetadata()).filter((t) => t.remoteId !== remoteId);
|
|
256
|
+
await saveThreadMetadata(filtered);
|
|
142
257
|
await storage.removeItem(messagesKey(remoteId));
|
|
143
258
|
},
|
|
144
259
|
async fetch(threadId) {
|
|
145
260
|
const thread = (await loadThreadMetadata()).find((t) => t.remoteId === threadId);
|
|
146
|
-
if (!thread) throw new Error("
|
|
261
|
+
if (!thread) throw new Error(`Stored thread "${threadId}" not found while fetching thread metadata.`);
|
|
147
262
|
return {
|
|
148
263
|
remoteId: thread.remoteId,
|
|
149
264
|
externalId: thread.externalId,
|
|
@@ -170,6 +285,6 @@ const createLocalStorageAdapter = (options) => {
|
|
|
170
285
|
};
|
|
171
286
|
};
|
|
172
287
|
//#endregion
|
|
173
|
-
export { createLocalStorageAdapter };
|
|
288
|
+
export { createLocalStorageAdapter, parseStoredMessageRepository, parseStoredThreadMetadata };
|
|
174
289
|
|
|
175
290
|
//# sourceMappingURL=LocalStorageThreadListAdapter.js.map
|