@assistant-ui/core 0.3.12 → 0.3.14
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/speech.d.ts.map +1 -1
- package/dist/adapters/speech.js +9 -15
- package/dist/adapters/speech.js.map +1 -1
- package/dist/adapters/thread-history.d.ts +2 -0
- package/dist/adapters/thread-history.d.ts.map +1 -1
- package/dist/adapters/voice.d.ts.map +1 -1
- package/dist/adapters/voice.js +27 -15
- package/dist/adapters/voice.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +6 -6
- package/dist/model-context/frame/host.d.ts.map +1 -1
- package/dist/model-context/frame/host.js +2 -1
- package/dist/model-context/frame/host.js.map +1 -1
- package/dist/model-context/registry.d.ts.map +1 -1
- package/dist/model-context/registry.js +16 -4
- package/dist/model-context/registry.js.map +1 -1
- package/dist/react/RuntimeAdapter.d.ts +8 -1
- package/dist/react/RuntimeAdapter.d.ts.map +1 -1
- package/dist/react/RuntimeAdapter.js +23 -18
- package/dist/react/RuntimeAdapter.js.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js +28 -12
- package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
- package/dist/react/client/AdaptedRemoteThread.d.ts +11 -0
- package/dist/react/client/AdaptedRemoteThread.d.ts.map +1 -0
- package/dist/react/client/AdaptedRemoteThread.js +27 -0
- package/dist/react/client/AdaptedRemoteThread.js.map +1 -0
- package/dist/react/client/InMemoryThreadList.d.ts +19 -0
- package/dist/react/client/InMemoryThreadList.d.ts.map +1 -0
- package/dist/react/client/InMemoryThreadList.js +418 -0
- package/dist/react/client/InMemoryThreadList.js.map +1 -0
- package/dist/react/client/Interactables.d.ts.map +1 -1
- package/dist/react/client/Interactables.js +159 -102
- package/dist/react/client/Interactables.js.map +1 -1
- package/dist/react/client/RemoteThreadList.d.ts +34 -0
- package/dist/react/client/RemoteThreadList.d.ts.map +1 -0
- package/dist/react/client/RemoteThreadList.js +826 -0
- package/dist/react/client/RemoteThreadList.js.map +1 -0
- package/dist/react/client/Tools.d.ts.map +1 -1
- package/dist/react/client/Tools.js +38 -27
- package/dist/react/client/Tools.js.map +1 -1
- package/dist/react/client/interactable-model-context.d.ts.map +1 -1
- package/dist/react/client/interactable-model-context.js +5 -1
- package/dist/react/client/interactable-model-context.js.map +1 -1
- package/dist/react/index.d.ts +7 -2
- package/dist/react/index.js +5 -2
- package/dist/react/interactables-legacy/Interactables.d.ts.map +1 -1
- package/dist/react/interactables-legacy/Interactables.js +145 -110
- package/dist/react/interactables-legacy/Interactables.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.js +13 -18
- package/dist/react/primitive-hooks/useActionBarCopy.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.js +2 -4
- package/dist/react/primitive-hooks/useActionBarEdit.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.js +2 -4
- package/dist/react/primitive-hooks/useActionBarReload.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.js +2 -6
- package/dist/react/primitive-hooks/useBranchPickerNext.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js +2 -6
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.js +2 -4
- package/dist/react/primitive-hooks/useComposerCancel.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.js +2 -4
- package/dist/react/primitive-hooks/useComposerSend.js.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.js +6 -2
- package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -1
- package/dist/react/primitives/message/MessageParts.d.ts +13 -0
- package/dist/react/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageParts.js.map +1 -1
- package/dist/react/primitives/thread/ThreadMessages.d.ts.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/runtimes/RemoteThreadListHookInstanceManager.d.ts +22 -10
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +109 -71
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +8 -2
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +40 -13
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadResource.d.ts +30 -0
- package/dist/react/runtimes/RemoteThreadResource.d.ts.map +1 -0
- package/dist/react/runtimes/RemoteThreadResource.js +134 -0
- package/dist/react/runtimes/RemoteThreadResource.js.map +1 -0
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts +3 -10
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts.map +1 -1
- package/dist/react/runtimes/RuntimeAdapterProvider.js +3 -6
- package/dist/react/runtimes/RuntimeAdapterProvider.js.map +1 -1
- package/dist/react/runtimes/assistant-transport/commandQueue.d.ts +17 -0
- package/dist/react/runtimes/assistant-transport/commandQueue.d.ts.map +1 -0
- package/dist/react/runtimes/assistant-transport/commandQueue.js +55 -0
- package/dist/react/runtimes/assistant-transport/commandQueue.js.map +1 -0
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.d.ts +11 -0
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.d.ts.map +1 -0
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.js +165 -0
- package/dist/react/runtimes/assistant-transport/replayBoundaryStream.js.map +1 -0
- package/dist/react/runtimes/assistant-transport/runManager.d.ts +15 -0
- package/dist/react/runtimes/assistant-transport/runManager.d.ts.map +1 -0
- package/dist/react/runtimes/assistant-transport/runManager.js +86 -0
- package/dist/react/runtimes/assistant-transport/runManager.js.map +1 -0
- package/dist/react/runtimes/assistant-transport/types.d.ts +130 -0
- package/dist/react/runtimes/assistant-transport/types.d.ts.map +1 -0
- package/dist/react/runtimes/assistant-transport/types.js +0 -0
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.d.ts +14 -0
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -0
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.js +296 -0
- package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.js.map +1 -0
- package/dist/react/runtimes/assistant-transport/useConvertedState.d.ts +7 -0
- package/dist/react/runtimes/assistant-transport/useConvertedState.d.ts.map +1 -0
- package/dist/react/runtimes/assistant-transport/useConvertedState.js +25 -0
- package/dist/react/runtimes/assistant-transport/useConvertedState.js.map +1 -0
- package/dist/react/runtimes/assistant-transport/useLatestRef.d.ts +7 -0
- package/dist/react/runtimes/assistant-transport/useLatestRef.d.ts.map +1 -0
- package/dist/react/runtimes/assistant-transport/useLatestRef.js +27 -0
- package/dist/react/runtimes/assistant-transport/useLatestRef.js.map +1 -0
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +39 -13
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts +2 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js +3 -3
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.d.ts +4 -0
- package/dist/react/runtimes/cloud/auiV0.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.js +7 -0
- package/dist/react/runtimes/cloud/auiV0.js.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js +22 -12
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListRuntime.d.ts +16 -0
- package/dist/react/runtimes/cloud/useCloudThreadListRuntime.d.ts.map +1 -0
- package/dist/react/runtimes/cloud/useCloudThreadListRuntime.js +36 -0
- package/dist/react/runtimes/cloud/useCloudThreadListRuntime.js.map +1 -0
- package/dist/react/runtimes/external-message-converter.js +14 -14
- package/dist/react/runtimes/external-message-converter.js.map +1 -1
- package/dist/react/runtimes/useExternalStoreRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useExternalStoreRuntime.js +44 -28
- package/dist/react/runtimes/useExternalStoreRuntime.js.map +1 -1
- package/dist/react/runtimes/useExternalStoreSharedOptions.js.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.js +1 -1
- package/dist/react/runtimes/useRuntimeAdapters.d.ts +9 -0
- package/dist/react/runtimes/useRuntimeAdapters.d.ts.map +1 -0
- package/dist/react/runtimes/useRuntimeAdapters.js +20 -0
- package/dist/react/runtimes/useRuntimeAdapters.js.map +1 -0
- package/dist/runtime/api/composer-runtime.d.ts +5 -0
- package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.js.map +1 -1
- package/dist/runtime/api/message-runtime.js +1 -1
- package/dist/runtime/api/thread-list-runtime.d.ts +1 -0
- package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-runtime.js +4 -2
- package/dist/runtime/api/thread-list-runtime.js.map +1 -1
- package/dist/runtime/api/thread-runtime.d.ts +12 -2
- package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-runtime.js +13 -3
- package/dist/runtime/api/thread-runtime.js.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.d.ts +25 -0
- package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.js +72 -18
- package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.d.ts +15 -0
- package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js +34 -3
- package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.js +1 -6
- package/dist/runtime/base/default-edit-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +0 -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 +11 -8
- package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
- package/dist/runtime/interfaces/thread-runtime-core.d.ts +6 -0
- package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/internal.js +5 -5
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts +15 -0
- package/dist/runtime/queue/external-thread-queue-adapter.d.ts.map +1 -1
- package/dist/runtime/queue/message-queue.d.ts.map +1 -1
- package/dist/runtime/queue/message-queue.js +25 -11
- package/dist/runtime/queue/message-queue.js.map +1 -1
- package/dist/runtime/utils/thread-runtime-lifecycle.d.ts +8 -0
- package/dist/runtime/utils/thread-runtime-lifecycle.d.ts.map +1 -0
- package/dist/runtime/utils/thread-runtime-lifecycle.js +11 -0
- package/dist/runtime/utils/thread-runtime-lifecycle.js.map +1 -0
- package/dist/runtimes/external-store/external-store-adapter.d.ts +7 -0
- package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-shared-options.js.map +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 +4 -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 +11 -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 +78 -20
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/internal.d.ts +1 -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 +55 -14
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +1 -0
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js +3 -0
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.js +3 -0
- package/dist/runtimes/remote-thread-list/empty-thread-core.js.map +1 -1
- package/dist/runtimes/remote-thread-list/types.d.ts +29 -1
- package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts +1 -12
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js +67 -38
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js.map +1 -1
- package/dist/store/clients/external-thread.d.ts +7 -0
- package/dist/store/clients/external-thread.d.ts.map +1 -1
- package/dist/store/clients/external-thread.js +460 -369
- package/dist/store/clients/external-thread.js.map +1 -1
- package/dist/store/clients/runtime-adapter.d.ts.map +1 -1
- package/dist/store/clients/runtime-adapter.js +5 -2
- package/dist/store/clients/runtime-adapter.js.map +1 -1
- package/dist/store/clients/single-thread-list.d.ts.map +1 -1
- package/dist/store/clients/single-thread-list.js +31 -27
- package/dist/store/clients/single-thread-list.js.map +1 -1
- package/dist/store/clients/suggestions.d.ts +3 -1
- package/dist/store/clients/suggestions.d.ts.map +1 -1
- package/dist/store/clients/suggestions.js +65 -37
- package/dist/store/clients/suggestions.js.map +1 -1
- package/dist/store/clients/thread-selection-events.d.ts +10 -0
- package/dist/store/clients/thread-selection-events.d.ts.map +1 -0
- package/dist/store/clients/thread-selection-events.js +40 -0
- package/dist/store/clients/thread-selection-events.js.map +1 -0
- package/dist/store/env.d.ts +5 -0
- package/dist/store/env.d.ts.map +1 -0
- package/dist/store/env.js +12 -0
- package/dist/store/env.js.map +1 -0
- package/dist/store/index.d.ts +6 -4
- package/dist/store/index.js +5 -3
- package/dist/store/internal.d.ts +4 -1
- package/dist/store/internal.js +4 -1
- package/dist/store/primitive-predicates.d.ts +19 -0
- package/dist/store/primitive-predicates.d.ts.map +1 -0
- package/dist/store/primitive-predicates.js +19 -0
- package/dist/store/primitive-predicates.js.map +1 -0
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/attachment-runtime-client.js +18 -11
- package/dist/store/runtime-clients/attachment-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/handle-runtime-action.d.ts +5 -0
- package/dist/store/runtime-clients/handle-runtime-action.d.ts.map +1 -0
- package/dist/store/runtime-clients/handle-runtime-action.js +12 -0
- package/dist/store/runtime-clients/handle-runtime-action.js.map +1 -0
- package/dist/store/runtime-clients/handle-thread-list-action.d.ts +5 -0
- package/dist/store/runtime-clients/handle-thread-list-action.d.ts.map +1 -0
- package/dist/store/runtime-clients/handle-thread-list-action.js +7 -0
- package/dist/store/runtime-clients/handle-thread-list-action.js.map +1 -0
- 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 +104 -57
- package/dist/store/runtime-clients/thread-list-item-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.js +5 -6
- 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 +98 -82
- package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
- package/dist/store/scope-registration.d.ts +2 -2
- package/dist/store/scopes/composer.d.ts +9 -4
- package/dist/store/scopes/composer.d.ts.map +1 -1
- package/dist/store/scopes/suggestions.d.ts +6 -1
- package/dist/store/scopes/suggestions.d.ts.map +1 -1
- package/dist/store/scopes/thread-list-item.d.ts +7 -6
- package/dist/store/scopes/thread-list-item.d.ts.map +1 -1
- package/dist/store/scopes/thread.d.ts +25 -7
- package/dist/store/scopes/thread.d.ts.map +1 -1
- package/dist/store/scopes/threads.d.ts +17 -1
- package/dist/store/scopes/threads.d.ts.map +1 -1
- package/dist/subscribable/subscribable.d.ts +2 -1
- package/dist/subscribable/subscribable.d.ts.map +1 -1
- package/dist/subscribable/subscribable.js +23 -18
- package/dist/subscribable/subscribable.js.map +1 -1
- package/dist/types/error.d.ts +15 -1
- package/dist/types/error.d.ts.map +1 -1
- package/dist/types/error.js +18 -1
- package/dist/types/error.js.map +1 -1
- package/dist/types/message.d.ts +2 -0
- package/dist/types/message.d.ts.map +1 -1
- package/dist/types/message.js.map +1 -1
- package/dist/utils/composite-context-provider.d.ts +1 -0
- package/dist/utils/composite-context-provider.d.ts.map +1 -1
- package/dist/utils/composite-context-provider.js +25 -9
- package/dist/utils/composite-context-provider.js.map +1 -1
- package/dist/utils/notify-event-listeners.d.ts +2 -2
- package/dist/utils/notify-event-listeners.d.ts.map +1 -1
- package/dist/utils/notify-event-listeners.js +2 -2
- package/dist/utils/notify-event-listeners.js.map +1 -1
- package/package.json +7 -7
- package/src/adapters/speech.test.ts +118 -1
- package/src/adapters/speech.ts +21 -22
- package/src/adapters/thread-history.ts +2 -0
- package/src/adapters/voice.test.ts +69 -0
- package/src/adapters/voice.ts +27 -27
- package/src/index.ts +2 -0
- package/src/model-context/frame/host.test.ts +23 -0
- package/src/model-context/frame/host.ts +2 -1
- package/src/model-context/registry.test.ts +131 -0
- package/src/model-context/registry.ts +16 -6
- package/src/react/RuntimeAdapter.test.ts +2 -0
- package/src/react/RuntimeAdapter.ts +20 -8
- package/src/react/adapters/LocalStorageThreadListAdapter.tsx +34 -17
- package/src/react/client/AdaptedRemoteThread.ts +41 -0
- package/src/react/client/InMemoryThreadList.test.tsx +148 -0
- package/src/react/client/InMemoryThreadList.ts +290 -0
- package/src/react/client/Interactables.test.ts +326 -2
- package/src/react/client/Interactables.ts +227 -110
- package/src/react/client/RemoteThreadList.test.ts +1026 -0
- package/src/react/client/RemoteThreadList.ts +1067 -0
- package/src/react/client/Tools.ts +36 -29
- package/src/react/client/interactable-model-context.ts +6 -1
- package/src/react/index.ts +13 -0
- package/src/react/interactables-legacy/Interactables.test.ts +317 -0
- package/src/react/interactables-legacy/Interactables.ts +204 -128
- package/src/react/primitive-hooks/useActionBarCopy.ts +2 -7
- package/src/react/primitive-hooks/useActionBarEdit.ts +2 -1
- package/src/react/primitive-hooks/useActionBarReload.ts +2 -6
- package/src/react/primitive-hooks/useBranchPickerNext.ts +2 -7
- package/src/react/primitive-hooks/useBranchPickerPrevious.ts +2 -7
- package/src/react/primitive-hooks/useComposerCancel.ts +2 -1
- package/src/react/primitive-hooks/useComposerSend.ts +2 -5
- package/src/react/primitive-hooks/useSuggestionTrigger.test.ts +11 -0
- package/src/react/primitive-hooks/useSuggestionTrigger.ts +4 -5
- package/src/react/primitives/message/MessageParts.tsx +0 -1
- package/src/react/primitives/thread/ThreadMessages.tsx +2 -1
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.retry.test.tsx +116 -0
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.running.test.tsx +1 -1
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.test.tsx +57 -6
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.title.test.tsx +272 -0
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.tsx +159 -124
- package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +59 -20
- package/src/react/runtimes/RemoteThreadResource.test.ts +141 -0
- package/src/react/runtimes/RemoteThreadResource.ts +231 -0
- package/src/react/runtimes/RuntimeAdapterProvider.tsx +8 -20
- package/src/react/runtimes/assistant-transport/commandQueue.ts +68 -0
- package/src/react/runtimes/assistant-transport/replayBoundaryStream.test.ts +455 -0
- package/src/react/runtimes/assistant-transport/replayBoundaryStream.ts +172 -0
- package/src/react/runtimes/assistant-transport/runManager.ts +124 -0
- package/src/react/runtimes/assistant-transport/transport-delivery.test.tsx +79 -0
- package/src/react/runtimes/assistant-transport/transport-parentid.test.tsx +97 -0
- package/src/react/runtimes/assistant-transport/transport-scheduling.test.ts +414 -0
- package/src/react/runtimes/assistant-transport/types.ts +170 -0
- package/src/react/runtimes/assistant-transport/useAssistantTransport.spec.md +141 -0
- package/src/react/runtimes/assistant-transport/useAssistantTransportRuntime.test.tsx +625 -0
- package/src/react/runtimes/assistant-transport/useAssistantTransportRuntime.ts +481 -0
- package/src/react/runtimes/assistant-transport/useConvertedState.ts +20 -0
- package/src/react/runtimes/assistant-transport/useLatestRef.ts +9 -0
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.tsx +131 -6
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.ts +61 -15
- package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.ts +6 -4
- package/src/react/runtimes/cloud/auiV0.ts +17 -1
- package/src/react/runtimes/cloud/useCloudThreadListAdapter.tsx +36 -21
- package/src/react/runtimes/cloud/useCloudThreadListRuntime.test.tsx +56 -0
- package/src/react/runtimes/cloud/useCloudThreadListRuntime.ts +31 -0
- package/src/react/runtimes/external-message-converter.test.ts +143 -0
- package/src/react/runtimes/external-message-converter.ts +41 -41
- package/src/react/runtimes/remote-thread-hook-on-tap.test.ts +58 -0
- package/src/react/runtimes/useExternalStoreRuntime.lifecycle.test.tsx +83 -0
- package/src/react/runtimes/useExternalStoreRuntime.suggestions.test.tsx +124 -0
- package/src/react/runtimes/useExternalStoreRuntime.ts +7 -0
- package/src/react/runtimes/useExternalStoreSharedOptions.ts +3 -1
- package/src/react/runtimes/useLocalRuntime.test.tsx +130 -4
- package/src/react/runtimes/useRuntimeAdapters.test.tsx +62 -0
- package/src/react/runtimes/useRuntimeAdapters.ts +28 -0
- package/src/runtime/api/composer-runtime.ts +5 -0
- package/src/runtime/api/thread-list-runtime.ts +3 -1
- package/src/runtime/api/thread-runtime.ts +28 -3
- package/src/runtime/base/base-composer-runtime-core.ts +106 -13
- package/src/runtime/base/base-thread-runtime-core.test.ts +191 -0
- package/src/runtime/base/base-thread-runtime-core.ts +47 -2
- package/src/runtime/base/default-edit-composer-runtime-core.ts +1 -15
- package/src/runtime/base/default-thread-composer-runtime-core.ts +13 -15
- package/src/runtime/interfaces/thread-runtime-core.ts +6 -0
- package/src/runtime/queue/external-thread-queue-adapter.ts +17 -0
- package/src/runtime/queue/message-queue.ts +28 -10
- package/src/runtime/utils/thread-runtime-lifecycle.ts +18 -0
- package/src/runtimes/external-store/external-store-adapter.ts +7 -0
- package/src/runtimes/external-store/external-store-shared-options.ts +3 -1
- 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 +187 -48
- package/src/runtimes/local/local-thread-runtime-core.test.ts +373 -4
- package/src/runtimes/local/local-thread-runtime-core.ts +83 -15
- package/src/runtimes/readonly/ReadonlyThreadRuntimeCore.ts +4 -0
- package/src/runtimes/remote-thread-list/empty-thread-core.ts +4 -0
- package/src/runtimes/remote-thread-list/types.ts +30 -0
- package/src/runtimes/tool-invocations/EDGE_CASES.md +17 -6
- package/src/runtimes/tool-invocations/ToolInvocationTracker.test.ts +243 -0
- package/src/runtimes/tool-invocations/ToolInvocationTracker.ts +127 -61
- package/src/store/clients/external-thread.ts +119 -16
- package/src/store/clients/model-context-client.test.ts +16 -8
- package/src/store/clients/runtime-adapter.ts +5 -2
- package/src/store/clients/single-thread-list.ts +2 -1
- package/src/store/clients/suggestions.ts +39 -13
- package/src/store/clients/thread-selection-events.ts +21 -0
- package/src/store/env.ts +11 -0
- package/src/store/index.ts +14 -1
- package/src/store/internal.ts +13 -0
- package/src/store/primitive-predicates.test.ts +184 -0
- package/src/store/primitive-predicates.ts +43 -0
- package/src/store/runtime-clients/attachment-runtime-client.test.ts +41 -0
- package/src/store/runtime-clients/attachment-runtime-client.ts +2 -1
- package/src/store/runtime-clients/handle-runtime-action.ts +11 -0
- package/src/store/runtime-clients/handle-thread-list-action.test.ts +69 -0
- package/src/store/runtime-clients/handle-thread-list-action.ts +6 -0
- package/src/store/runtime-clients/thread-list-item-runtime-client.ts +28 -35
- package/src/store/runtime-clients/thread-list-runtime-client.ts +9 -6
- package/src/store/runtime-clients/thread-runtime-client.ts +5 -0
- package/src/store/scopes/composer.ts +9 -4
- package/src/store/scopes/suggestions.ts +6 -0
- package/src/store/scopes/thread-list-item.ts +7 -6
- package/src/store/scopes/thread.ts +25 -7
- package/src/store/scopes/threads.ts +14 -0
- package/src/subscribable/subscribable.test.ts +77 -1
- package/src/subscribable/subscribable.ts +38 -23
- package/src/tests/RemoteThreadListThreadListRuntimeCore-switchToThread-unarchive.test.ts +25 -0
- package/src/tests/append-interactable-snapshots.test.ts +350 -0
- package/src/tests/auiV0Encode.test.ts +66 -0
- package/src/tests/base-composer-runtime-core-send.test.ts +156 -0
- package/src/tests/base-composer-runtime-core.test.ts +136 -1
- package/src/tests/composer-can-cancel.test.ts +101 -0
- package/src/tests/default-edit-composer-runtime-core.test.ts +0 -68
- package/src/tests/external-store-thread-list-runtime-core.test.ts +101 -0
- package/src/tests/external-store-thread-runtime-core-adapter.test.ts +491 -1
- package/src/tests/external-store-thread-runtime-core.test.ts +124 -0
- package/src/tests/external-thread-attachments.test.tsx +214 -0
- package/src/tests/external-thread-parity.test.tsx +54 -0
- package/src/tests/external-thread-refetch.test.tsx +117 -0
- package/src/tests/external-thread-suggestions.test.tsx +59 -0
- package/src/tests/interactables-toolui-migration.test.tsx +66 -0
- package/src/tests/message-queue.test.ts +54 -0
- package/src/tests/session-reset-notification.test.ts +145 -0
- package/src/tests/thread-message-like.test.ts +39 -0
- package/src/tests/thread-switch-events.test.tsx +234 -0
- package/src/tests/tools-scope-migration.test.tsx +58 -0
- package/src/types/error.ts +24 -0
- package/src/types/message.ts +2 -0
- package/src/utils/composite-context-provider.test.ts +139 -0
- package/src/utils/composite-context-provider.ts +26 -8
- package/src/utils/notify-event-listeners.ts +10 -5
- package/src/tests/default-thread-composer-runtime-core.test.ts +0 -82
|
@@ -7,53 +7,77 @@ const useSuggestionClient = (state) => {
|
|
|
7
7
|
return { getState: () => state };
|
|
8
8
|
};
|
|
9
9
|
const SuggestionClient = resource(useSuggestionClient);
|
|
10
|
-
const
|
|
11
|
-
const $ = c(
|
|
10
|
+
const useSuggestionsClient = (state) => {
|
|
11
|
+
const $ = c(9);
|
|
12
12
|
let t0;
|
|
13
|
-
if ($[0] !== suggestions) {
|
|
14
|
-
t0 = ()
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
$[0] = suggestions;
|
|
13
|
+
if ($[0] !== state.suggestions) {
|
|
14
|
+
t0 = state.suggestions.map(_temp);
|
|
15
|
+
$[0] = state.suggestions;
|
|
18
16
|
$[1] = t0;
|
|
19
17
|
} else t0 = $[1];
|
|
20
|
-
const
|
|
18
|
+
const suggestionClients = useClientLookup(t0);
|
|
21
19
|
let t1;
|
|
22
|
-
if ($[2] !== state
|
|
23
|
-
t1 =
|
|
24
|
-
$[2] = state
|
|
20
|
+
if ($[2] !== state) {
|
|
21
|
+
t1 = () => state;
|
|
22
|
+
$[2] = state;
|
|
25
23
|
$[3] = t1;
|
|
26
24
|
} else t1 = $[3];
|
|
27
|
-
const suggestionClients = useClientLookup(t1);
|
|
28
25
|
let t2;
|
|
29
|
-
if ($[4] !==
|
|
30
|
-
t2 = () =>
|
|
31
|
-
|
|
26
|
+
if ($[4] !== suggestionClients) {
|
|
27
|
+
t2 = (t3) => {
|
|
28
|
+
const { index: index_0 } = t3;
|
|
29
|
+
return suggestionClients.get({ index: index_0 });
|
|
30
|
+
};
|
|
31
|
+
$[4] = suggestionClients;
|
|
32
32
|
$[5] = t2;
|
|
33
33
|
} else t2 = $[5];
|
|
34
34
|
let t3;
|
|
35
|
-
if ($[6] !==
|
|
36
|
-
t3 =
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
if ($[6] !== t1 || $[7] !== t2) {
|
|
36
|
+
t3 = {
|
|
37
|
+
getState: t1,
|
|
38
|
+
suggestion: t2
|
|
39
39
|
};
|
|
40
|
-
$[6] =
|
|
41
|
-
$[7] =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
$[6] = t1;
|
|
41
|
+
$[7] = t2;
|
|
42
|
+
$[8] = t3;
|
|
43
|
+
} else t3 = $[8];
|
|
44
|
+
return t3;
|
|
45
|
+
};
|
|
46
|
+
const useStaticSuggestions = (suggestions) => {
|
|
47
|
+
const $ = c(2);
|
|
48
|
+
let t0;
|
|
49
|
+
if ($[0] !== suggestions) {
|
|
50
|
+
t0 = () => {
|
|
51
|
+
return { suggestions: (suggestions ?? []).map(_temp2) };
|
|
48
52
|
};
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return
|
|
53
|
+
$[0] = suggestions;
|
|
54
|
+
$[1] = t0;
|
|
55
|
+
} else t0 = $[1];
|
|
56
|
+
const [state] = useState(t0);
|
|
57
|
+
return useSuggestionsClient(state);
|
|
54
58
|
};
|
|
55
|
-
const Suggestions = resource(
|
|
56
|
-
|
|
59
|
+
const Suggestions = resource(useStaticSuggestions);
|
|
60
|
+
const useThreadSuggestions = (suggestions) => {
|
|
61
|
+
const $ = c(4);
|
|
62
|
+
let t0;
|
|
63
|
+
if ($[0] !== suggestions) {
|
|
64
|
+
t0 = suggestions.map(_temp3);
|
|
65
|
+
$[0] = suggestions;
|
|
66
|
+
$[1] = t0;
|
|
67
|
+
} else t0 = $[1];
|
|
68
|
+
let t1;
|
|
69
|
+
if ($[2] !== t0) {
|
|
70
|
+
t1 = { suggestions: t0 };
|
|
71
|
+
$[2] = t0;
|
|
72
|
+
$[3] = t1;
|
|
73
|
+
} else t1 = $[3];
|
|
74
|
+
return useSuggestionsClient(t1);
|
|
75
|
+
};
|
|
76
|
+
const ThreadSuggestions = resource(useThreadSuggestions);
|
|
77
|
+
function _temp(suggestion, index) {
|
|
78
|
+
return withKey(index, SuggestionClient(suggestion), [suggestion]);
|
|
79
|
+
}
|
|
80
|
+
function _temp2(s) {
|
|
57
81
|
if (typeof s === "string") return {
|
|
58
82
|
title: s,
|
|
59
83
|
label: "",
|
|
@@ -65,10 +89,14 @@ function _temp(s) {
|
|
|
65
89
|
prompt: s.prompt
|
|
66
90
|
};
|
|
67
91
|
}
|
|
68
|
-
function
|
|
69
|
-
return
|
|
92
|
+
function _temp3(s) {
|
|
93
|
+
return {
|
|
94
|
+
title: s.title ?? s.prompt,
|
|
95
|
+
label: s.label ?? "",
|
|
96
|
+
prompt: s.prompt
|
|
97
|
+
};
|
|
70
98
|
}
|
|
71
99
|
//#endregion
|
|
72
|
-
export { Suggestions };
|
|
100
|
+
export { Suggestions, ThreadSuggestions };
|
|
73
101
|
|
|
74
102
|
//# sourceMappingURL=suggestions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestions.js","names":["useState","resource","withKey","ClientOutput","useClientLookup","SuggestionsState","SuggestionState","SuggestionConfig","title","label","prompt","useSuggestionClient","state","getState","SuggestionClient","
|
|
1
|
+
{"version":3,"file":"suggestions.js","names":["useMemo","useState","resource","withKey","ClientOutput","useClientLookup","SuggestionsState","SuggestionState","ThreadSuggestion","SuggestionConfig","title","label","prompt","useSuggestionClient","state","getState","SuggestionClient","useSuggestionsClient","$","_c","t0","suggestions","map","_temp","suggestionClients","t1","t2","t3","index","index_0","get","suggestion","useStaticSuggestions","normalizedSuggestions","_temp2","Suggestions","useThreadSuggestions","_temp3","ThreadSuggestions","s"],"sources":["../../../src/store/clients/suggestions.ts"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport { resource, withKey } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport { useClientLookup } from \"@assistant-ui/store/client\";\nimport type { SuggestionsState } from \"../scopes/suggestions\";\nimport type { SuggestionState } from \"../scopes/suggestion\";\nimport type { ThreadSuggestion } from \"../../runtime/interfaces/thread-runtime-core\";\n\nexport type SuggestionConfig =\n | string\n | { title: string; label: string; prompt: string };\n\nconst useSuggestionClient = (\n state: SuggestionState,\n): ClientOutput<\"suggestion\"> => {\n return {\n getState: () => state,\n };\n};\n\nconst SuggestionClient = resource(useSuggestionClient);\n\nconst useSuggestionsClient = (\n state: SuggestionsState,\n): ClientOutput<\"suggestions\"> => {\n const suggestionClients = useClientLookup(\n state.suggestions.map((suggestion, index) =>\n withKey(index, SuggestionClient(suggestion), [suggestion]),\n ),\n );\n\n return {\n getState: () => state,\n suggestion: ({ index }: { index: number }) => {\n return suggestionClients.get({ index });\n },\n };\n};\n\nconst useStaticSuggestions = (\n suggestions?: SuggestionConfig[],\n): ClientOutput<\"suggestions\"> => {\n const [state] = useState<SuggestionsState>(() => {\n const normalizedSuggestions = (suggestions ?? []).map((s) => {\n if (typeof s === \"string\") {\n return {\n title: s,\n label: \"\",\n prompt: s,\n };\n }\n return {\n title: s.title,\n label: s.label,\n prompt: s.prompt,\n };\n });\n\n return {\n suggestions: normalizedSuggestions,\n };\n });\n\n return useSuggestionsClient(state);\n};\n\nexport const Suggestions = resource(useStaticSuggestions);\n\nconst useThreadSuggestions = (\n suggestions: readonly ThreadSuggestion[],\n): ClientOutput<\"suggestions\"> => {\n const state = useMemo<SuggestionsState>(\n () => ({\n suggestions: suggestions.map((s) => ({\n title: s.title ?? s.prompt,\n label: s.label ?? \"\",\n prompt: s.prompt,\n })),\n }),\n [suggestions],\n );\n\n return useSuggestionsClient(state);\n};\n\nexport const ThreadSuggestions = resource(useThreadSuggestions);\n"],"mappings":";;;;;AAYA,MAAMa,uBACJC,UAC+B;CAC/B,OAAO,EACLC,gBAAgBD,MAClB;AACF;AAEA,MAAME,mBAAmBd,SAASW,mBAAmB;AAErD,MAAMI,wBAAuBH,UAAA;CAAA,MAAAI,IAAAC,EAAA,CAAA;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAJ,MAAAO,aAAA;EAIzBD,KAAAN,MAAKO,YAAYC,IAAKC,KAEtB;EAACL,EAAA,KAAAJ,MAAAO;EAAAH,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAHH,MAAAM,oBAA0BnB,gBACxBe,EAGF;CAAE,IAAAK;CAAA,IAAAP,EAAA,OAAAJ,OAAA;EAGUW,WAAMX;EAAKI,EAAA,KAAAJ;EAAAI,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAM,mBAAA;EACTE,MAAAC,OAAA;GAAC,MAAA,EAAAC,OAAAC,YAAAF;GAA4B,OAChCH,kBAAiBM,IAAK,EAAAF,OAAEA,QAAM,CAAC;EAAC;EACxCV,EAAA,KAAAM;EAAAN,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,IAAAS;CAAA,IAAAT,EAAA,OAAAO,MAAAP,EAAA,OAAAQ,IAAA;EAJIC,KAAA;GAAAZ,UACKU;GAAWM,YACTL;EAGd;EAACR,EAAA,KAAAO;EAAAP,EAAA,KAAAQ;EAAAR,EAAA,KAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,OALMS;AAKN;AAGH,MAAMK,wBAAuBX,gBAAA;CAAA,MAAAH,IAAAC,EAAA,CAAA;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAG,aAAA;EAGgBD,WAAA;GActC,OAEI,EAAAC,cAfwBA,eAAA,CAAA,EAAA,CAAiBC,IAAMY,MAgBvCD,EACf;EAAC;EACFf,EAAA,KAAAG;EAAAH,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAnBD,MAAA,CAAAJ,SAAgBb,SAA2BmB,EAmB1C;CAAE,OAEIH,qBAAqBH,KAAK;AAAC;AAGpC,MAAaqB,cAAcjC,SAAS8B,oBAAoB;AAExD,MAAMI,wBAAuBf,gBAAA;CAAA,MAAAH,IAAAC,EAAA,CAAA;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAG,aAAA;EAKVD,KAAAC,YAAWC,IAAKe,MAI3B;EAACnB,EAAA,KAAAG;EAAAH,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAE,IAAA;EALEK,KAAA,EAAAJ,aACQD,GAKf;EAACF,EAAA,KAAAE;EAAAF,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAED,OAEKD,qBAAqBH,EAAK;AAAC;AAGpC,MAAawB,oBAAoBpC,SAASkC,oBAAoB;AA/DjC,SAAAb,MAAAQ,YAAAH,OAAA;CAAA,OAKvBzB,QAAQyB,OAAOZ,iBAAiBe,UAAU,GAAG,CAACA,UAAU,CAAC;AAAC;AAYnC,SAAAG,OAAAK,GAAA;CAKvB,IAAI,OAAOA,MAAM,UAAQ,OAChB;EAAA7B,OACE6B;EAAC5B,OACD;EAAEC,QACD2B;CACV;CACD,OACM;EAAA7B,OACE6B,EAAC7B;EAAMC,OACP4B,EAAC5B;EAAMC,QACN2B,EAAC3B;CACX;AAAC;AAasB,SAAAyB,OAAAE,GAAA;CAAA,OAKc;EAAA7B,OAC5B6B,EAAC7B,SAAU6B,EAAC3B;EAAOD,OACnB4B,EAAC5B,SAAD;EAAaC,QACZ2B,EAAC3B;CACX;AAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/store/clients/thread-selection-events.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Emits `threads.selectionChanged` whenever the main thread selection changes.
|
|
4
|
+
* Does not emit for the initially selected thread on mount. Every `threads`
|
|
5
|
+
* client whose selection can change calls this with its current main thread id.
|
|
6
|
+
*/
|
|
7
|
+
declare const useThreadSelectionEvents: (mainThreadId: string) => void;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { useThreadSelectionEvents };
|
|
10
|
+
//# sourceMappingURL=thread-selection-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread-selection-events.d.ts","names":[],"sources":["../../../src/store/clients/thread-selection-events.ts"],"mappings":";;;;;;cAQa,2BAA4B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
2
|
+
import { useEffect, useRef } from "@assistant-ui/tap/react-shim";
|
|
3
|
+
import { useAssistantEmit } from "@assistant-ui/store/client";
|
|
4
|
+
//#region src/store/clients/thread-selection-events.ts
|
|
5
|
+
/**
|
|
6
|
+
* Emits `threads.selectionChanged` whenever the main thread selection changes.
|
|
7
|
+
* Does not emit for the initially selected thread on mount. Every `threads`
|
|
8
|
+
* client whose selection can change calls this with its current main thread id.
|
|
9
|
+
*/
|
|
10
|
+
const useThreadSelectionEvents = (mainThreadId) => {
|
|
11
|
+
const $ = c(4);
|
|
12
|
+
const emit = useAssistantEmit();
|
|
13
|
+
const previousMainThreadIdRef = useRef(mainThreadId);
|
|
14
|
+
let t0;
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[0] !== emit || $[1] !== mainThreadId) {
|
|
17
|
+
t0 = () => {
|
|
18
|
+
const previousThreadId = previousMainThreadIdRef.current;
|
|
19
|
+
if (previousThreadId === mainThreadId) return;
|
|
20
|
+
previousMainThreadIdRef.current = mainThreadId;
|
|
21
|
+
emit("threads.selectionChanged", {
|
|
22
|
+
threadId: mainThreadId,
|
|
23
|
+
previousThreadId
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
t1 = [mainThreadId, emit];
|
|
27
|
+
$[0] = emit;
|
|
28
|
+
$[1] = mainThreadId;
|
|
29
|
+
$[2] = t0;
|
|
30
|
+
$[3] = t1;
|
|
31
|
+
} else {
|
|
32
|
+
t0 = $[2];
|
|
33
|
+
t1 = $[3];
|
|
34
|
+
}
|
|
35
|
+
useEffect(t0, t1);
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
export { useThreadSelectionEvents };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=thread-selection-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread-selection-events.js","names":["useEffect","useRef","useAssistantEmit","useThreadSelectionEvents","mainThreadId","$","_c","emit","previousMainThreadIdRef","t0","t1","previousThreadId","current","threadId"],"sources":["../../../src/store/clients/thread-selection-events.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { useAssistantEmit } from \"@assistant-ui/store/client\";\n\n/**\n * Emits `threads.selectionChanged` whenever the main thread selection changes.\n * Does not emit for the initially selected thread on mount. Every `threads`\n * client whose selection can change calls this with its current main thread id.\n */\nexport const useThreadSelectionEvents = (mainThreadId: string) => {\n const emit = useAssistantEmit();\n const previousMainThreadIdRef = useRef(mainThreadId);\n useEffect(() => {\n const previousThreadId = previousMainThreadIdRef.current;\n if (previousThreadId === mainThreadId) return;\n previousMainThreadIdRef.current = mainThreadId;\n emit(\"threads.selectionChanged\", {\n threadId: mainThreadId,\n previousThreadId,\n });\n }, [mainThreadId, emit]);\n};\n"],"mappings":";;;;;;;;;AAQA,MAAaG,4BAA2BC,iBAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACtC,MAAAC,OAAaL,iBAAiB;CAC9B,MAAAM,0BAAgCP,OAAOG,YAAY;CAAE,IAAAK;CAAA,IAAAC;CAAA,IAAAL,EAAA,OAAAE,QAAAF,EAAA,OAAAD,cAAA;EAC3CK,WAAA;GACR,MAAAE,mBAAyBH,wBAAuBI;GAChD,IAAID,qBAAqBP,cAAY;GACrCI,wBAAuBI,UAAWR;GAClCG,KAAK,4BAA4B;IAAAM,UACrBT;IAAYO;GAExB,CAAC;EAAC;EACDD,KAAA,CAACN,cAAcG,IAAI;EAACF,EAAA,KAAAE;EAAAF,EAAA,KAAAD;EAAAC,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;CAAA,OAAA;EAAAD,KAAAJ,EAAA;EAAAK,KAAAL,EAAA;CAAA;CARvBL,UAAUS,IAQPC,EAAoB;AAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","names":[],"sources":["../../src/store/env.ts"],"mappings":";cAEa"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/store/env.ts
|
|
2
|
+
const isDevelopment = (() => {
|
|
3
|
+
try {
|
|
4
|
+
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
5
|
+
} catch {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
})();
|
|
9
|
+
//#endregion
|
|
10
|
+
export { isDevelopment };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","names":["isDevelopment","process","env","NODE_ENV"],"sources":["../../src/store/env.ts"],"sourcesContent":["// Bundlers replace the process.env.NODE_ENV literal statically (Vite, webpack,\n// Metro); the try covers hosts where no process binding exists at runtime.\nexport const isDevelopment = (() => {\n try {\n return (\n process.env.NODE_ENV === \"development\" || process.env.NODE_ENV === \"test\"\n );\n } catch {\n return false;\n }\n})();\n"],"mappings":";AAEA,MAAaA,uBAAuB;CAClC,IAAI;EACF,OACEC,QAAQC,IAAIC,aAAa,iBAAiBF,QAAQC,IAAIC,aAAa;CAEvE,QAAQ;EACN,OAAO;CACT;AACF,EAAA,CAAG"}
|
package/dist/store/index.d.ts
CHANGED
|
@@ -6,13 +6,15 @@ import { AttachmentClientSchema, AttachmentMeta, AttachmentMethods, AttachmentSt
|
|
|
6
6
|
import { ComposerClientSchema, ComposerEvents, ComposerMeta, ComposerMethods, ComposerSendOptions, ComposerState } from "./scopes/composer.js";
|
|
7
7
|
import { PartClientSchema, PartMeta, PartMethods, PartState } from "./scopes/part.js";
|
|
8
8
|
import { MessageClientSchema, MessageMeta, MessageMethods, MessageState } from "./scopes/message.js";
|
|
9
|
-
import { ThreadClientSchema, ThreadEvents, ThreadMeta, ThreadMethods, ThreadState } from "./scopes/thread.js";
|
|
10
|
-
import { ThreadsClientSchema, ThreadsMethods, ThreadsState } from "./scopes/threads.js";
|
|
11
9
|
import { SuggestionClientSchema, SuggestionMeta, SuggestionMethods, SuggestionState } from "./scopes/suggestion.js";
|
|
12
10
|
import { Suggestion, SuggestionsClientSchema, SuggestionsMethods, SuggestionsState } from "./scopes/suggestions.js";
|
|
11
|
+
import { ThreadClientSchema, ThreadEvents, ThreadMeta, ThreadMethods, ThreadState } from "./scopes/thread.js";
|
|
12
|
+
import { ThreadsClientSchema, ThreadsEvents, ThreadsMethods, ThreadsState } from "./scopes/threads.js";
|
|
13
13
|
import { ModelContextClientSchema, ModelContextMethods, ModelContextState } from "./scopes/model-context.js";
|
|
14
14
|
import { ChainOfThoughtClientSchema, ChainOfThoughtMeta, ChainOfThoughtMethods, ChainOfThoughtPart, ChainOfThoughtState } from "./scopes/chain-of-thought.js";
|
|
15
|
-
import { RuntimeAdapter } from "../react/RuntimeAdapter.js";
|
|
15
|
+
import { RuntimeAdapter, runtimeAdapterTransformScopes } from "../react/RuntimeAdapter.js";
|
|
16
|
+
import { InMemoryThreadList, InMemoryThreadListProps, inMemoryThreadListTransformScopes } from "../react/client/InMemoryThreadList.js";
|
|
17
|
+
import { RemoteThreadList, RemoteThreadListProps } from "../react/client/RemoteThreadList.js";
|
|
16
18
|
import { JoinStrategy, convertExternalMessages, useExternalMessageConverter } from "../react/runtimes/external-message-converter.js";
|
|
17
19
|
import { StreamingTimingAccessors, StreamingTimingOptions, StreamingTimingState } from "../runtime/utils/streaming-timing.js";
|
|
18
20
|
import { useStreamingTiming } from "../react/runtimes/useStreamingTiming.js";
|
|
@@ -27,4 +29,4 @@ import { SuggestionConfig, Suggestions } from "./clients/suggestions.js";
|
|
|
27
29
|
import { ChainOfThoughtClient } from "./clients/chain-of-thought-client.js";
|
|
28
30
|
import { ThreadMessageClient, ThreadMessageClientProps } from "./clients/thread-message-client.js";
|
|
29
31
|
import { ModelContext } from "./clients/model-context-client.js";
|
|
30
|
-
export { type AttachmentClientSchema, type AttachmentMeta, type AttachmentMethods, type AttachmentState, ChainOfThoughtClient, type ChainOfThoughtClientSchema, type ChainOfThoughtMeta, type ChainOfThoughtMethods, type ChainOfThoughtPart, type ChainOfThoughtState, type ComposerClientSchema, type ComposerEvents, type ComposerMeta, type ComposerMethods, type ComposerSendOptions, type ComposerState, ExternalThread, type ExternalThreadMessage, type ExternalThreadProps, type JoinStrategy, type McpToolkitDefinition, type McpToolkitEntry, type McpToolkitToolConfig, type MessageClientSchema, type MessageMeta, type MessageMethods, type MessageState, ModelContext, type ModelContextClientSchema, type ModelContextMethods, type ModelContextState, NoOpComposerClient, type PartClientSchema, type PartMeta, type PartMethods, type PartState, type QueueItemClientSchema, type QueueItemMeta, type QueueItemMethods, type QueueItemState, RuntimeAdapter, type RuntimeExtrasBrand, SingleThreadList, type StreamingTimingAccessors, type StreamingTimingOptions, type StreamingTimingState, type Suggestion, type SuggestionClientSchema, type SuggestionConfig, type SuggestionMeta, type SuggestionMethods, type SuggestionState, Suggestions, type SuggestionsClientSchema, type SuggestionsMethods, type SuggestionsState, type ThreadClientSchema, type ThreadEvents, type ThreadListItemClientSchema, type ThreadListItemEvents, type ThreadListItemMeta, type ThreadListItemMethods, type ThreadListItemState, ThreadMessageClient, type ThreadMessageClientProps, type ThreadMeta, type ThreadMethods, type ThreadState, type ThreadsClientSchema, type ThreadsMethods, type ThreadsState, type Toolkit, type ToolkitDefinition, type ToolkitDefinitionEntry, convertExternalMessages, createRuntimeExtrasBrand, defineMcpToolkit, defineToolkit, useExternalMessageConverter, useStreamingTiming };
|
|
32
|
+
export { type AttachmentClientSchema, type AttachmentMeta, type AttachmentMethods, type AttachmentState, ChainOfThoughtClient, type ChainOfThoughtClientSchema, type ChainOfThoughtMeta, type ChainOfThoughtMethods, type ChainOfThoughtPart, type ChainOfThoughtState, type ComposerClientSchema, type ComposerEvents, type ComposerMeta, type ComposerMethods, type ComposerSendOptions, type ComposerState, ExternalThread, type ExternalThreadMessage, type ExternalThreadProps, InMemoryThreadList, type InMemoryThreadListProps, type JoinStrategy, type McpToolkitDefinition, type McpToolkitEntry, type McpToolkitToolConfig, type MessageClientSchema, type MessageMeta, type MessageMethods, type MessageState, ModelContext, type ModelContextClientSchema, type ModelContextMethods, type ModelContextState, NoOpComposerClient, type PartClientSchema, type PartMeta, type PartMethods, type PartState, type QueueItemClientSchema, type QueueItemMeta, type QueueItemMethods, type QueueItemState, RemoteThreadList, type RemoteThreadListProps, RuntimeAdapter, type RuntimeExtrasBrand, SingleThreadList, type StreamingTimingAccessors, type StreamingTimingOptions, type StreamingTimingState, type Suggestion, type SuggestionClientSchema, type SuggestionConfig, type SuggestionMeta, type SuggestionMethods, type SuggestionState, Suggestions, type SuggestionsClientSchema, type SuggestionsMethods, type SuggestionsState, type ThreadClientSchema, type ThreadEvents, type ThreadListItemClientSchema, type ThreadListItemEvents, type ThreadListItemMeta, type ThreadListItemMethods, type ThreadListItemState, ThreadMessageClient, type ThreadMessageClientProps, type ThreadMeta, type ThreadMethods, type ThreadState, type ThreadsClientSchema, type ThreadsEvents, type ThreadsMethods, type ThreadsState, type Toolkit, type ToolkitDefinition, type ToolkitDefinitionEntry, convertExternalMessages, createRuntimeExtrasBrand, defineMcpToolkit, defineToolkit, inMemoryThreadListTransformScopes, runtimeAdapterTransformScopes, useExternalMessageConverter, useStreamingTiming };
|
package/dist/store/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { ModelContext } from "./clients/model-context-client.js";
|
|
2
1
|
import { Suggestions } from "./clients/suggestions.js";
|
|
3
|
-
import {
|
|
2
|
+
import { ModelContext } from "./clients/model-context-client.js";
|
|
3
|
+
import { RuntimeAdapter, runtimeAdapterTransformScopes } from "../react/RuntimeAdapter.js";
|
|
4
4
|
import { defineToolkit } from "../react/model-context/define-toolkit.js";
|
|
5
5
|
import { defineMcpToolkit } from "../react/model-context/define-mcp-toolkit.js";
|
|
6
|
+
import { InMemoryThreadList, inMemoryThreadListTransformScopes } from "../react/client/InMemoryThreadList.js";
|
|
7
|
+
import { RemoteThreadList } from "../react/client/RemoteThreadList.js";
|
|
6
8
|
import { convertExternalMessages, useExternalMessageConverter } from "../react/runtimes/external-message-converter.js";
|
|
7
9
|
import { useStreamingTiming } from "../react/runtimes/useStreamingTiming.js";
|
|
8
10
|
import { createRuntimeExtrasBrand } from "../runtime/utils/runtime-extras-brand.js";
|
|
@@ -11,4 +13,4 @@ import { ExternalThread } from "./clients/external-thread.js";
|
|
|
11
13
|
import { NoOpComposerClient } from "./clients/no-op-composer-client.js";
|
|
12
14
|
import { ChainOfThoughtClient } from "./clients/chain-of-thought-client.js";
|
|
13
15
|
import { ThreadMessageClient } from "./clients/thread-message-client.js";
|
|
14
|
-
export { ChainOfThoughtClient, ExternalThread, ModelContext, NoOpComposerClient, RuntimeAdapter, SingleThreadList, Suggestions, ThreadMessageClient, convertExternalMessages, createRuntimeExtrasBrand, defineMcpToolkit, defineToolkit, useExternalMessageConverter, useStreamingTiming };
|
|
16
|
+
export { ChainOfThoughtClient, ExternalThread, InMemoryThreadList, ModelContext, NoOpComposerClient, RemoteThreadList, RuntimeAdapter, SingleThreadList, Suggestions, ThreadMessageClient, convertExternalMessages, createRuntimeExtrasBrand, defineMcpToolkit, defineToolkit, inMemoryThreadListTransformScopes, runtimeAdapterTransformScopes, useExternalMessageConverter, useStreamingTiming };
|
package/dist/store/internal.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { baseRuntimeAdapterTransformScopes } from "./clients/runtime-adapter.js";
|
|
2
|
+
import { useThreadSelectionEvents } from "./clients/thread-selection-events.js";
|
|
3
|
+
import { isDevelopment } from "./env.js";
|
|
2
4
|
import { AttachmentRuntimeClient } from "./runtime-clients/attachment-runtime-client.js";
|
|
3
5
|
import { MessagePartClient } from "./runtime-clients/message-part-runtime-client.js";
|
|
4
6
|
import { ComposerClient } from "./runtime-clients/composer-runtime-client.js";
|
|
@@ -6,4 +8,5 @@ import { MessageClient } from "./runtime-clients/message-runtime-client.js";
|
|
|
6
8
|
import { ThreadClient } from "./runtime-clients/thread-runtime-client.js";
|
|
7
9
|
import { ThreadListItemClient } from "./runtime-clients/thread-list-item-runtime-client.js";
|
|
8
10
|
import { ThreadListClient } from "./runtime-clients/thread-list-runtime-client.js";
|
|
9
|
-
|
|
11
|
+
import { actionBarCopyDisabled, actionBarEditDisabled, actionBarReloadDisabled, branchPickerNextDisabled, branchPickerPreviousDisabled, composerCancelDisabled, composerInputDisabled, composerSendDisabled, suggestionTriggerDisabled } from "./primitive-predicates.js";
|
|
12
|
+
export { AttachmentRuntimeClient, ComposerClient, MessageClient, MessagePartClient, ThreadClient, ThreadListClient, ThreadListItemClient, actionBarCopyDisabled, actionBarEditDisabled, actionBarReloadDisabled, baseRuntimeAdapterTransformScopes, branchPickerNextDisabled, branchPickerPreviousDisabled, composerCancelDisabled, composerInputDisabled, composerSendDisabled, isDevelopment, suggestionTriggerDisabled, useThreadSelectionEvents };
|
package/dist/store/internal.js
CHANGED
|
@@ -4,6 +4,9 @@ import { ComposerClient } from "./runtime-clients/composer-runtime-client.js";
|
|
|
4
4
|
import { MessageClient } from "./runtime-clients/message-runtime-client.js";
|
|
5
5
|
import { ThreadClient } from "./runtime-clients/thread-runtime-client.js";
|
|
6
6
|
import { ThreadListItemClient } from "./runtime-clients/thread-list-item-runtime-client.js";
|
|
7
|
+
import { useThreadSelectionEvents } from "./clients/thread-selection-events.js";
|
|
7
8
|
import { ThreadListClient } from "./runtime-clients/thread-list-runtime-client.js";
|
|
8
9
|
import { baseRuntimeAdapterTransformScopes } from "./clients/runtime-adapter.js";
|
|
9
|
-
|
|
10
|
+
import { actionBarCopyDisabled, actionBarEditDisabled, actionBarReloadDisabled, branchPickerNextDisabled, branchPickerPreviousDisabled, composerCancelDisabled, composerInputDisabled, composerSendDisabled, suggestionTriggerDisabled } from "./primitive-predicates.js";
|
|
11
|
+
import { isDevelopment } from "./env.js";
|
|
12
|
+
export { AttachmentRuntimeClient, ComposerClient, MessageClient, MessagePartClient, ThreadClient, ThreadListClient, ThreadListItemClient, actionBarCopyDisabled, actionBarEditDisabled, actionBarReloadDisabled, baseRuntimeAdapterTransformScopes, branchPickerNextDisabled, branchPickerPreviousDisabled, composerCancelDisabled, composerInputDisabled, composerSendDisabled, isDevelopment, suggestionTriggerDisabled, useThreadSelectionEvents };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AssistantState } from "@assistant-ui/store";
|
|
2
|
+
//#region src/store/primitive-predicates.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Disabled predicates shared by every binding's primitive layer. Each binding
|
|
5
|
+
* consumes these as state selectors so the disabled semantics of a primitive
|
|
6
|
+
* cannot drift between frameworks.
|
|
7
|
+
*/
|
|
8
|
+
declare const composerSendDisabled: (s: AssistantState) => boolean;
|
|
9
|
+
declare const composerCancelDisabled: (s: AssistantState) => boolean;
|
|
10
|
+
declare const composerInputDisabled: (s: AssistantState) => boolean;
|
|
11
|
+
declare const actionBarEditDisabled: (s: AssistantState) => boolean;
|
|
12
|
+
declare const actionBarReloadDisabled: (s: AssistantState) => boolean;
|
|
13
|
+
declare const actionBarCopyDisabled: (s: AssistantState) => boolean;
|
|
14
|
+
declare const branchPickerPreviousDisabled: (s: AssistantState) => boolean;
|
|
15
|
+
declare const branchPickerNextDisabled: (s: AssistantState) => boolean;
|
|
16
|
+
declare const suggestionTriggerDisabled: (s: AssistantState, send: boolean) => boolean;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { actionBarCopyDisabled, actionBarEditDisabled, actionBarReloadDisabled, branchPickerNextDisabled, branchPickerPreviousDisabled, composerCancelDisabled, composerInputDisabled, composerSendDisabled, suggestionTriggerDisabled };
|
|
19
|
+
//# sourceMappingURL=primitive-predicates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitive-predicates.d.ts","names":[],"sources":["../../src/store/primitive-predicates.ts"],"mappings":";;;;;;;cAQa,uBAAwB,GAAG;cAG3B,yBAA0B,GAAG;cAG7B,wBAAyB,GAAG;cAG5B,wBAAyB,GAAG;cAG5B,0BAA2B,GAAG;cAG9B,wBAAyB,GAAG;cAM5B,+BAAgC,GAAG;cAInC,2BAA4B,GAAG;cAI/B,4BACX,GAAG,gBACH"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/store/primitive-predicates.ts
|
|
2
|
+
/**
|
|
3
|
+
* Disabled predicates shared by every binding's primitive layer. Each binding
|
|
4
|
+
* consumes these as state selectors so the disabled semantics of a primitive
|
|
5
|
+
* cannot drift between frameworks.
|
|
6
|
+
*/
|
|
7
|
+
const composerSendDisabled = (s) => !s.composer.canSend || s.thread.isRunning && !s.thread.capabilities.queue;
|
|
8
|
+
const composerCancelDisabled = (s) => !s.composer.canCancel;
|
|
9
|
+
const composerInputDisabled = (s) => s.thread.isDisabled || s.composer.dictation?.inputDisabled === true;
|
|
10
|
+
const actionBarEditDisabled = (s) => s.composer.isEditing;
|
|
11
|
+
const actionBarReloadDisabled = (s) => s.thread.isRunning || s.thread.isDisabled || s.message.role !== "assistant";
|
|
12
|
+
const actionBarCopyDisabled = (s) => !((s.message.role !== "assistant" || s.message.status?.type !== "running") && s.message.parts.some((part) => part.type === "text" && part.text.length > 0));
|
|
13
|
+
const branchPickerPreviousDisabled = (s) => s.message.branchNumber <= 1 || s.thread.isRunning && !s.thread.capabilities.switchBranchDuringRun;
|
|
14
|
+
const branchPickerNextDisabled = (s) => s.message.branchNumber >= s.message.branchCount || s.thread.isRunning && !s.thread.capabilities.switchBranchDuringRun;
|
|
15
|
+
const suggestionTriggerDisabled = (s, send) => s.thread.isDisabled || send && s.thread.isRunning && !s.thread.capabilities.queue;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { actionBarCopyDisabled, actionBarEditDisabled, actionBarReloadDisabled, branchPickerNextDisabled, branchPickerPreviousDisabled, composerCancelDisabled, composerInputDisabled, composerSendDisabled, suggestionTriggerDisabled };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=primitive-predicates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitive-predicates.js","names":["AssistantState","composerSendDisabled","s","composer","canSend","thread","isRunning","capabilities","queue","composerCancelDisabled","canCancel","composerInputDisabled","isDisabled","dictation","inputDisabled","actionBarEditDisabled","isEditing","actionBarReloadDisabled","message","role","actionBarCopyDisabled","status","type","parts","some","part","text","length","branchPickerPreviousDisabled","branchNumber","switchBranchDuringRun","branchPickerNextDisabled","branchCount","suggestionTriggerDisabled","send"],"sources":["../../src/store/primitive-predicates.ts"],"sourcesContent":["import type { AssistantState } from \"@assistant-ui/store\";\n\n/**\n * Disabled predicates shared by every binding's primitive layer. Each binding\n * consumes these as state selectors so the disabled semantics of a primitive\n * cannot drift between frameworks.\n */\n\nexport const composerSendDisabled = (s: AssistantState): boolean =>\n !s.composer.canSend || (s.thread.isRunning && !s.thread.capabilities.queue);\n\nexport const composerCancelDisabled = (s: AssistantState): boolean =>\n !s.composer.canCancel;\n\nexport const composerInputDisabled = (s: AssistantState): boolean =>\n s.thread.isDisabled || s.composer.dictation?.inputDisabled === true;\n\nexport const actionBarEditDisabled = (s: AssistantState): boolean =>\n s.composer.isEditing;\n\nexport const actionBarReloadDisabled = (s: AssistantState): boolean =>\n s.thread.isRunning || s.thread.isDisabled || s.message.role !== \"assistant\";\n\nexport const actionBarCopyDisabled = (s: AssistantState): boolean =>\n !(\n (s.message.role !== \"assistant\" || s.message.status?.type !== \"running\") &&\n s.message.parts.some((part) => part.type === \"text\" && part.text.length > 0)\n );\n\nexport const branchPickerPreviousDisabled = (s: AssistantState): boolean =>\n s.message.branchNumber <= 1 ||\n (s.thread.isRunning && !s.thread.capabilities.switchBranchDuringRun);\n\nexport const branchPickerNextDisabled = (s: AssistantState): boolean =>\n s.message.branchNumber >= s.message.branchCount ||\n (s.thread.isRunning && !s.thread.capabilities.switchBranchDuringRun);\n\nexport const suggestionTriggerDisabled = (\n s: AssistantState,\n send: boolean,\n): boolean =>\n s.thread.isDisabled ||\n (send && s.thread.isRunning && !s.thread.capabilities.queue);\n"],"mappings":";;;;;;AAQA,MAAaC,wBAAwBC,MACnC,CAACA,EAAEC,SAASC,WAAYF,EAAEG,OAAOC,aAAa,CAACJ,EAAEG,OAAOE,aAAaC;AAEvE,MAAaC,0BAA0BP,MACrC,CAACA,EAAEC,SAASO;AAEd,MAAaC,yBAAyBT,MACpCA,EAAEG,OAAOO,cAAcV,EAAEC,SAASU,WAAWC,kBAAkB;AAEjE,MAAaC,yBAAyBb,MACpCA,EAAEC,SAASa;AAEb,MAAaC,2BAA2Bf,MACtCA,EAAEG,OAAOC,aAAaJ,EAAEG,OAAOO,cAAcV,EAAEgB,QAAQC,SAAS;AAElE,MAAaC,yBAAyBlB,MACpC,GACGA,EAAEgB,QAAQC,SAAS,eAAejB,EAAEgB,QAAQG,QAAQC,SAAS,cAC9DpB,EAAEgB,QAAQK,MAAMC,MAAMC,SAASA,KAAKH,SAAS,UAAUG,KAAKC,KAAKC,SAAS,CAAC;AAG/E,MAAaC,gCAAgC1B,MAC3CA,EAAEgB,QAAQW,gBAAgB,KACzB3B,EAAEG,OAAOC,aAAa,CAACJ,EAAEG,OAAOE,aAAauB;AAEhD,MAAaC,4BAA4B7B,MACvCA,EAAEgB,QAAQW,gBAAgB3B,EAAEgB,QAAQc,eACnC9B,EAAEG,OAAOC,aAAa,CAACJ,EAAEG,OAAOE,aAAauB;AAEhD,MAAaG,6BACX/B,GACAgC,SAEAhC,EAAEG,OAAOO,cACRsB,QAAQhC,EAAEG,OAAOC,aAAa,CAACJ,EAAEG,OAAOE,aAAaC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-runtime-client.d.ts","names":[],"sources":["../../../src/store/runtime-clients/attachment-runtime-client.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"attachment-runtime-client.d.ts","names":[],"sources":["../../../src/store/runtime-clients/attachment-runtime-client.ts"],"mappings":";;;cAoBa,qDAAuB,SAAA;EAXzB,SAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { handleRuntimeAction } from "./handle-runtime-action.js";
|
|
1
2
|
import { useSubscribable } from "./useSubscribable.js";
|
|
2
3
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
3
4
|
import { resource } from "@assistant-ui/tap";
|
|
4
5
|
//#region src/store/runtime-clients/attachment-runtime-client.ts
|
|
5
6
|
const useAttachmentRuntimeClient = (t0) => {
|
|
6
|
-
const $ = c(
|
|
7
|
+
const $ = c(9);
|
|
7
8
|
const { runtime } = t0;
|
|
8
9
|
const state = useSubscribable(runtime);
|
|
9
10
|
let t1;
|
|
@@ -13,24 +14,30 @@ const useAttachmentRuntimeClient = (t0) => {
|
|
|
13
14
|
$[1] = t1;
|
|
14
15
|
} else t1 = $[1];
|
|
15
16
|
let t2;
|
|
17
|
+
let t3;
|
|
16
18
|
if ($[2] !== runtime) {
|
|
17
|
-
t2 = () => runtime;
|
|
19
|
+
t2 = () => handleRuntimeAction("attachment remove", runtime.remove);
|
|
20
|
+
t3 = () => runtime;
|
|
18
21
|
$[2] = runtime;
|
|
19
22
|
$[3] = t2;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
t3 =
|
|
23
|
+
$[4] = t3;
|
|
24
|
+
} else {
|
|
25
|
+
t2 = $[3];
|
|
26
|
+
t3 = $[4];
|
|
27
|
+
}
|
|
28
|
+
let t4;
|
|
29
|
+
if ($[5] !== t1 || $[6] !== t2 || $[7] !== t3) {
|
|
30
|
+
t4 = {
|
|
24
31
|
getState: t1,
|
|
25
|
-
remove:
|
|
26
|
-
__internal_getRuntime:
|
|
32
|
+
remove: t2,
|
|
33
|
+
__internal_getRuntime: t3
|
|
27
34
|
};
|
|
28
|
-
$[4] = runtime.remove;
|
|
29
35
|
$[5] = t1;
|
|
30
36
|
$[6] = t2;
|
|
31
37
|
$[7] = t3;
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
$[8] = t4;
|
|
39
|
+
} else t4 = $[8];
|
|
40
|
+
return t4;
|
|
34
41
|
};
|
|
35
42
|
const AttachmentRuntimeClient = resource(useAttachmentRuntimeClient);
|
|
36
43
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-runtime-client.js","names":["resource","ClientOutput","AttachmentRuntime","useSubscribable","useAttachmentRuntimeClient","t0","$","_c","runtime","state","t1","t2","t3","remove","getState","__internal_getRuntime","AttachmentRuntimeClient"],"sources":["../../../src/store/runtime-clients/attachment-runtime-client.ts"],"sourcesContent":["import { resource } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport type { AttachmentRuntime } from \"../../runtime/api/attachment-runtime\";\nimport { useSubscribable } from \"./useSubscribable\";\n\nconst useAttachmentRuntimeClient = ({\n runtime,\n}: {\n runtime: AttachmentRuntime;\n}): ClientOutput<\"attachment\"> => {\n const state = useSubscribable(runtime);\n\n return {\n getState: () => state,\n remove: runtime.remove,\n __internal_getRuntime: () => runtime,\n };\n};\n\nexport const AttachmentRuntimeClient = resource(useAttachmentRuntimeClient);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"attachment-runtime-client.js","names":["resource","ClientOutput","AttachmentRuntime","handleRuntimeAction","useSubscribable","useAttachmentRuntimeClient","t0","$","_c","runtime","state","t1","t2","t3","remove","t4","getState","__internal_getRuntime","AttachmentRuntimeClient"],"sources":["../../../src/store/runtime-clients/attachment-runtime-client.ts"],"sourcesContent":["import { resource } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport type { AttachmentRuntime } from \"../../runtime/api/attachment-runtime\";\nimport { handleRuntimeAction } from \"./handle-runtime-action\";\nimport { useSubscribable } from \"./useSubscribable\";\n\nconst useAttachmentRuntimeClient = ({\n runtime,\n}: {\n runtime: AttachmentRuntime;\n}): ClientOutput<\"attachment\"> => {\n const state = useSubscribable(runtime);\n\n return {\n getState: () => state,\n remove: () => handleRuntimeAction(\"attachment remove\", runtime.remove),\n __internal_getRuntime: () => runtime,\n };\n};\n\nexport const AttachmentRuntimeClient = resource(useAttachmentRuntimeClient);\n"],"mappings":";;;;;AAMA,MAAMK,8BAA6BC,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAC,YAAAH;CAKlC,MAAAI,QAAcN,gBAAgBK,OAAO;CAAE,IAAAE;CAAA,IAAAJ,EAAA,OAAAG,OAAA;EAG3BC,WAAMD;EAAKH,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAK;CAAA,IAAAC;CAAA,IAAAN,EAAA,OAAAE,SAAA;EACbG,WAAMT,oBAAoB,qBAAqBM,QAAOK,MAAO;EAC9CD,WAAMJ;EAAOF,EAAA,KAAAE;EAAAF,EAAA,KAAAK;EAAAL,EAAA,KAAAM;CAAA,OAAA;EAAAD,KAAAL,EAAA;EAAAM,KAAAN,EAAA;CAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAI,MAAAJ,EAAA,OAAAK,MAAAL,EAAA,OAAAM,IAAA;EAH/BE,KAAA;GAAAC,UACKL;GAAWG,QACbF;GAA8DK,uBAC/CJ;EACzB;EAACN,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAM;EAAAN,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OAJMQ;AAIN;AAGH,MAAaG,0BAA0BlB,SAASK,0BAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-runtime-action.d.ts","names":[],"sources":["../../../src/store/runtime-clients/handle-runtime-action.ts"],"mappings":";cAAa,sBACX,eACA,eAAe,kBACd"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/store/runtime-clients/handle-runtime-action.ts
|
|
2
|
+
const handleRuntimeAction = (label, execute) => {
|
|
3
|
+
const task = execute();
|
|
4
|
+
task.catch((error) => {
|
|
5
|
+
console.error(`[assistant-ui] ${label} failed:`, error);
|
|
6
|
+
});
|
|
7
|
+
return task;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { handleRuntimeAction };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=handle-runtime-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-runtime-action.js","names":["handleRuntimeAction","label","execute","Promise","task","catch","error","console"],"sources":["../../../src/store/runtime-clients/handle-runtime-action.ts"],"sourcesContent":["export const handleRuntimeAction = (\n label: string,\n execute: () => Promise<void>,\n): Promise<void> => {\n const task = execute();\n\n void task.catch((error: unknown) => {\n console.error(`[assistant-ui] ${label} failed:`, error);\n });\n return task;\n};\n"],"mappings":";AAAA,MAAaA,uBACXC,OACAC,YACkB;CAClB,MAAME,OAAOF,QAAQ;CAErB,KAAUG,OAAOC,UAAmB;EAClCC,QAAQD,MAAM,kBAAkBL,MAAK,WAAYK,KAAK;CACxD,CAAC;CACD,OAAOF;AACT"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region src/store/runtime-clients/handle-thread-list-action.d.ts
|
|
2
|
+
declare const handleThreadListAction: (action: string, execute: () => Promise<void>) => Promise<void>;
|
|
3
|
+
//#endregion
|
|
4
|
+
export { handleThreadListAction };
|
|
5
|
+
//# sourceMappingURL=handle-thread-list-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-thread-list-action.d.ts","names":[],"sources":["../../../src/store/runtime-clients/handle-thread-list-action.ts"],"mappings":";cAEa,yBACX,gBACA,eAAe,kBACd"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { handleRuntimeAction } from "./handle-runtime-action.js";
|
|
2
|
+
//#region src/store/runtime-clients/handle-thread-list-action.ts
|
|
3
|
+
const handleThreadListAction = (action, execute) => handleRuntimeAction(`thread list ${action}`, execute);
|
|
4
|
+
//#endregion
|
|
5
|
+
export { handleThreadListAction };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=handle-thread-list-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-thread-list-action.js","names":["handleRuntimeAction","handleThreadListAction","action","execute","Promise"],"sources":["../../../src/store/runtime-clients/handle-thread-list-action.ts"],"sourcesContent":["import { handleRuntimeAction } from \"./handle-runtime-action\";\n\nexport const handleThreadListAction = (\n action: string,\n execute: () => Promise<void>,\n): Promise<void> => handleRuntimeAction(`thread list ${action}`, execute);\n"],"mappings":";;AAEA,MAAaC,0BACXC,QACAC,YACkBH,oBAAoB,eAAeE,UAAUC,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-list-item-runtime-client.d.ts","names":[],"sources":["../../../src/store/runtime-clients/thread-list-item-runtime-client.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"thread-list-item-runtime-client.d.ts","names":[],"sources":["../../../src/store/runtime-clients/thread-list-item-runtime-client.ts"],"mappings":";;;cA8Da,kDAAoB,SAAA;EAlDtB,SAAA;EAIa"}
|