@assistant-ui/core 0.2.10 → 0.2.12
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.map +1 -1
- package/dist/adapters/attachment.js +22 -12
- package/dist/adapters/attachment.js.map +1 -1
- package/dist/adapters/directive-formatter.js.map +1 -1
- package/dist/adapters/speech.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/model-context/frame/host.js.map +1 -1
- package/dist/model-context/frame/provider.js.map +1 -1
- package/dist/model-context/registry.js.map +1 -1
- package/dist/model-context/types.js.map +1 -1
- package/dist/react/AssistantProvider.js +1 -1
- package/dist/react/AssistantRuntimeProvider.d.ts +1 -1
- package/dist/react/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/react/AssistantRuntimeProvider.js +1 -1
- package/dist/react/RuntimeAdapter.js +4 -2
- package/dist/react/RuntimeAdapter.js.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
- package/dist/react/client/DataRenderers.d.ts.map +1 -1
- package/dist/react/client/DataRenderers.js +6 -5
- package/dist/react/client/DataRenderers.js.map +1 -1
- package/dist/react/client/Interactables.d.ts.map +1 -1
- package/dist/react/client/Interactables.js +30 -29
- package/dist/react/client/Interactables.js.map +1 -1
- package/dist/react/client/Tools.d.ts.map +1 -1
- package/dist/react/client/Tools.js +10 -9
- package/dist/react/client/Tools.js.map +1 -1
- package/dist/react/index.d.ts +5 -4
- package/dist/react/index.js +3 -2
- package/dist/react/model-context/define-mcp-toolkit.js.map +1 -1
- package/dist/react/model-context/define-toolkit.d.ts +9 -12
- package/dist/react/model-context/define-toolkit.d.ts.map +1 -1
- package/dist/react/model-context/define-toolkit.js +1 -1
- package/dist/react/model-context/define-toolkit.js.map +1 -1
- package/dist/react/model-context/external-tool.d.ts +14 -0
- package/dist/react/model-context/external-tool.d.ts.map +1 -0
- package/dist/react/model-context/external-tool.js +17 -0
- package/dist/react/model-context/external-tool.js.map +1 -0
- package/dist/react/model-context/human-tool.d.ts +27 -0
- package/dist/react/model-context/human-tool.d.ts.map +1 -0
- package/dist/react/model-context/human-tool.js +30 -0
- package/dist/react/model-context/human-tool.js.map +1 -0
- package/dist/react/model-context/toolbox.d.ts +3 -3
- package/dist/react/model-context/toolbox.js.map +1 -1
- package/dist/react/model-context/useAssistantContext.js +1 -1
- package/dist/react/model-context/useAssistantContext.js.map +1 -1
- package/dist/react/model-context/useAssistantDataUI.js +1 -1
- package/dist/react/model-context/useAssistantDataUI.js.map +1 -1
- package/dist/react/model-context/useAssistantInstructions.js +1 -1
- package/dist/react/model-context/useAssistantInstructions.js.map +1 -1
- package/dist/react/model-context/useAssistantInteractable.js +1 -1
- package/dist/react/model-context/useAssistantInteractable.js.map +1 -1
- package/dist/react/model-context/useAssistantTool.js +1 -1
- package/dist/react/model-context/useAssistantTool.js.map +1 -1
- package/dist/react/model-context/useAssistantToolUI.js +1 -1
- package/dist/react/model-context/useAssistantToolUI.js.map +1 -1
- package/dist/react/model-context/useAuiToolOverrides.js +1 -1
- package/dist/react/model-context/useAuiToolOverrides.js.map +1 -1
- package/dist/react/model-context/useInlineRender.js +1 -1
- package/dist/react/model-context/useInlineRender.js.map +1 -1
- package/dist/react/model-context/useInteractableState.js +1 -1
- package/dist/react/model-context/useInteractableState.js.map +1 -1
- package/dist/react/model-context/useToolArgsStatus.js +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.js +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.js +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.js +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.js +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.js +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.js +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.js +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.js +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.js +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.js +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.js +1 -1
- package/dist/react/primitive-hooks/useComposerSend.js.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.js +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.js.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.js +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.js +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageReload.js +1 -1
- package/dist/react/primitive-hooks/useMessageReload.js.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.js +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.js +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.js +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.js +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.js +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.js +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.js +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.js.map +1 -1
- package/dist/react/primitive-hooks/useVoice.js +1 -1
- package/dist/react/primitive-hooks/useVoice.js.map +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js.map +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.js +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/react/primitives/composer/ComposerQueue.js +1 -1
- package/dist/react/primitives/composer/ComposerQueue.js.map +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.js +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.js.map +1 -1
- package/dist/react/primitives/message/MessageAttachments.js +1 -1
- package/dist/react/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.js +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.js.map +1 -1
- package/dist/react/primitives/message/MessageParts.d.ts +1 -1
- package/dist/react/primitives/message/MessageParts.js +1 -1
- package/dist/react/primitives/message/MessageParts.js.map +1 -1
- package/dist/react/primitives/message/MessageQuote.js +1 -1
- package/dist/react/primitives/part/PartMessages.d.ts +2 -2
- package/dist/react/primitives/part/PartMessages.js +3 -3
- package/dist/react/primitives/part/PartMessages.js.map +1 -1
- package/dist/react/primitives/thread/ThreadMessages.js +1 -1
- package/dist/react/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.js +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.js.map +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.js +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/react/providers/AttachmentByIndexProvider.js.map +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.js.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js.map +1 -1
- package/dist/react/providers/MessageByIndexProvider.js.map +1 -1
- package/dist/react/providers/PartByIndexProvider.js.map +1 -1
- package/dist/react/providers/QueueItemByIndexProvider.js.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.js +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.js.map +1 -1
- package/dist/react/providers/SuggestionByIndexProvider.js.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.js +4 -3
- package/dist/react/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +7 -0
- 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 +7 -0
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/react/runtimes/RuntimeAdapterProvider.js +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js.map +1 -1
- package/dist/react/runtimes/createMessageConverter.d.ts +2 -2
- package/dist/react/runtimes/createMessageConverter.d.ts.map +1 -1
- package/dist/react/runtimes/createMessageConverter.js.map +1 -1
- package/dist/react/runtimes/external-message-converter.d.ts +4 -3
- package/dist/react/runtimes/external-message-converter.d.ts.map +1 -1
- package/dist/react/runtimes/external-message-converter.js +1 -1
- package/dist/react/runtimes/external-message-converter.js.map +1 -1
- package/dist/react/runtimes/useExternalStoreRuntime.js +1 -1
- package/dist/react/runtimes/useExternalStoreSharedOptions.js +1 -1
- package/dist/react/runtimes/useLocalRuntime.d.ts +2 -1
- package/dist/react/runtimes/useLocalRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.js +4 -3
- package/dist/react/runtimes/useLocalRuntime.js.map +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.js +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/react/utils/groupParts.d.ts +1 -1
- package/dist/react/utils/groupParts.js.map +1 -1
- package/dist/runtime/api/attachment-runtime.js.map +1 -1
- package/dist/runtime/api/composer-runtime.d.ts +8 -2
- package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.js +14 -0
- package/dist/runtime/api/composer-runtime.js.map +1 -1
- package/dist/runtime/api/message-part-runtime.js.map +1 -1
- package/dist/runtime/api/message-runtime.js +1 -1
- package/dist/runtime/api/message-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.js.map +1 -1
- package/dist/runtime/api/thread-runtime.d.ts +7 -0
- package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-runtime.js.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.d.ts +4 -0
- package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.js +7 -1
- package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +4 -0
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js +17 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
- package/dist/runtime/interfaces/composer-runtime-core.d.ts +6 -1
- package/dist/runtime/interfaces/composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-runtime-core.d.ts +4 -0
- package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts +20 -0
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts.map +1 -0
- package/dist/runtime/queue/external-thread-queue-adapter.js +0 -0
- package/dist/runtime/queue/message-queue.d.ts +20 -0
- package/dist/runtime/queue/message-queue.d.ts.map +1 -0
- package/dist/runtime/queue/message-queue.js +97 -0
- package/dist/runtime/queue/message-queue.js.map +1 -0
- package/dist/runtime/utils/message-repository.js.map +1 -1
- package/dist/runtime/utils/thread-message-like.js.map +1 -1
- package/dist/runtimes/external-store/external-store-adapter.d.ts +3 -1
- package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +4 -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 +20 -2
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/local/local-runtime-core.js.map +1 -1
- package/dist/runtimes/local/local-runtime-options.d.ts +5 -0
- package/dist/runtimes/local/local-runtime-options.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.d.ts +7 -0
- package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.js +45 -0
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +3 -0
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js +3 -0
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.js +3 -0
- package/dist/runtimes/remote-thread-list/empty-thread-core.js.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.js.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js.map +1 -1
- package/dist/store/clients/chain-of-thought-client.d.ts.map +1 -1
- package/dist/store/clients/chain-of-thought-client.js +6 -5
- package/dist/store/clients/chain-of-thought-client.js.map +1 -1
- package/dist/store/clients/model-context-client.d.ts.map +1 -1
- package/dist/store/clients/model-context-client.js +6 -5
- package/dist/store/clients/model-context-client.js.map +1 -1
- package/dist/store/clients/no-op-composer-client.d.ts.map +1 -1
- package/dist/store/clients/no-op-composer-client.js +4 -3
- package/dist/store/clients/no-op-composer-client.js.map +1 -1
- package/dist/store/clients/runtime-adapter.d.ts.map +1 -1
- package/dist/store/clients/runtime-adapter.js +7 -6
- package/dist/store/clients/runtime-adapter.js.map +1 -1
- package/dist/store/clients/suggestions.d.ts.map +1 -1
- package/dist/store/clients/suggestions.js +7 -6
- package/dist/store/clients/suggestions.js.map +1 -1
- package/dist/store/clients/thread-message-client.d.ts.map +1 -1
- package/dist/store/clients/thread-message-client.js +13 -12
- package/dist/store/clients/thread-message-client.js.map +1 -1
- package/dist/store/index.d.ts +1 -1
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/attachment-runtime-client.js +3 -3
- package/dist/store/runtime-clients/attachment-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.d.ts +12 -5
- package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.js +32 -16
- package/dist/store/runtime-clients/composer-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.js +3 -3
- package/dist/store/runtime-clients/message-part-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.d.ts +6 -3
- package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.js +17 -16
- package/dist/store/runtime-clients/message-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.js +8 -7
- package/dist/store/runtime-clients/thread-list-item-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.js +11 -10
- package/dist/store/runtime-clients/thread-list-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.js +15 -14
- package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/useSubscribable.d.ts +7 -0
- package/dist/store/runtime-clients/useSubscribable.d.ts.map +1 -0
- package/dist/store/runtime-clients/useSubscribable.js +16 -0
- package/dist/store/runtime-clients/useSubscribable.js.map +1 -0
- package/dist/store/scope-registration.d.ts +1 -1
- package/dist/store/scopes/composer.d.ts +1 -1
- package/dist/store/scopes/queue-item.d.ts +2 -1
- package/dist/store/scopes/queue-item.d.ts.map +1 -1
- package/dist/store/scopes/queue-item.js +6 -0
- package/dist/store/scopes/queue-item.js.map +1 -0
- package/dist/store/scopes/thread.d.ts +1 -1
- package/dist/store/scopes/threads.d.ts +1 -1
- package/dist/types/message.d.ts +2 -1
- package/dist/types/message.d.ts.map +1 -1
- package/dist/types/message.js.map +1 -1
- package/dist/utils/composite-context-provider.d.ts +1 -1
- package/dist/utils/composite-context-provider.js +3 -1
- package/dist/utils/composite-context-provider.js.map +1 -1
- package/dist/utils/json/is-json.js.map +1 -1
- package/dist/utils/text.js.map +1 -1
- package/package.json +14 -10
- package/src/adapters/attachment.ts +24 -4
- package/src/index.ts +8 -0
- package/src/react/RuntimeAdapter.ts +6 -4
- package/src/react/client/DataRenderers.ts +48 -42
- package/src/react/client/Interactables.ts +263 -267
- package/src/react/client/Tools.ts +122 -129
- package/src/react/index.ts +3 -1
- package/src/react/model-context/define-toolkit.test.ts +14 -7
- package/src/react/model-context/define-toolkit.ts +18 -19
- package/src/react/model-context/external-tool.ts +16 -0
- package/src/react/model-context/{hitl.ts → human-tool.ts} +13 -8
- package/src/react/model-context/toolbox.ts +3 -3
- package/src/react/primitives/message/MessageGroupedParts.tsx +1 -1
- package/src/react/primitives/part/PartMessages.tsx +2 -2
- package/src/react/providers/TextMessagePartProvider.tsx +31 -32
- package/src/react/runtimes/createMessageConverter.ts +2 -1
- package/src/react/runtimes/external-message-converter.ts +5 -3
- package/src/react/runtimes/useLocalRuntime.ts +2 -0
- package/src/runtime/api/composer-runtime.ts +26 -0
- package/src/runtime/base/base-composer-runtime-core.ts +11 -0
- package/src/runtime/base/default-thread-composer-runtime-core.ts +22 -0
- package/src/runtime/interfaces/composer-runtime-core.ts +7 -0
- package/src/runtime/interfaces/thread-runtime-core.ts +5 -0
- package/src/runtime/queue/external-thread-queue-adapter.ts +14 -0
- package/src/runtime/queue/message-queue.ts +128 -0
- package/src/runtimes/external-store/external-store-adapter.ts +3 -0
- package/src/runtimes/external-store/external-store-thread-runtime-core.ts +31 -2
- package/src/runtimes/local/local-runtime-options.ts +6 -0
- package/src/runtimes/local/local-thread-runtime-core.ts +70 -0
- package/src/runtimes/readonly/ReadonlyThreadRuntimeCore.ts +4 -0
- package/src/runtimes/remote-thread-list/empty-thread-core.ts +4 -0
- package/src/store/clients/chain-of-thought-client.ts +24 -25
- package/src/store/clients/model-context-client.ts +22 -19
- package/src/store/clients/no-op-composer-client.ts +69 -66
- package/src/store/clients/runtime-adapter.ts +9 -6
- package/src/store/clients/suggestions.ts +41 -40
- package/src/store/clients/thread-message-client.ts +127 -132
- package/src/store/runtime-clients/attachment-runtime-client.ts +7 -3
- package/src/store/runtime-clients/composer-runtime-client.ts +142 -113
- package/src/store/runtime-clients/message-part-runtime-client.ts +16 -14
- package/src/store/runtime-clients/message-runtime-client.ts +124 -122
- package/src/store/runtime-clients/thread-list-item-runtime-client.ts +44 -45
- package/src/store/runtime-clients/thread-list-runtime-client.ts +83 -80
- package/src/store/runtime-clients/thread-runtime-client.ts +113 -119
- package/src/store/runtime-clients/{tap-subscribable.ts → useSubscribable.ts} +4 -4
- package/src/store/scopes/queue-item.ts +2 -0
- package/src/tests/attachment-adapters.test.ts +86 -0
- package/src/tests/external-store-thread-runtime-core.test.ts +125 -0
- package/src/tests/message-queue.test.ts +168 -0
- package/src/types/message.ts +2 -0
- package/src/utils/composite-context-provider.ts +3 -1
- package/dist/react/model-context/hitl.d.ts +0 -23
- package/dist/react/model-context/hitl.d.ts.map +0 -1
- package/dist/react/model-context/hitl.js +0 -26
- package/dist/react/model-context/hitl.js.map +0 -1
- package/dist/store/runtime-clients/tap-subscribable.d.ts +0 -7
- package/dist/store/runtime-clients/tap-subscribable.d.ts.map +0 -1
- package/dist/store/runtime-clients/tap-subscribable.js +0 -16
- package/dist/store/runtime-clients/tap-subscribable.js.map +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/react/model-context/human-tool.ts
|
|
2
|
+
/**
|
|
3
|
+
* Marks a tool as **human-in-the-loop**: the agent pauses and the UI (`render`)
|
|
4
|
+
* supplies the result instead of code. Use it as the tool's `execute`:
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* confirm: { execute: humanTool(), render: (props) => <Confirm {...props} /> }
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* Unlike {@link defineToolkit}, it has **no runtime implementation**: a
|
|
11
|
+
* `"use generative"` compiler (e.g. `@assistant-ui/next` or `@assistant-ui/vite`)
|
|
12
|
+
* detects `execute: humanTool()`, drops it, and stamps the tool `type: "human"`.
|
|
13
|
+
* Reaching it at runtime means the module wasn't compiled (used outside a
|
|
14
|
+
* `"use generative"` file), so it throws.
|
|
15
|
+
*/
|
|
16
|
+
function humanTool() {
|
|
17
|
+
throw new Error("[assistant-ui] humanTool() has no runtime implementation — it marks a human-in-the-loop tool and is stripped at build time by the use-generative compiler. Reaching it means this module was not compiled (e.g. humanTool() used outside a \"use generative\" file).");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use {@link humanTool}.
|
|
21
|
+
*/
|
|
22
|
+
const hitlTool = humanTool;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Use {@link humanTool}.
|
|
25
|
+
*/
|
|
26
|
+
const hitl = humanTool;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { hitl, hitlTool, humanTool };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=human-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"human-tool.js","names":[],"sources":["../../../src/react/model-context/human-tool.ts"],"sourcesContent":["/**\n * Marks a tool as **human-in-the-loop**: the agent pauses and the UI (`render`)\n * supplies the result instead of code. Use it as the tool's `execute`:\n *\n * ```tsx\n * confirm: { execute: humanTool(), render: (props) => <Confirm {...props} /> }\n * ```\n *\n * Unlike {@link defineToolkit}, it has **no runtime implementation**: a\n * `\"use generative\"` compiler (e.g. `@assistant-ui/next` or `@assistant-ui/vite`)\n * detects `execute: humanTool()`, drops it, and stamps the tool `type: \"human\"`.\n * Reaching it at runtime means the module wasn't compiled (used outside a\n * `\"use generative\"` file), so it throws.\n */\nexport function humanTool(): never {\n throw new Error(\n \"[assistant-ui] humanTool() has no runtime implementation — it marks a \" +\n \"human-in-the-loop tool and is stripped at build time by the \" +\n \"use-generative compiler. Reaching it means this module was not compiled \" +\n '(e.g. humanTool() used outside a \"use generative\" file).',\n );\n}\n\n/**\n * @deprecated Use {@link humanTool}.\n */\nexport const hitlTool = humanTool;\n\n/**\n * @deprecated Use {@link humanTool}.\n */\nexport const hitl = humanTool;\n"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAgB,YAAmB;CACjC,MAAM,IAAI,MACR,sQAIF;AACF;;;;AAKA,MAAa,WAAW;;;;AAKxB,MAAa,OAAO"}
|
|
@@ -63,7 +63,7 @@ type ToolDefinition<TArgs extends Record<string, unknown> = Record<string, unkno
|
|
|
63
63
|
*
|
|
64
64
|
* @example
|
|
65
65
|
* ```tsx
|
|
66
|
-
* const toolkit = {
|
|
66
|
+
* const toolkit = defineToolkit({
|
|
67
67
|
* get_weather: {
|
|
68
68
|
* type: "frontend",
|
|
69
69
|
* description: "Get the weather for a city.",
|
|
@@ -71,7 +71,7 @@ type ToolDefinition<TArgs extends Record<string, unknown> = Record<string, unkno
|
|
|
71
71
|
* execute: async ({ city }: { city: string }) => fetchWeather(city),
|
|
72
72
|
* render: WeatherToolUI,
|
|
73
73
|
* },
|
|
74
|
-
* }
|
|
74
|
+
* });
|
|
75
75
|
* ```
|
|
76
76
|
*/
|
|
77
77
|
type Toolkit = Record<string, ToolDefinition<any, any>>;
|
|
@@ -79,7 +79,7 @@ type Toolkit = Record<string, ToolDefinition<any, any>>;
|
|
|
79
79
|
* A tool as authored, before the build splits it: like {@link ToolDefinition}
|
|
80
80
|
* but it may declare `description`, `parameters`, and a server-side `execute`
|
|
81
81
|
* alongside its `render`. The `type` field is **not** authored — the
|
|
82
|
-
* `"use generative"` compiler infers it (`execute:
|
|
82
|
+
* `"use generative"` compiler infers it (`execute: humanTool()` → human;
|
|
83
83
|
* `execute: providerTool(...)` → provider; `execute` with a `"use client"`
|
|
84
84
|
* directive → frontend; otherwise backend) and writes it back — so declaring it
|
|
85
85
|
* here is a type error.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbox.js","names":[],"sources":["../../../src/react/model-context/toolbox.ts"],"sourcesContent":["import type {\n Tool,\n ToolCallReader,\n ToolDeclaration,\n ToolModelOutputFunction,\n} from \"assistant-stream\";\nimport type { ReactNode } from \"react\";\nimport type {\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n} from \"../types/MessagePartComponentTypes\";\n\n/**\n * Resolves whether a tool's UI should be presented standalone (outside the\n * chain-of-thought grouping), applying the type-based defaults.\n *\n * An explicit `display` wins. Otherwise `human` tools default to standalone\n * (they prompt the user), and every other tool defaults to inline (a trace of\n * what the model is doing). MCP-app tool calls are detected separately from\n * the part itself and are not resolved here.\n */\nexport const isStandaloneToolDisplay = (\n tool: Pick<Tool<any, any>, \"type\" | \"display\">,\n): boolean => {\n if (tool.display !== undefined) return tool.display === \"standalone\";\n return tool.type === \"human\";\n};\n\ntype WithRender<T, TArgs extends Record<string, unknown>, TResult> = T extends {\n type: \"frontend\" | \"human\";\n}\n ? T &\n (T extends { type: \"frontend\" }\n ?\n | { render: ToolCallMessagePartComponent<TArgs, TResult> }\n | {\n render?: ToolCallMessagePartComponent<TArgs, TResult>;\n renderText: ToolCallText<TArgs, TResult>;\n }\n : { render: ToolCallMessagePartComponent<TArgs, TResult> })\n : T & {\n render?: ToolCallMessagePartComponent<TArgs, TResult> | undefined;\n renderText?: ToolCallText<TArgs, TResult> | undefined;\n };\n\ntype ToolParameters<TArgs extends Record<string, unknown>> =\n ToolDeclaration<TArgs>[\"parameters\"];\n\n// ToolExecutionContext is not re-exported from assistant-stream's public entry.\ntype ToolExecuteContext = Parameters<\n NonNullable<ToolDeclaration[\"execute\"]>\n>[1];\n\ntype ToolExecute<TArgs extends Record<string, unknown>, TResult> = (\n args: TArgs,\n context: ToolExecuteContext,\n) => TResult | Promise<TResult>;\n\ntype ToolStreamCall<TArgs extends Record<string, unknown>, TResult> = (\n reader: ToolCallReader<TArgs, TResult>,\n context: ToolExecuteContext,\n) => void;\n\ntype ToolCallRunningText<TArgs extends Record<string, unknown>> =\n | ReactNode\n | ((options: { args: TArgs }) => ReactNode);\n\ntype ToolCallCompleteText<TArgs extends Record<string, unknown>, TResult> =\n | ReactNode\n | ((options: { args: TArgs; result: TResult | undefined }) => ReactNode);\n\nexport type ToolCallText<TArgs extends Record<string, unknown>, TResult> =\n | {\n running: ToolCallRunningText<TArgs>;\n complete?: ToolCallCompleteText<TArgs, TResult> | undefined;\n }\n | {\n running?: ToolCallRunningText<TArgs> | undefined;\n complete: ToolCallCompleteText<TArgs, TResult>;\n };\n\nconst resolveToolCallText = <TArgs extends Record<string, unknown>, TResult>(\n text: ToolCallText<TArgs, TResult>,\n part: ToolCallMessagePartProps<TArgs, TResult>,\n): ReactNode => {\n const isRunning =\n part.status?.type === \"running\" || part.status?.type === \"requires-action\";\n\n if (!isRunning) {\n const value = text.complete;\n if (typeof value !== \"function\") return value ?? null;\n return value({ args: part.args, result: part.result });\n }\n\n const value = text.running;\n if (typeof value !== \"function\") return value ?? null;\n return value({ args: part.args });\n};\n\nexport const makeToolCallTextComponent = <\n TArgs extends Record<string, unknown>,\n TResult,\n>(\n text: ToolCallText<TArgs, TResult>,\n): ToolCallMessagePartComponent<TArgs, TResult> => {\n return function ToolCallTextComponent(part) {\n return resolveToolCallText(text, part);\n };\n};\n\n/**\n * Tool definition accepted by the React tool registry.\n *\n * Extends the core tool contract with tool-call display options. Human tools\n * rely on `render` to collect input from the user. Frontend tools execute in\n * the browser and require either `render` or `renderText` for their progress\n * and result. Backend tools execute server-side and may omit a renderer.\n */\nexport type ToolDefinition<\n TArgs extends Record<string, unknown> = Record<string, unknown>,\n TResult = unknown,\n> = WithRender<Tool<TArgs, TResult>, TArgs, TResult>;\n\n/**\n * Named collection of tools exposed to the assistant model.\n *\n * Keys are the tool names the model receives and uses in tool calls.\n *\n * @example\n * ```tsx\n * const toolkit = {\n * get_weather: {\n * type: \"frontend\",\n * description: \"Get the weather for a city.\",\n * parameters: weatherSchema,\n * execute: async ({ city }: { city: string }) => fetchWeather(city),\n * render: WeatherToolUI,\n * },\n * }
|
|
1
|
+
{"version":3,"file":"toolbox.js","names":[],"sources":["../../../src/react/model-context/toolbox.ts"],"sourcesContent":["import type {\n Tool,\n ToolCallReader,\n ToolDeclaration,\n ToolModelOutputFunction,\n} from \"assistant-stream\";\nimport type { ReactNode } from \"react\";\nimport type {\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n} from \"../types/MessagePartComponentTypes\";\n\n/**\n * Resolves whether a tool's UI should be presented standalone (outside the\n * chain-of-thought grouping), applying the type-based defaults.\n *\n * An explicit `display` wins. Otherwise `human` tools default to standalone\n * (they prompt the user), and every other tool defaults to inline (a trace of\n * what the model is doing). MCP-app tool calls are detected separately from\n * the part itself and are not resolved here.\n */\nexport const isStandaloneToolDisplay = (\n tool: Pick<Tool<any, any>, \"type\" | \"display\">,\n): boolean => {\n if (tool.display !== undefined) return tool.display === \"standalone\";\n return tool.type === \"human\";\n};\n\ntype WithRender<T, TArgs extends Record<string, unknown>, TResult> = T extends {\n type: \"frontend\" | \"human\";\n}\n ? T &\n (T extends { type: \"frontend\" }\n ?\n | { render: ToolCallMessagePartComponent<TArgs, TResult> }\n | {\n render?: ToolCallMessagePartComponent<TArgs, TResult>;\n renderText: ToolCallText<TArgs, TResult>;\n }\n : { render: ToolCallMessagePartComponent<TArgs, TResult> })\n : T & {\n render?: ToolCallMessagePartComponent<TArgs, TResult> | undefined;\n renderText?: ToolCallText<TArgs, TResult> | undefined;\n };\n\ntype ToolParameters<TArgs extends Record<string, unknown>> =\n ToolDeclaration<TArgs>[\"parameters\"];\n\n// ToolExecutionContext is not re-exported from assistant-stream's public entry.\ntype ToolExecuteContext = Parameters<\n NonNullable<ToolDeclaration[\"execute\"]>\n>[1];\n\ntype ToolExecute<TArgs extends Record<string, unknown>, TResult> = (\n args: TArgs,\n context: ToolExecuteContext,\n) => TResult | Promise<TResult>;\n\ntype ToolStreamCall<TArgs extends Record<string, unknown>, TResult> = (\n reader: ToolCallReader<TArgs, TResult>,\n context: ToolExecuteContext,\n) => void;\n\ntype ToolCallRunningText<TArgs extends Record<string, unknown>> =\n | ReactNode\n | ((options: { args: TArgs }) => ReactNode);\n\ntype ToolCallCompleteText<TArgs extends Record<string, unknown>, TResult> =\n | ReactNode\n | ((options: { args: TArgs; result: TResult | undefined }) => ReactNode);\n\nexport type ToolCallText<TArgs extends Record<string, unknown>, TResult> =\n | {\n running: ToolCallRunningText<TArgs>;\n complete?: ToolCallCompleteText<TArgs, TResult> | undefined;\n }\n | {\n running?: ToolCallRunningText<TArgs> | undefined;\n complete: ToolCallCompleteText<TArgs, TResult>;\n };\n\nconst resolveToolCallText = <TArgs extends Record<string, unknown>, TResult>(\n text: ToolCallText<TArgs, TResult>,\n part: ToolCallMessagePartProps<TArgs, TResult>,\n): ReactNode => {\n const isRunning =\n part.status?.type === \"running\" || part.status?.type === \"requires-action\";\n\n if (!isRunning) {\n const value = text.complete;\n if (typeof value !== \"function\") return value ?? null;\n return value({ args: part.args, result: part.result });\n }\n\n const value = text.running;\n if (typeof value !== \"function\") return value ?? null;\n return value({ args: part.args });\n};\n\nexport const makeToolCallTextComponent = <\n TArgs extends Record<string, unknown>,\n TResult,\n>(\n text: ToolCallText<TArgs, TResult>,\n): ToolCallMessagePartComponent<TArgs, TResult> => {\n return function ToolCallTextComponent(part) {\n return resolveToolCallText(text, part);\n };\n};\n\n/**\n * Tool definition accepted by the React tool registry.\n *\n * Extends the core tool contract with tool-call display options. Human tools\n * rely on `render` to collect input from the user. Frontend tools execute in\n * the browser and require either `render` or `renderText` for their progress\n * and result. Backend tools execute server-side and may omit a renderer.\n */\nexport type ToolDefinition<\n TArgs extends Record<string, unknown> = Record<string, unknown>,\n TResult = unknown,\n> = WithRender<Tool<TArgs, TResult>, TArgs, TResult>;\n\n/**\n * Named collection of tools exposed to the assistant model.\n *\n * Keys are the tool names the model receives and uses in tool calls.\n *\n * @example\n * ```tsx\n * const toolkit = defineToolkit({\n * get_weather: {\n * type: \"frontend\",\n * description: \"Get the weather for a city.\",\n * parameters: weatherSchema,\n * execute: async ({ city }: { city: string }) => fetchWeather(city),\n * render: WeatherToolUI,\n * },\n * });\n * ```\n */\nexport type Toolkit = Record<string, ToolDefinition<any, any>>;\n\n/**\n * A tool as authored, before the build splits it: like {@link ToolDefinition}\n * but it may declare `description`, `parameters`, and a server-side `execute`\n * alongside its `render`. The `type` field is **not** authored — the\n * `\"use generative\"` compiler infers it (`execute: humanTool()` → human;\n * `execute: providerTool(...)` → provider; `execute` with a `\"use client\"`\n * directive → frontend; otherwise backend) and writes it back — so declaring it\n * here is a type error.\n */\ntype OverrideOptionalField<\n T,\n TKey extends keyof T,\n TValue,\n> = undefined extends T[TKey]\n ? // Preserve `?: undefined` fields (for variants that explicitly disallow a\n // callback) instead of widening them to accept the override value.\n Exclude<T[TKey], undefined> extends never\n ? { [K in TKey]?: undefined }\n : { [K in TKey]?: TValue | undefined }\n : { [K in TKey]: TValue };\n\ntype OverrideToolDeclarationCallbacks<\n T extends { streamCall?: unknown },\n TArgs extends Record<string, unknown>,\n TResult,\n> = Omit<\n T,\n | \"type\"\n | \"execute\"\n | \"toModelOutput\"\n | \"experimental_onSchemaValidationError\"\n | \"streamCall\"\n> & {\n type?: never;\n} & (\"execute\" extends keyof T\n ? OverrideOptionalField<T, \"execute\", ToolExecute<NoInfer<TArgs>, TResult>>\n : {}) &\n (\"toModelOutput\" extends keyof T\n ? OverrideOptionalField<\n T,\n \"toModelOutput\",\n ToolModelOutputFunction<NoInfer<TArgs>, NoInfer<TResult>>\n >\n : {}) &\n (\"experimental_onSchemaValidationError\" extends keyof T\n ? OverrideOptionalField<\n T,\n \"experimental_onSchemaValidationError\",\n (\n args: unknown,\n context: ToolExecuteContext,\n ) => NoInfer<TResult> | Promise<NoInfer<TResult>>\n >\n : {}) &\n OverrideOptionalField<\n T,\n \"streamCall\",\n ToolStreamCall<TArgs, NoInfer<TResult>>\n >;\n\n// Keep the authored shape tied to ToolDeclaration's union variants while\n// overriding callback fields to avoid inference pollution.\ntype ToolkitDefinitionInput<\n TArgs extends Record<string, unknown>,\n TResult,\n> = WithRender<\n ToolDeclaration<TArgs, TResult> extends infer T\n ? T extends { streamCall?: unknown }\n ? OverrideToolDeclarationCallbacks<T, TArgs, TResult>\n : never\n : never,\n TArgs,\n TResult\n>;\n\n/**\n * A single entry in a {@link ToolkitDefinition}.\n *\n * Either authored inline (whose `type` the compiler infers) or an already-formed\n * {@link ToolDefinition} produced by a factory whose own build splits it across\n * targets — e.g. `new JSONGenerativeUI({ library }).present()`. The factory case\n * carries a `type`, so it can only match the {@link ToolDefinition} arm of this\n * union.\n */\nexport type ToolkitDefinitionEntry<\n TArgs extends Record<string, unknown> = Record<string, unknown>,\n TResult = unknown,\n> = ToolkitDefinitionInput<TArgs, TResult> | ToolDefinition<any, any>;\n\nexport type ToolkitDefinitionEntryWithParameters<\n TArgs extends Record<string, unknown> = Record<string, unknown>,\n TResult = unknown,\n> = ToolkitDefinitionInput<TArgs, TResult> & {\n parameters: NonNullable<ToolParameters<TArgs>>;\n};\n\n/**\n * The permissive, authoring-time counterpart to {@link Toolkit} — the input to\n * {@link defineToolkit}. Backend entries may carry their server `execute` here;\n * the canonical {@link Toolkit} keeps those fields `undefined`.\n */\nexport type ToolkitDefinition<\n TArgsByName extends {\n [K in keyof TArgsByName]: Record<string, unknown>;\n } = Record<string, any>,\n TResultByName extends { [K in keyof TArgsByName]: unknown } = {\n [K in keyof TArgsByName]: any;\n },\n> = {\n [K in keyof TArgsByName]: ToolkitDefinitionEntry<\n TArgsByName[K],\n TResultByName[K]\n >;\n};\n\n/** Configuration for the {@link Tools} resource. */\nexport type ToolsConfig = {\n /** Tools to register with model context and, when provided, message renderers. */\n toolkit: Toolkit;\n};\n"],"mappings":";;;;;;;;;;AAqBA,MAAa,2BACX,SACY;CACZ,IAAI,KAAK,YAAY,KAAA,GAAW,OAAO,KAAK,YAAY;CACxD,OAAO,KAAK,SAAS;AACvB;AAuDA,MAAM,uBACJ,MACA,SACc;CAId,IAAI,EAFF,KAAK,QAAQ,SAAS,aAAa,KAAK,QAAQ,SAAS,oBAE3C;EACd,MAAM,QAAQ,KAAK;EACnB,IAAI,OAAO,UAAU,YAAY,OAAO,SAAS;EACjD,OAAO,MAAM;GAAE,MAAM,KAAK;GAAM,QAAQ,KAAK;EAAO,CAAC;CACvD;CAEA,MAAM,QAAQ,KAAK;CACnB,IAAI,OAAO,UAAU,YAAY,OAAO,SAAS;CACjD,OAAO,MAAM,EAAE,MAAM,KAAK,KAAK,CAAC;AAClC;AAEA,MAAa,6BAIX,SACiD;CACjD,OAAO,SAAS,sBAAsB,MAAM;EAC1C,OAAO,oBAAoB,MAAM,IAAI;CACvC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAssistantContext.js","names":[],"sources":["../../../src/react/model-context/useAssistantContext.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { AssistantContextConfig } from \"../..\";\n\nexport type { AssistantContextConfig };\n\nexport const useAssistantContext = (config: AssistantContextConfig) => {\n const { getContext, disabled = false } = config;\n const aui = useAui();\n const getContextRef = useRef(getContext);\n getContextRef.current = getContext;\n\n useEffect(() => {\n if (disabled) return;\n\n return aui.modelContext().register({\n getModelContext: () => ({\n system: getContextRef.current(),\n }),\n });\n }, [aui, disabled]);\n};\n"],"mappings":";;;AAMA,MAAa,uBAAuB,WAAmC;CACrE,MAAM,EAAE,YAAY,WAAW,UAAU;CACzC,MAAM,MAAM,OAAO;CACnB,MAAM,gBAAgB,OAAO,UAAU;CACvC,cAAc,UAAU;CAExB,gBAAgB;EACd,IAAI,UAAU;EAEd,OAAO,IAAI,aAAa,
|
|
1
|
+
{"version":3,"file":"useAssistantContext.js","names":[],"sources":["../../../src/react/model-context/useAssistantContext.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { AssistantContextConfig } from \"../..\";\n\nexport type { AssistantContextConfig };\n\nexport const useAssistantContext = (config: AssistantContextConfig) => {\n const { getContext, disabled = false } = config;\n const aui = useAui();\n const getContextRef = useRef(getContext);\n getContextRef.current = getContext;\n\n useEffect(() => {\n if (disabled) return;\n\n return aui.modelContext().register({\n getModelContext: () => ({\n system: getContextRef.current(),\n }),\n });\n }, [aui, disabled]);\n};\n"],"mappings":";;;AAMA,MAAa,uBAAuB,WAAmC;CACrE,MAAM,EAAE,YAAY,WAAW,UAAU;CACzC,MAAM,MAAM,OAAO;CACnB,MAAM,gBAAgB,OAAO,UAAU;CACvC,cAAc,UAAU;CAExB,gBAAgB;EACd,IAAI,UAAU;EAEd,OAAO,IAAI,aAAa,CAAC,CAAC,SAAS,EACjC,wBAAwB,EACtB,QAAQ,cAAc,QAAQ,EAChC,GACF,CAAC;CACH,GAAG,CAAC,KAAK,QAAQ,CAAC;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAssistantDataUI.js","names":[],"sources":["../../../src/react/model-context/useAssistantDataUI.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { DataMessagePartComponent } from \"../types/MessagePartComponentTypes\";\n\n/** Props used to register a renderer for `data` message parts. */\nexport type AssistantDataUIProps<T = any> = {\n /** Data part name this renderer handles. */\n name: string;\n /** Component rendered for matching data message parts. */\n render: DataMessagePartComponent<T>;\n};\n\n/**\n * Registers a renderer for named `data` message parts while the component is\n * mounted.\n *\n * @param dataUI - Data renderer registration, or `null` to skip registration.\n */\nexport const useAssistantDataUI = (dataUI: AssistantDataUIProps | null) => {\n const aui = useAui();\n useEffect(() => {\n if (!dataUI?.name || !dataUI?.render) return undefined;\n return aui.dataRenderers().setDataUI(dataUI.name, dataUI.render);\n }, [aui, dataUI?.name, dataUI?.render]);\n};\n"],"mappings":";;;;;;;;;AAkBA,MAAa,sBAAsB,WAAwC;CACzE,MAAM,MAAM,OAAO;CACnB,gBAAgB;EACd,IAAI,CAAC,QAAQ,QAAQ,CAAC,QAAQ,QAAQ,OAAO,KAAA;EAC7C,OAAO,IAAI,cAAc,
|
|
1
|
+
{"version":3,"file":"useAssistantDataUI.js","names":[],"sources":["../../../src/react/model-context/useAssistantDataUI.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { DataMessagePartComponent } from \"../types/MessagePartComponentTypes\";\n\n/** Props used to register a renderer for `data` message parts. */\nexport type AssistantDataUIProps<T = any> = {\n /** Data part name this renderer handles. */\n name: string;\n /** Component rendered for matching data message parts. */\n render: DataMessagePartComponent<T>;\n};\n\n/**\n * Registers a renderer for named `data` message parts while the component is\n * mounted.\n *\n * @param dataUI - Data renderer registration, or `null` to skip registration.\n */\nexport const useAssistantDataUI = (dataUI: AssistantDataUIProps | null) => {\n const aui = useAui();\n useEffect(() => {\n if (!dataUI?.name || !dataUI?.render) return undefined;\n return aui.dataRenderers().setDataUI(dataUI.name, dataUI.render);\n }, [aui, dataUI?.name, dataUI?.render]);\n};\n"],"mappings":";;;;;;;;;AAkBA,MAAa,sBAAsB,WAAwC;CACzE,MAAM,MAAM,OAAO;CACnB,gBAAgB;EACd,IAAI,CAAC,QAAQ,QAAQ,CAAC,QAAQ,QAAQ,OAAO,KAAA;EAC7C,OAAO,IAAI,cAAc,CAAC,CAAC,UAAU,OAAO,MAAM,OAAO,MAAM;CACjE,GAAG;EAAC;EAAK,QAAQ;EAAM,QAAQ;CAAM,CAAC;AACxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAssistantInstructions.js","names":[],"sources":["../../../src/react/model-context/useAssistantInstructions.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { AssistantInstructionsConfig } from \"../..\";\n\nexport type { AssistantInstructionsConfig };\n\nconst getInstructions = (\n instruction: string | AssistantInstructionsConfig,\n): AssistantInstructionsConfig => {\n if (typeof instruction === \"string\") return { instruction };\n return instruction;\n};\n\nexport const useAssistantInstructions = (\n config: string | AssistantInstructionsConfig,\n) => {\n const { instruction, disabled = false } = getInstructions(config);\n const aui = useAui();\n\n useEffect(() => {\n if (disabled) return;\n\n const config = {\n system: instruction,\n };\n return aui.modelContext().register({\n getModelContext: () => config,\n });\n }, [aui, instruction, disabled]);\n};\n"],"mappings":";;;AAMA,MAAM,mBACJ,gBACgC;CAChC,IAAI,OAAO,gBAAgB,UAAU,OAAO,EAAE,YAAY;CAC1D,OAAO;AACT;AAEA,MAAa,4BACX,WACG;CACH,MAAM,EAAE,aAAa,WAAW,UAAU,gBAAgB,MAAM;CAChE,MAAM,MAAM,OAAO;CAEnB,gBAAgB;EACd,IAAI,UAAU;EAEd,MAAM,SAAS,EACb,QAAQ,YACV;EACA,OAAO,IAAI,aAAa,
|
|
1
|
+
{"version":3,"file":"useAssistantInstructions.js","names":[],"sources":["../../../src/react/model-context/useAssistantInstructions.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { AssistantInstructionsConfig } from \"../..\";\n\nexport type { AssistantInstructionsConfig };\n\nconst getInstructions = (\n instruction: string | AssistantInstructionsConfig,\n): AssistantInstructionsConfig => {\n if (typeof instruction === \"string\") return { instruction };\n return instruction;\n};\n\nexport const useAssistantInstructions = (\n config: string | AssistantInstructionsConfig,\n) => {\n const { instruction, disabled = false } = getInstructions(config);\n const aui = useAui();\n\n useEffect(() => {\n if (disabled) return;\n\n const config = {\n system: instruction,\n };\n return aui.modelContext().register({\n getModelContext: () => config,\n });\n }, [aui, instruction, disabled]);\n};\n"],"mappings":";;;AAMA,MAAM,mBACJ,gBACgC;CAChC,IAAI,OAAO,gBAAgB,UAAU,OAAO,EAAE,YAAY;CAC1D,OAAO;AACT;AAEA,MAAa,4BACX,WACG;CACH,MAAM,EAAE,aAAa,WAAW,UAAU,gBAAgB,MAAM;CAChE,MAAM,MAAM,OAAO;CAEnB,gBAAgB;EACd,IAAI,UAAU;EAEd,MAAM,SAAS,EACb,QAAQ,YACV;EACA,OAAO,IAAI,aAAa,CAAC,CAAC,SAAS,EACjC,uBAAuB,OACzB,CAAC;CACH,GAAG;EAAC;EAAK;EAAa;CAAQ,CAAC;AACjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAssistantInteractable.js","names":[],"sources":["../../../src/react/model-context/useAssistantInteractable.ts"],"sourcesContent":["import { useEffect, useId, useRef } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { InteractableStateSchema } from \"../types/scopes/interactables\";\n\nexport type AssistantInteractableProps = {\n description: string;\n stateSchema: InteractableStateSchema;\n initialState: unknown;\n id?: string;\n selected?: boolean;\n};\n\n/**\n * Registers an interactable with the AI assistant.\n *\n * This hook handles registration only. To read and write the interactable's\n * state, use {@link useInteractableState} with the returned id.\n *\n * @returns The interactable instance id.\n */\nexport const useAssistantInteractable = (\n name: string,\n config: AssistantInteractableProps,\n): string => {\n const aui = useAui();\n\n const autoId = useId().replace(/[^a-zA-Z0-9]/g, \"\");\n const id = config.id ?? autoId;\n\n const stateSchemaRef = useRef(config.stateSchema);\n stateSchemaRef.current = config.stateSchema;\n const initialStateRef = useRef(config.initialState);\n initialStateRef.current = config.initialState;\n\n useEffect(() => {\n return aui.interactables().register({\n id,\n name,\n description: config.description,\n stateSchema: stateSchemaRef.current,\n initialState: initialStateRef.current,\n selected: config.selected,\n });\n }, [aui, id, name, config.description, config.selected]);\n\n return id;\n};\n"],"mappings":";;;;;;;;;;;AAoBA,MAAa,4BACX,MACA,WACW;CACX,MAAM,MAAM,OAAO;CAEnB,MAAM,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"useAssistantInteractable.js","names":[],"sources":["../../../src/react/model-context/useAssistantInteractable.ts"],"sourcesContent":["import { useEffect, useId, useRef } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { InteractableStateSchema } from \"../types/scopes/interactables\";\n\nexport type AssistantInteractableProps = {\n description: string;\n stateSchema: InteractableStateSchema;\n initialState: unknown;\n id?: string;\n selected?: boolean;\n};\n\n/**\n * Registers an interactable with the AI assistant.\n *\n * This hook handles registration only. To read and write the interactable's\n * state, use {@link useInteractableState} with the returned id.\n *\n * @returns The interactable instance id.\n */\nexport const useAssistantInteractable = (\n name: string,\n config: AssistantInteractableProps,\n): string => {\n const aui = useAui();\n\n const autoId = useId().replace(/[^a-zA-Z0-9]/g, \"\");\n const id = config.id ?? autoId;\n\n const stateSchemaRef = useRef(config.stateSchema);\n stateSchemaRef.current = config.stateSchema;\n const initialStateRef = useRef(config.initialState);\n initialStateRef.current = config.initialState;\n\n useEffect(() => {\n return aui.interactables().register({\n id,\n name,\n description: config.description,\n stateSchema: stateSchemaRef.current,\n initialState: initialStateRef.current,\n selected: config.selected,\n });\n }, [aui, id, name, config.description, config.selected]);\n\n return id;\n};\n"],"mappings":";;;;;;;;;;;AAoBA,MAAa,4BACX,MACA,WACW;CACX,MAAM,MAAM,OAAO;CAEnB,MAAM,SAAS,MAAM,CAAC,CAAC,QAAQ,iBAAiB,EAAE;CAClD,MAAM,KAAK,OAAO,MAAM;CAExB,MAAM,iBAAiB,OAAO,OAAO,WAAW;CAChD,eAAe,UAAU,OAAO;CAChC,MAAM,kBAAkB,OAAO,OAAO,YAAY;CAClD,gBAAgB,UAAU,OAAO;CAEjC,gBAAgB;EACd,OAAO,IAAI,cAAc,CAAC,CAAC,SAAS;GAClC;GACA;GACA,aAAa,OAAO;GACpB,aAAa,eAAe;GAC5B,cAAc,gBAAgB;GAC9B,UAAU,OAAO;EACnB,CAAC;CACH,GAAG;EAAC;EAAK;EAAI;EAAM,OAAO;EAAa,OAAO;CAAQ,CAAC;CAEvD,OAAO;AACT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isStandaloneToolDisplay, makeToolCallTextComponent } from "./toolbox.js";
|
|
2
|
-
import { useEffect, useMemo } from "react";
|
|
2
|
+
import { useEffect, useMemo } from "@assistant-ui/tap/react-shim";
|
|
3
3
|
import { useAui } from "@assistant-ui/store";
|
|
4
4
|
//#region src/react/model-context/useAssistantTool.ts
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAssistantTool.js","names":[],"sources":["../../../src/react/model-context/useAssistantTool.ts"],"sourcesContent":["import { useEffect, useMemo } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { ToolCallMessagePartComponent } from \"../types/MessagePartComponentTypes\";\nimport type { AssistantToolProps as CoreAssistantToolProps } from \"../..\";\nimport {\n isStandaloneToolDisplay,\n makeToolCallTextComponent,\n type ToolCallText,\n} from \"./toolbox\";\n\n/**\n * Props used to register a tool from React.\n *\n * @deprecated Use a toolkit with `Tools({ toolkit })` and register it via\n * `useAui({ tools: Tools({ toolkit }) })` instead. See\n * https://assistant-ui.com/docs/migrations/toolkit-tools.\n */\nexport type AssistantToolProps<\n TArgs extends Record<string, unknown>,\n TResult,\n> = CoreAssistantToolProps<TArgs, TResult> & {\n /** Component used to render calls to this tool in assistant messages. */\n render?: ToolCallMessagePartComponent<TArgs, TResult> | undefined;\n /** Lightweight text rendered while a tool call is running or complete. */\n renderText?: ToolCallText<TArgs, TResult> | undefined;\n};\n\n/**\n * Registers a tool with the assistant model context while the component is\n * mounted.\n *\n * If `render` is provided, it is also installed as the renderer for matching\n * tool-call message parts. The registration is removed automatically when the\n * component unmounts or the tool definition changes.\n *\n * Pass a referentially stable tool object, such as one declared at module\n * scope or memoized with `useMemo`, to avoid re-registering on every render.\n *\n * @param tool - Tool definition and name to register.\n *\n * @deprecated Use a toolkit with `Tools({ toolkit })` and register it via\n * `useAui({ tools: Tools({ toolkit }) })` instead. See\n * https://assistant-ui.com/docs/migrations/toolkit-tools.\n *\n * @example\n * ```tsx\n * const weatherTool = {\n * toolName: \"get_weather\",\n * type: \"frontend\",\n * description: \"Get the weather for a city.\",\n * parameters: weatherSchema,\n * execute: async ({ city }: { city: string }) => fetchWeather(city),\n * render: WeatherToolUI,\n * } satisfies AssistantToolProps<{ city: string }, Weather>;\n *\n * function WeatherToolRegistration() {\n * useAssistantTool(weatherTool);\n * return null;\n * }\n * ```\n */\nexport const useAssistantTool = <\n TArgs extends Record<string, unknown>,\n TResult,\n>(\n tool: AssistantToolProps<TArgs, TResult>,\n) => {\n const aui = useAui();\n\n const standalone = isStandaloneToolDisplay(tool);\n const renderTextComponent = useMemo(\n () =>\n tool.renderText ? makeToolCallTextComponent(tool.renderText) : undefined,\n [tool.renderText],\n );\n const render = tool.render ?? renderTextComponent;\n\n useEffect(() => {\n if (!render) return undefined;\n return aui.tools().setToolUI(tool.toolName, render, { standalone });\n }, [aui, tool.toolName, render, standalone]);\n\n useEffect(() => {\n // `render`, `renderText`, and `display` are client-only presentation\n // concerns and never reach the model.\n const { toolName, render, renderText, display, ...rest } = tool;\n const context = {\n tools: {\n [toolName]: rest,\n },\n };\n return aui.modelContext().register({\n getModelContext: () => context,\n });\n }, [aui, tool]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAa,oBAIX,SACG;CACH,MAAM,MAAM,OAAO;CAEnB,MAAM,aAAa,wBAAwB,IAAI;CAC/C,MAAM,sBAAsB,cAExB,KAAK,aAAa,0BAA0B,KAAK,UAAU,IAAI,KAAA,GACjE,CAAC,KAAK,UAAU,CAClB;CACA,MAAM,SAAS,KAAK,UAAU;CAE9B,gBAAgB;EACd,IAAI,CAAC,QAAQ,OAAO,KAAA;EACpB,OAAO,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"useAssistantTool.js","names":[],"sources":["../../../src/react/model-context/useAssistantTool.ts"],"sourcesContent":["import { useEffect, useMemo } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { ToolCallMessagePartComponent } from \"../types/MessagePartComponentTypes\";\nimport type { AssistantToolProps as CoreAssistantToolProps } from \"../..\";\nimport {\n isStandaloneToolDisplay,\n makeToolCallTextComponent,\n type ToolCallText,\n} from \"./toolbox\";\n\n/**\n * Props used to register a tool from React.\n *\n * @deprecated Use a toolkit with `Tools({ toolkit })` and register it via\n * `useAui({ tools: Tools({ toolkit }) })` instead. See\n * https://assistant-ui.com/docs/migrations/toolkit-tools.\n */\nexport type AssistantToolProps<\n TArgs extends Record<string, unknown>,\n TResult,\n> = CoreAssistantToolProps<TArgs, TResult> & {\n /** Component used to render calls to this tool in assistant messages. */\n render?: ToolCallMessagePartComponent<TArgs, TResult> | undefined;\n /** Lightweight text rendered while a tool call is running or complete. */\n renderText?: ToolCallText<TArgs, TResult> | undefined;\n};\n\n/**\n * Registers a tool with the assistant model context while the component is\n * mounted.\n *\n * If `render` is provided, it is also installed as the renderer for matching\n * tool-call message parts. The registration is removed automatically when the\n * component unmounts or the tool definition changes.\n *\n * Pass a referentially stable tool object, such as one declared at module\n * scope or memoized with `useMemo`, to avoid re-registering on every render.\n *\n * @param tool - Tool definition and name to register.\n *\n * @deprecated Use a toolkit with `Tools({ toolkit })` and register it via\n * `useAui({ tools: Tools({ toolkit }) })` instead. See\n * https://assistant-ui.com/docs/migrations/toolkit-tools.\n *\n * @example\n * ```tsx\n * const weatherTool = {\n * toolName: \"get_weather\",\n * type: \"frontend\",\n * description: \"Get the weather for a city.\",\n * parameters: weatherSchema,\n * execute: async ({ city }: { city: string }) => fetchWeather(city),\n * render: WeatherToolUI,\n * } satisfies AssistantToolProps<{ city: string }, Weather>;\n *\n * function WeatherToolRegistration() {\n * useAssistantTool(weatherTool);\n * return null;\n * }\n * ```\n */\nexport const useAssistantTool = <\n TArgs extends Record<string, unknown>,\n TResult,\n>(\n tool: AssistantToolProps<TArgs, TResult>,\n) => {\n const aui = useAui();\n\n const standalone = isStandaloneToolDisplay(tool);\n const renderTextComponent = useMemo(\n () =>\n tool.renderText ? makeToolCallTextComponent(tool.renderText) : undefined,\n [tool.renderText],\n );\n const render = tool.render ?? renderTextComponent;\n\n useEffect(() => {\n if (!render) return undefined;\n return aui.tools().setToolUI(tool.toolName, render, { standalone });\n }, [aui, tool.toolName, render, standalone]);\n\n useEffect(() => {\n // `render`, `renderText`, and `display` are client-only presentation\n // concerns and never reach the model.\n const { toolName, render, renderText, display, ...rest } = tool;\n const context = {\n tools: {\n [toolName]: rest,\n },\n };\n return aui.modelContext().register({\n getModelContext: () => context,\n });\n }, [aui, tool]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAa,oBAIX,SACG;CACH,MAAM,MAAM,OAAO;CAEnB,MAAM,aAAa,wBAAwB,IAAI;CAC/C,MAAM,sBAAsB,cAExB,KAAK,aAAa,0BAA0B,KAAK,UAAU,IAAI,KAAA,GACjE,CAAC,KAAK,UAAU,CAClB;CACA,MAAM,SAAS,KAAK,UAAU;CAE9B,gBAAgB;EACd,IAAI,CAAC,QAAQ,OAAO,KAAA;EACpB,OAAO,IAAI,MAAM,CAAC,CAAC,UAAU,KAAK,UAAU,QAAQ,EAAE,WAAW,CAAC;CACpE,GAAG;EAAC;EAAK,KAAK;EAAU;EAAQ;CAAU,CAAC;CAE3C,gBAAgB;EAGd,MAAM,EAAE,UAAU,QAAQ,YAAY,SAAS,GAAG,SAAS;EAC3D,MAAM,UAAU,EACd,OAAO,GACJ,WAAW,KACd,EACF;EACA,OAAO,IAAI,aAAa,CAAC,CAAC,SAAS,EACjC,uBAAuB,QACzB,CAAC;CACH,GAAG,CAAC,KAAK,IAAI,CAAC;AAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAssistantToolUI.js","names":[],"sources":["../../../src/react/model-context/useAssistantToolUI.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { ToolCallMessagePartComponent } from \"../types/MessagePartComponentTypes\";\n\n/**\n * Props used to register a renderer for tool-call message parts.\n *\n * @deprecated Put `render`/`renderText` on the matching toolkit entry, or use\n * `MessagePrimitive.Parts` inline tool render overrides for per-message UI.\n * See https://assistant-ui.com/docs/migrations/toolkit-tools.\n */\nexport type AssistantToolUIProps<TArgs, TResult> = {\n /** Name of the tool whose calls should use this renderer. */\n toolName: string;\n /** Component rendered for matching tool-call message parts. */\n render: ToolCallMessagePartComponent<TArgs, TResult>;\n /**\n * How the UI is presented relative to the chain-of-thought trace. Set\n * `\"standalone\"` to surface it on its own (e.g. human-in-the-loop or\n * generative UI for a backend/MCP tool). Defaults to `\"inline\"`.\n */\n display?: \"standalone\" | \"inline\";\n};\n\n/**\n * Registers a tool-call renderer while the component is mounted.\n *\n * This only affects rendering. Pair it with {@link Tools} or a backend tool\n * registry to expose the actual tool definition to the model.\n *\n * @param tool - Tool renderer registration, or `null` to skip registration.\n *\n * @deprecated Put `render`/`renderText` on the matching toolkit entry, or use\n * `MessagePrimitive.Parts` inline tool render overrides for per-message UI.\n * See https://assistant-ui.com/docs/migrations/toolkit-tools.\n */\nexport const useAssistantToolUI = (\n tool: AssistantToolUIProps<any, any> | null,\n) => {\n const aui = useAui();\n const standalone = tool?.display === \"standalone\";\n useEffect(() => {\n if (!tool?.toolName || !tool?.render) return undefined;\n return aui.tools().setToolUI(tool.toolName, tool.render, { standalone });\n }, [aui, tool?.toolName, tool?.render, standalone]);\n};\n"],"mappings":";;;;;;;;;;;;;;;AAoCA,MAAa,sBACX,SACG;CACH,MAAM,MAAM,OAAO;CACnB,MAAM,aAAa,MAAM,YAAY;CACrC,gBAAgB;EACd,IAAI,CAAC,MAAM,YAAY,CAAC,MAAM,QAAQ,OAAO,KAAA;EAC7C,OAAO,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"useAssistantToolUI.js","names":[],"sources":["../../../src/react/model-context/useAssistantToolUI.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { ToolCallMessagePartComponent } from \"../types/MessagePartComponentTypes\";\n\n/**\n * Props used to register a renderer for tool-call message parts.\n *\n * @deprecated Put `render`/`renderText` on the matching toolkit entry, or use\n * `MessagePrimitive.Parts` inline tool render overrides for per-message UI.\n * See https://assistant-ui.com/docs/migrations/toolkit-tools.\n */\nexport type AssistantToolUIProps<TArgs, TResult> = {\n /** Name of the tool whose calls should use this renderer. */\n toolName: string;\n /** Component rendered for matching tool-call message parts. */\n render: ToolCallMessagePartComponent<TArgs, TResult>;\n /**\n * How the UI is presented relative to the chain-of-thought trace. Set\n * `\"standalone\"` to surface it on its own (e.g. human-in-the-loop or\n * generative UI for a backend/MCP tool). Defaults to `\"inline\"`.\n */\n display?: \"standalone\" | \"inline\";\n};\n\n/**\n * Registers a tool-call renderer while the component is mounted.\n *\n * This only affects rendering. Pair it with {@link Tools} or a backend tool\n * registry to expose the actual tool definition to the model.\n *\n * @param tool - Tool renderer registration, or `null` to skip registration.\n *\n * @deprecated Put `render`/`renderText` on the matching toolkit entry, or use\n * `MessagePrimitive.Parts` inline tool render overrides for per-message UI.\n * See https://assistant-ui.com/docs/migrations/toolkit-tools.\n */\nexport const useAssistantToolUI = (\n tool: AssistantToolUIProps<any, any> | null,\n) => {\n const aui = useAui();\n const standalone = tool?.display === \"standalone\";\n useEffect(() => {\n if (!tool?.toolName || !tool?.render) return undefined;\n return aui.tools().setToolUI(tool.toolName, tool.render, { standalone });\n }, [aui, tool?.toolName, tool?.render, standalone]);\n};\n"],"mappings":";;;;;;;;;;;;;;;AAoCA,MAAa,sBACX,SACG;CACH,MAAM,MAAM,OAAO;CACnB,MAAM,aAAa,MAAM,YAAY;CACrC,gBAAgB;EACd,IAAI,CAAC,MAAM,YAAY,CAAC,MAAM,QAAQ,OAAO,KAAA;EAC7C,OAAO,IAAI,MAAM,CAAC,CAAC,UAAU,KAAK,UAAU,KAAK,QAAQ,EAAE,WAAW,CAAC;CACzE,GAAG;EAAC;EAAK,MAAM;EAAU,MAAM;EAAQ;CAAU,CAAC;AACpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuiToolOverrides.js","names":[],"sources":["../../../src/react/model-context/useAuiToolOverrides.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { Tool } from \"assistant-stream\";\n\ntype AuiToolOverride<\n TArgs extends Record<string, unknown> = Record<string, unknown>,\n TResult = unknown,\n> = Partial<Tool<TArgs, TResult>>;\n\ntype AuiToolOverrides = Record<string, AuiToolOverride<any, any>>;\n\n/**\n * Overrides toolkit entries for the current assistant scope.\n *\n * This is intended for dynamic local-state tools whose model-facing contract is\n * declared in a `\"use generative\"` toolkit file with `execute: stubTool()`, but\n * whose actual executor must close over React state in the mounted component.\n * Keep the override keys stable after mount; dynamic key addition/removal is not\n * currently observed.\n * Overrides are registered at priority 1000, above toolkit defaults. Only one\n * mounted override provider may define a given tool name at a time.\n *\n * @deprecated Experimental, API may change.\n */\nexport function useAuiToolOverrides(overrides: AuiToolOverrides): void {\n const aui = useAui();\n const overridesRef = useRef(overrides);\n overridesRef.current = overrides;\n\n useEffect(() => {\n return aui.modelContext().register({\n getModelContext: () => ({\n priority: 1000,\n tools: overridesRef.current as Record<string, Tool<any, any>>,\n }),\n });\n }, [aui]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,SAAgB,oBAAoB,WAAmC;CACrE,MAAM,MAAM,OAAO;CACnB,MAAM,eAAe,OAAO,SAAS;CACrC,aAAa,UAAU;CAEvB,gBAAgB;EACd,OAAO,IAAI,aAAa,
|
|
1
|
+
{"version":3,"file":"useAuiToolOverrides.js","names":[],"sources":["../../../src/react/model-context/useAuiToolOverrides.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { Tool } from \"assistant-stream\";\n\ntype AuiToolOverride<\n TArgs extends Record<string, unknown> = Record<string, unknown>,\n TResult = unknown,\n> = Partial<Tool<TArgs, TResult>>;\n\ntype AuiToolOverrides = Record<string, AuiToolOverride<any, any>>;\n\n/**\n * Overrides toolkit entries for the current assistant scope.\n *\n * This is intended for dynamic local-state tools whose model-facing contract is\n * declared in a `\"use generative\"` toolkit file with `execute: stubTool()`, but\n * whose actual executor must close over React state in the mounted component.\n * Keep the override keys stable after mount; dynamic key addition/removal is not\n * currently observed.\n * Overrides are registered at priority 1000, above toolkit defaults. Only one\n * mounted override provider may define a given tool name at a time.\n *\n * @deprecated Experimental, API may change.\n */\nexport function useAuiToolOverrides(overrides: AuiToolOverrides): void {\n const aui = useAui();\n const overridesRef = useRef(overrides);\n overridesRef.current = overrides;\n\n useEffect(() => {\n return aui.modelContext().register({\n getModelContext: () => ({\n priority: 1000,\n tools: overridesRef.current as Record<string, Tool<any, any>>,\n }),\n });\n }, [aui]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,SAAgB,oBAAoB,WAAmC;CACrE,MAAM,MAAM,OAAO;CACnB,MAAM,eAAe,OAAO,SAAS;CACrC,aAAa,UAAU;CAEvB,gBAAgB;EACd,OAAO,IAAI,aAAa,CAAC,CAAC,SAAS,EACjC,wBAAwB;GACtB,UAAU;GACV,OAAO,aAAa;EACtB,GACF,CAAC;CACH,GAAG,CAAC,GAAG,CAAC;AACV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInlineRender.js","names":[],"sources":["../../../src/react/model-context/useInlineRender.ts"],"sourcesContent":["import { type FC, useCallback, useEffect, useState } from \"react\";\nimport type { ToolCallMessagePartProps } from \"../types/MessagePartComponentTypes\";\nimport { create } from \"zustand\";\n\nexport const useInlineRender = <TArgs, TResult>(\n toolUI: FC<ToolCallMessagePartProps<TArgs, TResult>>,\n): FC<ToolCallMessagePartProps<TArgs, TResult>> => {\n const [useToolUIStore] = useState(() =>\n create(() => ({\n toolUI,\n })),\n );\n\n useEffect(() => {\n useToolUIStore.setState({ toolUI });\n }, [toolUI, useToolUIStore]);\n\n return useCallback(\n function ToolUI(args) {\n const store = useToolUIStore();\n return store.toolUI(args);\n },\n [useToolUIStore],\n );\n};\n"],"mappings":";;;AAIA,MAAa,mBACX,WACiD;CACjD,MAAM,CAAC,kBAAkB,eACvB,cAAc,EACZ,OACF,EAAE,CACJ;CAEA,gBAAgB;EACd,eAAe,SAAS,EAAE,OAAO,CAAC;CACpC,GAAG,CAAC,QAAQ,cAAc,CAAC;CAE3B,OAAO,YACL,SAAS,OAAO,MAAM;EAEpB,OADc,eACH,
|
|
1
|
+
{"version":3,"file":"useInlineRender.js","names":[],"sources":["../../../src/react/model-context/useInlineRender.ts"],"sourcesContent":["import { type FC, useCallback, useEffect, useState } from \"react\";\nimport type { ToolCallMessagePartProps } from \"../types/MessagePartComponentTypes\";\nimport { create } from \"zustand\";\n\nexport const useInlineRender = <TArgs, TResult>(\n toolUI: FC<ToolCallMessagePartProps<TArgs, TResult>>,\n): FC<ToolCallMessagePartProps<TArgs, TResult>> => {\n const [useToolUIStore] = useState(() =>\n create(() => ({\n toolUI,\n })),\n );\n\n useEffect(() => {\n useToolUIStore.setState({ toolUI });\n }, [toolUI, useToolUIStore]);\n\n return useCallback(\n function ToolUI(args) {\n const store = useToolUIStore();\n return store.toolUI(args);\n },\n [useToolUIStore],\n );\n};\n"],"mappings":";;;AAIA,MAAa,mBACX,WACiD;CACjD,MAAM,CAAC,kBAAkB,eACvB,cAAc,EACZ,OACF,EAAE,CACJ;CAEA,gBAAgB;EACd,eAAe,SAAS,EAAE,OAAO,CAAC;CACpC,GAAG,CAAC,QAAQ,cAAc,CAAC;CAE3B,OAAO,YACL,SAAS,OAAO,MAAM;EAEpB,OADc,eACH,CAAC,CAAC,OAAO,IAAI;CAC1B,GACA,CAAC,cAAc,CACjB;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInteractableState.js","names":[],"sources":["../../../src/react/model-context/useInteractableState.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\ntype StateUpdater<TState> = TState | ((prev: TState) => TState);\n\n/**\n * Reads and writes the state of a registered interactable.\n *\n * Pair with {@link useAssistantInteractable} which handles registration.\n */\nexport const useInteractableState = <TState>(\n id: string,\n fallback: TState,\n): [\n TState,\n {\n setState: (updater: StateUpdater<TState>) => void;\n setSelected: (selected: boolean) => void;\n isPending: boolean;\n error: unknown;\n flush: () => Promise<void>;\n },\n] => {\n const aui = useAui();\n\n const state =\n (useAuiState((s) => s.interactables.definitions[id]?.state) as TState) ??\n (fallback as TState);\n\n const persistenceStatus = useAuiState((s) => s.interactables.persistence[id]);\n\n const setState = useCallback(\n (updater: StateUpdater<TState>) => {\n aui.interactables().setState(id, (prev) => {\n if (typeof updater === \"function\") {\n return (updater as (prev: TState) => TState)(prev as TState);\n }\n return updater;\n });\n },\n [aui, id],\n );\n\n const setSelected = useCallback(\n (selected: boolean) => {\n aui.interactables().setSelected(id, selected);\n },\n [aui, id],\n );\n\n const flush = useCallback(() => aui.interactables().flush(), [aui]);\n\n return [\n state,\n {\n setState,\n setSelected,\n isPending: persistenceStatus?.isPending ?? false,\n error: persistenceStatus?.error,\n flush,\n },\n ];\n};\n"],"mappings":";;;;;;;;AAUA,MAAa,wBACX,IACA,aAUG;CACH,MAAM,MAAM,OAAO;CAEnB,MAAM,QACH,aAAa,MAAM,EAAE,cAAc,YAAY,
|
|
1
|
+
{"version":3,"file":"useInteractableState.js","names":[],"sources":["../../../src/react/model-context/useInteractableState.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\ntype StateUpdater<TState> = TState | ((prev: TState) => TState);\n\n/**\n * Reads and writes the state of a registered interactable.\n *\n * Pair with {@link useAssistantInteractable} which handles registration.\n */\nexport const useInteractableState = <TState>(\n id: string,\n fallback: TState,\n): [\n TState,\n {\n setState: (updater: StateUpdater<TState>) => void;\n setSelected: (selected: boolean) => void;\n isPending: boolean;\n error: unknown;\n flush: () => Promise<void>;\n },\n] => {\n const aui = useAui();\n\n const state =\n (useAuiState((s) => s.interactables.definitions[id]?.state) as TState) ??\n (fallback as TState);\n\n const persistenceStatus = useAuiState((s) => s.interactables.persistence[id]);\n\n const setState = useCallback(\n (updater: StateUpdater<TState>) => {\n aui.interactables().setState(id, (prev) => {\n if (typeof updater === \"function\") {\n return (updater as (prev: TState) => TState)(prev as TState);\n }\n return updater;\n });\n },\n [aui, id],\n );\n\n const setSelected = useCallback(\n (selected: boolean) => {\n aui.interactables().setSelected(id, selected);\n },\n [aui, id],\n );\n\n const flush = useCallback(() => aui.interactables().flush(), [aui]);\n\n return [\n state,\n {\n setState,\n setSelected,\n isPending: persistenceStatus?.isPending ?? false,\n error: persistenceStatus?.error,\n flush,\n },\n ];\n};\n"],"mappings":";;;;;;;;AAUA,MAAa,wBACX,IACA,aAUG;CACH,MAAM,MAAM,OAAO;CAEnB,MAAM,QACH,aAAa,MAAM,EAAE,cAAc,YAAY,GAAG,EAAE,KAAK,KACzD;CAEH,MAAM,oBAAoB,aAAa,MAAM,EAAE,cAAc,YAAY,GAAG;CAE5E,MAAM,WAAW,aACd,YAAkC;EACjC,IAAI,cAAc,CAAC,CAAC,SAAS,KAAK,SAAS;GACzC,IAAI,OAAO,YAAY,YACrB,OAAQ,QAAqC,IAAc;GAE7D,OAAO;EACT,CAAC;CACH,GACA,CAAC,KAAK,EAAE,CACV;CAEA,MAAM,cAAc,aACjB,aAAsB;EACrB,IAAI,cAAc,CAAC,CAAC,YAAY,IAAI,QAAQ;CAC9C,GACA,CAAC,KAAK,EAAE,CACV;CAEA,MAAM,QAAQ,kBAAkB,IAAI,cAAc,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC;CAElE,OAAO,CACL,OACA;EACE;EACA;EACA,WAAW,mBAAmB,aAAa;EAC3C,OAAO,mBAAmB;EAC1B;CACF,CACF;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getPartialJsonObjectFieldState, getPartialJsonObjectMeta } from "assistant-stream/utils";
|
|
2
|
-
import { useMemo } from "react";
|
|
2
|
+
import { useMemo } from "@assistant-ui/tap/react-shim";
|
|
3
3
|
import { useAuiState } from "@assistant-ui/store";
|
|
4
4
|
//#region src/react/model-context/useToolArgsStatus.ts
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
1
|
+
import { useCallback } from "@assistant-ui/tap/react-shim";
|
|
2
2
|
import { useAui, useAuiState } from "@assistant-ui/store";
|
|
3
3
|
//#region src/react/primitive-hooks/useActionBarCopy.ts
|
|
4
4
|
const useActionBarCopy = ({ copiedDuration = 3e3, copyToClipboard } = {}) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActionBarCopy.js","names":[],"sources":["../../../src/react/primitive-hooks/useActionBarCopy.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport type UseActionBarCopyOptions = {\n copiedDuration?: number | undefined;\n copyToClipboard?: ((text: string) => void | Promise<void>) | undefined;\n};\n\nexport const useActionBarCopy = ({\n copiedDuration = 3000,\n copyToClipboard,\n}: UseActionBarCopyOptions = {}) => {\n const aui = useAui();\n const disabled = useAuiState((s) => {\n return !(\n (s.message.role !== \"assistant\" ||\n s.message.status?.type !== \"running\") &&\n s.message.parts.some((c) => c.type === \"text\" && c.text.length > 0)\n );\n });\n const isCopied = useAuiState((s) => s.message.isCopied);\n const isEditing = useAuiState((s) => s.composer.isEditing);\n const composerValue = useAuiState((s) => s.composer.text);\n\n const copy = useCallback(() => {\n const valueToCopy = isEditing ? composerValue : aui.message().getCopyText();\n if (!valueToCopy) return;\n\n const write = copyToClipboard ?? (() => {});\n // The rejection handler swallows clipboard write failures (permission denied,\n // API unavailable) so they don't surface as unhandled promise rejections.\n Promise.resolve(write(valueToCopy)).then(\n () => {\n aui.message().setIsCopied(true);\n setTimeout(() => aui.message().setIsCopied(false), copiedDuration);\n },\n () => {},\n );\n }, [aui, isEditing, composerValue, copiedDuration, copyToClipboard]);\n\n return { copy, disabled, isCopied };\n};\n"],"mappings":";;;AAQA,MAAa,oBAAoB,EAC/B,iBAAiB,KACjB,oBAC2B,CAAC,MAAM;CAClC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM;EAClC,OAAO,GACJ,EAAE,QAAQ,SAAS,eAClB,EAAE,QAAQ,QAAQ,SAAS,cAC7B,EAAE,QAAQ,MAAM,MAAM,MAAM,EAAE,SAAS,UAAU,EAAE,KAAK,SAAS,CAAC;CAEtE,CAAC;CACD,MAAM,WAAW,aAAa,MAAM,EAAE,QAAQ,QAAQ;CACtD,MAAM,YAAY,aAAa,MAAM,EAAE,SAAS,SAAS;CACzD,MAAM,gBAAgB,aAAa,MAAM,EAAE,SAAS,IAAI;CAkBxD,OAAO;EAAE,MAhBI,kBAAkB;GAC7B,MAAM,cAAc,YAAY,gBAAgB,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"useActionBarCopy.js","names":[],"sources":["../../../src/react/primitive-hooks/useActionBarCopy.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport type UseActionBarCopyOptions = {\n copiedDuration?: number | undefined;\n copyToClipboard?: ((text: string) => void | Promise<void>) | undefined;\n};\n\nexport const useActionBarCopy = ({\n copiedDuration = 3000,\n copyToClipboard,\n}: UseActionBarCopyOptions = {}) => {\n const aui = useAui();\n const disabled = useAuiState((s) => {\n return !(\n (s.message.role !== \"assistant\" ||\n s.message.status?.type !== \"running\") &&\n s.message.parts.some((c) => c.type === \"text\" && c.text.length > 0)\n );\n });\n const isCopied = useAuiState((s) => s.message.isCopied);\n const isEditing = useAuiState((s) => s.composer.isEditing);\n const composerValue = useAuiState((s) => s.composer.text);\n\n const copy = useCallback(() => {\n const valueToCopy = isEditing ? composerValue : aui.message().getCopyText();\n if (!valueToCopy) return;\n\n const write = copyToClipboard ?? (() => {});\n // The rejection handler swallows clipboard write failures (permission denied,\n // API unavailable) so they don't surface as unhandled promise rejections.\n Promise.resolve(write(valueToCopy)).then(\n () => {\n aui.message().setIsCopied(true);\n setTimeout(() => aui.message().setIsCopied(false), copiedDuration);\n },\n () => {},\n );\n }, [aui, isEditing, composerValue, copiedDuration, copyToClipboard]);\n\n return { copy, disabled, isCopied };\n};\n"],"mappings":";;;AAQA,MAAa,oBAAoB,EAC/B,iBAAiB,KACjB,oBAC2B,CAAC,MAAM;CAClC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM;EAClC,OAAO,GACJ,EAAE,QAAQ,SAAS,eAClB,EAAE,QAAQ,QAAQ,SAAS,cAC7B,EAAE,QAAQ,MAAM,MAAM,MAAM,EAAE,SAAS,UAAU,EAAE,KAAK,SAAS,CAAC;CAEtE,CAAC;CACD,MAAM,WAAW,aAAa,MAAM,EAAE,QAAQ,QAAQ;CACtD,MAAM,YAAY,aAAa,MAAM,EAAE,SAAS,SAAS;CACzD,MAAM,gBAAgB,aAAa,MAAM,EAAE,SAAS,IAAI;CAkBxD,OAAO;EAAE,MAhBI,kBAAkB;GAC7B,MAAM,cAAc,YAAY,gBAAgB,IAAI,QAAQ,CAAC,CAAC,YAAY;GAC1E,IAAI,CAAC,aAAa;GAElB,MAAM,QAAQ,0BAA0B,CAAC;GAGzC,QAAQ,QAAQ,MAAM,WAAW,CAAC,CAAC,CAAC,WAC5B;IACJ,IAAI,QAAQ,CAAC,CAAC,YAAY,IAAI;IAC9B,iBAAiB,IAAI,QAAQ,CAAC,CAAC,YAAY,KAAK,GAAG,cAAc;GACnE,SACM,CAAC,CACT;EACF,GAAG;GAAC;GAAK;GAAW;GAAe;GAAgB;EAAe,CAEtD;EAAG;EAAU;CAAS;AACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActionBarEdit.js","names":[],"sources":["../../../src/react/primitive-hooks/useActionBarEdit.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useActionBarEdit = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => s.composer.isEditing);\n\n const edit = useCallback(() => {\n aui.composer().beginEdit();\n }, [aui]);\n\n return { edit, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,yBAAyB;CACpC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM,EAAE,SAAS,SAAS;CAMxD,OAAO;EAAE,MAJI,kBAAkB;GAC7B,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"useActionBarEdit.js","names":[],"sources":["../../../src/react/primitive-hooks/useActionBarEdit.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useActionBarEdit = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => s.composer.isEditing);\n\n const edit = useCallback(() => {\n aui.composer().beginEdit();\n }, [aui]);\n\n return { edit, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,yBAAyB;CACpC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM,EAAE,SAAS,SAAS;CAMxD,OAAO;EAAE,MAJI,kBAAkB;GAC7B,IAAI,SAAS,CAAC,CAAC,UAAU;EAC3B,GAAG,CAAC,GAAG,CAEK;EAAG;CAAS;AAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActionBarFeedback.js","names":[],"sources":["../../../src/react/primitive-hooks/useActionBarFeedback.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useActionBarFeedbackPositive = () => {\n const aui = useAui();\n const isSubmitted = useAuiState(\n (s) => s.message.metadata.submittedFeedback?.type === \"positive\",\n );\n\n const submit = useCallback(() => {\n aui.message().submitFeedback({ type: \"positive\" });\n }, [aui]);\n\n return { submit, isSubmitted };\n};\n\nexport const useActionBarFeedbackNegative = () => {\n const aui = useAui();\n const isSubmitted = useAuiState(\n (s) => s.message.metadata.submittedFeedback?.type === \"negative\",\n );\n\n const submit = useCallback(() => {\n aui.message().submitFeedback({ type: \"negative\" });\n }, [aui]);\n\n return { submit, isSubmitted };\n};\n"],"mappings":";;;AAGA,MAAa,qCAAqC;CAChD,MAAM,MAAM,OAAO;CACnB,MAAM,cAAc,aACjB,MAAM,EAAE,QAAQ,SAAS,mBAAmB,SAAS,UACxD;CAMA,OAAO;EAAE,QAJM,kBAAkB;GAC/B,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"useActionBarFeedback.js","names":[],"sources":["../../../src/react/primitive-hooks/useActionBarFeedback.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useActionBarFeedbackPositive = () => {\n const aui = useAui();\n const isSubmitted = useAuiState(\n (s) => s.message.metadata.submittedFeedback?.type === \"positive\",\n );\n\n const submit = useCallback(() => {\n aui.message().submitFeedback({ type: \"positive\" });\n }, [aui]);\n\n return { submit, isSubmitted };\n};\n\nexport const useActionBarFeedbackNegative = () => {\n const aui = useAui();\n const isSubmitted = useAuiState(\n (s) => s.message.metadata.submittedFeedback?.type === \"negative\",\n );\n\n const submit = useCallback(() => {\n aui.message().submitFeedback({ type: \"negative\" });\n }, [aui]);\n\n return { submit, isSubmitted };\n};\n"],"mappings":";;;AAGA,MAAa,qCAAqC;CAChD,MAAM,MAAM,OAAO;CACnB,MAAM,cAAc,aACjB,MAAM,EAAE,QAAQ,SAAS,mBAAmB,SAAS,UACxD;CAMA,OAAO;EAAE,QAJM,kBAAkB;GAC/B,IAAI,QAAQ,CAAC,CAAC,eAAe,EAAE,MAAM,WAAW,CAAC;EACnD,GAAG,CAAC,GAAG,CAEO;EAAG;CAAY;AAC/B;AAEA,MAAa,qCAAqC;CAChD,MAAM,MAAM,OAAO;CACnB,MAAM,cAAc,aACjB,MAAM,EAAE,QAAQ,SAAS,mBAAmB,SAAS,UACxD;CAMA,OAAO;EAAE,QAJM,kBAAkB;GAC/B,IAAI,QAAQ,CAAC,CAAC,eAAe,EAAE,MAAM,WAAW,CAAC;EACnD,GAAG,CAAC,GAAG,CAEO;EAAG;CAAY;AAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActionBarReload.js","names":[],"sources":["../../../src/react/primitive-hooks/useActionBarReload.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useActionBarReload = () => {\n const aui = useAui();\n const disabled = useAuiState(\n (s) =>\n s.thread.isRunning ||\n s.thread.isDisabled ||\n s.message.role !== \"assistant\",\n );\n\n const reload = useCallback(() => {\n aui.message().reload();\n }, [aui]);\n\n return { reload, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,2BAA2B;CACtC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aACd,MACC,EAAE,OAAO,aACT,EAAE,OAAO,cACT,EAAE,QAAQ,SAAS,WACvB;CAMA,OAAO;EAAE,QAJM,kBAAkB;GAC/B,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"useActionBarReload.js","names":[],"sources":["../../../src/react/primitive-hooks/useActionBarReload.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useActionBarReload = () => {\n const aui = useAui();\n const disabled = useAuiState(\n (s) =>\n s.thread.isRunning ||\n s.thread.isDisabled ||\n s.message.role !== \"assistant\",\n );\n\n const reload = useCallback(() => {\n aui.message().reload();\n }, [aui]);\n\n return { reload, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,2BAA2B;CACtC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aACd,MACC,EAAE,OAAO,aACT,EAAE,OAAO,cACT,EAAE,QAAQ,SAAS,WACvB;CAMA,OAAO;EAAE,QAJM,kBAAkB;GAC/B,IAAI,QAAQ,CAAC,CAAC,OAAO;EACvB,GAAG,CAAC,GAAG,CAEO;EAAG;CAAS;AAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActionBarSpeak.js","names":[],"sources":["../../../src/react/primitive-hooks/useActionBarSpeak.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useActionBarSpeak = () => {\n const aui = useAui();\n\n const disabled = useAuiState((s) => {\n return !(\n (s.message.role !== \"assistant\" ||\n s.message.status?.type !== \"running\") &&\n s.message.parts.some((c) => c.type === \"text\" && c.text.length > 0)\n );\n });\n\n const speak = useCallback(async () => {\n aui.message().speak();\n }, [aui]);\n\n return { speak, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,0BAA0B;CACrC,MAAM,MAAM,OAAO;CAEnB,MAAM,WAAW,aAAa,MAAM;EAClC,OAAO,GACJ,EAAE,QAAQ,SAAS,eAClB,EAAE,QAAQ,QAAQ,SAAS,cAC7B,EAAE,QAAQ,MAAM,MAAM,MAAM,EAAE,SAAS,UAAU,EAAE,KAAK,SAAS,CAAC;CAEtE,CAAC;CAMD,OAAO;EAAE,OAJK,YAAY,YAAY;GACpC,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"useActionBarSpeak.js","names":[],"sources":["../../../src/react/primitive-hooks/useActionBarSpeak.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useActionBarSpeak = () => {\n const aui = useAui();\n\n const disabled = useAuiState((s) => {\n return !(\n (s.message.role !== \"assistant\" ||\n s.message.status?.type !== \"running\") &&\n s.message.parts.some((c) => c.type === \"text\" && c.text.length > 0)\n );\n });\n\n const speak = useCallback(async () => {\n aui.message().speak();\n }, [aui]);\n\n return { speak, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,0BAA0B;CACrC,MAAM,MAAM,OAAO;CAEnB,MAAM,WAAW,aAAa,MAAM;EAClC,OAAO,GACJ,EAAE,QAAQ,SAAS,eAClB,EAAE,QAAQ,QAAQ,SAAS,cAC7B,EAAE,QAAQ,MAAM,MAAM,MAAM,EAAE,SAAS,UAAU,EAAE,KAAK,SAAS,CAAC;CAEtE,CAAC;CAMD,OAAO;EAAE,OAJK,YAAY,YAAY;GACpC,IAAI,QAAQ,CAAC,CAAC,MAAM;EACtB,GAAG,CAAC,GAAG,CAEM;EAAG;CAAS;AAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActionBarStopSpeaking.js","names":[],"sources":["../../../src/react/primitive-hooks/useActionBarStopSpeaking.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useActionBarStopSpeaking = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => s.message.speech == null);\n\n const stopSpeaking = useCallback(() => {\n aui.message().stopSpeaking();\n }, [aui]);\n\n return { stopSpeaking, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,iCAAiC;CAC5C,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM,EAAE,QAAQ,UAAU,IAAI;CAM5D,OAAO;EAAE,cAJY,kBAAkB;GACrC,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"useActionBarStopSpeaking.js","names":[],"sources":["../../../src/react/primitive-hooks/useActionBarStopSpeaking.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useActionBarStopSpeaking = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => s.message.speech == null);\n\n const stopSpeaking = useCallback(() => {\n aui.message().stopSpeaking();\n }, [aui]);\n\n return { stopSpeaking, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,iCAAiC;CAC5C,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM,EAAE,QAAQ,UAAU,IAAI;CAM5D,OAAO;EAAE,cAJY,kBAAkB;GACrC,IAAI,QAAQ,CAAC,CAAC,aAAa;EAC7B,GAAG,CAAC,GAAG,CAEa;EAAG;CAAS;AAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBranchPickerNext.js","names":[],"sources":["../../../src/react/primitive-hooks/useBranchPickerNext.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useBranchPickerNext = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => {\n if (s.message.branchNumber >= s.message.branchCount) return true;\n if (s.thread.isRunning && !s.thread.capabilities.switchBranchDuringRun) {\n return true;\n }\n return false;\n });\n\n const next = useCallback(() => {\n aui.message().switchToBranch({ position: \"next\" });\n }, [aui]);\n\n return { next, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,4BAA4B;CACvC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM;EAClC,IAAI,EAAE,QAAQ,gBAAgB,EAAE,QAAQ,aAAa,OAAO;EAC5D,IAAI,EAAE,OAAO,aAAa,CAAC,EAAE,OAAO,aAAa,uBAC/C,OAAO;EAET,OAAO;CACT,CAAC;CAMD,OAAO;EAAE,MAJI,kBAAkB;GAC7B,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"useBranchPickerNext.js","names":[],"sources":["../../../src/react/primitive-hooks/useBranchPickerNext.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useBranchPickerNext = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => {\n if (s.message.branchNumber >= s.message.branchCount) return true;\n if (s.thread.isRunning && !s.thread.capabilities.switchBranchDuringRun) {\n return true;\n }\n return false;\n });\n\n const next = useCallback(() => {\n aui.message().switchToBranch({ position: \"next\" });\n }, [aui]);\n\n return { next, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,4BAA4B;CACvC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM;EAClC,IAAI,EAAE,QAAQ,gBAAgB,EAAE,QAAQ,aAAa,OAAO;EAC5D,IAAI,EAAE,OAAO,aAAa,CAAC,EAAE,OAAO,aAAa,uBAC/C,OAAO;EAET,OAAO;CACT,CAAC;CAMD,OAAO;EAAE,MAJI,kBAAkB;GAC7B,IAAI,QAAQ,CAAC,CAAC,eAAe,EAAE,UAAU,OAAO,CAAC;EACnD,GAAG,CAAC,GAAG,CAEK;EAAG;CAAS;AAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBranchPickerPrevious.js","names":[],"sources":["../../../src/react/primitive-hooks/useBranchPickerPrevious.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useBranchPickerPrevious = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => {\n if (s.message.branchNumber <= 1) return true;\n if (s.thread.isRunning && !s.thread.capabilities.switchBranchDuringRun) {\n return true;\n }\n return false;\n });\n\n const previous = useCallback(() => {\n aui.message().switchToBranch({ position: \"previous\" });\n }, [aui]);\n\n return { previous, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,gCAAgC;CAC3C,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM;EAClC,IAAI,EAAE,QAAQ,gBAAgB,GAAG,OAAO;EACxC,IAAI,EAAE,OAAO,aAAa,CAAC,EAAE,OAAO,aAAa,uBAC/C,OAAO;EAET,OAAO;CACT,CAAC;CAMD,OAAO;EAAE,UAJQ,kBAAkB;GACjC,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"useBranchPickerPrevious.js","names":[],"sources":["../../../src/react/primitive-hooks/useBranchPickerPrevious.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useBranchPickerPrevious = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => {\n if (s.message.branchNumber <= 1) return true;\n if (s.thread.isRunning && !s.thread.capabilities.switchBranchDuringRun) {\n return true;\n }\n return false;\n });\n\n const previous = useCallback(() => {\n aui.message().switchToBranch({ position: \"previous\" });\n }, [aui]);\n\n return { previous, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,gCAAgC;CAC3C,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM;EAClC,IAAI,EAAE,QAAQ,gBAAgB,GAAG,OAAO;EACxC,IAAI,EAAE,OAAO,aAAa,CAAC,EAAE,OAAO,aAAa,uBAC/C,OAAO;EAET,OAAO;CACT,CAAC;CAMD,OAAO;EAAE,UAJQ,kBAAkB;GACjC,IAAI,QAAQ,CAAC,CAAC,eAAe,EAAE,UAAU,WAAW,CAAC;EACvD,GAAG,CAAC,GAAG,CAES;EAAG;CAAS;AAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useComposerAddAttachment.js","names":[],"sources":["../../../src/react/primitive-hooks/useComposerAddAttachment.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport type { CreateAttachment } from \"../../types/attachment\";\n\nexport const useComposerAddAttachment = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => !s.composer.isEditing);\n\n const addAttachment = useCallback(\n (file: File | CreateAttachment) => {\n return aui.composer().addAttachment(file);\n },\n [aui],\n );\n\n return { addAttachment, disabled };\n};\n"],"mappings":";;;AAIA,MAAa,iCAAiC;CAC5C,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM,CAAC,EAAE,SAAS,SAAS;CASzD,OAAO;EAAE,eAPa,aACnB,SAAkC;GACjC,OAAO,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"useComposerAddAttachment.js","names":[],"sources":["../../../src/react/primitive-hooks/useComposerAddAttachment.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport type { CreateAttachment } from \"../../types/attachment\";\n\nexport const useComposerAddAttachment = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => !s.composer.isEditing);\n\n const addAttachment = useCallback(\n (file: File | CreateAttachment) => {\n return aui.composer().addAttachment(file);\n },\n [aui],\n );\n\n return { addAttachment, disabled };\n};\n"],"mappings":";;;AAIA,MAAa,iCAAiC;CAC5C,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM,CAAC,EAAE,SAAS,SAAS;CASzD,OAAO;EAAE,eAPa,aACnB,SAAkC;GACjC,OAAO,IAAI,SAAS,CAAC,CAAC,cAAc,IAAI;EAC1C,GACA,CAAC,GAAG,CAGe;EAAG;CAAS;AACnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useComposerCancel.js","names":[],"sources":["../../../src/react/primitive-hooks/useComposerCancel.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useComposerCancel = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => !s.composer.canCancel);\n\n const cancel = useCallback(() => {\n aui.composer().cancel();\n }, [aui]);\n\n return { cancel, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,0BAA0B;CACrC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM,CAAC,EAAE,SAAS,SAAS;CAMzD,OAAO;EAAE,QAJM,kBAAkB;GAC/B,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"useComposerCancel.js","names":[],"sources":["../../../src/react/primitive-hooks/useComposerCancel.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useComposerCancel = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => !s.composer.canCancel);\n\n const cancel = useCallback(() => {\n aui.composer().cancel();\n }, [aui]);\n\n return { cancel, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,0BAA0B;CACrC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM,CAAC,EAAE,SAAS,SAAS;CAMzD,OAAO;EAAE,QAJM,kBAAkB;GAC/B,IAAI,SAAS,CAAC,CAAC,OAAO;EACxB,GAAG,CAAC,GAAG,CAEO;EAAG;CAAS;AAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useComposerDictate.js","names":[],"sources":["../../../src/react/primitive-hooks/useComposerDictate.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useComposerDictate = () => {\n const aui = useAui();\n const disabled = useAuiState(\n (s) =>\n s.composer.dictation != null ||\n !s.thread.capabilities.dictation ||\n !s.composer.isEditing,\n );\n\n const startDictation = useCallback(() => {\n aui.composer().startDictation();\n }, [aui]);\n\n return { startDictation, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,2BAA2B;CACtC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aACd,MACC,EAAE,SAAS,aAAa,QACxB,CAAC,EAAE,OAAO,aAAa,aACvB,CAAC,EAAE,SAAS,SAChB;CAMA,OAAO;EAAE,gBAJc,kBAAkB;GACvC,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"useComposerDictate.js","names":[],"sources":["../../../src/react/primitive-hooks/useComposerDictate.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useComposerDictate = () => {\n const aui = useAui();\n const disabled = useAuiState(\n (s) =>\n s.composer.dictation != null ||\n !s.thread.capabilities.dictation ||\n !s.composer.isEditing,\n );\n\n const startDictation = useCallback(() => {\n aui.composer().startDictation();\n }, [aui]);\n\n return { startDictation, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,2BAA2B;CACtC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aACd,MACC,EAAE,SAAS,aAAa,QACxB,CAAC,EAAE,OAAO,aAAa,aACvB,CAAC,EAAE,SAAS,SAChB;CAMA,OAAO;EAAE,gBAJc,kBAAkB;GACvC,IAAI,SAAS,CAAC,CAAC,eAAe;EAChC,GAAG,CAAC,GAAG,CAEe;EAAG;CAAS;AACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useComposerSend.js","names":[],"sources":["../../../src/react/primitive-hooks/useComposerSend.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport type { ComposerSendOptions } from \"../../store/scopes/composer\";\n\nexport const useComposerSend = () => {\n const aui = useAui();\n const disabled = useAuiState(\n (s) =>\n !s.composer.canSend ||\n (s.thread.isRunning && !s.thread.capabilities.queue),\n );\n\n const send = useCallback(\n (opts?: ComposerSendOptions) => {\n aui.composer().send(opts);\n },\n [aui],\n );\n\n return { send, disabled };\n};\n"],"mappings":";;;AAIA,MAAa,wBAAwB;CACnC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aACd,MACC,CAAC,EAAE,SAAS,WACX,EAAE,OAAO,aAAa,CAAC,EAAE,OAAO,aAAa,KAClD;CASA,OAAO;EAAE,MAPI,aACV,SAA+B;GAC9B,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"useComposerSend.js","names":[],"sources":["../../../src/react/primitive-hooks/useComposerSend.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport type { ComposerSendOptions } from \"../../store/scopes/composer\";\n\nexport const useComposerSend = () => {\n const aui = useAui();\n const disabled = useAuiState(\n (s) =>\n !s.composer.canSend ||\n (s.thread.isRunning && !s.thread.capabilities.queue),\n );\n\n const send = useCallback(\n (opts?: ComposerSendOptions) => {\n aui.composer().send(opts);\n },\n [aui],\n );\n\n return { send, disabled };\n};\n"],"mappings":";;;AAIA,MAAa,wBAAwB;CACnC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aACd,MACC,CAAC,EAAE,SAAS,WACX,EAAE,OAAO,aAAa,CAAC,EAAE,OAAO,aAAa,KAClD;CASA,OAAO;EAAE,MAPI,aACV,SAA+B;GAC9B,IAAI,SAAS,CAAC,CAAC,KAAK,IAAI;EAC1B,GACA,CAAC,GAAG,CAGM;EAAG;CAAS;AAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditComposerCancel.js","names":[],"sources":["../../../src/react/primitive-hooks/useEditComposerCancel.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\n\nexport const useEditComposerCancel = () => {\n const aui = useAui();\n\n const cancel = useCallback(() => {\n aui.composer().cancel();\n }, [aui]);\n\n return { cancel };\n};\n"],"mappings":";;;AAGA,MAAa,8BAA8B;CACzC,MAAM,MAAM,OAAO;CAMnB,OAAO,EAAE,QAJM,kBAAkB;EAC/B,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"useEditComposerCancel.js","names":[],"sources":["../../../src/react/primitive-hooks/useEditComposerCancel.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\n\nexport const useEditComposerCancel = () => {\n const aui = useAui();\n\n const cancel = useCallback(() => {\n aui.composer().cancel();\n }, [aui]);\n\n return { cancel };\n};\n"],"mappings":";;;AAGA,MAAa,8BAA8B;CACzC,MAAM,MAAM,OAAO;CAMnB,OAAO,EAAE,QAJM,kBAAkB;EAC/B,IAAI,SAAS,CAAC,CAAC,OAAO;CACxB,GAAG,CAAC,GAAG,CAEO,EAAE;AAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditComposerSend.js","names":[],"sources":["../../../src/react/primitive-hooks/useEditComposerSend.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useEditComposerSend = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => s.composer.isEmpty);\n\n const send = useCallback(() => {\n aui.composer().send();\n }, [aui]);\n\n return { send, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,4BAA4B;CACvC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM,EAAE,SAAS,OAAO;CAMtD,OAAO;EAAE,MAJI,kBAAkB;GAC7B,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"useEditComposerSend.js","names":[],"sources":["../../../src/react/primitive-hooks/useEditComposerSend.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useEditComposerSend = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => s.composer.isEmpty);\n\n const send = useCallback(() => {\n aui.composer().send();\n }, [aui]);\n\n return { send, disabled };\n};\n"],"mappings":";;;AAGA,MAAa,4BAA4B;CACvC,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,aAAa,MAAM,EAAE,SAAS,OAAO;CAMtD,OAAO;EAAE,MAJI,kBAAkB;GAC7B,IAAI,SAAS,CAAC,CAAC,KAAK;EACtB,GAAG,CAAC,GAAG,CAEK;EAAG;CAAS;AAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessageBranching.js","names":[],"sources":["../../../src/react/primitive-hooks/useMessageBranching.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useMessageBranching = () => {\n const aui = useAui();\n const branchNumber = useAuiState((s) => s.message.branchNumber);\n const branchCount = useAuiState((s) => s.message.branchCount);\n\n const goToPrev = useCallback(() => {\n aui.message().switchToBranch({ position: \"previous\" });\n }, [aui]);\n\n const goToNext = useCallback(() => {\n aui.message().switchToBranch({ position: \"next\" });\n }, [aui]);\n\n return { branchNumber, branchCount, goToPrev, goToNext };\n};\n"],"mappings":";;;AAGA,MAAa,4BAA4B;CACvC,MAAM,MAAM,OAAO;CAYnB,OAAO;EAAE,cAXY,aAAa,MAAM,EAAE,QAAQ,YAW9B;EAAG,aAVH,aAAa,MAAM,EAAE,QAAQ,WAUhB;EAAG,UARnB,kBAAkB;GACjC,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"useMessageBranching.js","names":[],"sources":["../../../src/react/primitive-hooks/useMessageBranching.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useMessageBranching = () => {\n const aui = useAui();\n const branchNumber = useAuiState((s) => s.message.branchNumber);\n const branchCount = useAuiState((s) => s.message.branchCount);\n\n const goToPrev = useCallback(() => {\n aui.message().switchToBranch({ position: \"previous\" });\n }, [aui]);\n\n const goToNext = useCallback(() => {\n aui.message().switchToBranch({ position: \"next\" });\n }, [aui]);\n\n return { branchNumber, branchCount, goToPrev, goToNext };\n};\n"],"mappings":";;;AAGA,MAAa,4BAA4B;CACvC,MAAM,MAAM,OAAO;CAYnB,OAAO;EAAE,cAXY,aAAa,MAAM,EAAE,QAAQ,YAW9B;EAAG,aAVH,aAAa,MAAM,EAAE,QAAQ,WAUhB;EAAG,UARnB,kBAAkB;GACjC,IAAI,QAAQ,CAAC,CAAC,eAAe,EAAE,UAAU,WAAW,CAAC;EACvD,GAAG,CAAC,GAAG,CAMoC;EAAG,UAJ7B,kBAAkB;GACjC,IAAI,QAAQ,CAAC,CAAC,eAAe,EAAE,UAAU,OAAO,CAAC;EACnD,GAAG,CAAC,GAAG,CAE8C;CAAE;AACzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessageReload.js","names":[],"sources":["../../../src/react/primitive-hooks/useMessageReload.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useMessageReload = () => {\n const aui = useAui();\n const canReload = useAuiState((s) => s.message.role === \"assistant\");\n\n const reload = useCallback(() => {\n aui.message().reload();\n }, [aui]);\n\n return { reload, canReload };\n};\n"],"mappings":";;;AAGA,MAAa,yBAAyB;CACpC,MAAM,MAAM,OAAO;CACnB,MAAM,YAAY,aAAa,MAAM,EAAE,QAAQ,SAAS,WAAW;CAMnE,OAAO;EAAE,QAJM,kBAAkB;GAC/B,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"useMessageReload.js","names":[],"sources":["../../../src/react/primitive-hooks/useMessageReload.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useMessageReload = () => {\n const aui = useAui();\n const canReload = useAuiState((s) => s.message.role === \"assistant\");\n\n const reload = useCallback(() => {\n aui.message().reload();\n }, [aui]);\n\n return { reload, canReload };\n};\n"],"mappings":";;;AAGA,MAAa,yBAAyB;CACpC,MAAM,MAAM,OAAO;CACnB,MAAM,YAAY,aAAa,MAAM,EAAE,QAAQ,SAAS,WAAW;CAMnE,OAAO;EAAE,QAJM,kBAAkB;GAC/B,IAAI,QAAQ,CAAC,CAAC,OAAO;EACvB,GAAG,CAAC,GAAG,CAEO;EAAG;CAAU;AAC7B"}
|