@assistant-ui/react 0.9.6 → 0.10.1
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/api/AssistantRuntime.js +8 -34
- package/dist/api/AssistantRuntime.js.map +1 -1
- package/dist/api/AttachmentRuntime.js +12 -41
- package/dist/api/AttachmentRuntime.js.map +1 -1
- package/dist/api/ComposerRuntime.js +29 -54
- package/dist/api/ComposerRuntime.js.map +1 -1
- package/dist/api/ContentPartRuntime.js +4 -30
- package/dist/api/ContentPartRuntime.js.map +1 -1
- package/dist/api/MessageRuntime.js +34 -55
- package/dist/api/MessageRuntime.js.map +1 -1
- package/dist/api/RuntimePathTypes.js +0 -18
- package/dist/api/RuntimePathTypes.js.map +1 -1
- package/dist/api/ThreadListItemRuntime.js +4 -30
- package/dist/api/ThreadListItemRuntime.js.map +1 -1
- package/dist/api/ThreadListRuntime.js +30 -52
- package/dist/api/ThreadListRuntime.js.map +1 -1
- package/dist/api/ThreadRuntime.js +27 -50
- package/dist/api/ThreadRuntime.js.map +1 -1
- package/dist/api/index.js +0 -18
- package/dist/api/index.js.map +1 -1
- package/dist/api/subscribable/BaseSubject.js +4 -30
- package/dist/api/subscribable/BaseSubject.js.map +1 -1
- package/dist/api/subscribable/EventSubscriptionSubject.js +5 -31
- package/dist/api/subscribable/EventSubscriptionSubject.js.map +1 -1
- package/dist/api/subscribable/LazyMemoizeSubject.js +7 -33
- package/dist/api/subscribable/LazyMemoizeSubject.js.map +1 -1
- package/dist/api/subscribable/NestedSubscriptionSubject.js +5 -31
- package/dist/api/subscribable/NestedSubscriptionSubject.js.map +1 -1
- package/dist/api/subscribable/SKIP_UPDATE.js +3 -29
- package/dist/api/subscribable/SKIP_UPDATE.js.map +1 -1
- package/dist/api/subscribable/ShallowMemoizeSubject.js +10 -36
- package/dist/api/subscribable/ShallowMemoizeSubject.js.map +1 -1
- package/dist/api/subscribable/Subscribable.js +0 -18
- package/dist/api/subscribable/Subscribable.js.map +1 -1
- package/dist/api/subscribable/shallowEqual.js +2 -28
- package/dist/api/subscribable/shallowEqual.js.map +1 -1
- package/dist/cloud/AssistantCloud.js +12 -38
- package/dist/cloud/AssistantCloud.js.map +1 -1
- package/dist/cloud/AssistantCloudAPI.js +14 -36
- package/dist/cloud/AssistantCloudAPI.js.map +1 -1
- package/dist/cloud/AssistantCloudAuthStrategy.js +10 -38
- package/dist/cloud/AssistantCloudAuthStrategy.js.map +1 -1
- package/dist/cloud/AssistantCloudAuthTokens.js +4 -30
- package/dist/cloud/AssistantCloudAuthTokens.js.map +1 -1
- package/dist/cloud/AssistantCloudRuns.js +6 -32
- package/dist/cloud/AssistantCloudRuns.js.map +1 -1
- package/dist/cloud/AssistantCloudThreadHistoryAdapter.js +12 -38
- package/dist/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/cloud/AssistantCloudThreadMessages.js +4 -30
- package/dist/cloud/AssistantCloudThreadMessages.js.map +1 -1
- package/dist/cloud/AssistantCloudThreads.js +6 -32
- package/dist/cloud/AssistantCloudThreads.js.map +1 -1
- package/dist/cloud/auiV0.js +8 -35
- package/dist/cloud/auiV0.js.map +1 -1
- package/dist/cloud/index.js +4 -31
- package/dist/cloud/index.js.map +1 -1
- package/dist/cloud/useCloudThreadListRuntime.js +7 -33
- package/dist/cloud/useCloudThreadListRuntime.js.map +1 -1
- package/dist/context/ReadonlyStore.js +3 -29
- package/dist/context/ReadonlyStore.js.map +1 -1
- package/dist/context/index.js +3 -28
- package/dist/context/index.js.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.js +31 -53
- package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
- package/dist/context/providers/AttachmentRuntimeProvider.js +16 -42
- package/dist/context/providers/AttachmentRuntimeProvider.js.map +1 -1
- package/dist/context/providers/ContentPartRuntimeProvider.js +16 -42
- package/dist/context/providers/ContentPartRuntimeProvider.js.map +1 -1
- package/dist/context/providers/MessageRuntimeProvider.js +19 -45
- package/dist/context/providers/MessageRuntimeProvider.js.map +1 -1
- package/dist/context/providers/TextContentPartProvider.js +24 -46
- package/dist/context/providers/TextContentPartProvider.js.map +1 -1
- package/dist/context/providers/ThreadListItemRuntimeProvider.js +18 -42
- package/dist/context/providers/ThreadListItemRuntimeProvider.js.map +1 -1
- package/dist/context/providers/ThreadRuntimeProvider.js +19 -45
- package/dist/context/providers/ThreadRuntimeProvider.js.map +1 -1
- package/dist/context/providers/ThreadViewportProvider.js +19 -42
- package/dist/context/providers/ThreadViewportProvider.js.map +1 -1
- package/dist/context/providers/index.js +4 -31
- package/dist/context/providers/index.js.map +1 -1
- package/dist/context/react/AssistantContext.js +11 -42
- package/dist/context/react/AssistantContext.js.map +1 -1
- package/dist/context/react/AttachmentContext.js +11 -45
- package/dist/context/react/AttachmentContext.js.map +1 -1
- package/dist/context/react/ComposerContext.js +8 -35
- package/dist/context/react/ComposerContext.js.map +1 -1
- package/dist/context/react/ContentPartContext.js +8 -36
- package/dist/context/react/ContentPartContext.js.map +1 -1
- package/dist/context/react/MessageContext.js +12 -43
- package/dist/context/react/MessageContext.js.map +1 -1
- package/dist/context/react/ThreadContext.js +12 -42
- package/dist/context/react/ThreadContext.js.map +1 -1
- package/dist/context/react/ThreadListItemContext.js +8 -36
- package/dist/context/react/ThreadListItemContext.js.map +1 -1
- package/dist/context/react/ThreadViewportContext.js +8 -36
- package/dist/context/react/ThreadViewportContext.js.map +1 -1
- package/dist/context/react/index.js +38 -62
- package/dist/context/react/index.js.map +1 -1
- package/dist/context/react/utils/createContextHook.js +4 -30
- package/dist/context/react/utils/createContextHook.js.map +1 -1
- package/dist/context/react/utils/createContextStoreHook.js +2 -28
- package/dist/context/react/utils/createContextStoreHook.js.map +1 -1
- package/dist/context/react/utils/createStateHookForRuntime.js +6 -30
- package/dist/context/react/utils/createStateHookForRuntime.js.map +1 -1
- package/dist/context/react/utils/ensureBinding.js +21 -27
- package/dist/context/react/utils/ensureBinding.js.map +1 -1
- package/dist/context/react/utils/useRuntimeState.js +8 -35
- package/dist/context/react/utils/useRuntimeState.js.map +1 -1
- package/dist/context/stores/AssistantToolUIs.js +4 -30
- package/dist/context/stores/AssistantToolUIs.js.map +1 -1
- package/dist/context/stores/MessageUtils.js +4 -30
- package/dist/context/stores/MessageUtils.js.map +1 -1
- package/dist/context/stores/ThreadViewport.js +5 -31
- package/dist/context/stores/ThreadViewport.js.map +1 -1
- package/dist/context/stores/index.js +0 -18
- package/dist/context/stores/index.js.map +1 -1
- package/dist/index.js +10 -54
- package/dist/index.js.map +1 -1
- package/dist/internal.js +16 -51
- package/dist/internal.js.map +1 -1
- package/dist/model-context/ModelContextTypes.d.ts +14 -41
- package/dist/model-context/ModelContextTypes.d.ts.map +1 -1
- package/dist/model-context/ModelContextTypes.js +3 -48
- package/dist/model-context/ModelContextTypes.js.map +1 -1
- package/dist/model-context/index.js +17 -47
- package/dist/model-context/index.js.map +1 -1
- package/dist/model-context/makeAssistantTool.js +5 -31
- package/dist/model-context/makeAssistantTool.js.map +1 -1
- package/dist/model-context/makeAssistantToolUI.js +7 -31
- package/dist/model-context/makeAssistantToolUI.js.map +1 -1
- package/dist/model-context/makeAssistantVisible.d.ts.map +1 -1
- package/dist/model-context/makeAssistantVisible.js +33 -52
- package/dist/model-context/makeAssistantVisible.js.map +1 -1
- package/dist/model-context/tool.d.ts +6 -6
- package/dist/model-context/tool.d.ts.map +1 -1
- package/dist/model-context/tool.js +2 -28
- package/dist/model-context/tool.js.map +1 -1
- package/dist/model-context/useAssistantInstructions.js +8 -34
- package/dist/model-context/useAssistantInstructions.js.map +1 -1
- package/dist/model-context/useAssistantTool.js +12 -35
- package/dist/model-context/useAssistantTool.js.map +1 -1
- package/dist/model-context/useAssistantToolUI.js +7 -33
- package/dist/model-context/useAssistantToolUI.js.map +1 -1
- package/dist/model-context/useInlineRender.js +8 -34
- package/dist/model-context/useInlineRender.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.js +24 -47
- package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.js +12 -36
- package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +17 -43
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +15 -41
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.js +15 -39
- package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarRoot.js +15 -38
- package/dist/primitives/actionBar/ActionBarRoot.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.js +12 -36
- package/dist/primitives/actionBar/ActionBarSpeak.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js +21 -44
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js.map +1 -1
- package/dist/primitives/actionBar/index.js +17 -50
- package/dist/primitives/actionBar/index.js.map +1 -1
- package/dist/primitives/actionBar/useActionBarFloatStatus.js +13 -37
- package/dist/primitives/actionBar/useActionBarFloatStatus.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalAnchor.js +9 -45
- package/dist/primitives/assistantModal/AssistantModalAnchor.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.js +11 -47
- package/dist/primitives/assistantModal/AssistantModalContent.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.js +14 -50
- package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.js +9 -45
- package/dist/primitives/assistantModal/AssistantModalTrigger.js.map +1 -1
- package/dist/primitives/assistantModal/index.js +9 -38
- package/dist/primitives/assistantModal/index.js.map +1 -1
- package/dist/primitives/assistantModal/scope.js +4 -40
- package/dist/primitives/assistantModal/scope.js.map +1 -1
- package/dist/primitives/attachment/AttachmentName.js +7 -33
- package/dist/primitives/attachment/AttachmentName.js.map +1 -1
- package/dist/primitives/attachment/AttachmentRemove.js +11 -35
- package/dist/primitives/attachment/AttachmentRemove.js.map +1 -1
- package/dist/primitives/attachment/AttachmentRoot.js +7 -33
- package/dist/primitives/attachment/AttachmentRoot.js.map +1 -1
- package/dist/primitives/attachment/AttachmentThumb.js +9 -35
- package/dist/primitives/attachment/AttachmentThumb.js.map +1 -1
- package/dist/primitives/attachment/index.js +9 -38
- package/dist/primitives/attachment/index.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerCount.js +8 -34
- package/dist/primitives/branchPicker/BranchPickerCount.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.js +15 -36
- package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNumber.js +8 -34
- package/dist/primitives/branchPicker/BranchPickerNumber.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.js +15 -36
- package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.js +8 -34
- package/dist/primitives/branchPicker/BranchPickerRoot.js.map +1 -1
- package/dist/primitives/branchPicker/index.js +11 -41
- package/dist/primitives/branchPicker/index.js.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.js +12 -36
- package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.js +19 -45
- package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/primitives/composer/ComposerCancel.js +12 -36
- package/dist/primitives/composer/ComposerCancel.js.map +1 -1
- package/dist/primitives/composer/ComposerIf.js +6 -32
- package/dist/primitives/composer/ComposerIf.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +39 -67
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerRoot.js +14 -38
- package/dist/primitives/composer/ComposerRoot.js.map +1 -1
- package/dist/primitives/composer/ComposerSend.js +15 -40
- package/dist/primitives/composer/ComposerSend.js.map +1 -1
- package/dist/primitives/composer/index.js +15 -47
- package/dist/primitives/composer/index.js.map +1 -1
- package/dist/primitives/contentPart/ContentPartImage.js +9 -35
- package/dist/primitives/contentPart/ContentPartImage.js.map +1 -1
- package/dist/primitives/contentPart/ContentPartInProgress.js +5 -31
- package/dist/primitives/contentPart/ContentPartInProgress.js.map +1 -1
- package/dist/primitives/contentPart/ContentPartText.js +11 -35
- package/dist/primitives/contentPart/ContentPartText.js.map +1 -1
- package/dist/primitives/contentPart/index.js +7 -35
- package/dist/primitives/contentPart/index.js.map +1 -1
- package/dist/primitives/contentPart/useContentPartFile.js +5 -31
- package/dist/primitives/contentPart/useContentPartFile.js.map +1 -1
- package/dist/primitives/contentPart/useContentPartImage.js +5 -31
- package/dist/primitives/contentPart/useContentPartImage.js.map +1 -1
- package/dist/primitives/contentPart/useContentPartReasoning.js +5 -31
- package/dist/primitives/contentPart/useContentPartReasoning.js.map +1 -1
- package/dist/primitives/contentPart/useContentPartSource.js +5 -31
- package/dist/primitives/contentPart/useContentPartSource.js.map +1 -1
- package/dist/primitives/contentPart/useContentPartText.js +5 -31
- package/dist/primitives/contentPart/useContentPartText.js.map +1 -1
- package/dist/primitives/index.js +18 -69
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/message/MessageAttachments.js +19 -45
- package/dist/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/primitives/message/MessageContent.js +54 -72
- package/dist/primitives/message/MessageContent.js.map +1 -1
- package/dist/primitives/message/MessageIf.js +12 -35
- package/dist/primitives/message/MessageIf.js.map +1 -1
- package/dist/primitives/message/MessageRoot.js +18 -41
- package/dist/primitives/message/MessageRoot.js.map +1 -1
- package/dist/primitives/message/index.js +9 -38
- package/dist/primitives/message/index.js.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.js +5 -31
- package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
- package/dist/primitives/thread/ThreadIf.js +6 -32
- package/dist/primitives/thread/ThreadIf.js.map +1 -1
- package/dist/primitives/thread/ThreadMessages.js +23 -50
- package/dist/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/primitives/thread/ThreadRoot.js +7 -33
- package/dist/primitives/thread/ThreadRoot.js.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.js +15 -36
- package/dist/primitives/thread/ThreadScrollToBottom.js.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.js +13 -37
- package/dist/primitives/thread/ThreadSuggestion.js.map +1 -1
- package/dist/primitives/thread/ThreadViewport.js +14 -40
- package/dist/primitives/thread/ThreadViewport.js.map +1 -1
- package/dist/primitives/thread/index.js +15 -47
- package/dist/primitives/thread/index.js.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js +22 -48
- package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js +14 -40
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.js +14 -40
- package/dist/primitives/threadList/ThreadListNew.js.map +1 -1
- package/dist/primitives/threadList/ThreadListRoot.js +7 -33
- package/dist/primitives/threadList/ThreadListRoot.js.map +1 -1
- package/dist/primitives/threadList/index.js +7 -35
- package/dist/primitives/threadList/index.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.js +11 -35
- package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemDelete.js +9 -33
- package/dist/primitives/threadListItem/ThreadListItemDelete.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.js +10 -36
- package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTitle.js +7 -33
- package/dist/primitives/threadListItem/ThreadListItemTitle.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js +9 -33
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +9 -33
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -1
- package/dist/primitives/threadListItem/index.js +13 -44
- package/dist/primitives/threadListItem/index.js.map +1 -1
- package/dist/runtimes/adapters/RuntimeAdapterProvider.js +10 -37
- package/dist/runtimes/adapters/RuntimeAdapterProvider.js.map +1 -1
- package/dist/runtimes/adapters/attachment/AttachmentAdapter.js +0 -18
- package/dist/runtimes/adapters/attachment/AttachmentAdapter.js.map +1 -1
- package/dist/runtimes/adapters/attachment/CompositeAttachmentAdapter.js +4 -30
- package/dist/runtimes/adapters/attachment/CompositeAttachmentAdapter.js.map +1 -1
- package/dist/runtimes/adapters/attachment/SimpleImageAttachmentAdapter.js +5 -31
- package/dist/runtimes/adapters/attachment/SimpleImageAttachmentAdapter.js.map +1 -1
- package/dist/runtimes/adapters/attachment/SimpleTextAttachmentAdapter.js +5 -31
- package/dist/runtimes/adapters/attachment/SimpleTextAttachmentAdapter.js.map +1 -1
- package/dist/runtimes/adapters/attachment/index.js +5 -33
- package/dist/runtimes/adapters/attachment/index.js.map +1 -1
- package/dist/runtimes/adapters/feedback/FeedbackAdapter.js +0 -18
- package/dist/runtimes/adapters/feedback/FeedbackAdapter.js.map +1 -1
- package/dist/runtimes/adapters/feedback/index.js +0 -18
- package/dist/runtimes/adapters/feedback/index.js.map +1 -1
- package/dist/runtimes/adapters/index.js +4 -30
- package/dist/runtimes/adapters/index.js.map +1 -1
- package/dist/runtimes/adapters/speech/SpeechAdapterTypes.js +0 -18
- package/dist/runtimes/adapters/speech/SpeechAdapterTypes.js.map +1 -1
- package/dist/runtimes/adapters/speech/WebSpeechSynthesisAdapter.js +4 -30
- package/dist/runtimes/adapters/speech/WebSpeechSynthesisAdapter.js.map +1 -1
- package/dist/runtimes/adapters/speech/index.js +3 -29
- package/dist/runtimes/adapters/speech/index.js.map +1 -1
- package/dist/runtimes/adapters/suggestion/SuggestionAdapter.js +0 -18
- package/dist/runtimes/adapters/suggestion/SuggestionAdapter.js.map +1 -1
- package/dist/runtimes/adapters/suggestion/index.js +0 -18
- package/dist/runtimes/adapters/suggestion/index.js.map +1 -1
- package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.js +0 -18
- package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.js.map +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.js +6 -32
- package/dist/runtimes/composer/BaseComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js +8 -34
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.js +5 -31
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/AssistantRuntimeCore.js +0 -18
- package/dist/runtimes/core/AssistantRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.js +6 -32
- package/dist/runtimes/core/BaseAssistantRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.js +14 -38
- package/dist/runtimes/core/BaseThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/ComposerRuntimeCore.js +0 -18
- package/dist/runtimes/core/ComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/ThreadListRuntimeCore.js +0 -18
- package/dist/runtimes/core/ThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/ThreadRuntimeCore.js +0 -18
- package/dist/runtimes/core/ThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/index.js +0 -18
- package/dist/runtimes/core/index.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.js +0 -18
- package/dist/runtimes/external-store/ExternalStoreAdapter.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +10 -36
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js +9 -35
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +23 -47
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageConverter.js +4 -30
- package/dist/runtimes/external-store/ThreadMessageConverter.js.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.js +8 -34
- package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
- package/dist/runtimes/external-store/auto-status.js +6 -33
- package/dist/runtimes/external-store/auto-status.js.map +1 -1
- package/dist/runtimes/external-store/createMessageConverter.d.ts +5 -1
- package/dist/runtimes/external-store/createMessageConverter.d.ts.map +1 -1
- package/dist/runtimes/external-store/createMessageConverter.js +22 -40
- package/dist/runtimes/external-store/createMessageConverter.js.map +1 -1
- package/dist/runtimes/external-store/external-message-converter.js +30 -54
- package/dist/runtimes/external-store/external-message-converter.js.map +1 -1
- package/dist/runtimes/external-store/getExternalStoreMessage.js +7 -35
- package/dist/runtimes/external-store/getExternalStoreMessage.js.map +1 -1
- package/dist/runtimes/external-store/index.js +14 -39
- package/dist/runtimes/external-store/index.js.map +1 -1
- package/dist/runtimes/external-store/useExternalStoreRuntime.d.ts +2 -2
- package/dist/runtimes/external-store/useExternalStoreRuntime.d.ts.map +1 -1
- package/dist/runtimes/external-store/useExternalStoreRuntime.js +14 -38
- package/dist/runtimes/external-store/useExternalStoreRuntime.js.map +1 -1
- package/dist/runtimes/index.js +8 -40
- package/dist/runtimes/index.js.map +1 -1
- package/dist/runtimes/local/ChatModelAdapter.js +0 -18
- package/dist/runtimes/local/ChatModelAdapter.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.js +11 -37
- package/dist/runtimes/local/LocalRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.js +3 -29
- package/dist/runtimes/local/LocalRuntimeOptions.js.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js +6 -32
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js +11 -37
- package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/index.js +3 -29
- package/dist/runtimes/local/index.js.map +1 -1
- package/dist/runtimes/local/shouldContinue.js +3 -29
- package/dist/runtimes/local/shouldContinue.js.map +1 -1
- package/dist/runtimes/local/useLocalRuntime.js +18 -44
- package/dist/runtimes/local/useLocalRuntime.js.map +1 -1
- package/dist/runtimes/remote-thread-list/BaseSubscribable.js +4 -30
- package/dist/runtimes/remote-thread-list/BaseSubscribable.js.map +1 -1
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.js +4 -30
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.js.map +1 -1
- package/dist/runtimes/remote-thread-list/OptimisticState.js +6 -32
- package/dist/runtimes/remote-thread-list/OptimisticState.js.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.js +33 -50
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +28 -54
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/cloud.js +23 -44
- package/dist/runtimes/remote-thread-list/adapter/cloud.js.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/in-memory.js +4 -30
- package/dist/runtimes/remote-thread-list/adapter/in-memory.js.map +1 -1
- package/dist/runtimes/remote-thread-list/index.js +5 -32
- package/dist/runtimes/remote-thread-list/index.js.map +1 -1
- package/dist/runtimes/remote-thread-list/types.js +0 -18
- package/dist/runtimes/remote-thread-list/types.js.map +1 -1
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js +13 -39
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/runtimes/utils/MessageRepository.js +14 -41
- package/dist/runtimes/utils/MessageRepository.js.map +1 -1
- package/dist/tests/setup.js +3 -2995
- package/dist/tests/setup.js.map +1 -1
- package/dist/types/AssistantTypes.js +0 -18
- package/dist/types/AssistantTypes.js.map +1 -1
- package/dist/types/AttachmentTypes.js +0 -18
- package/dist/types/AttachmentTypes.js.map +1 -1
- package/dist/types/ContentPartComponentTypes.js +0 -18
- package/dist/types/ContentPartComponentTypes.js.map +1 -1
- package/dist/types/Unsubscribe.js +0 -18
- package/dist/types/Unsubscribe.js.map +1 -1
- package/dist/types/index.js +0 -18
- package/dist/types/index.js.map +1 -1
- package/dist/utils/CompositeContextProvider.js +8 -32
- package/dist/utils/CompositeContextProvider.js.map +1 -1
- package/dist/utils/RequireAtLeastOne.js +0 -18
- package/dist/utils/RequireAtLeastOne.js.map +1 -1
- package/dist/utils/combined/createCombinedStore.js +5 -31
- package/dist/utils/combined/createCombinedStore.js.map +1 -1
- package/dist/utils/combined/useCombinedStore.js +8 -32
- package/dist/utils/combined/useCombinedStore.js.map +1 -1
- package/dist/utils/createActionButton.js +13 -37
- package/dist/utils/createActionButton.js.map +1 -1
- package/dist/utils/getThreadMessageText.js +3 -29
- package/dist/utils/getThreadMessageText.js.map +1 -1
- package/dist/utils/hooks/useManagedRef.js +6 -32
- package/dist/utils/hooks/useManagedRef.js.map +1 -1
- package/dist/utils/hooks/useOnResizeContent.js +9 -35
- package/dist/utils/hooks/useOnResizeContent.js.map +1 -1
- package/dist/utils/hooks/useOnScrollToBottom.js +9 -35
- package/dist/utils/hooks/useOnScrollToBottom.js.map +1 -1
- package/dist/utils/idUtils.js +7 -35
- package/dist/utils/idUtils.js.map +1 -1
- package/dist/utils/json/is-json.js +2 -30
- package/dist/utils/json/is-json.js.map +1 -1
- package/dist/utils/json/json-value.js +0 -18
- package/dist/utils/json/json-value.js.map +1 -1
- package/dist/utils/smooth/SmoothContext.js +24 -48
- package/dist/utils/smooth/SmoothContext.js.map +1 -1
- package/dist/utils/smooth/index.js +4 -32
- package/dist/utils/smooth/index.js.map +1 -1
- package/dist/utils/smooth/useSmooth.js +23 -49
- package/dist/utils/smooth/useSmooth.js.map +1 -1
- package/dist/utils/useToolArgsFieldStatus.js +8 -34
- package/dist/utils/useToolArgsFieldStatus.js.map +1 -1
- package/package.json +10 -16
- package/src/model-context/ModelContextTypes.ts +14 -21
- package/src/model-context/makeAssistantVisible.tsx +2 -0
- package/src/model-context/tool.ts +6 -12
- package/src/runtimes/external-store/createMessageConverter.tsx +10 -1
- package/src/runtimes/external-store/useExternalStoreRuntime.tsx +7 -2
- package/dist/api/AssistantRuntime.mjs +0 -46
- package/dist/api/AssistantRuntime.mjs.map +0 -1
- package/dist/api/AttachmentRuntime.mjs +0 -59
- package/dist/api/AttachmentRuntime.mjs.map +0 -1
- package/dist/api/ComposerRuntime.mjs +0 -230
- package/dist/api/ComposerRuntime.mjs.map +0 -1
- package/dist/api/ContentPartRuntime.mjs +0 -47
- package/dist/api/ContentPartRuntime.mjs.map +0 -1
- package/dist/api/MessageRuntime.mjs +0 -212
- package/dist/api/MessageRuntime.mjs.map +0 -1
- package/dist/api/RuntimePathTypes.mjs +0 -1
- package/dist/api/RuntimePathTypes.mjs.map +0 -1
- package/dist/api/ThreadListItemRuntime.mjs +0 -71
- package/dist/api/ThreadListItemRuntime.mjs.map +0 -1
- package/dist/api/ThreadListRuntime.mjs +0 -165
- package/dist/api/ThreadListRuntime.mjs.map +0 -1
- package/dist/api/ThreadRuntime.mjs +0 -235
- package/dist/api/ThreadRuntime.mjs.map +0 -1
- package/dist/api/index.mjs +0 -1
- package/dist/api/index.mjs.map +0 -1
- package/dist/api/subscribable/BaseSubject.mjs +0 -32
- package/dist/api/subscribable/BaseSubject.mjs.map +0 -1
- package/dist/api/subscribable/EventSubscriptionSubject.mjs +0 -37
- package/dist/api/subscribable/EventSubscriptionSubject.mjs.map +0 -1
- package/dist/api/subscribable/LazyMemoizeSubject.mjs +0 -37
- package/dist/api/subscribable/LazyMemoizeSubject.mjs.map +0 -1
- package/dist/api/subscribable/NestedSubscriptionSubject.mjs +0 -41
- package/dist/api/subscribable/NestedSubscriptionSubject.mjs.map +0 -1
- package/dist/api/subscribable/SKIP_UPDATE.mjs +0 -6
- package/dist/api/subscribable/SKIP_UPDATE.mjs.map +0 -1
- package/dist/api/subscribable/ShallowMemoizeSubject.mjs +0 -41
- package/dist/api/subscribable/ShallowMemoizeSubject.mjs.map +0 -1
- package/dist/api/subscribable/Subscribable.mjs +0 -1
- package/dist/api/subscribable/Subscribable.mjs.map +0 -1
- package/dist/api/subscribable/shallowEqual.mjs +0 -16
- package/dist/api/subscribable/shallowEqual.mjs.map +0 -1
- package/dist/cloud/AssistantCloud.mjs +0 -22
- package/dist/cloud/AssistantCloud.mjs.map +0 -1
- package/dist/cloud/AssistantCloudAPI.mjs +0 -87
- package/dist/cloud/AssistantCloudAPI.mjs.map +0 -1
- package/dist/cloud/AssistantCloudAuthStrategy.mjs +0 -139
- package/dist/cloud/AssistantCloudAuthStrategy.mjs.map +0 -1
- package/dist/cloud/AssistantCloudAuthTokens.mjs +0 -13
- package/dist/cloud/AssistantCloudAuthTokens.mjs.map +0 -1
- package/dist/cloud/AssistantCloudRuns.mjs +0 -21
- package/dist/cloud/AssistantCloudRuns.mjs.map +0 -1
- package/dist/cloud/AssistantCloudThreadHistoryAdapter.mjs +0 -47
- package/dist/cloud/AssistantCloudThreadHistoryAdapter.mjs.map +0 -1
- package/dist/cloud/AssistantCloudThreadMessages.mjs +0 -21
- package/dist/cloud/AssistantCloudThreadMessages.mjs.map +0 -1
- package/dist/cloud/AssistantCloudThreads.mjs +0 -30
- package/dist/cloud/AssistantCloudThreads.mjs.map +0 -1
- package/dist/cloud/auiV0.mjs +0 -88
- package/dist/cloud/auiV0.mjs.map +0 -1
- package/dist/cloud/index.mjs +0 -8
- package/dist/cloud/index.mjs.map +0 -1
- package/dist/cloud/useCloudThreadListRuntime.mjs +0 -20
- package/dist/cloud/useCloudThreadListRuntime.mjs.map +0 -1
- package/dist/context/ReadonlyStore.mjs +0 -8
- package/dist/context/ReadonlyStore.mjs.map +0 -1
- package/dist/context/index.mjs +0 -5
- package/dist/context/index.mjs.map +0 -1
- package/dist/context/providers/AssistantRuntimeProvider.mjs +0 -59
- package/dist/context/providers/AssistantRuntimeProvider.mjs.map +0 -1
- package/dist/context/providers/AttachmentRuntimeProvider.mjs +0 -33
- package/dist/context/providers/AttachmentRuntimeProvider.mjs.map +0 -1
- package/dist/context/providers/ContentPartRuntimeProvider.mjs +0 -28
- package/dist/context/providers/ContentPartRuntimeProvider.mjs.map +0 -1
- package/dist/context/providers/MessageRuntimeProvider.mjs +0 -37
- package/dist/context/providers/MessageRuntimeProvider.mjs.map +0 -1
- package/dist/context/providers/TextContentPartProvider.mjs +0 -66
- package/dist/context/providers/TextContentPartProvider.mjs.map +0 -1
- package/dist/context/providers/ThreadListItemRuntimeProvider.mjs +0 -30
- package/dist/context/providers/ThreadListItemRuntimeProvider.mjs.map +0 -1
- package/dist/context/providers/ThreadRuntimeProvider.mjs +0 -33
- package/dist/context/providers/ThreadRuntimeProvider.mjs.map +0 -1
- package/dist/context/providers/ThreadViewportProvider.mjs +0 -42
- package/dist/context/providers/ThreadViewportProvider.mjs.map +0 -1
- package/dist/context/providers/index.mjs +0 -8
- package/dist/context/providers/index.mjs.map +0 -1
- package/dist/context/react/AssistantContext.mjs +0 -34
- package/dist/context/react/AssistantContext.mjs.map +0 -1
- package/dist/context/react/AttachmentContext.mjs +0 -67
- package/dist/context/react/AttachmentContext.mjs.map +0 -1
- package/dist/context/react/ComposerContext.mjs +0 -17
- package/dist/context/react/ComposerContext.mjs.map +0 -1
- package/dist/context/react/ContentPartContext.mjs +0 -25
- package/dist/context/react/ContentPartContext.mjs.map +0 -1
- package/dist/context/react/MessageContext.mjs +0 -35
- package/dist/context/react/MessageContext.mjs.map +0 -1
- package/dist/context/react/ThreadContext.mjs +0 -38
- package/dist/context/react/ThreadContext.mjs.map +0 -1
- package/dist/context/react/ThreadListItemContext.mjs +0 -25
- package/dist/context/react/ThreadListItemContext.mjs.map +0 -1
- package/dist/context/react/ThreadViewportContext.mjs +0 -18
- package/dist/context/react/ThreadViewportContext.mjs.map +0 -1
- package/dist/context/react/index.mjs +0 -66
- package/dist/context/react/index.mjs.map +0 -1
- package/dist/context/react/utils/createContextHook.mjs +0 -18
- package/dist/context/react/utils/createContextHook.mjs.map +0 -1
- package/dist/context/react/utils/createContextStoreHook.mjs +0 -31
- package/dist/context/react/utils/createContextStoreHook.mjs.map +0 -1
- package/dist/context/react/utils/createStateHookForRuntime.mjs +0 -24
- package/dist/context/react/utils/createStateHookForRuntime.mjs.map +0 -1
- package/dist/context/react/utils/ensureBinding.mjs +0 -11
- package/dist/context/react/utils/ensureBinding.mjs.map +0 -1
- package/dist/context/react/utils/useRuntimeState.mjs +0 -22
- package/dist/context/react/utils/useRuntimeState.mjs.map +0 -1
- package/dist/context/stores/AssistantToolUIs.mjs +0 -35
- package/dist/context/stores/AssistantToolUIs.mjs.map +0 -1
- package/dist/context/stores/MessageUtils.mjs +0 -18
- package/dist/context/stores/MessageUtils.mjs.map +0 -1
- package/dist/context/stores/ThreadViewport.mjs +0 -25
- package/dist/context/stores/ThreadViewport.mjs.map +0 -1
- package/dist/context/stores/index.mjs +0 -1
- package/dist/context/stores/index.mjs.map +0 -1
- package/dist/index.mjs +0 -13
- package/dist/index.mjs.map +0 -1
- package/dist/internal.mjs +0 -27
- package/dist/internal.mjs.map +0 -1
- package/dist/model-context/ModelContextTypes.mjs +0 -61
- package/dist/model-context/ModelContextTypes.mjs.map +0 -1
- package/dist/model-context/index.mjs +0 -26
- package/dist/model-context/index.mjs.map +0 -1
- package/dist/model-context/makeAssistantTool.mjs +0 -16
- package/dist/model-context/makeAssistantTool.mjs.map +0 -1
- package/dist/model-context/makeAssistantToolUI.mjs +0 -18
- package/dist/model-context/makeAssistantToolUI.mjs.map +0 -1
- package/dist/model-context/makeAssistantVisible.mjs +0 -93
- package/dist/model-context/makeAssistantVisible.mjs.map +0 -1
- package/dist/model-context/tool.mjs +0 -8
- package/dist/model-context/tool.mjs.map +0 -1
- package/dist/model-context/useAssistantInstructions.mjs +0 -26
- package/dist/model-context/useAssistantInstructions.mjs.map +0 -1
- package/dist/model-context/useAssistantTool.mjs +0 -31
- package/dist/model-context/useAssistantTool.mjs.map +0 -1
- package/dist/model-context/useAssistantToolUI.mjs +0 -16
- package/dist/model-context/useAssistantToolUI.mjs.map +0 -1
- package/dist/model-context/useInlineRender.mjs +0 -22
- package/dist/model-context/useInlineRender.mjs.map +0 -1
- package/dist/primitives/actionBar/ActionBarCopy.mjs +0 -56
- package/dist/primitives/actionBar/ActionBarCopy.mjs.map +0 -1
- package/dist/primitives/actionBar/ActionBarEdit.mjs +0 -25
- package/dist/primitives/actionBar/ActionBarEdit.mjs.map +0 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.mjs +0 -41
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.mjs.map +0 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.mjs +0 -39
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.mjs.map +0 -1
- package/dist/primitives/actionBar/ActionBarReload.mjs +0 -31
- package/dist/primitives/actionBar/ActionBarReload.mjs.map +0 -1
- package/dist/primitives/actionBar/ActionBarRoot.mjs +0 -31
- package/dist/primitives/actionBar/ActionBarRoot.mjs.map +0 -1
- package/dist/primitives/actionBar/ActionBarSpeak.mjs +0 -27
- package/dist/primitives/actionBar/ActionBarSpeak.mjs.map +0 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.mjs +0 -48
- package/dist/primitives/actionBar/ActionBarStopSpeaking.mjs.map +0 -1
- package/dist/primitives/actionBar/index.mjs +0 -20
- package/dist/primitives/actionBar/index.mjs.map +0 -1
- package/dist/primitives/actionBar/useActionBarFloatStatus.mjs +0 -41
- package/dist/primitives/actionBar/useActionBarFloatStatus.mjs.map +0 -1
- package/dist/primitives/assistantModal/AssistantModalAnchor.mjs +0 -21
- package/dist/primitives/assistantModal/AssistantModalAnchor.mjs.map +0 -1
- package/dist/primitives/assistantModal/AssistantModalContent.mjs +0 -39
- package/dist/primitives/assistantModal/AssistantModalContent.mjs.map +0 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.mjs +0 -60
- package/dist/primitives/assistantModal/AssistantModalRoot.mjs.map +0 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.mjs +0 -19
- package/dist/primitives/assistantModal/AssistantModalTrigger.mjs.map +0 -1
- package/dist/primitives/assistantModal/index.mjs +0 -12
- package/dist/primitives/assistantModal/index.mjs.map +0 -1
- package/dist/primitives/assistantModal/scope.mjs +0 -7
- package/dist/primitives/assistantModal/scope.mjs.map +0 -1
- package/dist/primitives/attachment/AttachmentName.mjs +0 -14
- package/dist/primitives/attachment/AttachmentName.mjs.map +0 -1
- package/dist/primitives/attachment/AttachmentRemove.mjs +0 -23
- package/dist/primitives/attachment/AttachmentRemove.mjs.map +0 -1
- package/dist/primitives/attachment/AttachmentRoot.mjs +0 -12
- package/dist/primitives/attachment/AttachmentRoot.mjs.map +0 -1
- package/dist/primitives/attachment/AttachmentThumb.mjs +0 -19
- package/dist/primitives/attachment/AttachmentThumb.mjs.map +0 -1
- package/dist/primitives/attachment/index.mjs +0 -12
- package/dist/primitives/attachment/index.mjs.map +0 -1
- package/dist/primitives/branchPicker/BranchPickerCount.mjs +0 -18
- package/dist/primitives/branchPicker/BranchPickerCount.mjs.map +0 -1
- package/dist/primitives/branchPicker/BranchPickerNext.mjs +0 -28
- package/dist/primitives/branchPicker/BranchPickerNext.mjs.map +0 -1
- package/dist/primitives/branchPicker/BranchPickerNumber.mjs +0 -18
- package/dist/primitives/branchPicker/BranchPickerNumber.mjs.map +0 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.mjs +0 -28
- package/dist/primitives/branchPicker/BranchPickerPrevious.mjs.map +0 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.mjs +0 -13
- package/dist/primitives/branchPicker/BranchPickerRoot.mjs.map +0 -1
- package/dist/primitives/branchPicker/index.mjs +0 -14
- package/dist/primitives/branchPicker/index.mjs.map +0 -1
- package/dist/primitives/composer/ComposerAddAttachment.mjs +0 -42
- package/dist/primitives/composer/ComposerAddAttachment.mjs.map +0 -1
- package/dist/primitives/composer/ComposerAttachments.mjs +0 -57
- package/dist/primitives/composer/ComposerAttachments.mjs.map +0 -1
- package/dist/primitives/composer/ComposerCancel.mjs +0 -25
- package/dist/primitives/composer/ComposerCancel.mjs.map +0 -1
- package/dist/primitives/composer/ComposerIf.mjs +0 -23
- package/dist/primitives/composer/ComposerIf.mjs.map +0 -1
- package/dist/primitives/composer/ComposerInput.mjs +0 -115
- package/dist/primitives/composer/ComposerInput.mjs.map +0 -1
- package/dist/primitives/composer/ComposerRoot.mjs +0 -31
- package/dist/primitives/composer/ComposerRoot.mjs.map +0 -1
- package/dist/primitives/composer/ComposerSend.mjs +0 -32
- package/dist/primitives/composer/ComposerSend.mjs.map +0 -1
- package/dist/primitives/composer/index.mjs +0 -18
- package/dist/primitives/composer/index.mjs.map +0 -1
- package/dist/primitives/contentPart/ContentPartImage.mjs +0 -16
- package/dist/primitives/contentPart/ContentPartImage.mjs.map +0 -1
- package/dist/primitives/contentPart/ContentPartInProgress.mjs +0 -13
- package/dist/primitives/contentPart/ContentPartInProgress.mjs.map +0 -1
- package/dist/primitives/contentPart/ContentPartText.mjs +0 -18
- package/dist/primitives/contentPart/ContentPartText.mjs.map +0 -1
- package/dist/primitives/contentPart/index.mjs +0 -10
- package/dist/primitives/contentPart/index.mjs.map +0 -1
- package/dist/primitives/contentPart/useContentPartFile.mjs +0 -18
- package/dist/primitives/contentPart/useContentPartFile.mjs.map +0 -1
- package/dist/primitives/contentPart/useContentPartImage.mjs +0 -18
- package/dist/primitives/contentPart/useContentPartImage.mjs.map +0 -1
- package/dist/primitives/contentPart/useContentPartReasoning.mjs +0 -18
- package/dist/primitives/contentPart/useContentPartReasoning.mjs.map +0 -1
- package/dist/primitives/contentPart/useContentPartSource.mjs +0 -18
- package/dist/primitives/contentPart/useContentPartSource.mjs.map +0 -1
- package/dist/primitives/contentPart/useContentPartText.mjs +0 -18
- package/dist/primitives/contentPart/useContentPartText.mjs.map +0 -1
- package/dist/primitives/index.mjs +0 -36
- package/dist/primitives/index.mjs.map +0 -1
- package/dist/primitives/message/MessageAttachments.mjs +0 -58
- package/dist/primitives/message/MessageAttachments.mjs.map +0 -1
- package/dist/primitives/message/MessageContent.mjs +0 -131
- package/dist/primitives/message/MessageContent.mjs.map +0 -1
- package/dist/primitives/message/MessageIf.mjs +0 -55
- package/dist/primitives/message/MessageIf.mjs.map +0 -1
- package/dist/primitives/message/MessageRoot.mjs +0 -45
- package/dist/primitives/message/MessageRoot.mjs.map +0 -1
- package/dist/primitives/message/index.mjs +0 -12
- package/dist/primitives/message/index.mjs.map +0 -1
- package/dist/primitives/thread/ThreadEmpty.mjs +0 -15
- package/dist/primitives/thread/ThreadEmpty.mjs.map +0 -1
- package/dist/primitives/thread/ThreadIf.mjs +0 -27
- package/dist/primitives/thread/ThreadIf.mjs.map +0 -1
- package/dist/primitives/thread/ThreadMessages.mjs +0 -77
- package/dist/primitives/thread/ThreadMessages.mjs.map +0 -1
- package/dist/primitives/thread/ThreadRoot.mjs +0 -12
- package/dist/primitives/thread/ThreadRoot.mjs.map +0 -1
- package/dist/primitives/thread/ThreadScrollToBottom.mjs +0 -28
- package/dist/primitives/thread/ThreadScrollToBottom.mjs.map +0 -1
- package/dist/primitives/thread/ThreadSuggestion.mjs +0 -34
- package/dist/primitives/thread/ThreadSuggestion.mjs.map +0 -1
- package/dist/primitives/thread/ThreadViewport.mjs +0 -25
- package/dist/primitives/thread/ThreadViewport.mjs.map +0 -1
- package/dist/primitives/thread/index.mjs +0 -18
- package/dist/primitives/thread/index.mjs.map +0 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.mjs +0 -68
- package/dist/primitives/thread/useThreadViewportAutoScroll.mjs.map +0 -1
- package/dist/primitives/threadList/ThreadListItems.mjs +0 -46
- package/dist/primitives/threadList/ThreadListItems.mjs.map +0 -1
- package/dist/primitives/threadList/ThreadListNew.mjs +0 -36
- package/dist/primitives/threadList/ThreadListNew.mjs.map +0 -1
- package/dist/primitives/threadList/ThreadListRoot.mjs +0 -12
- package/dist/primitives/threadList/ThreadListRoot.mjs.map +0 -1
- package/dist/primitives/threadList/index.mjs +0 -10
- package/dist/primitives/threadList/index.mjs.map +0 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.mjs +0 -22
- package/dist/primitives/threadListItem/ThreadListItemArchive.mjs.map +0 -1
- package/dist/primitives/threadListItem/ThreadListItemDelete.mjs +0 -21
- package/dist/primitives/threadListItem/ThreadListItemDelete.mjs.map +0 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.mjs +0 -23
- package/dist/primitives/threadListItem/ThreadListItemRoot.mjs.map +0 -1
- package/dist/primitives/threadListItem/ThreadListItemTitle.mjs +0 -14
- package/dist/primitives/threadListItem/ThreadListItemTitle.mjs.map +0 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.mjs +0 -21
- package/dist/primitives/threadListItem/ThreadListItemTrigger.mjs.map +0 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.mjs +0 -21
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.mjs.map +0 -1
- package/dist/primitives/threadListItem/index.mjs +0 -16
- package/dist/primitives/threadListItem/index.mjs.map +0 -1
- package/dist/runtimes/adapters/RuntimeAdapterProvider.mjs +0 -29
- package/dist/runtimes/adapters/RuntimeAdapterProvider.mjs.map +0 -1
- package/dist/runtimes/adapters/attachment/AttachmentAdapter.mjs +0 -1
- package/dist/runtimes/adapters/attachment/AttachmentAdapter.mjs.map +0 -1
- package/dist/runtimes/adapters/attachment/CompositeAttachmentAdapter.mjs +0 -79
- package/dist/runtimes/adapters/attachment/CompositeAttachmentAdapter.mjs.map +0 -1
- package/dist/runtimes/adapters/attachment/SimpleImageAttachmentAdapter.mjs +0 -38
- package/dist/runtimes/adapters/attachment/SimpleImageAttachmentAdapter.mjs.map +0 -1
- package/dist/runtimes/adapters/attachment/SimpleTextAttachmentAdapter.mjs +0 -40
- package/dist/runtimes/adapters/attachment/SimpleTextAttachmentAdapter.mjs.map +0 -1
- package/dist/runtimes/adapters/attachment/index.mjs +0 -10
- package/dist/runtimes/adapters/attachment/index.mjs.map +0 -1
- package/dist/runtimes/adapters/feedback/FeedbackAdapter.mjs +0 -1
- package/dist/runtimes/adapters/feedback/FeedbackAdapter.mjs.map +0 -1
- package/dist/runtimes/adapters/feedback/index.mjs +0 -1
- package/dist/runtimes/adapters/feedback/index.mjs.map +0 -1
- package/dist/runtimes/adapters/index.mjs +0 -6
- package/dist/runtimes/adapters/index.mjs.map +0 -1
- package/dist/runtimes/adapters/speech/SpeechAdapterTypes.mjs +0 -1
- package/dist/runtimes/adapters/speech/SpeechAdapterTypes.mjs.map +0 -1
- package/dist/runtimes/adapters/speech/WebSpeechSynthesisAdapter.mjs +0 -43
- package/dist/runtimes/adapters/speech/WebSpeechSynthesisAdapter.mjs.map +0 -1
- package/dist/runtimes/adapters/speech/index.mjs +0 -6
- package/dist/runtimes/adapters/speech/index.mjs.map +0 -1
- package/dist/runtimes/adapters/suggestion/SuggestionAdapter.mjs +0 -1
- package/dist/runtimes/adapters/suggestion/SuggestionAdapter.mjs.map +0 -1
- package/dist/runtimes/adapters/suggestion/index.mjs +0 -1
- package/dist/runtimes/adapters/suggestion/index.mjs.map +0 -1
- package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.mjs +0 -1
- package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.mjs.map +0 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs +0 -163
- package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs +0 -48
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.mjs +0 -41
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/core/AssistantRuntimeCore.mjs +0 -1
- package/dist/runtimes/core/AssistantRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.mjs +0 -12
- package/dist/runtimes/core/BaseAssistantRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.mjs +0 -141
- package/dist/runtimes/core/BaseThreadRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/core/ComposerRuntimeCore.mjs +0 -1
- package/dist/runtimes/core/ComposerRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/core/ThreadListRuntimeCore.mjs +0 -1
- package/dist/runtimes/core/ThreadListRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/core/ThreadRuntimeCore.mjs +0 -1
- package/dist/runtimes/core/ThreadRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/core/index.mjs +0 -1
- package/dist/runtimes/core/index.mjs.map +0 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.mjs +0 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.mjs.map +0 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs +0 -25
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs +0 -134
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs +0 -191
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/external-store/ThreadMessageConverter.mjs +0 -16
- package/dist/runtimes/external-store/ThreadMessageConverter.mjs.map +0 -1
- package/dist/runtimes/external-store/ThreadMessageLike.mjs +0 -111
- package/dist/runtimes/external-store/ThreadMessageLike.mjs.map +0 -1
- package/dist/runtimes/external-store/auto-status.mjs +0 -13
- package/dist/runtimes/external-store/auto-status.mjs.map +0 -1
- package/dist/runtimes/external-store/createMessageConverter.mjs +0 -52
- package/dist/runtimes/external-store/createMessageConverter.mjs.map +0 -1
- package/dist/runtimes/external-store/external-message-converter.mjs +0 -238
- package/dist/runtimes/external-store/external-message-converter.mjs.map +0 -1
- package/dist/runtimes/external-store/getExternalStoreMessage.mjs +0 -24
- package/dist/runtimes/external-store/getExternalStoreMessage.mjs.map +0 -1
- package/dist/runtimes/external-store/index.mjs +0 -20
- package/dist/runtimes/external-store/index.mjs.map +0 -1
- package/dist/runtimes/external-store/useExternalStoreRuntime.mjs +0 -23
- package/dist/runtimes/external-store/useExternalStoreRuntime.mjs.map +0 -1
- package/dist/runtimes/index.mjs +0 -11
- package/dist/runtimes/index.mjs.map +0 -1
- package/dist/runtimes/local/ChatModelAdapter.mjs +0 -1
- package/dist/runtimes/local/ChatModelAdapter.mjs.map +0 -1
- package/dist/runtimes/local/LocalRuntimeCore.mjs +0 -24
- package/dist/runtimes/local/LocalRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/local/LocalRuntimeOptions.mjs +0 -25
- package/dist/runtimes/local/LocalRuntimeOptions.mjs.map +0 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs +0 -72
- package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +0 -309
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/local/index.mjs +0 -6
- package/dist/runtimes/local/index.mjs.map +0 -1
- package/dist/runtimes/local/shouldContinue.mjs +0 -13
- package/dist/runtimes/local/shouldContinue.mjs.map +0 -1
- package/dist/runtimes/local/useLocalRuntime.mjs +0 -46
- package/dist/runtimes/local/useLocalRuntime.mjs.map +0 -1
- package/dist/runtimes/remote-thread-list/BaseSubscribable.mjs +0 -37
- package/dist/runtimes/remote-thread-list/BaseSubscribable.mjs.map +0 -1
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.mjs +0 -128
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.mjs.map +0 -1
- package/dist/runtimes/remote-thread-list/OptimisticState.mjs +0 -60
- package/dist/runtimes/remote-thread-list/OptimisticState.mjs.map +0 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.mjs +0 -128
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.mjs.map +0 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs +0 -431
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs.map +0 -1
- package/dist/runtimes/remote-thread-list/adapter/cloud.mjs +0 -83
- package/dist/runtimes/remote-thread-list/adapter/cloud.mjs.map +0 -1
- package/dist/runtimes/remote-thread-list/adapter/in-memory.mjs +0 -30
- package/dist/runtimes/remote-thread-list/adapter/in-memory.mjs.map +0 -1
- package/dist/runtimes/remote-thread-list/index.mjs +0 -8
- package/dist/runtimes/remote-thread-list/index.mjs.map +0 -1
- package/dist/runtimes/remote-thread-list/types.mjs +0 -1
- package/dist/runtimes/remote-thread-list/types.mjs.map +0 -1
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs +0 -32
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs.map +0 -1
- package/dist/runtimes/utils/MessageRepository.mjs +0 -345
- package/dist/runtimes/utils/MessageRepository.mjs.map +0 -1
- package/dist/tests/MessageRepository.test.d.ts +0 -2
- package/dist/tests/MessageRepository.test.d.ts.map +0 -1
- package/dist/tests/setup.mjs +0 -2974
- package/dist/tests/setup.mjs.map +0 -1
- package/dist/types/AssistantTypes.mjs +0 -1
- package/dist/types/AssistantTypes.mjs.map +0 -1
- package/dist/types/AttachmentTypes.mjs +0 -1
- package/dist/types/AttachmentTypes.mjs.map +0 -1
- package/dist/types/ContentPartComponentTypes.mjs +0 -1
- package/dist/types/ContentPartComponentTypes.mjs.map +0 -1
- package/dist/types/Unsubscribe.mjs +0 -1
- package/dist/types/Unsubscribe.mjs.map +0 -1
- package/dist/types/index.mjs +0 -1
- package/dist/types/index.mjs.map +0 -1
- package/dist/utils/CompositeContextProvider.mjs +0 -34
- package/dist/utils/CompositeContextProvider.mjs.map +0 -1
- package/dist/utils/RequireAtLeastOne.mjs +0 -1
- package/dist/utils/RequireAtLeastOne.mjs.map +0 -1
- package/dist/utils/combined/createCombinedStore.mjs +0 -22
- package/dist/utils/combined/createCombinedStore.mjs.map +0 -1
- package/dist/utils/combined/useCombinedStore.mjs +0 -15
- package/dist/utils/combined/useCombinedStore.mjs.map +0 -1
- package/dist/utils/createActionButton.mjs +0 -37
- package/dist/utils/createActionButton.mjs.map +0 -1
- package/dist/utils/getThreadMessageText.mjs +0 -11
- package/dist/utils/getThreadMessageText.mjs.map +0 -1
- package/dist/utils/hooks/useManagedRef.mjs +0 -21
- package/dist/utils/hooks/useManagedRef.mjs.map +0 -1
- package/dist/utils/hooks/useOnResizeContent.mjs +0 -34
- package/dist/utils/hooks/useOnResizeContent.mjs.map +0 -1
- package/dist/utils/hooks/useOnScrollToBottom.mjs +0 -17
- package/dist/utils/hooks/useOnScrollToBottom.mjs.map +0 -1
- package/dist/utils/idUtils.mjs +0 -15
- package/dist/utils/idUtils.mjs.map +0 -1
- package/dist/utils/json/is-json.mjs +0 -35
- package/dist/utils/json/is-json.mjs.map +0 -1
- package/dist/utils/json/json-value.mjs +0 -1
- package/dist/utils/json/json-value.mjs.map +0 -1
- package/dist/utils/smooth/SmoothContext.mjs +0 -53
- package/dist/utils/smooth/SmoothContext.mjs.map +0 -1
- package/dist/utils/smooth/index.mjs +0 -11
- package/dist/utils/smooth/index.mjs.map +0 -1
- package/dist/utils/smooth/useSmooth.mjs +0 -114
- package/dist/utils/smooth/useSmooth.mjs.map +0 -1
- package/dist/utils/useToolArgsFieldStatus.mjs +0 -20
- package/dist/utils/useToolArgsFieldStatus.mjs.map +0 -1
@@ -1,34 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
|
20
|
-
// src/api/AssistantRuntime.ts
|
21
|
-
var AssistantRuntime_exports = {};
|
22
|
-
__export(AssistantRuntime_exports, {
|
23
|
-
AssistantRuntimeImpl: () => AssistantRuntimeImpl
|
24
|
-
});
|
25
|
-
module.exports = __toCommonJS(AssistantRuntime_exports);
|
26
|
-
var import_ThreadListRuntime = require("./ThreadListRuntime.js");
|
27
|
-
var import_runtimes = require("../runtimes/index.js");
|
28
|
-
var AssistantRuntimeImpl = class {
|
1
|
+
import { ThreadListRuntimeImpl } from "./ThreadListRuntime";
|
2
|
+
import { ExportedMessageRepository } from "../runtimes";
|
3
|
+
class AssistantRuntimeImpl {
|
29
4
|
constructor(_core) {
|
30
5
|
this._core = _core;
|
31
|
-
this.threads = new
|
6
|
+
this.threads = new ThreadListRuntimeImpl(_core.threads);
|
32
7
|
this._thread = this.threads.main;
|
33
8
|
}
|
34
9
|
threads;
|
@@ -61,11 +36,10 @@ var AssistantRuntimeImpl = class {
|
|
61
36
|
reset({
|
62
37
|
initialMessages
|
63
38
|
} = {}) {
|
64
|
-
return this._core.threads.getMainThreadRuntimeCore().import(
|
39
|
+
return this._core.threads.getMainThreadRuntimeCore().import(ExportedMessageRepository.fromArray(initialMessages ?? []));
|
65
40
|
}
|
66
|
-
}
|
67
|
-
|
68
|
-
0 && (module.exports = {
|
41
|
+
}
|
42
|
+
export {
|
69
43
|
AssistantRuntimeImpl
|
70
|
-
}
|
44
|
+
};
|
71
45
|
//# sourceMappingURL=AssistantRuntime.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/api/AssistantRuntime.ts"],"sourcesContent":["import { AssistantRuntimeCore } from \"../runtimes/core/AssistantRuntimeCore\";\nimport { ModelContextProvider } from \"../model-context/ModelContextTypes\";\nimport { ThreadRuntime } from \"./ThreadRuntime\";\nimport { Unsubscribe } from \"../types\";\nimport { ThreadListRuntime, ThreadListRuntimeImpl } from \"./ThreadListRuntime\";\nimport { ExportedMessageRepository, ThreadMessageLike } from \"../runtimes\";\n\nexport type AssistantRuntime = {\n /**\n * The threads in this assistant.\n */\n readonly threads: ThreadListRuntime;\n\n /**\n * The currently selected main thread. Equivalent to `threads.main`.\n */\n readonly thread: ThreadRuntime;\n\n /**\n * @deprecated This field was renamed to `threads`.\n */\n readonly threadList: ThreadListRuntime;\n\n /**\n * Switch to a new thread.\n *\n * @deprecated This method was moved to `threads.switchToNewThread`.\n */\n switchToNewThread(): void;\n\n /**\n * Switch to a thread.\n *\n * @param threadId The thread ID to switch to.\n * @deprecated This method was moved to `threads.switchToThread`.\n */\n switchToThread(threadId: string): void;\n\n /**\n * Register a model context provider. Model context providers are configuration such as system message, temperature, etc. that are set in the frontend.\n *\n * @param provider The model context provider to register.\n */\n registerModelContextProvider(provider: ModelContextProvider): Unsubscribe;\n\n /**\n * @deprecated This method was renamed to `registerModelContextProvider`.\n */\n registerModelConfigProvider(provider: ModelContextProvider): Unsubscribe;\n\n /**\n * @deprecated Deprecated. Please use `runtime.threads.main.import(ExportedMessageRepository.fromArray(initialMessages))`.\n */\n reset: unknown; // make it a type error\n};\n\nexport class AssistantRuntimeImpl implements AssistantRuntime {\n public readonly threads;\n public get threadList() {\n return this.threads;\n }\n\n public readonly _thread: ThreadRuntime;\n\n public constructor(private readonly _core: AssistantRuntimeCore) {\n this.threads = new ThreadListRuntimeImpl(_core.threads);\n this._thread = this.threads.main;\n }\n\n protected __internal_bindMethods() {\n this.switchToNewThread = this.switchToNewThread.bind(this);\n this.switchToThread = this.switchToThread.bind(this);\n this.registerModelContextProvider =\n this.registerModelContextProvider.bind(this);\n this.registerModelConfigProvider =\n this.registerModelConfigProvider.bind(this);\n this.reset = this.reset.bind(this);\n }\n\n public get thread() {\n return this._thread;\n }\n\n public switchToNewThread() {\n return this._core.threads.switchToNewThread();\n }\n\n public switchToThread(threadId: string) {\n return this._core.threads.switchToThread(threadId);\n }\n\n public registerModelContextProvider(provider: ModelContextProvider) {\n return this._core.registerModelContextProvider(provider);\n }\n\n public registerModelConfigProvider(provider: ModelContextProvider) {\n return this.registerModelContextProvider(provider);\n }\n\n public reset({\n initialMessages,\n }: { initialMessages?: ThreadMessageLike[] } = {}) {\n return this._core.threads\n .getMainThreadRuntimeCore()\n .import(ExportedMessageRepository.fromArray(initialMessages ?? []));\n }\n}\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../src/api/AssistantRuntime.ts"],"sourcesContent":["import { AssistantRuntimeCore } from \"../runtimes/core/AssistantRuntimeCore\";\nimport { ModelContextProvider } from \"../model-context/ModelContextTypes\";\nimport { ThreadRuntime } from \"./ThreadRuntime\";\nimport { Unsubscribe } from \"../types\";\nimport { ThreadListRuntime, ThreadListRuntimeImpl } from \"./ThreadListRuntime\";\nimport { ExportedMessageRepository, ThreadMessageLike } from \"../runtimes\";\n\nexport type AssistantRuntime = {\n /**\n * The threads in this assistant.\n */\n readonly threads: ThreadListRuntime;\n\n /**\n * The currently selected main thread. Equivalent to `threads.main`.\n */\n readonly thread: ThreadRuntime;\n\n /**\n * @deprecated This field was renamed to `threads`.\n */\n readonly threadList: ThreadListRuntime;\n\n /**\n * Switch to a new thread.\n *\n * @deprecated This method was moved to `threads.switchToNewThread`.\n */\n switchToNewThread(): void;\n\n /**\n * Switch to a thread.\n *\n * @param threadId The thread ID to switch to.\n * @deprecated This method was moved to `threads.switchToThread`.\n */\n switchToThread(threadId: string): void;\n\n /**\n * Register a model context provider. Model context providers are configuration such as system message, temperature, etc. that are set in the frontend.\n *\n * @param provider The model context provider to register.\n */\n registerModelContextProvider(provider: ModelContextProvider): Unsubscribe;\n\n /**\n * @deprecated This method was renamed to `registerModelContextProvider`.\n */\n registerModelConfigProvider(provider: ModelContextProvider): Unsubscribe;\n\n /**\n * @deprecated Deprecated. Please use `runtime.threads.main.import(ExportedMessageRepository.fromArray(initialMessages))`.\n */\n reset: unknown; // make it a type error\n};\n\nexport class AssistantRuntimeImpl implements AssistantRuntime {\n public readonly threads;\n public get threadList() {\n return this.threads;\n }\n\n public readonly _thread: ThreadRuntime;\n\n public constructor(private readonly _core: AssistantRuntimeCore) {\n this.threads = new ThreadListRuntimeImpl(_core.threads);\n this._thread = this.threads.main;\n }\n\n protected __internal_bindMethods() {\n this.switchToNewThread = this.switchToNewThread.bind(this);\n this.switchToThread = this.switchToThread.bind(this);\n this.registerModelContextProvider =\n this.registerModelContextProvider.bind(this);\n this.registerModelConfigProvider =\n this.registerModelConfigProvider.bind(this);\n this.reset = this.reset.bind(this);\n }\n\n public get thread() {\n return this._thread;\n }\n\n public switchToNewThread() {\n return this._core.threads.switchToNewThread();\n }\n\n public switchToThread(threadId: string) {\n return this._core.threads.switchToThread(threadId);\n }\n\n public registerModelContextProvider(provider: ModelContextProvider) {\n return this._core.registerModelContextProvider(provider);\n }\n\n public registerModelConfigProvider(provider: ModelContextProvider) {\n return this.registerModelContextProvider(provider);\n }\n\n public reset({\n initialMessages,\n }: { initialMessages?: ThreadMessageLike[] } = {}) {\n return this._core.threads\n .getMainThreadRuntimeCore()\n .import(ExportedMessageRepository.fromArray(initialMessages ?? []));\n }\n}\n"],"mappings":"AAIA,SAA4B,6BAA6B;AACzD,SAAS,iCAAoD;AAmDtD,MAAM,qBAAiD;AAAA,EAQrD,YAA6B,OAA6B;AAA7B;AAClC,SAAK,UAAU,IAAI,sBAAsB,MAAM,OAAO;AACtD,SAAK,UAAU,KAAK,QAAQ;AAAA,EAC9B;AAAA,EAVgB;AAAA,EAChB,IAAW,aAAa;AACtB,WAAO,KAAK;AAAA,EACd;AAAA,EAEgB;AAAA,EAON,yBAAyB;AACjC,SAAK,oBAAoB,KAAK,kBAAkB,KAAK,IAAI;AACzD,SAAK,iBAAiB,KAAK,eAAe,KAAK,IAAI;AACnD,SAAK,+BACH,KAAK,6BAA6B,KAAK,IAAI;AAC7C,SAAK,8BACH,KAAK,4BAA4B,KAAK,IAAI;AAC5C,SAAK,QAAQ,KAAK,MAAM,KAAK,IAAI;AAAA,EACnC;AAAA,EAEA,IAAW,SAAS;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEO,oBAAoB;AACzB,WAAO,KAAK,MAAM,QAAQ,kBAAkB;AAAA,EAC9C;AAAA,EAEO,eAAe,UAAkB;AACtC,WAAO,KAAK,MAAM,QAAQ,eAAe,QAAQ;AAAA,EACnD;AAAA,EAEO,6BAA6B,UAAgC;AAClE,WAAO,KAAK,MAAM,6BAA6B,QAAQ;AAAA,EACzD;AAAA,EAEO,4BAA4B,UAAgC;AACjE,WAAO,KAAK,6BAA6B,QAAQ;AAAA,EACnD;AAAA,EAEO,MAAM;AAAA,IACX;AAAA,EACF,IAA+C,CAAC,GAAG;AACjD,WAAO,KAAK,MAAM,QACf,yBAAyB,EACzB,OAAO,0BAA0B,UAAU,mBAAmB,CAAC,CAAC,CAAC;AAAA,EACtE;AACF;","names":[]}
|
@@ -1,32 +1,4 @@
|
|
1
|
-
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
|
20
|
-
// src/api/AttachmentRuntime.ts
|
21
|
-
var AttachmentRuntime_exports = {};
|
22
|
-
__export(AttachmentRuntime_exports, {
|
23
|
-
AttachmentRuntimeImpl: () => AttachmentRuntimeImpl,
|
24
|
-
EditComposerAttachmentRuntimeImpl: () => EditComposerAttachmentRuntimeImpl,
|
25
|
-
MessageAttachmentRuntimeImpl: () => MessageAttachmentRuntimeImpl,
|
26
|
-
ThreadComposerAttachmentRuntimeImpl: () => ThreadComposerAttachmentRuntimeImpl
|
27
|
-
});
|
28
|
-
module.exports = __toCommonJS(AttachmentRuntime_exports);
|
29
|
-
var AttachmentRuntimeImpl = class {
|
1
|
+
class AttachmentRuntimeImpl {
|
30
2
|
constructor(_core) {
|
31
3
|
this._core = _core;
|
32
4
|
}
|
@@ -44,8 +16,8 @@ var AttachmentRuntimeImpl = class {
|
|
44
16
|
subscribe(callback) {
|
45
17
|
return this._core.subscribe(callback);
|
46
18
|
}
|
47
|
-
}
|
48
|
-
|
19
|
+
}
|
20
|
+
class ComposerAttachmentRuntime extends AttachmentRuntimeImpl {
|
49
21
|
constructor(core, _composerApi) {
|
50
22
|
super(core);
|
51
23
|
this._composerApi = _composerApi;
|
@@ -55,18 +27,18 @@ var ComposerAttachmentRuntime = class extends AttachmentRuntimeImpl {
|
|
55
27
|
if (!core) throw new Error("Composer is not available");
|
56
28
|
return core.removeAttachment(this.getState().id);
|
57
29
|
}
|
58
|
-
}
|
59
|
-
|
30
|
+
}
|
31
|
+
class ThreadComposerAttachmentRuntimeImpl extends ComposerAttachmentRuntime {
|
60
32
|
get source() {
|
61
33
|
return "thread-composer";
|
62
34
|
}
|
63
|
-
}
|
64
|
-
|
35
|
+
}
|
36
|
+
class EditComposerAttachmentRuntimeImpl extends ComposerAttachmentRuntime {
|
65
37
|
get source() {
|
66
38
|
return "edit-composer";
|
67
39
|
}
|
68
|
-
}
|
69
|
-
|
40
|
+
}
|
41
|
+
class MessageAttachmentRuntimeImpl extends AttachmentRuntimeImpl {
|
70
42
|
get source() {
|
71
43
|
return "message";
|
72
44
|
}
|
@@ -76,12 +48,11 @@ var MessageAttachmentRuntimeImpl = class extends AttachmentRuntimeImpl {
|
|
76
48
|
remove() {
|
77
49
|
throw new Error("Message attachments cannot be removed");
|
78
50
|
}
|
79
|
-
}
|
80
|
-
|
81
|
-
0 && (module.exports = {
|
51
|
+
}
|
52
|
+
export {
|
82
53
|
AttachmentRuntimeImpl,
|
83
54
|
EditComposerAttachmentRuntimeImpl,
|
84
55
|
MessageAttachmentRuntimeImpl,
|
85
56
|
ThreadComposerAttachmentRuntimeImpl
|
86
|
-
}
|
57
|
+
};
|
87
58
|
//# sourceMappingURL=AttachmentRuntime.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/api/AttachmentRuntime.ts"],"sourcesContent":["import { SubscribableWithState } from \"./subscribable/Subscribable\";\n\nimport { ComposerRuntimeCoreBinding } from \"./ComposerRuntime\";\nimport {\n Attachment,\n CompleteAttachment,\n PendingAttachment,\n Unsubscribe,\n} from \"../types\";\nimport { AttachmentRuntimePath } from \"./RuntimePathTypes\";\n\ntype MessageAttachmentState = CompleteAttachment & {\n readonly source: \"message\";\n};\n\ntype ThreadComposerAttachmentState = PendingAttachment & {\n readonly source: \"thread-composer\";\n};\n\ntype EditComposerAttachmentState = Attachment & {\n readonly source: \"edit-composer\";\n};\n\nexport type AttachmentState =\n | ThreadComposerAttachmentState\n | EditComposerAttachmentState\n | MessageAttachmentState;\n\ntype AttachmentSnapshotBinding<Source extends AttachmentRuntimeSource> =\n SubscribableWithState<\n AttachmentState & { source: Source },\n AttachmentRuntimePath & { attachmentSource: Source }\n >;\n\ntype AttachmentRuntimeSource = AttachmentState[\"source\"];\n\nexport type AttachmentRuntime<\n TSource extends AttachmentRuntimeSource = AttachmentRuntimeSource,\n> = {\n readonly path: AttachmentRuntimePath & { attachmentSource: TSource };\n readonly source: TSource;\n getState(): AttachmentState & { source: TSource };\n remove(): Promise<void>;\n subscribe(callback: () => void): Unsubscribe;\n};\n\nexport abstract class AttachmentRuntimeImpl<\n Source extends AttachmentRuntimeSource = AttachmentRuntimeSource,\n> implements AttachmentRuntime\n{\n public get path() {\n return this._core.path;\n }\n\n public abstract get source(): Source;\n\n constructor(private _core: AttachmentSnapshotBinding<Source>) {}\n\n protected __internal_bindMethods() {\n this.getState = this.getState.bind(this);\n this.remove = this.remove.bind(this);\n this.subscribe = this.subscribe.bind(this);\n }\n\n public getState(): AttachmentState & { source: Source } {\n return this._core.getState();\n }\n\n public abstract remove(): Promise<void>;\n\n public subscribe(callback: () => void) {\n return this._core.subscribe(callback);\n }\n}\n\nabstract class ComposerAttachmentRuntime<\n Source extends \"thread-composer\" | \"edit-composer\",\n> extends AttachmentRuntimeImpl<Source> {\n constructor(\n core: AttachmentSnapshotBinding<Source>,\n private _composerApi: ComposerRuntimeCoreBinding,\n ) {\n super(core);\n }\n\n public remove() {\n const core = this._composerApi.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.removeAttachment(this.getState().id);\n }\n}\n\nexport class ThreadComposerAttachmentRuntimeImpl extends ComposerAttachmentRuntime<\"thread-composer\"> {\n public get source(): \"thread-composer\" {\n return \"thread-composer\";\n }\n}\n\nexport class EditComposerAttachmentRuntimeImpl extends ComposerAttachmentRuntime<\"edit-composer\"> {\n public get source(): \"edit-composer\" {\n return \"edit-composer\";\n }\n}\n\nexport class MessageAttachmentRuntimeImpl extends AttachmentRuntimeImpl<\"message\"> {\n public get source(): \"message\" {\n return \"message\";\n }\n\n constructor(core: AttachmentSnapshotBinding<\"message\">) {\n super(core);\n }\n\n public remove(): never {\n throw new Error(\"Message attachments cannot be removed\");\n }\n}\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../src/api/AttachmentRuntime.ts"],"sourcesContent":["import { SubscribableWithState } from \"./subscribable/Subscribable\";\n\nimport { ComposerRuntimeCoreBinding } from \"./ComposerRuntime\";\nimport {\n Attachment,\n CompleteAttachment,\n PendingAttachment,\n Unsubscribe,\n} from \"../types\";\nimport { AttachmentRuntimePath } from \"./RuntimePathTypes\";\n\ntype MessageAttachmentState = CompleteAttachment & {\n readonly source: \"message\";\n};\n\ntype ThreadComposerAttachmentState = PendingAttachment & {\n readonly source: \"thread-composer\";\n};\n\ntype EditComposerAttachmentState = Attachment & {\n readonly source: \"edit-composer\";\n};\n\nexport type AttachmentState =\n | ThreadComposerAttachmentState\n | EditComposerAttachmentState\n | MessageAttachmentState;\n\ntype AttachmentSnapshotBinding<Source extends AttachmentRuntimeSource> =\n SubscribableWithState<\n AttachmentState & { source: Source },\n AttachmentRuntimePath & { attachmentSource: Source }\n >;\n\ntype AttachmentRuntimeSource = AttachmentState[\"source\"];\n\nexport type AttachmentRuntime<\n TSource extends AttachmentRuntimeSource = AttachmentRuntimeSource,\n> = {\n readonly path: AttachmentRuntimePath & { attachmentSource: TSource };\n readonly source: TSource;\n getState(): AttachmentState & { source: TSource };\n remove(): Promise<void>;\n subscribe(callback: () => void): Unsubscribe;\n};\n\nexport abstract class AttachmentRuntimeImpl<\n Source extends AttachmentRuntimeSource = AttachmentRuntimeSource,\n> implements AttachmentRuntime\n{\n public get path() {\n return this._core.path;\n }\n\n public abstract get source(): Source;\n\n constructor(private _core: AttachmentSnapshotBinding<Source>) {}\n\n protected __internal_bindMethods() {\n this.getState = this.getState.bind(this);\n this.remove = this.remove.bind(this);\n this.subscribe = this.subscribe.bind(this);\n }\n\n public getState(): AttachmentState & { source: Source } {\n return this._core.getState();\n }\n\n public abstract remove(): Promise<void>;\n\n public subscribe(callback: () => void) {\n return this._core.subscribe(callback);\n }\n}\n\nabstract class ComposerAttachmentRuntime<\n Source extends \"thread-composer\" | \"edit-composer\",\n> extends AttachmentRuntimeImpl<Source> {\n constructor(\n core: AttachmentSnapshotBinding<Source>,\n private _composerApi: ComposerRuntimeCoreBinding,\n ) {\n super(core);\n }\n\n public remove() {\n const core = this._composerApi.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.removeAttachment(this.getState().id);\n }\n}\n\nexport class ThreadComposerAttachmentRuntimeImpl extends ComposerAttachmentRuntime<\"thread-composer\"> {\n public get source(): \"thread-composer\" {\n return \"thread-composer\";\n }\n}\n\nexport class EditComposerAttachmentRuntimeImpl extends ComposerAttachmentRuntime<\"edit-composer\"> {\n public get source(): \"edit-composer\" {\n return \"edit-composer\";\n }\n}\n\nexport class MessageAttachmentRuntimeImpl extends AttachmentRuntimeImpl<\"message\"> {\n public get source(): \"message\" {\n return \"message\";\n }\n\n constructor(core: AttachmentSnapshotBinding<\"message\">) {\n super(core);\n }\n\n public remove(): never {\n throw new Error(\"Message attachments cannot be removed\");\n }\n}\n"],"mappings":"AA8CO,MAAe,sBAGtB;AAAA,EAOE,YAAoB,OAA0C;AAA1C;AAAA,EAA2C;AAAA,EAN/D,IAAW,OAAO;AAChB,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA,EAMU,yBAAyB;AACjC,SAAK,WAAW,KAAK,SAAS,KAAK,IAAI;AACvC,SAAK,SAAS,KAAK,OAAO,KAAK,IAAI;AACnC,SAAK,YAAY,KAAK,UAAU,KAAK,IAAI;AAAA,EAC3C;AAAA,EAEO,WAAiD;AACtD,WAAO,KAAK,MAAM,SAAS;AAAA,EAC7B;AAAA,EAIO,UAAU,UAAsB;AACrC,WAAO,KAAK,MAAM,UAAU,QAAQ;AAAA,EACtC;AACF;AAEA,MAAe,kCAEL,sBAA8B;AAAA,EACtC,YACE,MACQ,cACR;AACA,UAAM,IAAI;AAFF;AAAA,EAGV;AAAA,EAEO,SAAS;AACd,UAAM,OAAO,KAAK,aAAa,SAAS;AACxC,QAAI,CAAC,KAAM,OAAM,IAAI,MAAM,2BAA2B;AACtD,WAAO,KAAK,iBAAiB,KAAK,SAAS,EAAE,EAAE;AAAA,EACjD;AACF;AAEO,MAAM,4CAA4C,0BAA6C;AAAA,EACpG,IAAW,SAA4B;AACrC,WAAO;AAAA,EACT;AACF;AAEO,MAAM,0CAA0C,0BAA2C;AAAA,EAChG,IAAW,SAA0B;AACnC,WAAO;AAAA,EACT;AACF;AAEO,MAAM,qCAAqC,sBAAiC;AAAA,EACjF,IAAW,SAAoB;AAC7B,WAAO;AAAA,EACT;AAAA,EAEA,YAAY,MAA4C;AACtD,UAAM,IAAI;AAAA,EACZ;AAAA,EAEO,SAAgB;AACrB,UAAM,IAAI,MAAM,uCAAuC;AAAA,EACzD;AACF;","names":[]}
|
@@ -1,38 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
|
20
|
-
// src/api/ComposerRuntime.ts
|
21
|
-
var ComposerRuntime_exports = {};
|
22
|
-
__export(ComposerRuntime_exports, {
|
23
|
-
ComposerRuntimeImpl: () => ComposerRuntimeImpl,
|
24
|
-
EditComposerRuntimeImpl: () => EditComposerRuntimeImpl,
|
25
|
-
ThreadComposerRuntimeImpl: () => ThreadComposerRuntimeImpl
|
26
|
-
});
|
27
|
-
module.exports = __toCommonJS(ComposerRuntime_exports);
|
28
|
-
var import_LazyMemoizeSubject = require("./subscribable/LazyMemoizeSubject.js");
|
29
|
-
var import_AttachmentRuntime = require("./AttachmentRuntime.js");
|
30
|
-
var import_ShallowMemoizeSubject = require("./subscribable/ShallowMemoizeSubject.js");
|
31
|
-
var import_SKIP_UPDATE = require("./subscribable/SKIP_UPDATE.js");
|
32
|
-
var import_EventSubscriptionSubject = require("./subscribable/EventSubscriptionSubject.js");
|
33
|
-
var EMPTY_ARRAY = Object.freeze([]);
|
34
|
-
var EMPTY_OBJECT = Object.freeze({});
|
35
|
-
var getThreadComposerState = (runtime) => {
|
1
|
+
import { LazyMemoizeSubject } from "./subscribable/LazyMemoizeSubject";
|
2
|
+
import {
|
3
|
+
EditComposerAttachmentRuntimeImpl,
|
4
|
+
ThreadComposerAttachmentRuntimeImpl
|
5
|
+
} from "./AttachmentRuntime";
|
6
|
+
import { ShallowMemoizeSubject } from "./subscribable/ShallowMemoizeSubject";
|
7
|
+
import { SKIP_UPDATE } from "./subscribable/SKIP_UPDATE";
|
8
|
+
import { EventSubscriptionSubject } from "./subscribable/EventSubscriptionSubject";
|
9
|
+
const EMPTY_ARRAY = Object.freeze([]);
|
10
|
+
const EMPTY_OBJECT = Object.freeze({});
|
11
|
+
const getThreadComposerState = (runtime) => {
|
36
12
|
return Object.freeze({
|
37
13
|
type: "thread",
|
38
14
|
isEditing: runtime?.isEditing ?? false,
|
@@ -45,7 +21,7 @@ var getThreadComposerState = (runtime) => {
|
|
45
21
|
value: runtime?.text ?? ""
|
46
22
|
});
|
47
23
|
};
|
48
|
-
|
24
|
+
const getEditComposerState = (runtime) => {
|
49
25
|
return Object.freeze({
|
50
26
|
type: "edit",
|
51
27
|
isEditing: runtime?.isEditing ?? false,
|
@@ -58,7 +34,7 @@ var getEditComposerState = (runtime) => {
|
|
58
34
|
value: runtime?.text ?? ""
|
59
35
|
});
|
60
36
|
};
|
61
|
-
|
37
|
+
class ComposerRuntimeImpl {
|
62
38
|
constructor(_core) {
|
63
39
|
this._core = _core;
|
64
40
|
}
|
@@ -127,7 +103,7 @@ var ComposerRuntimeImpl = class {
|
|
127
103
|
unstable_on(event, callback) {
|
128
104
|
let subject = this._eventSubscriptionSubjects.get(event);
|
129
105
|
if (!subject) {
|
130
|
-
subject = new
|
106
|
+
subject = new EventSubscriptionSubject({
|
131
107
|
event,
|
132
108
|
binding: this._core
|
133
109
|
});
|
@@ -140,8 +116,8 @@ var ComposerRuntimeImpl = class {
|
|
140
116
|
if (!core) throw new Error("Composer is not available");
|
141
117
|
return core.getAttachmentAccept();
|
142
118
|
}
|
143
|
-
}
|
144
|
-
|
119
|
+
}
|
120
|
+
class ThreadComposerRuntimeImpl extends ComposerRuntimeImpl {
|
145
121
|
get path() {
|
146
122
|
return this._core.path;
|
147
123
|
}
|
@@ -150,7 +126,7 @@ var ThreadComposerRuntimeImpl = class extends ComposerRuntimeImpl {
|
|
150
126
|
}
|
151
127
|
_getState;
|
152
128
|
constructor(core) {
|
153
|
-
const stateBinding = new
|
129
|
+
const stateBinding = new LazyMemoizeSubject({
|
154
130
|
path: core.path,
|
155
131
|
getState: () => getThreadComposerState(core.getState()),
|
156
132
|
subscribe: (callback) => core.subscribe(callback)
|
@@ -166,8 +142,8 @@ var ThreadComposerRuntimeImpl = class extends ComposerRuntimeImpl {
|
|
166
142
|
return this._getState();
|
167
143
|
}
|
168
144
|
getAttachmentByIndex(idx) {
|
169
|
-
return new
|
170
|
-
new
|
145
|
+
return new ThreadComposerAttachmentRuntimeImpl(
|
146
|
+
new ShallowMemoizeSubject({
|
171
147
|
path: {
|
172
148
|
...this.path,
|
173
149
|
attachmentSource: "thread-composer",
|
@@ -177,7 +153,7 @@ var ThreadComposerRuntimeImpl = class extends ComposerRuntimeImpl {
|
|
177
153
|
getState: () => {
|
178
154
|
const attachments = this.getState().attachments;
|
179
155
|
const attachment = attachments[idx];
|
180
|
-
if (!attachment) return
|
156
|
+
if (!attachment) return SKIP_UPDATE;
|
181
157
|
return {
|
182
158
|
...attachment,
|
183
159
|
source: "thread-composer"
|
@@ -188,10 +164,10 @@ var ThreadComposerRuntimeImpl = class extends ComposerRuntimeImpl {
|
|
188
164
|
this._core
|
189
165
|
);
|
190
166
|
}
|
191
|
-
}
|
192
|
-
|
167
|
+
}
|
168
|
+
class EditComposerRuntimeImpl extends ComposerRuntimeImpl {
|
193
169
|
constructor(core, _beginEdit) {
|
194
|
-
const stateBinding = new
|
170
|
+
const stateBinding = new LazyMemoizeSubject({
|
195
171
|
path: core.path,
|
196
172
|
getState: () => getEditComposerState(core.getState()),
|
197
173
|
subscribe: (callback) => core.subscribe(callback)
|
@@ -222,8 +198,8 @@ var EditComposerRuntimeImpl = class extends ComposerRuntimeImpl {
|
|
222
198
|
this._beginEdit();
|
223
199
|
}
|
224
200
|
getAttachmentByIndex(idx) {
|
225
|
-
return new
|
226
|
-
new
|
201
|
+
return new EditComposerAttachmentRuntimeImpl(
|
202
|
+
new ShallowMemoizeSubject({
|
227
203
|
path: {
|
228
204
|
...this.path,
|
229
205
|
attachmentSource: "edit-composer",
|
@@ -233,7 +209,7 @@ var EditComposerRuntimeImpl = class extends ComposerRuntimeImpl {
|
|
233
209
|
getState: () => {
|
234
210
|
const attachments = this.getState().attachments;
|
235
211
|
const attachment = attachments[idx];
|
236
|
-
if (!attachment) return
|
212
|
+
if (!attachment) return SKIP_UPDATE;
|
237
213
|
return {
|
238
214
|
...attachment,
|
239
215
|
source: "edit-composer"
|
@@ -244,11 +220,10 @@ var EditComposerRuntimeImpl = class extends ComposerRuntimeImpl {
|
|
244
220
|
this._core
|
245
221
|
);
|
246
222
|
}
|
247
|
-
}
|
248
|
-
|
249
|
-
0 && (module.exports = {
|
223
|
+
}
|
224
|
+
export {
|
250
225
|
ComposerRuntimeImpl,
|
251
226
|
EditComposerRuntimeImpl,
|
252
227
|
ThreadComposerRuntimeImpl
|
253
|
-
}
|
228
|
+
};
|
254
229
|
//# sourceMappingURL=ComposerRuntime.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/api/ComposerRuntime.ts"],"sourcesContent":["import { Attachment, PendingAttachment } from \"../types/AttachmentTypes\";\nimport {\n ComposerRuntimeCore,\n ComposerRuntimeEventType,\n ThreadComposerRuntimeCore,\n} from \"../runtimes/core/ComposerRuntimeCore\";\nimport { Unsubscribe } from \"../types\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { LazyMemoizeSubject } from \"./subscribable/LazyMemoizeSubject\";\nimport {\n AttachmentRuntime,\n AttachmentState,\n EditComposerAttachmentRuntimeImpl,\n ThreadComposerAttachmentRuntimeImpl,\n} from \"./AttachmentRuntime\";\nimport { ShallowMemoizeSubject } from \"./subscribable/ShallowMemoizeSubject\";\nimport { SKIP_UPDATE } from \"./subscribable/SKIP_UPDATE\";\nimport { ComposerRuntimePath } from \"./RuntimePathTypes\";\nimport { MessageRole, RunConfig } from \"../types/AssistantTypes\";\nimport { EventSubscriptionSubject } from \"./subscribable/EventSubscriptionSubject\";\n\nexport type ThreadComposerRuntimeCoreBinding = SubscribableWithState<\n ThreadComposerRuntimeCore | undefined,\n ComposerRuntimePath & { composerSource: \"thread\" }\n>;\n\nexport type EditComposerRuntimeCoreBinding = SubscribableWithState<\n ComposerRuntimeCore | undefined,\n ComposerRuntimePath & { composerSource: \"edit\" }\n>;\n\nexport type ComposerRuntimeCoreBinding = SubscribableWithState<\n ComposerRuntimeCore | undefined,\n ComposerRuntimePath\n>;\n\ntype BaseComposerState = {\n readonly canCancel: boolean;\n readonly isEditing: boolean;\n readonly isEmpty: boolean;\n\n readonly text: string;\n readonly role: MessageRole;\n readonly attachments: readonly Attachment[];\n readonly runConfig: RunConfig;\n};\n\nexport type ThreadComposerState = BaseComposerState & {\n readonly type: \"thread\";\n\n readonly attachments: readonly PendingAttachment[];\n};\n\nexport type EditComposerState = BaseComposerState & {\n readonly type: \"edit\";\n};\n\nexport type ComposerState = ThreadComposerState | EditComposerState;\n\nconst EMPTY_ARRAY = Object.freeze([]);\nconst EMPTY_OBJECT = Object.freeze({});\nconst getThreadComposerState = (\n runtime: ThreadComposerRuntimeCore | undefined,\n): ThreadComposerState => {\n return Object.freeze({\n type: \"thread\",\n\n isEditing: runtime?.isEditing ?? false,\n canCancel: runtime?.canCancel ?? false,\n isEmpty: runtime?.isEmpty ?? true,\n\n attachments: runtime?.attachments ?? EMPTY_ARRAY,\n text: runtime?.text ?? \"\",\n role: runtime?.role ?? \"user\",\n runConfig: runtime?.runConfig ?? EMPTY_OBJECT,\n\n value: runtime?.text ?? \"\",\n });\n};\n\nconst getEditComposerState = (\n runtime: ComposerRuntimeCore | undefined,\n): EditComposerState => {\n return Object.freeze({\n type: \"edit\",\n\n isEditing: runtime?.isEditing ?? false,\n canCancel: runtime?.canCancel ?? false,\n isEmpty: runtime?.isEmpty ?? true,\n\n text: runtime?.text ?? \"\",\n role: runtime?.role ?? \"user\",\n attachments: runtime?.attachments ?? EMPTY_ARRAY,\n runConfig: runtime?.runConfig ?? EMPTY_OBJECT,\n\n value: runtime?.text ?? \"\",\n });\n};\n\nexport type ComposerRuntime = {\n readonly path: ComposerRuntimePath;\n readonly type: \"edit\" | \"thread\";\n getState(): ComposerState;\n\n getAttachmentAccept(): string;\n addAttachment(file: File): Promise<void>;\n\n setText(text: string): void;\n setRole(role: MessageRole): void;\n setRunConfig(runConfig: RunConfig): void;\n\n reset(): Promise<void>;\n clearAttachments(): Promise<void>;\n\n send(): void;\n cancel(): void;\n subscribe(callback: () => void): Unsubscribe;\n getAttachmentByIndex(idx: number): AttachmentRuntime;\n};\n\nexport abstract class ComposerRuntimeImpl implements ComposerRuntime {\n public get path() {\n return this._core.path;\n }\n\n public abstract get type(): \"edit\" | \"thread\";\n\n constructor(protected _core: ComposerRuntimeCoreBinding) {}\n\n protected __internal_bindMethods() {\n this.setText = this.setText.bind(this);\n this.setRunConfig = this.setRunConfig.bind(this);\n this.getState = this.getState.bind(this);\n this.subscribe = this.subscribe.bind(this);\n this.addAttachment = this.addAttachment.bind(this);\n this.reset = this.reset.bind(this);\n this.clearAttachments = this.clearAttachments.bind(this);\n this.send = this.send.bind(this);\n this.cancel = this.cancel.bind(this);\n this.setRole = this.setRole.bind(this);\n this.getAttachmentAccept = this.getAttachmentAccept.bind(this);\n this.getAttachmentByIndex = this.getAttachmentByIndex.bind(this);\n this.unstable_on = this.unstable_on.bind(this);\n }\n\n public abstract getState(): ComposerState;\n\n public setText(text: string) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setText(text);\n }\n\n public setRunConfig(runConfig: RunConfig) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setRunConfig(runConfig);\n }\n\n public addAttachment(file: File) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.addAttachment(file);\n }\n\n public reset() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.reset();\n }\n\n public clearAttachments() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.clearAttachments();\n }\n\n public send() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.send();\n }\n\n public cancel() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.cancel();\n }\n\n public setRole(role: MessageRole) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setRole(role);\n }\n\n public subscribe(callback: () => void) {\n return this._core.subscribe(callback);\n }\n\n private _eventSubscriptionSubjects = new Map<\n string,\n EventSubscriptionSubject<ComposerRuntimeEventType>\n >();\n\n public unstable_on(\n event: ComposerRuntimeEventType,\n callback: () => void,\n ): Unsubscribe {\n let subject = this._eventSubscriptionSubjects.get(event);\n if (!subject) {\n subject = new EventSubscriptionSubject({\n event: event,\n binding: this._core,\n });\n this._eventSubscriptionSubjects.set(event, subject);\n }\n return subject.subscribe(callback);\n }\n\n public getAttachmentAccept(): string {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.getAttachmentAccept();\n }\n\n public abstract getAttachmentByIndex(idx: number): AttachmentRuntime;\n}\n\nexport type ThreadComposerRuntime = Omit<\n ComposerRuntime,\n \"getState\" | \"getAttachmentByIndex\"\n> & {\n readonly path: ComposerRuntimePath & { composerSource: \"thread\" };\n readonly type: \"thread\";\n getState(): ThreadComposerState;\n\n getAttachmentByIndex(\n idx: number,\n ): AttachmentRuntime & { source: \"thread-composer\" };\n};\n\nexport class ThreadComposerRuntimeImpl\n extends ComposerRuntimeImpl\n implements ThreadComposerRuntime\n{\n public override get path() {\n return this._core.path as ComposerRuntimePath & {\n composerSource: \"thread\";\n };\n }\n\n public get type() {\n return \"thread\" as const;\n }\n\n private _getState;\n\n constructor(core: ThreadComposerRuntimeCoreBinding) {\n const stateBinding = new LazyMemoizeSubject({\n path: core.path,\n getState: () => getThreadComposerState(core.getState()),\n subscribe: (callback) => core.subscribe(callback),\n });\n super({\n path: core.path,\n getState: () => core.getState(),\n subscribe: (callback) => stateBinding.subscribe(callback),\n });\n this._getState = stateBinding.getState.bind(stateBinding);\n }\n\n public override getState(): ThreadComposerState {\n return this._getState();\n }\n\n public getAttachmentByIndex(idx: number) {\n return new ThreadComposerAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n attachmentSource: \"thread-composer\",\n attachmentSelector: { type: \"index\", index: idx },\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n },\n getState: () => {\n const attachments = this.getState().attachments;\n const attachment = attachments[idx];\n if (!attachment) return SKIP_UPDATE;\n\n return {\n ...attachment,\n source: \"thread-composer\",\n } satisfies AttachmentState & { source: \"thread-composer\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n\nexport type EditComposerRuntime = Omit<\n ComposerRuntime,\n \"getState\" | \"getAttachmentByIndex\"\n> & {\n readonly path: ComposerRuntimePath & { composerSource: \"edit\" };\n readonly type: \"edit\";\n\n getState(): EditComposerState;\n beginEdit(): void;\n\n getAttachmentByIndex(\n idx: number,\n ): AttachmentRuntime & { source: \"edit-composer\" };\n};\n\nexport class EditComposerRuntimeImpl\n extends ComposerRuntimeImpl\n implements EditComposerRuntime\n{\n public override get path() {\n return this._core.path as ComposerRuntimePath & { composerSource: \"edit\" };\n }\n\n public get type() {\n return \"edit\" as const;\n }\n\n private _getState;\n constructor(\n core: EditComposerRuntimeCoreBinding,\n private _beginEdit: () => void,\n ) {\n const stateBinding = new LazyMemoizeSubject({\n path: core.path,\n getState: () => getEditComposerState(core.getState()),\n subscribe: (callback) => core.subscribe(callback),\n });\n\n super({\n path: core.path,\n getState: () => core.getState(),\n subscribe: (callback) => stateBinding.subscribe(callback),\n });\n\n this._getState = stateBinding.getState.bind(stateBinding);\n }\n\n public override __internal_bindMethods() {\n super.__internal_bindMethods();\n this.beginEdit = this.beginEdit.bind(this);\n }\n\n public override getState(): EditComposerState {\n return this._getState();\n }\n\n public beginEdit() {\n this._beginEdit();\n }\n\n public getAttachmentByIndex(idx: number) {\n return new EditComposerAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n attachmentSource: \"edit-composer\",\n attachmentSelector: { type: \"index\", index: idx },\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n },\n getState: () => {\n const attachments = this.getState().attachments;\n const attachment = attachments[idx];\n if (!attachment) return SKIP_UPDATE;\n\n return {\n ...attachment,\n source: \"edit-composer\",\n } satisfies AttachmentState & { source: \"edit-composer\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,gCAAmC;AACnC,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A,EACpB;AAAA,EAEA,IAAW,OAAO;AAChB,WAAO;AAAA,EACT;AAAA,EAEQ;AAAA,EAoBQ,yBAAyB;AACvC,UAAM,uBAAuB;AAC7B,SAAK,YAAY,KAAK,UAAU,KAAK,IAAI;AAAA,EAC3C;AAAA,EAEgB,WAA8B;AAC5C,WAAO,KAAK,UAAU;AAAA,EACxB;AAAA,EAEO,YAAY;AACjB,SAAK,WAAW;AAAA,EAClB;AAAA,EAEO,qBAAqB,KAAa;AACvC,WAAO,IAAI;AAAA,MACT,IAAI,mDAAsB;AAAA,QACxB,MAAM;AAAA,UACJ,GAAG,KAAK;AAAA,UACR,kBAAkB;AAAA,UAClB,oBAAoB,EAAE,MAAM,SAAS,OAAO,IAAI;AAAA,UAChD,KAAK,KAAK,KAAK,MAAM,GAAG,KAAK,KAAK,GAAG,gBAAgB,GAAG;AAAA,QAC1D;AAAA,QACA,UAAU,MAAM;AACd,gBAAM,cAAc,KAAK,SAAS,EAAE;AACpC,gBAAM,aAAa,YAAY,GAAG;AAClC,cAAI,CAAC,WAAY,QAAO;AAExB,iBAAO;AAAA,YACL,GAAG;AAAA,YACH,QAAQ;AAAA,UACV;AAAA,QACF;AAAA,QACA,WAAW,CAAC,aAAa,KAAK,MAAM,UAAU,QAAQ;AAAA,MACxD,CAAC;AAAA,MACD,KAAK;AAAA,IACP;AAAA,EACF;AACF;","names":[]}
|
1
|
+
{"version":3,"sources":["../../src/api/ComposerRuntime.ts"],"sourcesContent":["import { Attachment, PendingAttachment } from \"../types/AttachmentTypes\";\nimport {\n ComposerRuntimeCore,\n ComposerRuntimeEventType,\n ThreadComposerRuntimeCore,\n} from \"../runtimes/core/ComposerRuntimeCore\";\nimport { Unsubscribe } from \"../types\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { LazyMemoizeSubject } from \"./subscribable/LazyMemoizeSubject\";\nimport {\n AttachmentRuntime,\n AttachmentState,\n EditComposerAttachmentRuntimeImpl,\n ThreadComposerAttachmentRuntimeImpl,\n} from \"./AttachmentRuntime\";\nimport { ShallowMemoizeSubject } from \"./subscribable/ShallowMemoizeSubject\";\nimport { SKIP_UPDATE } from \"./subscribable/SKIP_UPDATE\";\nimport { ComposerRuntimePath } from \"./RuntimePathTypes\";\nimport { MessageRole, RunConfig } from \"../types/AssistantTypes\";\nimport { EventSubscriptionSubject } from \"./subscribable/EventSubscriptionSubject\";\n\nexport type ThreadComposerRuntimeCoreBinding = SubscribableWithState<\n ThreadComposerRuntimeCore | undefined,\n ComposerRuntimePath & { composerSource: \"thread\" }\n>;\n\nexport type EditComposerRuntimeCoreBinding = SubscribableWithState<\n ComposerRuntimeCore | undefined,\n ComposerRuntimePath & { composerSource: \"edit\" }\n>;\n\nexport type ComposerRuntimeCoreBinding = SubscribableWithState<\n ComposerRuntimeCore | undefined,\n ComposerRuntimePath\n>;\n\ntype BaseComposerState = {\n readonly canCancel: boolean;\n readonly isEditing: boolean;\n readonly isEmpty: boolean;\n\n readonly text: string;\n readonly role: MessageRole;\n readonly attachments: readonly Attachment[];\n readonly runConfig: RunConfig;\n};\n\nexport type ThreadComposerState = BaseComposerState & {\n readonly type: \"thread\";\n\n readonly attachments: readonly PendingAttachment[];\n};\n\nexport type EditComposerState = BaseComposerState & {\n readonly type: \"edit\";\n};\n\nexport type ComposerState = ThreadComposerState | EditComposerState;\n\nconst EMPTY_ARRAY = Object.freeze([]);\nconst EMPTY_OBJECT = Object.freeze({});\nconst getThreadComposerState = (\n runtime: ThreadComposerRuntimeCore | undefined,\n): ThreadComposerState => {\n return Object.freeze({\n type: \"thread\",\n\n isEditing: runtime?.isEditing ?? false,\n canCancel: runtime?.canCancel ?? false,\n isEmpty: runtime?.isEmpty ?? true,\n\n attachments: runtime?.attachments ?? EMPTY_ARRAY,\n text: runtime?.text ?? \"\",\n role: runtime?.role ?? \"user\",\n runConfig: runtime?.runConfig ?? EMPTY_OBJECT,\n\n value: runtime?.text ?? \"\",\n });\n};\n\nconst getEditComposerState = (\n runtime: ComposerRuntimeCore | undefined,\n): EditComposerState => {\n return Object.freeze({\n type: \"edit\",\n\n isEditing: runtime?.isEditing ?? false,\n canCancel: runtime?.canCancel ?? false,\n isEmpty: runtime?.isEmpty ?? true,\n\n text: runtime?.text ?? \"\",\n role: runtime?.role ?? \"user\",\n attachments: runtime?.attachments ?? EMPTY_ARRAY,\n runConfig: runtime?.runConfig ?? EMPTY_OBJECT,\n\n value: runtime?.text ?? \"\",\n });\n};\n\nexport type ComposerRuntime = {\n readonly path: ComposerRuntimePath;\n readonly type: \"edit\" | \"thread\";\n getState(): ComposerState;\n\n getAttachmentAccept(): string;\n addAttachment(file: File): Promise<void>;\n\n setText(text: string): void;\n setRole(role: MessageRole): void;\n setRunConfig(runConfig: RunConfig): void;\n\n reset(): Promise<void>;\n clearAttachments(): Promise<void>;\n\n send(): void;\n cancel(): void;\n subscribe(callback: () => void): Unsubscribe;\n getAttachmentByIndex(idx: number): AttachmentRuntime;\n};\n\nexport abstract class ComposerRuntimeImpl implements ComposerRuntime {\n public get path() {\n return this._core.path;\n }\n\n public abstract get type(): \"edit\" | \"thread\";\n\n constructor(protected _core: ComposerRuntimeCoreBinding) {}\n\n protected __internal_bindMethods() {\n this.setText = this.setText.bind(this);\n this.setRunConfig = this.setRunConfig.bind(this);\n this.getState = this.getState.bind(this);\n this.subscribe = this.subscribe.bind(this);\n this.addAttachment = this.addAttachment.bind(this);\n this.reset = this.reset.bind(this);\n this.clearAttachments = this.clearAttachments.bind(this);\n this.send = this.send.bind(this);\n this.cancel = this.cancel.bind(this);\n this.setRole = this.setRole.bind(this);\n this.getAttachmentAccept = this.getAttachmentAccept.bind(this);\n this.getAttachmentByIndex = this.getAttachmentByIndex.bind(this);\n this.unstable_on = this.unstable_on.bind(this);\n }\n\n public abstract getState(): ComposerState;\n\n public setText(text: string) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setText(text);\n }\n\n public setRunConfig(runConfig: RunConfig) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setRunConfig(runConfig);\n }\n\n public addAttachment(file: File) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.addAttachment(file);\n }\n\n public reset() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.reset();\n }\n\n public clearAttachments() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.clearAttachments();\n }\n\n public send() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.send();\n }\n\n public cancel() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.cancel();\n }\n\n public setRole(role: MessageRole) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setRole(role);\n }\n\n public subscribe(callback: () => void) {\n return this._core.subscribe(callback);\n }\n\n private _eventSubscriptionSubjects = new Map<\n string,\n EventSubscriptionSubject<ComposerRuntimeEventType>\n >();\n\n public unstable_on(\n event: ComposerRuntimeEventType,\n callback: () => void,\n ): Unsubscribe {\n let subject = this._eventSubscriptionSubjects.get(event);\n if (!subject) {\n subject = new EventSubscriptionSubject({\n event: event,\n binding: this._core,\n });\n this._eventSubscriptionSubjects.set(event, subject);\n }\n return subject.subscribe(callback);\n }\n\n public getAttachmentAccept(): string {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.getAttachmentAccept();\n }\n\n public abstract getAttachmentByIndex(idx: number): AttachmentRuntime;\n}\n\nexport type ThreadComposerRuntime = Omit<\n ComposerRuntime,\n \"getState\" | \"getAttachmentByIndex\"\n> & {\n readonly path: ComposerRuntimePath & { composerSource: \"thread\" };\n readonly type: \"thread\";\n getState(): ThreadComposerState;\n\n getAttachmentByIndex(\n idx: number,\n ): AttachmentRuntime & { source: \"thread-composer\" };\n};\n\nexport class ThreadComposerRuntimeImpl\n extends ComposerRuntimeImpl\n implements ThreadComposerRuntime\n{\n public override get path() {\n return this._core.path as ComposerRuntimePath & {\n composerSource: \"thread\";\n };\n }\n\n public get type() {\n return \"thread\" as const;\n }\n\n private _getState;\n\n constructor(core: ThreadComposerRuntimeCoreBinding) {\n const stateBinding = new LazyMemoizeSubject({\n path: core.path,\n getState: () => getThreadComposerState(core.getState()),\n subscribe: (callback) => core.subscribe(callback),\n });\n super({\n path: core.path,\n getState: () => core.getState(),\n subscribe: (callback) => stateBinding.subscribe(callback),\n });\n this._getState = stateBinding.getState.bind(stateBinding);\n }\n\n public override getState(): ThreadComposerState {\n return this._getState();\n }\n\n public getAttachmentByIndex(idx: number) {\n return new ThreadComposerAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n attachmentSource: \"thread-composer\",\n attachmentSelector: { type: \"index\", index: idx },\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n },\n getState: () => {\n const attachments = this.getState().attachments;\n const attachment = attachments[idx];\n if (!attachment) return SKIP_UPDATE;\n\n return {\n ...attachment,\n source: \"thread-composer\",\n } satisfies AttachmentState & { source: \"thread-composer\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n\nexport type EditComposerRuntime = Omit<\n ComposerRuntime,\n \"getState\" | \"getAttachmentByIndex\"\n> & {\n readonly path: ComposerRuntimePath & { composerSource: \"edit\" };\n readonly type: \"edit\";\n\n getState(): EditComposerState;\n beginEdit(): void;\n\n getAttachmentByIndex(\n idx: number,\n ): AttachmentRuntime & { source: \"edit-composer\" };\n};\n\nexport class EditComposerRuntimeImpl\n extends ComposerRuntimeImpl\n implements EditComposerRuntime\n{\n public override get path() {\n return this._core.path as ComposerRuntimePath & { composerSource: \"edit\" };\n }\n\n public get type() {\n return \"edit\" as const;\n }\n\n private _getState;\n constructor(\n core: EditComposerRuntimeCoreBinding,\n private _beginEdit: () => void,\n ) {\n const stateBinding = new LazyMemoizeSubject({\n path: core.path,\n getState: () => getEditComposerState(core.getState()),\n subscribe: (callback) => core.subscribe(callback),\n });\n\n super({\n path: core.path,\n getState: () => core.getState(),\n subscribe: (callback) => stateBinding.subscribe(callback),\n });\n\n this._getState = stateBinding.getState.bind(stateBinding);\n }\n\n public override __internal_bindMethods() {\n super.__internal_bindMethods();\n this.beginEdit = this.beginEdit.bind(this);\n }\n\n public override getState(): EditComposerState {\n return this._getState();\n }\n\n public beginEdit() {\n this._beginEdit();\n }\n\n public getAttachmentByIndex(idx: number) {\n return new EditComposerAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n attachmentSource: \"edit-composer\",\n attachmentSelector: { type: \"index\", index: idx },\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n },\n getState: () => {\n const attachments = this.getState().attachments;\n const attachment = attachments[idx];\n if (!attachment) return SKIP_UPDATE;\n\n return {\n ...attachment,\n source: \"edit-composer\",\n } satisfies AttachmentState & { source: \"edit-composer\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n"],"mappings":"AAQA,SAAS,0BAA0B;AACnC;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAG5B,SAAS,gCAAgC;AAwCzC,MAAM,cAAc,OAAO,OAAO,CAAC,CAAC;AACpC,MAAM,eAAe,OAAO,OAAO,CAAC,CAAC;AACrC,MAAM,yBAAyB,CAC7B,YACwB;AACxB,SAAO,OAAO,OAAO;AAAA,IACnB,MAAM;AAAA,IAEN,WAAW,SAAS,aAAa;AAAA,IACjC,WAAW,SAAS,aAAa;AAAA,IACjC,SAAS,SAAS,WAAW;AAAA,IAE7B,aAAa,SAAS,eAAe;AAAA,IACrC,MAAM,SAAS,QAAQ;AAAA,IACvB,MAAM,SAAS,QAAQ;AAAA,IACvB,WAAW,SAAS,aAAa;AAAA,IAEjC,OAAO,SAAS,QAAQ;AAAA,EAC1B,CAAC;AACH;AAEA,MAAM,uBAAuB,CAC3B,YACsB;AACtB,SAAO,OAAO,OAAO;AAAA,IACnB,MAAM;A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cAAc,KAAK,SAAS,EAAE;AACpC,gBAAM,aAAa,YAAY,GAAG;AAClC,cAAI,CAAC,WAAY,QAAO;AAExB,iBAAO;AAAA,YACL,GAAG;AAAA,YACH,QAAQ;AAAA,UACV;AAAA,QACF;AAAA,QACA,WAAW,CAAC,aAAa,KAAK,MAAM,UAAU,QAAQ;AAAA,MACxD,CAAC;AAAA,MACD,KAAK;AAAA,IACP;AAAA,EACF;AACF;","names":[]}
|
@@ -1,29 +1,4 @@
|
|
1
|
-
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
|
20
|
-
// src/api/ContentPartRuntime.ts
|
21
|
-
var ContentPartRuntime_exports = {};
|
22
|
-
__export(ContentPartRuntime_exports, {
|
23
|
-
ContentPartRuntimeImpl: () => ContentPartRuntimeImpl
|
24
|
-
});
|
25
|
-
module.exports = __toCommonJS(ContentPartRuntime_exports);
|
26
|
-
var ContentPartRuntimeImpl = class {
|
1
|
+
class ContentPartRuntimeImpl {
|
27
2
|
constructor(contentBinding, messageApi, threadApi) {
|
28
3
|
this.contentBinding = contentBinding;
|
29
4
|
this.messageApi = messageApi;
|
@@ -64,9 +39,8 @@ var ContentPartRuntimeImpl = class {
|
|
64
39
|
subscribe(callback) {
|
65
40
|
return this.contentBinding.subscribe(callback);
|
66
41
|
}
|
67
|
-
}
|
68
|
-
|
69
|
-
0 && (module.exports = {
|
42
|
+
}
|
43
|
+
export {
|
70
44
|
ContentPartRuntimeImpl
|
71
|
-
}
|
45
|
+
};
|
72
46
|
//# sourceMappingURL=ContentPartRuntime.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/api/ContentPartRuntime.ts"],"sourcesContent":["import {\n ThreadAssistantContentPart,\n ThreadUserContentPart,\n ContentPartStatus,\n ToolCallContentPartStatus,\n} from \"../types/AssistantTypes\";\nimport { ThreadRuntimeCoreBinding } from \"./ThreadRuntime\";\nimport { MessageStateBinding } from \"./MessageRuntime\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { Unsubscribe } from \"../types\";\nimport { ContentPartRuntimePath } from \"./RuntimePathTypes\";\n\nexport type ContentPartState = (\n | ThreadUserContentPart\n | ThreadAssistantContentPart\n) & {\n readonly status: ContentPartStatus | ToolCallContentPartStatus;\n};\n\ntype ContentPartSnapshotBinding = SubscribableWithState<\n ContentPartState,\n ContentPartRuntimePath\n>;\n\nexport type ContentPartRuntime = {\n /**\n * Add tool result to a tool call content part that has no tool result yet.\n * This is useful when you are collecting a tool result via user input (\"human tool calls\").\n */\n addToolResult(result: any): void;\n\n readonly path: ContentPartRuntimePath;\n getState(): ContentPartState;\n subscribe(callback: () => void): Unsubscribe;\n};\n\nexport class ContentPartRuntimeImpl implements ContentPartRuntime {\n public get path() {\n return this.contentBinding.path;\n }\n\n constructor(\n private contentBinding: ContentPartSnapshotBinding,\n private messageApi?: MessageStateBinding,\n private threadApi?: ThreadRuntimeCoreBinding,\n ) {}\n\n protected __internal_bindMethods() {\n this.addToolResult = this.addToolResult.bind(this);\n this.getState = this.getState.bind(this);\n this.subscribe = this.subscribe.bind(this);\n }\n\n public getState() {\n return this.contentBinding.getState();\n }\n\n public addToolResult(result: any) {\n const state = this.contentBinding.getState();\n if (!state) throw new Error(\"Content part is not available\");\n\n if (state.type !== \"tool-call\")\n throw new Error(\"Tried to add tool result to non-tool content part\");\n\n if (!this.messageApi)\n throw new Error(\n \"Message API is not available. This is likely a bug in assistant-ui.\",\n );\n if (!this.threadApi) throw new Error(\"Thread API is not available\");\n\n const message = this.messageApi.getState();\n if (!message) throw new Error(\"Message is not available\");\n\n const toolName = state.toolName;\n const toolCallId = state.toolCallId;\n\n this.threadApi.getState().addToolResult({\n messageId: message.id,\n toolName,\n toolCallId,\n result,\n });\n }\n\n public subscribe(callback: () => void) {\n return this.contentBinding.subscribe(callback);\n }\n}\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../src/api/ContentPartRuntime.ts"],"sourcesContent":["import {\n ThreadAssistantContentPart,\n ThreadUserContentPart,\n ContentPartStatus,\n ToolCallContentPartStatus,\n} from \"../types/AssistantTypes\";\nimport { ThreadRuntimeCoreBinding } from \"./ThreadRuntime\";\nimport { MessageStateBinding } from \"./MessageRuntime\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { Unsubscribe } from \"../types\";\nimport { ContentPartRuntimePath } from \"./RuntimePathTypes\";\n\nexport type ContentPartState = (\n | ThreadUserContentPart\n | ThreadAssistantContentPart\n) & {\n readonly status: ContentPartStatus | ToolCallContentPartStatus;\n};\n\ntype ContentPartSnapshotBinding = SubscribableWithState<\n ContentPartState,\n ContentPartRuntimePath\n>;\n\nexport type ContentPartRuntime = {\n /**\n * Add tool result to a tool call content part that has no tool result yet.\n * This is useful when you are collecting a tool result via user input (\"human tool calls\").\n */\n addToolResult(result: any): void;\n\n readonly path: ContentPartRuntimePath;\n getState(): ContentPartState;\n subscribe(callback: () => void): Unsubscribe;\n};\n\nexport class ContentPartRuntimeImpl implements ContentPartRuntime {\n public get path() {\n return this.contentBinding.path;\n }\n\n constructor(\n private contentBinding: ContentPartSnapshotBinding,\n private messageApi?: MessageStateBinding,\n private threadApi?: ThreadRuntimeCoreBinding,\n ) {}\n\n protected __internal_bindMethods() {\n this.addToolResult = this.addToolResult.bind(this);\n this.getState = this.getState.bind(this);\n this.subscribe = this.subscribe.bind(this);\n }\n\n public getState() {\n return this.contentBinding.getState();\n }\n\n public addToolResult(result: any) {\n const state = this.contentBinding.getState();\n if (!state) throw new Error(\"Content part is not available\");\n\n if (state.type !== \"tool-call\")\n throw new Error(\"Tried to add tool result to non-tool content part\");\n\n if (!this.messageApi)\n throw new Error(\n \"Message API is not available. This is likely a bug in assistant-ui.\",\n );\n if (!this.threadApi) throw new Error(\"Thread API is not available\");\n\n const message = this.messageApi.getState();\n if (!message) throw new Error(\"Message is not available\");\n\n const toolName = state.toolName;\n const toolCallId = state.toolCallId;\n\n this.threadApi.getState().addToolResult({\n messageId: message.id,\n toolName,\n toolCallId,\n result,\n });\n }\n\n public subscribe(callback: () => void) {\n return this.contentBinding.subscribe(callback);\n }\n}\n"],"mappings":"AAoCO,MAAM,uBAAqD;AAAA,EAKhE,YACU,gBACA,YACA,WACR;AAHQ;AACA;AACA;AAAA,EACP;AAAA,EARH,IAAW,OAAO;AAChB,WAAO,KAAK,eAAe;AAAA,EAC7B;AAAA,EAQU,yBAAyB;AACjC,SAAK,gBAAgB,KAAK,cAAc,KAAK,IAAI;AACjD,SAAK,WAAW,KAAK,SAAS,KAAK,IAAI;AACvC,SAAK,YAAY,KAAK,UAAU,KAAK,IAAI;AAAA,EAC3C;AAAA,EAEO,WAAW;AAChB,WAAO,KAAK,eAAe,SAAS;AAAA,EACtC;AAAA,EAEO,cAAc,QAAa;AAChC,UAAM,QAAQ,KAAK,eAAe,SAAS;AAC3C,QAAI,CAAC,MAAO,OAAM,IAAI,MAAM,+BAA+B;AAE3D,QAAI,MAAM,SAAS;AACjB,YAAM,IAAI,MAAM,mDAAmD;AAErE,QAAI,CAAC,KAAK;AACR,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AACF,QAAI,CAAC,KAAK,UAAW,OAAM,IAAI,MAAM,6BAA6B;AAElE,UAAM,UAAU,KAAK,WAAW,SAAS;AACzC,QAAI,CAAC,QAAS,OAAM,IAAI,MAAM,0BAA0B;AAExD,UAAM,WAAW,MAAM;AACvB,UAAM,aAAa,MAAM;AAEzB,SAAK,UAAU,SAAS,EAAE,cAAc;AAAA,MACtC,WAAW,QAAQ;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEO,UAAU,UAAsB;AACrC,WAAO,KAAK,eAAe,UAAU,QAAQ;AAAA,EAC/C;AACF;","names":[]}
|