@assistant-ui/core 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/attachment.d.ts +43 -39
- package/dist/adapters/attachment.d.ts.map +1 -1
- package/dist/adapters/attachment.js +148 -183
- package/dist/adapters/attachment.js.map +1 -1
- package/dist/adapters/directive-formatter.d.ts +6 -2
- package/dist/adapters/directive-formatter.d.ts.map +1 -1
- package/dist/adapters/directive-formatter.js +36 -33
- package/dist/adapters/directive-formatter.js.map +1 -1
- package/dist/adapters/feedback.d.ts +9 -6
- package/dist/adapters/feedback.d.ts.map +1 -1
- package/dist/adapters/feedback.js +0 -2
- package/dist/adapters/index.d.ts +9 -13
- package/dist/adapters/index.js +5 -6
- package/dist/adapters/speech.d.ts +66 -63
- package/dist/adapters/speech.d.ts.map +1 -1
- package/dist/adapters/speech.js +170 -174
- package/dist/adapters/speech.js.map +1 -1
- package/dist/adapters/suggestion.d.ts +9 -6
- package/dist/adapters/suggestion.d.ts.map +1 -1
- package/dist/adapters/suggestion.js +0 -2
- package/dist/adapters/thread-history.d.ts +40 -37
- package/dist/adapters/thread-history.d.ts.map +1 -1
- package/dist/adapters/thread-history.js +0 -2
- package/dist/adapters/trigger.d.ts +9 -8
- package/dist/adapters/trigger.d.ts.map +1 -1
- package/dist/adapters/trigger.js +0 -2
- package/dist/adapters/voice.d.ts +46 -42
- package/dist/adapters/voice.d.ts.map +1 -1
- package/dist/adapters/voice.js +98 -107
- package/dist/adapters/voice.js.map +1 -1
- package/dist/index.d.ts +45 -53
- package/dist/index.js +16 -20
- package/dist/internal.d.ts +37 -8
- package/dist/internal.js +34 -18
- package/dist/model-context/frame/host.d.ts +23 -19
- package/dist/model-context/frame/host.d.ts.map +1 -1
- package/dist/model-context/frame/host.js +121 -135
- package/dist/model-context/frame/host.js.map +1 -1
- package/dist/model-context/frame/provider.d.ts +20 -16
- package/dist/model-context/frame/provider.d.ts.map +1 -1
- package/dist/model-context/frame/provider.js +115 -126
- package/dist/model-context/frame/provider.js.map +1 -1
- package/dist/model-context/frame/types.d.ts +25 -22
- package/dist/model-context/frame/types.d.ts.map +1 -1
- package/dist/model-context/frame/types.js +5 -1
- package/dist/model-context/frame/types.js.map +1 -1
- package/dist/model-context/registry-handles.d.ts +13 -9
- package/dist/model-context/registry-handles.d.ts.map +1 -1
- package/dist/model-context/registry-handles.js +0 -2
- package/dist/model-context/registry.d.ts +19 -15
- package/dist/model-context/registry.d.ts.map +1 -1
- package/dist/model-context/registry.js +93 -107
- package/dist/model-context/registry.js.map +1 -1
- package/dist/model-context/tool.d.ts +6 -2
- package/dist/model-context/tool.d.ts.map +1 -1
- package/dist/model-context/tool.js +30 -27
- package/dist/model-context/tool.js.map +1 -1
- package/dist/model-context/types.d.ts +37 -33
- package/dist/model-context/types.d.ts.map +1 -1
- package/dist/model-context/types.js +24 -38
- package/dist/model-context/types.js.map +1 -1
- package/dist/react/AssistantProvider.d.ts +12 -8
- package/dist/react/AssistantProvider.d.ts.map +1 -1
- package/dist/react/AssistantProvider.js +16 -9
- package/dist/react/AssistantProvider.js.map +1 -1
- package/dist/react/AssistantRuntimeProvider.d.ts +26 -18
- package/dist/react/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/react/AssistantRuntimeProvider.js +33 -25
- package/dist/react/AssistantRuntimeProvider.js.map +1 -1
- package/dist/react/RuntimeAdapter.d.ts +5 -2
- package/dist/react/RuntimeAdapter.d.ts.map +1 -1
- package/dist/react/RuntimeAdapter.js +11 -11
- package/dist/react/RuntimeAdapter.js.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts +14 -11
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js +136 -147
- package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
- package/dist/react/adapters/TitleGenerationAdapter.d.ts +8 -4
- package/dist/react/adapters/TitleGenerationAdapter.d.ts.map +1 -1
- package/dist/react/adapters/TitleGenerationAdapter.js +13 -13
- package/dist/react/adapters/TitleGenerationAdapter.js.map +1 -1
- package/dist/react/client/DataRenderers.d.ts +6 -2
- package/dist/react/client/DataRenderers.d.ts.map +1 -1
- package/dist/react/client/DataRenderers.js +53 -51
- package/dist/react/client/DataRenderers.js.map +1 -1
- package/dist/react/client/Interactables.d.ts +6 -2
- package/dist/react/client/Interactables.d.ts.map +1 -1
- package/dist/react/client/Interactables.js +251 -257
- package/dist/react/client/Interactables.js.map +1 -1
- package/dist/react/client/Tools.d.ts +13 -14
- package/dist/react/client/Tools.d.ts.map +1 -1
- package/dist/react/client/Tools.js +57 -68
- package/dist/react/client/Tools.js.map +1 -1
- package/dist/react/client/interactable-model-context.d.ts +10 -6
- package/dist/react/client/interactable-model-context.d.ts.map +1 -1
- package/dist/react/client/interactable-model-context.js +51 -59
- package/dist/react/client/interactable-model-context.js.map +1 -1
- package/dist/react/index.d.ts +95 -90
- package/dist/react/index.js +88 -96
- package/dist/react/model-context/makeAssistantDataUI.d.ts +9 -6
- package/dist/react/model-context/makeAssistantDataUI.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantDataUI.js +17 -13
- package/dist/react/model-context/makeAssistantDataUI.js.map +1 -1
- package/dist/react/model-context/makeAssistantTool.d.ts +9 -6
- package/dist/react/model-context/makeAssistantTool.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantTool.js +18 -14
- package/dist/react/model-context/makeAssistantTool.js.map +1 -1
- package/dist/react/model-context/makeAssistantToolUI.d.ts +9 -6
- package/dist/react/model-context/makeAssistantToolUI.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantToolUI.js +19 -15
- package/dist/react/model-context/makeAssistantToolUI.js.map +1 -1
- package/dist/react/model-context/toolbox.d.ts +13 -11
- package/dist/react/model-context/toolbox.d.ts.map +1 -1
- package/dist/react/model-context/toolbox.js +0 -2
- package/dist/react/model-context/useAssistantContext.d.ts +5 -3
- package/dist/react/model-context/useAssistantContext.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantContext.js +13 -14
- package/dist/react/model-context/useAssistantContext.js.map +1 -1
- package/dist/react/model-context/useAssistantDataUI.d.ts +9 -7
- package/dist/react/model-context/useAssistantDataUI.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantDataUI.js +19 -12
- package/dist/react/model-context/useAssistantDataUI.js.map +1 -1
- package/dist/react/model-context/useAssistantInstructions.d.ts +5 -3
- package/dist/react/model-context/useAssistantInstructions.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantInstructions.js +18 -16
- package/dist/react/model-context/useAssistantInstructions.js.map +1 -1
- package/dist/react/model-context/useAssistantInteractable.d.ts +12 -8
- package/dist/react/model-context/useAssistantInteractable.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantInteractable.js +36 -26
- package/dist/react/model-context/useAssistantInteractable.js.map +1 -1
- package/dist/react/model-context/useAssistantTool.d.ts +9 -6
- package/dist/react/model-context/useAssistantTool.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantTool.js +48 -47
- package/dist/react/model-context/useAssistantTool.js.map +1 -1
- package/dist/react/model-context/useAssistantToolUI.d.ts +9 -7
- package/dist/react/model-context/useAssistantToolUI.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantToolUI.js +22 -15
- package/dist/react/model-context/useAssistantToolUI.js.map +1 -1
- package/dist/react/model-context/useInlineRender.d.ts +7 -3
- package/dist/react/model-context/useInlineRender.d.ts.map +1 -1
- package/dist/react/model-context/useInlineRender.js +12 -12
- package/dist/react/model-context/useInlineRender.js.map +1 -1
- package/dist/react/model-context/useInteractableState.d.ts +9 -7
- package/dist/react/model-context/useInteractableState.d.ts.map +1 -1
- package/dist/react/model-context/useInteractableState.js +29 -31
- package/dist/react/model-context/useInteractableState.js.map +1 -1
- package/dist/react/model-context/useToolArgsStatus.d.ts +7 -7
- package/dist/react/model-context/useToolArgsStatus.d.ts.map +1 -1
- package/dist/react/model-context/useToolArgsStatus.js +44 -50
- package/dist/react/model-context/useToolArgsStatus.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.d.ts +13 -7
- package/dist/react/primitive-hooks/useActionBarCopy.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.js +31 -23
- package/dist/react/primitive-hooks/useActionBarCopy.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.d.ts +6 -3
- package/dist/react/primitive-hooks/useActionBarEdit.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.js +13 -7
- package/dist/react/primitive-hooks/useActionBarEdit.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.d.ts +9 -6
- package/dist/react/primitive-hooks/useActionBarFeedback.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.js +22 -14
- package/dist/react/primitive-hooks/useActionBarFeedback.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.d.ts +6 -3
- package/dist/react/primitive-hooks/useActionBarReload.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.js +13 -9
- package/dist/react/primitive-hooks/useActionBarReload.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.d.ts +6 -3
- package/dist/react/primitive-hooks/useActionBarSpeak.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.js +15 -11
- package/dist/react/primitive-hooks/useActionBarSpeak.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts +6 -3
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.js +13 -7
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.d.ts +6 -3
- package/dist/react/primitive-hooks/useBranchPickerNext.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.js +17 -14
- package/dist/react/primitive-hooks/useBranchPickerNext.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts +6 -3
- package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js +17 -14
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts +8 -4
- package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.js +13 -7
- package/dist/react/primitive-hooks/useComposerAddAttachment.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.d.ts +6 -3
- package/dist/react/primitive-hooks/useComposerCancel.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.js +13 -7
- package/dist/react/primitive-hooks/useComposerCancel.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.d.ts +6 -3
- package/dist/react/primitive-hooks/useComposerDictate.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.js +13 -9
- package/dist/react/primitive-hooks/useComposerDictate.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.d.ts +8 -4
- package/dist/react/primitive-hooks/useComposerSend.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.js +13 -8
- package/dist/react/primitive-hooks/useComposerSend.js.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.d.ts +5 -2
- package/dist/react/primitive-hooks/useEditComposerCancel.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.js +9 -6
- package/dist/react/primitive-hooks/useEditComposerCancel.js.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.d.ts +6 -3
- package/dist/react/primitive-hooks/useEditComposerSend.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.js +13 -7
- package/dist/react/primitive-hooks/useEditComposerSend.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.d.ts +8 -5
- package/dist/react/primitive-hooks/useMessageBranching.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.js +16 -11
- package/dist/react/primitive-hooks/useMessageBranching.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageError.d.ts +4 -1
- package/dist/react/primitive-hooks/useMessageError.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageError.js +6 -5
- package/dist/react/primitive-hooks/useMessageError.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageReload.d.ts +6 -3
- package/dist/react/primitive-hooks/useMessageReload.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageReload.js +13 -7
- package/dist/react/primitive-hooks/useMessageReload.js.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts +14 -7
- package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.js +33 -28
- package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts +4 -1
- package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsEmpty.js +6 -2
- package/dist/react/primitive-hooks/useThreadIsEmpty.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsRunning.d.ts +4 -1
- package/dist/react/primitive-hooks/useThreadIsRunning.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsRunning.js +6 -2
- package/dist/react/primitive-hooks/useThreadIsRunning.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts +5 -2
- package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.js +9 -6
- package/dist/react/primitive-hooks/useThreadListItemArchive.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts +5 -2
- package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.js +9 -6
- package/dist/react/primitive-hooks/useThreadListItemDelete.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts +5 -2
- package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.js +9 -6
- package/dist/react/primitive-hooks/useThreadListItemTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts +5 -2
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.js +9 -6
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.d.ts +6 -3
- package/dist/react/primitive-hooks/useThreadListLoadMore.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.js +13 -7
- package/dist/react/primitive-hooks/useThreadListLoadMore.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.d.ts +5 -2
- package/dist/react/primitive-hooks/useThreadListNew.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.js +9 -6
- package/dist/react/primitive-hooks/useThreadListNew.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadMessages.d.ts +6 -2
- package/dist/react/primitive-hooks/useThreadMessages.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadMessages.js +6 -2
- package/dist/react/primitive-hooks/useThreadMessages.js.map +1 -1
- package/dist/react/primitive-hooks/useVoice.d.ts +12 -8
- package/dist/react/primitive-hooks/useVoice.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useVoice.js +25 -21
- package/dist/react/primitive-hooks/useVoice.js.map +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts +26 -27
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts.map +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js +30 -28
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js.map +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.d.ts +27 -26
- package/dist/react/primitives/composer/ComposerAttachments.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.js +44 -48
- package/dist/react/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/react/primitives/composer/ComposerIf.d.ts +12 -13
- package/dist/react/primitives/composer/ComposerIf.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerIf.js +16 -17
- package/dist/react/primitives/composer/ComposerIf.js.map +1 -1
- package/dist/react/primitives/composer/ComposerQueue.d.ts +16 -13
- package/dist/react/primitives/composer/ComposerQueue.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerQueue.js +31 -23
- package/dist/react/primitives/composer/ComposerQueue.js.map +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.d.ts +64 -0
- package/dist/react/primitives/generativeUI/GenerativeUI.d.ts.map +1 -0
- package/dist/react/primitives/generativeUI/GenerativeUI.js +91 -0
- package/dist/react/primitives/generativeUI/GenerativeUI.js.map +1 -0
- package/dist/react/primitives/message/MessageAttachments.d.ts +27 -26
- package/dist/react/primitives/message/MessageAttachments.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageAttachments.js +47 -52
- package/dist/react/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.d.ts +73 -66
- package/dist/react/primitives/message/MessageGroupedParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.js +64 -60
- package/dist/react/primitives/message/MessageGroupedParts.js.map +1 -1
- package/dist/react/primitives/message/MessageParts.d.ts +147 -145
- package/dist/react/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageParts.js +358 -329
- package/dist/react/primitives/message/MessageParts.js.map +1 -1
- package/dist/react/primitives/message/MessageQuote.d.ts +11 -8
- package/dist/react/primitives/message/MessageQuote.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageQuote.js +24 -21
- package/dist/react/primitives/message/MessageQuote.js.map +1 -1
- package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts +8 -4
- package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts.map +1 -1
- package/dist/react/primitives/messagePart/MessagePartInProgress.js +6 -3
- package/dist/react/primitives/messagePart/MessagePartInProgress.js.map +1 -1
- package/dist/react/primitives/part/PartMessages.d.ts +16 -13
- package/dist/react/primitives/part/PartMessages.d.ts.map +1 -1
- package/dist/react/primitives/part/PartMessages.js +45 -41
- package/dist/react/primitives/part/PartMessages.js.map +1 -1
- package/dist/react/primitives/thread/ThreadMessages.d.ts +40 -55
- package/dist/react/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadMessages.js +58 -92
- package/dist/react/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.d.ts +25 -25
- package/dist/react/primitives/thread/ThreadSuggestions.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.js +39 -35
- package/dist/react/primitives/thread/ThreadSuggestions.js.map +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.d.ts +27 -26
- package/dist/react/primitives/threadList/ThreadListItems.d.ts.map +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.js +47 -23
- package/dist/react/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts +10 -6
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -1
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.js +7 -4
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.js.map +1 -1
- package/dist/react/providers/AttachmentByIndexProvider.d.ts +9 -5
- package/dist/react/providers/AttachmentByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/AttachmentByIndexProvider.js +30 -20
- package/dist/react/providers/AttachmentByIndexProvider.js.map +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts +8 -4
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.js +19 -17
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.js.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts +7 -3
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js +18 -11
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js.map +1 -1
- package/dist/react/providers/MessageByIndexProvider.d.ts +7 -3
- package/dist/react/providers/MessageByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/MessageByIndexProvider.js +25 -16
- package/dist/react/providers/MessageByIndexProvider.js.map +1 -1
- package/dist/react/providers/PartByIndexProvider.d.ts +7 -3
- package/dist/react/providers/PartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/PartByIndexProvider.js +18 -11
- package/dist/react/providers/PartByIndexProvider.js.map +1 -1
- package/dist/react/providers/QueueItemByIndexProvider.d.ts +8 -4
- package/dist/react/providers/QueueItemByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/QueueItemByIndexProvider.js +14 -10
- package/dist/react/providers/QueueItemByIndexProvider.js.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.d.ts +11 -7
- package/dist/react/providers/ReadonlyThreadProvider.d.ts.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.js +46 -42
- package/dist/react/providers/ReadonlyThreadProvider.js.map +1 -1
- package/dist/react/providers/SuggestionByIndexProvider.d.ts +8 -4
- package/dist/react/providers/SuggestionByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/SuggestionByIndexProvider.js +14 -10
- package/dist/react/providers/SuggestionByIndexProvider.js.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.d.ts +8 -4
- package/dist/react/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.js +29 -22
- package/dist/react/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.d.ts +8 -4
- package/dist/react/providers/ThreadListItemByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.js +22 -11
- package/dist/react/providers/ThreadListItemByIndexProvider.js.map +1 -1
- package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts +8 -4
- package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts.map +1 -1
- package/dist/react/providers/ThreadListItemRuntimeProvider.js +12 -8
- package/dist/react/providers/ThreadListItemRuntimeProvider.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +119 -109
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +123 -129
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +147 -135
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +460 -515
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts +19 -15
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts.map +1 -1
- package/dist/react/runtimes/RuntimeAdapterProvider.js +16 -9
- package/dist/react/runtimes/RuntimeAdapterProvider.js.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts +8 -4
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +372 -485
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts +19 -13
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js +83 -80
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.d.ts +61 -58
- package/dist/react/runtimes/cloud/auiV0.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.js +80 -87
- package/dist/react/runtimes/cloud/auiV0.js.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts +10 -7
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js +101 -101
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js.map +1 -1
- package/dist/react/runtimes/createMessageConverter.d.ts +23 -14
- package/dist/react/runtimes/createMessageConverter.d.ts.map +1 -1
- package/dist/react/runtimes/createMessageConverter.js +43 -46
- package/dist/react/runtimes/createMessageConverter.js.map +1 -1
- package/dist/react/runtimes/external-message-converter.d.ts +40 -31
- package/dist/react/runtimes/external-message-converter.d.ts.map +1 -1
- package/dist/react/runtimes/external-message-converter.js +222 -296
- package/dist/react/runtimes/external-message-converter.js.map +1 -1
- package/dist/react/runtimes/useExternalStoreRuntime.d.ts +7 -3
- package/dist/react/runtimes/useExternalStoreRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useExternalStoreRuntime.js +18 -15
- package/dist/react/runtimes/useExternalStoreRuntime.js.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.d.ts +41 -26
- package/dist/react/runtimes/useLocalRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.js +58 -67
- package/dist/react/runtimes/useLocalRuntime.js.map +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts +7 -3
- package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.js +51 -62
- package/dist/react/runtimes/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/react/runtimes/useToolInvocations.d.ts +39 -34
- package/dist/react/runtimes/useToolInvocations.d.ts.map +1 -1
- package/dist/react/runtimes/useToolInvocations.js +371 -481
- package/dist/react/runtimes/useToolInvocations.js.map +1 -1
- package/dist/react/types/MessagePartComponentTypes.d.ts +65 -41
- package/dist/react/types/MessagePartComponentTypes.d.ts.map +1 -1
- package/dist/react/types/MessagePartComponentTypes.js +0 -2
- package/dist/react/types/scopes/dataRenderers.d.ts +15 -11
- package/dist/react/types/scopes/dataRenderers.d.ts.map +1 -1
- package/dist/react/types/scopes/dataRenderers.js +0 -2
- package/dist/react/types/scopes/interactables.d.ts +44 -42
- package/dist/react/types/scopes/interactables.d.ts.map +1 -1
- package/dist/react/types/scopes/interactables.js +0 -2
- package/dist/react/types/scopes/tools.d.ts +16 -12
- package/dist/react/types/scopes/tools.d.ts.map +1 -1
- package/dist/react/types/scopes/tools.js +0 -2
- package/dist/react/types/store-augmentation.d.ts +11 -9
- package/dist/react/types/store-augmentation.d.ts.map +1 -1
- package/dist/react/types/store-augmentation.js +0 -2
- package/dist/react/utils/getMessageQuote.d.ts +9 -6
- package/dist/react/utils/getMessageQuote.d.ts.map +1 -1
- package/dist/react/utils/getMessageQuote.js +8 -5
- package/dist/react/utils/getMessageQuote.js.map +1 -1
- package/dist/react/utils/groupParts.d.ts +22 -19
- package/dist/react/utils/groupParts.d.ts.map +1 -1
- package/dist/react/utils/groupParts.js +62 -89
- package/dist/react/utils/groupParts.js.map +1 -1
- package/dist/runtime/api/assistant-runtime.d.ts +32 -28
- package/dist/runtime/api/assistant-runtime.d.ts.map +1 -1
- package/dist/runtime/api/assistant-runtime.js +25 -22
- package/dist/runtime/api/assistant-runtime.js.map +1 -1
- package/dist/runtime/api/attachment-runtime.d.ts +48 -45
- package/dist/runtime/api/attachment-runtime.d.ts.map +1 -1
- package/dist/runtime/api/attachment-runtime.js +55 -52
- package/dist/runtime/api/attachment-runtime.js.map +1 -1
- package/dist/runtime/api/bindings.d.ts +30 -25
- package/dist/runtime/api/bindings.d.ts.map +1 -1
- package/dist/runtime/api/bindings.js +0 -2
- package/dist/runtime/api/composer-runtime.d.ts +184 -182
- package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.js +239 -245
- package/dist/runtime/api/composer-runtime.js.map +1 -1
- package/dist/runtime/api/message-part-runtime.d.ts +29 -27
- package/dist/runtime/api/message-part-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-part-runtime.js +61 -65
- package/dist/runtime/api/message-part-runtime.js.map +1 -1
- package/dist/runtime/api/message-runtime.d.ts +91 -80
- package/dist/runtime/api/message-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-runtime.js +169 -194
- package/dist/runtime/api/message-runtime.js.map +1 -1
- package/dist/runtime/api/paths.d.ts +57 -54
- package/dist/runtime/api/paths.d.ts.map +1 -1
- package/dist/runtime/api/paths.js +0 -2
- package/dist/runtime/api/thread-list-item-runtime.d.ts +68 -61
- package/dist/runtime/api/thread-list-item-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.js +85 -84
- package/dist/runtime/api/thread-list-item-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-runtime.d.ts +57 -48
- package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-runtime.js +160 -147
- package/dist/runtime/api/thread-list-runtime.js.map +1 -1
- package/dist/runtime/api/thread-runtime.d.ts +278 -272
- package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-runtime.js +244 -244
- package/dist/runtime/api/thread-runtime.js.map +1 -1
- package/dist/runtime/base/base-assistant-runtime-core.d.ts +13 -9
- package/dist/runtime/base/base-assistant-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-assistant-runtime-core.js +13 -9
- package/dist/runtime/base/base-assistant-runtime-core.js.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.d.ts +60 -57
- package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.js +348 -392
- package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.d.ts +89 -84
- package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js +349 -357
- package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts +37 -30
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.js +70 -77
- package/dist/runtime/base/default-edit-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +25 -21
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js +51 -48
- package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts +12 -8
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/assistant-runtime-core.js +0 -2
- package/dist/runtime/interfaces/composer-runtime-core.d.ts +70 -67
- package/dist/runtime/interfaces/composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/composer-runtime-core.js +0 -2
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts +45 -39
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-list-runtime-core.js +0 -2
- package/dist/runtime/interfaces/thread-runtime-core.d.ts +149 -145
- package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-runtime-core.js +0 -2
- package/dist/runtime/internal.d.ts +19 -23
- package/dist/runtime/internal.js +18 -22
- package/dist/runtime/utils/auto-status.d.ts +8 -4
- package/dist/runtime/utils/auto-status.d.ts.map +1 -1
- package/dist/runtime/utils/auto-status.js +18 -22
- package/dist/runtime/utils/auto-status.js.map +1 -1
- package/dist/runtime/utils/chat-model-adapter.d.ts +34 -31
- package/dist/runtime/utils/chat-model-adapter.d.ts.map +1 -1
- package/dist/runtime/utils/chat-model-adapter.js +0 -2
- package/dist/runtime/utils/external-store-message.d.ts +9 -5
- package/dist/runtime/utils/external-store-message.d.ts.map +1 -1
- package/dist/runtime/utils/external-store-message.js +21 -21
- package/dist/runtime/utils/external-store-message.js.map +1 -1
- package/dist/runtime/utils/message-repository.d.ts +48 -42
- package/dist/runtime/utils/message-repository.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository.js +213 -267
- package/dist/runtime/utils/message-repository.js.map +1 -1
- package/dist/runtime/utils/thread-message-like.d.ts +41 -39
- package/dist/runtime/utils/thread-message-like.d.ts.map +1 -1
- package/dist/runtime/utils/thread-message-like.js +125 -139
- package/dist/runtime/utils/thread-message-like.js.map +1 -1
- package/dist/runtimes/assistant-transport/utils.d.ts +4 -1
- package/dist/runtimes/assistant-transport/utils.d.ts.map +1 -1
- package/dist/runtimes/assistant-transport/utils.js +9 -5
- package/dist/runtimes/assistant-transport/utils.js.map +1 -1
- package/dist/runtimes/external-store/external-store-adapter.d.ts +100 -97
- package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-adapter.js +0 -2
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts +9 -5
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-runtime-core.js +16 -13
- package/dist/runtimes/external-store/external-store-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts +46 -40
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js +141 -171
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +53 -47
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js +212 -288
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/thread-message-converter.d.ts +9 -5
- package/dist/runtimes/external-store/thread-message-converter.d.ts.map +1 -1
- package/dist/runtimes/external-store/thread-message-converter.js +14 -11
- package/dist/runtimes/external-store/thread-message-converter.js.map +1 -1
- package/dist/runtimes/internal.d.ts +15 -19
- package/dist/runtimes/internal.js +13 -17
- package/dist/runtimes/local/local-runtime-core.d.ts +11 -7
- package/dist/runtimes/local/local-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-runtime-core.js +18 -18
- package/dist/runtimes/local/local-runtime-core.js.map +1 -1
- package/dist/runtimes/local/local-runtime-options.d.ts +27 -23
- package/dist/runtimes/local/local-runtime-options.d.ts.map +1 -1
- package/dist/runtimes/local/local-runtime-options.js +0 -2
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts +46 -42
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-list-runtime-core.js +84 -83
- package/dist/runtimes/local/local-thread-list-runtime-core.js.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.d.ts +80 -59
- package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.js +342 -424
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/local/should-continue.d.ts +6 -2
- package/dist/runtimes/local/should-continue.d.ts.map +1 -1
- package/dist/runtimes/local/should-continue.js +7 -12
- package/dist/runtimes/local/should-continue.js.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +96 -92
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js +164 -176
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts +15 -11
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/in-memory.js +33 -28
- package/dist/runtimes/remote-thread-list/adapter/in-memory.js.map +1 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts +6 -2
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.js +152 -160
- package/dist/runtimes/remote-thread-list/empty-thread-core.js.map +1 -1
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts +27 -27
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/optimistic-state.js +63 -73
- package/dist/runtimes/remote-thread-list/optimistic-state.js.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts +46 -43
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.js +81 -91
- package/dist/runtimes/remote-thread-list/remote-thread-state.js.map +1 -1
- package/dist/runtimes/remote-thread-list/types.d.ts +65 -61
- package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/types.js +0 -2
- package/dist/store/clients/chain-of-thought-client.d.ts +16 -12
- package/dist/store/clients/chain-of-thought-client.d.ts.map +1 -1
- package/dist/store/clients/chain-of-thought-client.js +24 -15
- package/dist/store/clients/chain-of-thought-client.js.map +1 -1
- package/dist/store/clients/model-context-client.d.ts +6 -2
- package/dist/store/clients/model-context-client.d.ts.map +1 -1
- package/dist/store/clients/model-context-client.js +32 -26
- package/dist/store/clients/model-context-client.js.map +1 -1
- package/dist/store/clients/no-op-composer-client.d.ts +8 -4
- package/dist/store/clients/no-op-composer-client.d.ts.map +1 -1
- package/dist/store/clients/no-op-composer-client.js +67 -63
- package/dist/store/clients/no-op-composer-client.js.map +1 -1
- package/dist/store/clients/runtime-adapter.d.ts +8 -4
- package/dist/store/clients/runtime-adapter.d.ts.map +1 -1
- package/dist/store/clients/runtime-adapter.js +33 -33
- package/dist/store/clients/runtime-adapter.js.map +1 -1
- package/dist/store/clients/suggestions.d.ts +12 -8
- package/dist/store/clients/suggestions.d.ts.map +1 -1
- package/dist/store/clients/suggestions.js +28 -32
- package/dist/store/clients/suggestions.js.map +1 -1
- package/dist/store/clients/thread-message-client.d.ts +13 -9
- package/dist/store/clients/thread-message-client.d.ts.map +1 -1
- package/dist/store/clients/thread-message-client.js +95 -105
- package/dist/store/clients/thread-message-client.js.map +1 -1
- package/dist/store/index.d.ts +18 -18
- package/dist/store/index.js +6 -8
- package/dist/store/internal.d.ts +9 -9
- package/dist/store/internal.js +9 -9
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts +9 -5
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/attachment-runtime-client.js +12 -8
- package/dist/store/runtime-clients/attachment-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.d.ts +14 -10
- package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.js +86 -89
- package/dist/store/runtime-clients/composer-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts +9 -5
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.js +13 -9
- package/dist/store/runtime-clients/message-part-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.d.ts +12 -8
- package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.js +66 -70
- package/dist/store/runtime-clients/message-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/tap-subscribable.d.ts +6 -2
- package/dist/store/runtime-clients/tap-subscribable.d.ts.map +1 -1
- package/dist/store/runtime-clients/tap-subscribable.js +14 -10
- package/dist/store/runtime-clients/tap-subscribable.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts +9 -5
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.js +33 -38
- package/dist/store/runtime-clients/thread-list-item-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts +12 -8
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.js +53 -53
- package/dist/store/runtime-clients/thread-list-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.d.ts +9 -5
- package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.js +93 -85
- package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
- package/dist/store/scope-registration.d.ts +29 -27
- package/dist/store/scope-registration.d.ts.map +1 -1
- package/dist/store/scope-registration.js +0 -2
- package/dist/store/scopes/attachment.d.ts +23 -19
- package/dist/store/scopes/attachment.d.ts.map +1 -1
- package/dist/store/scopes/attachment.js +0 -2
- package/dist/store/scopes/chain-of-thought.d.ts +36 -33
- package/dist/store/scopes/chain-of-thought.d.ts.map +1 -1
- package/dist/store/scopes/chain-of-thought.js +0 -2
- package/dist/store/scopes/composer.d.ts +118 -115
- package/dist/store/scopes/composer.d.ts.map +1 -1
- package/dist/store/scopes/composer.js +0 -2
- package/dist/store/scopes/message.d.ts +81 -81
- package/dist/store/scopes/message.d.ts.map +1 -1
- package/dist/store/scopes/message.js +0 -2
- package/dist/store/scopes/model-context.d.ts +14 -10
- package/dist/store/scopes/model-context.d.ts.map +1 -1
- package/dist/store/scopes/model-context.js +0 -2
- package/dist/store/scopes/part.d.ts +42 -39
- package/dist/store/scopes/part.d.ts.map +1 -1
- package/dist/store/scopes/part.js +0 -2
- package/dist/store/scopes/queue-item.d.ts +18 -15
- package/dist/store/scopes/queue-item.d.ts.map +1 -1
- package/dist/store/scopes/queue-item.js +0 -2
- package/dist/store/scopes/suggestion.d.ts +17 -14
- package/dist/store/scopes/suggestion.d.ts.map +1 -1
- package/dist/store/scopes/suggestion.js +0 -2
- package/dist/store/scopes/suggestions.d.ts +18 -14
- package/dist/store/scopes/suggestions.d.ts.map +1 -1
- package/dist/store/scopes/suggestions.js +0 -2
- package/dist/store/scopes/thread-list-item.d.ts +62 -56
- package/dist/store/scopes/thread-list-item.d.ts.map +1 -1
- package/dist/store/scopes/thread-list-item.js +0 -2
- package/dist/store/scopes/thread.d.ts +151 -149
- package/dist/store/scopes/thread.d.ts.map +1 -1
- package/dist/store/scopes/thread.js +0 -2
- package/dist/store/scopes/threads.d.ts +36 -30
- package/dist/store/scopes/threads.d.ts.map +1 -1
- package/dist/store/scopes/threads.js +0 -2
- package/dist/subscribable/subscribable.d.ts +62 -58
- package/dist/subscribable/subscribable.d.ts.map +1 -1
- package/dist/subscribable/subscribable.js +196 -220
- package/dist/subscribable/subscribable.js.map +1 -1
- package/dist/tests/remote-thread-list-test-helpers.d.ts +13 -9
- package/dist/tests/remote-thread-list-test-helpers.d.ts.map +1 -1
- package/dist/tests/remote-thread-list-test-helpers.js +49 -42
- package/dist/tests/remote-thread-list-test-helpers.js.map +1 -1
- package/dist/types/attachment.d.ts +35 -32
- package/dist/types/attachment.d.ts.map +1 -1
- package/dist/types/attachment.js +0 -2
- package/dist/types/directive.d.ts +15 -13
- package/dist/types/directive.d.ts.map +1 -1
- package/dist/types/directive.js +0 -2
- package/dist/types/index.d.ts +7 -7
- package/dist/types/index.js +0 -2
- package/dist/types/message.d.ts +238 -214
- package/dist/types/message.d.ts.map +1 -1
- package/dist/types/message.js +6 -2
- package/dist/types/message.js.map +1 -1
- package/dist/types/quote.d.ts +6 -3
- package/dist/types/quote.d.ts.map +1 -1
- package/dist/types/quote.js +0 -2
- package/dist/types/trigger.d.ts +14 -10
- package/dist/types/trigger.d.ts.map +1 -1
- package/dist/types/trigger.js +0 -2
- package/dist/types/unsubscribe.d.ts +4 -1
- package/dist/types/unsubscribe.d.ts.map +1 -1
- package/dist/types/unsubscribe.js +0 -2
- package/dist/utils/composite-context-provider.d.ts +11 -8
- package/dist/utils/composite-context-provider.d.ts.map +1 -1
- package/dist/utils/composite-context-provider.js +31 -28
- package/dist/utils/composite-context-provider.js.map +1 -1
- package/dist/utils/id.d.ts +8 -5
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/id.js +9 -5
- package/dist/utils/id.js.map +1 -1
- package/dist/utils/json/is-json-equal.d.ts +4 -1
- package/dist/utils/json/is-json-equal.d.ts.map +1 -1
- package/dist/utils/json/is-json-equal.js +20 -25
- package/dist/utils/json/is-json-equal.js.map +1 -1
- package/dist/utils/json/is-json.d.ts +9 -5
- package/dist/utils/json/is-json.d.ts.map +1 -1
- package/dist/utils/json/is-json.js +17 -28
- package/dist/utils/json/is-json.js.map +1 -1
- package/dist/utils/text.d.ts +6 -2
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/text.js +6 -3
- package/dist/utils/text.js.map +1 -1
- package/package.json +12 -12
- package/src/index.ts +3 -0
- package/src/react/index.ts +17 -0
- package/src/react/primitives/generativeUI/GenerativeUI.tsx +182 -0
- package/src/react/primitives/message/MessageGroupedParts.tsx +2 -1
- package/src/react/primitives/message/MessageParts.tsx +70 -15
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.tsx +11 -7
- package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +7 -2
- package/src/react/runtimes/cloud/auiV0.ts +1 -1
- package/src/react/types/MessagePartComponentTypes.ts +26 -0
- package/src/runtime/api/thread-list-item-runtime.ts +3 -3
- package/src/runtime/api/thread-list-runtime.ts +9 -3
- package/src/runtime/base/base-thread-runtime-core.ts +8 -0
- package/src/runtime/interfaces/thread-list-runtime-core.ts +4 -1
- package/src/runtime/interfaces/thread-runtime-core.ts +6 -5
- package/src/runtime/utils/thread-message-like.ts +11 -3
- package/src/runtimes/external-store/external-store-thread-list-runtime-core.ts +4 -1
- package/src/store/runtime-clients/thread-list-runtime-client.ts +2 -2
- package/src/store/scopes/thread-list-item.ts +1 -1
- package/src/store/scopes/threads.ts +1 -1
- package/src/tests/RemoteThreadListThreadListRuntimeCore-switchToThread-unarchive.test.ts +88 -0
- package/src/tests/external-store-thread-runtime-core.test.ts +83 -0
- package/src/types/index.ts +3 -0
- package/src/types/message.ts +49 -1
- package/dist/adapters/feedback.js.map +0 -1
- package/dist/adapters/index.d.ts.map +0 -1
- package/dist/adapters/index.js.map +0 -1
- package/dist/adapters/suggestion.js.map +0 -1
- package/dist/adapters/thread-history.js.map +0 -1
- package/dist/adapters/trigger.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/internal.d.ts.map +0 -1
- package/dist/internal.js.map +0 -1
- package/dist/model-context/registry-handles.js.map +0 -1
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react/index.js.map +0 -1
- package/dist/react/model-context/toolbox.js.map +0 -1
- package/dist/react/types/MessagePartComponentTypes.js.map +0 -1
- package/dist/react/types/scopes/dataRenderers.js.map +0 -1
- package/dist/react/types/scopes/interactables.js.map +0 -1
- package/dist/react/types/scopes/tools.js.map +0 -1
- package/dist/react/types/store-augmentation.js.map +0 -1
- package/dist/runtime/api/bindings.js.map +0 -1
- package/dist/runtime/api/paths.js.map +0 -1
- package/dist/runtime/interfaces/assistant-runtime-core.js.map +0 -1
- package/dist/runtime/interfaces/composer-runtime-core.js.map +0 -1
- package/dist/runtime/interfaces/thread-list-runtime-core.js.map +0 -1
- package/dist/runtime/interfaces/thread-runtime-core.js.map +0 -1
- package/dist/runtime/internal.d.ts.map +0 -1
- package/dist/runtime/internal.js.map +0 -1
- package/dist/runtime/utils/chat-model-adapter.js.map +0 -1
- package/dist/runtimes/external-store/external-store-adapter.js.map +0 -1
- package/dist/runtimes/internal.d.ts.map +0 -1
- package/dist/runtimes/internal.js.map +0 -1
- package/dist/runtimes/local/local-runtime-options.js.map +0 -1
- package/dist/runtimes/remote-thread-list/types.js.map +0 -1
- package/dist/store/index.d.ts.map +0 -1
- package/dist/store/index.js.map +0 -1
- package/dist/store/internal.d.ts.map +0 -1
- package/dist/store/internal.js.map +0 -1
- package/dist/store/scope-registration.js.map +0 -1
- package/dist/store/scopes/attachment.js.map +0 -1
- package/dist/store/scopes/chain-of-thought.js.map +0 -1
- package/dist/store/scopes/composer.js.map +0 -1
- package/dist/store/scopes/message.js.map +0 -1
- package/dist/store/scopes/model-context.js.map +0 -1
- package/dist/store/scopes/part.js.map +0 -1
- package/dist/store/scopes/queue-item.js.map +0 -1
- package/dist/store/scopes/suggestion.js.map +0 -1
- package/dist/store/scopes/suggestions.js.map +0 -1
- package/dist/store/scopes/thread-list-item.js.map +0 -1
- package/dist/store/scopes/thread.js.map +0 -1
- package/dist/store/scopes/threads.js.map +0 -1
- package/dist/types/attachment.js.map +0 -1
- package/dist/types/directive.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/quote.js.map +0 -1
- package/dist/types/trigger.js.map +0 -1
- package/dist/types/unsubscribe.js.map +0 -1
|
@@ -1,528 +1,415 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import { CloudMessagePersistence, createFormattedPersistence, } from "assistant-cloud";
|
|
3
1
|
import { auiV0Decode, auiV0Encode } from "./auiV0.js";
|
|
2
|
+
import { useState } from "react";
|
|
4
3
|
import { useAui } from "@assistant-ui/store";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
? { total_steps: data.totalSteps }
|
|
93
|
-
: undefined),
|
|
94
|
-
...(data.toolCalls ? { tool_calls: data.toolCalls } : undefined),
|
|
95
|
-
...(mergedSteps ? { steps: mergedSteps } : undefined),
|
|
96
|
-
...(data.inputTokens != null
|
|
97
|
-
? { input_tokens: data.inputTokens }
|
|
98
|
-
: undefined),
|
|
99
|
-
...(data.outputTokens != null
|
|
100
|
-
? { output_tokens: data.outputTokens }
|
|
101
|
-
: undefined),
|
|
102
|
-
...(data.reasoningTokens != null
|
|
103
|
-
? { reasoning_tokens: data.reasoningTokens }
|
|
104
|
-
: undefined),
|
|
105
|
-
...(data.cachedInputTokens != null
|
|
106
|
-
? { cached_input_tokens: data.cachedInputTokens }
|
|
107
|
-
: undefined),
|
|
108
|
-
...(durationMs != null ? { duration_ms: durationMs } : undefined),
|
|
109
|
-
...(data.outputText != null
|
|
110
|
-
? { output_text: data.outputText }
|
|
111
|
-
: undefined),
|
|
112
|
-
...(data.metadata ? { metadata: data.metadata } : undefined),
|
|
113
|
-
...(data.modelId ? { model_id: data.modelId } : undefined),
|
|
114
|
-
};
|
|
115
|
-
const { beforeReport } = this.cloudRef.current.telemetry;
|
|
116
|
-
const report = beforeReport ? beforeReport(initial) : initial;
|
|
117
|
-
if (!report)
|
|
118
|
-
return;
|
|
119
|
-
this.cloudRef.current.runs.report(report).catch(() => { });
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
const MAX_SPAN_CONTENT = 50_000;
|
|
4
|
+
import { CloudMessagePersistence, createFormattedPersistence } from "assistant-cloud";
|
|
5
|
+
//#region src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.ts
|
|
6
|
+
const globalPersistence = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
var AssistantCloudThreadHistoryAdapter = class {
|
|
8
|
+
cloudRef;
|
|
9
|
+
aui;
|
|
10
|
+
constructor(cloudRef, aui) {
|
|
11
|
+
this.cloudRef = cloudRef;
|
|
12
|
+
this.aui = aui;
|
|
13
|
+
}
|
|
14
|
+
get _persistence() {
|
|
15
|
+
const key = this.aui.threadListItem();
|
|
16
|
+
if (!globalPersistence.has(key)) globalPersistence.set(key, new CloudMessagePersistence(this.cloudRef.current));
|
|
17
|
+
return globalPersistence.get(key);
|
|
18
|
+
}
|
|
19
|
+
withFormat(formatAdapter) {
|
|
20
|
+
const adapter = this;
|
|
21
|
+
const formatted = createFormattedPersistence(this._persistence, formatAdapter);
|
|
22
|
+
return {
|
|
23
|
+
async append(item) {
|
|
24
|
+
const { remoteId } = await adapter.aui.threadListItem().initialize();
|
|
25
|
+
await formatted.append(remoteId, item);
|
|
26
|
+
},
|
|
27
|
+
async update(item, localMessageId) {
|
|
28
|
+
const remoteId = adapter.aui.threadListItem().getState().remoteId;
|
|
29
|
+
if (!remoteId) return;
|
|
30
|
+
await formatted.update?.(remoteId, item, localMessageId);
|
|
31
|
+
},
|
|
32
|
+
reportTelemetry(items, options) {
|
|
33
|
+
const encodedRunMessages = items.map((item) => formatAdapter.encode(item));
|
|
34
|
+
adapter._reportRunTelemetry(formatAdapter.format, encodedRunMessages, options);
|
|
35
|
+
},
|
|
36
|
+
async load() {
|
|
37
|
+
const remoteId = adapter.aui.threadListItem().getState().remoteId;
|
|
38
|
+
if (!remoteId) return { messages: [] };
|
|
39
|
+
return formatted.load(remoteId);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
async append({ parentId, message }) {
|
|
44
|
+
const { remoteId } = await this.aui.threadListItem().initialize();
|
|
45
|
+
const encoded = auiV0Encode(message);
|
|
46
|
+
await this._persistence.append(remoteId, message.id, parentId, "aui/v0", encoded);
|
|
47
|
+
if (this.cloudRef.current.telemetry.enabled) this._maybeReportRun(remoteId, "aui/v0", encoded);
|
|
48
|
+
}
|
|
49
|
+
async load() {
|
|
50
|
+
const remoteId = this.aui.threadListItem().getState().remoteId;
|
|
51
|
+
if (!remoteId) return { messages: [] };
|
|
52
|
+
return { messages: (await this._persistence.load(remoteId, "aui/v0")).filter((m) => m.format === "aui/v0").map(auiV0Decode).reverse() };
|
|
53
|
+
}
|
|
54
|
+
_reportRunTelemetry(format, runMessages, options) {
|
|
55
|
+
if (!this.cloudRef.current.telemetry.enabled) return;
|
|
56
|
+
const remoteId = this.aui.threadListItem().getState().remoteId;
|
|
57
|
+
if (!remoteId) return;
|
|
58
|
+
const extracted = extractRunTelemetry(format, runMessages);
|
|
59
|
+
if (!extracted) return;
|
|
60
|
+
this._sendReport(remoteId, extracted, options?.durationMs, options?.stepTimestamps);
|
|
61
|
+
}
|
|
62
|
+
_maybeReportRun(remoteId, format, content) {
|
|
63
|
+
const extracted = extractTelemetry(format, content);
|
|
64
|
+
if (!extracted) return;
|
|
65
|
+
this._sendReport(remoteId, extracted);
|
|
66
|
+
}
|
|
67
|
+
_sendReport(remoteId, data, durationMs, stepTimestamps) {
|
|
68
|
+
const mergedSteps = mergeStepTimestamps(data.steps, stepTimestamps);
|
|
69
|
+
const initial = {
|
|
70
|
+
thread_id: remoteId,
|
|
71
|
+
status: data.status,
|
|
72
|
+
...data.totalSteps != null ? { total_steps: data.totalSteps } : void 0,
|
|
73
|
+
...data.toolCalls ? { tool_calls: data.toolCalls } : void 0,
|
|
74
|
+
...mergedSteps ? { steps: mergedSteps } : void 0,
|
|
75
|
+
...data.inputTokens != null ? { input_tokens: data.inputTokens } : void 0,
|
|
76
|
+
...data.outputTokens != null ? { output_tokens: data.outputTokens } : void 0,
|
|
77
|
+
...data.reasoningTokens != null ? { reasoning_tokens: data.reasoningTokens } : void 0,
|
|
78
|
+
...data.cachedInputTokens != null ? { cached_input_tokens: data.cachedInputTokens } : void 0,
|
|
79
|
+
...durationMs != null ? { duration_ms: durationMs } : void 0,
|
|
80
|
+
...data.outputText != null ? { output_text: data.outputText } : void 0,
|
|
81
|
+
...data.metadata ? { metadata: data.metadata } : void 0,
|
|
82
|
+
...data.modelId ? { model_id: data.modelId } : void 0
|
|
83
|
+
};
|
|
84
|
+
const { beforeReport } = this.cloudRef.current.telemetry;
|
|
85
|
+
const report = beforeReport ? beforeReport(initial) : initial;
|
|
86
|
+
if (!report) return;
|
|
87
|
+
this.cloudRef.current.runs.report(report).catch(() => {});
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const MAX_SPAN_CONTENT = 5e4;
|
|
123
91
|
function truncateStr(value) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return value.slice(0, MAX_SPAN_CONTENT);
|
|
92
|
+
if (value.length <= MAX_SPAN_CONTENT) return value;
|
|
93
|
+
return value.slice(0, MAX_SPAN_CONTENT);
|
|
127
94
|
}
|
|
128
95
|
function safeStringify(value) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return undefined;
|
|
136
|
-
}
|
|
96
|
+
if (value == null) return void 0;
|
|
97
|
+
try {
|
|
98
|
+
return truncateStr(JSON.stringify(value));
|
|
99
|
+
} catch {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
137
102
|
}
|
|
138
103
|
const BASE64_PATTERN = /^[A-Za-z0-9+/]{100,}={0,2}$/;
|
|
139
104
|
function summarizeMcpResult(value) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
// not JSON array, fall through
|
|
161
|
-
}
|
|
162
|
-
return safeStringify(value);
|
|
105
|
+
if (value == null) return void 0;
|
|
106
|
+
try {
|
|
107
|
+
const parsed = typeof value === "string" ? JSON.parse(value) : value;
|
|
108
|
+
if (Array.isArray(parsed)) {
|
|
109
|
+
const summarized = parsed.map((item) => {
|
|
110
|
+
if (item && typeof item === "object" && item.type) {
|
|
111
|
+
if ((item.type === "image" || item.type === "audio") && typeof item.data === "string" && BASE64_PATTERN.test(item.data.slice(0, 200))) {
|
|
112
|
+
const sizeKB = (item.data.length * 3 / 4 / 1024).toFixed(1);
|
|
113
|
+
return {
|
|
114
|
+
...item,
|
|
115
|
+
data: `[${item.type}: ${sizeKB}KB]`
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return item;
|
|
120
|
+
});
|
|
121
|
+
return truncateStr(JSON.stringify(summarized));
|
|
122
|
+
}
|
|
123
|
+
} catch {}
|
|
124
|
+
return safeStringify(value);
|
|
163
125
|
}
|
|
164
126
|
function buildToolCall(toolName, toolCallId, args, result, argsText, toolSource) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
if (toolSource)
|
|
176
|
-
call.tool_source = toolSource;
|
|
177
|
-
return call;
|
|
127
|
+
const call = {
|
|
128
|
+
tool_name: toolName,
|
|
129
|
+
tool_call_id: toolCallId
|
|
130
|
+
};
|
|
131
|
+
const toolArgs = argsText ?? safeStringify(args);
|
|
132
|
+
if (toolArgs !== void 0) call.tool_args = toolArgs;
|
|
133
|
+
const toolResult = toolSource === "mcp" ? summarizeMcpResult(result) : safeStringify(result);
|
|
134
|
+
if (toolResult !== void 0) call.tool_result = toolResult;
|
|
135
|
+
if (toolSource) call.tool_source = toolSource;
|
|
136
|
+
return call;
|
|
178
137
|
}
|
|
179
138
|
function mergeStepTimestamps(steps, timestamps) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
...(i < len ? timestamps[i] : undefined),
|
|
188
|
-
}));
|
|
139
|
+
if (!timestamps) return steps;
|
|
140
|
+
if (!steps) return timestamps.map((t) => ({ ...t }));
|
|
141
|
+
const len = Math.min(steps.length, timestamps.length);
|
|
142
|
+
return steps.map((s, i) => ({
|
|
143
|
+
...s,
|
|
144
|
+
...i < len ? timestamps[i] : void 0
|
|
145
|
+
}));
|
|
189
146
|
}
|
|
190
147
|
function extractTelemetry(format, content) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
default:
|
|
197
|
-
return null;
|
|
198
|
-
}
|
|
148
|
+
switch (format) {
|
|
149
|
+
case "aui/v0": return extractAuiV0(content);
|
|
150
|
+
case "ai-sdk/v6": return extractAiSdkV6(content);
|
|
151
|
+
default: return null;
|
|
152
|
+
}
|
|
199
153
|
}
|
|
200
154
|
function extractRunTelemetry(format, runMessages) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
return result;
|
|
208
|
-
}
|
|
209
|
-
return null;
|
|
155
|
+
if (format === "ai-sdk/v6") return aggregateAiSdkV6RunSteps(runMessages);
|
|
156
|
+
for (let i = runMessages.length - 1; i >= 0; i--) {
|
|
157
|
+
const result = extractTelemetry(format, runMessages[i]);
|
|
158
|
+
if (result) return result;
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
210
161
|
}
|
|
211
162
|
const AUI_STATUS_MAP = {
|
|
212
|
-
|
|
213
|
-
|
|
163
|
+
error: "error",
|
|
164
|
+
incomplete: "incomplete"
|
|
214
165
|
};
|
|
215
166
|
function extractAuiV0(content) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
...(s.usage?.cachedInputTokens != null
|
|
282
|
-
? { cached_input_tokens: s.usage.cachedInputTokens }
|
|
283
|
-
: undefined),
|
|
284
|
-
}))
|
|
285
|
-
: undefined;
|
|
286
|
-
return {
|
|
287
|
-
status,
|
|
288
|
-
...(toolCalls && toolCalls.length > 0 ? { toolCalls } : undefined),
|
|
289
|
-
...(steps?.length ? { totalSteps: steps.length } : undefined),
|
|
290
|
-
...(inputTokens != null ? { inputTokens } : undefined),
|
|
291
|
-
...(outputTokens != null ? { outputTokens } : undefined),
|
|
292
|
-
...(reasoningTokens != null ? { reasoningTokens } : undefined),
|
|
293
|
-
...(cachedInputTokens != null ? { cachedInputTokens } : undefined),
|
|
294
|
-
...(outputText != null ? { outputText } : undefined),
|
|
295
|
-
...(metadata ? { metadata } : undefined),
|
|
296
|
-
...(telemetrySteps ? { steps: telemetrySteps } : undefined),
|
|
297
|
-
...(modelId ? { modelId } : undefined),
|
|
298
|
-
};
|
|
167
|
+
const msg = content;
|
|
168
|
+
if (msg.role !== "assistant") return null;
|
|
169
|
+
const toolCalls = msg.content?.filter((p) => p.type === "tool-call" && p.toolName && p.toolCallId).map((p) => buildToolCall(p.toolName, p.toolCallId, p.args, p.result, p.argsText));
|
|
170
|
+
const textParts = msg.content?.filter((p) => p.type === "text" && p.text);
|
|
171
|
+
const outputText = textParts && textParts.length > 0 ? truncateStr(textParts.map((p) => p.text).join("")) : void 0;
|
|
172
|
+
const steps = msg.metadata?.steps;
|
|
173
|
+
let inputTokens;
|
|
174
|
+
let outputTokens;
|
|
175
|
+
let reasoningTokens;
|
|
176
|
+
let cachedInputTokens;
|
|
177
|
+
if (steps && steps.length > 0) {
|
|
178
|
+
let totalInput = 0;
|
|
179
|
+
let totalOutput = 0;
|
|
180
|
+
let totalReasoning = 0;
|
|
181
|
+
let totalCachedInput = 0;
|
|
182
|
+
let hasInput = false;
|
|
183
|
+
let hasOutput = false;
|
|
184
|
+
let hasReasoning = false;
|
|
185
|
+
let hasCachedInput = false;
|
|
186
|
+
for (const step of steps) {
|
|
187
|
+
if (step.usage?.inputTokens != null) {
|
|
188
|
+
totalInput += step.usage.inputTokens;
|
|
189
|
+
hasInput = true;
|
|
190
|
+
}
|
|
191
|
+
if (step.usage?.outputTokens != null) {
|
|
192
|
+
totalOutput += step.usage.outputTokens;
|
|
193
|
+
hasOutput = true;
|
|
194
|
+
}
|
|
195
|
+
if (step.usage?.reasoningTokens != null) {
|
|
196
|
+
totalReasoning += step.usage.reasoningTokens;
|
|
197
|
+
hasReasoning = true;
|
|
198
|
+
}
|
|
199
|
+
if (step.usage?.cachedInputTokens != null) {
|
|
200
|
+
totalCachedInput += step.usage.cachedInputTokens;
|
|
201
|
+
hasCachedInput = true;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
inputTokens = hasInput ? totalInput : void 0;
|
|
205
|
+
outputTokens = hasOutput ? totalOutput : void 0;
|
|
206
|
+
reasoningTokens = hasReasoning ? totalReasoning : void 0;
|
|
207
|
+
cachedInputTokens = hasCachedInput ? totalCachedInput : void 0;
|
|
208
|
+
}
|
|
209
|
+
const statusType = msg.status?.type;
|
|
210
|
+
const status = statusType && AUI_STATUS_MAP[statusType] || "completed";
|
|
211
|
+
const metadata = msg.metadata?.custom;
|
|
212
|
+
const modelId = msg.metadata?.modelId ?? (typeof msg.metadata?.custom?.modelId === "string" ? msg.metadata.custom.modelId : void 0);
|
|
213
|
+
const telemetrySteps = steps && steps.length > 1 ? steps.map((s) => ({
|
|
214
|
+
...s.usage?.inputTokens != null ? { input_tokens: s.usage.inputTokens } : void 0,
|
|
215
|
+
...s.usage?.outputTokens != null ? { output_tokens: s.usage.outputTokens } : void 0,
|
|
216
|
+
...s.usage?.reasoningTokens != null ? { reasoning_tokens: s.usage.reasoningTokens } : void 0,
|
|
217
|
+
...s.usage?.cachedInputTokens != null ? { cached_input_tokens: s.usage.cachedInputTokens } : void 0
|
|
218
|
+
})) : void 0;
|
|
219
|
+
return {
|
|
220
|
+
status,
|
|
221
|
+
...toolCalls && toolCalls.length > 0 ? { toolCalls } : void 0,
|
|
222
|
+
...steps?.length ? { totalSteps: steps.length } : void 0,
|
|
223
|
+
...inputTokens != null ? { inputTokens } : void 0,
|
|
224
|
+
...outputTokens != null ? { outputTokens } : void 0,
|
|
225
|
+
...reasoningTokens != null ? { reasoningTokens } : void 0,
|
|
226
|
+
...cachedInputTokens != null ? { cachedInputTokens } : void 0,
|
|
227
|
+
...outputText != null ? { outputText } : void 0,
|
|
228
|
+
...metadata ? { metadata } : void 0,
|
|
229
|
+
...telemetrySteps ? { steps: telemetrySteps } : void 0,
|
|
230
|
+
...modelId ? { modelId } : void 0
|
|
231
|
+
};
|
|
299
232
|
}
|
|
300
233
|
function isToolCallPart(p) {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
return !!p.toolName;
|
|
305
|
-
return p.type.startsWith("tool-") || p.type.startsWith("dynamic-tool-");
|
|
234
|
+
if (!p.toolCallId) return false;
|
|
235
|
+
if (p.type === "tool-call" || p.type === "dynamic-tool") return !!p.toolName;
|
|
236
|
+
return p.type.startsWith("tool-") || p.type.startsWith("dynamic-tool-");
|
|
306
237
|
}
|
|
307
238
|
function isDynamicToolPart(p) {
|
|
308
|
-
|
|
239
|
+
return p.type === "dynamic-tool" || p.type.startsWith("dynamic-tool-");
|
|
309
240
|
}
|
|
310
241
|
function partToToolCall(p) {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
: undefined;
|
|
314
|
-
return buildToolCall(p.toolName ?? p.type.slice(5), p.toolCallId, p.args ?? p.input, p.result ?? p.output, undefined, toolSource);
|
|
242
|
+
const toolSource = isDynamicToolPart(p) ? "mcp" : void 0;
|
|
243
|
+
return buildToolCall(p.toolName ?? p.type.slice(5), p.toolCallId, p.args ?? p.input, p.result ?? p.output, void 0, toolSource);
|
|
315
244
|
}
|
|
316
245
|
function collectAiSdkV6Parts(parts) {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
if (currentStepToolCalls !== null) {
|
|
340
|
-
stepsData.push({ tool_calls: currentStepToolCalls });
|
|
341
|
-
}
|
|
342
|
-
return { textParts, toolCalls, stepsData };
|
|
246
|
+
const textParts = [];
|
|
247
|
+
const toolCalls = [];
|
|
248
|
+
const stepsData = [];
|
|
249
|
+
let currentStepToolCalls = null;
|
|
250
|
+
for (const p of parts) if (p.type === "step-start") {
|
|
251
|
+
if (currentStepToolCalls !== null) stepsData.push({ tool_calls: currentStepToolCalls });
|
|
252
|
+
currentStepToolCalls = [];
|
|
253
|
+
} else if (p.type === "text" && p.text) textParts.push(p.text);
|
|
254
|
+
else if (isToolCallPart(p)) {
|
|
255
|
+
const tc = partToToolCall(p);
|
|
256
|
+
toolCalls.push(tc);
|
|
257
|
+
if (currentStepToolCalls !== null) currentStepToolCalls.push(tc);
|
|
258
|
+
}
|
|
259
|
+
if (currentStepToolCalls !== null) stepsData.push({ tool_calls: currentStepToolCalls });
|
|
260
|
+
return {
|
|
261
|
+
textParts,
|
|
262
|
+
toolCalls,
|
|
263
|
+
stepsData
|
|
264
|
+
};
|
|
343
265
|
}
|
|
344
266
|
function extractModelId(metadata) {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
const custom = metadata.custom;
|
|
350
|
-
if (typeof custom?.modelId === "string")
|
|
351
|
-
return custom.modelId;
|
|
352
|
-
return undefined;
|
|
267
|
+
if (!metadata) return void 0;
|
|
268
|
+
if (typeof metadata.modelId === "string") return metadata.modelId;
|
|
269
|
+
const custom = metadata.custom;
|
|
270
|
+
if (typeof custom?.modelId === "string") return custom.modelId;
|
|
353
271
|
}
|
|
354
272
|
function buildAiSdkV6Result(textParts, toolCalls, totalSteps, metadata, stepsData, usage) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
...(usage?.outputTokens != null
|
|
373
|
-
? { outputTokens: usage.outputTokens }
|
|
374
|
-
: undefined),
|
|
375
|
-
...(usage?.reasoningTokens != null
|
|
376
|
-
? { reasoningTokens: usage.reasoningTokens }
|
|
377
|
-
: undefined),
|
|
378
|
-
...(usage?.cachedInputTokens != null
|
|
379
|
-
? { cachedInputTokens: usage.cachedInputTokens }
|
|
380
|
-
: undefined),
|
|
381
|
-
...(outputText != null ? { outputText } : undefined),
|
|
382
|
-
...(metadata ? { metadata } : undefined),
|
|
383
|
-
...(steps ? { steps } : undefined),
|
|
384
|
-
...(modelId ? { modelId } : undefined),
|
|
385
|
-
};
|
|
273
|
+
const hasText = textParts.length > 0;
|
|
274
|
+
const outputText = hasText ? truncateStr(textParts.join("")) : void 0;
|
|
275
|
+
const modelId = extractModelId(metadata);
|
|
276
|
+
const steps = stepsData && stepsData.length > 1 ? stepsData.map((s) => ({ ...s.tool_calls.length > 0 ? { tool_calls: s.tool_calls } : void 0 })) : void 0;
|
|
277
|
+
return {
|
|
278
|
+
status: hasText ? "completed" : "incomplete",
|
|
279
|
+
...toolCalls.length > 0 ? { toolCalls } : void 0,
|
|
280
|
+
...totalSteps > 0 ? { totalSteps } : void 0,
|
|
281
|
+
...usage?.inputTokens != null ? { inputTokens: usage.inputTokens } : void 0,
|
|
282
|
+
...usage?.outputTokens != null ? { outputTokens: usage.outputTokens } : void 0,
|
|
283
|
+
...usage?.reasoningTokens != null ? { reasoningTokens: usage.reasoningTokens } : void 0,
|
|
284
|
+
...usage?.cachedInputTokens != null ? { cachedInputTokens: usage.cachedInputTokens } : void 0,
|
|
285
|
+
...outputText != null ? { outputText } : void 0,
|
|
286
|
+
...metadata ? { metadata } : void 0,
|
|
287
|
+
...steps ? { steps } : void 0,
|
|
288
|
+
...modelId ? { modelId } : void 0
|
|
289
|
+
};
|
|
386
290
|
}
|
|
387
291
|
function normalizeUsage(u) {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
...(input != null ? { inputTokens: input } : undefined),
|
|
398
|
-
...(output != null ? { outputTokens: output } : undefined),
|
|
399
|
-
...(u.reasoningTokens != null
|
|
400
|
-
? { reasoningTokens: u.reasoningTokens }
|
|
401
|
-
: undefined),
|
|
402
|
-
...(u.cachedInputTokens != null
|
|
403
|
-
? { cachedInputTokens: u.cachedInputTokens }
|
|
404
|
-
: undefined),
|
|
405
|
-
};
|
|
292
|
+
const input = u.inputTokens ?? u.promptTokens;
|
|
293
|
+
const output = u.outputTokens ?? u.completionTokens;
|
|
294
|
+
if (input == null && output == null && u.reasoningTokens == null && u.cachedInputTokens == null) return;
|
|
295
|
+
return {
|
|
296
|
+
...input != null ? { inputTokens: input } : void 0,
|
|
297
|
+
...output != null ? { outputTokens: output } : void 0,
|
|
298
|
+
...u.reasoningTokens != null ? { reasoningTokens: u.reasoningTokens } : void 0,
|
|
299
|
+
...u.cachedInputTokens != null ? { cachedInputTokens: u.cachedInputTokens } : void 0
|
|
300
|
+
};
|
|
406
301
|
}
|
|
407
302
|
function extractAiSdkV6Usage(metadata) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
...(hasOutput ? { outputTokens } : undefined),
|
|
455
|
-
...(hasReasoning ? { reasoningTokens } : undefined),
|
|
456
|
-
...(hasCachedInput ? { cachedInputTokens } : undefined),
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
return undefined;
|
|
303
|
+
const usage = metadata?.usage;
|
|
304
|
+
if (usage) {
|
|
305
|
+
const normalized = normalizeUsage(usage);
|
|
306
|
+
if (normalized) return normalized;
|
|
307
|
+
}
|
|
308
|
+
const steps = metadata?.steps;
|
|
309
|
+
if (steps && steps.length > 0) {
|
|
310
|
+
let inputTokens = 0;
|
|
311
|
+
let outputTokens = 0;
|
|
312
|
+
let reasoningTokens = 0;
|
|
313
|
+
let cachedInputTokens = 0;
|
|
314
|
+
let hasInput = false;
|
|
315
|
+
let hasOutput = false;
|
|
316
|
+
let hasReasoning = false;
|
|
317
|
+
let hasCachedInput = false;
|
|
318
|
+
let hasAny = false;
|
|
319
|
+
for (const s of steps) {
|
|
320
|
+
if (!s.usage) continue;
|
|
321
|
+
const n = normalizeUsage(s.usage);
|
|
322
|
+
if (n) {
|
|
323
|
+
if (n.inputTokens != null) {
|
|
324
|
+
inputTokens += n.inputTokens;
|
|
325
|
+
hasInput = true;
|
|
326
|
+
}
|
|
327
|
+
if (n.outputTokens != null) {
|
|
328
|
+
outputTokens += n.outputTokens;
|
|
329
|
+
hasOutput = true;
|
|
330
|
+
}
|
|
331
|
+
if (n.reasoningTokens != null) {
|
|
332
|
+
reasoningTokens += n.reasoningTokens;
|
|
333
|
+
hasReasoning = true;
|
|
334
|
+
}
|
|
335
|
+
if (n.cachedInputTokens != null) {
|
|
336
|
+
cachedInputTokens += n.cachedInputTokens;
|
|
337
|
+
hasCachedInput = true;
|
|
338
|
+
}
|
|
339
|
+
hasAny = true;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (hasAny) return {
|
|
343
|
+
...hasInput ? { inputTokens } : void 0,
|
|
344
|
+
...hasOutput ? { outputTokens } : void 0,
|
|
345
|
+
...hasReasoning ? { reasoningTokens } : void 0,
|
|
346
|
+
...hasCachedInput ? { cachedInputTokens } : void 0
|
|
347
|
+
};
|
|
348
|
+
}
|
|
461
349
|
}
|
|
462
350
|
function extractAiSdkV6(content) {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
return buildAiSdkV6Result(textParts, toolCalls, stepsData.length, msg.metadata, stepsData, extractAiSdkV6Usage(msg.metadata));
|
|
351
|
+
const msg = content;
|
|
352
|
+
if (msg.role !== "assistant") return null;
|
|
353
|
+
const { textParts, toolCalls, stepsData } = collectAiSdkV6Parts(msg.parts ?? []);
|
|
354
|
+
return buildAiSdkV6Result(textParts, toolCalls, stepsData.length, msg.metadata, stepsData, extractAiSdkV6Usage(msg.metadata));
|
|
468
355
|
}
|
|
469
356
|
function aggregateAiSdkV6RunSteps(stepMessages) {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
...(hasReasoning ? { reasoningTokens } : undefined),
|
|
520
|
-
...(hasCachedInput ? { cachedInputTokens } : undefined),
|
|
521
|
-
});
|
|
357
|
+
const allTextParts = [];
|
|
358
|
+
const allToolCalls = [];
|
|
359
|
+
const allStepsData = [];
|
|
360
|
+
let hasAssistant = false;
|
|
361
|
+
let metadata;
|
|
362
|
+
let inputTokens = 0;
|
|
363
|
+
let outputTokens = 0;
|
|
364
|
+
let reasoningTokens = 0;
|
|
365
|
+
let cachedInputTokens = 0;
|
|
366
|
+
let hasInput = false;
|
|
367
|
+
let hasOutput = false;
|
|
368
|
+
let hasReasoning = false;
|
|
369
|
+
let hasCachedInput = false;
|
|
370
|
+
for (const content of stepMessages) {
|
|
371
|
+
const msg = content;
|
|
372
|
+
if (msg.role !== "assistant") continue;
|
|
373
|
+
hasAssistant = true;
|
|
374
|
+
const { textParts, toolCalls, stepsData } = collectAiSdkV6Parts(msg.parts ?? []);
|
|
375
|
+
allTextParts.push(...textParts);
|
|
376
|
+
allToolCalls.push(...toolCalls);
|
|
377
|
+
allStepsData.push(...stepsData);
|
|
378
|
+
if (msg.metadata) metadata = msg.metadata;
|
|
379
|
+
const usage = extractAiSdkV6Usage(msg.metadata);
|
|
380
|
+
if (usage) {
|
|
381
|
+
if (usage.inputTokens != null) {
|
|
382
|
+
inputTokens += usage.inputTokens;
|
|
383
|
+
hasInput = true;
|
|
384
|
+
}
|
|
385
|
+
if (usage.outputTokens != null) {
|
|
386
|
+
outputTokens += usage.outputTokens;
|
|
387
|
+
hasOutput = true;
|
|
388
|
+
}
|
|
389
|
+
if (usage.reasoningTokens != null) {
|
|
390
|
+
reasoningTokens += usage.reasoningTokens;
|
|
391
|
+
hasReasoning = true;
|
|
392
|
+
}
|
|
393
|
+
if (usage.cachedInputTokens != null) {
|
|
394
|
+
cachedInputTokens += usage.cachedInputTokens;
|
|
395
|
+
hasCachedInput = true;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (!hasAssistant) return null;
|
|
400
|
+
return buildAiSdkV6Result(allTextParts, allToolCalls, allStepsData.length, metadata, allStepsData, {
|
|
401
|
+
...hasInput ? { inputTokens } : void 0,
|
|
402
|
+
...hasOutput ? { outputTokens } : void 0,
|
|
403
|
+
...hasReasoning ? { reasoningTokens } : void 0,
|
|
404
|
+
...hasCachedInput ? { cachedInputTokens } : void 0
|
|
405
|
+
});
|
|
522
406
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
407
|
+
function useAssistantCloudThreadHistoryAdapter(cloudRef) {
|
|
408
|
+
const aui = useAui();
|
|
409
|
+
const [adapter] = useState(() => new AssistantCloudThreadHistoryAdapter(cloudRef, aui));
|
|
410
|
+
return adapter;
|
|
527
411
|
}
|
|
412
|
+
//#endregion
|
|
413
|
+
export { useAssistantCloudThreadHistoryAdapter };
|
|
414
|
+
|
|
528
415
|
//# sourceMappingURL=AssistantCloudThreadHistoryAdapter.js.map
|