@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,170 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ThreadAssistantMessagePart,
|
|
3
|
+
ThreadUserMessagePart,
|
|
4
|
+
Attachment,
|
|
5
|
+
ThreadMessage,
|
|
6
|
+
} from "../../types";
|
|
7
|
+
import {
|
|
8
|
+
resource,
|
|
9
|
+
tapMemo,
|
|
10
|
+
tapState,
|
|
11
|
+
tapResource,
|
|
12
|
+
withKey,
|
|
13
|
+
} from "@assistant-ui/tap";
|
|
14
|
+
import type { ClientOutput } from "../types/client";
|
|
15
|
+
import { tapClientLookup } from "../utils/tap-client-lookup";
|
|
16
|
+
import type { MessageState, PartState } from "../scopes";
|
|
17
|
+
import { NoOpComposerClient } from "./no-op-composer-client";
|
|
18
|
+
|
|
19
|
+
const ThreadMessagePartClient = resource(
|
|
20
|
+
({
|
|
21
|
+
part,
|
|
22
|
+
}: {
|
|
23
|
+
part: ThreadAssistantMessagePart | ThreadUserMessagePart;
|
|
24
|
+
}): ClientOutput<"part"> => {
|
|
25
|
+
const state = tapMemo<PartState>(() => {
|
|
26
|
+
return {
|
|
27
|
+
...part,
|
|
28
|
+
status: { type: "complete" },
|
|
29
|
+
};
|
|
30
|
+
}, [part]);
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
getState: () => state,
|
|
34
|
+
addToolResult: () => {
|
|
35
|
+
throw new Error("Not supported");
|
|
36
|
+
},
|
|
37
|
+
resumeToolCall: () => {
|
|
38
|
+
throw new Error("Not supported");
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const ThreadMessageAttachmentClient = resource(
|
|
45
|
+
({ attachment }: { attachment: Attachment }): ClientOutput<"attachment"> => {
|
|
46
|
+
return {
|
|
47
|
+
getState: () => attachment,
|
|
48
|
+
remove: () => {
|
|
49
|
+
throw new Error("Not supported");
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
export type ThreadMessageClientProps = {
|
|
55
|
+
message: ThreadMessage;
|
|
56
|
+
index: number;
|
|
57
|
+
isLast?: boolean;
|
|
58
|
+
branchNumber?: number;
|
|
59
|
+
branchCount?: number;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const ThreadMessageClient = resource(
|
|
63
|
+
({
|
|
64
|
+
message,
|
|
65
|
+
index,
|
|
66
|
+
isLast = true,
|
|
67
|
+
branchNumber = 1,
|
|
68
|
+
branchCount = 1,
|
|
69
|
+
}: ThreadMessageClientProps): ClientOutput<"message"> => {
|
|
70
|
+
const [isCopiedState, setIsCopied] = tapState(false);
|
|
71
|
+
const [isHoveringState, setIsHovering] = tapState(false);
|
|
72
|
+
|
|
73
|
+
const parts = tapClientLookup(
|
|
74
|
+
() =>
|
|
75
|
+
message.content.map((part, idx) =>
|
|
76
|
+
withKey(
|
|
77
|
+
"toolCallId" in part && part.toolCallId != null
|
|
78
|
+
? `toolCallId-${part.toolCallId}`
|
|
79
|
+
: `index-${idx}`,
|
|
80
|
+
ThreadMessagePartClient({ part }),
|
|
81
|
+
),
|
|
82
|
+
),
|
|
83
|
+
[message.content],
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const attachments = tapClientLookup(
|
|
87
|
+
() =>
|
|
88
|
+
(message.attachments ?? []).map((attachment) =>
|
|
89
|
+
withKey(attachment.id, ThreadMessageAttachmentClient({ attachment })),
|
|
90
|
+
),
|
|
91
|
+
[message.attachments],
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const composer = tapResource(NoOpComposerClient({ type: "edit" }));
|
|
95
|
+
const composerState = composer.getState();
|
|
96
|
+
|
|
97
|
+
const state = tapMemo<MessageState>(() => {
|
|
98
|
+
return {
|
|
99
|
+
...message,
|
|
100
|
+
parts: parts.state,
|
|
101
|
+
composer: composerState,
|
|
102
|
+
parentId: null,
|
|
103
|
+
index,
|
|
104
|
+
isLast,
|
|
105
|
+
branchNumber,
|
|
106
|
+
branchCount,
|
|
107
|
+
speech: undefined,
|
|
108
|
+
submittedFeedback: message.metadata.submittedFeedback,
|
|
109
|
+
isCopied: isCopiedState,
|
|
110
|
+
isHovering: isHoveringState,
|
|
111
|
+
};
|
|
112
|
+
}, [
|
|
113
|
+
message,
|
|
114
|
+
index,
|
|
115
|
+
isCopiedState,
|
|
116
|
+
isHoveringState,
|
|
117
|
+
isLast,
|
|
118
|
+
parts.state,
|
|
119
|
+
composerState,
|
|
120
|
+
branchNumber,
|
|
121
|
+
branchCount,
|
|
122
|
+
]);
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
getState: () => state,
|
|
126
|
+
composer: () => composer,
|
|
127
|
+
part: (selector) => {
|
|
128
|
+
if ("index" in selector) {
|
|
129
|
+
return parts.get({ index: selector.index });
|
|
130
|
+
} else {
|
|
131
|
+
return parts.get({ key: `toolCallId-${selector.toolCallId}` });
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
attachment: (selector) => {
|
|
135
|
+
if ("id" in selector) {
|
|
136
|
+
return attachments.get({ key: selector.id });
|
|
137
|
+
} else {
|
|
138
|
+
return attachments.get(selector);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
reload: () => {
|
|
142
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
143
|
+
},
|
|
144
|
+
speak: () => {
|
|
145
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
146
|
+
},
|
|
147
|
+
stopSpeaking: () => {
|
|
148
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
149
|
+
},
|
|
150
|
+
submitFeedback: () => {
|
|
151
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
152
|
+
},
|
|
153
|
+
switchToBranch: () => {
|
|
154
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
155
|
+
},
|
|
156
|
+
getCopyText: () => {
|
|
157
|
+
return message.content
|
|
158
|
+
.map((part) => {
|
|
159
|
+
if ("text" in part && typeof part.text === "string") {
|
|
160
|
+
return part.text;
|
|
161
|
+
}
|
|
162
|
+
return "";
|
|
163
|
+
})
|
|
164
|
+
.join("\n");
|
|
165
|
+
},
|
|
166
|
+
setIsCopied,
|
|
167
|
+
setIsHovering,
|
|
168
|
+
};
|
|
169
|
+
},
|
|
170
|
+
);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// resources
|
|
2
|
+
export { Derived } from "./utils/derived";
|
|
3
|
+
export type { DerivedElement } from "./utils/derived";
|
|
4
|
+
export { attachTransformScopes } from "./utils/attach-transform-scopes";
|
|
5
|
+
export type { ScopesConfig } from "./utils/attach-transform-scopes";
|
|
6
|
+
|
|
7
|
+
// tap hooks
|
|
8
|
+
export {
|
|
9
|
+
tapAssistantClientRef,
|
|
10
|
+
tapAssistantEmit,
|
|
11
|
+
} from "./utils/tap-assistant-context";
|
|
12
|
+
export { tapClientResource } from "./utils/tap-client-resource";
|
|
13
|
+
export { tapClientLookup } from "./utils/tap-client-lookup";
|
|
14
|
+
export { tapClientList } from "./utils/tap-client-list";
|
|
15
|
+
|
|
16
|
+
// types
|
|
17
|
+
export type {
|
|
18
|
+
ScopeRegistry,
|
|
19
|
+
ClientOutput,
|
|
20
|
+
AssistantClient,
|
|
21
|
+
AssistantState,
|
|
22
|
+
ClientMethods,
|
|
23
|
+
ClientSchema,
|
|
24
|
+
ClientNames,
|
|
25
|
+
ClientEvents,
|
|
26
|
+
ClientMeta,
|
|
27
|
+
ClientElement,
|
|
28
|
+
Unsubscribe,
|
|
29
|
+
AssistantClientAccessor,
|
|
30
|
+
} from "./types/client";
|
|
31
|
+
export type {
|
|
32
|
+
AssistantEventName,
|
|
33
|
+
AssistantEventCallback,
|
|
34
|
+
AssistantEventPayload,
|
|
35
|
+
AssistantEventSelector,
|
|
36
|
+
AssistantEventScope,
|
|
37
|
+
} from "./types/events";
|
|
38
|
+
export { normalizeEventSelector } from "./types/events";
|
|
39
|
+
|
|
40
|
+
// scopes
|
|
41
|
+
export * from "./scopes";
|
|
42
|
+
|
|
43
|
+
// clients
|
|
44
|
+
export * from "./clients";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Internal utilities — consumed by @assistant-ui/store, not public API.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
BaseProxyHandler,
|
|
5
|
+
handleIntrospectionProp,
|
|
6
|
+
} from "./utils/base-proxy-handler";
|
|
7
|
+
export {
|
|
8
|
+
SYMBOL_CLIENT_INDEX,
|
|
9
|
+
getClientIndex,
|
|
10
|
+
type ClientStack,
|
|
11
|
+
tapClientStack,
|
|
12
|
+
tapWithClientStack,
|
|
13
|
+
} from "./utils/tap-client-stack-context";
|
|
14
|
+
export {
|
|
15
|
+
type AssistantTapContextValue,
|
|
16
|
+
withAssistantTapContextProvider,
|
|
17
|
+
} from "./utils/tap-assistant-context";
|
|
18
|
+
export { NotificationManager } from "./utils/notification-manager";
|
|
19
|
+
export {
|
|
20
|
+
PROXIED_ASSISTANT_STATE_SYMBOL,
|
|
21
|
+
createProxiedAssistantState,
|
|
22
|
+
getProxiedAssistantState,
|
|
23
|
+
} from "./utils/proxied-assistant-state";
|
|
24
|
+
export {
|
|
25
|
+
type RootClients,
|
|
26
|
+
type DerivedClients,
|
|
27
|
+
tapSplitClients,
|
|
28
|
+
} from "./utils/split-clients";
|
|
29
|
+
export { getClientState, ClientResource } from "./utils/tap-client-resource";
|
|
30
|
+
export { wrapperResource } from "./utils/wrapper-resource";
|
|
31
|
+
export { getTransformScopes } from "./utils/attach-transform-scopes";
|
|
32
|
+
export * from "./runtime-clients";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { resource } from "@assistant-ui/tap";
|
|
2
|
+
import { type ClientOutput } from "../";
|
|
3
|
+
import { AttachmentRuntime } from "../../runtime";
|
|
4
|
+
import { tapSubscribable } from "./tap-subscribable";
|
|
5
|
+
|
|
6
|
+
export const AttachmentRuntimeClient = resource(
|
|
7
|
+
({ runtime }: { runtime: AttachmentRuntime }): ClientOutput<"attachment"> => {
|
|
8
|
+
const state = tapSubscribable(runtime);
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
getState: () => state,
|
|
12
|
+
remove: runtime.remove,
|
|
13
|
+
__internal_getRuntime: () => runtime,
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
);
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { Unsubscribe } from "../../types";
|
|
2
|
+
import {
|
|
3
|
+
resource,
|
|
4
|
+
tapMemo,
|
|
5
|
+
tapEffect,
|
|
6
|
+
tapResource,
|
|
7
|
+
type tapRef,
|
|
8
|
+
withKey,
|
|
9
|
+
} from "@assistant-ui/tap";
|
|
10
|
+
import { type ClientOutput, tapAssistantEmit, tapClientLookup } from "../";
|
|
11
|
+
import {
|
|
12
|
+
ComposerRuntime,
|
|
13
|
+
EditComposerRuntime,
|
|
14
|
+
ComposerRuntimeEventType,
|
|
15
|
+
} from "../../runtime";
|
|
16
|
+
import { ComposerState } from "../scopes";
|
|
17
|
+
import { AttachmentRuntimeClient } from "./attachment-runtime-client";
|
|
18
|
+
import { tapSubscribable } from "./tap-subscribable";
|
|
19
|
+
|
|
20
|
+
const ComposerAttachmentClientByIndex = resource(
|
|
21
|
+
({ runtime, index }: { runtime: ComposerRuntime; index: number }) => {
|
|
22
|
+
const attachmentRuntime = tapMemo(
|
|
23
|
+
() => runtime.getAttachmentByIndex(index),
|
|
24
|
+
[runtime, index],
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return tapResource(
|
|
28
|
+
AttachmentRuntimeClient({
|
|
29
|
+
runtime: attachmentRuntime,
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export const ComposerClient = resource(
|
|
36
|
+
({
|
|
37
|
+
threadIdRef,
|
|
38
|
+
messageIdRef,
|
|
39
|
+
runtime,
|
|
40
|
+
}: {
|
|
41
|
+
threadIdRef: tapRef.RefObject<string>;
|
|
42
|
+
messageIdRef?: tapRef.RefObject<string>;
|
|
43
|
+
runtime: ComposerRuntime;
|
|
44
|
+
}): ClientOutput<"composer"> => {
|
|
45
|
+
const runtimeState = tapSubscribable(runtime);
|
|
46
|
+
const emit = tapAssistantEmit();
|
|
47
|
+
|
|
48
|
+
// Bind composer events to event manager
|
|
49
|
+
tapEffect(() => {
|
|
50
|
+
const unsubscribers: Unsubscribe[] = [];
|
|
51
|
+
|
|
52
|
+
// Subscribe to composer events
|
|
53
|
+
const composerEvents: ComposerRuntimeEventType[] = [
|
|
54
|
+
"send",
|
|
55
|
+
"attachmentAdd",
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
for (const event of composerEvents) {
|
|
59
|
+
const unsubscribe = runtime.unstable_on(event, () => {
|
|
60
|
+
emit(`composer.${event}`, {
|
|
61
|
+
threadId: threadIdRef.current,
|
|
62
|
+
...(messageIdRef && { messageId: messageIdRef.current }),
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
unsubscribers.push(unsubscribe);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return () => {
|
|
69
|
+
for (const unsub of unsubscribers) unsub();
|
|
70
|
+
};
|
|
71
|
+
}, [runtime, emit, threadIdRef, messageIdRef]);
|
|
72
|
+
|
|
73
|
+
const attachments = tapClientLookup(
|
|
74
|
+
() =>
|
|
75
|
+
runtimeState.attachments.map((attachment, idx) =>
|
|
76
|
+
withKey(
|
|
77
|
+
attachment.id,
|
|
78
|
+
ComposerAttachmentClientByIndex({
|
|
79
|
+
runtime,
|
|
80
|
+
index: idx,
|
|
81
|
+
}),
|
|
82
|
+
),
|
|
83
|
+
),
|
|
84
|
+
[runtimeState.attachments, runtime],
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const state = tapMemo<ComposerState>(() => {
|
|
88
|
+
return {
|
|
89
|
+
text: runtimeState.text,
|
|
90
|
+
role: runtimeState.role,
|
|
91
|
+
attachments: attachments.state,
|
|
92
|
+
runConfig: runtimeState.runConfig,
|
|
93
|
+
isEditing: runtimeState.isEditing,
|
|
94
|
+
canCancel: runtimeState.canCancel,
|
|
95
|
+
attachmentAccept: runtimeState.attachmentAccept,
|
|
96
|
+
isEmpty: runtimeState.isEmpty,
|
|
97
|
+
type: runtimeState.type ?? "thread",
|
|
98
|
+
dictation: runtimeState.dictation,
|
|
99
|
+
quote: runtimeState.quote,
|
|
100
|
+
};
|
|
101
|
+
}, [runtimeState, attachments.state]);
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
getState: () => state,
|
|
105
|
+
setText: runtime.setText,
|
|
106
|
+
setRole: runtime.setRole,
|
|
107
|
+
setRunConfig: runtime.setRunConfig,
|
|
108
|
+
addAttachment: runtime.addAttachment,
|
|
109
|
+
reset: runtime.reset,
|
|
110
|
+
clearAttachments: runtime.clearAttachments,
|
|
111
|
+
send: runtime.send,
|
|
112
|
+
cancel: runtime.cancel,
|
|
113
|
+
beginEdit:
|
|
114
|
+
(runtime as EditComposerRuntime).beginEdit ??
|
|
115
|
+
(() => {
|
|
116
|
+
throw new Error("beginEdit is not supported in this runtime");
|
|
117
|
+
}),
|
|
118
|
+
startDictation: runtime.startDictation,
|
|
119
|
+
stopDictation: runtime.stopDictation,
|
|
120
|
+
setQuote: runtime.setQuote,
|
|
121
|
+
attachment: (selector) => {
|
|
122
|
+
if ("id" in selector) {
|
|
123
|
+
return attachments.get({ key: selector.id });
|
|
124
|
+
} else {
|
|
125
|
+
return attachments.get(selector);
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
__internal_getRuntime: () => runtime,
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { AttachmentRuntimeClient } from "./attachment-runtime-client";
|
|
2
|
+
export { MessagePartClient } from "./message-part-runtime-client";
|
|
3
|
+
export { ComposerClient } from "./composer-runtime-client";
|
|
4
|
+
export { MessageClient } from "./message-runtime-client";
|
|
5
|
+
export { ThreadClient } from "./thread-runtime-client";
|
|
6
|
+
export { ThreadListItemClient } from "./thread-list-item-runtime-client";
|
|
7
|
+
export { ThreadListClient } from "./thread-list-runtime-client";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { resource } from "@assistant-ui/tap";
|
|
2
|
+
import { type ClientOutput } from "../";
|
|
3
|
+
import { MessagePartRuntime } from "../../runtime";
|
|
4
|
+
import { tapSubscribable } from "./tap-subscribable";
|
|
5
|
+
|
|
6
|
+
export const MessagePartClient = resource(
|
|
7
|
+
({ runtime }: { runtime: MessagePartRuntime }): ClientOutput<"part"> => {
|
|
8
|
+
const state = tapSubscribable(runtime);
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
getState: () => state,
|
|
12
|
+
addToolResult: (result) => runtime.addToolResult(result),
|
|
13
|
+
resumeToolCall: (payload) => runtime.resumeToolCall(payload),
|
|
14
|
+
__internal_getRuntime: () => runtime,
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
);
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import {
|
|
2
|
+
withKey,
|
|
3
|
+
resource,
|
|
4
|
+
tapResource,
|
|
5
|
+
tapMemo,
|
|
6
|
+
tapState,
|
|
7
|
+
type tapRef,
|
|
8
|
+
} from "@assistant-ui/tap";
|
|
9
|
+
import { type ClientOutput, tapClientLookup, tapClientResource } from "../";
|
|
10
|
+
import { MessageRuntime } from "../../runtime";
|
|
11
|
+
import { tapSubscribable } from "./tap-subscribable";
|
|
12
|
+
import { ComposerClient } from "./composer-runtime-client";
|
|
13
|
+
import { MessagePartClient } from "./message-part-runtime-client";
|
|
14
|
+
import { MessageState } from "../scopes";
|
|
15
|
+
import { AttachmentRuntimeClient } from "./attachment-runtime-client";
|
|
16
|
+
|
|
17
|
+
const MessageAttachmentClientByIndex = resource(
|
|
18
|
+
({ runtime, index }: { runtime: MessageRuntime; index: number }) => {
|
|
19
|
+
const attachmentRuntime = tapMemo(
|
|
20
|
+
() => runtime.getAttachmentByIndex(index),
|
|
21
|
+
[runtime, index],
|
|
22
|
+
);
|
|
23
|
+
return tapResource(AttachmentRuntimeClient({ runtime: attachmentRuntime }));
|
|
24
|
+
},
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const MessagePartByIndex = resource(
|
|
28
|
+
({ runtime, index }: { runtime: MessageRuntime; index: number }) => {
|
|
29
|
+
const partRuntime = tapMemo(
|
|
30
|
+
() => runtime.getMessagePartByIndex(index),
|
|
31
|
+
[runtime, index],
|
|
32
|
+
);
|
|
33
|
+
return tapResource(MessagePartClient({ runtime: partRuntime }));
|
|
34
|
+
},
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export const MessageClient = resource(
|
|
38
|
+
({
|
|
39
|
+
runtime,
|
|
40
|
+
threadIdRef,
|
|
41
|
+
}: {
|
|
42
|
+
runtime: MessageRuntime;
|
|
43
|
+
threadIdRef: tapRef.RefObject<string>;
|
|
44
|
+
}): ClientOutput<"message"> => {
|
|
45
|
+
const runtimeState = tapSubscribable(runtime);
|
|
46
|
+
|
|
47
|
+
const [isCopiedState, setIsCopied] = tapState(false);
|
|
48
|
+
const [isHoveringState, setIsHovering] = tapState(false);
|
|
49
|
+
|
|
50
|
+
const messageIdRef = tapMemo(
|
|
51
|
+
() => ({
|
|
52
|
+
get current() {
|
|
53
|
+
return runtime.getState().id;
|
|
54
|
+
},
|
|
55
|
+
}),
|
|
56
|
+
[runtime],
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const composer = tapClientResource(
|
|
60
|
+
ComposerClient({
|
|
61
|
+
runtime: runtime.composer,
|
|
62
|
+
threadIdRef,
|
|
63
|
+
messageIdRef,
|
|
64
|
+
}),
|
|
65
|
+
);
|
|
66
|
+
const parts = tapClientLookup(
|
|
67
|
+
() =>
|
|
68
|
+
runtimeState.content.map((part, idx) =>
|
|
69
|
+
withKey(
|
|
70
|
+
"toolCallId" in part && part.toolCallId != null
|
|
71
|
+
? `toolCallId-${part.toolCallId}`
|
|
72
|
+
: `index-${idx}`,
|
|
73
|
+
MessagePartByIndex({ runtime, index: idx }),
|
|
74
|
+
),
|
|
75
|
+
),
|
|
76
|
+
[runtimeState.content, runtime],
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const attachments = tapClientLookup(
|
|
80
|
+
() =>
|
|
81
|
+
(runtimeState.attachments ?? []).map((attachment, idx) =>
|
|
82
|
+
withKey(
|
|
83
|
+
attachment.id,
|
|
84
|
+
MessageAttachmentClientByIndex({ runtime, index: idx }),
|
|
85
|
+
),
|
|
86
|
+
),
|
|
87
|
+
[runtimeState.attachments, runtime],
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const state = tapMemo<MessageState>(() => {
|
|
91
|
+
return {
|
|
92
|
+
...(runtimeState as MessageState),
|
|
93
|
+
|
|
94
|
+
parts: parts.state,
|
|
95
|
+
composer: composer.state,
|
|
96
|
+
|
|
97
|
+
isCopied: isCopiedState,
|
|
98
|
+
isHovering: isHoveringState,
|
|
99
|
+
};
|
|
100
|
+
}, [
|
|
101
|
+
runtimeState,
|
|
102
|
+
parts.state,
|
|
103
|
+
composer.state,
|
|
104
|
+
isCopiedState,
|
|
105
|
+
isHoveringState,
|
|
106
|
+
]);
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
getState: () => state,
|
|
110
|
+
|
|
111
|
+
composer: () => composer.methods,
|
|
112
|
+
|
|
113
|
+
reload: (config) => runtime.reload(config),
|
|
114
|
+
speak: () => runtime.speak(),
|
|
115
|
+
stopSpeaking: () => runtime.stopSpeaking(),
|
|
116
|
+
submitFeedback: (feedback) => runtime.submitFeedback(feedback),
|
|
117
|
+
switchToBranch: (options) => runtime.switchToBranch(options),
|
|
118
|
+
getCopyText: () => runtime.unstable_getCopyText(),
|
|
119
|
+
part: (selector) => {
|
|
120
|
+
if ("index" in selector) {
|
|
121
|
+
return parts.get({ index: selector.index });
|
|
122
|
+
} else {
|
|
123
|
+
return parts.get({ key: `toolCallId-${selector.toolCallId}` });
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
attachment: (selector) => {
|
|
128
|
+
if ("id" in selector) {
|
|
129
|
+
return attachments.get({ key: selector.id });
|
|
130
|
+
} else {
|
|
131
|
+
return attachments.get(selector);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
setIsCopied,
|
|
136
|
+
setIsHovering,
|
|
137
|
+
|
|
138
|
+
__internal_getRuntime: () => runtime,
|
|
139
|
+
};
|
|
140
|
+
},
|
|
141
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { tapState, tapEffect } from "@assistant-ui/tap";
|
|
2
|
+
import type { SubscribableWithState } from "../../subscribable";
|
|
3
|
+
|
|
4
|
+
export const tapSubscribable = <T>(
|
|
5
|
+
subscribable: Omit<SubscribableWithState<T, any>, "path">,
|
|
6
|
+
) => {
|
|
7
|
+
const [, setState] = tapState(subscribable.getState);
|
|
8
|
+
tapEffect(() => {
|
|
9
|
+
setState(subscribable.getState());
|
|
10
|
+
return subscribable.subscribe(() => {
|
|
11
|
+
setState(subscribable.getState());
|
|
12
|
+
});
|
|
13
|
+
}, [subscribable]);
|
|
14
|
+
|
|
15
|
+
return subscribable.getState();
|
|
16
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Unsubscribe } from "../../types";
|
|
2
|
+
import { resource, tapEffect } from "@assistant-ui/tap";
|
|
3
|
+
import { type ClientOutput, tapAssistantEmit } from "../";
|
|
4
|
+
import { ThreadListItemEventType, ThreadListItemRuntime } from "../../runtime";
|
|
5
|
+
import { tapSubscribable } from "./tap-subscribable";
|
|
6
|
+
|
|
7
|
+
export const ThreadListItemClient = resource(
|
|
8
|
+
({
|
|
9
|
+
runtime,
|
|
10
|
+
}: {
|
|
11
|
+
runtime: ThreadListItemRuntime;
|
|
12
|
+
}): ClientOutput<"threadListItem"> => {
|
|
13
|
+
const state = tapSubscribable(runtime);
|
|
14
|
+
const emit = tapAssistantEmit();
|
|
15
|
+
|
|
16
|
+
// Bind thread list item events to event manager
|
|
17
|
+
tapEffect(() => {
|
|
18
|
+
const unsubscribers: Unsubscribe[] = [];
|
|
19
|
+
|
|
20
|
+
// Subscribe to thread list item events
|
|
21
|
+
const threadListItemEvents: ThreadListItemEventType[] = [
|
|
22
|
+
"switchedTo",
|
|
23
|
+
"switchedAway",
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
for (const event of threadListItemEvents) {
|
|
27
|
+
const unsubscribe = runtime.unstable_on(event, () => {
|
|
28
|
+
emit(`threadListItem.${event}`, {
|
|
29
|
+
threadId: runtime.getState()!.id,
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
unsubscribers.push(unsubscribe);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return () => {
|
|
36
|
+
for (const unsub of unsubscribers) unsub();
|
|
37
|
+
};
|
|
38
|
+
}, [runtime, emit]);
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
getState: () => state,
|
|
42
|
+
switchTo: runtime.switchTo,
|
|
43
|
+
rename: runtime.rename,
|
|
44
|
+
archive: runtime.archive,
|
|
45
|
+
unarchive: runtime.unarchive,
|
|
46
|
+
delete: runtime.delete,
|
|
47
|
+
generateTitle: runtime.generateTitle,
|
|
48
|
+
initialize: runtime.initialize,
|
|
49
|
+
detach: runtime.detach,
|
|
50
|
+
__internal_getRuntime: () => runtime,
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
);
|