@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,135 @@
|
|
|
1
|
+
import type { ReadonlyJSONValue } from "assistant-stream/utils";
|
|
2
|
+
import type {
|
|
3
|
+
RuntimeCapabilities,
|
|
4
|
+
SpeechState,
|
|
5
|
+
ThreadSuggestion,
|
|
6
|
+
ExportedMessageRepository,
|
|
7
|
+
ThreadMessageLike,
|
|
8
|
+
CreateAppendMessage,
|
|
9
|
+
CreateStartRunConfig,
|
|
10
|
+
CreateResumeRunConfig,
|
|
11
|
+
ThreadRuntime,
|
|
12
|
+
} from "../../runtime";
|
|
13
|
+
import type { ModelContext } from "../../model-context";
|
|
14
|
+
import type { MessageMethods, MessageState } from "./message";
|
|
15
|
+
import type { ComposerMethods, ComposerState } from "./composer";
|
|
16
|
+
|
|
17
|
+
export type ThreadState = {
|
|
18
|
+
/**
|
|
19
|
+
* Whether the thread is empty. A thread is considered empty when it has no messages and is not loading.
|
|
20
|
+
*/
|
|
21
|
+
readonly isEmpty: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the thread is disabled. Disabled threads cannot receive new messages.
|
|
24
|
+
*/
|
|
25
|
+
readonly isDisabled: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the thread is loading its history.
|
|
28
|
+
*/
|
|
29
|
+
readonly isLoading: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the thread is running. A thread is considered running when there is an active stream connection to the backend.
|
|
32
|
+
*/
|
|
33
|
+
readonly isRunning: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The capabilities of the thread, such as whether the thread supports editing, branch switching, etc.
|
|
36
|
+
*/
|
|
37
|
+
readonly capabilities: RuntimeCapabilities;
|
|
38
|
+
/**
|
|
39
|
+
* The messages in the currently selected branch of the thread.
|
|
40
|
+
*/
|
|
41
|
+
readonly messages: readonly MessageState[];
|
|
42
|
+
/**
|
|
43
|
+
* The thread state.
|
|
44
|
+
* @deprecated This feature is experimental
|
|
45
|
+
*/
|
|
46
|
+
readonly state: ReadonlyJSONValue;
|
|
47
|
+
/**
|
|
48
|
+
* Follow up message suggestions to show the user.
|
|
49
|
+
*/
|
|
50
|
+
readonly suggestions: readonly ThreadSuggestion[];
|
|
51
|
+
/**
|
|
52
|
+
* Custom extra information provided by the runtime.
|
|
53
|
+
*/
|
|
54
|
+
readonly extras: unknown;
|
|
55
|
+
/** @deprecated This API is still under active development and might change without notice. */
|
|
56
|
+
readonly speech: SpeechState | undefined;
|
|
57
|
+
readonly composer: ComposerState;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type ThreadMethods = {
|
|
61
|
+
/**
|
|
62
|
+
* Get the current state of the thread.
|
|
63
|
+
*/
|
|
64
|
+
getState(): ThreadState;
|
|
65
|
+
/**
|
|
66
|
+
* The thread composer runtime.
|
|
67
|
+
*/
|
|
68
|
+
composer(): ComposerMethods;
|
|
69
|
+
/**
|
|
70
|
+
* Append a new message to the thread.
|
|
71
|
+
*
|
|
72
|
+
* @example ```ts
|
|
73
|
+
* // append a new user message with the text "Hello, world!"
|
|
74
|
+
* threadRuntime.append("Hello, world!");
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @example ```ts
|
|
78
|
+
* // append a new assistant message with the text "Hello, world!"
|
|
79
|
+
* threadRuntime.append({
|
|
80
|
+
* role: "assistant",
|
|
81
|
+
* content: [{ type: "text", text: "Hello, world!" }],
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
append(message: CreateAppendMessage): void;
|
|
86
|
+
/**
|
|
87
|
+
* Start a new run with the given configuration.
|
|
88
|
+
* @param config The configuration for starting the run
|
|
89
|
+
*/
|
|
90
|
+
startRun(config: CreateStartRunConfig): void;
|
|
91
|
+
/**
|
|
92
|
+
* Resume a run with the given configuration.
|
|
93
|
+
* @param config The configuration for resuming the run
|
|
94
|
+
*/
|
|
95
|
+
unstable_resumeRun(config: CreateResumeRunConfig): void;
|
|
96
|
+
cancelRun(): void;
|
|
97
|
+
getModelContext(): ModelContext;
|
|
98
|
+
export(): ExportedMessageRepository;
|
|
99
|
+
import(repository: ExportedMessageRepository): void;
|
|
100
|
+
/**
|
|
101
|
+
* Reset the thread with optional initial messages.
|
|
102
|
+
* @param initialMessages - Optional array of initial messages to populate the thread
|
|
103
|
+
*/
|
|
104
|
+
reset(initialMessages?: readonly ThreadMessageLike[]): void;
|
|
105
|
+
message(selector: { id: string } | { index: number }): MessageMethods;
|
|
106
|
+
/** @deprecated This API is still under active development and might change without notice. */
|
|
107
|
+
stopSpeaking(): void;
|
|
108
|
+
/**
|
|
109
|
+
* Start the voice session for the thread. Establishes any necessary media connections.
|
|
110
|
+
*/
|
|
111
|
+
startVoice(): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Stop the currently active voice session.
|
|
114
|
+
*/
|
|
115
|
+
stopVoice(): Promise<void>;
|
|
116
|
+
__internal_getRuntime?(): ThreadRuntime;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export type ThreadMeta = {
|
|
120
|
+
source: "threads";
|
|
121
|
+
query: { type: "main" };
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export type ThreadEvents = {
|
|
125
|
+
"thread.runStart": { threadId: string };
|
|
126
|
+
"thread.runEnd": { threadId: string };
|
|
127
|
+
"thread.initialize": { threadId: string };
|
|
128
|
+
"thread.modelContextUpdate": { threadId: string };
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export type ThreadClientSchema = {
|
|
132
|
+
methods: ThreadMethods;
|
|
133
|
+
meta: ThreadMeta;
|
|
134
|
+
events: ThreadEvents;
|
|
135
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AssistantRuntime } from "../../runtime";
|
|
2
|
+
import type {
|
|
3
|
+
ThreadListItemMethods,
|
|
4
|
+
ThreadListItemState,
|
|
5
|
+
} from "./thread-list-item";
|
|
6
|
+
import type { ThreadMethods, ThreadState } from "./thread";
|
|
7
|
+
|
|
8
|
+
export type ThreadsState = {
|
|
9
|
+
readonly mainThreadId: string;
|
|
10
|
+
readonly newThreadId: string | null;
|
|
11
|
+
readonly isLoading: boolean;
|
|
12
|
+
readonly threadIds: readonly string[];
|
|
13
|
+
readonly archivedThreadIds: readonly string[];
|
|
14
|
+
readonly threadItems: readonly ThreadListItemState[];
|
|
15
|
+
readonly main: ThreadState;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type ThreadsMethods = {
|
|
19
|
+
getState(): ThreadsState;
|
|
20
|
+
switchToThread(threadId: string): void;
|
|
21
|
+
switchToNewThread(): void;
|
|
22
|
+
item(
|
|
23
|
+
threadIdOrOptions:
|
|
24
|
+
| "main"
|
|
25
|
+
| { id: string }
|
|
26
|
+
| { index: number; archived?: boolean },
|
|
27
|
+
): ThreadListItemMethods;
|
|
28
|
+
thread(selector: "main"): ThreadMethods;
|
|
29
|
+
__internal_getAssistantRuntime?(): AssistantRuntime;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type ThreadsClientSchema = {
|
|
33
|
+
methods: ThreadsMethods;
|
|
34
|
+
};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import type { ResourceElement } from "@assistant-ui/tap";
|
|
2
|
+
import type {
|
|
3
|
+
AssistantEventName,
|
|
4
|
+
AssistantEventCallback,
|
|
5
|
+
AssistantEventSelector,
|
|
6
|
+
} from "./events";
|
|
7
|
+
import type { ThreadsClientSchema } from "../scopes/threads";
|
|
8
|
+
import type { ThreadListItemClientSchema } from "../scopes/thread-list-item";
|
|
9
|
+
import type { ThreadClientSchema } from "../scopes/thread";
|
|
10
|
+
import type { MessageClientSchema } from "../scopes/message";
|
|
11
|
+
import type { PartClientSchema } from "../scopes/part";
|
|
12
|
+
import type { ComposerClientSchema } from "../scopes/composer";
|
|
13
|
+
import type { AttachmentClientSchema } from "../scopes/attachment";
|
|
14
|
+
import type { ModelContextClientSchema } from "../scopes/model-context";
|
|
15
|
+
import type { SuggestionsClientSchema } from "../scopes/suggestions";
|
|
16
|
+
import type { SuggestionClientSchema } from "../scopes/suggestion";
|
|
17
|
+
import type { ChainOfThoughtClientSchema } from "../scopes/chain-of-thought";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Base type for methods that can be called on a client.
|
|
21
|
+
*/
|
|
22
|
+
export interface ClientMethods {
|
|
23
|
+
[key: string | symbol]: (...args: any[]) => any;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type ClientMetaType = { source: ClientNames; query: Record<string, unknown> };
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Schema of a client in the assistant system (internal type).
|
|
30
|
+
* @template TState - The state type for this client
|
|
31
|
+
* @template TMethods - The methods available on this client
|
|
32
|
+
* @template TMeta - Source/query metadata (optional)
|
|
33
|
+
* @template TEvents - Events that this client can emit (optional)
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
export type ClientSchema<
|
|
37
|
+
TMethods extends ClientMethods = ClientMethods,
|
|
38
|
+
TMeta extends ClientMetaType = never,
|
|
39
|
+
TEvents extends Record<string, unknown> = never,
|
|
40
|
+
> = {
|
|
41
|
+
methods: TMethods;
|
|
42
|
+
meta?: TMeta;
|
|
43
|
+
events?: TEvents;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Module augmentation interface for assistant-ui store type extensions.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* declare module "@assistant-ui/core/store" {
|
|
52
|
+
* interface ScopeRegistry {
|
|
53
|
+
* // Simple client (meta and events are optional)
|
|
54
|
+
* foo: {
|
|
55
|
+
* methods: {
|
|
56
|
+
* getState: () => { bar: string };
|
|
57
|
+
* updateBar: (bar: string) => void;
|
|
58
|
+
* };
|
|
59
|
+
* };
|
|
60
|
+
* // Full client with meta and events
|
|
61
|
+
* bar: {
|
|
62
|
+
* methods: {
|
|
63
|
+
* getState: () => { id: string };
|
|
64
|
+
* update: () => void;
|
|
65
|
+
* };
|
|
66
|
+
* meta: { source: "fooList"; query: { index: number } };
|
|
67
|
+
* events: {
|
|
68
|
+
* "bar.updated": { id: string };
|
|
69
|
+
* };
|
|
70
|
+
* };
|
|
71
|
+
* }
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export interface ScopeRegistry {
|
|
76
|
+
threads: ThreadsClientSchema;
|
|
77
|
+
threadListItem: ThreadListItemClientSchema;
|
|
78
|
+
thread: ThreadClientSchema;
|
|
79
|
+
message: MessageClientSchema;
|
|
80
|
+
part: PartClientSchema;
|
|
81
|
+
composer: ComposerClientSchema;
|
|
82
|
+
attachment: AttachmentClientSchema;
|
|
83
|
+
modelContext: ModelContextClientSchema;
|
|
84
|
+
suggestions: SuggestionsClientSchema;
|
|
85
|
+
suggestion: SuggestionClientSchema;
|
|
86
|
+
chainOfThought: ChainOfThoughtClientSchema;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
type ClientEventsType<K extends ClientNames> = Record<
|
|
90
|
+
`${K}.${string}`,
|
|
91
|
+
unknown
|
|
92
|
+
>;
|
|
93
|
+
|
|
94
|
+
type ClientError<E extends string> = {
|
|
95
|
+
methods: Record<E, () => E>;
|
|
96
|
+
meta: { source: ClientNames; query: Record<E, E> };
|
|
97
|
+
events: Record<`${E}.`, E>;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
type ValidateClient<K extends keyof ScopeRegistry> = ScopeRegistry[K] extends {
|
|
101
|
+
methods: ClientMethods;
|
|
102
|
+
}
|
|
103
|
+
? "meta" extends keyof ScopeRegistry[K]
|
|
104
|
+
? ScopeRegistry[K]["meta"] extends ClientMetaType
|
|
105
|
+
? "events" extends keyof ScopeRegistry[K]
|
|
106
|
+
? ScopeRegistry[K]["events"] extends ClientEventsType<K>
|
|
107
|
+
? ScopeRegistry[K]
|
|
108
|
+
: ClientError<`ERROR: ${K & string} has invalid events type`>
|
|
109
|
+
: ScopeRegistry[K]
|
|
110
|
+
: ClientError<`ERROR: ${K & string} has invalid meta type`>
|
|
111
|
+
: "events" extends keyof ScopeRegistry[K]
|
|
112
|
+
? ScopeRegistry[K]["events"] extends ClientEventsType<K>
|
|
113
|
+
? ScopeRegistry[K]
|
|
114
|
+
: ClientError<`ERROR: ${K & string} has invalid events type`>
|
|
115
|
+
: ScopeRegistry[K]
|
|
116
|
+
: ClientError<`ERROR: ${K & string} has invalid methods type`>;
|
|
117
|
+
|
|
118
|
+
type ClientSchemas = keyof ScopeRegistry extends never
|
|
119
|
+
? {
|
|
120
|
+
"ERROR: No clients were defined": ClientError<"ERROR: No clients were defined">;
|
|
121
|
+
}
|
|
122
|
+
: { [K in keyof ScopeRegistry]: ValidateClient<K> };
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Output type that client resources return (just methods).
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* const FooResource = resource((): ClientResourceOutput<"foo"> => {
|
|
130
|
+
* const [state, setState] = tapState({ bar: "hello" });
|
|
131
|
+
* return {
|
|
132
|
+
* getState: () => state,
|
|
133
|
+
* updateBar: (b) => setState({ bar: b }),
|
|
134
|
+
* };
|
|
135
|
+
* });
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export type ClientOutput<K extends ClientNames> = ClientSchemas[K]["methods"] &
|
|
139
|
+
ClientMethods;
|
|
140
|
+
|
|
141
|
+
export type ClientNames = keyof ClientSchemas extends infer U ? U : never;
|
|
142
|
+
|
|
143
|
+
export type ClientEvents<K extends ClientNames> =
|
|
144
|
+
"events" extends keyof ClientSchemas[K]
|
|
145
|
+
? ClientSchemas[K]["events"] extends ClientEventsType<K>
|
|
146
|
+
? ClientSchemas[K]["events"]
|
|
147
|
+
: never
|
|
148
|
+
: never;
|
|
149
|
+
|
|
150
|
+
export type ClientMeta<K extends ClientNames> =
|
|
151
|
+
"meta" extends keyof ClientSchemas[K]
|
|
152
|
+
? Pick<
|
|
153
|
+
ClientSchemas[K]["meta"] extends ClientMetaType
|
|
154
|
+
? ClientSchemas[K]["meta"]
|
|
155
|
+
: never,
|
|
156
|
+
"source" | "query"
|
|
157
|
+
>
|
|
158
|
+
: never;
|
|
159
|
+
|
|
160
|
+
export type ClientElement<K extends ClientNames> = ResourceElement<
|
|
161
|
+
ClientOutput<K>
|
|
162
|
+
>;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Unsubscribe function type.
|
|
166
|
+
*/
|
|
167
|
+
export type Unsubscribe = () => void;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* State type extracted from all clients via their getState() methods.
|
|
171
|
+
*/
|
|
172
|
+
export type AssistantState = {
|
|
173
|
+
[K in ClientNames]: ClientSchemas[K]["methods"] extends {
|
|
174
|
+
getState: () => infer S;
|
|
175
|
+
}
|
|
176
|
+
? S
|
|
177
|
+
: never;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Type for a client accessor - a function that returns the methods,
|
|
182
|
+
* with source/query metadata attached (derived from meta).
|
|
183
|
+
*/
|
|
184
|
+
export type AssistantClientAccessor<K extends ClientNames> =
|
|
185
|
+
(() => ClientSchemas[K]["methods"]) &
|
|
186
|
+
(
|
|
187
|
+
| ClientMeta<K>
|
|
188
|
+
| { source: "root"; query: Record<string, never> }
|
|
189
|
+
| { source: null; query: null }
|
|
190
|
+
) & { name: K };
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The assistant client type with all registered clients.
|
|
194
|
+
*/
|
|
195
|
+
export type AssistantClient = {
|
|
196
|
+
[K in ClientNames]: AssistantClientAccessor<K>;
|
|
197
|
+
} & {
|
|
198
|
+
subscribe(listener: () => void): Unsubscribe;
|
|
199
|
+
on<TEvent extends AssistantEventName>(
|
|
200
|
+
selector: AssistantEventSelector<TEvent>,
|
|
201
|
+
callback: AssistantEventCallback<TEvent>,
|
|
202
|
+
): Unsubscribe;
|
|
203
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AssistantClientAccessor,
|
|
3
|
+
ClientEvents,
|
|
4
|
+
ClientNames,
|
|
5
|
+
} from "./client";
|
|
6
|
+
|
|
7
|
+
// --- Event Map Construction ---
|
|
8
|
+
type UnionToIntersection<U> = (
|
|
9
|
+
U extends unknown
|
|
10
|
+
? (x: U) => void
|
|
11
|
+
: never
|
|
12
|
+
) extends (x: infer I) => void
|
|
13
|
+
? I
|
|
14
|
+
: never;
|
|
15
|
+
|
|
16
|
+
type ClientEventMap = UnionToIntersection<
|
|
17
|
+
{ [K in ClientNames]: ClientEvents<K> }[ClientNames]
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
// --- Core Types ---
|
|
21
|
+
|
|
22
|
+
type WildcardPayload = {
|
|
23
|
+
[K in keyof ClientEventMap]: { event: K; payload: ClientEventMap[K] };
|
|
24
|
+
}[keyof ClientEventMap];
|
|
25
|
+
|
|
26
|
+
export type AssistantEventPayload = ClientEventMap & { "*": WildcardPayload };
|
|
27
|
+
|
|
28
|
+
export type AssistantEventName = keyof AssistantEventPayload;
|
|
29
|
+
|
|
30
|
+
type EventSource<T extends AssistantEventName> =
|
|
31
|
+
T extends `${infer Source}.${string}` ? Source : never;
|
|
32
|
+
|
|
33
|
+
// --- Scoping ---
|
|
34
|
+
|
|
35
|
+
type ParentOf<K extends ClientNames> =
|
|
36
|
+
AssistantClientAccessor<K> extends { source: infer S }
|
|
37
|
+
? S extends ClientNames
|
|
38
|
+
? S
|
|
39
|
+
: never
|
|
40
|
+
: never;
|
|
41
|
+
|
|
42
|
+
type AncestorsOf<
|
|
43
|
+
K extends ClientNames,
|
|
44
|
+
Seen extends ClientNames = never,
|
|
45
|
+
> = K extends Seen
|
|
46
|
+
? never
|
|
47
|
+
: ParentOf<K> extends never
|
|
48
|
+
? never
|
|
49
|
+
: ParentOf<K> | AncestorsOf<ParentOf<K>, Seen | K>;
|
|
50
|
+
|
|
51
|
+
/** Valid scopes: `"*"` | event source | ancestors of event source */
|
|
52
|
+
export type AssistantEventScope<TEvent extends AssistantEventName> =
|
|
53
|
+
| "*"
|
|
54
|
+
| EventSource<TEvent>
|
|
55
|
+
| (EventSource<TEvent> extends ClientNames
|
|
56
|
+
? AncestorsOf<EventSource<TEvent>>
|
|
57
|
+
: never);
|
|
58
|
+
|
|
59
|
+
// --- Selection & Callbacks ---
|
|
60
|
+
|
|
61
|
+
export type AssistantEventSelector<TEvent extends AssistantEventName> =
|
|
62
|
+
| TEvent
|
|
63
|
+
| { scope: AssistantEventScope<TEvent>; event: TEvent };
|
|
64
|
+
|
|
65
|
+
export const normalizeEventSelector = <TEvent extends AssistantEventName>(
|
|
66
|
+
selector: AssistantEventSelector<TEvent>,
|
|
67
|
+
) => {
|
|
68
|
+
if (typeof selector === "string") {
|
|
69
|
+
const source = selector.split(".")[0] as AssistantEventScope<TEvent>;
|
|
70
|
+
return { scope: source, event: selector };
|
|
71
|
+
}
|
|
72
|
+
return { scope: selector.scope, event: selector.event };
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export type AssistantEventCallback<TEvent extends AssistantEventName> = (
|
|
76
|
+
payload: AssistantEventPayload[TEvent],
|
|
77
|
+
) => void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
ClientMethods,
|
|
3
|
+
ClientSchema,
|
|
4
|
+
ScopeRegistry,
|
|
5
|
+
ClientOutput,
|
|
6
|
+
ClientNames,
|
|
7
|
+
ClientEvents,
|
|
8
|
+
ClientMeta,
|
|
9
|
+
ClientElement,
|
|
10
|
+
Unsubscribe,
|
|
11
|
+
AssistantState,
|
|
12
|
+
AssistantClientAccessor,
|
|
13
|
+
AssistantClient,
|
|
14
|
+
} from "./client";
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
normalizeEventSelector,
|
|
18
|
+
type AssistantEventPayload,
|
|
19
|
+
type AssistantEventName,
|
|
20
|
+
type AssistantEventScope,
|
|
21
|
+
type AssistantEventSelector,
|
|
22
|
+
type AssistantEventCallback,
|
|
23
|
+
} from "./events";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ResourceElement } from "@assistant-ui/tap";
|
|
2
|
+
import type {
|
|
3
|
+
AssistantClient,
|
|
4
|
+
ClientElement,
|
|
5
|
+
ClientNames,
|
|
6
|
+
} from "../types/client";
|
|
7
|
+
import type { DerivedElement } from "./derived";
|
|
8
|
+
|
|
9
|
+
const TRANSFORM_SCOPES = Symbol("assistant-ui.transform-scopes");
|
|
10
|
+
|
|
11
|
+
export type ScopesConfig = {
|
|
12
|
+
[K in ClientNames]?: ClientElement<K> | DerivedElement<K>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type TransformScopesFn = (
|
|
16
|
+
scopes: ScopesConfig,
|
|
17
|
+
parent: AssistantClient,
|
|
18
|
+
) => ScopesConfig;
|
|
19
|
+
|
|
20
|
+
type ResourceWithTransformScopes = {
|
|
21
|
+
[TRANSFORM_SCOPES]?: TransformScopesFn;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export function attachTransformScopes<
|
|
25
|
+
T extends (...args: any[]) => ResourceElement<any>,
|
|
26
|
+
>(resource: T, transform: TransformScopesFn): void {
|
|
27
|
+
const r = resource as T & ResourceWithTransformScopes;
|
|
28
|
+
if (r[TRANSFORM_SCOPES]) {
|
|
29
|
+
throw new Error("transformScopes is already attached to this resource");
|
|
30
|
+
}
|
|
31
|
+
r[TRANSFORM_SCOPES] = transform;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function getTransformScopes<
|
|
35
|
+
T extends (...args: any[]) => ResourceElement<any>,
|
|
36
|
+
>(resource: T): TransformScopesFn | undefined {
|
|
37
|
+
return (resource as T & ResourceWithTransformScopes)[TRANSFORM_SCOPES];
|
|
38
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const INTROSPECTION_PROPS = new Set(["$$typeof", "nodeType", "then"]);
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Handles common proxy introspection properties.
|
|
5
|
+
* Returns the appropriate value for toStringTag, toJSON, and props that should return undefined.
|
|
6
|
+
* Returns `false` if the prop should be handled by the subclass.
|
|
7
|
+
*/
|
|
8
|
+
export const handleIntrospectionProp = (
|
|
9
|
+
prop: string | symbol,
|
|
10
|
+
name: string,
|
|
11
|
+
): unknown | false => {
|
|
12
|
+
if (prop === Symbol.toStringTag) return name;
|
|
13
|
+
if (typeof prop === "symbol") return undefined;
|
|
14
|
+
if (prop === "toJSON") return () => name;
|
|
15
|
+
if (INTROSPECTION_PROPS.has(prop)) return undefined;
|
|
16
|
+
return false;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export abstract class BaseProxyHandler implements ProxyHandler<object> {
|
|
20
|
+
abstract get(_: unknown, prop: string | symbol, receiver?: unknown): unknown;
|
|
21
|
+
abstract ownKeys(): ArrayLike<string | symbol>;
|
|
22
|
+
abstract has(_: unknown, prop: string | symbol): boolean;
|
|
23
|
+
|
|
24
|
+
getOwnPropertyDescriptor(_: unknown, prop: string | symbol) {
|
|
25
|
+
const value = this.get(_, prop);
|
|
26
|
+
if (value === undefined) return undefined;
|
|
27
|
+
return {
|
|
28
|
+
value,
|
|
29
|
+
writable: false,
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: false,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
set() {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
setPrototypeOf() {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
defineProperty() {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
deleteProperty() {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
preventExtensions(): boolean {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { resource, ResourceElement } from "@assistant-ui/tap";
|
|
2
|
+
import type {
|
|
3
|
+
AssistantClient,
|
|
4
|
+
ClientNames,
|
|
5
|
+
AssistantClientAccessor,
|
|
6
|
+
ClientMeta,
|
|
7
|
+
} from "../types/client";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Creates a derived client field that references a client from a parent scope.
|
|
11
|
+
* The get callback always calls the most recent version (useEffectEvent pattern).
|
|
12
|
+
*
|
|
13
|
+
* IMPORTANT: The `get` callback must return a client that was created via
|
|
14
|
+
* `tapClientResource` (or `tapClientLookup`/`tapClientList` which use it internally).
|
|
15
|
+
* This is required for event scoping to work correctly.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const aui = useAui({
|
|
20
|
+
* message: Derived({
|
|
21
|
+
* source: "thread",
|
|
22
|
+
* query: { index: 0 },
|
|
23
|
+
* get: (aui) => aui.thread().message({ index: 0 }),
|
|
24
|
+
* }),
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export const Derived = resource(
|
|
29
|
+
<K extends ClientNames>(_config: Derived.Props<K>): null => {
|
|
30
|
+
return null;
|
|
31
|
+
},
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export type DerivedElement<K extends ClientNames> = ResourceElement<
|
|
35
|
+
null,
|
|
36
|
+
Derived.Props<K>
|
|
37
|
+
>;
|
|
38
|
+
|
|
39
|
+
export namespace Derived {
|
|
40
|
+
/**
|
|
41
|
+
* Props passed to a derived client resource element.
|
|
42
|
+
*/
|
|
43
|
+
export type Props<K extends ClientNames> = {
|
|
44
|
+
get: (client: AssistantClient) => ReturnType<AssistantClientAccessor<K>>;
|
|
45
|
+
} & (ClientMeta<K> | { getMeta: (client: AssistantClient) => ClientMeta<K> });
|
|
46
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export {
|
|
2
|
+
BaseProxyHandler,
|
|
3
|
+
handleIntrospectionProp,
|
|
4
|
+
} from "./base-proxy-handler";
|
|
5
|
+
export {
|
|
6
|
+
SYMBOL_CLIENT_INDEX,
|
|
7
|
+
getClientIndex,
|
|
8
|
+
type ClientStack,
|
|
9
|
+
tapClientStack,
|
|
10
|
+
tapWithClientStack,
|
|
11
|
+
} from "./tap-client-stack-context";
|
|
12
|
+
export {
|
|
13
|
+
type AssistantTapContextValue,
|
|
14
|
+
withAssistantTapContextProvider,
|
|
15
|
+
tapAssistantClientRef,
|
|
16
|
+
tapAssistantEmit,
|
|
17
|
+
} from "./tap-assistant-context";
|
|
18
|
+
export { NotificationManager } from "./notification-manager";
|
|
19
|
+
export {
|
|
20
|
+
PROXIED_ASSISTANT_STATE_SYMBOL,
|
|
21
|
+
createProxiedAssistantState,
|
|
22
|
+
getProxiedAssistantState,
|
|
23
|
+
} from "./proxied-assistant-state";
|
|
24
|
+
export {
|
|
25
|
+
type RootClients,
|
|
26
|
+
type DerivedClients,
|
|
27
|
+
tapSplitClients,
|
|
28
|
+
} from "./split-clients";
|