@assistant-ui/core 0.2.22 → 0.3.0
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/thread-history.d.ts +8 -0
- package/dist/adapters/thread-history.d.ts.map +1 -1
- package/dist/internal.d.ts +3 -2
- package/dist/internal.js +3 -2
- package/dist/model-context/frame/host.d.ts.map +1 -1
- package/dist/model-context/frame/host.js +36 -21
- package/dist/model-context/frame/host.js.map +1 -1
- package/dist/model-context/types.d.ts.map +1 -1
- package/dist/model-context/types.js +13 -4
- package/dist/model-context/types.js.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js +3 -2
- package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
- package/dist/react/client/Tools.d.ts.map +1 -1
- package/dist/react/client/Tools.js +40 -55
- package/dist/react/client/Tools.js.map +1 -1
- package/dist/react/client/interactable-model-context.js +1 -0
- package/dist/react/client/interactable-model-context.js.map +1 -1
- package/dist/react/interactables-legacy/useAssistantInteractable.js +1 -1
- package/dist/react/interactables-legacy/useAssistantInteractable.js.map +1 -1
- package/dist/react/interactables-legacy/useInteractableState.js +4 -3
- package/dist/react/interactables-legacy/useInteractableState.js.map +1 -1
- package/dist/react/model-context/useAssistantContext.js +1 -1
- package/dist/react/model-context/useAssistantContext.js.map +1 -1
- package/dist/react/model-context/useAssistantDataUI.js +1 -1
- package/dist/react/model-context/useAssistantDataUI.js.map +1 -1
- package/dist/react/model-context/useAssistantInstructions.js +1 -1
- package/dist/react/model-context/useAssistantInstructions.js.map +1 -1
- package/dist/react/model-context/useAssistantTool.js +29 -25
- package/dist/react/model-context/useAssistantTool.js.map +1 -1
- package/dist/react/model-context/useAssistantToolUI.js +1 -1
- package/dist/react/model-context/useAssistantToolUI.js.map +1 -1
- package/dist/react/model-context/useAuiToolOverrides.js +1 -1
- package/dist/react/model-context/useAuiToolOverrides.js.map +1 -1
- package/dist/react/model-context/useInteractable.js +1 -1
- package/dist/react/model-context/useInteractable.js.map +1 -1
- package/dist/react/model-context/useInteractableState.js +3 -2
- package/dist/react/model-context/useInteractableState.js.map +1 -1
- package/dist/react/model-context/useInteractableVersions.js +1 -0
- package/dist/react/model-context/useInteractableVersions.js.map +1 -1
- package/dist/react/model-context/useToolArgsStatus.js +1 -0
- package/dist/react/model-context/useToolArgsStatus.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.js +4 -3
- package/dist/react/primitive-hooks/useActionBarCopy.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.js +2 -1
- package/dist/react/primitive-hooks/useActionBarEdit.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.js +3 -2
- package/dist/react/primitive-hooks/useActionBarFeedback.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.js +2 -1
- package/dist/react/primitive-hooks/useActionBarReload.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.js +2 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.js +2 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.js +2 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js +2 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.js +2 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.js +2 -1
- package/dist/react/primitive-hooks/useComposerCancel.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.js +2 -1
- package/dist/react/primitive-hooks/useComposerDictate.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.js +2 -1
- package/dist/react/primitive-hooks/useComposerSend.js.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.js +2 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.js.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.js +2 -1
- package/dist/react/primitive-hooks/useEditComposerSend.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.js +3 -2
- package/dist/react/primitive-hooks/useMessageBranching.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageReload.js +2 -1
- package/dist/react/primitive-hooks/useMessageReload.js.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.js +8 -7
- package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.js +2 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.js +2 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.js +2 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.js +2 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.js +2 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.js +2 -1
- package/dist/react/primitive-hooks/useThreadListNew.js.map +1 -1
- package/dist/react/primitive-hooks/useVoice.js +5 -13
- package/dist/react/primitive-hooks/useVoice.js.map +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js.map +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.js +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/react/primitives/composer/ComposerQueue.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerQueue.js +1 -1
- package/dist/react/primitives/composer/ComposerQueue.js.map +1 -1
- package/dist/react/primitives/message/MessageAttachments.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageAttachments.js +1 -1
- package/dist/react/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/react/primitives/message/MessageParts.js +84 -122
- package/dist/react/primitives/message/MessageParts.js.map +1 -1
- package/dist/react/primitives/thread/ThreadMessages.js +1 -1
- package/dist/react/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.js +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.js.map +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.js +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/react/providers/AttachmentByIndexProvider.js +2 -2
- package/dist/react/providers/AttachmentByIndexProvider.js.map +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.js +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.js.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js +30 -18
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js.map +1 -1
- package/dist/react/providers/MessageByIdProvider.js +2 -2
- package/dist/react/providers/MessageByIdProvider.js.map +1 -1
- package/dist/react/providers/MessageByIndexProvider.js +2 -2
- package/dist/react/providers/MessageByIndexProvider.js.map +1 -1
- package/dist/react/providers/PartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/PartByIndexProvider.js +30 -18
- package/dist/react/providers/PartByIndexProvider.js.map +1 -1
- package/dist/react/providers/QueueItemByIndexProvider.js +1 -1
- package/dist/react/providers/QueueItemByIndexProvider.js.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.js +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.js.map +1 -1
- package/dist/react/providers/SuggestionByIndexProvider.js +1 -1
- package/dist/react/providers/SuggestionByIndexProvider.js.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.js +1 -0
- package/dist/react/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.js +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +3 -3
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +6 -4
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts +31 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +42 -20
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.d.ts +12 -1
- package/dist/react/runtimes/cloud/auiV0.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.js +2 -1
- package/dist/react/runtimes/cloud/auiV0.js.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js +75 -73
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js.map +1 -1
- package/dist/react/runtimes/createRuntimeExtras.js +1 -1
- package/dist/react/runtimes/createRuntimeExtras.js.map +1 -1
- package/dist/react/runtimes/external-message-converter.js +1 -1
- package/dist/react/runtimes/external-message-converter.js.map +1 -1
- package/dist/react/runtimes/useExternalStoreSharedOptions.js +1 -0
- package/dist/react/runtimes/useExternalStoreSharedOptions.js.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.d.ts +0 -1
- package/dist/react/runtimes/useLocalRuntime.d.ts.map +1 -1
- package/dist/react/types/scopes/tools.d.ts +0 -6
- package/dist/react/types/scopes/tools.d.ts.map +1 -1
- package/dist/react/utils/groupParts.d.ts +1 -3
- package/dist/react/utils/groupParts.d.ts.map +1 -1
- package/dist/react/utils/groupParts.js +1 -3
- package/dist/react/utils/groupParts.js.map +1 -1
- package/dist/runtime/api/assistant-runtime.d.ts +1 -1
- package/dist/runtime/api/assistant-runtime.d.ts.map +1 -1
- package/dist/runtime/api/assistant-runtime.js +1 -1
- package/dist/runtime/api/assistant-runtime.js.map +1 -1
- package/dist/runtime/api/attachment-runtime.d.ts +1 -1
- package/dist/runtime/api/attachment-runtime.d.ts.map +1 -1
- package/dist/runtime/api/attachment-runtime.js +1 -1
- package/dist/runtime/api/attachment-runtime.js.map +1 -1
- package/dist/runtime/api/composer-runtime.d.ts +2 -2
- package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.js +2 -2
- package/dist/runtime/api/composer-runtime.js.map +1 -1
- package/dist/runtime/api/message-part-runtime.d.ts +4 -4
- package/dist/runtime/api/message-part-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-part-runtime.js +3 -3
- package/dist/runtime/api/message-part-runtime.js.map +1 -1
- package/dist/runtime/api/message-runtime.d.ts +1 -1
- package/dist/runtime/api/message-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-runtime.js +2 -2
- package/dist/runtime/api/message-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.d.ts +1 -1
- package/dist/runtime/api/thread-list-item-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.js +2 -2
- package/dist/runtime/api/thread-list-item-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-runtime.d.ts +1 -1
- package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-runtime.js +1 -1
- package/dist/runtime/api/thread-list-runtime.js.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.d.ts +1 -1
- package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts +2 -2
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.js +2 -2
- package/dist/runtime/base/default-edit-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
- package/dist/runtime/utils/message-repository.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository.js +4 -2
- package/dist/runtime/utils/message-repository.js.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js +1 -1
- 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.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js +12 -0
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/internal.d.ts +2 -1
- package/dist/runtimes/internal.js +2 -1
- package/dist/runtimes/local/local-thread-runtime-core.d.ts +3 -0
- package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.js +44 -13
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts +32 -27
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js +2 -0
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js.map +1 -1
- package/dist/store/clients/no-op-composer-client.js +1 -0
- package/dist/store/clients/no-op-composer-client.js.map +1 -1
- package/dist/store/clients/runtime-adapter.js +3 -3
- package/dist/store/clients/runtime-adapter.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.js +1 -0
- package/dist/store/runtime-clients/thread-list-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.js +17 -15
- package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
- package/dist/store/scopes/thread.d.ts +1 -0
- package/dist/store/scopes/thread.d.ts.map +1 -1
- package/dist/subscribable/subscribable.d.ts +3 -3
- package/dist/subscribable/subscribable.d.ts.map +1 -1
- package/dist/subscribable/subscribable.js +3 -3
- package/dist/subscribable/subscribable.js.map +1 -1
- package/package.json +8 -8
- package/src/adapters/thread-history.ts +8 -0
- package/src/internal.ts +1 -1
- package/src/model-context/frame/host.test.ts +47 -0
- package/src/model-context/frame/host.ts +46 -19
- package/src/model-context/types.ts +16 -6
- package/src/react/adapters/LocalStorageThreadListAdapter.tsx +17 -7
- package/src/react/client/Tools.ts +0 -7
- package/src/react/interactables-legacy/useAssistantInteractable.ts +1 -1
- package/src/react/interactables-legacy/useInteractableState.ts +3 -3
- package/src/react/model-context/useAssistantContext.ts +1 -1
- package/src/react/model-context/useAssistantDataUI.ts +1 -1
- package/src/react/model-context/useAssistantInstructions.ts +1 -1
- package/src/react/model-context/useAssistantTool.ts +2 -2
- package/src/react/model-context/useAssistantToolUI.ts +1 -1
- package/src/react/model-context/useAuiToolOverrides.ts +1 -1
- package/src/react/model-context/useInteractable.ts +1 -1
- package/src/react/model-context/useInteractableState.ts +2 -2
- package/src/react/primitive-hooks/useActionBarCopy.test.ts +2 -2
- package/src/react/primitive-hooks/useActionBarCopy.ts +3 -3
- package/src/react/primitive-hooks/useActionBarEdit.ts +1 -1
- package/src/react/primitive-hooks/useActionBarFeedback.ts +2 -2
- package/src/react/primitive-hooks/useActionBarReload.ts +1 -1
- package/src/react/primitive-hooks/useActionBarSpeak.ts +1 -1
- package/src/react/primitive-hooks/useActionBarStopSpeaking.ts +1 -1
- package/src/react/primitive-hooks/useBranchPickerNext.ts +1 -1
- package/src/react/primitive-hooks/useBranchPickerPrevious.ts +1 -1
- package/src/react/primitive-hooks/useComposerAddAttachment.ts +1 -1
- package/src/react/primitive-hooks/useComposerCancel.ts +1 -1
- package/src/react/primitive-hooks/useComposerDictate.ts +1 -1
- package/src/react/primitive-hooks/useComposerSend.ts +1 -1
- package/src/react/primitive-hooks/useEditComposerCancel.ts +1 -1
- package/src/react/primitive-hooks/useEditComposerSend.ts +1 -1
- package/src/react/primitive-hooks/useMessageBranching.ts +2 -2
- package/src/react/primitive-hooks/useMessageReload.ts +1 -1
- package/src/react/primitive-hooks/useSuggestionTrigger.ts +9 -9
- package/src/react/primitive-hooks/useThreadListItemArchive.ts +1 -1
- package/src/react/primitive-hooks/useThreadListItemDelete.ts +1 -1
- package/src/react/primitive-hooks/useThreadListItemTrigger.ts +1 -1
- package/src/react/primitive-hooks/useThreadListItemUnarchive.ts +1 -1
- package/src/react/primitive-hooks/useThreadListLoadMore.ts +1 -1
- package/src/react/primitive-hooks/useThreadListNew.ts +1 -1
- package/src/react/primitive-hooks/useVoice.ts +5 -5
- package/src/react/primitives/chainOfThought/ChainOfThoughtParts.tsx +1 -1
- package/src/react/primitives/composer/ComposerAttachments.tsx +1 -1
- package/src/react/primitives/composer/ComposerQueue.tsx +1 -3
- package/src/react/primitives/message/MessageAttachments.tsx +1 -3
- package/src/react/primitives/message/MessageParts.tsx +9 -9
- package/src/react/primitives/thread/ThreadMessages.tsx +1 -1
- package/src/react/primitives/thread/ThreadSuggestions.tsx +1 -1
- package/src/react/primitives/threadList/ThreadListItems.tsx +1 -1
- package/src/react/providers/AttachmentByIndexProvider.tsx +2 -2
- package/src/react/providers/ChainOfThoughtByIndicesProvider.tsx +1 -1
- package/src/react/providers/ChainOfThoughtPartByIndexProvider.tsx +2 -19
- package/src/react/providers/MessageByIdProvider.tsx +2 -2
- package/src/react/providers/MessageByIndexProvider.tsx +2 -2
- package/src/react/providers/PartByIndexProvider.tsx +2 -16
- package/src/react/providers/QueueItemByIndexProvider.tsx +1 -1
- package/src/react/providers/ReadonlyThreadProvider.tsx +1 -1
- package/src/react/providers/SuggestionByIndexProvider.tsx +1 -1
- package/src/react/providers/ThreadListItemByIndexProvider.tsx +1 -1
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.tsx +3 -3
- package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +20 -6
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.ts +34 -0
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.tsx +32 -7
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.ts +47 -16
- package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.ts +5 -1
- package/src/react/runtimes/cloud/auiV0.ts +14 -0
- package/src/react/runtimes/cloud/useCloudThreadListAdapter.tsx +90 -88
- package/src/react/runtimes/createRuntimeExtras.test.ts +1 -1
- package/src/react/runtimes/createRuntimeExtras.ts +1 -1
- package/src/react/runtimes/external-message-converter.test.ts +346 -0
- package/src/react/runtimes/external-message-converter.ts +1 -1
- package/src/react/runtimes/useLocalRuntime.test.tsx +43 -0
- package/src/react/types/scopes/tools.ts +0 -6
- package/src/react/utils/groupParts.ts +1 -7
- package/src/runtime/api/assistant-runtime.ts +4 -1
- package/src/runtime/api/attachment-runtime.ts +8 -2
- package/src/runtime/api/composer-runtime.ts +9 -5
- package/src/runtime/api/message-part-runtime.ts +10 -3
- package/src/runtime/api/message-runtime.ts +7 -2
- package/src/runtime/api/thread-list-item-runtime.ts +7 -2
- package/src/runtime/api/thread-list-runtime.ts +10 -2
- package/src/runtime/base/base-thread-runtime-core.ts +5 -1
- package/src/runtime/base/default-edit-composer-runtime-core.ts +14 -2
- package/src/runtime/base/default-thread-composer-runtime-core.ts +11 -1
- package/src/runtime/utils/message-repository.ts +19 -13
- package/src/runtimes/external-store/external-store-thread-list-runtime-core.ts +4 -1
- package/src/runtimes/external-store/external-store-thread-runtime-core.ts +15 -0
- package/src/runtimes/internal.ts +3 -0
- package/src/runtimes/local/local-thread-runtime-core.test.ts +596 -0
- package/src/runtimes/local/local-thread-runtime-core.ts +85 -21
- package/src/runtimes/local/should-continue.test.ts +122 -0
- package/src/runtimes/tool-invocations/ToolInvocationTracker.test.ts +9 -10
- package/src/runtimes/tool-invocations/ToolInvocationTracker.ts +38 -32
- package/src/store/clients/model-context-client.test.ts +21 -1
- package/src/store/clients/runtime-adapter.ts +3 -3
- package/src/store/runtime-clients/thread-runtime-client.ts +2 -1
- package/src/store/scopes/thread.ts +1 -0
- package/src/subscribable/subscribable.ts +16 -8
- package/src/tests/MessageRepository.test.ts +12 -0
- package/src/tests/RemoteThreadListThreadListRuntimeCore-switchToThread-position.test.ts +121 -0
- package/src/tests/auiV0Encode.test.ts +74 -0
- package/src/tests/base-composer-runtime-core.test.ts +422 -0
- package/src/tests/external-store-thread-list-runtime-core.test.ts +6 -6
- package/src/tests/external-store-thread-runtime-core-adapter.test.ts +575 -0
- package/src/tests/external-store-thread-runtime-core.test.ts +55 -1
- package/src/tests/groupParts.test.ts +3 -48
- package/src/tests/OptimisticState-delete-crash.test.ts +0 -208
|
@@ -6,7 +6,7 @@ export const useActionBarStopSpeaking = () => {
|
|
|
6
6
|
const disabled = useAuiState((s) => s.message.speech == null);
|
|
7
7
|
|
|
8
8
|
const stopSpeaking = useCallback(() => {
|
|
9
|
-
aui.message
|
|
9
|
+
aui.message.stopSpeaking();
|
|
10
10
|
}, [aui]);
|
|
11
11
|
|
|
12
12
|
return { stopSpeaking, disabled };
|
|
@@ -12,7 +12,7 @@ export const useBranchPickerPrevious = () => {
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
const previous = useCallback(() => {
|
|
15
|
-
aui.message
|
|
15
|
+
aui.message.switchToBranch({ position: "previous" });
|
|
16
16
|
}, [aui]);
|
|
17
17
|
|
|
18
18
|
return { previous, disabled };
|
|
@@ -7,11 +7,11 @@ export const useMessageBranching = () => {
|
|
|
7
7
|
const branchCount = useAuiState((s) => s.message.branchCount);
|
|
8
8
|
|
|
9
9
|
const goToPrev = useCallback(() => {
|
|
10
|
-
aui.message
|
|
10
|
+
aui.message.switchToBranch({ position: "previous" });
|
|
11
11
|
}, [aui]);
|
|
12
12
|
|
|
13
13
|
const goToNext = useCallback(() => {
|
|
14
|
-
aui.message
|
|
14
|
+
aui.message.switchToBranch({ position: "next" });
|
|
15
15
|
}, [aui]);
|
|
16
16
|
|
|
17
17
|
return { branchNumber, branchCount, goToPrev, goToNext };
|
|
@@ -17,24 +17,24 @@ export const useSuggestionTrigger = ({
|
|
|
17
17
|
const resolvedSend = send ?? false;
|
|
18
18
|
|
|
19
19
|
const trigger = useCallback(() => {
|
|
20
|
-
const isRunning = aui.thread
|
|
20
|
+
const isRunning = aui.thread.getState().isRunning;
|
|
21
21
|
|
|
22
22
|
if (resolvedSend && !isRunning) {
|
|
23
|
-
aui.thread
|
|
23
|
+
aui.thread.append({
|
|
24
24
|
content: [{ type: "text", text: prompt }],
|
|
25
|
-
runConfig: aui.composer
|
|
25
|
+
runConfig: aui.composer.getState().runConfig,
|
|
26
26
|
});
|
|
27
27
|
if (clearComposer) {
|
|
28
|
-
aui.composer
|
|
28
|
+
aui.composer.setText("");
|
|
29
29
|
}
|
|
30
30
|
} else {
|
|
31
31
|
if (clearComposer) {
|
|
32
|
-
aui.composer
|
|
32
|
+
aui.composer.setText(prompt);
|
|
33
33
|
} else {
|
|
34
|
-
const currentText = aui.composer
|
|
35
|
-
aui
|
|
36
|
-
.
|
|
37
|
-
|
|
34
|
+
const currentText = aui.composer.getState().text;
|
|
35
|
+
aui.composer.setText(
|
|
36
|
+
currentText.trim() ? `${currentText} ${prompt}` : prompt,
|
|
37
|
+
);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}, [aui, resolvedSend, clearComposer, prompt]);
|
|
@@ -10,7 +10,7 @@ const getServerVolume = () => 0;
|
|
|
10
10
|
|
|
11
11
|
export const useVoiceVolume = (): number => {
|
|
12
12
|
const aui = useAui();
|
|
13
|
-
const thread = aui.thread
|
|
13
|
+
const thread = aui.thread;
|
|
14
14
|
return useSyncExternalStore(
|
|
15
15
|
thread.subscribeVoiceVolume,
|
|
16
16
|
thread.getVoiceVolume,
|
|
@@ -22,19 +22,19 @@ export const useVoiceControls = () => {
|
|
|
22
22
|
const aui = useAui();
|
|
23
23
|
|
|
24
24
|
const connect = useCallback(() => {
|
|
25
|
-
aui.thread
|
|
25
|
+
aui.thread.connectVoice();
|
|
26
26
|
}, [aui]);
|
|
27
27
|
|
|
28
28
|
const disconnect = useCallback(() => {
|
|
29
|
-
aui.thread
|
|
29
|
+
aui.thread.disconnectVoice();
|
|
30
30
|
}, [aui]);
|
|
31
31
|
|
|
32
32
|
const mute = useCallback(() => {
|
|
33
|
-
aui.thread
|
|
33
|
+
aui.thread.muteVoice();
|
|
34
34
|
}, [aui]);
|
|
35
35
|
|
|
36
36
|
const unmute = useCallback(() => {
|
|
37
|
-
aui.thread
|
|
37
|
+
aui.thread.unmuteVoice();
|
|
38
38
|
}, [aui]);
|
|
39
39
|
|
|
40
40
|
return { connect, disconnect, mute, unmute };
|
|
@@ -51,7 +51,7 @@ const ChainOfThoughtPrimitivePartsInner: FC<{
|
|
|
51
51
|
Array.from({ length: partsLength }, (_, index) => (
|
|
52
52
|
<ChainOfThoughtPartByIndexProvider key={index} index={index}>
|
|
53
53
|
<RenderChildrenWithAccessor
|
|
54
|
-
getItemState={(aui) => aui.part
|
|
54
|
+
getItemState={(aui) => aui.part.getState()}
|
|
55
55
|
>
|
|
56
56
|
{(getItem) =>
|
|
57
57
|
children({
|
|
@@ -99,7 +99,7 @@ const ComposerPrimitiveAttachmentsInner: FC<{
|
|
|
99
99
|
<ComposerAttachmentByIndexProvider key={index} index={index}>
|
|
100
100
|
<RenderChildrenWithAccessor
|
|
101
101
|
getItemState={(aui) =>
|
|
102
|
-
aui.composer
|
|
102
|
+
aui.composer.attachment({ index }).getState()
|
|
103
103
|
}
|
|
104
104
|
>
|
|
105
105
|
{(getItem) =>
|
|
@@ -20,9 +20,7 @@ const ComposerPrimitiveQueueInner: FC<{
|
|
|
20
20
|
Array.from({ length: queue }, (_, index) => (
|
|
21
21
|
<QueueItemByIndexProvider key={index} index={index}>
|
|
22
22
|
<RenderChildrenWithAccessor
|
|
23
|
-
getItemState={(aui) =>
|
|
24
|
-
aui.composer().queueItem({ index }).getState()
|
|
25
|
-
}
|
|
23
|
+
getItemState={(aui) => aui.composer.queueItem({ index }).getState()}
|
|
26
24
|
>
|
|
27
25
|
{(getItem) =>
|
|
28
26
|
children({
|
|
@@ -101,9 +101,7 @@ const MessagePrimitiveAttachmentsInner: FC<{
|
|
|
101
101
|
Array.from({ length: attachmentsCount }, (_, index) => (
|
|
102
102
|
<MessageAttachmentByIndexProvider key={index} index={index}>
|
|
103
103
|
<RenderChildrenWithAccessor
|
|
104
|
-
getItemState={(aui) =>
|
|
105
|
-
aui.message().attachment({ index }).getState()
|
|
106
|
-
}
|
|
104
|
+
getItemState={(aui) => aui.message.attachment({ index }).getState()}
|
|
107
105
|
>
|
|
108
106
|
{(getItem) =>
|
|
109
107
|
children({
|
|
@@ -415,9 +415,9 @@ export const MessagePartComponent: FC<MessagePartComponentProps> = ({
|
|
|
415
415
|
|
|
416
416
|
const type = part.type;
|
|
417
417
|
if (type === "tool-call") {
|
|
418
|
-
const addResult = aui.part
|
|
419
|
-
const resume = aui.part
|
|
420
|
-
const respondToApproval = aui.part
|
|
418
|
+
const addResult = aui.part.addToolResult;
|
|
419
|
+
const resume = aui.part.resumeToolCall;
|
|
420
|
+
const respondToApproval = aui.part.respondToToolApproval;
|
|
421
421
|
if ("Override" in tools)
|
|
422
422
|
return (
|
|
423
423
|
<tools.Override
|
|
@@ -636,9 +636,9 @@ const RegisteredToolUI: FC = () => {
|
|
|
636
636
|
return (
|
|
637
637
|
<Render
|
|
638
638
|
{...part}
|
|
639
|
-
addResult={aui.part
|
|
640
|
-
resume={aui.part
|
|
641
|
-
respondToApproval={aui.part
|
|
639
|
+
addResult={aui.part.addToolResult}
|
|
640
|
+
resume={aui.part.resumeToolCall}
|
|
641
|
+
respondToApproval={aui.part.respondToToolApproval}
|
|
642
642
|
/>
|
|
643
643
|
);
|
|
644
644
|
};
|
|
@@ -743,16 +743,16 @@ const MessagePartChildrenInner: FC<
|
|
|
743
743
|
|
|
744
744
|
return (
|
|
745
745
|
<RenderChildrenWithAccessor
|
|
746
|
-
getItemState={(client) => client.part
|
|
746
|
+
getItemState={(client) => client.part.getState()}
|
|
747
747
|
>
|
|
748
748
|
{(getItem) =>
|
|
749
749
|
children({
|
|
750
750
|
get part() {
|
|
751
751
|
const state = getItem();
|
|
752
752
|
if (state.type === "tool-call") {
|
|
753
|
-
const toolsState = aui.tools
|
|
753
|
+
const toolsState = aui.tools.getState();
|
|
754
754
|
const hasUI = resolveToolRender(toolsState, state) !== null;
|
|
755
|
-
const partMethods = aui.part
|
|
755
|
+
const partMethods = aui.part;
|
|
756
756
|
return {
|
|
757
757
|
...state,
|
|
758
758
|
toolUI: hasUI ? <RegisteredToolUI /> : null,
|
|
@@ -247,7 +247,7 @@ const ThreadPrimitiveMessagesInner: FC<{
|
|
|
247
247
|
return Array.from({ length: messagesLength }, (_, index) => (
|
|
248
248
|
<MessageByIndexProvider key={index} index={index}>
|
|
249
249
|
<RenderChildrenWithAccessor
|
|
250
|
-
getItemState={(aui) => aui.thread
|
|
250
|
+
getItemState={(aui) => aui.thread.message({ index }).getState()}
|
|
251
251
|
>
|
|
252
252
|
{(getItem) =>
|
|
253
253
|
children({
|
|
@@ -77,7 +77,7 @@ const ThreadPrimitiveSuggestionsInner: FC<{
|
|
|
77
77
|
<SuggestionByIndexProvider key={index} index={index}>
|
|
78
78
|
<RenderChildrenWithAccessor
|
|
79
79
|
getItemState={(aui) =>
|
|
80
|
-
aui.suggestions
|
|
80
|
+
aui.suggestions.suggestion({ index }).getState()
|
|
81
81
|
}
|
|
82
82
|
>
|
|
83
83
|
{(getItem) =>
|
|
@@ -10,7 +10,7 @@ export const MessageAttachmentByIndexProvider: FC<
|
|
|
10
10
|
attachment: Derived({
|
|
11
11
|
source: "message",
|
|
12
12
|
query: { type: "index", index },
|
|
13
|
-
get: (aui) => aui.message
|
|
13
|
+
get: (aui) => aui.message.attachment({ index }),
|
|
14
14
|
}),
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -26,7 +26,7 @@ export const ComposerAttachmentByIndexProvider: FC<
|
|
|
26
26
|
attachment: Derived({
|
|
27
27
|
source: "composer",
|
|
28
28
|
query: { type: "index", index },
|
|
29
|
-
get: (aui) => aui.composer
|
|
29
|
+
get: (aui) => aui.composer.attachment({ index }),
|
|
30
30
|
}),
|
|
31
31
|
});
|
|
32
32
|
|
|
@@ -25,7 +25,7 @@ export const ChainOfThoughtByIndicesProvider: FC<
|
|
|
25
25
|
`ChainOfThought part index ${index} is out of bounds (0..${parts.length - 1})`,
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
|
-
return parentAui.message
|
|
28
|
+
return parentAui.message.part({ index: startIndex + index });
|
|
29
29
|
},
|
|
30
30
|
}),
|
|
31
31
|
});
|
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FC, PropsWithChildren } from "react";
|
|
2
2
|
import { useAui, AuiProvider, Derived } from "@assistant-ui/store";
|
|
3
|
-
import type { PartMethods } from "../../store/scopes/part";
|
|
4
3
|
|
|
5
4
|
export const ChainOfThoughtPartByIndexProvider: FC<
|
|
6
5
|
PropsWithChildren<{
|
|
7
6
|
index: number;
|
|
8
7
|
}>
|
|
9
8
|
> = ({ index, children }) => {
|
|
10
|
-
const lastPartRef = useMemo(
|
|
11
|
-
() => ({ index, current: null as PartMethods | null }),
|
|
12
|
-
[index],
|
|
13
|
-
);
|
|
14
9
|
const aui = useAui({
|
|
15
10
|
part: Derived({
|
|
16
11
|
source: "chainOfThought",
|
|
17
12
|
query: { type: "index", index },
|
|
18
|
-
get: (aui) => {
|
|
19
|
-
const chainOfThought = aui.chainOfThought();
|
|
20
|
-
if (
|
|
21
|
-
index >= chainOfThought.getState().parts.length &&
|
|
22
|
-
lastPartRef.current
|
|
23
|
-
) {
|
|
24
|
-
return lastPartRef.current;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const part = chainOfThought.part({ index });
|
|
28
|
-
lastPartRef.current = part;
|
|
29
|
-
return part;
|
|
30
|
-
},
|
|
13
|
+
get: (aui) => aui.chainOfThought.part({ index }),
|
|
31
14
|
}),
|
|
32
15
|
});
|
|
33
16
|
|
|
@@ -10,12 +10,12 @@ export const MessageByIdProvider: FC<
|
|
|
10
10
|
message: Derived({
|
|
11
11
|
source: "thread",
|
|
12
12
|
query: { type: "id", id },
|
|
13
|
-
get: (aui) => aui.thread
|
|
13
|
+
get: (aui) => aui.thread.message({ id }),
|
|
14
14
|
}),
|
|
15
15
|
composer: Derived({
|
|
16
16
|
source: "message",
|
|
17
17
|
query: {},
|
|
18
|
-
get: (aui) => aui.thread
|
|
18
|
+
get: (aui) => aui.thread.message({ id }).composer(),
|
|
19
19
|
}),
|
|
20
20
|
});
|
|
21
21
|
|
|
@@ -10,12 +10,12 @@ export const MessageByIndexProvider: FC<
|
|
|
10
10
|
message: Derived({
|
|
11
11
|
source: "thread",
|
|
12
12
|
query: { type: "index", index },
|
|
13
|
-
get: (aui) => aui.thread
|
|
13
|
+
get: (aui) => aui.thread.message({ index }),
|
|
14
14
|
}),
|
|
15
15
|
composer: Derived({
|
|
16
16
|
source: "message",
|
|
17
17
|
query: {},
|
|
18
|
-
get: (aui) => aui.thread
|
|
18
|
+
get: (aui) => aui.thread.message({ index }).composer(),
|
|
19
19
|
}),
|
|
20
20
|
});
|
|
21
21
|
|
|
@@ -1,30 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FC, PropsWithChildren } from "react";
|
|
2
2
|
import { useAui, AuiProvider, Derived } from "@assistant-ui/store";
|
|
3
|
-
import type { PartMethods } from "../../store/scopes/part";
|
|
4
3
|
|
|
5
4
|
export const PartByIndexProvider: FC<
|
|
6
5
|
PropsWithChildren<{
|
|
7
6
|
index: number;
|
|
8
7
|
}>
|
|
9
8
|
> = ({ index, children }) => {
|
|
10
|
-
const lastPartRef = useMemo(
|
|
11
|
-
() => ({ index, current: null as PartMethods | null }),
|
|
12
|
-
[index],
|
|
13
|
-
);
|
|
14
9
|
const aui = useAui({
|
|
15
10
|
part: Derived({
|
|
16
11
|
source: "message",
|
|
17
12
|
query: { type: "index", index },
|
|
18
|
-
get: (aui) => {
|
|
19
|
-
const message = aui.message();
|
|
20
|
-
if (index >= message.getState().parts.length && lastPartRef.current) {
|
|
21
|
-
return lastPartRef.current;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const part = message.part({ index });
|
|
25
|
-
lastPartRef.current = part;
|
|
26
|
-
return part;
|
|
27
|
-
},
|
|
13
|
+
get: (aui) => aui.message.part({ index }),
|
|
28
14
|
}),
|
|
29
15
|
});
|
|
30
16
|
|
|
@@ -13,7 +13,7 @@ export const QueueItemByIndexProvider: FC<QueueItemByIndexProviderProps> = ({
|
|
|
13
13
|
queueItem: Derived({
|
|
14
14
|
source: "composer",
|
|
15
15
|
query: { index },
|
|
16
|
-
get: (aui) => aui.composer
|
|
16
|
+
get: (aui) => aui.composer.queueItem({ index }),
|
|
17
17
|
}),
|
|
18
18
|
});
|
|
19
19
|
|
|
@@ -13,7 +13,7 @@ export const SuggestionByIndexProvider: FC<SuggestionByIndexProviderProps> = ({
|
|
|
13
13
|
suggestion: Derived({
|
|
14
14
|
source: "suggestions",
|
|
15
15
|
query: { index },
|
|
16
|
-
get: (aui) => aui.suggestions
|
|
16
|
+
get: (aui) => aui.suggestions.suggestion({ index }),
|
|
17
17
|
}),
|
|
18
18
|
});
|
|
19
19
|
|
|
@@ -11,7 +11,7 @@ export const ThreadListItemByIndexProvider: FC<
|
|
|
11
11
|
threadListItem: Derived({
|
|
12
12
|
source: "threads",
|
|
13
13
|
query: { type: "index", index, archived },
|
|
14
|
-
get: (aui) => aui.threads
|
|
14
|
+
get: (aui) => aui.threads.item({ index, archived }),
|
|
15
15
|
}),
|
|
16
16
|
});
|
|
17
17
|
|
|
@@ -147,15 +147,15 @@ export class RemoteThreadListHookInstanceManager extends BaseSubscribable {
|
|
|
147
147
|
return runtime.threads.main.unstable_on("initialize", () => {
|
|
148
148
|
if (hasInitializedRef.current) return;
|
|
149
149
|
|
|
150
|
-
const state = aui.threadListItem
|
|
150
|
+
const state = aui.threadListItem.getState();
|
|
151
151
|
if (state.status !== "new") return;
|
|
152
152
|
hasInitializedRef.current = true;
|
|
153
153
|
|
|
154
|
-
initPromiseRef.current = aui.threadListItem
|
|
154
|
+
initPromiseRef.current = aui.threadListItem.initialize();
|
|
155
155
|
|
|
156
156
|
const dispose = runtime.thread.unstable_on("runEnd", () => {
|
|
157
157
|
dispose();
|
|
158
|
-
aui.threadListItem
|
|
158
|
+
aui.threadListItem.generateTitle();
|
|
159
159
|
});
|
|
160
160
|
});
|
|
161
161
|
}, [runtime, aui]);
|
|
@@ -356,22 +356,36 @@ export class RemoteThreadListThreadListRuntimeCore
|
|
|
356
356
|
[remoteMetadata.remoteId]: mappingId,
|
|
357
357
|
};
|
|
358
358
|
|
|
359
|
-
//
|
|
360
|
-
//
|
|
359
|
+
// A concurrent `list()` may already have placed this thread; keep that
|
|
360
|
+
// position and only merge metadata. A genuinely absent thread stays
|
|
361
|
+
// appended: it may live on an unloaded page, and a prepend would pin it
|
|
362
|
+
// above newer threads permanently since `classifyThreads` skips ids it
|
|
363
|
+
// has already seen. Filtering both arrays first still prevents
|
|
364
|
+
// duplication or a wrong-status entry from `list()`.
|
|
365
|
+
const remoteId = remoteMetadata.remoteId;
|
|
366
|
+
const wasInTarget =
|
|
367
|
+
remoteMetadata.status === "regular"
|
|
368
|
+
? state.threadIds.includes(remoteId)
|
|
369
|
+
: state.archivedThreadIds.includes(remoteId);
|
|
370
|
+
|
|
361
371
|
const threadIdsWithoutRemote = state.threadIds.filter(
|
|
362
|
-
(id) => id !==
|
|
372
|
+
(id) => id !== remoteId,
|
|
363
373
|
);
|
|
364
374
|
const archivedThreadIdsWithoutRemote = state.archivedThreadIds.filter(
|
|
365
|
-
(id) => id !==
|
|
375
|
+
(id) => id !== remoteId,
|
|
366
376
|
);
|
|
367
377
|
|
|
368
378
|
const newThreadIds =
|
|
369
379
|
remoteMetadata.status === "regular"
|
|
370
|
-
?
|
|
380
|
+
? wasInTarget
|
|
381
|
+
? state.threadIds
|
|
382
|
+
: [...threadIdsWithoutRemote, remoteId]
|
|
371
383
|
: threadIdsWithoutRemote;
|
|
372
384
|
const newArchivedThreadIds =
|
|
373
385
|
remoteMetadata.status === "archived"
|
|
374
|
-
?
|
|
386
|
+
? wasInTarget
|
|
387
|
+
? state.archivedThreadIds
|
|
388
|
+
: [...archivedThreadIdsWithoutRemote, remoteId]
|
|
375
389
|
: archivedThreadIdsWithoutRemote;
|
|
376
390
|
|
|
377
391
|
this._state.update({
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { extractAuiV0 } from "./AssistantCloudThreadHistoryAdapter";
|
|
3
|
+
|
|
4
|
+
const auiV0Message = (status: { type: string; reason?: string }) => ({
|
|
5
|
+
role: "assistant",
|
|
6
|
+
status,
|
|
7
|
+
content: [
|
|
8
|
+
{
|
|
9
|
+
type: "tool-call",
|
|
10
|
+
toolCallId: "call-1",
|
|
11
|
+
toolName: "send_email",
|
|
12
|
+
args: {},
|
|
13
|
+
argsText: "{}",
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
metadata: { steps: [{ usage: { inputTokens: 1, outputTokens: 2 } }] },
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
describe("extractAuiV0", () => {
|
|
20
|
+
it("returns null for a requires-action message so paused writes never report", () => {
|
|
21
|
+
expect(
|
|
22
|
+
extractAuiV0(
|
|
23
|
+
auiV0Message({ type: "requires-action", reason: "tool-calls" }),
|
|
24
|
+
),
|
|
25
|
+
).toBeNull();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("reports a terminal message once with its usage", () => {
|
|
29
|
+
const result = extractAuiV0(auiV0Message({ type: "complete" }));
|
|
30
|
+
expect(result?.status).toBe("completed");
|
|
31
|
+
expect(result?.inputTokens).toBe(1);
|
|
32
|
+
expect(result?.outputTokens).toBe(2);
|
|
33
|
+
});
|
|
34
|
+
});
|