@assistant-ui/react 0.7.42 → 0.7.44
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/api/AssistantRuntime.d.ts +11 -3
- package/dist/api/AssistantRuntime.d.ts.map +1 -1
- package/dist/api/AssistantRuntime.js +8 -17
- package/dist/api/AssistantRuntime.js.map +1 -1
- package/dist/api/AssistantRuntime.mjs +8 -17
- package/dist/api/AssistantRuntime.mjs.map +1 -1
- package/dist/api/RuntimePathTypes.d.ts +4 -1
- package/dist/api/RuntimePathTypes.d.ts.map +1 -1
- package/dist/api/RuntimePathTypes.js.map +1 -1
- package/dist/api/ThreadListItemRuntime.d.ts +8 -0
- package/dist/api/ThreadListItemRuntime.d.ts.map +1 -1
- package/dist/api/ThreadListItemRuntime.js +4 -0
- package/dist/api/ThreadListItemRuntime.js.map +1 -1
- package/dist/api/ThreadListItemRuntime.mjs +4 -0
- package/dist/api/ThreadListItemRuntime.mjs.map +1 -1
- package/dist/api/ThreadListRuntime.d.ts +11 -1
- package/dist/api/ThreadListRuntime.d.ts.map +1 -1
- package/dist/api/ThreadListRuntime.js +37 -1
- package/dist/api/ThreadListRuntime.js.map +1 -1
- package/dist/api/ThreadListRuntime.mjs +39 -1
- package/dist/api/ThreadListRuntime.mjs.map +1 -1
- package/dist/runtimes/adapters/RuntimeAdapterProvider.d.ts +15 -0
- package/dist/runtimes/adapters/RuntimeAdapterProvider.d.ts.map +1 -0
- package/dist/runtimes/adapters/RuntimeAdapterProvider.js +45 -0
- package/dist/runtimes/adapters/RuntimeAdapterProvider.js.map +1 -0
- package/dist/runtimes/adapters/RuntimeAdapterProvider.mjs +19 -0
- package/dist/runtimes/adapters/RuntimeAdapterProvider.mjs.map +1 -0
- package/dist/runtimes/{attachment → adapters/attachment}/AttachmentAdapter.d.ts +1 -1
- package/dist/runtimes/adapters/attachment/AttachmentAdapter.d.ts.map +1 -0
- package/dist/runtimes/{attachment → adapters/attachment}/AttachmentAdapter.js +1 -1
- package/dist/runtimes/adapters/attachment/AttachmentAdapter.js.map +1 -0
- package/dist/runtimes/{attachment → adapters/attachment}/CompositeAttachmentAdapter.d.ts +2 -2
- package/dist/runtimes/adapters/attachment/CompositeAttachmentAdapter.d.ts.map +1 -0
- package/dist/runtimes/{attachment → adapters/attachment}/CompositeAttachmentAdapter.js +1 -1
- package/dist/runtimes/adapters/attachment/CompositeAttachmentAdapter.js.map +1 -0
- package/dist/runtimes/{attachment → adapters/attachment}/CompositeAttachmentAdapter.mjs +1 -1
- package/dist/runtimes/adapters/attachment/CompositeAttachmentAdapter.mjs.map +1 -0
- package/dist/runtimes/{attachment → adapters/attachment}/SimpleImageAttachmentAdapter.d.ts +1 -1
- package/dist/runtimes/adapters/attachment/SimpleImageAttachmentAdapter.d.ts.map +1 -0
- package/dist/runtimes/{attachment → adapters/attachment}/SimpleImageAttachmentAdapter.js +1 -1
- package/dist/runtimes/adapters/attachment/SimpleImageAttachmentAdapter.js.map +1 -0
- package/dist/runtimes/{attachment → adapters/attachment}/SimpleImageAttachmentAdapter.mjs +1 -1
- package/dist/runtimes/adapters/attachment/SimpleImageAttachmentAdapter.mjs.map +1 -0
- package/dist/runtimes/{attachment → adapters/attachment}/SimpleTextAttachmentAdapter.d.ts +1 -1
- package/dist/runtimes/adapters/attachment/SimpleTextAttachmentAdapter.d.ts.map +1 -0
- package/dist/runtimes/{attachment → adapters/attachment}/SimpleTextAttachmentAdapter.js +1 -1
- package/dist/runtimes/adapters/attachment/SimpleTextAttachmentAdapter.js.map +1 -0
- package/dist/runtimes/{attachment → adapters/attachment}/SimpleTextAttachmentAdapter.mjs +1 -1
- package/dist/runtimes/adapters/attachment/SimpleTextAttachmentAdapter.mjs.map +1 -0
- package/dist/runtimes/adapters/attachment/index.d.ts.map +1 -0
- package/dist/runtimes/{attachment → adapters/attachment}/index.js +1 -1
- package/dist/runtimes/adapters/attachment/index.js.map +1 -0
- package/dist/runtimes/{attachment → adapters/attachment}/index.mjs +1 -1
- package/dist/runtimes/adapters/attachment/index.mjs.map +1 -0
- package/dist/runtimes/{feedback → adapters/feedback}/FeedbackAdapter.d.ts +1 -1
- package/dist/runtimes/adapters/feedback/FeedbackAdapter.d.ts.map +1 -0
- package/dist/runtimes/{feedback → adapters/feedback}/FeedbackAdapter.js +1 -1
- package/dist/runtimes/adapters/feedback/FeedbackAdapter.js.map +1 -0
- package/dist/runtimes/adapters/feedback/index.d.ts.map +1 -0
- package/dist/runtimes/{feedback → adapters/feedback}/index.js +1 -1
- package/dist/runtimes/adapters/feedback/index.js.map +1 -0
- package/dist/runtimes/adapters/index.d.ts +4 -0
- package/dist/runtimes/adapters/index.d.ts.map +1 -0
- package/dist/runtimes/adapters/index.js +29 -0
- package/dist/runtimes/adapters/index.js.map +1 -0
- package/dist/runtimes/adapters/index.mjs +5 -0
- package/dist/runtimes/adapters/index.mjs.map +1 -0
- package/dist/runtimes/{speech → adapters/speech}/SpeechAdapterTypes.d.ts +1 -1
- package/dist/runtimes/adapters/speech/SpeechAdapterTypes.d.ts.map +1 -0
- package/dist/runtimes/{speech → adapters/speech}/SpeechAdapterTypes.js +1 -1
- package/dist/runtimes/adapters/speech/SpeechAdapterTypes.js.map +1 -0
- package/dist/runtimes/adapters/speech/WebSpeechSynthesisAdapter.d.ts.map +1 -0
- package/dist/runtimes/{speech → adapters/speech}/WebSpeechSynthesisAdapter.js +1 -1
- package/dist/runtimes/adapters/speech/WebSpeechSynthesisAdapter.js.map +1 -0
- package/dist/runtimes/{speech → adapters/speech}/WebSpeechSynthesisAdapter.mjs +1 -1
- package/dist/runtimes/adapters/speech/WebSpeechSynthesisAdapter.mjs.map +1 -0
- package/dist/runtimes/adapters/speech/index.d.ts.map +1 -0
- package/dist/runtimes/{speech → adapters/speech}/index.js +1 -1
- package/dist/runtimes/adapters/speech/index.js.map +1 -0
- package/dist/runtimes/{speech → adapters/speech}/index.mjs +1 -1
- package/dist/runtimes/adapters/speech/index.mjs.map +1 -0
- package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.d.ts +6 -0
- package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.d.ts.map +1 -0
- package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.js +19 -0
- package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.js.map +1 -0
- package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.mjs +1 -0
- package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.mjs.map +1 -0
- package/dist/runtimes/composer/BaseComposerRuntimeCore.d.ts +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.d.ts +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.d.ts +1 -1
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/core/AssistantRuntimeCore.d.ts +1 -1
- package/dist/runtimes/core/AssistantRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/AssistantRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.d.ts +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts +3 -3
- package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/core/ThreadListRuntimeCore.d.ts +5 -0
- package/dist/runtimes/core/ThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/ThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/ThreadRuntimeCore.d.ts +2 -2
- package/dist/runtimes/core/ThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/ThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts +3 -3
- package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +4 -4
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs +4 -4
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts +2 -0
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js +6 -0
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs +6 -0
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +7 -0
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs +7 -0
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/index.d.ts +1 -3
- package/dist/runtimes/index.d.ts.map +1 -1
- package/dist/runtimes/index.js +3 -7
- package/dist/runtimes/index.js.map +1 -1
- package/dist/runtimes/index.mjs +1 -3
- package/dist/runtimes/index.mjs.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.d.ts +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.js +5 -5
- package/dist/runtimes/local/LocalRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.mjs +5 -5
- package/dist/runtimes/local/LocalRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.d.ts +6 -3
- package/dist/runtimes/local/LocalRuntimeOptions.d.ts.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.mjs.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts +2 -0
- package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js +8 -0
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs +8 -0
- package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts +1 -0
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js +7 -3
- package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +7 -3
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/local/useLocalRuntime.js +1 -1
- package/dist/runtimes/local/useLocalRuntime.js.map +1 -1
- package/dist/runtimes/local/useLocalRuntime.mjs +1 -1
- package/dist/runtimes/local/useLocalRuntime.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts +32 -2
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +13 -7
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs +13 -7
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAPI.d.ts +3 -2
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAPI.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAPI.js +9 -4
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAPI.js.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAPI.mjs +9 -4
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAPI.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAuthStrategy.d.ts +6 -3
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAuthStrategy.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAuthStrategy.js +13 -1
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAuthStrategy.js.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAuthStrategy.mjs +13 -1
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAuthStrategy.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/index.d.ts +0 -1
- package/dist/runtimes/remote-thread-list/cloud/index.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/index.js +0 -3
- package/dist/runtimes/remote-thread-list/cloud/index.js.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/index.mjs +0 -2
- package/dist/runtimes/remote-thread-list/cloud/index.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.js +26 -49
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.js.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.mjs +27 -56
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/types.d.ts +2 -2
- package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/types.js.map +1 -1
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js +5 -5
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs +5 -5
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs.map +1 -1
- package/dist/runtimes/utils/MessageRepository.d.ts +4 -0
- package/dist/runtimes/utils/MessageRepository.d.ts.map +1 -1
- package/dist/runtimes/utils/MessageRepository.js.map +1 -1
- package/dist/runtimes/utils/MessageRepository.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/AssistantRuntime.ts +19 -18
- package/src/api/RuntimePathTypes.ts +6 -1
- package/src/api/ThreadListItemRuntime.ts +9 -0
- package/src/api/ThreadListRuntime.ts +56 -1
- package/src/runtimes/adapters/RuntimeAdapterProvider.tsx +31 -0
- package/src/runtimes/{attachment → adapters/attachment}/AttachmentAdapter.ts +1 -1
- package/src/runtimes/{attachment → adapters/attachment}/CompositeAttachmentAdapter.ts +1 -1
- package/src/runtimes/{attachment → adapters/attachment}/SimpleImageAttachmentAdapter.ts +1 -1
- package/src/runtimes/{attachment → adapters/attachment}/SimpleTextAttachmentAdapter.ts +1 -1
- package/src/runtimes/{feedback → adapters/feedback}/FeedbackAdapter.ts +1 -1
- package/src/runtimes/adapters/index.ts +3 -0
- package/src/runtimes/{speech → adapters/speech}/SpeechAdapterTypes.ts +1 -1
- package/src/runtimes/adapters/thread-history/ThreadHistoryAdapter.ts +9 -0
- package/src/runtimes/composer/BaseComposerRuntimeCore.tsx +1 -1
- package/src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx +1 -1
- package/src/runtimes/composer/DefaultThreadComposerRuntimeCore.tsx +1 -1
- package/src/runtimes/core/AssistantRuntimeCore.tsx +1 -1
- package/src/runtimes/core/BaseAssistantRuntimeCore.tsx +1 -1
- package/src/runtimes/core/BaseThreadRuntimeCore.tsx +3 -3
- package/src/runtimes/core/ThreadListRuntimeCore.tsx +6 -0
- package/src/runtimes/core/ThreadRuntimeCore.tsx +2 -1
- package/src/runtimes/external-store/ExternalStoreAdapter.tsx +3 -3
- package/src/runtimes/external-store/ExternalStoreRuntimeCore.tsx +4 -4
- package/src/runtimes/external-store/ExternalStoreThreadListRuntimeCore.tsx +8 -0
- package/src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx +8 -0
- package/src/runtimes/index.ts +1 -3
- package/src/runtimes/local/LocalRuntimeCore.tsx +5 -5
- package/src/runtimes/local/LocalRuntimeOptions.tsx +5 -3
- package/src/runtimes/local/LocalThreadListRuntimeCore.tsx +10 -0
- package/src/runtimes/local/LocalThreadRuntimeCore.tsx +7 -3
- package/src/runtimes/local/useLocalRuntime.tsx +1 -1
- package/src/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.tsx +16 -14
- package/src/runtimes/remote-thread-list/cloud/AssistantCloudAPI.tsx +13 -5
- package/src/runtimes/remote-thread-list/cloud/AssistantCloudAuthStrategy.tsx +24 -4
- package/src/runtimes/remote-thread-list/cloud/index.ts +0 -1
- package/src/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.tsx +36 -60
- package/src/runtimes/remote-thread-list/types.tsx +2 -5
- package/src/runtimes/remote-thread-list/useRemoteThreadListRuntime.tsx +5 -5
- package/src/runtimes/utils/MessageRepository.tsx +5 -0
- package/dist/runtimes/attachment/AttachmentAdapter.d.ts.map +0 -1
- package/dist/runtimes/attachment/AttachmentAdapter.js.map +0 -1
- package/dist/runtimes/attachment/CompositeAttachmentAdapter.d.ts.map +0 -1
- package/dist/runtimes/attachment/CompositeAttachmentAdapter.js.map +0 -1
- package/dist/runtimes/attachment/CompositeAttachmentAdapter.mjs.map +0 -1
- package/dist/runtimes/attachment/SimpleImageAttachmentAdapter.d.ts.map +0 -1
- package/dist/runtimes/attachment/SimpleImageAttachmentAdapter.js.map +0 -1
- package/dist/runtimes/attachment/SimpleImageAttachmentAdapter.mjs.map +0 -1
- package/dist/runtimes/attachment/SimpleTextAttachmentAdapter.d.ts.map +0 -1
- package/dist/runtimes/attachment/SimpleTextAttachmentAdapter.js.map +0 -1
- package/dist/runtimes/attachment/SimpleTextAttachmentAdapter.mjs.map +0 -1
- package/dist/runtimes/attachment/index.d.ts.map +0 -1
- package/dist/runtimes/attachment/index.js.map +0 -1
- package/dist/runtimes/attachment/index.mjs.map +0 -1
- package/dist/runtimes/feedback/FeedbackAdapter.d.ts.map +0 -1
- package/dist/runtimes/feedback/FeedbackAdapter.js.map +0 -1
- package/dist/runtimes/feedback/index.d.ts.map +0 -1
- package/dist/runtimes/feedback/index.js.map +0 -1
- package/dist/runtimes/remote-thread-list/cloud/CloudThreadListItemRuntime.d.ts +0 -22
- package/dist/runtimes/remote-thread-list/cloud/CloudThreadListItemRuntime.d.ts.map +0 -1
- package/dist/runtimes/remote-thread-list/cloud/CloudThreadListItemRuntime.js +0 -85
- package/dist/runtimes/remote-thread-list/cloud/CloudThreadListItemRuntime.js.map +0 -1
- package/dist/runtimes/remote-thread-list/cloud/CloudThreadListItemRuntime.mjs +0 -60
- package/dist/runtimes/remote-thread-list/cloud/CloudThreadListItemRuntime.mjs.map +0 -1
- package/dist/runtimes/speech/SpeechAdapterTypes.d.ts.map +0 -1
- package/dist/runtimes/speech/SpeechAdapterTypes.js.map +0 -1
- package/dist/runtimes/speech/WebSpeechSynthesisAdapter.d.ts.map +0 -1
- package/dist/runtimes/speech/WebSpeechSynthesisAdapter.js.map +0 -1
- package/dist/runtimes/speech/WebSpeechSynthesisAdapter.mjs.map +0 -1
- package/dist/runtimes/speech/index.d.ts.map +0 -1
- package/dist/runtimes/speech/index.js.map +0 -1
- package/dist/runtimes/speech/index.mjs.map +0 -1
- package/src/runtimes/remote-thread-list/cloud/CloudThreadListItemRuntime.tsx +0 -89
- /package/dist/runtimes/{attachment → adapters/attachment}/AttachmentAdapter.mjs +0 -0
- /package/dist/runtimes/{attachment → adapters/attachment}/AttachmentAdapter.mjs.map +0 -0
- /package/dist/runtimes/{attachment → adapters/attachment}/index.d.ts +0 -0
- /package/dist/runtimes/{feedback → adapters/feedback}/FeedbackAdapter.mjs +0 -0
- /package/dist/runtimes/{feedback → adapters/feedback}/FeedbackAdapter.mjs.map +0 -0
- /package/dist/runtimes/{feedback → adapters/feedback}/index.d.ts +0 -0
- /package/dist/runtimes/{feedback → adapters/feedback}/index.mjs +0 -0
- /package/dist/runtimes/{feedback → adapters/feedback}/index.mjs.map +0 -0
- /package/dist/runtimes/{speech → adapters/speech}/SpeechAdapterTypes.mjs +0 -0
- /package/dist/runtimes/{speech → adapters/speech}/SpeechAdapterTypes.mjs.map +0 -0
- /package/dist/runtimes/{speech → adapters/speech}/WebSpeechSynthesisAdapter.d.ts +0 -0
- /package/dist/runtimes/{speech → adapters/speech}/index.d.ts +0 -0
- /package/src/runtimes/{attachment → adapters/attachment}/index.ts +0 -0
- /package/src/runtimes/{feedback → adapters/feedback}/index.ts +0 -0
- /package/src/runtimes/{speech → adapters/speech}/WebSpeechSynthesisAdapter.ts +0 -0
- /package/src/runtimes/{speech → adapters/speech}/index.ts +0 -0
@@ -1,5 +1,4 @@
|
|
1
1
|
import { AssistantRuntimeCore } from "../runtimes/core/AssistantRuntimeCore";
|
2
|
-
import { NestedSubscriptionSubject } from "./subscribable/NestedSubscriptionSubject";
|
3
2
|
import { ModelConfigProvider } from "../types/ModelConfigTypes";
|
4
3
|
import {
|
5
4
|
ThreadListItemRuntimeBinding,
|
@@ -12,17 +11,24 @@ import { ThreadListRuntime, ThreadListRuntimeImpl } from "./ThreadListRuntime";
|
|
12
11
|
|
13
12
|
export type AssistantRuntime = {
|
14
13
|
/**
|
15
|
-
* The
|
14
|
+
* The threads in this assistant.
|
15
|
+
*/
|
16
|
+
readonly threads: ThreadListRuntime;
|
17
|
+
|
18
|
+
/**
|
19
|
+
* The currently selected main thread. Equivalent to `threads.main`.
|
16
20
|
*/
|
17
21
|
readonly thread: ThreadRuntime;
|
18
22
|
|
19
23
|
/**
|
20
|
-
*
|
24
|
+
* @deprecated This field was renamed to `threads.main`.
|
21
25
|
*/
|
22
26
|
readonly threadList: ThreadListRuntime;
|
23
27
|
|
24
28
|
/**
|
25
29
|
* Switch to a new thread.
|
30
|
+
*
|
31
|
+
* @deprecated This field was moved to `threads.switchToNewThread`.
|
26
32
|
*/
|
27
33
|
switchToNewThread(): void;
|
28
34
|
|
@@ -30,6 +36,7 @@ export type AssistantRuntime = {
|
|
30
36
|
* Switch to a thread.
|
31
37
|
*
|
32
38
|
* @param threadId The thread ID to switch to.
|
39
|
+
* @deprecated This field was moved to `threads.switchToThread`.
|
33
40
|
*/
|
34
41
|
switchToThread(threadId: string): void;
|
35
42
|
|
@@ -42,7 +49,11 @@ export type AssistantRuntime = {
|
|
42
49
|
};
|
43
50
|
|
44
51
|
export class AssistantRuntimeImpl implements AssistantRuntime {
|
45
|
-
public readonly
|
52
|
+
public readonly threads;
|
53
|
+
public get threadList() {
|
54
|
+
return this.threads;
|
55
|
+
}
|
56
|
+
|
46
57
|
public readonly _thread: ThreadRuntime;
|
47
58
|
|
48
59
|
protected constructor(
|
@@ -52,18 +63,8 @@ export class AssistantRuntimeImpl implements AssistantRuntime {
|
|
52
63
|
threadListItemBinding: ThreadListItemRuntimeBinding,
|
53
64
|
) => ThreadRuntime = ThreadRuntimeImpl,
|
54
65
|
) {
|
55
|
-
this.
|
56
|
-
this._thread =
|
57
|
-
new NestedSubscriptionSubject({
|
58
|
-
path: {
|
59
|
-
ref: "threads.main",
|
60
|
-
threadSelector: { type: "main" },
|
61
|
-
},
|
62
|
-
getState: () => _core.threadList.getMainThreadRuntimeCore(),
|
63
|
-
subscribe: (callback) => _core.threadList.subscribe(callback),
|
64
|
-
}),
|
65
|
-
this.threadList.mainItem, // TODO capture "main" threadListItem from context around useLocalRuntime / useExternalStoreRuntime
|
66
|
-
);
|
66
|
+
this.threads = new ThreadListRuntimeImpl(_core.threads, runtimeFactory);
|
67
|
+
this._thread = this.threadList.main;
|
67
68
|
}
|
68
69
|
|
69
70
|
public get thread() {
|
@@ -71,11 +72,11 @@ export class AssistantRuntimeImpl implements AssistantRuntime {
|
|
71
72
|
}
|
72
73
|
|
73
74
|
public switchToNewThread() {
|
74
|
-
return this._core.
|
75
|
+
return this._core.threads.switchToNewThread();
|
75
76
|
}
|
76
77
|
|
77
78
|
public switchToThread(threadId: string) {
|
78
|
-
return this._core.
|
79
|
+
return this._core.threads.switchToThread(threadId);
|
79
80
|
}
|
80
81
|
|
81
82
|
public registerModelConfigProvider(provider: ModelConfigProvider) {
|
@@ -9,7 +9,12 @@ export type ThreadListItemRuntimePath = {
|
|
9
9
|
|
10
10
|
export type ThreadRuntimePath = {
|
11
11
|
readonly ref: string;
|
12
|
-
readonly threadSelector:
|
12
|
+
readonly threadSelector:
|
13
|
+
| { readonly type: "main" }
|
14
|
+
| {
|
15
|
+
readonly type: "threadId";
|
16
|
+
readonly threadId: string;
|
17
|
+
};
|
13
18
|
};
|
14
19
|
|
15
20
|
export type MessageRuntimePath = ThreadRuntimePath & {
|
@@ -25,6 +25,7 @@ export type ThreadListItemRuntime = {
|
|
25
25
|
readonly path: ThreadListItemRuntimePath;
|
26
26
|
getState(): ThreadListItemState;
|
27
27
|
|
28
|
+
initialize(): Promise<{ remoteId: string; externalId: string | undefined }>;
|
28
29
|
switchTo(): Promise<void>;
|
29
30
|
rename(newTitle: string): Promise<void>;
|
30
31
|
archive(): Promise<void>;
|
@@ -87,6 +88,14 @@ export class ThreadListItemRuntimeImpl implements ThreadListItemRuntime {
|
|
87
88
|
return this._threadListBinding.delete(state.id);
|
88
89
|
}
|
89
90
|
|
91
|
+
public initialize(): Promise<{
|
92
|
+
remoteId: string;
|
93
|
+
externalId: string | undefined;
|
94
|
+
}> {
|
95
|
+
const state = this._core.getState();
|
96
|
+
return this._threadListBinding.initialize(state.id);
|
97
|
+
}
|
98
|
+
|
90
99
|
public unstable_on(event: ThreadListItemEventType, callback: () => void) {
|
91
100
|
let prevIsMain = this._core.getState().isMain;
|
92
101
|
return this.subscribe(() => {
|
@@ -8,6 +8,13 @@ import {
|
|
8
8
|
} from "./ThreadListItemRuntime";
|
9
9
|
import { SKIP_UPDATE } from "./subscribable/SKIP_UPDATE";
|
10
10
|
import { ShallowMemoizeSubject } from "./subscribable/ShallowMemoizeSubject";
|
11
|
+
import {
|
12
|
+
ThreadListItemRuntimeBinding,
|
13
|
+
ThreadRuntime,
|
14
|
+
ThreadRuntimeCoreBinding,
|
15
|
+
ThreadRuntimeImpl,
|
16
|
+
} from "./ThreadRuntime";
|
17
|
+
import { NestedSubscriptionSubject } from "./subscribable/NestedSubscriptionSubject";
|
11
18
|
|
12
19
|
export type ThreadListState = {
|
13
20
|
readonly mainThreadId: string;
|
@@ -21,10 +28,16 @@ export type ThreadListRuntime = {
|
|
21
28
|
|
22
29
|
subscribe(callback: () => void): Unsubscribe;
|
23
30
|
|
31
|
+
readonly main: ThreadRuntime;
|
32
|
+
getById(threadId: string): ThreadRuntime;
|
33
|
+
|
24
34
|
readonly mainItem: ThreadListItemRuntime;
|
25
35
|
getItemById(threadId: string): ThreadListItemRuntime;
|
26
36
|
getItemByIndex(idx: number): ThreadListItemRuntime;
|
27
37
|
getArchivedItemByIndex(idx: number): ThreadListItemRuntime;
|
38
|
+
|
39
|
+
switchToThread(threadId: string): Promise<void>;
|
40
|
+
switchToNewThread(): Promise<void>;
|
28
41
|
};
|
29
42
|
|
30
43
|
const getThreadListState = (
|
@@ -61,7 +74,13 @@ export type ThreadListRuntimeCoreBinding = ThreadListRuntimeCore;
|
|
61
74
|
|
62
75
|
export class ThreadListRuntimeImpl implements ThreadListRuntime {
|
63
76
|
private _getState;
|
64
|
-
constructor(
|
77
|
+
constructor(
|
78
|
+
private _core: ThreadListRuntimeCoreBinding,
|
79
|
+
private _runtimeFactory: new (
|
80
|
+
binding: ThreadRuntimeCoreBinding,
|
81
|
+
threadListItemBinding: ThreadListItemRuntimeBinding,
|
82
|
+
) => ThreadRuntime = ThreadRuntimeImpl,
|
83
|
+
) {
|
65
84
|
const stateBinding = new LazyMemoizeSubject({
|
66
85
|
path: {},
|
67
86
|
getState: () => getThreadListState(_core),
|
@@ -83,6 +102,26 @@ export class ThreadListRuntimeImpl implements ThreadListRuntime {
|
|
83
102
|
}),
|
84
103
|
this._core,
|
85
104
|
);
|
105
|
+
|
106
|
+
this.main = new _runtimeFactory(
|
107
|
+
new NestedSubscriptionSubject({
|
108
|
+
path: {
|
109
|
+
ref: "threads.main",
|
110
|
+
threadSelector: { type: "main" },
|
111
|
+
},
|
112
|
+
getState: () => _core.getMainThreadRuntimeCore(),
|
113
|
+
subscribe: (callback) => _core.subscribe(callback),
|
114
|
+
}),
|
115
|
+
this._mainThreadListItemRuntime, // TODO capture "main" threadListItem from context around useLocalRuntime / useExternalStoreRuntime
|
116
|
+
);
|
117
|
+
}
|
118
|
+
|
119
|
+
public switchToThread(threadId: string): Promise<void> {
|
120
|
+
return this._core.switchToThread(threadId);
|
121
|
+
}
|
122
|
+
|
123
|
+
public switchToNewThread(): Promise<void> {
|
124
|
+
return this._core.switchToNewThread();
|
86
125
|
}
|
87
126
|
|
88
127
|
public getState(): ThreadListState {
|
@@ -95,10 +134,26 @@ export class ThreadListRuntimeImpl implements ThreadListRuntime {
|
|
95
134
|
|
96
135
|
private _mainThreadListItemRuntime;
|
97
136
|
|
137
|
+
public readonly main: ThreadRuntime;
|
138
|
+
|
98
139
|
public get mainItem() {
|
99
140
|
return this._mainThreadListItemRuntime;
|
100
141
|
}
|
101
142
|
|
143
|
+
public getById(threadId: string) {
|
144
|
+
return new this._runtimeFactory(
|
145
|
+
new NestedSubscriptionSubject({
|
146
|
+
path: {
|
147
|
+
ref: "threads[threadId=" + JSON.stringify(threadId) + "]",
|
148
|
+
threadSelector: { type: "threadId", threadId },
|
149
|
+
},
|
150
|
+
getState: () => this._core.getThreadRuntimeCore(threadId),
|
151
|
+
subscribe: (callback) => this._core.subscribe(callback),
|
152
|
+
}),
|
153
|
+
this.mainItem, // TODO capture "main" threadListItem from context around useLocalRuntime / useExternalStoreRuntime
|
154
|
+
);
|
155
|
+
}
|
156
|
+
|
102
157
|
public getItemByIndex(idx: number) {
|
103
158
|
return new ThreadListItemRuntimeImpl(
|
104
159
|
new ShallowMemoizeSubject({
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { createContext, FC, useContext } from "react";
|
2
|
+
import { ThreadHistoryAdapter } from "./thread-history/ThreadHistoryAdapter";
|
3
|
+
|
4
|
+
export type RuntimeAdapters = {
|
5
|
+
history: ThreadHistoryAdapter;
|
6
|
+
};
|
7
|
+
|
8
|
+
const RuntimeAdaptersContext = createContext<RuntimeAdapters | null>(null);
|
9
|
+
|
10
|
+
namespace RuntimeAdapterProvider {
|
11
|
+
export type Props = {
|
12
|
+
adapters: RuntimeAdapters;
|
13
|
+
children: React.ReactNode;
|
14
|
+
};
|
15
|
+
}
|
16
|
+
|
17
|
+
export const RuntimeAdapterProvider: FC<RuntimeAdapterProvider.Props> = ({
|
18
|
+
adapters,
|
19
|
+
children,
|
20
|
+
}) => {
|
21
|
+
return (
|
22
|
+
<RuntimeAdaptersContext.Provider value={adapters}>
|
23
|
+
{children}
|
24
|
+
</RuntimeAdaptersContext.Provider>
|
25
|
+
);
|
26
|
+
};
|
27
|
+
|
28
|
+
export const useRuntimeAdapters = () => {
|
29
|
+
const adapters = useContext(RuntimeAdaptersContext);
|
30
|
+
return adapters;
|
31
|
+
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import {
|
2
2
|
PendingAttachment,
|
3
3
|
CompleteAttachment,
|
4
|
-
} from "
|
4
|
+
} from "../../../types/AttachmentTypes";
|
5
5
|
import { AttachmentAdapter } from "./AttachmentAdapter";
|
6
6
|
|
7
7
|
export class SimpleImageAttachmentAdapter implements AttachmentAdapter {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import {
|
2
2
|
CompleteAttachment,
|
3
3
|
PendingAttachment,
|
4
|
-
} from "
|
4
|
+
} from "../../../types/AttachmentTypes";
|
5
5
|
import { AttachmentAdapter } from "./AttachmentAdapter";
|
6
6
|
|
7
7
|
export class SimpleTextAttachmentAdapter implements AttachmentAdapter {
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import {
|
2
|
+
ExportedMessageRepository,
|
3
|
+
ExportedMessageRepositoryItem,
|
4
|
+
} from "../../utils/MessageRepository";
|
5
|
+
|
6
|
+
export type ThreadHistoryAdapter = {
|
7
|
+
load(): Promise<ExportedMessageRepository>;
|
8
|
+
append(item: ExportedMessageRepositoryItem): Promise<void>;
|
9
|
+
};
|
@@ -4,7 +4,7 @@ import {
|
|
4
4
|
PendingAttachment,
|
5
5
|
} from "../../types/AttachmentTypes";
|
6
6
|
import { AppendMessage } from "../../types";
|
7
|
-
import { AttachmentAdapter } from "../attachment";
|
7
|
+
import { AttachmentAdapter } from "../adapters/attachment";
|
8
8
|
import {
|
9
9
|
ComposerRuntimeCore,
|
10
10
|
ComposerRuntimeEventType,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { AppendMessage, ThreadMessage } from "../../types";
|
2
2
|
import { getThreadMessageText } from "../../utils/getThreadMessageText";
|
3
|
-
import { AttachmentAdapter } from "../attachment";
|
3
|
+
import { AttachmentAdapter } from "../adapters/attachment";
|
4
4
|
import { ThreadRuntimeCore } from "../core/ThreadRuntimeCore";
|
5
5
|
import { BaseComposerRuntimeCore } from "./BaseComposerRuntimeCore";
|
6
6
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { AppendMessage, PendingAttachment } from "../../types";
|
2
|
-
import { AttachmentAdapter } from "../attachment";
|
2
|
+
import { AttachmentAdapter } from "../adapters/attachment";
|
3
3
|
import { ThreadComposerRuntimeCore } from "../core/ComposerRuntimeCore";
|
4
4
|
import { ThreadRuntimeCore } from "../core/ThreadRuntimeCore";
|
5
5
|
import { BaseComposerRuntimeCore } from "./BaseComposerRuntimeCore";
|
@@ -4,7 +4,7 @@ import type { Unsubscribe } from "../../types/Unsubscribe";
|
|
4
4
|
import { ThreadListRuntimeCore } from "./ThreadListRuntimeCore";
|
5
5
|
|
6
6
|
export type AssistantRuntimeCore = {
|
7
|
-
readonly
|
7
|
+
readonly threads: ThreadListRuntimeCore;
|
8
8
|
|
9
9
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
10
10
|
|
@@ -6,7 +6,7 @@ import { ThreadListRuntimeCore } from "./ThreadListRuntimeCore";
|
|
6
6
|
|
7
7
|
export abstract class BaseAssistantRuntimeCore implements AssistantRuntimeCore {
|
8
8
|
protected readonly _proxyConfigProvider = new ProxyConfigProvider();
|
9
|
-
public abstract get
|
9
|
+
public abstract get threads(): ThreadListRuntimeCore;
|
10
10
|
|
11
11
|
constructor() {}
|
12
12
|
|
@@ -20,9 +20,9 @@ import {
|
|
20
20
|
StartRunConfig,
|
21
21
|
} from "../core/ThreadRuntimeCore";
|
22
22
|
import { DefaultEditComposerRuntimeCore } from "../composer/DefaultEditComposerRuntimeCore";
|
23
|
-
import { SpeechSynthesisAdapter } from "../speech/SpeechAdapterTypes";
|
24
|
-
import { FeedbackAdapter } from "../feedback/FeedbackAdapter";
|
25
|
-
import { AttachmentAdapter } from "../attachment";
|
23
|
+
import { SpeechSynthesisAdapter } from "../adapters/speech/SpeechAdapterTypes";
|
24
|
+
import { FeedbackAdapter } from "../adapters/feedback/FeedbackAdapter";
|
25
|
+
import { AttachmentAdapter } from "../adapters/attachment";
|
26
26
|
import { getThreadMessageText } from "../../utils/getThreadMessageText";
|
27
27
|
|
28
28
|
type BaseThreadAdapters = {
|
@@ -20,6 +20,8 @@ export type ThreadListRuntimeCore = {
|
|
20
20
|
archivedThreadIds: readonly string[];
|
21
21
|
|
22
22
|
getMainThreadRuntimeCore(): ThreadRuntimeCore;
|
23
|
+
getThreadRuntimeCore(threadId: string): ThreadRuntimeCore;
|
24
|
+
|
23
25
|
getItemById(threadId: string): ThreadListItemCoreState | undefined;
|
24
26
|
|
25
27
|
switchToThread(threadId: string): Promise<void>;
|
@@ -33,5 +35,9 @@ export type ThreadListRuntimeCore = {
|
|
33
35
|
unarchive(threadId: string): Promise<void>;
|
34
36
|
delete(threadId: string): Promise<void>;
|
35
37
|
|
38
|
+
initialize(
|
39
|
+
threadId: string,
|
40
|
+
): Promise<{ remoteId: string; externalId: string | undefined }>;
|
41
|
+
|
36
42
|
subscribe(callback: () => void): Unsubscribe;
|
37
43
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { AppendMessage, ModelConfig, ThreadMessage } from "../../types";
|
2
2
|
import { RunConfig } from "../../types/AssistantTypes";
|
3
3
|
import type { Unsubscribe } from "../../types/Unsubscribe";
|
4
|
-
import { SpeechSynthesisAdapter } from "../speech/SpeechAdapterTypes";
|
4
|
+
import { SpeechSynthesisAdapter } from "../adapters/speech/SpeechAdapterTypes";
|
5
5
|
import { ExportedMessageRepository } from "../utils/MessageRepository";
|
6
6
|
import {
|
7
7
|
ComposerRuntimeCore,
|
@@ -46,6 +46,7 @@ export type SubmittedFeedback = {
|
|
46
46
|
|
47
47
|
export type ThreadRuntimeEventType =
|
48
48
|
| "run-start"
|
49
|
+
| "run-end"
|
49
50
|
| "initialize"
|
50
51
|
| "model-config-update";
|
51
52
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { AppendMessage, ThreadMessage } from "../../types";
|
2
|
-
import { AttachmentAdapter } from "../attachment";
|
2
|
+
import { AttachmentAdapter } from "../adapters/attachment";
|
3
3
|
import {
|
4
4
|
AddToolResultOptions,
|
5
5
|
StartRunConfig,
|
6
6
|
ThreadSuggestion,
|
7
7
|
} from "../core/ThreadRuntimeCore";
|
8
|
-
import { FeedbackAdapter } from "../feedback/FeedbackAdapter";
|
9
|
-
import { SpeechSynthesisAdapter } from "../speech/SpeechAdapterTypes";
|
8
|
+
import { FeedbackAdapter } from "../adapters/feedback/FeedbackAdapter";
|
9
|
+
import { SpeechSynthesisAdapter } from "../adapters/speech/SpeechAdapterTypes";
|
10
10
|
import { ThreadMessageLike } from "./ThreadMessageLike";
|
11
11
|
|
12
12
|
export type ExternalStoreThreadData<TState extends "regular" | "archived"> = {
|
@@ -10,11 +10,11 @@ const getThreadListAdapter = (store: ExternalStoreAdapter<any>) => {
|
|
10
10
|
};
|
11
11
|
|
12
12
|
export class ExternalStoreRuntimeCore extends BaseAssistantRuntimeCore {
|
13
|
-
public readonly
|
13
|
+
public readonly threads;
|
14
14
|
|
15
15
|
constructor(adapter: ExternalStoreAdapter<any>) {
|
16
16
|
super();
|
17
|
-
this.
|
17
|
+
this.threads = new ExternalStoreThreadListRuntimeCore(
|
18
18
|
getThreadListAdapter(adapter),
|
19
19
|
() =>
|
20
20
|
new ExternalStoreThreadRuntimeCore(this._proxyConfigProvider, adapter),
|
@@ -23,7 +23,7 @@ export class ExternalStoreRuntimeCore extends BaseAssistantRuntimeCore {
|
|
23
23
|
|
24
24
|
public setAdapter(adapter: ExternalStoreAdapter<any>) {
|
25
25
|
// Update the thread list adapter and propagate store changes to the main thread
|
26
|
-
this.
|
27
|
-
this.
|
26
|
+
this.threads.__internal_setAdapter(getThreadListAdapter(adapter));
|
27
|
+
this.threads.getMainThreadRuntimeCore().__internal_setAdapter(adapter);
|
28
28
|
}
|
29
29
|
}
|
@@ -57,6 +57,10 @@ export class ExternalStoreThreadListRuntimeCore
|
|
57
57
|
return this._mainThread;
|
58
58
|
}
|
59
59
|
|
60
|
+
public getThreadRuntimeCore(): never {
|
61
|
+
throw new Error("Method not implemented.");
|
62
|
+
}
|
63
|
+
|
60
64
|
public getItemById(threadId: string) {
|
61
65
|
for (const thread of this.adapter.threads ?? []) {
|
62
66
|
if (thread.threadId === threadId) return thread;
|
@@ -159,6 +163,10 @@ export class ExternalStoreThreadListRuntimeCore
|
|
159
163
|
onDelete(threadId);
|
160
164
|
}
|
161
165
|
|
166
|
+
public initialize(): never {
|
167
|
+
throw new Error("Method not implemented.");
|
168
|
+
}
|
169
|
+
|
162
170
|
private _subscriptions = new Set<() => void>();
|
163
171
|
|
164
172
|
public subscribe(callback: () => void): Unsubscribe {
|
@@ -146,6 +146,14 @@ export class ExternalStoreThreadRuntimeCore
|
|
146
146
|
|
147
147
|
if (messages.length > 0) this.ensureInitialized();
|
148
148
|
|
149
|
+
if (oldStore?.isRunning ?? false !== store.isRunning ?? false) {
|
150
|
+
if (store.isRunning) {
|
151
|
+
this._notifyEventSubscribers("run-start");
|
152
|
+
} else {
|
153
|
+
this._notifyEventSubscribers("run-end");
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
149
157
|
for (let i = 0; i < messages.length; i++) {
|
150
158
|
const message = messages[i]!;
|
151
159
|
const parent = messages[i - 1];
|
package/src/runtimes/index.ts
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
export * from "./
|
1
|
+
export * from "./adapters";
|
2
2
|
export * from "./core";
|
3
3
|
export * from "./dangerous-in-browser";
|
4
4
|
export * from "./edge";
|
5
5
|
export * from "./external-store";
|
6
|
-
export * from "./feedback";
|
7
6
|
export * from "./local";
|
8
7
|
export * from "./remote-thread-list";
|
9
|
-
export * from "./speech";
|
@@ -25,7 +25,7 @@ const getExportFromInitialMessages = (
|
|
25
25
|
};
|
26
26
|
|
27
27
|
export class LocalRuntimeCore extends BaseAssistantRuntimeCore {
|
28
|
-
public readonly
|
28
|
+
public readonly threads;
|
29
29
|
public readonly Provider = undefined;
|
30
30
|
|
31
31
|
private _options: LocalRuntimeOptionsBase;
|
@@ -38,7 +38,7 @@ export class LocalRuntimeCore extends BaseAssistantRuntimeCore {
|
|
38
38
|
|
39
39
|
this._options = options;
|
40
40
|
|
41
|
-
this.
|
41
|
+
this.threads = new LocalThreadListRuntimeCore(() => {
|
42
42
|
return new LocalThreadRuntimeCore(
|
43
43
|
this._proxyConfigProvider,
|
44
44
|
this._options,
|
@@ -46,7 +46,7 @@ export class LocalRuntimeCore extends BaseAssistantRuntimeCore {
|
|
46
46
|
});
|
47
47
|
|
48
48
|
if (initialMessages) {
|
49
|
-
this.
|
49
|
+
this.threads
|
50
50
|
.getMainThreadRuntimeCore()
|
51
51
|
.import(getExportFromInitialMessages(initialMessages));
|
52
52
|
}
|
@@ -57,10 +57,10 @@ export class LocalRuntimeCore extends BaseAssistantRuntimeCore {
|
|
57
57
|
}: {
|
58
58
|
initialMessages?: readonly CoreMessage[] | undefined;
|
59
59
|
} = {}) {
|
60
|
-
this.
|
60
|
+
this.threads.switchToNewThread();
|
61
61
|
if (!initialMessages) return;
|
62
62
|
|
63
|
-
this.
|
63
|
+
this.threads
|
64
64
|
.getMainThreadRuntimeCore()
|
65
65
|
.import(getExportFromInitialMessages(initialMessages));
|
66
66
|
}
|
@@ -1,13 +1,15 @@
|
|
1
|
-
import {
|
1
|
+
import { ThreadHistoryAdapter } from "../adapters/thread-history/ThreadHistoryAdapter";
|
2
|
+
import { AttachmentAdapter } from "../adapters/attachment/AttachmentAdapter";
|
2
3
|
import { ThreadMessageLike } from "../external-store";
|
3
|
-
import { FeedbackAdapter } from "../feedback/FeedbackAdapter";
|
4
|
-
import { SpeechSynthesisAdapter } from "../speech/SpeechAdapterTypes";
|
4
|
+
import { FeedbackAdapter } from "../adapters/feedback/FeedbackAdapter";
|
5
|
+
import { SpeechSynthesisAdapter } from "../adapters/speech/SpeechAdapterTypes";
|
5
6
|
import { ChatModelAdapter } from "./ChatModelAdapter";
|
6
7
|
|
7
8
|
export type LocalRuntimeOptionsBase = {
|
8
9
|
maxSteps?: number | undefined;
|
9
10
|
adapters: {
|
10
11
|
chatModel: ChatModelAdapter;
|
12
|
+
history?: ThreadHistoryAdapter | undefined;
|
11
13
|
attachments?: AttachmentAdapter | undefined;
|
12
14
|
speech?: SpeechSynthesisAdapter | undefined;
|
13
15
|
feedback?: FeedbackAdapter | undefined;
|
@@ -52,6 +52,12 @@ export class LocalThreadListRuntimeCore implements ThreadListRuntimeCore {
|
|
52
52
|
return result;
|
53
53
|
}
|
54
54
|
|
55
|
+
public getThreadRuntimeCore(threadId: string) {
|
56
|
+
const result = this._threadData.get(threadId)?.runtime;
|
57
|
+
if (!result) throw new Error("Thread not found.");
|
58
|
+
return result;
|
59
|
+
}
|
60
|
+
|
55
61
|
public getLoadThreadsPromise(): Promise<void> {
|
56
62
|
return RESOLVED_PROMISE;
|
57
63
|
}
|
@@ -212,6 +218,10 @@ export class LocalThreadListRuntimeCore implements ThreadListRuntimeCore {
|
|
212
218
|
return Promise.resolve();
|
213
219
|
}
|
214
220
|
|
221
|
+
public initialize(): never {
|
222
|
+
throw new Error("Method not implemented.");
|
223
|
+
}
|
224
|
+
|
215
225
|
private _subscriptions = new Set<() => void>();
|
216
226
|
|
217
227
|
public subscribe(callback: () => void): Unsubscribe {
|
@@ -127,9 +127,13 @@ export class LocalThreadRuntimeCore
|
|
127
127
|
|
128
128
|
this._notifyEventSubscribers("run-start");
|
129
129
|
|
130
|
-
|
131
|
-
|
132
|
-
|
130
|
+
try {
|
131
|
+
do {
|
132
|
+
message = await this.performRoundtrip(parentId, message, runConfig);
|
133
|
+
} while (shouldContinue(message));
|
134
|
+
} finally {
|
135
|
+
this._notifyEventSubscribers("run-end");
|
136
|
+
}
|
133
137
|
}
|
134
138
|
|
135
139
|
private async performRoundtrip(
|
@@ -43,7 +43,7 @@ export const useLocalRuntime = (
|
|
43
43
|
const [runtime] = useState(() => new LocalRuntimeCore(opt, initialMessages));
|
44
44
|
|
45
45
|
useEffect(() => {
|
46
|
-
runtime.
|
46
|
+
runtime.threads.getMainThreadRuntimeCore().__internal_setOptions(opt);
|
47
47
|
}, [runtime, opt]);
|
48
48
|
|
49
49
|
return useMemo(() => LocalRuntimeImpl.create(runtime), [runtime]);
|