@assistant-ui/react 0.7.43 → 0.7.44
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.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 +11 -5
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs +11 -5
- 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 +14 -12
- 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
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { ThreadListRuntimeCore } from "../core/ThreadListRuntimeCore";
|
|
4
4
|
import { generateId } from "../../internal";
|
|
5
|
-
import {
|
|
6
|
-
RemoteThreadInitializeResponse,
|
|
7
|
-
RemoteThreadListAdapter,
|
|
8
|
-
} from "./types";
|
|
5
|
+
import { RemoteThreadListAdapter } from "./types";
|
|
9
6
|
import { RemoteThreadListHookInstanceManager } from "./RemoteThreadListHookInstanceManager";
|
|
10
7
|
import { BaseSubscribable } from "./BaseSubscribable";
|
|
11
8
|
import { EMPTY_THREAD_CORE } from "./EMPTY_THREAD_CORE";
|
|
@@ -244,8 +241,7 @@ export class RemoteThreadListThreadListRuntimeCore
|
|
|
244
241
|
|
|
245
242
|
public __internal_bindAdapter() {
|
|
246
243
|
this.getLoadThreadsPromise(); // begin loading on initial bind
|
|
247
|
-
return this._adapter.subscribe({
|
|
248
|
-
onInitialize: this._onInitialize,
|
|
244
|
+
return this._adapter.subscribe?.({
|
|
249
245
|
onGenerateTitle: this._onGenerateTitle,
|
|
250
246
|
});
|
|
251
247
|
}
|
|
@@ -272,6 +268,15 @@ export class RemoteThreadListThreadListRuntimeCore
|
|
|
272
268
|
return result;
|
|
273
269
|
}
|
|
274
270
|
|
|
271
|
+
public getThreadRuntimeCore(threadIdOrRemoteId: string) {
|
|
272
|
+
const data = this.getItemById(threadIdOrRemoteId);
|
|
273
|
+
if (!data) throw new Error("Thread not found");
|
|
274
|
+
|
|
275
|
+
const result = this._hookManager.getThreadRuntimeCore(data.threadId);
|
|
276
|
+
if (!result) throw new Error("Thread not found");
|
|
277
|
+
return result;
|
|
278
|
+
}
|
|
279
|
+
|
|
275
280
|
public getItemById(threadIdOrRemoteId: string) {
|
|
276
281
|
return getThreadData(this._state.value, threadIdOrRemoteId);
|
|
277
282
|
}
|
|
@@ -332,16 +337,13 @@ export class RemoteThreadListThreadListRuntimeCore
|
|
|
332
337
|
return this.switchToThread(threadId);
|
|
333
338
|
}
|
|
334
339
|
|
|
335
|
-
|
|
336
|
-
threadId: string,
|
|
337
|
-
begin: () => Promise<RemoteThreadInitializeResponse>,
|
|
338
|
-
) => {
|
|
340
|
+
public initialize = async (threadId: string) => {
|
|
339
341
|
if (this._state.value.newThreadId !== threadId)
|
|
340
342
|
throw new Error("The provided thread is already initialized");
|
|
341
343
|
|
|
342
|
-
|
|
344
|
+
return this._state.optimisticUpdate({
|
|
343
345
|
execute: () => {
|
|
344
|
-
return
|
|
346
|
+
return this._adapter.initialize(threadId);
|
|
345
347
|
},
|
|
346
348
|
optimistic: (state) => {
|
|
347
349
|
return updateStatusReducer(state, threadId, "regular");
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
export type AssistantCloudConfig =
|
|
8
8
|
| {
|
|
9
9
|
baseUrl: string;
|
|
10
|
-
authToken()
|
|
10
|
+
authToken: (() => Promise<string | null>) | undefined;
|
|
11
11
|
}
|
|
12
12
|
| {
|
|
13
13
|
apiKey: string;
|
|
@@ -30,16 +30,16 @@ type MakeRequestOptions = {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export class AssistantCloudAPI {
|
|
33
|
-
private
|
|
33
|
+
private _auth: AssistantCloudAuthStrategy;
|
|
34
34
|
private _baseUrl;
|
|
35
35
|
|
|
36
36
|
constructor(config: AssistantCloudConfig) {
|
|
37
37
|
if ("authToken" in config) {
|
|
38
38
|
this._baseUrl = config.baseUrl;
|
|
39
|
-
this.
|
|
39
|
+
this._auth = new AssistantCloudJWTAuthStrategy(config.authToken);
|
|
40
40
|
} else {
|
|
41
41
|
this._baseUrl = "https://backend.assistant-api.com";
|
|
42
|
-
this.
|
|
42
|
+
this._auth = new AssistantCloudAPIKeyAuthStrategy(
|
|
43
43
|
config.apiKey,
|
|
44
44
|
config.userId,
|
|
45
45
|
config.workspaceId,
|
|
@@ -47,11 +47,17 @@ export class AssistantCloudAPI {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
public async initializeAuth() {
|
|
51
|
+
return !!this._auth.getAuthHeaders();
|
|
52
|
+
}
|
|
53
|
+
|
|
50
54
|
public async makeRawRequest(
|
|
51
55
|
endpoint: string,
|
|
52
56
|
options: MakeRequestOptions = {},
|
|
53
57
|
) {
|
|
54
|
-
const authHeaders = await this.
|
|
58
|
+
const authHeaders = await this._auth.getAuthHeaders();
|
|
59
|
+
if (!authHeaders) throw new Error("Authronization failed");
|
|
60
|
+
|
|
55
61
|
const headers = {
|
|
56
62
|
...authHeaders,
|
|
57
63
|
...options.headers,
|
|
@@ -79,6 +85,8 @@ export class AssistantCloudAPI {
|
|
|
79
85
|
body: options.body ? JSON.stringify(options.body) : null,
|
|
80
86
|
});
|
|
81
87
|
|
|
88
|
+
this._auth.readAuthHeaders(response.headers);
|
|
89
|
+
|
|
82
90
|
if (!response.ok) {
|
|
83
91
|
const text = await response.text();
|
|
84
92
|
try {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type AssistantCloudAuthStrategy = {
|
|
2
2
|
readonly strategy: "jwt" | "api-key";
|
|
3
|
-
getAuthHeaders(): Promise<Record<string, string
|
|
3
|
+
getAuthHeaders(): Promise<Record<string, string> | false>;
|
|
4
|
+
readAuthHeaders(headers: Headers): void;
|
|
4
5
|
};
|
|
5
6
|
|
|
6
7
|
export class AssistantCloudJWTAuthStrategy
|
|
@@ -13,7 +14,7 @@ export class AssistantCloudJWTAuthStrategy
|
|
|
13
14
|
|
|
14
15
|
#authTokenCallback;
|
|
15
16
|
|
|
16
|
-
constructor(authTokenCallback: () => Promise<string>) {
|
|
17
|
+
constructor(authTokenCallback: (() => Promise<string | null>) | undefined) {
|
|
17
18
|
this.#authTokenCallback = authTokenCallback;
|
|
18
19
|
}
|
|
19
20
|
|
|
@@ -43,7 +44,7 @@ export class AssistantCloudJWTAuthStrategy
|
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
public async getAuthHeaders(): Promise<Record<string, string
|
|
47
|
+
public async getAuthHeaders(): Promise<Record<string, string> | false> {
|
|
47
48
|
const currentTime = Date.now();
|
|
48
49
|
|
|
49
50
|
// Check if the cached token is valid for at least 30 seconds
|
|
@@ -58,7 +59,9 @@ export class AssistantCloudJWTAuthStrategy
|
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
// Fetch a new token
|
|
61
|
-
const newToken = await this.#authTokenCallback();
|
|
62
|
+
const newToken = await this.#authTokenCallback?.();
|
|
63
|
+
if (!newToken) return false;
|
|
64
|
+
|
|
62
65
|
const expiry = this.getJwtExpiry(newToken);
|
|
63
66
|
|
|
64
67
|
this.cachedToken = newToken;
|
|
@@ -68,7 +71,20 @@ export class AssistantCloudJWTAuthStrategy
|
|
|
68
71
|
Authorization: `Bearer ${newToken}`,
|
|
69
72
|
};
|
|
70
73
|
}
|
|
74
|
+
|
|
75
|
+
public readAuthHeaders(headers: Headers) {
|
|
76
|
+
const authHeader = headers.get("Authorization");
|
|
77
|
+
if (!authHeader) return;
|
|
78
|
+
|
|
79
|
+
const [scheme, token] = authHeader.split(" ");
|
|
80
|
+
if (scheme !== "Bearer" || !token)
|
|
81
|
+
throw new Error("Invalid auth header received");
|
|
82
|
+
|
|
83
|
+
this.cachedToken = token;
|
|
84
|
+
this.tokenExpiry = this.getJwtExpiry(token);
|
|
85
|
+
}
|
|
71
86
|
}
|
|
87
|
+
|
|
72
88
|
export class AssistantCloudAPIKeyAuthStrategy
|
|
73
89
|
implements AssistantCloudAuthStrategy
|
|
74
90
|
{
|
|
@@ -91,4 +107,8 @@ export class AssistantCloudAPIKeyAuthStrategy
|
|
|
91
107
|
"Aui-Workspace-Id": this.#workspaceId,
|
|
92
108
|
};
|
|
93
109
|
}
|
|
110
|
+
|
|
111
|
+
public readAuthHeaders() {
|
|
112
|
+
// noop
|
|
113
|
+
}
|
|
94
114
|
}
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
PropsWithChildren,
|
|
5
|
-
useCallback,
|
|
6
|
-
useEffect,
|
|
7
|
-
useMemo,
|
|
8
|
-
useRef,
|
|
9
|
-
useState,
|
|
10
|
-
} from "react";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
11
4
|
import { useRemoteThreadListRuntime } from "../useRemoteThreadListRuntime";
|
|
12
5
|
import { AssistantCloud } from "./AssistantCloud";
|
|
13
6
|
import { AssistantRuntime } from "../../../api";
|
|
14
7
|
import { RemoteThreadListSubscriber } from "../types";
|
|
15
|
-
import { CloudThreadListItemRuntimeProvider } from "./CloudThreadListItemRuntime";
|
|
16
8
|
import { toCoreMessages } from "../../edge";
|
|
17
9
|
|
|
18
10
|
type ThreadData = {
|
|
@@ -45,45 +37,6 @@ export const useCloudThreadListRuntime = (adapter: CloudThreadListAdapter) => {
|
|
|
45
37
|
|
|
46
38
|
const [subscribers] = useState(() => new Set<RemoteThreadListSubscriber>());
|
|
47
39
|
|
|
48
|
-
const cloudThreadListItemRuntimeAdapter = useMemo(() => {
|
|
49
|
-
return {
|
|
50
|
-
initialize: async (threadId: string) => {
|
|
51
|
-
const begin = beginnable(async () => {
|
|
52
|
-
const createTask = adapterRef.current.create?.() ?? Promise.resolve();
|
|
53
|
-
const t = await createTask;
|
|
54
|
-
const external_id = t ? t.externalId : undefined;
|
|
55
|
-
const { thread_id } = await adapterRef.current.cloud.threads.create({
|
|
56
|
-
title: "New Thread",
|
|
57
|
-
last_message_at: new Date(),
|
|
58
|
-
external_id,
|
|
59
|
-
});
|
|
60
|
-
return { externalId: external_id, remoteId: thread_id };
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
for (const subscriber of subscribers) {
|
|
64
|
-
subscriber.onInitialize(threadId, begin);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// note: onInitialize immediately throws if there are any issues
|
|
68
|
-
// therefore begin is safe to call here
|
|
69
|
-
return begin();
|
|
70
|
-
},
|
|
71
|
-
generateTitle: async (remoteId: string) => {
|
|
72
|
-
const messages = runtime.thread.getState().messages;
|
|
73
|
-
const begin = beginnable(() => {
|
|
74
|
-
return adapterRef.current.cloud.runs.stream({
|
|
75
|
-
thread_id: remoteId,
|
|
76
|
-
assistant_id: "system/thread_title",
|
|
77
|
-
messages: toCoreMessages(messages),
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
for (const subscriber of subscribers) {
|
|
81
|
-
subscriber.onGenerateTitle(remoteId, begin);
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
}, [subscribers]);
|
|
86
|
-
|
|
87
40
|
const runtime = useRemoteThreadListRuntime({
|
|
88
41
|
runtimeHook: adapter.runtimeHook,
|
|
89
42
|
list: async () => {
|
|
@@ -97,6 +50,41 @@ export const useCloudThreadListRuntime = (adapter: CloudThreadListAdapter) => {
|
|
|
97
50
|
})),
|
|
98
51
|
};
|
|
99
52
|
},
|
|
53
|
+
|
|
54
|
+
initialize: async (threadId: string) => {
|
|
55
|
+
const createTask = adapterRef.current.create?.() ?? Promise.resolve();
|
|
56
|
+
const t = await createTask;
|
|
57
|
+
const external_id = t ? t.externalId : undefined;
|
|
58
|
+
const { thread_id: remoteId } =
|
|
59
|
+
await adapterRef.current.cloud.threads.create({
|
|
60
|
+
title: "New Thread",
|
|
61
|
+
last_message_at: new Date(),
|
|
62
|
+
external_id,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const dispose = runtime.threads
|
|
66
|
+
.getById(threadId)
|
|
67
|
+
.unstable_on("run-end", () => {
|
|
68
|
+
dispose();
|
|
69
|
+
|
|
70
|
+
const messages = runtime.threads
|
|
71
|
+
.getById(threadId)
|
|
72
|
+
.getState().messages;
|
|
73
|
+
const begin = beginnable(() => {
|
|
74
|
+
return adapterRef.current.cloud.runs.stream({
|
|
75
|
+
thread_id: remoteId,
|
|
76
|
+
assistant_id: "system/thread_title",
|
|
77
|
+
messages: toCoreMessages(messages),
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
for (const subscriber of subscribers) {
|
|
81
|
+
subscriber.onGenerateTitle(remoteId, begin);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
return { externalId: external_id, remoteId: remoteId };
|
|
86
|
+
},
|
|
87
|
+
|
|
100
88
|
rename: async (threadId, newTitle) => {
|
|
101
89
|
return adapter.cloud.threads.update(threadId, { title: newTitle });
|
|
102
90
|
},
|
|
@@ -116,18 +104,6 @@ export const useCloudThreadListRuntime = (adapter: CloudThreadListAdapter) => {
|
|
|
116
104
|
subscribers.delete(callback);
|
|
117
105
|
};
|
|
118
106
|
},
|
|
119
|
-
unstable_Provider: useCallback(
|
|
120
|
-
({ children }: PropsWithChildren) => {
|
|
121
|
-
return (
|
|
122
|
-
<CloudThreadListItemRuntimeProvider
|
|
123
|
-
adapter={cloudThreadListItemRuntimeAdapter}
|
|
124
|
-
>
|
|
125
|
-
{children}
|
|
126
|
-
</CloudThreadListItemRuntimeProvider>
|
|
127
|
-
);
|
|
128
|
-
},
|
|
129
|
-
[cloudThreadListItemRuntimeAdapter],
|
|
130
|
-
),
|
|
131
107
|
});
|
|
132
108
|
|
|
133
109
|
return runtime;
|
|
@@ -20,10 +20,6 @@ export type RemoteThreadListResponse = {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export type RemoteThreadListSubscriber = {
|
|
23
|
-
onInitialize: (
|
|
24
|
-
threadId: string,
|
|
25
|
-
begin: () => Promise<RemoteThreadInitializeResponse>,
|
|
26
|
-
) => void;
|
|
27
23
|
onGenerateTitle: (
|
|
28
24
|
threadId: string,
|
|
29
25
|
begin: () => Promise<AssistantStream>,
|
|
@@ -39,8 +35,9 @@ export type RemoteThreadListAdapter = {
|
|
|
39
35
|
archive(remoteId: string): Promise<void>;
|
|
40
36
|
unarchive(remoteId: string): Promise<void>;
|
|
41
37
|
delete(remoteId: string): Promise<void>;
|
|
38
|
+
initialize(threadId: string): Promise<RemoteThreadInitializeResponse>;
|
|
42
39
|
|
|
43
|
-
subscribe(subscriber: RemoteThreadListSubscriber): Unsubscribe;
|
|
40
|
+
subscribe?(subscriber: RemoteThreadListSubscriber): Unsubscribe;
|
|
44
41
|
|
|
45
42
|
unstable_Provider?: ComponentType<PropsWithChildren>;
|
|
46
43
|
};
|
|
@@ -11,15 +11,15 @@ class RemoteThreadListRuntimeCore
|
|
|
11
11
|
extends BaseAssistantRuntimeCore
|
|
12
12
|
implements AssistantRuntimeCore
|
|
13
13
|
{
|
|
14
|
-
public readonly
|
|
14
|
+
public readonly threads;
|
|
15
15
|
|
|
16
16
|
constructor(adapter: RemoteThreadListAdapter) {
|
|
17
17
|
super();
|
|
18
|
-
this.
|
|
18
|
+
this.threads = new RemoteThreadListThreadListRuntimeCore(adapter);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
public get RenderComponent() {
|
|
22
|
-
return this.
|
|
22
|
+
return this.threads.__internal_RenderComponent;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -28,8 +28,8 @@ export const useRemoteThreadListRuntime = (
|
|
|
28
28
|
) => {
|
|
29
29
|
const [runtime] = useState(() => new RemoteThreadListRuntimeCore(adapter));
|
|
30
30
|
useEffect(() => {
|
|
31
|
-
runtime.
|
|
32
|
-
return runtime.
|
|
31
|
+
runtime.threads.__internal_setAdapter(adapter);
|
|
32
|
+
return runtime.threads.__internal_bindAdapter();
|
|
33
33
|
}, [runtime, adapter]);
|
|
34
34
|
return useMemo(() => AssistantRuntimeImpl.create(runtime), [runtime]);
|
|
35
35
|
};
|
|
@@ -13,6 +13,11 @@ type RepositoryMessage = RepositoryParent & {
|
|
|
13
13
|
level: number;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
export type ExportedMessageRepositoryItem = {
|
|
17
|
+
message: ThreadMessage;
|
|
18
|
+
parentId: string | null;
|
|
19
|
+
};
|
|
20
|
+
|
|
16
21
|
export interface ExportedMessageRepository {
|
|
17
22
|
headId?: string | null;
|
|
18
23
|
messages: Array<{
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentAdapter.d.ts","sourceRoot":"","sources":["../../../src/runtimes/attachment/AttachmentAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,6BAA6B,CAAC;AAErC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IAEf,GAAG,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACvD,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAClE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/attachment/AttachmentAdapter.ts"],"sourcesContent":["import {\n Attachment,\n PendingAttachment,\n CompleteAttachment,\n} from \"../../types/AttachmentTypes\";\n\nexport type AttachmentAdapter = {\n accept: string;\n\n add(state: { file: File }): Promise<PendingAttachment>;\n remove(attachment: Attachment): Promise<void>;\n send(attachment: PendingAttachment): Promise<CompleteAttachment>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeAttachmentAdapter.d.ts","sourceRoot":"","sources":["../../../src/runtimes/attachment/CompositeAttachmentAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AA6CxD,qBAAa,0BAA2B,YAAW,iBAAiB;IAClE,OAAO,CAAC,SAAS,CAAsB;IAEhC,MAAM,EAAE,MAAM,CAAC;gBAEV,QAAQ,EAAE,iBAAiB,EAAE;IAgB5B,GAAG,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE;IASzB,IAAI,CAAC,UAAU,EAAE,iBAAiB;IAUlC,MAAM,CAAC,UAAU,EAAE,UAAU;CAiB3C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/attachment/CompositeAttachmentAdapter.ts"],"sourcesContent":["import { Attachment, PendingAttachment } from \"../../types/AttachmentTypes\";\nimport { AttachmentAdapter } from \"./AttachmentAdapter\";\n\nfunction fileMatchesAccept(\n file: { name: string; type: string },\n acceptString: string,\n) {\n // Check if the accept string is \"*\", which allows any file\n if (acceptString === \"*\") {\n return true;\n }\n\n // Split the accept string into an array of allowed types\n const allowedTypes = acceptString\n .split(\",\")\n .map((type) => type.trim().toLowerCase());\n\n // Get the file's extension and MIME type\n const fileExtension = \".\" + file.name.split(\".\").pop()!.toLowerCase();\n const fileMimeType = file.type.toLowerCase();\n\n for (const type of allowedTypes) {\n // Check for file extension match\n if (type.startsWith(\".\") && type === fileExtension) {\n return true;\n }\n\n // Check for exact MIME type match\n if (type.includes(\"/\") && type === fileMimeType) {\n return true;\n }\n\n if (type === \"image/*\" || type === \"video/*\" || type === \"audio/*\") {\n // Check for wildcard MIME type match\n if (type.endsWith(\"/*\")) {\n const generalType = type.split(\"/\")[0]!;\n if (fileMimeType.startsWith(generalType + \"/\")) {\n return true;\n }\n }\n }\n }\n\n return false;\n}\n\nexport class CompositeAttachmentAdapter implements AttachmentAdapter {\n private _adapters: AttachmentAdapter[];\n\n public accept: string;\n\n constructor(adapters: AttachmentAdapter[]) {\n this._adapters = adapters;\n\n const wildcardIdx = adapters.findIndex((a) => a.accept === \"*\");\n if (wildcardIdx !== -1) {\n if (wildcardIdx !== adapters.length - 1)\n throw new Error(\n \"A wildcard adapter (handling all files) can only be specified as the last adapter.\",\n );\n\n this.accept = \"*\";\n } else {\n this.accept = adapters.map((a) => a.accept).join(\",\");\n }\n }\n\n public async add(state: { file: File }) {\n for (const adapter of this._adapters) {\n if (fileMatchesAccept(state.file, adapter.accept)) {\n return adapter.add(state);\n }\n }\n throw new Error(\"No matching adapter found for file\");\n }\n\n public async send(attachment: PendingAttachment) {\n const adapters = this._adapters.slice();\n for (const adapter of adapters) {\n if (fileMatchesAccept(attachment.file, adapter.accept)) {\n return adapter.send(attachment);\n }\n }\n throw new Error(\"No matching adapter found for attachment\");\n }\n\n public async remove(attachment: Attachment) {\n const adapters = this._adapters.slice();\n for (const adapter of adapters) {\n if (\n fileMatchesAccept(\n {\n name: attachment.name,\n type: attachment.contentType,\n },\n adapter.accept,\n )\n ) {\n return adapter.remove(attachment);\n }\n }\n throw new Error(\"No matching adapter found for attachment\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,SAAS,kBACP,MACA,cACA;AAEA,MAAI,iBAAiB,KAAK;AACxB,WAAO;AAAA,EACT;AAGA,QAAM,eAAe,aAClB,MAAM,GAAG,EACT,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE,YAAY,CAAC;AAG1C,QAAM,gBAAgB,MAAM,KAAK,KAAK,MAAM,GAAG,EAAE,IAAI,EAAG,YAAY;AACpE,QAAM,eAAe,KAAK,KAAK,YAAY;AAE3C,aAAW,QAAQ,cAAc;AAE/B,QAAI,KAAK,WAAW,GAAG,KAAK,SAAS,eAAe;AAClD,aAAO;AAAA,IACT;AAGA,QAAI,KAAK,SAAS,GAAG,KAAK,SAAS,cAAc;AAC/C,aAAO;AAAA,IACT;AAEA,QAAI,SAAS,aAAa,SAAS,aAAa,SAAS,WAAW;AAElE,UAAI,KAAK,SAAS,IAAI,GAAG;AACvB,cAAM,cAAc,KAAK,MAAM,GAAG,EAAE,CAAC;AACrC,YAAI,aAAa,WAAW,cAAc,GAAG,GAAG;AAC9C,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEO,IAAM,6BAAN,MAA8D;AAAA,EAC3D;AAAA,EAED;AAAA,EAEP,YAAY,UAA+B;AACzC,SAAK,YAAY;AAEjB,UAAM,cAAc,SAAS,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG;AAC9D,QAAI,gBAAgB,IAAI;AACtB,UAAI,gBAAgB,SAAS,SAAS;AACpC,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAEF,WAAK,SAAS;AAAA,IAChB,OAAO;AACL,WAAK,SAAS,SAAS,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,GAAG;AAAA,IACtD;AAAA,EACF;AAAA,EAEA,MAAa,IAAI,OAAuB;AACtC,eAAW,WAAW,KAAK,WAAW;AACpC,UAAI,kBAAkB,MAAM,MAAM,QAAQ,MAAM,GAAG;AACjD,eAAO,QAAQ,IAAI,KAAK;AAAA,MAC1B;AAAA,IACF;AACA,UAAM,IAAI,MAAM,oCAAoC;AAAA,EACtD;AAAA,EAEA,MAAa,KAAK,YAA+B;AAC/C,UAAM,WAAW,KAAK,UAAU,MAAM;AACtC,eAAW,WAAW,UAAU;AAC9B,UAAI,kBAAkB,WAAW,MAAM,QAAQ,MAAM,GAAG;AACtD,eAAO,QAAQ,KAAK,UAAU;AAAA,MAChC;AAAA,IACF;AACA,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC5D;AAAA,EAEA,MAAa,OAAO,YAAwB;AAC1C,UAAM,WAAW,KAAK,UAAU,MAAM;AACtC,eAAW,WAAW,UAAU;AAC9B,UACE;AAAA,QACE;AAAA,UACE,MAAM,WAAW;AAAA,UACjB,MAAM,WAAW;AAAA,QACnB;AAAA,QACA,QAAQ;AAAA,MACV,GACA;AACA,eAAO,QAAQ,OAAO,UAAU;AAAA,MAClC;AAAA,IACF;AACA,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC5D;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/attachment/CompositeAttachmentAdapter.ts"],"sourcesContent":["import { Attachment, PendingAttachment } from \"../../types/AttachmentTypes\";\nimport { AttachmentAdapter } from \"./AttachmentAdapter\";\n\nfunction fileMatchesAccept(\n file: { name: string; type: string },\n acceptString: string,\n) {\n // Check if the accept string is \"*\", which allows any file\n if (acceptString === \"*\") {\n return true;\n }\n\n // Split the accept string into an array of allowed types\n const allowedTypes = acceptString\n .split(\",\")\n .map((type) => type.trim().toLowerCase());\n\n // Get the file's extension and MIME type\n const fileExtension = \".\" + file.name.split(\".\").pop()!.toLowerCase();\n const fileMimeType = file.type.toLowerCase();\n\n for (const type of allowedTypes) {\n // Check for file extension match\n if (type.startsWith(\".\") && type === fileExtension) {\n return true;\n }\n\n // Check for exact MIME type match\n if (type.includes(\"/\") && type === fileMimeType) {\n return true;\n }\n\n if (type === \"image/*\" || type === \"video/*\" || type === \"audio/*\") {\n // Check for wildcard MIME type match\n if (type.endsWith(\"/*\")) {\n const generalType = type.split(\"/\")[0]!;\n if (fileMimeType.startsWith(generalType + \"/\")) {\n return true;\n }\n }\n }\n }\n\n return false;\n}\n\nexport class CompositeAttachmentAdapter implements AttachmentAdapter {\n private _adapters: AttachmentAdapter[];\n\n public accept: string;\n\n constructor(adapters: AttachmentAdapter[]) {\n this._adapters = adapters;\n\n const wildcardIdx = adapters.findIndex((a) => a.accept === \"*\");\n if (wildcardIdx !== -1) {\n if (wildcardIdx !== adapters.length - 1)\n throw new Error(\n \"A wildcard adapter (handling all files) can only be specified as the last adapter.\",\n );\n\n this.accept = \"*\";\n } else {\n this.accept = adapters.map((a) => a.accept).join(\",\");\n }\n }\n\n public async add(state: { file: File }) {\n for (const adapter of this._adapters) {\n if (fileMatchesAccept(state.file, adapter.accept)) {\n return adapter.add(state);\n }\n }\n throw new Error(\"No matching adapter found for file\");\n }\n\n public async send(attachment: PendingAttachment) {\n const adapters = this._adapters.slice();\n for (const adapter of adapters) {\n if (fileMatchesAccept(attachment.file, adapter.accept)) {\n return adapter.send(attachment);\n }\n }\n throw new Error(\"No matching adapter found for attachment\");\n }\n\n public async remove(attachment: Attachment) {\n const adapters = this._adapters.slice();\n for (const adapter of adapters) {\n if (\n fileMatchesAccept(\n {\n name: attachment.name,\n type: attachment.contentType,\n },\n adapter.accept,\n )\n ) {\n return adapter.remove(attachment);\n }\n }\n throw new Error(\"No matching adapter found for attachment\");\n }\n}\n"],"mappings":";AAGA,SAAS,kBACP,MACA,cACA;AAEA,MAAI,iBAAiB,KAAK;AACxB,WAAO;AAAA,EACT;AAGA,QAAM,eAAe,aAClB,MAAM,GAAG,EACT,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE,YAAY,CAAC;AAG1C,QAAM,gBAAgB,MAAM,KAAK,KAAK,MAAM,GAAG,EAAE,IAAI,EAAG,YAAY;AACpE,QAAM,eAAe,KAAK,KAAK,YAAY;AAE3C,aAAW,QAAQ,cAAc;AAE/B,QAAI,KAAK,WAAW,GAAG,KAAK,SAAS,eAAe;AAClD,aAAO;AAAA,IACT;AAGA,QAAI,KAAK,SAAS,GAAG,KAAK,SAAS,cAAc;AAC/C,aAAO;AAAA,IACT;AAEA,QAAI,SAAS,aAAa,SAAS,aAAa,SAAS,WAAW;AAElE,UAAI,KAAK,SAAS,IAAI,GAAG;AACvB,cAAM,cAAc,KAAK,MAAM,GAAG,EAAE,CAAC;AACrC,YAAI,aAAa,WAAW,cAAc,GAAG,GAAG;AAC9C,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEO,IAAM,6BAAN,MAA8D;AAAA,EAC3D;AAAA,EAED;AAAA,EAEP,YAAY,UAA+B;AACzC,SAAK,YAAY;AAEjB,UAAM,cAAc,SAAS,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG;AAC9D,QAAI,gBAAgB,IAAI;AACtB,UAAI,gBAAgB,SAAS,SAAS;AACpC,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAEF,WAAK,SAAS;AAAA,IAChB,OAAO;AACL,WAAK,SAAS,SAAS,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,GAAG;AAAA,IACtD;AAAA,EACF;AAAA,EAEA,MAAa,IAAI,OAAuB;AACtC,eAAW,WAAW,KAAK,WAAW;AACpC,UAAI,kBAAkB,MAAM,MAAM,QAAQ,MAAM,GAAG;AACjD,eAAO,QAAQ,IAAI,KAAK;AAAA,MAC1B;AAAA,IACF;AACA,UAAM,IAAI,MAAM,oCAAoC;AAAA,EACtD;AAAA,EAEA,MAAa,KAAK,YAA+B;AAC/C,UAAM,WAAW,KAAK,UAAU,MAAM;AACtC,eAAW,WAAW,UAAU;AAC9B,UAAI,kBAAkB,WAAW,MAAM,QAAQ,MAAM,GAAG;AACtD,eAAO,QAAQ,KAAK,UAAU;AAAA,MAChC;AAAA,IACF;AACA,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC5D;AAAA,EAEA,MAAa,OAAO,YAAwB;AAC1C,UAAM,WAAW,KAAK,UAAU,MAAM;AACtC,eAAW,WAAW,UAAU;AAC9B,UACE;AAAA,QACE;AAAA,UACE,MAAM,WAAW;AAAA,UACjB,MAAM,WAAW;AAAA,QACnB;AAAA,QACA,QAAQ;AAAA,MACV,GACA;AACA,eAAO,QAAQ,OAAO,UAAU;AAAA,MAClC;AAAA,IACF;AACA,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC5D;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleImageAttachmentAdapter.d.ts","sourceRoot":"","sources":["../../../src/runtimes/attachment/SimpleImageAttachmentAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,4BAA6B,YAAW,iBAAiB;IAC7D,MAAM,SAAa;IAEb,GAAG,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAWtD,IAAI,CACf,UAAU,EAAE,iBAAiB,GAC5B,OAAO,CAAC,kBAAkB,CAAC;IAajB,MAAM;CAGpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/attachment/SimpleImageAttachmentAdapter.ts"],"sourcesContent":["import {\n PendingAttachment,\n CompleteAttachment,\n} from \"../../types/AttachmentTypes\";\nimport { AttachmentAdapter } from \"./AttachmentAdapter\";\n\nexport class SimpleImageAttachmentAdapter implements AttachmentAdapter {\n public accept = \"image/*\";\n\n public async add(state: { file: File }): Promise<PendingAttachment> {\n return {\n id: state.file.name,\n type: \"image\",\n name: state.file.name,\n contentType: state.file.type,\n file: state.file,\n status: { type: \"requires-action\", reason: \"composer-send\" },\n };\n }\n\n public async send(\n attachment: PendingAttachment,\n ): Promise<CompleteAttachment> {\n return {\n ...attachment,\n status: { type: \"complete\" },\n content: [\n {\n type: \"image\",\n image: await getFileDataURL(attachment.file),\n },\n ],\n };\n }\n\n public async remove() {\n // noop\n }\n}\n\nconst getFileDataURL = (file: File) =>\n new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = (error) => reject(error);\n\n reader.readAsDataURL(file);\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,IAAM,+BAAN,MAAgE;AAAA,EAC9D,SAAS;AAAA,EAEhB,MAAa,IAAI,OAAmD;AAClE,WAAO;AAAA,MACL,IAAI,MAAM,KAAK;AAAA,MACf,MAAM;AAAA,MACN,MAAM,MAAM,KAAK;AAAA,MACjB,aAAa,MAAM,KAAK;AAAA,MACxB,MAAM,MAAM;AAAA,MACZ,QAAQ,EAAE,MAAM,mBAAmB,QAAQ,gBAAgB;AAAA,IAC7D;AAAA,EACF;AAAA,EAEA,MAAa,KACX,YAC6B;AAC7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,QAAQ,EAAE,MAAM,WAAW;AAAA,MAC3B,SAAS;AAAA,QACP;AAAA,UACE,MAAM;AAAA,UACN,OAAO,MAAM,eAAe,WAAW,IAAI;AAAA,QAC7C;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAa,SAAS;AAAA,EAEtB;AACF;AAEA,IAAM,iBAAiB,CAAC,SACtB,IAAI,QAAgB,CAAC,SAAS,WAAW;AACvC,QAAM,SAAS,IAAI,WAAW;AAE9B,SAAO,SAAS,MAAM,QAAQ,OAAO,MAAgB;AACrD,SAAO,UAAU,CAAC,UAAU,OAAO,KAAK;AAExC,SAAO,cAAc,IAAI;AAC3B,CAAC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/attachment/SimpleImageAttachmentAdapter.ts"],"sourcesContent":["import {\n PendingAttachment,\n CompleteAttachment,\n} from \"../../types/AttachmentTypes\";\nimport { AttachmentAdapter } from \"./AttachmentAdapter\";\n\nexport class SimpleImageAttachmentAdapter implements AttachmentAdapter {\n public accept = \"image/*\";\n\n public async add(state: { file: File }): Promise<PendingAttachment> {\n return {\n id: state.file.name,\n type: \"image\",\n name: state.file.name,\n contentType: state.file.type,\n file: state.file,\n status: { type: \"requires-action\", reason: \"composer-send\" },\n };\n }\n\n public async send(\n attachment: PendingAttachment,\n ): Promise<CompleteAttachment> {\n return {\n ...attachment,\n status: { type: \"complete\" },\n content: [\n {\n type: \"image\",\n image: await getFileDataURL(attachment.file),\n },\n ],\n };\n }\n\n public async remove() {\n // noop\n }\n}\n\nconst getFileDataURL = (file: File) =>\n new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = (error) => reject(error);\n\n reader.readAsDataURL(file);\n });\n"],"mappings":";AAMO,IAAM,+BAAN,MAAgE;AAAA,EAC9D,SAAS;AAAA,EAEhB,MAAa,IAAI,OAAmD;AAClE,WAAO;AAAA,MACL,IAAI,MAAM,KAAK;AAAA,MACf,MAAM;AAAA,MACN,MAAM,MAAM,KAAK;AAAA,MACjB,aAAa,MAAM,KAAK;AAAA,MACxB,MAAM,MAAM;AAAA,MACZ,QAAQ,EAAE,MAAM,mBAAmB,QAAQ,gBAAgB;AAAA,IAC7D;AAAA,EACF;AAAA,EAEA,MAAa,KACX,YAC6B;AAC7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,QAAQ,EAAE,MAAM,WAAW;AAAA,MAC3B,SAAS;AAAA,QACP;AAAA,UACE,MAAM;AAAA,UACN,OAAO,MAAM,eAAe,WAAW,IAAI;AAAA,QAC7C;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAa,SAAS;AAAA,EAEtB;AACF;AAEA,IAAM,iBAAiB,CAAC,SACtB,IAAI,QAAgB,CAAC,SAAS,WAAW;AACvC,QAAM,SAAS,IAAI,WAAW;AAE9B,SAAO,SAAS,MAAM,QAAQ,OAAO,MAAgB;AACrD,SAAO,UAAU,CAAC,UAAU,OAAO,KAAK;AAExC,SAAO,cAAc,IAAI;AAC3B,CAAC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleTextAttachmentAdapter.d.ts","sourceRoot":"","sources":["../../../src/runtimes/attachment/SimpleTextAttachmentAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,2BAA4B,YAAW,iBAAiB;IAC5D,MAAM,SAC+D;IAE/D,GAAG,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAWtD,IAAI,CACf,UAAU,EAAE,iBAAiB,GAC5B,OAAO,CAAC,kBAAkB,CAAC;IAajB,MAAM;CAGpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/attachment/SimpleTextAttachmentAdapter.ts"],"sourcesContent":["import {\n CompleteAttachment,\n PendingAttachment,\n} from \"../../types/AttachmentTypes\";\nimport { AttachmentAdapter } from \"./AttachmentAdapter\";\n\nexport class SimpleTextAttachmentAdapter implements AttachmentAdapter {\n public accept =\n \"text/plain,text/html,text/markdown,text/csv,text/xml,text/json,text/css\";\n\n public async add(state: { file: File }): Promise<PendingAttachment> {\n return {\n id: state.file.name,\n type: \"document\",\n name: state.file.name,\n contentType: state.file.type,\n file: state.file,\n status: { type: \"requires-action\", reason: \"composer-send\" },\n };\n }\n\n public async send(\n attachment: PendingAttachment,\n ): Promise<CompleteAttachment> {\n return {\n ...attachment,\n status: { type: \"complete\" },\n content: [\n {\n type: \"text\",\n text: `<attachment name=${attachment.name}>\\n${await getFileText(attachment.file)}\\n</attachment>`,\n },\n ],\n };\n }\n\n public async remove() {\n // noop\n }\n}\n\nconst getFileText = (file: File) =>\n new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = (error) => reject(error);\n\n reader.readAsText(file);\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,IAAM,8BAAN,MAA+D;AAAA,EAC7D,SACL;AAAA,EAEF,MAAa,IAAI,OAAmD;AAClE,WAAO;AAAA,MACL,IAAI,MAAM,KAAK;AAAA,MACf,MAAM;AAAA,MACN,MAAM,MAAM,KAAK;AAAA,MACjB,aAAa,MAAM,KAAK;AAAA,MACxB,MAAM,MAAM;AAAA,MACZ,QAAQ,EAAE,MAAM,mBAAmB,QAAQ,gBAAgB;AAAA,IAC7D;AAAA,EACF;AAAA,EAEA,MAAa,KACX,YAC6B;AAC7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,QAAQ,EAAE,MAAM,WAAW;AAAA,MAC3B,SAAS;AAAA,QACP;AAAA,UACE,MAAM;AAAA,UACN,MAAM,oBAAoB,WAAW,IAAI;AAAA,EAAM,MAAM,YAAY,WAAW,IAAI,CAAC;AAAA;AAAA,QACnF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAa,SAAS;AAAA,EAEtB;AACF;AAEA,IAAM,cAAc,CAAC,SACnB,IAAI,QAAgB,CAAC,SAAS,WAAW;AACvC,QAAM,SAAS,IAAI,WAAW;AAE9B,SAAO,SAAS,MAAM,QAAQ,OAAO,MAAgB;AACrD,SAAO,UAAU,CAAC,UAAU,OAAO,KAAK;AAExC,SAAO,WAAW,IAAI;AACxB,CAAC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/attachment/SimpleTextAttachmentAdapter.ts"],"sourcesContent":["import {\n CompleteAttachment,\n PendingAttachment,\n} from \"../../types/AttachmentTypes\";\nimport { AttachmentAdapter } from \"./AttachmentAdapter\";\n\nexport class SimpleTextAttachmentAdapter implements AttachmentAdapter {\n public accept =\n \"text/plain,text/html,text/markdown,text/csv,text/xml,text/json,text/css\";\n\n public async add(state: { file: File }): Promise<PendingAttachment> {\n return {\n id: state.file.name,\n type: \"document\",\n name: state.file.name,\n contentType: state.file.type,\n file: state.file,\n status: { type: \"requires-action\", reason: \"composer-send\" },\n };\n }\n\n public async send(\n attachment: PendingAttachment,\n ): Promise<CompleteAttachment> {\n return {\n ...attachment,\n status: { type: \"complete\" },\n content: [\n {\n type: \"text\",\n text: `<attachment name=${attachment.name}>\\n${await getFileText(attachment.file)}\\n</attachment>`,\n },\n ],\n };\n }\n\n public async remove() {\n // noop\n }\n}\n\nconst getFileText = (file: File) =>\n new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = (error) => reject(error);\n\n reader.readAsText(file);\n });\n"],"mappings":";AAMO,IAAM,8BAAN,MAA+D;AAAA,EAC7D,SACL;AAAA,EAEF,MAAa,IAAI,OAAmD;AAClE,WAAO;AAAA,MACL,IAAI,MAAM,KAAK;AAAA,MACf,MAAM;AAAA,MACN,MAAM,MAAM,KAAK;AAAA,MACjB,aAAa,MAAM,KAAK;AAAA,MACxB,MAAM,MAAM;AAAA,MACZ,QAAQ,EAAE,MAAM,mBAAmB,QAAQ,gBAAgB;AAAA,IAC7D;AAAA,EACF;AAAA,EAEA,MAAa,KACX,YAC6B;AAC7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,QAAQ,EAAE,MAAM,WAAW;AAAA,MAC3B,SAAS;AAAA,QACP;AAAA,UACE,MAAM;AAAA,UACN,MAAM,oBAAoB,WAAW,IAAI;AAAA,EAAM,MAAM,YAAY,WAAW,IAAI,CAAC;AAAA;AAAA,QACnF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAa,SAAS;AAAA,EAEtB;AACF;AAEA,IAAM,cAAc,CAAC,SACnB,IAAI,QAAgB,CAAC,SAAS,WAAW;AACvC,QAAM,SAAS,IAAI,WAAW;AAE9B,SAAO,SAAS,MAAM,QAAQ,OAAO,MAAgB;AACrD,SAAO,UAAU,CAAC,UAAU,OAAO,KAAK;AAExC,SAAO,WAAW,IAAI;AACxB,CAAC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtimes/attachment/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/attachment/index.ts"],"sourcesContent":["export type { AttachmentAdapter } from \"./AttachmentAdapter\";\nexport { SimpleImageAttachmentAdapter } from \"./SimpleImageAttachmentAdapter\";\nexport { SimpleTextAttachmentAdapter } from \"./SimpleTextAttachmentAdapter\";\nexport { CompositeAttachmentAdapter } from \"./CompositeAttachmentAdapter\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0CAA6C;AAC7C,yCAA4C;AAC5C,wCAA2C;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/attachment/index.ts"],"sourcesContent":["export type { AttachmentAdapter } from \"./AttachmentAdapter\";\nexport { SimpleImageAttachmentAdapter } from \"./SimpleImageAttachmentAdapter\";\nexport { SimpleTextAttachmentAdapter } from \"./SimpleTextAttachmentAdapter\";\nexport { CompositeAttachmentAdapter } from \"./CompositeAttachmentAdapter\";\n"],"mappings":";AACA,SAAS,oCAAoC;AAC7C,SAAS,mCAAmC;AAC5C,SAAS,kCAAkC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FeedbackAdapter.d.ts","sourceRoot":"","sources":["../../../src/runtimes/feedback/FeedbackAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,CAAC,QAAQ,EAAE,uBAAuB,KAAK,IAAI,CAAC;CACrD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/feedback/FeedbackAdapter.ts"],"sourcesContent":["import { ThreadMessage } from \"../../types/AssistantTypes\";\n\ntype FeedbackAdapterFeedback = {\n message: ThreadMessage;\n type: \"positive\" | \"negative\";\n};\n\nexport type FeedbackAdapter = {\n submit: (feedback: FeedbackAdapterFeedback) => void;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtimes/feedback/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/feedback/index.ts"],"sourcesContent":["export { type FeedbackAdapter } from \"./FeedbackAdapter\";\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
2
|
-
import { RemoteThreadInitializeResponse } from "../types";
|
|
3
|
-
type CloudInitializeResponse = {
|
|
4
|
-
remoteId: string;
|
|
5
|
-
externalId: string | undefined;
|
|
6
|
-
};
|
|
7
|
-
type CloudThreadListItemRuntime = {
|
|
8
|
-
getOrCreateThread: () => Promise<CloudInitializeResponse>;
|
|
9
|
-
generateThreadTitle: () => Promise<void>;
|
|
10
|
-
};
|
|
11
|
-
export declare const useCloudThreadListItemRuntime: () => CloudThreadListItemRuntime;
|
|
12
|
-
type CloudThreadListItemRuntimeAdapter = {
|
|
13
|
-
initialize: (threadId: string) => Promise<RemoteThreadInitializeResponse>;
|
|
14
|
-
generateTitle: (remoteId: string) => Promise<void>;
|
|
15
|
-
};
|
|
16
|
-
type CloudThreadListItemRuntimeContextAdapterProps = {
|
|
17
|
-
adapter: CloudThreadListItemRuntimeAdapter;
|
|
18
|
-
children: React.ReactNode;
|
|
19
|
-
};
|
|
20
|
-
export declare const CloudThreadListItemRuntimeProvider: FC<CloudThreadListItemRuntimeContextAdapterProps>;
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=CloudThreadListItemRuntime.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CloudThreadListItemRuntime.d.ts","sourceRoot":"","sources":["../../../../src/runtimes/remote-thread-list/cloud/CloudThreadListItemRuntime.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,EAAE,EAAmC,MAAM,OAAO,CAAC;AAE3E,OAAO,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAG1D,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,iBAAiB,EAAE,MAAM,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC1D,mBAAmB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,6BAA6B,kCASzC,CAAC;AAEF,KAAK,iCAAiC,GAAG;IACvC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAC1E,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD,CAAC;AA4BF,KAAK,6CAA6C,GAAG;IACnD,OAAO,EAAE,iCAAiC,CAAC;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,kCAAkC,EAAE,EAAE,CACjD,6CAA6C,CAoB9C,CAAC"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/runtimes/remote-thread-list/cloud/CloudThreadListItemRuntime.tsx
|
|
22
|
-
var CloudThreadListItemRuntime_exports = {};
|
|
23
|
-
__export(CloudThreadListItemRuntime_exports, {
|
|
24
|
-
CloudThreadListItemRuntimeProvider: () => CloudThreadListItemRuntimeProvider,
|
|
25
|
-
useCloudThreadListItemRuntime: () => useCloudThreadListItemRuntime
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(CloudThreadListItemRuntime_exports);
|
|
28
|
-
var import_react = require("react");
|
|
29
|
-
var import_context = require("../../../context/index.js");
|
|
30
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
-
var useCloudThreadListItemRuntime = () => {
|
|
32
|
-
const cloudThreadListItemRuntime = (0, import_react.useContext)(
|
|
33
|
-
CloudThreadListItemRuntimeContext
|
|
34
|
-
);
|
|
35
|
-
if (!cloudThreadListItemRuntime)
|
|
36
|
-
throw new Error(
|
|
37
|
-
"This component can only be used inside a useCloudThreadListRuntime's runtimeHook."
|
|
38
|
-
);
|
|
39
|
-
return cloudThreadListItemRuntime;
|
|
40
|
-
};
|
|
41
|
-
var CloudThreadListItemRuntimeImpl = class {
|
|
42
|
-
constructor(adapter, threadListItemRuntime) {
|
|
43
|
-
this.adapter = adapter;
|
|
44
|
-
this.threadListItemRuntime = threadListItemRuntime;
|
|
45
|
-
}
|
|
46
|
-
__internal_setThreadListItemRuntime(threadListItemRuntime) {
|
|
47
|
-
this.threadListItemRuntime = threadListItemRuntime;
|
|
48
|
-
}
|
|
49
|
-
async getOrCreateThread() {
|
|
50
|
-
const threadData = this.threadListItemRuntime.getState();
|
|
51
|
-
if (threadData.remoteId)
|
|
52
|
-
return threadData;
|
|
53
|
-
return this.adapter.initialize(threadData.id);
|
|
54
|
-
}
|
|
55
|
-
generateThreadTitle() {
|
|
56
|
-
const remoteId = this.threadListItemRuntime.getState().remoteId;
|
|
57
|
-
if (!remoteId) throw new Error("Thread not initialized yet");
|
|
58
|
-
return this.adapter.generateTitle(remoteId);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
var CloudThreadListItemRuntimeProvider = ({ adapter, children }) => {
|
|
62
|
-
const threadListItemRuntime = (0, import_context.useThreadListItemRuntime)();
|
|
63
|
-
const [cloudThreadListItemRuntime] = (0, import_react.useState)(
|
|
64
|
-
() => new CloudThreadListItemRuntimeImpl(adapter, threadListItemRuntime)
|
|
65
|
-
);
|
|
66
|
-
(0, import_react.useEffect)(() => {
|
|
67
|
-
cloudThreadListItemRuntime.__internal_setThreadListItemRuntime(
|
|
68
|
-
threadListItemRuntime
|
|
69
|
-
);
|
|
70
|
-
}, [cloudThreadListItemRuntime, threadListItemRuntime]);
|
|
71
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
72
|
-
CloudThreadListItemRuntimeContext.Provider,
|
|
73
|
-
{
|
|
74
|
-
value: cloudThreadListItemRuntime,
|
|
75
|
-
children
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
};
|
|
79
|
-
var CloudThreadListItemRuntimeContext = (0, import_react.createContext)(null);
|
|
80
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
81
|
-
0 && (module.exports = {
|
|
82
|
-
CloudThreadListItemRuntimeProvider,
|
|
83
|
-
useCloudThreadListItemRuntime
|
|
84
|
-
});
|
|
85
|
-
//# sourceMappingURL=CloudThreadListItemRuntime.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtimes/remote-thread-list/cloud/CloudThreadListItemRuntime.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, FC, useContext, useEffect, useState } from \"react\";\nimport { useThreadListItemRuntime } from \"../../../context\";\nimport { RemoteThreadInitializeResponse } from \"../types\";\nimport { ThreadListItemRuntime } from \"../../../api\";\n\ntype CloudInitializeResponse = {\n remoteId: string;\n externalId: string | undefined;\n};\n\ntype CloudThreadListItemRuntime = {\n getOrCreateThread: () => Promise<CloudInitializeResponse>;\n generateThreadTitle: () => Promise<void>;\n};\n\nexport const useCloudThreadListItemRuntime = () => {\n const cloudThreadListItemRuntime = useContext(\n CloudThreadListItemRuntimeContext,\n );\n if (!cloudThreadListItemRuntime)\n throw new Error(\n \"This component can only be used inside a useCloudThreadListRuntime's runtimeHook.\",\n );\n return cloudThreadListItemRuntime;\n};\n\ntype CloudThreadListItemRuntimeAdapter = {\n initialize: (threadId: string) => Promise<RemoteThreadInitializeResponse>;\n generateTitle: (remoteId: string) => Promise<void>;\n};\n\nclass CloudThreadListItemRuntimeImpl implements CloudThreadListItemRuntime {\n public constructor(\n private adapter: CloudThreadListItemRuntimeAdapter,\n private threadListItemRuntime: ThreadListItemRuntime,\n ) {}\n\n public __internal_setThreadListItemRuntime(\n threadListItemRuntime: ThreadListItemRuntime,\n ) {\n this.threadListItemRuntime = threadListItemRuntime;\n }\n\n public async getOrCreateThread(): Promise<CloudInitializeResponse> {\n const threadData = this.threadListItemRuntime.getState();\n if (threadData.remoteId)\n return threadData as RemoteThreadInitializeResponse;\n return this.adapter.initialize(threadData.id);\n }\n\n public generateThreadTitle() {\n const remoteId = this.threadListItemRuntime.getState().remoteId;\n if (!remoteId) throw new Error(\"Thread not initialized yet\");\n return this.adapter.generateTitle(remoteId);\n }\n}\n\ntype CloudThreadListItemRuntimeContextAdapterProps = {\n adapter: CloudThreadListItemRuntimeAdapter;\n children: React.ReactNode;\n};\n\nexport const CloudThreadListItemRuntimeProvider: FC<\n CloudThreadListItemRuntimeContextAdapterProps\n> = ({ adapter, children }) => {\n const threadListItemRuntime = useThreadListItemRuntime();\n const [cloudThreadListItemRuntime] = useState(\n () => new CloudThreadListItemRuntimeImpl(adapter, threadListItemRuntime),\n );\n\n useEffect(() => {\n cloudThreadListItemRuntime.__internal_setThreadListItemRuntime(\n threadListItemRuntime,\n );\n }, [cloudThreadListItemRuntime, threadListItemRuntime]);\n\n return (\n <CloudThreadListItemRuntimeContext.Provider\n value={cloudThreadListItemRuntime}\n >\n {children}\n </CloudThreadListItemRuntimeContext.Provider>\n );\n};\n\nconst CloudThreadListItemRuntimeContext =\n createContext<CloudThreadListItemRuntime | null>(null);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAmE;AACnE,qBAAyC;AA4ErC;AA9DG,IAAM,gCAAgC,MAAM;AACjD,QAAM,iCAA6B;AAAA,IACjC;AAAA,EACF;AACA,MAAI,CAAC;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AACF,SAAO;AACT;AAOA,IAAM,iCAAN,MAA2E;AAAA,EAClE,YACG,SACA,uBACR;AAFQ;AACA;AAAA,EACP;AAAA,EAEI,oCACL,uBACA;AACA,SAAK,wBAAwB;AAAA,EAC/B;AAAA,EAEA,MAAa,oBAAsD;AACjE,UAAM,aAAa,KAAK,sBAAsB,SAAS;AACvD,QAAI,WAAW;AACb,aAAO;AACT,WAAO,KAAK,QAAQ,WAAW,WAAW,EAAE;AAAA,EAC9C;AAAA,EAEO,sBAAsB;AAC3B,UAAM,WAAW,KAAK,sBAAsB,SAAS,EAAE;AACvD,QAAI,CAAC,SAAU,OAAM,IAAI,MAAM,4BAA4B;AAC3D,WAAO,KAAK,QAAQ,cAAc,QAAQ;AAAA,EAC5C;AACF;AAOO,IAAM,qCAET,CAAC,EAAE,SAAS,SAAS,MAAM;AAC7B,QAAM,4BAAwB,yCAAyB;AACvD,QAAM,CAAC,0BAA0B,QAAI;AAAA,IACnC,MAAM,IAAI,+BAA+B,SAAS,qBAAqB;AAAA,EACzE;AAEA,8BAAU,MAAM;AACd,+BAA2B;AAAA,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,4BAA4B,qBAAqB,CAAC;AAEtD,SACE;AAAA,IAAC,kCAAkC;AAAA,IAAlC;AAAA,MACC,OAAO;AAAA,MAEN;AAAA;AAAA,EACH;AAEJ;AAEA,IAAM,wCACJ,4BAAiD,IAAI;","names":[]}
|