@assistant-ui/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/attachment.d.ts +36 -0
- package/dist/adapters/attachment.d.ts.map +1 -0
- package/dist/adapters/attachment.js +148 -0
- package/dist/adapters/attachment.js.map +1 -0
- package/dist/adapters/feedback.d.ts +10 -0
- package/dist/adapters/feedback.d.ts.map +1 -0
- package/dist/adapters/feedback.js +2 -0
- package/dist/adapters/feedback.js.map +1 -0
- package/dist/adapters/index.d.ts +8 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +3 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/speech.d.ts +76 -0
- package/dist/adapters/speech.d.ts.map +1 -0
- package/dist/adapters/speech.js +179 -0
- package/dist/adapters/speech.js.map +1 -0
- package/dist/adapters/suggestion.d.ts +10 -0
- package/dist/adapters/suggestion.d.ts.map +1 -0
- package/dist/adapters/suggestion.js +2 -0
- package/dist/adapters/suggestion.js.map +1 -0
- package/dist/adapters/thread-history.d.ts +43 -0
- package/dist/adapters/thread-history.d.ts.map +1 -0
- package/dist/adapters/thread-history.js +2 -0
- package/dist/adapters/thread-history.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +5 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +7 -0
- package/dist/internal.js.map +1 -0
- package/dist/model-context/frame/host.d.ts +21 -0
- package/dist/model-context/frame/host.d.ts.map +1 -0
- package/dist/model-context/frame/host.js +141 -0
- package/dist/model-context/frame/host.js.map +1 -0
- package/dist/model-context/frame/index.d.ts +5 -0
- package/dist/model-context/frame/index.d.ts.map +1 -0
- package/dist/model-context/frame/index.js +4 -0
- package/dist/model-context/frame/index.js.map +1 -0
- package/dist/model-context/frame/provider.d.ts +18 -0
- package/dist/model-context/frame/provider.d.ts.map +1 -0
- package/dist/model-context/frame/provider.js +133 -0
- package/dist/model-context/frame/provider.js.map +1 -0
- package/dist/model-context/frame/types.d.ts +29 -0
- package/dist/model-context/frame/types.d.ts.map +1 -0
- package/dist/model-context/frame/types.js +2 -0
- package/dist/model-context/frame/types.js.map +1 -0
- package/dist/model-context/index.d.ts +8 -0
- package/dist/model-context/index.d.ts.map +1 -0
- package/dist/model-context/index.js +9 -0
- package/dist/model-context/index.js.map +1 -0
- package/dist/model-context/registry-handles.d.ts +13 -0
- package/dist/model-context/registry-handles.d.ts.map +1 -0
- package/dist/model-context/registry-handles.js +2 -0
- package/dist/model-context/registry-handles.js.map +1 -0
- package/dist/model-context/registry.d.ts +17 -0
- package/dist/model-context/registry.d.ts.map +1 -0
- package/dist/model-context/registry.js +108 -0
- package/dist/model-context/registry.js.map +1 -0
- package/dist/model-context/tool.d.ts +3 -0
- package/dist/model-context/tool.d.ts.map +1 -0
- package/dist/model-context/tool.js +5 -0
- package/dist/model-context/tool.js.map +1 -0
- package/dist/model-context/types.d.ts +37 -0
- package/dist/model-context/types.d.ts.map +1 -0
- package/dist/model-context/types.js +43 -0
- package/dist/model-context/types.js.map +1 -0
- package/dist/runtime/api/assistant-runtime.d.ts +64 -0
- package/dist/runtime/api/assistant-runtime.d.ts.map +1 -0
- package/dist/runtime/api/assistant-runtime.js +46 -0
- package/dist/runtime/api/assistant-runtime.js.map +1 -0
- package/dist/runtime/api/attachment-runtime.d.ts +63 -0
- package/dist/runtime/api/attachment-runtime.d.ts.map +1 -0
- package/dist/runtime/api/attachment-runtime.js +56 -0
- package/dist/runtime/api/attachment-runtime.js.map +1 -0
- package/dist/runtime/api/bindings.d.ts +31 -0
- package/dist/runtime/api/bindings.d.ts.map +1 -0
- package/dist/runtime/api/bindings.js +2 -0
- package/dist/runtime/api/bindings.js.map +1 -0
- package/dist/runtime/api/composer-runtime.d.ts +181 -0
- package/dist/runtime/api/composer-runtime.d.ts.map +1 -0
- package/dist/runtime/api/composer-runtime.js +247 -0
- package/dist/runtime/api/composer-runtime.js.map +1 -0
- package/dist/runtime/api/message-part-runtime.d.ts +31 -0
- package/dist/runtime/api/message-part-runtime.d.ts.map +1 -0
- package/dist/runtime/api/message-part-runtime.js +67 -0
- package/dist/runtime/api/message-part-runtime.js.map +1 -0
- package/dist/runtime/api/message-runtime.d.ts +91 -0
- package/dist/runtime/api/message-runtime.d.ts.map +1 -0
- package/dist/runtime/api/message-runtime.js +199 -0
- package/dist/runtime/api/message-runtime.js.map +1 -0
- package/dist/runtime/api/paths.d.ts +64 -0
- package/dist/runtime/api/paths.d.ts.map +1 -0
- package/dist/runtime/api/paths.js +2 -0
- package/dist/runtime/api/paths.js.map +1 -0
- package/dist/runtime/api/thread-list-item-runtime.d.ts +50 -0
- package/dist/runtime/api/thread-list-item-runtime.d.ts.map +1 -0
- package/dist/runtime/api/thread-list-item-runtime.js +85 -0
- package/dist/runtime/api/thread-list-item-runtime.js.map +1 -0
- package/dist/runtime/api/thread-list-runtime.d.ts +44 -0
- package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -0
- package/dist/runtime/api/thread-list-runtime.js +136 -0
- package/dist/runtime/api/thread-list-runtime.js.map +1 -0
- package/dist/runtime/api/thread-runtime.d.ts +272 -0
- package/dist/runtime/api/thread-runtime.d.ts.map +1 -0
- package/dist/runtime/api/thread-runtime.js +240 -0
- package/dist/runtime/api/thread-runtime.js.map +1 -0
- package/dist/runtime/base/base-assistant-runtime-core.d.ts +12 -0
- package/dist/runtime/base/base-assistant-runtime-core.d.ts.map +1 -0
- package/dist/runtime/base/base-assistant-runtime-core.js +11 -0
- package/dist/runtime/base/base-assistant-runtime-core.js.map +1 -0
- package/dist/runtime/base/base-composer-runtime-core.d.ts +55 -0
- package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -0
- package/dist/runtime/base/base-composer-runtime-core.js +320 -0
- package/dist/runtime/base/base-composer-runtime-core.js.map +1 -0
- package/dist/runtime/base/base-thread-runtime-core.d.ts +67 -0
- package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -0
- package/dist/runtime/base/base-thread-runtime-core.js +157 -0
- package/dist/runtime/base/base-thread-runtime-core.js.map +1 -0
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts +28 -0
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts.map +1 -0
- package/dist/runtime/base/default-edit-composer-runtime-core.js +49 -0
- package/dist/runtime/base/default-edit-composer-runtime-core.js.map +1 -0
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +24 -0
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -0
- package/dist/runtime/base/default-thread-composer-runtime-core.js +41 -0
- package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -0
- package/dist/runtime/index.d.ts +20 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +7 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts +10 -0
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts.map +1 -0
- package/dist/runtime/interfaces/assistant-runtime-core.js +2 -0
- package/dist/runtime/interfaces/assistant-runtime-core.js.map +1 -0
- package/dist/runtime/interfaces/composer-runtime-core.d.ts +38 -0
- package/dist/runtime/interfaces/composer-runtime-core.d.ts.map +1 -0
- package/dist/runtime/interfaces/composer-runtime-core.js +2 -0
- package/dist/runtime/interfaces/composer-runtime-core.js.map +1 -0
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts +37 -0
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts.map +1 -0
- package/dist/runtime/interfaces/thread-list-runtime-core.js +2 -0
- package/dist/runtime/interfaces/thread-list-runtime-core.js.map +1 -0
- package/dist/runtime/interfaces/thread-runtime-core.d.ts +97 -0
- package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -0
- package/dist/runtime/interfaces/thread-runtime-core.js +2 -0
- package/dist/runtime/interfaces/thread-runtime-core.js.map +1 -0
- package/dist/runtime/internal.d.ts +23 -0
- package/dist/runtime/internal.d.ts.map +1 -0
- package/dist/runtime/internal.js +25 -0
- package/dist/runtime/internal.js.map +1 -0
- package/dist/runtime/utils/auto-status.d.ts +5 -0
- package/dist/runtime/utils/auto-status.d.ts.map +1 -0
- package/dist/runtime/utils/auto-status.js +32 -0
- package/dist/runtime/utils/auto-status.js.map +1 -0
- package/dist/runtime/utils/chat-model-adapter.d.ts +40 -0
- package/dist/runtime/utils/chat-model-adapter.d.ts.map +1 -0
- package/dist/runtime/utils/chat-model-adapter.js +2 -0
- package/dist/runtime/utils/chat-model-adapter.js.map +1 -0
- package/dist/runtime/utils/external-store-message.d.ts +10 -0
- package/dist/runtime/utils/external-store-message.d.ts.map +1 -0
- package/dist/runtime/utils/external-store-message.js +22 -0
- package/dist/runtime/utils/external-store-message.js.map +1 -0
- package/dist/runtime/utils/message-repository.d.ts +43 -0
- package/dist/runtime/utils/message-repository.d.ts.map +1 -0
- package/dist/runtime/utils/message-repository.js +257 -0
- package/dist/runtime/utils/message-repository.js.map +1 -0
- package/dist/runtime/utils/thread-message-like.d.ts +34 -0
- package/dist/runtime/utils/thread-message-like.d.ts.map +1 -0
- package/dist/runtime/utils/thread-message-like.js +129 -0
- package/dist/runtime/utils/thread-message-like.js.map +1 -0
- package/dist/runtimes/assistant-transport/utils.d.ts +11 -0
- package/dist/runtimes/assistant-transport/utils.d.ts.map +1 -0
- package/dist/runtimes/assistant-transport/utils.js +20 -0
- package/dist/runtimes/assistant-transport/utils.js.map +1 -0
- package/dist/runtimes/external-store/external-store-adapter.d.ts +81 -0
- package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -0
- package/dist/runtimes/external-store/external-store-adapter.js +2 -0
- package/dist/runtimes/external-store/external-store-adapter.js.map +1 -0
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts +9 -0
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts.map +1 -0
- package/dist/runtimes/external-store/external-store-runtime-core.js +19 -0
- package/dist/runtimes/external-store/external-store-runtime-core.js.map +1 -0
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts +42 -0
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts.map +1 -0
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js +174 -0
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js.map +1 -0
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +47 -0
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts.map +1 -0
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js +260 -0
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -0
- package/dist/runtimes/external-store/index.d.ts +8 -0
- package/dist/runtimes/external-store/index.d.ts.map +1 -0
- package/dist/runtimes/external-store/index.js +5 -0
- package/dist/runtimes/external-store/index.js.map +1 -0
- package/dist/runtimes/external-store/thread-message-converter.d.ts +7 -0
- package/dist/runtimes/external-store/thread-message-converter.d.ts.map +1 -0
- package/dist/runtimes/external-store/thread-message-converter.js +12 -0
- package/dist/runtimes/external-store/thread-message-converter.js.map +1 -0
- package/dist/runtimes/index.d.ts +6 -0
- package/dist/runtimes/index.d.ts.map +1 -0
- package/dist/runtimes/index.js +4 -0
- package/dist/runtimes/index.js.map +1 -0
- package/dist/runtimes/internal.d.ts +18 -0
- package/dist/runtimes/internal.d.ts.map +1 -0
- package/dist/runtimes/internal.js +15 -0
- package/dist/runtimes/internal.js.map +1 -0
- package/dist/runtimes/local/index.d.ts +7 -0
- package/dist/runtimes/local/index.d.ts.map +1 -0
- package/dist/runtimes/local/index.js +5 -0
- package/dist/runtimes/local/index.js.map +1 -0
- package/dist/runtimes/local/local-runtime-core.d.ts +11 -0
- package/dist/runtimes/local/local-runtime-core.d.ts.map +1 -0
- package/dist/runtimes/local/local-runtime-core.js +22 -0
- package/dist/runtimes/local/local-runtime-core.js.map +1 -0
- package/dist/runtimes/local/local-runtime-options.d.ts +23 -0
- package/dist/runtimes/local/local-runtime-options.d.ts.map +1 -0
- package/dist/runtimes/local/local-runtime-options.js +2 -0
- package/dist/runtimes/local/local-runtime-options.js.map +1 -0
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts +46 -0
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts.map +1 -0
- package/dist/runtimes/local/local-thread-list-runtime-core.js +87 -0
- package/dist/runtimes/local/local-thread-list-runtime-core.js.map +1 -0
- package/dist/runtimes/local/local-thread-runtime-core.d.ts +59 -0
- package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -0
- package/dist/runtimes/local/local-thread-runtime-core.js +423 -0
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -0
- package/dist/runtimes/local/should-continue.d.ts +3 -0
- package/dist/runtimes/local/should-continue.d.ts.map +1 -0
- package/dist/runtimes/local/should-continue.js +14 -0
- package/dist/runtimes/local/should-continue.js.map +1 -0
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts +13 -0
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/adapter/in-memory.js +29 -0
- package/dist/runtimes/remote-thread-list/adapter/in-memory.js.map +1 -0
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts +3 -0
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/empty-thread-core.js +146 -0
- package/dist/runtimes/remote-thread-list/empty-thread-core.js.map +1 -0
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts +23 -0
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/optimistic-state.js +57 -0
- package/dist/runtimes/remote-thread-list/optimistic-state.js.map +1 -0
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts +37 -0
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/remote-thread-state.js +62 -0
- package/dist/runtimes/remote-thread-list/remote-thread-state.js.map +1 -0
- package/dist/runtimes/remote-thread-list/types.d.ts +38 -0
- package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/types.js +2 -0
- package/dist/runtimes/remote-thread-list/types.js.map +1 -0
- package/dist/store/clients/chain-of-thought-client.d.ts +15 -0
- package/dist/store/clients/chain-of-thought-client.d.ts.map +1 -0
- package/dist/store/clients/chain-of-thought-client.js +18 -0
- package/dist/store/clients/chain-of-thought-client.js.map +1 -0
- package/dist/store/clients/index.d.ts +6 -0
- package/dist/store/clients/index.d.ts.map +1 -0
- package/dist/store/clients/index.js +6 -0
- package/dist/store/clients/index.js.map +1 -0
- package/dist/store/clients/model-context-client.d.ts +3 -0
- package/dist/store/clients/model-context-client.d.ts.map +1 -0
- package/dist/store/clients/model-context-client.js +14 -0
- package/dist/store/clients/model-context-client.js.map +1 -0
- package/dist/store/clients/no-op-composer-client.d.ts +7 -0
- package/dist/store/clients/no-op-composer-client.d.ts.map +1 -0
- package/dist/store/clients/no-op-composer-client.js +61 -0
- package/dist/store/clients/no-op-composer-client.js.map +1 -0
- package/dist/store/clients/suggestions.d.ts +11 -0
- package/dist/store/clients/suggestions.d.ts.map +1 -0
- package/dist/store/clients/suggestions.js +37 -0
- package/dist/store/clients/suggestions.js.map +1 -0
- package/dist/store/clients/thread-message-client.d.ts +11 -0
- package/dist/store/clients/thread-message-client.d.ts.map +1 -0
- package/dist/store/clients/thread-message-client.js +112 -0
- package/dist/store/clients/thread-message-client.js.map +1 -0
- package/dist/store/index.d.ts +14 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +14 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/internal.d.ts +11 -0
- package/dist/store/internal.d.ts.map +1 -0
- package/dist/store/internal.js +12 -0
- package/dist/store/internal.js.map +1 -0
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts +8 -0
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -0
- package/dist/store/runtime-clients/attachment-runtime-client.js +11 -0
- package/dist/store/runtime-clients/attachment-runtime-client.js.map +1 -0
- package/dist/store/runtime-clients/composer-runtime-client.d.ts +13 -0
- package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -0
- package/dist/store/runtime-clients/composer-runtime-client.js +83 -0
- package/dist/store/runtime-clients/composer-runtime-client.js.map +1 -0
- package/dist/store/runtime-clients/index.d.ts +8 -0
- package/dist/store/runtime-clients/index.d.ts.map +1 -0
- package/dist/store/runtime-clients/index.js +8 -0
- package/dist/store/runtime-clients/index.js.map +1 -0
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts +8 -0
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts.map +1 -0
- package/dist/store/runtime-clients/message-part-runtime-client.js +12 -0
- package/dist/store/runtime-clients/message-part-runtime-client.js.map +1 -0
- package/dist/store/runtime-clients/message-runtime-client.d.ts +11 -0
- package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -0
- package/dist/store/runtime-clients/message-runtime-client.js +78 -0
- package/dist/store/runtime-clients/message-runtime-client.js.map +1 -0
- package/dist/store/runtime-clients/tap-subscribable.d.ts +3 -0
- package/dist/store/runtime-clients/tap-subscribable.d.ts.map +1 -0
- package/dist/store/runtime-clients/tap-subscribable.js +12 -0
- package/dist/store/runtime-clients/tap-subscribable.js.map +1 -0
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts +8 -0
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts.map +1 -0
- package/dist/store/runtime-clients/thread-list-item-runtime-client.js +41 -0
- package/dist/store/runtime-clients/thread-list-item-runtime-client.js.map +1 -0
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts +10 -0
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -0
- package/dist/store/runtime-clients/thread-list-runtime-client.js +54 -0
- package/dist/store/runtime-clients/thread-list-runtime-client.js.map +1 -0
- package/dist/store/runtime-clients/thread-runtime-client.d.ts +8 -0
- package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -0
- package/dist/store/runtime-clients/thread-runtime-client.js +91 -0
- package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -0
- package/dist/store/scopes/attachment.d.ts +23 -0
- package/dist/store/scopes/attachment.d.ts.map +1 -0
- package/dist/store/scopes/attachment.js +2 -0
- package/dist/store/scopes/attachment.js.map +1 -0
- package/dist/store/scopes/chain-of-thought.d.ts +39 -0
- package/dist/store/scopes/chain-of-thought.d.ts.map +1 -0
- package/dist/store/scopes/chain-of-thought.js +2 -0
- package/dist/store/scopes/chain-of-thought.js.map +1 -0
- package/dist/store/scopes/composer.d.ts +75 -0
- package/dist/store/scopes/composer.d.ts.map +1 -0
- package/dist/store/scopes/composer.js +2 -0
- package/dist/store/scopes/composer.js.map +1 -0
- package/dist/store/scopes/index.d.ts +12 -0
- package/dist/store/scopes/index.d.ts.map +1 -0
- package/dist/store/scopes/index.js +2 -0
- package/dist/store/scopes/index.js.map +1 -0
- package/dist/store/scopes/message.d.ts +86 -0
- package/dist/store/scopes/message.d.ts.map +1 -0
- package/dist/store/scopes/message.js +2 -0
- package/dist/store/scopes/message.js.map +1 -0
- package/dist/store/scopes/model-context.d.ts +11 -0
- package/dist/store/scopes/model-context.d.ts.map +1 -0
- package/dist/store/scopes/model-context.js +2 -0
- package/dist/store/scopes/model-context.js.map +1 -0
- package/dist/store/scopes/part.d.ts +44 -0
- package/dist/store/scopes/part.d.ts.map +1 -0
- package/dist/store/scopes/part.js +2 -0
- package/dist/store/scopes/part.js.map +1 -0
- package/dist/store/scopes/suggestion.d.ts +19 -0
- package/dist/store/scopes/suggestion.d.ts.map +1 -0
- package/dist/store/scopes/suggestion.js +2 -0
- package/dist/store/scopes/suggestion.js.map +1 -0
- package/dist/store/scopes/suggestions.d.ts +19 -0
- package/dist/store/scopes/suggestions.d.ts.map +1 -0
- package/dist/store/scopes/suggestions.js +2 -0
- package/dist/store/scopes/suggestions.js.map +1 -0
- package/dist/store/scopes/thread-list-item.d.ts +50 -0
- package/dist/store/scopes/thread-list-item.d.ts.map +1 -0
- package/dist/store/scopes/thread-list-item.js +2 -0
- package/dist/store/scopes/thread-list-item.js.map +1 -0
- package/dist/store/scopes/thread.d.ts +135 -0
- package/dist/store/scopes/thread.d.ts.map +1 -0
- package/dist/store/scopes/thread.js +2 -0
- package/dist/store/scopes/thread.js.map +1 -0
- package/dist/store/scopes/threads.d.ts +29 -0
- package/dist/store/scopes/threads.d.ts.map +1 -0
- package/dist/store/scopes/threads.js +2 -0
- package/dist/store/scopes/threads.js.map +1 -0
- package/dist/store/types/client.d.ts +137 -0
- package/dist/store/types/client.d.ts.map +1 -0
- package/dist/store/types/client.js +2 -0
- package/dist/store/types/client.js.map +1 -0
- package/dist/store/types/events.d.ts +33 -0
- package/dist/store/types/events.d.ts.map +1 -0
- package/dist/store/types/events.js +8 -0
- package/dist/store/types/events.js.map +1 -0
- package/dist/store/types/index.d.ts +3 -0
- package/dist/store/types/index.d.ts.map +1 -0
- package/dist/store/types/index.js +2 -0
- package/dist/store/types/index.js.map +1 -0
- package/dist/store/utils/attach-transform-scopes.d.ts +11 -0
- package/dist/store/utils/attach-transform-scopes.d.ts.map +1 -0
- package/dist/store/utils/attach-transform-scopes.js +12 -0
- package/dist/store/utils/attach-transform-scopes.js.map +1 -0
- package/dist/store/utils/base-proxy-handler.d.ts +23 -0
- package/dist/store/utils/base-proxy-handler.d.ts.map +1 -0
- package/dist/store/utils/base-proxy-handler.js +46 -0
- package/dist/store/utils/base-proxy-handler.js.map +1 -0
- package/dist/store/utils/derived.d.ts +34 -0
- package/dist/store/utils/derived.d.ts.map +1 -0
- package/dist/store/utils/derived.js +24 -0
- package/dist/store/utils/derived.js.map +1 -0
- package/dist/store/utils/index.d.ts +7 -0
- package/dist/store/utils/index.d.ts.map +1 -0
- package/dist/store/utils/index.js +7 -0
- package/dist/store/utils/index.js.map +1 -0
- package/dist/store/utils/notification-manager.d.ts +11 -0
- package/dist/store/utils/notification-manager.d.ts.map +1 -0
- package/dist/store/utils/notification-manager.js +84 -0
- package/dist/store/utils/notification-manager.js.map +1 -0
- package/dist/store/utils/proxied-assistant-state.d.ts +8 -0
- package/dist/store/utils/proxied-assistant-state.d.ts.map +1 -0
- package/dist/store/utils/proxied-assistant-state.js +33 -0
- package/dist/store/utils/proxied-assistant-state.js.map +1 -0
- package/dist/store/utils/split-clients.d.ts +10 -0
- package/dist/store/utils/split-clients.d.ts.map +1 -0
- package/dist/store/utils/split-clients.js +53 -0
- package/dist/store/utils/split-clients.js.map +1 -0
- package/dist/store/utils/tap-assistant-context.d.ts +19 -0
- package/dist/store/utils/tap-assistant-context.d.ts.map +1 -0
- package/dist/store/utils/tap-assistant-context.js +23 -0
- package/dist/store/utils/tap-assistant-context.js.map +1 -0
- package/dist/store/utils/tap-client-list.d.ts +28 -0
- package/dist/store/utils/tap-client-list.d.ts.map +1 -0
- package/dist/store/utils/tap-client-list.js +68 -0
- package/dist/store/utils/tap-client-list.js.map +1 -0
- package/dist/store/utils/tap-client-lookup.d.ts +15 -0
- package/dist/store/utils/tap-client-lookup.d.ts.map +1 -0
- package/dist/store/utils/tap-client-lookup.js +42 -0
- package/dist/store/utils/tap-client-lookup.js.map +1 -0
- package/dist/store/utils/tap-client-resource.d.ts +13 -0
- package/dist/store/utils/tap-client-resource.d.ts.map +1 -0
- package/dist/store/utils/tap-client-resource.js +114 -0
- package/dist/store/utils/tap-client-resource.js.map +1 -0
- package/dist/store/utils/tap-client-stack-context.d.ts +23 -0
- package/dist/store/utils/tap-client-stack-context.d.ts.map +1 -0
- package/dist/store/utils/tap-client-stack-context.js +28 -0
- package/dist/store/utils/tap-client-stack-context.js.map +1 -0
- package/dist/store/utils/wrapper-resource.d.ts +3 -0
- package/dist/store/utils/wrapper-resource.d.ts.map +1 -0
- package/dist/store/utils/wrapper-resource.js +11 -0
- package/dist/store/utils/wrapper-resource.js.map +1 -0
- package/dist/subscribable/index.d.ts +3 -0
- package/dist/subscribable/index.d.ts.map +1 -0
- package/dist/subscribable/index.js +8 -0
- package/dist/subscribable/index.js.map +1 -0
- package/dist/subscribable/subscribable.d.ts +68 -0
- package/dist/subscribable/subscribable.d.ts.map +1 -0
- package/dist/subscribable/subscribable.js +237 -0
- package/dist/subscribable/subscribable.js.map +1 -0
- package/dist/types/attachment.d.ts +35 -0
- package/dist/types/attachment.d.ts.map +1 -0
- package/dist/types/attachment.js +2 -0
- package/dist/types/attachment.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/message.d.ts +179 -0
- package/dist/types/message.d.ts.map +1 -0
- package/dist/types/message.js +2 -0
- package/dist/types/message.js.map +1 -0
- package/dist/types/quote.d.ts +5 -0
- package/dist/types/quote.d.ts.map +1 -0
- package/dist/types/quote.js +2 -0
- package/dist/types/quote.js.map +1 -0
- package/dist/types/unsubscribe.d.ts +2 -0
- package/dist/types/unsubscribe.d.ts.map +1 -0
- package/dist/types/unsubscribe.js +2 -0
- package/dist/types/unsubscribe.js.map +1 -0
- package/dist/utils/composite-context-provider.d.ts +10 -0
- package/dist/utils/composite-context-provider.d.ts.map +1 -0
- package/dist/utils/composite-context-provider.js +29 -0
- package/dist/utils/composite-context-provider.js.map +1 -0
- package/dist/utils/id.d.ts +6 -0
- package/dist/utils/id.d.ts.map +1 -0
- package/dist/utils/id.js +9 -0
- package/dist/utils/id.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/text.d.ts +3 -0
- package/dist/utils/text.d.ts.map +1 -0
- package/dist/utils/text.js +5 -0
- package/dist/utils/text.js.map +1 -0
- package/package.json +85 -0
- package/src/adapters/attachment.ts +209 -0
- package/src/adapters/feedback.ts +10 -0
- package/src/adapters/index.ts +30 -0
- package/src/adapters/speech.ts +338 -0
- package/src/adapters/suggestion.ts +14 -0
- package/src/adapters/thread-history.ts +72 -0
- package/src/index.ts +7 -0
- package/src/internal.ts +7 -0
- package/src/model-context/frame/host.ts +195 -0
- package/src/model-context/frame/index.ts +10 -0
- package/src/model-context/frame/provider.ts +193 -0
- package/src/model-context/frame/types.ts +40 -0
- package/src/model-context/index.ts +35 -0
- package/src/model-context/registry-handles.ts +18 -0
- package/src/model-context/registry.ts +159 -0
- package/src/model-context/tool.ts +9 -0
- package/src/model-context/types.ts +104 -0
- package/src/runtime/api/assistant-runtime.ts +115 -0
- package/src/runtime/api/attachment-runtime.ts +119 -0
- package/src/runtime/api/bindings.ts +49 -0
- package/src/runtime/api/composer-runtime.ts +505 -0
- package/src/runtime/api/message-part-runtime.ts +108 -0
- package/src/runtime/api/message-runtime.ts +335 -0
- package/src/runtime/api/paths.ts +61 -0
- package/src/runtime/api/thread-list-item-runtime.ts +145 -0
- package/src/runtime/api/thread-list-runtime.ts +227 -0
- package/src/runtime/api/thread-runtime.ts +568 -0
- package/src/runtime/base/base-assistant-runtime-core.ts +20 -0
- package/src/runtime/base/base-composer-runtime-core.ts +418 -0
- package/src/runtime/base/base-thread-runtime-core.ts +234 -0
- package/src/runtime/base/default-edit-composer-runtime-core.ts +71 -0
- package/src/runtime/base/default-thread-composer-runtime-core.ts +65 -0
- package/src/runtime/index.ts +108 -0
- package/src/runtime/interfaces/assistant-runtime-core.ts +12 -0
- package/src/runtime/interfaces/composer-runtime-core.ts +64 -0
- package/src/runtime/interfaces/thread-list-runtime-core.ts +49 -0
- package/src/runtime/interfaces/thread-runtime-core.ts +142 -0
- package/src/runtime/internal.ts +64 -0
- package/src/runtime/utils/auto-status.ts +67 -0
- package/src/runtime/utils/chat-model-adapter.ts +66 -0
- package/src/runtime/utils/external-store-message.ts +37 -0
- package/src/runtime/utils/message-repository.ts +390 -0
- package/src/runtime/utils/thread-message-like.ts +225 -0
- package/src/runtimes/assistant-transport/utils.ts +37 -0
- package/src/runtimes/external-store/external-store-adapter.ts +111 -0
- package/src/runtimes/external-store/external-store-runtime-core.ts +26 -0
- package/src/runtimes/external-store/external-store-thread-list-runtime-core.ts +235 -0
- package/src/runtimes/external-store/external-store-thread-runtime-core.ts +368 -0
- package/src/runtimes/external-store/index.ts +15 -0
- package/src/runtimes/external-store/thread-message-converter.ts +23 -0
- package/src/runtimes/index.ts +28 -0
- package/src/runtimes/internal.ts +36 -0
- package/src/runtimes/local/index.ts +6 -0
- package/src/runtimes/local/local-runtime-core.ts +32 -0
- package/src/runtimes/local/local-runtime-options.ts +27 -0
- package/src/runtimes/local/local-thread-list-runtime-core.ts +116 -0
- package/src/runtimes/local/local-thread-runtime-core.ts +534 -0
- package/src/runtimes/local/should-continue.ts +26 -0
- package/src/runtimes/remote-thread-list/adapter/in-memory.ts +43 -0
- package/src/runtimes/remote-thread-list/empty-thread-core.ts +200 -0
- package/src/runtimes/remote-thread-list/optimistic-state.ts +89 -0
- package/src/runtimes/remote-thread-list/remote-thread-state.ts +123 -0
- package/src/runtimes/remote-thread-list/types.ts +48 -0
- package/src/store/clients/chain-of-thought-client.ts +40 -0
- package/src/store/clients/index.ts +8 -0
- package/src/store/clients/model-context-client.ts +20 -0
- package/src/store/clients/no-op-composer-client.ts +66 -0
- package/src/store/clients/suggestions.ts +69 -0
- package/src/store/clients/thread-message-client.ts +170 -0
- package/src/store/index.ts +44 -0
- package/src/store/internal.ts +32 -0
- package/src/store/runtime-clients/attachment-runtime-client.ts +16 -0
- package/src/store/runtime-clients/composer-runtime-client.ts +131 -0
- package/src/store/runtime-clients/index.ts +7 -0
- package/src/store/runtime-clients/message-part-runtime-client.ts +17 -0
- package/src/store/runtime-clients/message-runtime-client.ts +141 -0
- package/src/store/runtime-clients/tap-subscribable.ts +16 -0
- package/src/store/runtime-clients/thread-list-item-runtime-client.ts +53 -0
- package/src/store/runtime-clients/thread-list-runtime-client.ts +86 -0
- package/src/store/runtime-clients/thread-runtime-client.ts +141 -0
- package/src/store/scopes/attachment.ts +20 -0
- package/src/store/scopes/chain-of-thought.ts +38 -0
- package/src/store/scopes/composer.ts +80 -0
- package/src/store/scopes/index.ts +68 -0
- package/src/store/scopes/message.ts +75 -0
- package/src/store/scopes/model-context.ts +13 -0
- package/src/store/scopes/part.ts +47 -0
- package/src/store/scopes/suggestion.ts +19 -0
- package/src/store/scopes/suggestions.ts +20 -0
- package/src/store/scopes/thread-list-item.ts +44 -0
- package/src/store/scopes/thread.ts +135 -0
- package/src/store/scopes/threads.ts +34 -0
- package/src/store/types/client.ts +203 -0
- package/src/store/types/events.ts +77 -0
- package/src/store/types/index.ts +23 -0
- package/src/store/utils/attach-transform-scopes.ts +38 -0
- package/src/store/utils/base-proxy-handler.ts +50 -0
- package/src/store/utils/derived.ts +46 -0
- package/src/store/utils/index.ts +28 -0
- package/src/store/utils/notification-manager.ts +114 -0
- package/src/store/utils/proxied-assistant-state.ts +55 -0
- package/src/store/utils/split-clients.ts +82 -0
- package/src/store/utils/tap-assistant-context.ts +58 -0
- package/src/store/utils/tap-client-list.ts +121 -0
- package/src/store/utils/tap-client-lookup.ts +79 -0
- package/src/store/utils/tap-client-resource.ts +187 -0
- package/src/store/utils/tap-client-stack-context.ts +51 -0
- package/src/store/utils/wrapper-resource.ts +17 -0
- package/src/subscribable/index.ts +21 -0
- package/src/subscribable/subscribable.ts +317 -0
- package/src/tests/BaseSubscribable.test.ts +54 -0
- package/src/tests/MessageRepository.test.ts +607 -0
- package/src/tests/OptimisticState-delete-crash.test.ts +206 -0
- package/src/types/attachment.ts +45 -0
- package/src/types/index.ts +39 -0
- package/src/types/message.ts +248 -0
- package/src/types/quote.ts +4 -0
- package/src/types/unsubscribe.ts +1 -0
- package/src/utils/composite-context-provider.ts +36 -0
- package/src/utils/id.ts +14 -0
- package/src/utils/index.ts +14 -0
- package/src/utils/text.ts +11 -0
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Attachment,
|
|
3
|
+
CompleteAttachment,
|
|
4
|
+
PendingAttachment,
|
|
5
|
+
MessageRole,
|
|
6
|
+
RunConfig,
|
|
7
|
+
QuoteInfo,
|
|
8
|
+
AppendMessage,
|
|
9
|
+
Unsubscribe,
|
|
10
|
+
} from "../../types";
|
|
11
|
+
import { BaseSubscribable } from "../../subscribable";
|
|
12
|
+
import type { AttachmentAdapter } from "../../adapters/attachment";
|
|
13
|
+
import type {
|
|
14
|
+
ComposerRuntimeCore,
|
|
15
|
+
ComposerRuntimeEventType,
|
|
16
|
+
DictationState,
|
|
17
|
+
} from "../interfaces/composer-runtime-core";
|
|
18
|
+
import type { DictationAdapter } from "../../adapters/speech";
|
|
19
|
+
|
|
20
|
+
const isAttachmentComplete = (a: Attachment): a is CompleteAttachment =>
|
|
21
|
+
a.status.type === "complete";
|
|
22
|
+
|
|
23
|
+
export abstract class BaseComposerRuntimeCore
|
|
24
|
+
extends BaseSubscribable
|
|
25
|
+
implements ComposerRuntimeCore
|
|
26
|
+
{
|
|
27
|
+
public readonly isEditing = true;
|
|
28
|
+
|
|
29
|
+
protected abstract getAttachmentAdapter(): AttachmentAdapter | undefined;
|
|
30
|
+
protected abstract getDictationAdapter(): DictationAdapter | undefined;
|
|
31
|
+
|
|
32
|
+
public get attachmentAccept(): string {
|
|
33
|
+
return this.getAttachmentAdapter()?.accept ?? "*";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private _attachments: readonly Attachment[] = [];
|
|
37
|
+
public get attachments() {
|
|
38
|
+
return this._attachments;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
protected setAttachments(value: readonly Attachment[]) {
|
|
42
|
+
this._attachments = value;
|
|
43
|
+
this._notifySubscribers();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public abstract get canCancel(): boolean;
|
|
47
|
+
|
|
48
|
+
public get isEmpty() {
|
|
49
|
+
return !this.text.trim() && !this.attachments.length;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private _text = "";
|
|
53
|
+
|
|
54
|
+
get text() {
|
|
55
|
+
return this._text;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private _role: MessageRole = "user";
|
|
59
|
+
|
|
60
|
+
get role() {
|
|
61
|
+
return this._role;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private _runConfig: RunConfig = {};
|
|
65
|
+
|
|
66
|
+
get runConfig() {
|
|
67
|
+
return this._runConfig;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private _quote: QuoteInfo | undefined = undefined;
|
|
71
|
+
|
|
72
|
+
get quote() {
|
|
73
|
+
return this._quote;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public setQuote(quote: QuoteInfo | undefined) {
|
|
77
|
+
if (this._quote === quote) return;
|
|
78
|
+
|
|
79
|
+
this._quote = quote;
|
|
80
|
+
this._notifySubscribers();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public setText(value: string) {
|
|
84
|
+
if (this._text === value) return;
|
|
85
|
+
|
|
86
|
+
this._text = value;
|
|
87
|
+
if (this._dictation) {
|
|
88
|
+
this._dictationBaseText = value;
|
|
89
|
+
this._currentInterimText = "";
|
|
90
|
+
const { status, inputDisabled } = this._dictation;
|
|
91
|
+
this._dictation = inputDisabled ? { status, inputDisabled } : { status };
|
|
92
|
+
}
|
|
93
|
+
this._notifySubscribers();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
public setRole(role: MessageRole) {
|
|
97
|
+
if (this._role === role) return;
|
|
98
|
+
|
|
99
|
+
this._role = role;
|
|
100
|
+
this._notifySubscribers();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public setRunConfig(runConfig: RunConfig) {
|
|
104
|
+
if (this._runConfig === runConfig) return;
|
|
105
|
+
|
|
106
|
+
this._runConfig = runConfig;
|
|
107
|
+
this._notifySubscribers();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private _emptyTextAndAttachments() {
|
|
111
|
+
this._attachments = [];
|
|
112
|
+
this._text = "";
|
|
113
|
+
this._notifySubscribers();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
private async _onClearAttachments() {
|
|
117
|
+
const adapter = this.getAttachmentAdapter();
|
|
118
|
+
if (adapter) {
|
|
119
|
+
await Promise.all(this._attachments.map((a) => adapter.remove(a)));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
public async reset() {
|
|
124
|
+
if (
|
|
125
|
+
this._attachments.length === 0 &&
|
|
126
|
+
this._text === "" &&
|
|
127
|
+
this._role === "user" &&
|
|
128
|
+
Object.keys(this._runConfig).length === 0 &&
|
|
129
|
+
this._quote === undefined
|
|
130
|
+
) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
this._role = "user";
|
|
135
|
+
this._runConfig = {};
|
|
136
|
+
this._quote = undefined;
|
|
137
|
+
|
|
138
|
+
const task = this._onClearAttachments();
|
|
139
|
+
this._emptyTextAndAttachments();
|
|
140
|
+
await task;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
public async clearAttachments() {
|
|
144
|
+
const task = this._onClearAttachments();
|
|
145
|
+
this.setAttachments([]);
|
|
146
|
+
|
|
147
|
+
await task;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
public async send() {
|
|
151
|
+
if (this._dictationSession) {
|
|
152
|
+
this._dictationSession.cancel();
|
|
153
|
+
this._cleanupDictation();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const adapter = this.getAttachmentAdapter();
|
|
157
|
+
const attachments =
|
|
158
|
+
adapter && this.attachments.length > 0
|
|
159
|
+
? Promise.all(
|
|
160
|
+
this.attachments.map(async (a) => {
|
|
161
|
+
if (isAttachmentComplete(a)) return a;
|
|
162
|
+
const result = await adapter.send(a);
|
|
163
|
+
return result as CompleteAttachment;
|
|
164
|
+
}),
|
|
165
|
+
)
|
|
166
|
+
: [];
|
|
167
|
+
|
|
168
|
+
const text = this.text;
|
|
169
|
+
const quote = this._quote;
|
|
170
|
+
this._quote = undefined;
|
|
171
|
+
this._emptyTextAndAttachments();
|
|
172
|
+
|
|
173
|
+
const message: Omit<AppendMessage, "parentId" | "sourceId"> = {
|
|
174
|
+
createdAt: new Date(),
|
|
175
|
+
role: this.role,
|
|
176
|
+
content: text ? [{ type: "text", text }] : [],
|
|
177
|
+
attachments: await attachments,
|
|
178
|
+
runConfig: this.runConfig,
|
|
179
|
+
metadata: { custom: { ...(quote ? { quote } : {}) } },
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
this.handleSend(message);
|
|
183
|
+
this._notifyEventSubscribers("send");
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
public cancel() {
|
|
187
|
+
this.handleCancel();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
protected abstract handleSend(
|
|
191
|
+
message: Omit<AppendMessage, "parentId" | "sourceId">,
|
|
192
|
+
): void;
|
|
193
|
+
protected abstract handleCancel(): void;
|
|
194
|
+
|
|
195
|
+
async addAttachment(file: File) {
|
|
196
|
+
const adapter = this.getAttachmentAdapter();
|
|
197
|
+
if (!adapter) throw new Error("Attachments are not supported");
|
|
198
|
+
|
|
199
|
+
const upsertAttachment = (a: PendingAttachment) => {
|
|
200
|
+
const idx = this._attachments.findIndex(
|
|
201
|
+
(attachment) => attachment.id === a.id,
|
|
202
|
+
);
|
|
203
|
+
if (idx !== -1)
|
|
204
|
+
this._attachments = [
|
|
205
|
+
...this._attachments.slice(0, idx),
|
|
206
|
+
a,
|
|
207
|
+
...this._attachments.slice(idx + 1),
|
|
208
|
+
];
|
|
209
|
+
else {
|
|
210
|
+
this._attachments = [...this._attachments, a];
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
this._notifySubscribers();
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const promiseOrGenerator = adapter.add({ file });
|
|
217
|
+
if (Symbol.asyncIterator in promiseOrGenerator) {
|
|
218
|
+
for await (const r of promiseOrGenerator) {
|
|
219
|
+
upsertAttachment(r);
|
|
220
|
+
}
|
|
221
|
+
} else {
|
|
222
|
+
upsertAttachment(await promiseOrGenerator);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
this._notifyEventSubscribers("attachmentAdd");
|
|
226
|
+
this._notifySubscribers();
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
async removeAttachment(attachmentId: string) {
|
|
230
|
+
const adapter = this.getAttachmentAdapter();
|
|
231
|
+
if (!adapter) throw new Error("Attachments are not supported");
|
|
232
|
+
|
|
233
|
+
const index = this._attachments.findIndex((a) => a.id === attachmentId);
|
|
234
|
+
if (index === -1) throw new Error("Attachment not found");
|
|
235
|
+
const attachment = this._attachments[index]!;
|
|
236
|
+
|
|
237
|
+
await adapter.remove(attachment);
|
|
238
|
+
|
|
239
|
+
this._attachments = this._attachments.filter((a) => a.id !== attachmentId);
|
|
240
|
+
this._notifySubscribers();
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
private _dictation: DictationState | undefined;
|
|
244
|
+
private _dictationSession: DictationAdapter.Session | undefined;
|
|
245
|
+
private _dictationUnsubscribes: Unsubscribe[] = [];
|
|
246
|
+
private _dictationBaseText = "";
|
|
247
|
+
private _currentInterimText = "";
|
|
248
|
+
private _dictationSessionIdCounter = 0;
|
|
249
|
+
private _activeDictationSessionId: number | undefined;
|
|
250
|
+
private _isCleaningDictation = false;
|
|
251
|
+
|
|
252
|
+
public get dictation(): DictationState | undefined {
|
|
253
|
+
return this._dictation;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
private _isActiveSession(
|
|
257
|
+
sessionId: number,
|
|
258
|
+
session: DictationAdapter.Session,
|
|
259
|
+
): boolean {
|
|
260
|
+
return (
|
|
261
|
+
this._activeDictationSessionId === sessionId &&
|
|
262
|
+
this._dictationSession === session
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
public startDictation(): void {
|
|
267
|
+
const adapter = this.getDictationAdapter();
|
|
268
|
+
if (!adapter) {
|
|
269
|
+
throw new Error("Dictation adapter not configured");
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (this._dictationSession) {
|
|
273
|
+
for (const unsub of this._dictationUnsubscribes) {
|
|
274
|
+
unsub();
|
|
275
|
+
}
|
|
276
|
+
this._dictationUnsubscribes = [];
|
|
277
|
+
const oldSession = this._dictationSession;
|
|
278
|
+
oldSession.stop().catch(() => {});
|
|
279
|
+
this._dictationSession = undefined;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const inputDisabled = adapter.disableInputDuringDictation ?? false;
|
|
283
|
+
|
|
284
|
+
this._dictationBaseText = this._text;
|
|
285
|
+
this._currentInterimText = "";
|
|
286
|
+
|
|
287
|
+
const session = adapter.listen();
|
|
288
|
+
this._dictationSession = session;
|
|
289
|
+
const sessionId = ++this._dictationSessionIdCounter;
|
|
290
|
+
this._activeDictationSessionId = sessionId;
|
|
291
|
+
this._dictation = { status: session.status, inputDisabled };
|
|
292
|
+
this._notifySubscribers();
|
|
293
|
+
|
|
294
|
+
const unsubSpeech = session.onSpeech((result) => {
|
|
295
|
+
if (!this._isActiveSession(sessionId, session)) return;
|
|
296
|
+
const isFinal = result.isFinal !== false;
|
|
297
|
+
|
|
298
|
+
const needsSeparator =
|
|
299
|
+
this._dictationBaseText &&
|
|
300
|
+
!this._dictationBaseText.endsWith(" ") &&
|
|
301
|
+
result.transcript;
|
|
302
|
+
const separator = needsSeparator ? " " : "";
|
|
303
|
+
|
|
304
|
+
if (isFinal) {
|
|
305
|
+
this._dictationBaseText =
|
|
306
|
+
this._dictationBaseText + separator + result.transcript;
|
|
307
|
+
this._currentInterimText = "";
|
|
308
|
+
this._text = this._dictationBaseText;
|
|
309
|
+
|
|
310
|
+
if (this._dictation) {
|
|
311
|
+
const { transcript: _, ...rest } = this._dictation;
|
|
312
|
+
this._dictation = rest;
|
|
313
|
+
}
|
|
314
|
+
this._notifySubscribers();
|
|
315
|
+
} else {
|
|
316
|
+
this._currentInterimText = separator + result.transcript;
|
|
317
|
+
this._text = this._dictationBaseText + this._currentInterimText;
|
|
318
|
+
|
|
319
|
+
if (this._dictation) {
|
|
320
|
+
this._dictation = {
|
|
321
|
+
...this._dictation,
|
|
322
|
+
transcript: result.transcript,
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
this._notifySubscribers();
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
this._dictationUnsubscribes.push(unsubSpeech);
|
|
329
|
+
|
|
330
|
+
const unsubStart = session.onSpeechStart(() => {
|
|
331
|
+
if (!this._isActiveSession(sessionId, session)) return;
|
|
332
|
+
|
|
333
|
+
this._dictation = {
|
|
334
|
+
status: { type: "running" },
|
|
335
|
+
inputDisabled,
|
|
336
|
+
...(this._dictation?.transcript && {
|
|
337
|
+
transcript: this._dictation.transcript,
|
|
338
|
+
}),
|
|
339
|
+
};
|
|
340
|
+
this._notifySubscribers();
|
|
341
|
+
});
|
|
342
|
+
this._dictationUnsubscribes.push(unsubStart);
|
|
343
|
+
|
|
344
|
+
const unsubEnd = session.onSpeechEnd(() => {
|
|
345
|
+
this._cleanupDictation({ sessionId });
|
|
346
|
+
});
|
|
347
|
+
this._dictationUnsubscribes.push(unsubEnd);
|
|
348
|
+
|
|
349
|
+
const statusInterval = setInterval(() => {
|
|
350
|
+
if (!this._isActiveSession(sessionId, session)) return;
|
|
351
|
+
|
|
352
|
+
if (session.status.type === "ended") {
|
|
353
|
+
this._cleanupDictation({ sessionId });
|
|
354
|
+
}
|
|
355
|
+
}, 100);
|
|
356
|
+
this._dictationUnsubscribes.push(() => clearInterval(statusInterval));
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
public stopDictation(): void {
|
|
360
|
+
if (!this._dictationSession) return;
|
|
361
|
+
|
|
362
|
+
const session = this._dictationSession;
|
|
363
|
+
const sessionId = this._activeDictationSessionId;
|
|
364
|
+
session.stop().finally(() => {
|
|
365
|
+
this._cleanupDictation({ sessionId });
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
private _cleanupDictation(options?: { sessionId: number | undefined }): void {
|
|
370
|
+
const isStaleSession =
|
|
371
|
+
options?.sessionId !== undefined &&
|
|
372
|
+
options.sessionId !== this._activeDictationSessionId;
|
|
373
|
+
if (isStaleSession || this._isCleaningDictation) return;
|
|
374
|
+
|
|
375
|
+
this._isCleaningDictation = true;
|
|
376
|
+
try {
|
|
377
|
+
for (const unsub of this._dictationUnsubscribes) {
|
|
378
|
+
unsub();
|
|
379
|
+
}
|
|
380
|
+
this._dictationUnsubscribes = [];
|
|
381
|
+
this._dictationSession = undefined;
|
|
382
|
+
this._activeDictationSessionId = undefined;
|
|
383
|
+
this._dictation = undefined;
|
|
384
|
+
this._dictationBaseText = "";
|
|
385
|
+
this._currentInterimText = "";
|
|
386
|
+
this._notifySubscribers();
|
|
387
|
+
} finally {
|
|
388
|
+
this._isCleaningDictation = false;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
private _eventSubscribers = new Map<
|
|
393
|
+
ComposerRuntimeEventType,
|
|
394
|
+
Set<() => void>
|
|
395
|
+
>();
|
|
396
|
+
|
|
397
|
+
protected _notifyEventSubscribers(event: ComposerRuntimeEventType) {
|
|
398
|
+
const subscribers = this._eventSubscribers.get(event);
|
|
399
|
+
if (!subscribers) return;
|
|
400
|
+
|
|
401
|
+
for (const callback of subscribers) callback();
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
public unstable_on(event: ComposerRuntimeEventType, callback: () => void) {
|
|
405
|
+
const subscribers = this._eventSubscribers.get(event);
|
|
406
|
+
if (!subscribers) {
|
|
407
|
+
this._eventSubscribers.set(event, new Set([callback]));
|
|
408
|
+
} else {
|
|
409
|
+
subscribers.add(callback);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
return () => {
|
|
413
|
+
const subscribers = this._eventSubscribers.get(event);
|
|
414
|
+
if (!subscribers) return;
|
|
415
|
+
subscribers.delete(callback);
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import type { AppendMessage, ThreadMessage, Unsubscribe } from "../../types";
|
|
2
|
+
import type { ModelContextProvider } from "../../model-context";
|
|
3
|
+
import { getThreadMessageText } from "../../utils/text";
|
|
4
|
+
import {
|
|
5
|
+
ExportedMessageRepository,
|
|
6
|
+
MessageRepository,
|
|
7
|
+
} from "../utils/message-repository";
|
|
8
|
+
import { DefaultThreadComposerRuntimeCore } from "./default-thread-composer-runtime-core";
|
|
9
|
+
import type {
|
|
10
|
+
AddToolResultOptions,
|
|
11
|
+
ResumeToolCallOptions,
|
|
12
|
+
ThreadSuggestion,
|
|
13
|
+
SubmitFeedbackOptions,
|
|
14
|
+
ThreadRuntimeCore,
|
|
15
|
+
SpeechState,
|
|
16
|
+
RuntimeCapabilities,
|
|
17
|
+
ThreadRuntimeEventType,
|
|
18
|
+
StartRunConfig,
|
|
19
|
+
ResumeRunConfig,
|
|
20
|
+
} from "../interfaces/thread-runtime-core";
|
|
21
|
+
import { DefaultEditComposerRuntimeCore } from "./default-edit-composer-runtime-core";
|
|
22
|
+
import type { SpeechSynthesisAdapter } from "../../adapters/speech";
|
|
23
|
+
import type { FeedbackAdapter } from "../../adapters/feedback";
|
|
24
|
+
import type { AttachmentAdapter } from "../../adapters/attachment";
|
|
25
|
+
import type { ThreadMessageLike } from "../utils/thread-message-like";
|
|
26
|
+
|
|
27
|
+
type BaseThreadAdapters = {
|
|
28
|
+
speech?: SpeechSynthesisAdapter | undefined;
|
|
29
|
+
feedback?: FeedbackAdapter | undefined;
|
|
30
|
+
attachments?: AttachmentAdapter | undefined;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore {
|
|
34
|
+
private _subscriptions = new Set<() => void>();
|
|
35
|
+
private _isInitialized = false;
|
|
36
|
+
|
|
37
|
+
protected readonly repository = new MessageRepository();
|
|
38
|
+
public abstract get adapters(): BaseThreadAdapters | undefined;
|
|
39
|
+
public abstract get isDisabled(): boolean;
|
|
40
|
+
public abstract get isLoading(): boolean;
|
|
41
|
+
public abstract get suggestions(): readonly ThreadSuggestion[];
|
|
42
|
+
public abstract get extras(): unknown;
|
|
43
|
+
|
|
44
|
+
public abstract get capabilities(): RuntimeCapabilities;
|
|
45
|
+
public abstract append(message: AppendMessage): void;
|
|
46
|
+
public abstract startRun(config: StartRunConfig): void;
|
|
47
|
+
public abstract resumeRun(config: ResumeRunConfig): void;
|
|
48
|
+
public abstract addToolResult(options: AddToolResultOptions): void;
|
|
49
|
+
public abstract resumeToolCall(options: ResumeToolCallOptions): void;
|
|
50
|
+
public abstract cancelRun(): void;
|
|
51
|
+
public abstract exportExternalState(): any;
|
|
52
|
+
public abstract importExternalState(state: any): void;
|
|
53
|
+
public abstract unstable_loadExternalState(state: any): void;
|
|
54
|
+
|
|
55
|
+
public get messages() {
|
|
56
|
+
return this.repository.getMessages();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public get state() {
|
|
60
|
+
let mostRecentAssistantMessage;
|
|
61
|
+
for (const message of this.messages) {
|
|
62
|
+
if (message.role === "assistant") {
|
|
63
|
+
mostRecentAssistantMessage = message;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return mostRecentAssistantMessage?.metadata.unstable_state ?? null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public readonly composer = new DefaultThreadComposerRuntimeCore(this);
|
|
71
|
+
|
|
72
|
+
constructor(private readonly _contextProvider: ModelContextProvider) {}
|
|
73
|
+
|
|
74
|
+
public getModelContext() {
|
|
75
|
+
return this._contextProvider.getModelContext();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private _editComposers = new Map<string, DefaultEditComposerRuntimeCore>();
|
|
79
|
+
public getEditComposer(messageId: string) {
|
|
80
|
+
return this._editComposers.get(messageId);
|
|
81
|
+
}
|
|
82
|
+
public beginEdit(messageId: string) {
|
|
83
|
+
if (this._editComposers.has(messageId))
|
|
84
|
+
throw new Error("Edit already in progress");
|
|
85
|
+
|
|
86
|
+
this._editComposers.set(
|
|
87
|
+
messageId,
|
|
88
|
+
new DefaultEditComposerRuntimeCore(
|
|
89
|
+
this,
|
|
90
|
+
() => this._editComposers.delete(messageId),
|
|
91
|
+
this.repository.getMessage(messageId),
|
|
92
|
+
),
|
|
93
|
+
);
|
|
94
|
+
this._notifySubscribers();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public getMessageById(messageId: string) {
|
|
98
|
+
try {
|
|
99
|
+
return this.repository.getMessage(messageId);
|
|
100
|
+
} catch {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
public getBranches(messageId: string): string[] {
|
|
106
|
+
return this.repository.getBranches(messageId);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
public switchToBranch(branchId: string): void {
|
|
110
|
+
this.repository.switchToBranch(branchId);
|
|
111
|
+
this._notifySubscribers();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
protected _notifySubscribers() {
|
|
115
|
+
for (const callback of this._subscriptions) callback();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public _notifyEventSubscribers(event: ThreadRuntimeEventType) {
|
|
119
|
+
const subscribers = this._eventSubscribers.get(event);
|
|
120
|
+
if (!subscribers) return;
|
|
121
|
+
|
|
122
|
+
for (const callback of subscribers) callback();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public subscribe(callback: () => void): Unsubscribe {
|
|
126
|
+
this._subscriptions.add(callback);
|
|
127
|
+
return () => this._subscriptions.delete(callback);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
public submitFeedback({ messageId, type }: SubmitFeedbackOptions) {
|
|
131
|
+
const adapter = this.adapters?.feedback;
|
|
132
|
+
if (!adapter) throw new Error("Feedback adapter not configured");
|
|
133
|
+
|
|
134
|
+
const { message, parentId } = this.repository.getMessage(messageId);
|
|
135
|
+
adapter.submit({ message, type });
|
|
136
|
+
|
|
137
|
+
if (message.role === "assistant") {
|
|
138
|
+
const updatedMessage: ThreadMessage = {
|
|
139
|
+
...message,
|
|
140
|
+
metadata: {
|
|
141
|
+
...message.metadata,
|
|
142
|
+
submittedFeedback: { type },
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
this.repository.addOrUpdateMessage(parentId, updatedMessage);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
this._notifySubscribers();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private _stopSpeaking: Unsubscribe | undefined;
|
|
152
|
+
public speech: SpeechState | undefined;
|
|
153
|
+
|
|
154
|
+
public speak(messageId: string) {
|
|
155
|
+
const adapter = this.adapters?.speech;
|
|
156
|
+
if (!adapter) throw new Error("Speech adapter not configured");
|
|
157
|
+
|
|
158
|
+
const { message } = this.repository.getMessage(messageId);
|
|
159
|
+
|
|
160
|
+
this._stopSpeaking?.();
|
|
161
|
+
|
|
162
|
+
const utterance = adapter.speak(getThreadMessageText(message));
|
|
163
|
+
const unsub = utterance.subscribe(() => {
|
|
164
|
+
if (utterance.status.type === "ended") {
|
|
165
|
+
this._stopSpeaking = undefined;
|
|
166
|
+
this.speech = undefined;
|
|
167
|
+
} else {
|
|
168
|
+
this.speech = { messageId, status: utterance.status };
|
|
169
|
+
}
|
|
170
|
+
this._notifySubscribers();
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
this.speech = { messageId, status: utterance.status };
|
|
174
|
+
this._notifySubscribers();
|
|
175
|
+
|
|
176
|
+
this._stopSpeaking = () => {
|
|
177
|
+
utterance.cancel();
|
|
178
|
+
unsub();
|
|
179
|
+
this.speech = undefined;
|
|
180
|
+
this._stopSpeaking = undefined;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
public stopSpeaking() {
|
|
185
|
+
if (!this._stopSpeaking) throw new Error("No message is being spoken");
|
|
186
|
+
this._stopSpeaking();
|
|
187
|
+
this._notifySubscribers();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
protected ensureInitialized() {
|
|
191
|
+
if (!this._isInitialized) {
|
|
192
|
+
this._isInitialized = true;
|
|
193
|
+
this._notifyEventSubscribers("initialize");
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
public export() {
|
|
198
|
+
return this.repository.export();
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
public import(data: ExportedMessageRepository) {
|
|
202
|
+
this.ensureInitialized();
|
|
203
|
+
this.repository.clear();
|
|
204
|
+
this.repository.import(data);
|
|
205
|
+
this._notifySubscribers();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
public reset(initialMessages?: readonly ThreadMessageLike[]) {
|
|
209
|
+
this.import(ExportedMessageRepository.fromArray(initialMessages ?? []));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
private _eventSubscribers = new Map<
|
|
213
|
+
ThreadRuntimeEventType,
|
|
214
|
+
Set<() => void>
|
|
215
|
+
>();
|
|
216
|
+
|
|
217
|
+
public unstable_on(event: ThreadRuntimeEventType, callback: () => void) {
|
|
218
|
+
if (event === "modelContextUpdate") {
|
|
219
|
+
return this._contextProvider.subscribe?.(callback) ?? (() => {});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const subscribers = this._eventSubscribers.get(event);
|
|
223
|
+
if (!subscribers) {
|
|
224
|
+
this._eventSubscribers.set(event, new Set([callback]));
|
|
225
|
+
} else {
|
|
226
|
+
subscribers.add(callback);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return () => {
|
|
230
|
+
const subscribers = this._eventSubscribers.get(event)!;
|
|
231
|
+
subscribers.delete(callback);
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { AppendMessage, ThreadMessage } from "../../types";
|
|
2
|
+
import { getThreadMessageText } from "../../utils/text";
|
|
3
|
+
import type { AttachmentAdapter } from "../../adapters/attachment";
|
|
4
|
+
import type { DictationAdapter } from "../../adapters/speech";
|
|
5
|
+
import type { ThreadRuntimeCore } from "../interfaces/thread-runtime-core";
|
|
6
|
+
import { BaseComposerRuntimeCore } from "./base-composer-runtime-core";
|
|
7
|
+
|
|
8
|
+
export class DefaultEditComposerRuntimeCore extends BaseComposerRuntimeCore {
|
|
9
|
+
public get canCancel() {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
protected getAttachmentAdapter() {
|
|
14
|
+
return this.runtime.adapters?.attachments;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
protected getDictationAdapter() {
|
|
18
|
+
return this.runtime.adapters?.dictation;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private _nonTextParts;
|
|
22
|
+
private _previousText;
|
|
23
|
+
private _parentId;
|
|
24
|
+
private _sourceId;
|
|
25
|
+
constructor(
|
|
26
|
+
private runtime: ThreadRuntimeCore & {
|
|
27
|
+
adapters?:
|
|
28
|
+
| {
|
|
29
|
+
attachments?: AttachmentAdapter | undefined;
|
|
30
|
+
dictation?: DictationAdapter | undefined;
|
|
31
|
+
}
|
|
32
|
+
| undefined;
|
|
33
|
+
},
|
|
34
|
+
private endEditCallback: () => void,
|
|
35
|
+
{ parentId, message }: { parentId: string | null; message: ThreadMessage },
|
|
36
|
+
) {
|
|
37
|
+
super();
|
|
38
|
+
this._parentId = parentId;
|
|
39
|
+
this._sourceId = message.id;
|
|
40
|
+
this._previousText = getThreadMessageText(message);
|
|
41
|
+
this.setText(this._previousText);
|
|
42
|
+
|
|
43
|
+
this.setRole(message.role);
|
|
44
|
+
this.setAttachments(message.attachments ?? []);
|
|
45
|
+
|
|
46
|
+
this._nonTextParts = message.content.filter((part) => part.type !== "text");
|
|
47
|
+
|
|
48
|
+
this.setRunConfig({ ...runtime.composer.runConfig });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public async handleSend(
|
|
52
|
+
message: Omit<AppendMessage, "parentId" | "sourceId">,
|
|
53
|
+
) {
|
|
54
|
+
const text = getThreadMessageText(message as AppendMessage);
|
|
55
|
+
if (text !== this._previousText) {
|
|
56
|
+
this.runtime.append({
|
|
57
|
+
...message,
|
|
58
|
+
content: [...message.content, ...this._nonTextParts] as any,
|
|
59
|
+
parentId: this._parentId,
|
|
60
|
+
sourceId: this._sourceId,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
this.handleCancel();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public handleCancel() {
|
|
68
|
+
this.endEditCallback();
|
|
69
|
+
this._notifySubscribers();
|
|
70
|
+
}
|
|
71
|
+
}
|