@assistant-ui/react 0.12.9 → 0.12.11
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/client/DataRenderers.d.ts +3 -0
- package/dist/client/DataRenderers.d.ts.map +1 -0
- package/dist/client/DataRenderers.js +33 -0
- package/dist/client/DataRenderers.js.map +1 -0
- package/dist/client/ExternalThread.d.ts +1 -1
- package/dist/client/ExternalThread.d.ts.map +1 -1
- package/dist/client/ExternalThread.js +136 -127
- package/dist/client/ExternalThread.js.map +1 -1
- package/dist/client/InMemoryThreadList.d.ts.map +1 -1
- package/dist/client/InMemoryThreadList.js +62 -53
- package/dist/client/InMemoryThreadList.js.map +1 -1
- package/dist/client/Tools.d.ts.map +1 -1
- package/dist/client/Tools.js +10 -10
- package/dist/client/Tools.js.map +1 -1
- package/dist/client/index.d.ts +4 -3
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +6 -3
- package/dist/client/index.js.map +1 -1
- package/dist/context/providers/ChainOfThoughtByIndicesProvider.js +2 -2
- package/dist/context/providers/ChainOfThoughtByIndicesProvider.js.map +1 -1
- package/dist/context/providers/MessageByIndexProvider.js +1 -1
- package/dist/context/providers/MessageByIndexProvider.js.map +1 -1
- package/dist/context/providers/MessageProvider.d.ts +1 -1
- package/dist/context/providers/MessageProvider.d.ts.map +1 -1
- package/dist/context/providers/MessageProvider.js +1 -1
- package/dist/context/providers/MessageProvider.js.map +1 -1
- package/dist/context/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/context/providers/TextMessagePartProvider.js +6 -9
- package/dist/context/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/context/providers/ThreadListItemProvider.js +1 -1
- package/dist/context/providers/ThreadListItemProvider.js.map +1 -1
- package/dist/context/react/utils/ensureBinding.js +1 -1
- package/dist/context/react/utils/ensureBinding.js.map +1 -1
- package/dist/context/react/utils/useRuntimeState.d.ts +1 -1
- package/dist/context/react/utils/useRuntimeState.d.ts.map +1 -1
- package/dist/context/react/utils/useRuntimeState.js.map +1 -1
- package/dist/context/stores/ThreadViewport.d.ts +1 -1
- package/dist/context/stores/ThreadViewport.d.ts.map +1 -1
- package/dist/context/stores/ThreadViewport.js.map +1 -1
- package/dist/devtools/DevToolsHooks.d.ts +1 -1
- package/dist/devtools/DevToolsHooks.d.ts.map +1 -1
- package/dist/hooks/useMessageQuote.d.ts +17 -0
- package/dist/hooks/useMessageQuote.d.ts.map +1 -0
- package/dist/hooks/useMessageQuote.js +20 -0
- package/dist/hooks/useMessageQuote.js.map +1 -0
- package/dist/hooks/useMessageTiming.d.ts +17 -0
- package/dist/hooks/useMessageTiming.d.ts.map +1 -0
- package/dist/hooks/useMessageTiming.js +20 -0
- package/dist/hooks/useMessageTiming.js.map +1 -0
- package/dist/internal.d.ts +3 -11
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +3 -9
- package/dist/internal.js.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.js +1 -2
- package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
- package/dist/legacy-runtime/RuntimeAdapter.js +37 -24
- package/dist/legacy-runtime/RuntimeAdapter.js.map +1 -1
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.d.ts +2 -2
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.js +384 -80
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/legacy-runtime/cloud/auiV0.d.ts +8 -9
- package/dist/legacy-runtime/cloud/auiV0.d.ts.map +1 -1
- package/dist/legacy-runtime/cloud/auiV0.js +20 -45
- package/dist/legacy-runtime/cloud/auiV0.js.map +1 -1
- package/dist/legacy-runtime/cloud/useCloudThreadListRuntime.d.ts +1 -1
- package/dist/legacy-runtime/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/cloud/useCloudThreadListRuntime.js +4 -5
- package/dist/legacy-runtime/cloud/useCloudThreadListRuntime.js.map +1 -1
- package/dist/legacy-runtime/hooks/AssistantContext.d.ts +12 -12
- package/dist/legacy-runtime/hooks/AssistantContext.js +1 -1
- package/dist/legacy-runtime/hooks/AttachmentContext.d.ts +157 -157
- package/dist/legacy-runtime/hooks/AttachmentContext.js +1 -1
- package/dist/legacy-runtime/hooks/ComposerContext.d.ts +17 -17
- package/dist/legacy-runtime/hooks/ComposerContext.js +4 -4
- package/dist/legacy-runtime/hooks/MessageContext.d.ts +27 -27
- package/dist/legacy-runtime/hooks/MessageContext.js +5 -5
- package/dist/legacy-runtime/hooks/MessagePartContext.d.ts +12 -12
- package/dist/legacy-runtime/hooks/MessagePartContext.js +1 -1
- package/dist/legacy-runtime/hooks/ThreadContext.d.ts +27 -27
- package/dist/legacy-runtime/hooks/ThreadContext.js +4 -4
- package/dist/legacy-runtime/hooks/ThreadListItemContext.d.ts +12 -12
- package/dist/legacy-runtime/hooks/ThreadListItemContext.js +1 -1
- package/dist/legacy-runtime/runtime/AssistantRuntime.d.ts +2 -63
- package/dist/legacy-runtime/runtime/AssistantRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime/AssistantRuntime.js +1 -45
- package/dist/legacy-runtime/runtime/AssistantRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime/AttachmentRuntime.d.ts +2 -62
- package/dist/legacy-runtime/runtime/AttachmentRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime/AttachmentRuntime.js +1 -55
- package/dist/legacy-runtime/runtime/AttachmentRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime/ComposerRuntime.d.ts +3 -171
- package/dist/legacy-runtime/runtime/ComposerRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime/ComposerRuntime.js +1 -240
- package/dist/legacy-runtime/runtime/ComposerRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime/MessagePartRuntime.d.ts +2 -39
- package/dist/legacy-runtime/runtime/MessagePartRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime/MessagePartRuntime.js +1 -66
- package/dist/legacy-runtime/runtime/MessagePartRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime/MessageRuntime.d.ts +3 -91
- package/dist/legacy-runtime/runtime/MessageRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime/MessageRuntime.js +1 -200
- package/dist/legacy-runtime/runtime/MessageRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime/RuntimeBindings.d.ts +2 -36
- package/dist/legacy-runtime/runtime/RuntimeBindings.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime/RuntimeBindings.js +3 -0
- package/dist/legacy-runtime/runtime/RuntimeBindings.js.map +1 -1
- package/dist/legacy-runtime/runtime/RuntimePathTypes.d.ts +1 -63
- package/dist/legacy-runtime/runtime/RuntimePathTypes.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime/ThreadListItemRuntime.d.ts +4 -49
- package/dist/legacy-runtime/runtime/ThreadListItemRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime/ThreadListItemRuntime.js +1 -87
- package/dist/legacy-runtime/runtime/ThreadListItemRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime/ThreadListRuntime.d.ts +3 -43
- package/dist/legacy-runtime/runtime/ThreadListRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime/ThreadListRuntime.js +1 -138
- package/dist/legacy-runtime/runtime/ThreadListRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime/ThreadRuntime.d.ts +3 -270
- package/dist/legacy-runtime/runtime/ThreadRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime/ThreadRuntime.js +1 -242
- package/dist/legacy-runtime/runtime/ThreadRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime/index.d.ts +1 -8
- package/dist/legacy-runtime/runtime/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.d.ts +1 -2
- package/dist/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.d.ts +1 -2
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/index.d.ts +2 -4
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/index.js +2 -3
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/index.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/feedback/index.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/feedback/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/speech/index.d.ts +2 -3
- package/dist/legacy-runtime/runtime-cores/adapters/speech/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/speech/index.js +1 -2
- package/dist/legacy-runtime/runtime-cores/adapters/speech/index.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/suggestion/index.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/suggestion/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/thread-history/index.d.ts +1 -2
- package/dist/legacy-runtime/runtime-cores/adapters/thread-history/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/thread-history/index.js +1 -2
- package/dist/legacy-runtime/runtime-cores/adapters/thread-history/index.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts +6 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js +38 -28
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.js +122 -31
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/utils.d.ts +1 -10
- package/dist/legacy-runtime/runtime-cores/assistant-transport/utils.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/utils.js +1 -19
- package/dist/legacy-runtime/runtime-cores/assistant-transport/utils.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.d.ts +1 -53
- package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.js +1 -312
- package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.d.ts +1 -27
- package/dist/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.js +1 -49
- package/dist/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.d.ts +1 -23
- package/dist/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.js +1 -40
- package/dist/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/AssistantRuntimeCore.d.ts +1 -16
- package/dist/legacy-runtime/runtime-cores/core/AssistantRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/AssistantRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/BaseAssistantRuntimeCore.d.ts +1 -11
- package/dist/legacy-runtime/runtime-cores/core/BaseAssistantRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/BaseAssistantRuntimeCore.js +1 -10
- package/dist/legacy-runtime/runtime-cores/core/BaseAssistantRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.d.ts +1 -66
- package/dist/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.js +1 -159
- package/dist/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.d.ts +1 -61
- package/dist/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ThreadListRuntimeCore.d.ts +1 -36
- package/dist/legacy-runtime/runtime-cores/core/ThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ThreadListRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.d.ts +1 -110
- package/dist/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/index.d.ts +1 -2
- package/dist/legacy-runtime/runtime-cores/core/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.d.ts +1 -80
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreRuntimeCore.d.ts +1 -8
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreRuntimeCore.js +1 -18
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadListRuntimeCore.d.ts +2 -41
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadListRuntimeCore.js +1 -173
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadListRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.d.ts +1 -46
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.js +1 -259
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageConverter.d.ts +2 -6
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageConverter.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageConverter.js +1 -11
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageConverter.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.d.ts +2 -33
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.js +1 -126
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/auto-status.d.ts +1 -4
- package/dist/legacy-runtime/runtime-cores/external-store/auto-status.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/auto-status.js +1 -31
- package/dist/legacy-runtime/runtime-cores/external-store/auto-status.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.js +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.d.ts +2 -1
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js +4 -1
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.d.ts +2 -8
- package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.js +2 -22
- package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/index.d.ts +3 -3
- package/dist/legacy-runtime/runtime-cores/external-store/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/index.js +2 -1
- package/dist/legacy-runtime/runtime-cores/external-store/index.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/index.d.ts +2 -1
- package/dist/legacy-runtime/runtime-cores/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/index.js +1 -1
- package/dist/legacy-runtime/runtime-cores/index.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/ChatModelAdapter.d.ts +1 -38
- package/dist/legacy-runtime/runtime-cores/local/ChatModelAdapter.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/ChatModelAdapter.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeCore.d.ts +1 -10
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeCore.js +1 -21
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.d.ts +10 -30
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadListRuntimeCore.d.ts +2 -45
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadListRuntimeCore.js +1 -86
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadListRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.d.ts +1 -58
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.js +1 -415
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/index.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/local/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/index.js +1 -0
- package/dist/legacy-runtime/runtime-cores/local/index.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/shouldContinue.d.ts +1 -2
- package/dist/legacy-runtime/runtime-cores/local/shouldContinue.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/shouldContinue.js +1 -13
- package/dist/legacy-runtime/runtime-cores/local/shouldContinue.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.js +1 -1
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/BaseSubscribable.d.ts +1 -7
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/BaseSubscribable.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/BaseSubscribable.js +1 -37
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/BaseSubscribable.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.d.ts +1 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.js +1 -141
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/OptimisticState.d.ts +1 -22
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/OptimisticState.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/OptimisticState.js +1 -56
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/OptimisticState.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.d.ts +39 -39
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.js +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts +41 -67
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +13 -72
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.js +10 -3
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/in-memory.d.ts +1 -12
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/in-memory.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/in-memory.js +1 -28
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/in-memory.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/index.d.ts +2 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/index.js +2 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/index.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/types.d.ts +1 -38
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/types.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/types.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.d.ts +2 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js +1 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/utils/MessageRepository.d.ts +3 -163
- package/dist/legacy-runtime/runtime-cores/utils/MessageRepository.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/utils/MessageRepository.js +2 -393
- package/dist/legacy-runtime/runtime-cores/utils/MessageRepository.js.map +1 -1
- package/dist/model-context/frame/index.d.ts +4 -3
- package/dist/model-context/frame/index.d.ts.map +1 -1
- package/dist/model-context/frame/index.js +3 -3
- package/dist/model-context/frame/index.js.map +1 -1
- package/dist/model-context/frame/useAssistantFrameHost.d.ts +2 -2
- package/dist/model-context/frame/useAssistantFrameHost.d.ts.map +1 -1
- package/dist/model-context/frame/useAssistantFrameHost.js +1 -1
- package/dist/model-context/frame/useAssistantFrameHost.js.map +1 -1
- package/dist/model-context/index.d.ts +6 -3
- package/dist/model-context/index.d.ts.map +1 -1
- package/dist/model-context/index.js +5 -2
- package/dist/model-context/index.js.map +1 -1
- package/dist/model-context/makeAssistantDataUI.d.ts +7 -0
- package/dist/model-context/makeAssistantDataUI.d.ts.map +1 -0
- package/dist/model-context/makeAssistantDataUI.js +11 -0
- package/dist/model-context/makeAssistantDataUI.js.map +1 -0
- package/dist/model-context/makeAssistantTool.d.ts.map +1 -1
- package/dist/model-context/makeAssistantTool.js.map +1 -1
- package/dist/model-context/makeAssistantToolUI.d.ts.map +1 -1
- package/dist/model-context/makeAssistantToolUI.js.map +1 -1
- package/dist/model-context/makeAssistantVisible.js +1 -1
- package/dist/model-context/makeAssistantVisible.js.map +1 -1
- package/dist/model-context/registry/index.d.ts +2 -2
- package/dist/model-context/registry/index.d.ts.map +1 -1
- package/dist/model-context/registry/index.js +1 -2
- package/dist/model-context/registry/index.js.map +1 -1
- package/dist/model-context/toolbox.d.ts.map +1 -1
- package/dist/model-context/toolbox.js.map +1 -1
- package/dist/model-context/useAssistantDataUI.d.ts +7 -0
- package/dist/model-context/useAssistantDataUI.d.ts.map +1 -0
- package/dist/model-context/useAssistantDataUI.js +12 -0
- package/dist/model-context/useAssistantDataUI.js.map +1 -0
- package/dist/model-context/useAssistantInstructions.d.ts +2 -4
- package/dist/model-context/useAssistantInstructions.d.ts.map +1 -1
- package/dist/model-context/useAssistantInstructions.js.map +1 -1
- package/dist/model-context/useAssistantTool.d.ts +2 -3
- package/dist/model-context/useAssistantTool.d.ts.map +1 -1
- package/dist/model-context/useAssistantTool.js.map +1 -1
- package/dist/model-context/useAssistantToolUI.d.ts.map +1 -1
- package/dist/model-context/useAssistantToolUI.js.map +1 -1
- package/dist/model-context/useInlineRender.d.ts.map +1 -1
- package/dist/model-context/useInlineRender.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.js +7 -6
- package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.js +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarExportMarkdown.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarExportMarkdown.js +4 -3
- package/dist/primitives/actionBar/ActionBarExportMarkdown.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.js +4 -3
- package/dist/primitives/actionBar/ActionBarSpeak.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js.map +1 -1
- package/dist/primitives/actionBar/useActionBarFloatStatus.d.ts.map +1 -1
- package/dist/primitives/actionBar/useActionBarFloatStatus.js +5 -5
- package/dist/primitives/actionBar/useActionBarFloatStatus.js.map +1 -1
- package/dist/primitives/actionBarMore/scope.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/scope.js.map +1 -1
- package/dist/primitives/assistantModal/scope.d.ts.map +1 -1
- package/dist/primitives/assistantModal/scope.js.map +1 -1
- package/dist/primitives/attachment/AttachmentName.js +1 -1
- package/dist/primitives/attachment/AttachmentName.js.map +1 -1
- package/dist/primitives/attachment/AttachmentRemove.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentRemove.js.map +1 -1
- package/dist/primitives/attachment/AttachmentThumb.js +2 -2
- package/dist/primitives/attachment/AttachmentThumb.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerCount.js +1 -1
- package/dist/primitives/branchPicker/BranchPickerCount.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.js +3 -3
- package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNumber.js +1 -1
- package/dist/primitives/branchPicker/BranchPickerNumber.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.js +3 -3
- package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.d.ts.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.js +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.js.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.js +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.js +1 -1
- package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/primitives/composer/ComposerCancel.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerCancel.js +1 -1
- package/dist/primitives/composer/ComposerCancel.js.map +1 -1
- package/dist/primitives/composer/ComposerDictate.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerDictate.js +3 -3
- package/dist/primitives/composer/ComposerDictate.js.map +1 -1
- package/dist/primitives/composer/ComposerDictationTranscript.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerDictationTranscript.js +1 -1
- package/dist/primitives/composer/ComposerDictationTranscript.js.map +1 -1
- package/dist/primitives/composer/ComposerIf.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerIf.js +4 -4
- package/dist/primitives/composer/ComposerIf.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.d.ts +35 -45
- package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +25 -9
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerQuote.d.ts +52 -0
- package/dist/primitives/composer/ComposerQuote.d.ts.map +1 -0
- package/dist/primitives/composer/ComposerQuote.js +57 -0
- package/dist/primitives/composer/ComposerQuote.js.map +1 -0
- package/dist/primitives/composer/ComposerSend.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerSend.js.map +1 -1
- package/dist/primitives/composer/ComposerStopDictation.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerStopDictation.js +1 -1
- package/dist/primitives/composer/ComposerStopDictation.js.map +1 -1
- package/dist/primitives/composer/index.d.ts +3 -0
- package/dist/primitives/composer/index.d.ts.map +1 -1
- package/dist/primitives/composer/index.js +3 -0
- package/dist/primitives/composer/index.js.map +1 -1
- package/dist/primitives/error/ErrorMessage.js +4 -4
- package/dist/primitives/error/ErrorMessage.js.map +1 -1
- package/dist/primitives/index.d.ts +3 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +3 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/message/MessageAttachments.d.ts.map +1 -1
- package/dist/primitives/message/MessageAttachments.js +4 -4
- package/dist/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/primitives/message/MessageError.d.ts.map +1 -1
- package/dist/primitives/message/MessageError.js +2 -2
- package/dist/primitives/message/MessageError.js.map +1 -1
- package/dist/primitives/message/MessageIf.d.ts.map +1 -1
- package/dist/primitives/message/MessageIf.js +3 -3
- package/dist/primitives/message/MessageIf.js.map +1 -1
- package/dist/primitives/message/MessageParts.d.ts +9 -1
- package/dist/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/primitives/message/MessageParts.js +24 -10
- package/dist/primitives/message/MessageParts.js.map +1 -1
- package/dist/primitives/message/MessagePartsGrouped.d.ts +8 -1
- package/dist/primitives/message/MessagePartsGrouped.d.ts.map +1 -1
- package/dist/primitives/message/MessagePartsGrouped.js +22 -8
- package/dist/primitives/message/MessagePartsGrouped.js.map +1 -1
- package/dist/primitives/message/MessageRoot.d.ts.map +1 -1
- package/dist/primitives/message/MessageRoot.js +6 -5
- package/dist/primitives/message/MessageRoot.js.map +1 -1
- package/dist/primitives/messagePart/MessagePartInProgress.d.ts.map +1 -1
- package/dist/primitives/messagePart/MessagePartInProgress.js +1 -1
- package/dist/primitives/messagePart/MessagePartInProgress.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartData.d.ts +1 -1
- package/dist/primitives/messagePart/useMessagePartData.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartData.js +3 -3
- package/dist/primitives/messagePart/useMessagePartData.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartFile.d.ts +2 -2
- package/dist/primitives/messagePart/useMessagePartFile.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartFile.js +3 -3
- package/dist/primitives/messagePart/useMessagePartFile.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartImage.d.ts +2 -2
- package/dist/primitives/messagePart/useMessagePartImage.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartImage.js +3 -3
- package/dist/primitives/messagePart/useMessagePartImage.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartReasoning.d.ts +2 -2
- package/dist/primitives/messagePart/useMessagePartReasoning.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartReasoning.js +3 -3
- package/dist/primitives/messagePart/useMessagePartReasoning.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartSource.d.ts +2 -2
- package/dist/primitives/messagePart/useMessagePartSource.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartSource.js +3 -3
- package/dist/primitives/messagePart/useMessagePartSource.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartText.d.ts +3 -3
- package/dist/primitives/messagePart/useMessagePartText.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartText.js +3 -3
- package/dist/primitives/messagePart/useMessagePartText.js.map +1 -1
- package/dist/primitives/reasoning/useScrollLock.d.ts.map +1 -1
- package/dist/primitives/reasoning/useScrollLock.js.map +1 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarQuote.d.ts +24 -0
- package/dist/primitives/selectionToolbar/SelectionToolbarQuote.d.ts.map +1 -0
- package/dist/primitives/selectionToolbar/SelectionToolbarQuote.js +37 -0
- package/dist/primitives/selectionToolbar/SelectionToolbarQuote.js.map +1 -0
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.d.ts +31 -0
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.d.ts.map +1 -0
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js +85 -0
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js.map +1 -0
- package/dist/primitives/selectionToolbar/index.d.ts +3 -0
- package/dist/primitives/selectionToolbar/index.d.ts.map +1 -0
- package/dist/primitives/selectionToolbar/index.js +3 -0
- package/dist/primitives/selectionToolbar/index.js.map +1 -0
- package/dist/primitives/suggestion/SuggestionDescription.js +1 -1
- package/dist/primitives/suggestion/SuggestionDescription.js.map +1 -1
- package/dist/primitives/suggestion/SuggestionTitle.js +1 -1
- package/dist/primitives/suggestion/SuggestionTitle.js.map +1 -1
- package/dist/primitives/suggestion/SuggestionTrigger.d.ts.map +1 -1
- package/dist/primitives/suggestion/SuggestionTrigger.js +6 -3
- package/dist/primitives/suggestion/SuggestionTrigger.js.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.js +1 -1
- package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
- package/dist/primitives/thread/ThreadIf.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadIf.js +7 -7
- package/dist/primitives/thread/ThreadIf.js.map +1 -1
- package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadMessages.js +3 -3
- package/dist/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.js.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.js +5 -2
- package/dist/primitives/thread/ThreadSuggestion.js.map +1 -1
- package/dist/primitives/thread/ThreadSuggestions.js +1 -1
- package/dist/primitives/thread/ThreadSuggestions.js.map +1 -1
- package/dist/primitives/thread/ThreadViewportSlack.js +4 -4
- package/dist/primitives/thread/ThreadViewportSlack.js.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.d.ts.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js +1 -1
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.js +1 -1
- package/dist/primitives/threadList/ThreadListNew.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.js +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTitle.js +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTitle.js.map +1 -1
- package/dist/primitives/threadListItemMore/scope.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/scope.js.map +1 -1
- package/dist/types/MessagePartComponentTypes.d.ts +4 -2
- package/dist/types/MessagePartComponentTypes.d.ts.map +1 -1
- package/dist/types/MessagePartComponentTypes.js.map +1 -1
- package/dist/types/index.d.ts +3 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/scopes/dataRenderers.d.ts +13 -0
- package/dist/types/scopes/dataRenderers.d.ts.map +1 -0
- package/dist/types/scopes/dataRenderers.js +2 -0
- package/dist/types/scopes/dataRenderers.js.map +1 -0
- package/dist/types/scopes/index.d.ts +2 -11
- package/dist/types/scopes/index.d.ts.map +1 -1
- package/dist/types/scopes/tools.d.ts +1 -2
- package/dist/types/scopes/tools.d.ts.map +1 -1
- package/dist/types/store-augmentation.d.ts +5 -25
- package/dist/types/store-augmentation.d.ts.map +1 -1
- package/dist/types/store-augmentation.js +1 -1
- package/dist/types/store-augmentation.js.map +1 -1
- package/dist/utils/RequireAtLeastOne.d.ts.map +1 -1
- package/dist/utils/RequireAtLeastOne.js.map +1 -1
- package/dist/utils/getSelectionMessageId.d.ts +2 -0
- package/dist/utils/getSelectionMessageId.d.ts.map +1 -0
- package/dist/utils/getSelectionMessageId.js +21 -0
- package/dist/utils/getSelectionMessageId.js.map +1 -0
- package/dist/utils/hooks/useOnResizeContent.d.ts.map +1 -1
- package/dist/utils/hooks/useOnResizeContent.js.map +1 -1
- package/dist/utils/hooks/useOnScrollToBottom.d.ts.map +1 -1
- package/dist/utils/hooks/useOnScrollToBottom.js.map +1 -1
- package/dist/utils/smooth/useSmooth.d.ts +1 -2
- package/dist/utils/smooth/useSmooth.d.ts.map +1 -1
- package/dist/utils/smooth/useSmooth.js +18 -8
- package/dist/utils/smooth/useSmooth.js.map +1 -1
- package/dist/utils/useToolArgsFieldStatus.d.ts.map +1 -1
- package/dist/utils/useToolArgsFieldStatus.js +5 -5
- package/dist/utils/useToolArgsFieldStatus.js.map +1 -1
- package/package.json +8 -5
- package/src/client/DataRenderers.ts +42 -0
- package/src/client/ExternalThread.ts +149 -136
- package/src/client/InMemoryThreadList.ts +68 -54
- package/src/client/Tools.ts +10 -10
- package/src/client/index.ts +7 -3
- package/src/context/providers/ChainOfThoughtByIndicesProvider.tsx +3 -3
- package/src/context/providers/MessageByIndexProvider.tsx +1 -1
- package/src/context/providers/MessageProvider.tsx +2 -2
- package/src/context/providers/TextMessagePartProvider.tsx +6 -9
- package/src/context/providers/ThreadListItemProvider.tsx +1 -1
- package/src/context/react/utils/ensureBinding.ts +1 -1
- package/src/context/react/utils/useRuntimeState.ts +1 -1
- package/src/context/stores/{ThreadViewport.tsx → ThreadViewport.ts} +1 -1
- package/src/devtools/DevToolsHooks.ts +1 -1
- package/src/hooks/useMessageQuote.ts +27 -0
- package/src/hooks/useMessageTiming.ts +24 -0
- package/src/internal.ts +22 -13
- package/src/legacy-runtime/AssistantRuntimeProvider.tsx +5 -6
- package/src/legacy-runtime/RuntimeAdapter.ts +42 -24
- package/src/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.ts +646 -0
- package/src/legacy-runtime/cloud/auiV0.ts +29 -53
- package/src/legacy-runtime/cloud/{useCloudThreadListRuntime.tsx → useCloudThreadListRuntime.ts} +5 -7
- package/src/legacy-runtime/hooks/AssistantContext.ts +1 -1
- package/src/legacy-runtime/hooks/AttachmentContext.ts +1 -1
- package/src/legacy-runtime/hooks/ComposerContext.ts +6 -6
- package/src/legacy-runtime/hooks/MessageContext.ts +5 -5
- package/src/legacy-runtime/hooks/MessagePartContext.ts +1 -1
- package/src/legacy-runtime/hooks/ThreadContext.ts +5 -5
- package/src/legacy-runtime/hooks/ThreadListItemContext.ts +1 -1
- package/src/legacy-runtime/runtime/AssistantRuntime.ts +2 -111
- package/src/legacy-runtime/runtime/AttachmentRuntime.ts +7 -119
- package/src/legacy-runtime/runtime/ComposerRuntime.ts +15 -475
- package/src/legacy-runtime/runtime/MessagePartRuntime.ts +2 -117
- package/src/legacy-runtime/runtime/MessageRuntime.ts +3 -335
- package/src/legacy-runtime/runtime/RuntimeBindings.ts +12 -69
- package/src/legacy-runtime/runtime/RuntimePathTypes.ts +8 -61
- package/src/legacy-runtime/runtime/ThreadListItemRuntime.ts +7 -152
- package/src/legacy-runtime/runtime/ThreadListRuntime.ts +6 -224
- package/src/legacy-runtime/runtime/ThreadRuntime.ts +14 -561
- package/src/legacy-runtime/runtime/index.ts +10 -13
- package/src/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.tsx +4 -2
- package/src/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.ts +4 -4
- package/src/legacy-runtime/runtime-cores/adapters/attachment/index.ts +9 -4
- package/src/legacy-runtime/runtime-cores/adapters/feedback/index.ts +2 -1
- package/src/legacy-runtime/runtime-cores/adapters/speech/index.ts +6 -3
- package/src/legacy-runtime/runtime-cores/adapters/suggestion/index.ts +2 -1
- package/src/legacy-runtime/runtime-cores/adapters/thread-history/index.ts +9 -2
- package/src/legacy-runtime/runtime-cores/assistant-transport/transport-scheduling.test.ts +136 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/types.ts +6 -1
- package/src/legacy-runtime/runtime-cores/assistant-transport/{useAssistantTransportRuntime.tsx → useAssistantTransportRuntime.ts} +46 -36
- package/src/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.test.ts +223 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.ts +175 -46
- package/src/legacy-runtime/runtime-cores/assistant-transport/utils.ts +5 -37
- package/src/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.ts +1 -0
- package/src/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.ts +1 -0
- package/src/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.ts +1 -0
- package/src/legacy-runtime/runtime-cores/core/AssistantRuntimeCore.ts +1 -0
- package/src/legacy-runtime/runtime-cores/core/BaseAssistantRuntimeCore.ts +1 -0
- package/src/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.ts +1 -0
- package/src/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.ts +6 -0
- package/src/legacy-runtime/runtime-cores/core/ThreadListRuntimeCore.ts +4 -0
- package/src/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.ts +13 -0
- package/src/legacy-runtime/runtime-cores/core/index.ts +3 -3
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.ts +6 -0
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreRuntimeCore.ts +1 -0
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadListRuntimeCore.ts +2 -0
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.ts +4 -0
- package/src/legacy-runtime/runtime-cores/external-store/ThreadMessageConverter.ts +2 -23
- package/src/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.ts +2 -0
- package/src/legacy-runtime/runtime-cores/external-store/auto-status.ts +1 -0
- package/src/legacy-runtime/runtime-cores/external-store/{createMessageConverter.tsx → createMessageConverter.ts} +3 -3
- package/src/legacy-runtime/runtime-cores/external-store/{external-message-converter.tsx → external-message-converter.ts} +13 -4
- package/src/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.ts +5 -0
- package/src/legacy-runtime/runtime-cores/external-store/index.ts +9 -6
- package/src/legacy-runtime/runtime-cores/external-store/{useExternalStoreRuntime.tsx → useExternalStoreRuntime.ts} +1 -1
- package/src/legacy-runtime/runtime-cores/index.ts +3 -4
- package/src/legacy-runtime/runtime-cores/local/ChatModelAdapter.ts +7 -0
- package/src/legacy-runtime/runtime-cores/local/LocalRuntimeCore.ts +1 -0
- package/src/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.ts +36 -0
- package/src/legacy-runtime/runtime-cores/local/LocalThreadListRuntimeCore.ts +2 -0
- package/src/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.ts +1 -0
- package/src/legacy-runtime/runtime-cores/local/index.ts +10 -6
- package/src/legacy-runtime/runtime-cores/local/shouldContinue.ts +1 -0
- package/src/legacy-runtime/runtime-cores/local/{useLocalRuntime.tsx → useLocalRuntime.ts} +1 -3
- package/src/legacy-runtime/runtime-cores/remote-thread-list/BaseSubscribable.ts +1 -0
- package/src/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.ts +1 -0
- package/src/legacy-runtime/runtime-cores/remote-thread-list/OptimisticState.ts +1 -89
- package/src/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.tsx +1 -1
- package/src/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.tsx +33 -136
- package/src/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.tsx +11 -3
- package/src/legacy-runtime/runtime-cores/remote-thread-list/adapter/in-memory.ts +1 -0
- package/src/legacy-runtime/runtime-cores/remote-thread-list/index.ts +5 -3
- package/src/legacy-runtime/runtime-cores/remote-thread-list/types.ts +7 -0
- package/src/legacy-runtime/runtime-cores/remote-thread-list/{useRemoteThreadListRuntime.tsx → useRemoteThreadListRuntime.ts} +9 -5
- package/src/legacy-runtime/runtime-cores/utils/MessageRepository.ts +3 -0
- package/src/model-context/frame/AssistantFrame.test.ts +6 -4
- package/src/model-context/frame/index.ts +9 -3
- package/src/model-context/frame/useAssistantFrameHost.ts +2 -2
- package/src/model-context/index.ts +12 -3
- package/src/model-context/makeAssistantDataUI.ts +22 -0
- package/src/model-context/makeAssistantVisible.tsx +1 -1
- package/src/model-context/registry/index.ts +6 -2
- package/src/model-context/useAssistantDataUI.ts +18 -0
- package/src/model-context/{useAssistantInstructions.tsx → useAssistantInstructions.ts} +2 -4
- package/src/model-context/{useAssistantTool.tsx → useAssistantTool.ts} +2 -3
- package/src/primitives/actionBar/ActionBarCopy.tsx +7 -6
- package/src/primitives/actionBar/{ActionBarEdit.tsx → ActionBarEdit.ts} +1 -1
- package/src/primitives/actionBar/ActionBarExportMarkdown.tsx +4 -3
- package/src/primitives/actionBar/{ActionBarSpeak.tsx → ActionBarSpeak.ts} +4 -3
- package/src/primitives/actionBar/ActionBarStopSpeaking.tsx +1 -1
- package/src/primitives/actionBar/{useActionBarFloatStatus.tsx → useActionBarFloatStatus.ts} +5 -5
- package/src/primitives/attachment/AttachmentName.tsx +1 -1
- package/src/primitives/attachment/AttachmentThumb.tsx +2 -2
- package/src/primitives/branchPicker/BranchPickerCount.tsx +1 -1
- package/src/primitives/branchPicker/{BranchPickerNext.tsx → BranchPickerNext.ts} +3 -3
- package/src/primitives/branchPicker/BranchPickerNumber.tsx +1 -1
- package/src/primitives/branchPicker/{BranchPickerPrevious.tsx → BranchPickerPrevious.ts} +3 -3
- package/src/primitives/chainOfThought/{ChainOfThoughtAccordionTrigger.tsx → ChainOfThoughtAccordionTrigger.ts} +1 -3
- package/src/primitives/chainOfThought/ChainOfThoughtParts.tsx +1 -3
- package/src/primitives/composer/{ComposerAddAttachment.tsx → ComposerAddAttachment.ts} +1 -1
- package/src/primitives/composer/ComposerAttachments.tsx +2 -2
- package/src/primitives/composer/{ComposerCancel.tsx → ComposerCancel.ts} +1 -1
- package/src/primitives/composer/{ComposerDictate.tsx → ComposerDictate.ts} +4 -4
- package/src/primitives/composer/ComposerDictationTranscript.tsx +1 -3
- package/src/primitives/composer/{ComposerIf.tsx → ComposerIf.ts} +4 -4
- package/src/primitives/composer/ComposerInput.tsx +57 -17
- package/src/primitives/composer/ComposerQuote.tsx +109 -0
- package/src/primitives/composer/{ComposerStopDictation.tsx → ComposerStopDictation.ts} +1 -1
- package/src/primitives/composer/index.ts +3 -0
- package/src/primitives/error/ErrorMessage.tsx +4 -4
- package/src/primitives/index.ts +3 -0
- package/src/primitives/message/MessageAttachments.tsx +5 -5
- package/src/primitives/message/{MessageError.tsx → MessageError.ts} +3 -3
- package/src/primitives/message/{MessageIf.tsx → MessageIf.ts} +3 -3
- package/src/primitives/message/MessageParts.tsx +40 -10
- package/src/primitives/message/MessagePartsGrouped.tsx +40 -8
- package/src/primitives/message/MessageRoot.tsx +6 -5
- package/src/primitives/messagePart/{MessagePartInProgress.tsx → MessagePartInProgress.ts} +1 -3
- package/src/primitives/messagePart/{useMessagePartData.tsx → useMessagePartData.ts} +4 -4
- package/src/primitives/messagePart/useMessagePartFile.ts +17 -0
- package/src/primitives/messagePart/useMessagePartImage.ts +17 -0
- package/src/primitives/messagePart/useMessagePartReasoning.ts +20 -0
- package/src/primitives/messagePart/useMessagePartSource.ts +17 -0
- package/src/primitives/messagePart/useMessagePartText.ts +22 -0
- package/src/primitives/selectionToolbar/SelectionToolbarQuote.tsx +62 -0
- package/src/primitives/selectionToolbar/SelectionToolbarRoot.tsx +131 -0
- package/src/primitives/selectionToolbar/index.ts +8 -0
- package/src/primitives/suggestion/SuggestionDescription.tsx +1 -1
- package/src/primitives/suggestion/SuggestionTitle.tsx +1 -1
- package/src/primitives/suggestion/{SuggestionTrigger.tsx → SuggestionTrigger.ts} +6 -3
- package/src/primitives/thread/{ThreadEmpty.tsx → ThreadEmpty.ts} +1 -1
- package/src/primitives/thread/{ThreadIf.tsx → ThreadIf.ts} +8 -8
- package/src/primitives/thread/ThreadMessages.tsx +4 -4
- package/src/primitives/thread/{ThreadSuggestion.tsx → ThreadSuggestion.ts} +5 -2
- package/src/primitives/thread/ThreadSuggestions.tsx +1 -1
- package/src/primitives/thread/ThreadViewportSlack.tsx +5 -5
- package/src/primitives/threadList/ThreadListItems.tsx +2 -2
- package/src/primitives/threadList/ThreadListNew.tsx +1 -1
- package/src/primitives/threadListItem/ThreadListItemRoot.tsx +1 -1
- package/src/primitives/threadListItem/ThreadListItemTitle.test.tsx +52 -0
- package/src/primitives/threadListItem/ThreadListItemTitle.tsx +1 -1
- package/src/tests/BaseComposerRuntimeCore.test.ts +318 -0
- package/src/tests/BaseSubscribable.test.ts +54 -0
- package/src/tests/DataRenderers.test.ts +223 -0
- package/src/tests/ExternalStoreThreadRuntimeCore.test.ts +510 -0
- package/src/tests/LocalThreadRuntimeCore.test.ts +321 -0
- package/src/tests/external-message-converter.test.ts +1 -1
- package/src/tests/shouldContinue.test.ts +89 -0
- package/src/types/{MessagePartComponentTypes.tsx → MessagePartComponentTypes.ts} +9 -2
- package/src/types/index.ts +9 -8
- package/src/types/scopes/dataRenderers.ts +15 -0
- package/src/types/scopes/index.ts +10 -22
- package/src/types/scopes/tools.ts +1 -2
- package/src/types/store-augmentation.ts +5 -25
- package/src/utils/getSelectionMessageId.ts +20 -0
- package/src/utils/smooth/SmoothContext.tsx +2 -2
- package/src/utils/smooth/{useSmooth.tsx → useSmooth.ts} +22 -11
- package/src/utils/{useToolArgsFieldStatus.tsx → useToolArgsFieldStatus.ts} +5 -5
- package/dist/client/ChainOfThoughtClient.d.ts +0 -15
- package/dist/client/ChainOfThoughtClient.d.ts.map +0 -1
- package/dist/client/ChainOfThoughtClient.js +0 -21
- package/dist/client/ChainOfThoughtClient.js.map +0 -1
- package/dist/client/ModelContextClient.d.ts +0 -3
- package/dist/client/ModelContextClient.d.ts.map +0 -1
- package/dist/client/ModelContextClient.js +0 -17
- package/dist/client/ModelContextClient.js.map +0 -1
- package/dist/client/NoOpComposerClient.d.ts +0 -7
- package/dist/client/NoOpComposerClient.d.ts.map +0 -1
- package/dist/client/NoOpComposerClient.js +0 -61
- package/dist/client/NoOpComposerClient.js.map +0 -1
- package/dist/client/Suggestions.d.ts +0 -11
- package/dist/client/Suggestions.d.ts.map +0 -1
- package/dist/client/Suggestions.js +0 -43
- package/dist/client/Suggestions.js.map +0 -1
- package/dist/client/ThreadMessageClient.d.ts +0 -11
- package/dist/client/ThreadMessageClient.d.ts.map +0 -1
- package/dist/client/ThreadMessageClient.js +0 -121
- package/dist/client/ThreadMessageClient.js.map +0 -1
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.d.ts +0 -8
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.d.ts.map +0 -1
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.js +0 -14
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.js.map +0 -1
- package/dist/legacy-runtime/client/ComposerRuntimeClient.d.ts +0 -13
- package/dist/legacy-runtime/client/ComposerRuntimeClient.d.ts.map +0 -1
- package/dist/legacy-runtime/client/ComposerRuntimeClient.js +0 -84
- package/dist/legacy-runtime/client/ComposerRuntimeClient.js.map +0 -1
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.d.ts +0 -8
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.d.ts.map +0 -1
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.js +0 -15
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.js.map +0 -1
- package/dist/legacy-runtime/client/MessageRuntimeClient.d.ts +0 -11
- package/dist/legacy-runtime/client/MessageRuntimeClient.d.ts.map +0 -1
- package/dist/legacy-runtime/client/MessageRuntimeClient.js +0 -81
- package/dist/legacy-runtime/client/MessageRuntimeClient.js.map +0 -1
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.d.ts +0 -8
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.d.ts.map +0 -1
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.js +0 -44
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.js.map +0 -1
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.d.ts +0 -11
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.d.ts.map +0 -1
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.js +0 -57
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.js.map +0 -1
- package/dist/legacy-runtime/client/ThreadRuntimeClient.d.ts +0 -8
- package/dist/legacy-runtime/client/ThreadRuntimeClient.d.ts.map +0 -1
- package/dist/legacy-runtime/client/ThreadRuntimeClient.js +0 -94
- package/dist/legacy-runtime/client/ThreadRuntimeClient.js.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/BaseSubject.d.ts +0 -11
- package/dist/legacy-runtime/runtime/subscribable/BaseSubject.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/BaseSubject.js +0 -31
- package/dist/legacy-runtime/runtime/subscribable/BaseSubject.js.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/EventSubscriptionSubject.d.ts +0 -13
- package/dist/legacy-runtime/runtime/subscribable/EventSubscriptionSubject.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/EventSubscriptionSubject.js +0 -37
- package/dist/legacy-runtime/runtime/subscribable/EventSubscriptionSubject.js.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/LazyMemoizeSubject.d.ts +0 -13
- package/dist/legacy-runtime/runtime/subscribable/LazyMemoizeSubject.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/LazyMemoizeSubject.js +0 -34
- package/dist/legacy-runtime/runtime/subscribable/LazyMemoizeSubject.js.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/NestedSubscriptionSubject.d.ts +0 -12
- package/dist/legacy-runtime/runtime/subscribable/NestedSubscriptionSubject.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/NestedSubscriptionSubject.js +0 -39
- package/dist/legacy-runtime/runtime/subscribable/NestedSubscriptionSubject.js.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/SKIP_UPDATE.d.ts +0 -3
- package/dist/legacy-runtime/runtime/subscribable/SKIP_UPDATE.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/SKIP_UPDATE.js +0 -2
- package/dist/legacy-runtime/runtime/subscribable/SKIP_UPDATE.js.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/ShallowMemoizeSubject.d.ts +0 -13
- package/dist/legacy-runtime/runtime/subscribable/ShallowMemoizeSubject.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/ShallowMemoizeSubject.js +0 -41
- package/dist/legacy-runtime/runtime/subscribable/ShallowMemoizeSubject.js.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/Subscribable.d.ts +0 -16
- package/dist/legacy-runtime/runtime/subscribable/Subscribable.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/Subscribable.js +0 -2
- package/dist/legacy-runtime/runtime/subscribable/Subscribable.js.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/shallowEqual.d.ts +0 -2
- package/dist/legacy-runtime/runtime/subscribable/shallowEqual.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime/subscribable/shallowEqual.js +0 -16
- package/dist/legacy-runtime/runtime/subscribable/shallowEqual.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/AttachmentAdapter.d.ts +0 -64
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/AttachmentAdapter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/AttachmentAdapter.js +0 -2
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/AttachmentAdapter.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CompositeAttachmentAdapter.d.ts +0 -13
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CompositeAttachmentAdapter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CompositeAttachmentAdapter.js +0 -79
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CompositeAttachmentAdapter.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/SimpleImageAttachmentAdapter.d.ts +0 -11
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/SimpleImageAttachmentAdapter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/SimpleImageAttachmentAdapter.js +0 -35
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/SimpleImageAttachmentAdapter.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/SimpleTextAttachmentAdapter.d.ts +0 -11
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/SimpleTextAttachmentAdapter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/SimpleTextAttachmentAdapter.js +0 -35
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/SimpleTextAttachmentAdapter.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/feedback/FeedbackAdapter.d.ts +0 -43
- package/dist/legacy-runtime/runtime-cores/adapters/feedback/FeedbackAdapter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/feedback/FeedbackAdapter.js +0 -2
- package/dist/legacy-runtime/runtime-cores/adapters/feedback/FeedbackAdapter.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/speech/SpeechAdapterTypes.d.ts +0 -110
- package/dist/legacy-runtime/runtime-cores/adapters/speech/SpeechAdapterTypes.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/speech/SpeechAdapterTypes.js +0 -2
- package/dist/legacy-runtime/runtime-cores/adapters/speech/SpeechAdapterTypes.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/speech/WebSpeechDictationAdapter.d.ts +0 -61
- package/dist/legacy-runtime/runtime-cores/adapters/speech/WebSpeechDictationAdapter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/speech/WebSpeechDictationAdapter.js +0 -152
- package/dist/legacy-runtime/runtime-cores/adapters/speech/WebSpeechDictationAdapter.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/speech/WebSpeechSynthesisAdapter.d.ts +0 -5
- package/dist/legacy-runtime/runtime-cores/adapters/speech/WebSpeechSynthesisAdapter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/speech/WebSpeechSynthesisAdapter.js +0 -42
- package/dist/legacy-runtime/runtime-cores/adapters/speech/WebSpeechSynthesisAdapter.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/suggestion/SuggestionAdapter.d.ts +0 -10
- package/dist/legacy-runtime/runtime-cores/adapters/suggestion/SuggestionAdapter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/suggestion/SuggestionAdapter.js +0 -2
- package/dist/legacy-runtime/runtime-cores/adapters/suggestion/SuggestionAdapter.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/thread-history/MessageFormatAdapter.d.ts +0 -21
- package/dist/legacy-runtime/runtime-cores/adapters/thread-history/MessageFormatAdapter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/thread-history/MessageFormatAdapter.js +0 -2
- package/dist/legacy-runtime/runtime-cores/adapters/thread-history/MessageFormatAdapter.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/thread-history/ThreadHistoryAdapter.d.ts +0 -16
- package/dist/legacy-runtime/runtime-cores/adapters/thread-history/ThreadHistoryAdapter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/thread-history/ThreadHistoryAdapter.js +0 -2
- package/dist/legacy-runtime/runtime-cores/adapters/thread-history/ThreadHistoryAdapter.js.map +0 -1
- package/dist/legacy-runtime/util-hooks/tapSubscribable.d.ts +0 -3
- package/dist/legacy-runtime/util-hooks/tapSubscribable.d.ts.map +0 -1
- package/dist/legacy-runtime/util-hooks/tapSubscribable.js +0 -12
- package/dist/legacy-runtime/util-hooks/tapSubscribable.js.map +0 -1
- package/dist/model-context/ModelContextTypes.d.ts +0 -29
- package/dist/model-context/ModelContextTypes.d.ts.map +0 -1
- package/dist/model-context/ModelContextTypes.js +0 -41
- package/dist/model-context/ModelContextTypes.js.map +0 -1
- package/dist/model-context/frame/AssistantFrameHost.d.ts +0 -37
- package/dist/model-context/frame/AssistantFrameHost.d.ts.map +0 -1
- package/dist/model-context/frame/AssistantFrameHost.js +0 -161
- package/dist/model-context/frame/AssistantFrameHost.js.map +0 -1
- package/dist/model-context/frame/AssistantFrameProvider.d.ts +0 -41
- package/dist/model-context/frame/AssistantFrameProvider.d.ts.map +0 -1
- package/dist/model-context/frame/AssistantFrameProvider.js +0 -167
- package/dist/model-context/frame/AssistantFrameProvider.js.map +0 -1
- package/dist/model-context/frame/AssistantFrameTypes.d.ts +0 -29
- package/dist/model-context/frame/AssistantFrameTypes.d.ts.map +0 -1
- package/dist/model-context/frame/AssistantFrameTypes.js +0 -2
- package/dist/model-context/frame/AssistantFrameTypes.js.map +0 -1
- package/dist/model-context/registry/ModelContextRegistry.d.ts +0 -19
- package/dist/model-context/registry/ModelContextRegistry.d.ts.map +0 -1
- package/dist/model-context/registry/ModelContextRegistry.js +0 -114
- package/dist/model-context/registry/ModelContextRegistry.js.map +0 -1
- package/dist/model-context/registry/ModelContextRegistryHandles.d.ts +0 -14
- package/dist/model-context/registry/ModelContextRegistryHandles.d.ts.map +0 -1
- package/dist/model-context/registry/ModelContextRegistryHandles.js +0 -2
- package/dist/model-context/registry/ModelContextRegistryHandles.js.map +0 -1
- package/dist/model-context/tool.d.ts +0 -3
- package/dist/model-context/tool.d.ts.map +0 -1
- package/dist/model-context/tool.js +0 -5
- package/dist/model-context/tool.js.map +0 -1
- package/dist/types/AssistantTypes.d.ts +0 -108
- package/dist/types/AssistantTypes.d.ts.map +0 -1
- package/dist/types/AssistantTypes.js +0 -2
- package/dist/types/AssistantTypes.js.map +0 -1
- package/dist/types/AttachmentTypes.d.ts +0 -35
- package/dist/types/AttachmentTypes.d.ts.map +0 -1
- package/dist/types/AttachmentTypes.js +0 -2
- package/dist/types/AttachmentTypes.js.map +0 -1
- package/dist/types/MessagePartTypes.d.ts +0 -62
- package/dist/types/MessagePartTypes.d.ts.map +0 -1
- package/dist/types/MessagePartTypes.js +0 -2
- package/dist/types/MessagePartTypes.js.map +0 -1
- package/dist/types/Unsubscribe.d.ts +0 -2
- package/dist/types/Unsubscribe.d.ts.map +0 -1
- package/dist/types/Unsubscribe.js +0 -2
- package/dist/types/Unsubscribe.js.map +0 -1
- package/dist/types/scopes/attachment.d.ts +0 -22
- package/dist/types/scopes/attachment.d.ts.map +0 -1
- package/dist/types/scopes/attachment.js +0 -2
- package/dist/types/scopes/attachment.js.map +0 -1
- package/dist/types/scopes/chainOfThought.d.ts +0 -40
- package/dist/types/scopes/chainOfThought.d.ts.map +0 -1
- package/dist/types/scopes/chainOfThought.js +0 -2
- package/dist/types/scopes/chainOfThought.js.map +0 -1
- package/dist/types/scopes/composer.d.ts +0 -67
- package/dist/types/scopes/composer.d.ts.map +0 -1
- package/dist/types/scopes/composer.js +0 -2
- package/dist/types/scopes/composer.js.map +0 -1
- package/dist/types/scopes/message.d.ts +0 -87
- package/dist/types/scopes/message.d.ts.map +0 -1
- package/dist/types/scopes/message.js +0 -2
- package/dist/types/scopes/message.js.map +0 -1
- package/dist/types/scopes/modelContext.d.ts +0 -12
- package/dist/types/scopes/modelContext.d.ts.map +0 -1
- package/dist/types/scopes/modelContext.js +0 -2
- package/dist/types/scopes/modelContext.js.map +0 -1
- package/dist/types/scopes/part.d.ts +0 -43
- package/dist/types/scopes/part.d.ts.map +0 -1
- package/dist/types/scopes/part.js +0 -2
- package/dist/types/scopes/part.js.map +0 -1
- package/dist/types/scopes/suggestion.d.ts +0 -20
- package/dist/types/scopes/suggestion.d.ts.map +0 -1
- package/dist/types/scopes/suggestion.js +0 -2
- package/dist/types/scopes/suggestion.js.map +0 -1
- package/dist/types/scopes/suggestions.d.ts +0 -20
- package/dist/types/scopes/suggestions.d.ts.map +0 -1
- package/dist/types/scopes/suggestions.js +0 -2
- package/dist/types/scopes/suggestions.js.map +0 -1
- package/dist/types/scopes/thread.d.ts +0 -138
- package/dist/types/scopes/thread.d.ts.map +0 -1
- package/dist/types/scopes/thread.js +0 -2
- package/dist/types/scopes/thread.js.map +0 -1
- package/dist/types/scopes/threadListItem.d.ts +0 -50
- package/dist/types/scopes/threadListItem.d.ts.map +0 -1
- package/dist/types/scopes/threadListItem.js +0 -2
- package/dist/types/scopes/threadListItem.js.map +0 -1
- package/dist/types/scopes/threads.d.ts +0 -28
- package/dist/types/scopes/threads.d.ts.map +0 -1
- package/dist/types/scopes/threads.js +0 -2
- package/dist/types/scopes/threads.js.map +0 -1
- package/dist/utils/CompositeContextProvider.d.ts +0 -10
- package/dist/utils/CompositeContextProvider.d.ts.map +0 -1
- package/dist/utils/CompositeContextProvider.js +0 -29
- package/dist/utils/CompositeContextProvider.js.map +0 -1
- package/dist/utils/getThreadMessageText.d.ts +0 -3
- package/dist/utils/getThreadMessageText.d.ts.map +0 -1
- package/dist/utils/getThreadMessageText.js +0 -5
- package/dist/utils/getThreadMessageText.js.map +0 -1
- package/dist/utils/idUtils.d.ts +0 -6
- package/dist/utils/idUtils.d.ts.map +0 -1
- package/dist/utils/idUtils.js +0 -9
- package/dist/utils/idUtils.js.map +0 -1
- package/src/client/ChainOfThoughtClient.ts +0 -43
- package/src/client/ModelContextClient.ts +0 -23
- package/src/client/NoOpComposerClient.tsx +0 -66
- package/src/client/Suggestions.ts +0 -74
- package/src/client/ThreadMessageClient.tsx +0 -178
- package/src/legacy-runtime/client/AttachmentRuntimeClient.ts +0 -19
- package/src/legacy-runtime/client/ComposerRuntimeClient.ts +0 -136
- package/src/legacy-runtime/client/MessagePartRuntimeClient.ts +0 -20
- package/src/legacy-runtime/client/MessageRuntimeClient.ts +0 -151
- package/src/legacy-runtime/client/ThreadListItemRuntimeClient.ts +0 -59
- package/src/legacy-runtime/client/ThreadListRuntimeClient.ts +0 -100
- package/src/legacy-runtime/client/ThreadRuntimeClient.ts +0 -148
- package/src/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.tsx +0 -182
- package/src/legacy-runtime/runtime/subscribable/BaseSubject.ts +0 -36
- package/src/legacy-runtime/runtime/subscribable/EventSubscriptionSubject.ts +0 -44
- package/src/legacy-runtime/runtime/subscribable/LazyMemoizeSubject.ts +0 -42
- package/src/legacy-runtime/runtime/subscribable/NestedSubscriptionSubject.ts +0 -58
- package/src/legacy-runtime/runtime/subscribable/SKIP_UPDATE.ts +0 -2
- package/src/legacy-runtime/runtime/subscribable/ShallowMemoizeSubject.ts +0 -47
- package/src/legacy-runtime/runtime/subscribable/Subscribable.ts +0 -26
- package/src/legacy-runtime/runtime/subscribable/shallowEqual.ts +0 -16
- package/src/legacy-runtime/runtime-cores/adapters/attachment/AttachmentAdapter.ts +0 -71
- package/src/legacy-runtime/runtime-cores/adapters/attachment/CompositeAttachmentAdapter.ts +0 -107
- package/src/legacy-runtime/runtime-cores/adapters/attachment/SimpleImageAttachmentAdapter.ts +0 -49
- package/src/legacy-runtime/runtime-cores/adapters/attachment/SimpleTextAttachmentAdapter.ts +0 -50
- package/src/legacy-runtime/runtime-cores/adapters/feedback/FeedbackAdapter.ts +0 -43
- package/src/legacy-runtime/runtime-cores/adapters/speech/SpeechAdapterTypes.ts +0 -121
- package/src/legacy-runtime/runtime-cores/adapters/speech/WebSpeechDictationAdapter.ts +0 -255
- package/src/legacy-runtime/runtime-cores/adapters/speech/WebSpeechSynthesisAdapter.ts +0 -48
- package/src/legacy-runtime/runtime-cores/adapters/suggestion/SuggestionAdapter.ts +0 -14
- package/src/legacy-runtime/runtime-cores/adapters/thread-history/MessageFormatAdapter.ts +0 -25
- package/src/legacy-runtime/runtime-cores/adapters/thread-history/ThreadHistoryAdapter.ts +0 -26
- package/src/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.tsx +0 -404
- package/src/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.tsx +0 -72
- package/src/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.tsx +0 -65
- package/src/legacy-runtime/runtime-cores/core/AssistantRuntimeCore.tsx +0 -19
- package/src/legacy-runtime/runtime-cores/core/BaseAssistantRuntimeCore.tsx +0 -20
- package/src/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.tsx +0 -237
- package/src/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.tsx +0 -86
- package/src/legacy-runtime/runtime-cores/core/ThreadListRuntimeCore.tsx +0 -49
- package/src/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.tsx +0 -154
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.tsx +0 -111
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreRuntimeCore.tsx +0 -26
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadListRuntimeCore.tsx +0 -235
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.tsx +0 -368
- package/src/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.tsx +0 -227
- package/src/legacy-runtime/runtime-cores/external-store/auto-status.tsx +0 -67
- package/src/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.tsx +0 -37
- package/src/legacy-runtime/runtime-cores/local/ChatModelAdapter.tsx +0 -64
- package/src/legacy-runtime/runtime-cores/local/LocalRuntimeCore.tsx +0 -32
- package/src/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.tsx +0 -60
- package/src/legacy-runtime/runtime-cores/local/LocalThreadListRuntimeCore.tsx +0 -116
- package/src/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.tsx +0 -519
- package/src/legacy-runtime/runtime-cores/local/shouldContinue.tsx +0 -26
- package/src/legacy-runtime/runtime-cores/remote-thread-list/BaseSubscribable.tsx +0 -41
- package/src/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.tsx +0 -194
- package/src/legacy-runtime/runtime-cores/remote-thread-list/adapter/in-memory.tsx +0 -43
- package/src/legacy-runtime/runtime-cores/remote-thread-list/types.tsx +0 -49
- package/src/legacy-runtime/runtime-cores/utils/MessageRepository.tsx +0 -551
- package/src/legacy-runtime/util-hooks/tapSubscribable.ts +0 -16
- package/src/model-context/ModelContextTypes.ts +0 -76
- package/src/model-context/frame/AssistantFrameHost.ts +0 -218
- package/src/model-context/frame/AssistantFrameProvider.ts +0 -230
- package/src/model-context/frame/AssistantFrameTypes.ts +0 -40
- package/src/model-context/registry/ModelContextRegistry.ts +0 -165
- package/src/model-context/registry/ModelContextRegistryHandles.ts +0 -19
- package/src/model-context/tool.ts +0 -9
- package/src/primitives/messagePart/useMessagePartFile.tsx +0 -18
- package/src/primitives/messagePart/useMessagePartImage.tsx +0 -18
- package/src/primitives/messagePart/useMessagePartReasoning.tsx +0 -18
- package/src/primitives/messagePart/useMessagePartSource.tsx +0 -18
- package/src/primitives/messagePart/useMessagePartText.tsx +0 -18
- package/src/tests/MessageRepository.test.ts +0 -786
- package/src/types/AssistantTypes.ts +0 -166
- package/src/types/AttachmentTypes.ts +0 -45
- package/src/types/MessagePartTypes.ts +0 -82
- package/src/types/Unsubscribe.tsx +0 -1
- package/src/types/scopes/attachment.ts +0 -22
- package/src/types/scopes/chainOfThought.ts +0 -42
- package/src/types/scopes/composer.ts +0 -68
- package/src/types/scopes/message.ts +0 -78
- package/src/types/scopes/modelContext.ts +0 -14
- package/src/types/scopes/part.ts +0 -49
- package/src/types/scopes/suggestion.ts +0 -20
- package/src/types/scopes/suggestions.ts +0 -21
- package/src/types/scopes/thread.ts +0 -141
- package/src/types/scopes/threadListItem.ts +0 -44
- package/src/types/scopes/threads.ts +0 -36
- package/src/utils/CompositeContextProvider.ts +0 -36
- package/src/utils/getThreadMessageText.tsx +0 -15
- package/src/utils/idUtils.tsx +0 -14
- /package/src/model-context/{makeAssistantTool.tsx → makeAssistantTool.ts} +0 -0
- /package/src/model-context/{makeAssistantToolUI.tsx → makeAssistantToolUI.ts} +0 -0
- /package/src/model-context/{toolbox.tsx → toolbox.ts} +0 -0
- /package/src/model-context/{useAssistantToolUI.tsx → useAssistantToolUI.ts} +0 -0
- /package/src/model-context/{useInlineRender.tsx → useInlineRender.ts} +0 -0
- /package/src/primitives/actionBar/{ActionBarReload.tsx → ActionBarReload.ts} +0 -0
- /package/src/primitives/actionBarMore/{scope.tsx → scope.ts} +0 -0
- /package/src/primitives/assistantModal/{scope.tsx → scope.ts} +0 -0
- /package/src/primitives/attachment/{AttachmentRemove.tsx → AttachmentRemove.ts} +0 -0
- /package/src/primitives/composer/{ComposerSend.tsx → ComposerSend.ts} +0 -0
- /package/src/primitives/reasoning/{useScrollLock.tsx → useScrollLock.ts} +0 -0
- /package/src/primitives/thread/{ThreadScrollToBottom.tsx → ThreadScrollToBottom.ts} +0 -0
- /package/src/primitives/thread/{useThreadViewportAutoScroll.tsx → useThreadViewportAutoScroll.ts} +0 -0
- /package/src/primitives/threadListItemMore/{scope.tsx → scope.ts} +0 -0
- /package/src/utils/{RequireAtLeastOne.tsx → RequireAtLeastOne.ts} +0 -0
- /package/src/utils/hooks/{useOnResizeContent.tsx → useOnResizeContent.ts} +0 -0
- /package/src/utils/hooks/{useOnScrollToBottom.tsx → useOnScrollToBottom.ts} +0 -0
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
import { RefObject, useState } from "react";
|
|
2
|
+
import type {
|
|
3
|
+
GenericThreadHistoryAdapter,
|
|
4
|
+
ThreadHistoryAdapter,
|
|
5
|
+
ExportedMessageRepositoryItem,
|
|
6
|
+
MessageFormatAdapter,
|
|
7
|
+
MessageFormatItem,
|
|
8
|
+
MessageFormatRepository,
|
|
9
|
+
} from "@assistant-ui/core";
|
|
10
|
+
import {
|
|
11
|
+
AssistantCloud,
|
|
12
|
+
CloudMessagePersistence,
|
|
13
|
+
createFormattedPersistence,
|
|
14
|
+
} from "assistant-cloud";
|
|
15
|
+
import { auiV0Decode, auiV0Encode } from "./auiV0";
|
|
16
|
+
import { AssistantClient, useAui } from "@assistant-ui/store";
|
|
17
|
+
import { ThreadListItemMethods } from "../../types/scopes";
|
|
18
|
+
|
|
19
|
+
const globalPersistence = new WeakMap<
|
|
20
|
+
ThreadListItemMethods,
|
|
21
|
+
CloudMessagePersistence
|
|
22
|
+
>();
|
|
23
|
+
|
|
24
|
+
class AssistantCloudThreadHistoryAdapter implements ThreadHistoryAdapter {
|
|
25
|
+
constructor(
|
|
26
|
+
private cloudRef: RefObject<AssistantCloud>,
|
|
27
|
+
private aui: AssistantClient,
|
|
28
|
+
) {}
|
|
29
|
+
|
|
30
|
+
private get _persistence(): CloudMessagePersistence {
|
|
31
|
+
const key = this.aui.threadListItem();
|
|
32
|
+
if (!globalPersistence.has(key)) {
|
|
33
|
+
globalPersistence.set(
|
|
34
|
+
key,
|
|
35
|
+
new CloudMessagePersistence(this.cloudRef.current),
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return globalPersistence.get(key)!;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
withFormat<TMessage, TStorageFormat extends Record<string, unknown>>(
|
|
42
|
+
formatAdapter: MessageFormatAdapter<TMessage, TStorageFormat>,
|
|
43
|
+
): GenericThreadHistoryAdapter<TMessage> {
|
|
44
|
+
const adapter = this;
|
|
45
|
+
const formatted = createFormattedPersistence(
|
|
46
|
+
this._persistence,
|
|
47
|
+
formatAdapter,
|
|
48
|
+
);
|
|
49
|
+
return {
|
|
50
|
+
// Note: callers must also call reportTelemetry() for run tracking
|
|
51
|
+
async append(item: MessageFormatItem<TMessage>) {
|
|
52
|
+
const { remoteId } = await adapter.aui.threadListItem().initialize();
|
|
53
|
+
await formatted.append(remoteId, item);
|
|
54
|
+
},
|
|
55
|
+
async update(item: MessageFormatItem<TMessage>, localMessageId: string) {
|
|
56
|
+
const remoteId = adapter.aui.threadListItem().getState().remoteId;
|
|
57
|
+
if (!remoteId) return;
|
|
58
|
+
await formatted.update?.(remoteId, item, localMessageId);
|
|
59
|
+
},
|
|
60
|
+
reportTelemetry(
|
|
61
|
+
items: MessageFormatItem<TMessage>[],
|
|
62
|
+
options?: {
|
|
63
|
+
durationMs?: number;
|
|
64
|
+
stepTimestamps?: StepTimestamp[];
|
|
65
|
+
},
|
|
66
|
+
) {
|
|
67
|
+
const encodedContents = items.map((item) => formatAdapter.encode(item));
|
|
68
|
+
adapter._reportBatchTelemetry(
|
|
69
|
+
formatAdapter.format,
|
|
70
|
+
encodedContents,
|
|
71
|
+
options,
|
|
72
|
+
);
|
|
73
|
+
},
|
|
74
|
+
async load(): Promise<MessageFormatRepository<TMessage>> {
|
|
75
|
+
const remoteId = adapter.aui.threadListItem().getState().remoteId;
|
|
76
|
+
if (!remoteId) return { messages: [] };
|
|
77
|
+
return formatted.load(remoteId);
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async append({ parentId, message }: ExportedMessageRepositoryItem) {
|
|
83
|
+
const { remoteId } = await this.aui.threadListItem().initialize();
|
|
84
|
+
const encoded = auiV0Encode(message);
|
|
85
|
+
await this._persistence.append(
|
|
86
|
+
remoteId,
|
|
87
|
+
message.id,
|
|
88
|
+
parentId,
|
|
89
|
+
"aui/v0",
|
|
90
|
+
encoded,
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
if (this.cloudRef.current.telemetry.enabled) {
|
|
94
|
+
this._maybeReportRun(remoteId, "aui/v0", encoded);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async load() {
|
|
99
|
+
const remoteId = this.aui.threadListItem().getState().remoteId;
|
|
100
|
+
if (!remoteId) return { messages: [] };
|
|
101
|
+
const messages = await this._persistence.load(remoteId, "aui/v0");
|
|
102
|
+
return {
|
|
103
|
+
messages: messages
|
|
104
|
+
.filter(
|
|
105
|
+
(m): m is typeof m & { format: "aui/v0" } => m.format === "aui/v0",
|
|
106
|
+
)
|
|
107
|
+
.map(auiV0Decode)
|
|
108
|
+
.reverse(),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
private _reportBatchTelemetry<T>(
|
|
113
|
+
format: string,
|
|
114
|
+
contents: T[],
|
|
115
|
+
options?: {
|
|
116
|
+
durationMs?: number;
|
|
117
|
+
stepTimestamps?: StepTimestamp[];
|
|
118
|
+
},
|
|
119
|
+
) {
|
|
120
|
+
if (!this.cloudRef.current.telemetry.enabled) return;
|
|
121
|
+
|
|
122
|
+
const remoteId = this.aui.threadListItem().getState().remoteId;
|
|
123
|
+
if (!remoteId) return;
|
|
124
|
+
|
|
125
|
+
const extracted = extractBatchTelemetry(format, contents);
|
|
126
|
+
if (!extracted) return;
|
|
127
|
+
|
|
128
|
+
this._sendReport(
|
|
129
|
+
remoteId,
|
|
130
|
+
extracted,
|
|
131
|
+
options?.durationMs,
|
|
132
|
+
options?.stepTimestamps,
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private _maybeReportRun<T>(remoteId: string, format: string, content: T) {
|
|
137
|
+
const extracted = extractTelemetry(format, content);
|
|
138
|
+
if (!extracted) return;
|
|
139
|
+
|
|
140
|
+
this._sendReport(remoteId, extracted);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
private _sendReport(
|
|
144
|
+
remoteId: string,
|
|
145
|
+
data: TelemetryData,
|
|
146
|
+
durationMs?: number,
|
|
147
|
+
stepTimestamps?: StepTimestamp[],
|
|
148
|
+
) {
|
|
149
|
+
const mergedSteps = mergeStepTimestamps(data.steps, stepTimestamps);
|
|
150
|
+
const initial: Parameters<typeof this.cloudRef.current.runs.report>[0] = {
|
|
151
|
+
thread_id: remoteId,
|
|
152
|
+
status: data.status,
|
|
153
|
+
...(data.totalSteps != null
|
|
154
|
+
? { total_steps: data.totalSteps }
|
|
155
|
+
: undefined),
|
|
156
|
+
...(data.toolCalls ? { tool_calls: data.toolCalls } : undefined),
|
|
157
|
+
...(mergedSteps ? { steps: mergedSteps } : undefined),
|
|
158
|
+
...(data.inputTokens != null
|
|
159
|
+
? { input_tokens: data.inputTokens }
|
|
160
|
+
: undefined),
|
|
161
|
+
...(data.outputTokens != null
|
|
162
|
+
? { output_tokens: data.outputTokens }
|
|
163
|
+
: undefined),
|
|
164
|
+
...(durationMs != null ? { duration_ms: durationMs } : undefined),
|
|
165
|
+
...(data.outputText != null
|
|
166
|
+
? { output_text: data.outputText }
|
|
167
|
+
: undefined),
|
|
168
|
+
...(data.metadata ? { metadata: data.metadata } : undefined),
|
|
169
|
+
...(data.modelId ? { model_id: data.modelId } : undefined),
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const { beforeReport } = this.cloudRef.current.telemetry;
|
|
173
|
+
const report = beforeReport ? beforeReport(initial) : initial;
|
|
174
|
+
if (!report) return;
|
|
175
|
+
|
|
176
|
+
this.cloudRef.current.runs.report(report).catch(() => {});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const MAX_SPAN_CONTENT = 50_000;
|
|
181
|
+
|
|
182
|
+
function truncateStr(value: string): string {
|
|
183
|
+
if (value.length <= MAX_SPAN_CONTENT) return value;
|
|
184
|
+
return value.slice(0, MAX_SPAN_CONTENT);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function safeStringify(value: unknown): string | undefined {
|
|
188
|
+
if (value == null) return undefined;
|
|
189
|
+
try {
|
|
190
|
+
return truncateStr(JSON.stringify(value));
|
|
191
|
+
} catch {
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
type TelemetryToolCall = {
|
|
197
|
+
tool_name: string;
|
|
198
|
+
tool_call_id: string;
|
|
199
|
+
tool_args?: string;
|
|
200
|
+
tool_result?: string;
|
|
201
|
+
tool_source?: "mcp" | "frontend" | "backend";
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
const BASE64_PATTERN = /^[A-Za-z0-9+/]{100,}={0,2}$/;
|
|
205
|
+
|
|
206
|
+
function summarizeMcpResult(value: unknown): string | undefined {
|
|
207
|
+
if (value == null) return undefined;
|
|
208
|
+
try {
|
|
209
|
+
const parsed = typeof value === "string" ? JSON.parse(value) : value;
|
|
210
|
+
if (Array.isArray(parsed)) {
|
|
211
|
+
const summarized = parsed.map((item) => {
|
|
212
|
+
if (item && typeof item === "object" && item.type) {
|
|
213
|
+
if (
|
|
214
|
+
(item.type === "image" || item.type === "audio") &&
|
|
215
|
+
typeof item.data === "string" &&
|
|
216
|
+
BASE64_PATTERN.test(item.data.slice(0, 200))
|
|
217
|
+
) {
|
|
218
|
+
const sizeKB = ((item.data.length * 3) / 4 / 1024).toFixed(1);
|
|
219
|
+
return { ...item, data: `[${item.type}: ${sizeKB}KB]` };
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return item;
|
|
223
|
+
});
|
|
224
|
+
return truncateStr(JSON.stringify(summarized));
|
|
225
|
+
}
|
|
226
|
+
} catch {
|
|
227
|
+
// not JSON array, fall through
|
|
228
|
+
}
|
|
229
|
+
return safeStringify(value);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function buildToolCall(
|
|
233
|
+
toolName: string,
|
|
234
|
+
toolCallId: string,
|
|
235
|
+
args: unknown,
|
|
236
|
+
result: unknown,
|
|
237
|
+
argsText?: string,
|
|
238
|
+
toolSource?: "mcp" | "frontend" | "backend",
|
|
239
|
+
): TelemetryToolCall {
|
|
240
|
+
const call: TelemetryToolCall = {
|
|
241
|
+
tool_name: toolName,
|
|
242
|
+
tool_call_id: toolCallId,
|
|
243
|
+
};
|
|
244
|
+
const toolArgs = argsText ?? safeStringify(args);
|
|
245
|
+
if (toolArgs !== undefined) call.tool_args = toolArgs;
|
|
246
|
+
const toolResult =
|
|
247
|
+
toolSource === "mcp" ? summarizeMcpResult(result) : safeStringify(result);
|
|
248
|
+
if (toolResult !== undefined) call.tool_result = toolResult;
|
|
249
|
+
if (toolSource) call.tool_source = toolSource;
|
|
250
|
+
return call;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
type TelemetryStepData = {
|
|
254
|
+
input_tokens?: number;
|
|
255
|
+
output_tokens?: number;
|
|
256
|
+
tool_calls?: TelemetryToolCall[];
|
|
257
|
+
start_ms?: number;
|
|
258
|
+
end_ms?: number;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
type StepTimestamp = { start_ms: number; end_ms: number };
|
|
262
|
+
|
|
263
|
+
function mergeStepTimestamps(
|
|
264
|
+
steps: TelemetryStepData[] | undefined,
|
|
265
|
+
timestamps: StepTimestamp[] | undefined,
|
|
266
|
+
): TelemetryStepData[] | undefined {
|
|
267
|
+
if (!timestamps) return steps;
|
|
268
|
+
if (!steps) return timestamps.map((t) => ({ ...t }));
|
|
269
|
+
|
|
270
|
+
const len = Math.min(steps.length, timestamps.length);
|
|
271
|
+
return steps.map((s, i) => ({
|
|
272
|
+
...s,
|
|
273
|
+
...(i < len ? timestamps[i] : undefined),
|
|
274
|
+
}));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
type TelemetryData = {
|
|
278
|
+
status: "completed" | "incomplete" | "error";
|
|
279
|
+
toolCalls?: TelemetryToolCall[];
|
|
280
|
+
totalSteps?: number;
|
|
281
|
+
inputTokens?: number;
|
|
282
|
+
outputTokens?: number;
|
|
283
|
+
outputText?: string;
|
|
284
|
+
metadata?: Record<string, unknown>;
|
|
285
|
+
steps?: TelemetryStepData[];
|
|
286
|
+
modelId?: string;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
function extractTelemetry<T>(format: string, content: T): TelemetryData | null {
|
|
290
|
+
switch (format) {
|
|
291
|
+
case "aui/v0":
|
|
292
|
+
return extractAuiV0(content);
|
|
293
|
+
case "ai-sdk/v6":
|
|
294
|
+
return extractAiSdkV6(content);
|
|
295
|
+
default:
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function extractBatchTelemetry<T>(
|
|
301
|
+
format: string,
|
|
302
|
+
contents: T[],
|
|
303
|
+
): TelemetryData | null {
|
|
304
|
+
if (format === "ai-sdk/v6") {
|
|
305
|
+
return extractAiSdkV6Batch(contents);
|
|
306
|
+
}
|
|
307
|
+
for (let i = contents.length - 1; i >= 0; i--) {
|
|
308
|
+
const result = extractTelemetry(format, contents[i]!);
|
|
309
|
+
if (result) return result;
|
|
310
|
+
}
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const AUI_STATUS_MAP: Record<string, TelemetryData["status"]> = {
|
|
315
|
+
error: "error",
|
|
316
|
+
incomplete: "incomplete",
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
function extractAuiV0<T>(content: T): TelemetryData | null {
|
|
320
|
+
const msg = content as {
|
|
321
|
+
role?: string;
|
|
322
|
+
status?: { type: string };
|
|
323
|
+
content?: readonly {
|
|
324
|
+
type: string;
|
|
325
|
+
text?: string;
|
|
326
|
+
toolName?: string;
|
|
327
|
+
toolCallId?: string;
|
|
328
|
+
args?: unknown;
|
|
329
|
+
argsText?: string;
|
|
330
|
+
result?: unknown;
|
|
331
|
+
}[];
|
|
332
|
+
metadata?: {
|
|
333
|
+
modelId?: string;
|
|
334
|
+
steps?: readonly {
|
|
335
|
+
usage?: { inputTokens?: number; outputTokens?: number };
|
|
336
|
+
}[];
|
|
337
|
+
custom?: Record<string, unknown> & { modelId?: string };
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
if (msg.role !== "assistant") return null;
|
|
342
|
+
|
|
343
|
+
const toolCalls = msg.content
|
|
344
|
+
?.filter((p) => p.type === "tool-call" && p.toolName && p.toolCallId)
|
|
345
|
+
.map((p) =>
|
|
346
|
+
buildToolCall(p.toolName!, p.toolCallId!, p.args, p.result, p.argsText),
|
|
347
|
+
);
|
|
348
|
+
|
|
349
|
+
const textParts = msg.content?.filter((p) => p.type === "text" && p.text);
|
|
350
|
+
const outputText =
|
|
351
|
+
textParts && textParts.length > 0
|
|
352
|
+
? truncateStr(textParts.map((p) => p.text).join(""))
|
|
353
|
+
: undefined;
|
|
354
|
+
|
|
355
|
+
const steps = msg.metadata?.steps;
|
|
356
|
+
let inputTokens: number | undefined;
|
|
357
|
+
let outputTokens: number | undefined;
|
|
358
|
+
if (steps && steps.length > 0) {
|
|
359
|
+
inputTokens = 0;
|
|
360
|
+
outputTokens = 0;
|
|
361
|
+
for (const step of steps) {
|
|
362
|
+
inputTokens += step.usage?.inputTokens ?? 0;
|
|
363
|
+
outputTokens += step.usage?.outputTokens ?? 0;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const statusType = msg.status?.type;
|
|
368
|
+
const status: TelemetryData["status"] =
|
|
369
|
+
(statusType && AUI_STATUS_MAP[statusType]) || "completed";
|
|
370
|
+
|
|
371
|
+
const metadata = msg.metadata?.custom as Record<string, unknown> | undefined;
|
|
372
|
+
const modelId =
|
|
373
|
+
msg.metadata?.modelId ??
|
|
374
|
+
(typeof msg.metadata?.custom?.modelId === "string"
|
|
375
|
+
? msg.metadata.custom.modelId
|
|
376
|
+
: undefined);
|
|
377
|
+
|
|
378
|
+
const telemetrySteps: TelemetryStepData[] | undefined =
|
|
379
|
+
steps && steps.length > 1
|
|
380
|
+
? steps.map((s) => ({
|
|
381
|
+
...(s.usage?.inputTokens != null
|
|
382
|
+
? { input_tokens: s.usage.inputTokens }
|
|
383
|
+
: undefined),
|
|
384
|
+
...(s.usage?.outputTokens != null
|
|
385
|
+
? { output_tokens: s.usage.outputTokens }
|
|
386
|
+
: undefined),
|
|
387
|
+
}))
|
|
388
|
+
: undefined;
|
|
389
|
+
|
|
390
|
+
return {
|
|
391
|
+
status,
|
|
392
|
+
...(toolCalls && toolCalls.length > 0 ? { toolCalls } : undefined),
|
|
393
|
+
...(steps?.length ? { totalSteps: steps.length } : undefined),
|
|
394
|
+
...(inputTokens != null ? { inputTokens } : undefined),
|
|
395
|
+
...(outputTokens != null ? { outputTokens } : undefined),
|
|
396
|
+
...(outputText != null ? { outputText } : undefined),
|
|
397
|
+
...(metadata ? { metadata } : undefined),
|
|
398
|
+
...(telemetrySteps ? { steps: telemetrySteps } : undefined),
|
|
399
|
+
...(modelId ? { modelId } : undefined),
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
type AiSdkV6Part = {
|
|
404
|
+
type: string;
|
|
405
|
+
text?: string;
|
|
406
|
+
toolName?: string;
|
|
407
|
+
toolCallId?: string;
|
|
408
|
+
args?: unknown;
|
|
409
|
+
result?: unknown;
|
|
410
|
+
input?: unknown;
|
|
411
|
+
output?: unknown;
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
type AiSdkV6Message = {
|
|
415
|
+
role?: string;
|
|
416
|
+
parts?: readonly AiSdkV6Part[];
|
|
417
|
+
metadata?: Record<string, unknown>;
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
function isToolCallPart(p: AiSdkV6Part): boolean {
|
|
421
|
+
if (!p.toolCallId) return false;
|
|
422
|
+
if (p.type === "tool-call" || p.type === "dynamic-tool") return !!p.toolName;
|
|
423
|
+
return p.type.startsWith("tool-") || p.type.startsWith("dynamic-tool-");
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
function isDynamicToolPart(p: AiSdkV6Part): boolean {
|
|
427
|
+
return p.type === "dynamic-tool" || p.type.startsWith("dynamic-tool-");
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function partToToolCall(p: AiSdkV6Part): TelemetryToolCall {
|
|
431
|
+
const toolSource: "mcp" | undefined = isDynamicToolPart(p)
|
|
432
|
+
? "mcp"
|
|
433
|
+
: undefined;
|
|
434
|
+
return buildToolCall(
|
|
435
|
+
p.toolName ?? p.type.slice(5),
|
|
436
|
+
p.toolCallId!,
|
|
437
|
+
p.args ?? p.input,
|
|
438
|
+
p.result ?? p.output,
|
|
439
|
+
undefined,
|
|
440
|
+
toolSource,
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
function collectAiSdkV6Parts(parts: readonly AiSdkV6Part[]): {
|
|
445
|
+
textParts: string[];
|
|
446
|
+
toolCalls: TelemetryToolCall[];
|
|
447
|
+
stepsData: { tool_calls: TelemetryToolCall[] }[];
|
|
448
|
+
} {
|
|
449
|
+
const textParts: string[] = [];
|
|
450
|
+
const toolCalls: TelemetryToolCall[] = [];
|
|
451
|
+
const stepsData: { tool_calls: TelemetryToolCall[] }[] = [];
|
|
452
|
+
let currentStepToolCalls: TelemetryToolCall[] | null = null;
|
|
453
|
+
|
|
454
|
+
for (const p of parts) {
|
|
455
|
+
if (p.type === "step-start") {
|
|
456
|
+
if (currentStepToolCalls !== null) {
|
|
457
|
+
stepsData.push({ tool_calls: currentStepToolCalls });
|
|
458
|
+
}
|
|
459
|
+
currentStepToolCalls = [];
|
|
460
|
+
} else if (p.type === "text" && p.text) {
|
|
461
|
+
textParts.push(p.text);
|
|
462
|
+
} else if (isToolCallPart(p)) {
|
|
463
|
+
const tc = partToToolCall(p);
|
|
464
|
+
toolCalls.push(tc);
|
|
465
|
+
if (currentStepToolCalls !== null) {
|
|
466
|
+
currentStepToolCalls.push(tc);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
if (currentStepToolCalls !== null) {
|
|
472
|
+
stepsData.push({ tool_calls: currentStepToolCalls });
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
return { textParts, toolCalls, stepsData };
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function extractModelId(
|
|
479
|
+
metadata?: Record<string, unknown>,
|
|
480
|
+
): string | undefined {
|
|
481
|
+
if (!metadata) return undefined;
|
|
482
|
+
if (typeof metadata.modelId === "string") return metadata.modelId;
|
|
483
|
+
const custom = metadata.custom as Record<string, unknown> | undefined;
|
|
484
|
+
if (typeof custom?.modelId === "string") return custom.modelId;
|
|
485
|
+
return undefined;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
function buildAiSdkV6Result(
|
|
489
|
+
textParts: string[],
|
|
490
|
+
toolCalls: TelemetryToolCall[],
|
|
491
|
+
totalSteps: number,
|
|
492
|
+
metadata?: Record<string, unknown>,
|
|
493
|
+
stepsData?: { tool_calls: TelemetryToolCall[] }[],
|
|
494
|
+
usage?: { inputTokens?: number; outputTokens?: number },
|
|
495
|
+
): TelemetryData {
|
|
496
|
+
const hasText = textParts.length > 0;
|
|
497
|
+
const outputText = hasText ? truncateStr(textParts.join("")) : undefined;
|
|
498
|
+
const modelId = extractModelId(metadata);
|
|
499
|
+
|
|
500
|
+
const steps: TelemetryStepData[] | undefined =
|
|
501
|
+
stepsData && stepsData.length > 1
|
|
502
|
+
? stepsData.map((s) => ({
|
|
503
|
+
...(s.tool_calls.length > 0
|
|
504
|
+
? { tool_calls: s.tool_calls }
|
|
505
|
+
: undefined),
|
|
506
|
+
}))
|
|
507
|
+
: undefined;
|
|
508
|
+
|
|
509
|
+
return {
|
|
510
|
+
status: hasText ? "completed" : "incomplete",
|
|
511
|
+
...(toolCalls.length > 0 ? { toolCalls } : undefined),
|
|
512
|
+
...(totalSteps > 0 ? { totalSteps } : undefined),
|
|
513
|
+
...(usage?.inputTokens != null
|
|
514
|
+
? { inputTokens: usage.inputTokens }
|
|
515
|
+
: undefined),
|
|
516
|
+
...(usage?.outputTokens != null
|
|
517
|
+
? { outputTokens: usage.outputTokens }
|
|
518
|
+
: undefined),
|
|
519
|
+
...(outputText != null ? { outputText } : undefined),
|
|
520
|
+
...(metadata ? { metadata } : undefined),
|
|
521
|
+
...(steps ? { steps } : undefined),
|
|
522
|
+
...(modelId ? { modelId } : undefined),
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
type UsageFields = {
|
|
527
|
+
inputTokens?: number;
|
|
528
|
+
outputTokens?: number;
|
|
529
|
+
promptTokens?: number;
|
|
530
|
+
completionTokens?: number;
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
function normalizeUsage(
|
|
534
|
+
u: UsageFields,
|
|
535
|
+
): { inputTokens: number; outputTokens: number } | undefined {
|
|
536
|
+
const input = u.inputTokens ?? u.promptTokens;
|
|
537
|
+
const output = u.outputTokens ?? u.completionTokens;
|
|
538
|
+
if (input == null && output == null) return undefined;
|
|
539
|
+
return {
|
|
540
|
+
inputTokens: input ?? 0,
|
|
541
|
+
outputTokens: output ?? 0,
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
function extractAiSdkV6Usage(
|
|
546
|
+
metadata?: Record<string, unknown>,
|
|
547
|
+
): { inputTokens?: number; outputTokens?: number } | undefined {
|
|
548
|
+
// Try top-level metadata.usage
|
|
549
|
+
const usage = metadata?.usage as UsageFields | undefined;
|
|
550
|
+
if (usage) {
|
|
551
|
+
const normalized = normalizeUsage(usage);
|
|
552
|
+
if (normalized) return normalized;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
// Try aggregating from metadata.steps[].usage
|
|
556
|
+
const steps = metadata?.steps as
|
|
557
|
+
| readonly { usage?: UsageFields }[]
|
|
558
|
+
| undefined;
|
|
559
|
+
if (steps && steps.length > 0) {
|
|
560
|
+
let inputTokens = 0;
|
|
561
|
+
let outputTokens = 0;
|
|
562
|
+
let hasAny = false;
|
|
563
|
+
for (const s of steps) {
|
|
564
|
+
if (!s.usage) continue;
|
|
565
|
+
const n = normalizeUsage(s.usage);
|
|
566
|
+
if (n) {
|
|
567
|
+
inputTokens += n.inputTokens;
|
|
568
|
+
outputTokens += n.outputTokens;
|
|
569
|
+
hasAny = true;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
if (hasAny) return { inputTokens, outputTokens };
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
return undefined;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
function extractAiSdkV6<T>(content: T): TelemetryData | null {
|
|
579
|
+
const msg = content as AiSdkV6Message;
|
|
580
|
+
if (msg.role !== "assistant") return null;
|
|
581
|
+
|
|
582
|
+
const { textParts, toolCalls, stepsData } = collectAiSdkV6Parts(
|
|
583
|
+
msg.parts ?? [],
|
|
584
|
+
);
|
|
585
|
+
return buildAiSdkV6Result(
|
|
586
|
+
textParts,
|
|
587
|
+
toolCalls,
|
|
588
|
+
stepsData.length,
|
|
589
|
+
msg.metadata,
|
|
590
|
+
stepsData,
|
|
591
|
+
extractAiSdkV6Usage(msg.metadata),
|
|
592
|
+
);
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
function extractAiSdkV6Batch<T>(contents: T[]): TelemetryData | null {
|
|
596
|
+
const allTextParts: string[] = [];
|
|
597
|
+
const allToolCalls: TelemetryToolCall[] = [];
|
|
598
|
+
const allStepsData: { tool_calls: TelemetryToolCall[] }[] = [];
|
|
599
|
+
let hasAssistant = false;
|
|
600
|
+
let metadata: Record<string, unknown> | undefined;
|
|
601
|
+
let aggregatedUsage:
|
|
602
|
+
| { inputTokens: number; outputTokens: number }
|
|
603
|
+
| undefined;
|
|
604
|
+
|
|
605
|
+
for (const content of contents) {
|
|
606
|
+
const msg = content as AiSdkV6Message;
|
|
607
|
+
if (msg.role !== "assistant") continue;
|
|
608
|
+
hasAssistant = true;
|
|
609
|
+
|
|
610
|
+
const { textParts, toolCalls, stepsData } = collectAiSdkV6Parts(
|
|
611
|
+
msg.parts ?? [],
|
|
612
|
+
);
|
|
613
|
+
allTextParts.push(...textParts);
|
|
614
|
+
allToolCalls.push(...toolCalls);
|
|
615
|
+
allStepsData.push(...stepsData);
|
|
616
|
+
if (msg.metadata) metadata = msg.metadata;
|
|
617
|
+
|
|
618
|
+
const usage = extractAiSdkV6Usage(msg.metadata);
|
|
619
|
+
if (usage) {
|
|
620
|
+
if (!aggregatedUsage)
|
|
621
|
+
aggregatedUsage = { inputTokens: 0, outputTokens: 0 };
|
|
622
|
+
aggregatedUsage.inputTokens += usage.inputTokens ?? 0;
|
|
623
|
+
aggregatedUsage.outputTokens += usage.outputTokens ?? 0;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
if (!hasAssistant) return null;
|
|
628
|
+
return buildAiSdkV6Result(
|
|
629
|
+
allTextParts,
|
|
630
|
+
allToolCalls,
|
|
631
|
+
allStepsData.length,
|
|
632
|
+
metadata,
|
|
633
|
+
allStepsData,
|
|
634
|
+
aggregatedUsage,
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export function useAssistantCloudThreadHistoryAdapter(
|
|
639
|
+
cloudRef: RefObject<AssistantCloud>,
|
|
640
|
+
): ThreadHistoryAdapter {
|
|
641
|
+
const aui = useAui();
|
|
642
|
+
const [adapter] = useState(
|
|
643
|
+
() => new AssistantCloudThreadHistoryAdapter(cloudRef, aui),
|
|
644
|
+
);
|
|
645
|
+
return adapter;
|
|
646
|
+
}
|