@swisper.ai/web-chat-ui 0.0.2
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/LICENSE +202 -0
- package/README.md +251 -0
- package/dist/components/canvas-shell/canvas-shell.d.ts +64 -0
- package/dist/components/canvas-shell/canvas-shell.d.ts.map +1 -0
- package/dist/components/canvas-shell/canvas-shell.stories.d.ts +26 -0
- package/dist/components/canvas-shell/canvas-shell.stories.d.ts.map +1 -0
- package/dist/components/canvas-shell/index.d.ts +2 -0
- package/dist/components/canvas-shell/index.d.ts.map +1 -0
- package/dist/components/card-item-picker/card-item-picker-context.d.ts +21 -0
- package/dist/components/card-item-picker/card-item-picker-context.d.ts.map +1 -0
- package/dist/components/card-item-picker/card-item-picker-list.d.ts +24 -0
- package/dist/components/card-item-picker/card-item-picker-list.d.ts.map +1 -0
- package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts +28 -0
- package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts.map +1 -0
- package/dist/components/card-item-picker/card-item-picker-row.d.ts +12 -0
- package/dist/components/card-item-picker/card-item-picker-row.d.ts.map +1 -0
- package/dist/components/card-item-picker/card-item-picker.stories.d.ts +19 -0
- package/dist/components/card-item-picker/card-item-picker.stories.d.ts.map +1 -0
- package/dist/components/card-item-picker/index.d.ts +9 -0
- package/dist/components/card-item-picker/index.d.ts.map +1 -0
- package/dist/components/chat-card/chat-card.d.ts +4 -0
- package/dist/components/chat-card/chat-card.d.ts.map +1 -0
- package/dist/components/chat-card/chat-card.stories.d.ts +11 -0
- package/dist/components/chat-card/chat-card.stories.d.ts.map +1 -0
- package/dist/components/chat-card/components/chat-card-body.d.ts +22 -0
- package/dist/components/chat-card/components/chat-card-body.d.ts.map +1 -0
- package/dist/components/chat-card/components/chat-card-footer.d.ts +20 -0
- package/dist/components/chat-card/components/chat-card-footer.d.ts.map +1 -0
- package/dist/components/chat-card/components/chat-card-form.d.ts +28 -0
- package/dist/components/chat-card/components/chat-card-form.d.ts.map +1 -0
- package/dist/components/chat-card/components/chat-card-header.d.ts +36 -0
- package/dist/components/chat-card/components/chat-card-header.d.ts.map +1 -0
- package/dist/components/chat-card/components/index.d.ts +5 -0
- package/dist/components/chat-card/components/index.d.ts.map +1 -0
- package/dist/components/chat-card/context.d.ts +13 -0
- package/dist/components/chat-card/context.d.ts.map +1 -0
- package/dist/components/chat-card/contexts.d.ts +16 -0
- package/dist/components/chat-card/contexts.d.ts.map +1 -0
- package/dist/components/chat-card/hooks.d.ts +13 -0
- package/dist/components/chat-card/hooks.d.ts.map +1 -0
- package/dist/components/chat-card/index.d.ts +6 -0
- package/dist/components/chat-card/index.d.ts.map +1 -0
- package/dist/components/chat-card/types.d.ts +21 -0
- package/dist/components/chat-card/types.d.ts.map +1 -0
- package/dist/components/chat-card-container/chat-card-container.d.ts +43 -0
- package/dist/components/chat-card-container/chat-card-container.d.ts.map +1 -0
- package/dist/components/chat-card-container/chat-card-container.stories.d.ts +17 -0
- package/dist/components/chat-card-container/chat-card-container.stories.d.ts.map +1 -0
- package/dist/components/chat-card-container/index.d.ts +3 -0
- package/dist/components/chat-card-container/index.d.ts.map +1 -0
- package/dist/components/chat-container/chat-container.d.ts +51 -0
- package/dist/components/chat-container/chat-container.d.ts.map +1 -0
- package/dist/components/chat-container/chat-container.stories.d.ts +21 -0
- package/dist/components/chat-container/chat-container.stories.d.ts.map +1 -0
- package/dist/components/chat-container/index.d.ts +3 -0
- package/dist/components/chat-container/index.d.ts.map +1 -0
- package/dist/components/chat-input/chat-input.d.ts +35 -0
- package/dist/components/chat-input/chat-input.d.ts.map +1 -0
- package/dist/components/chat-input/chat-input.stories.d.ts +14 -0
- package/dist/components/chat-input/chat-input.stories.d.ts.map +1 -0
- package/dist/components/chat-input/index.d.ts +3 -0
- package/dist/components/chat-input/index.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/auto-focus-plugin.d.ts +8 -0
- package/dist/components/chat-input/plugins/auto-focus-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/controlled-value-plugin.d.ts +6 -0
- package/dist/components/chat-input/plugins/controlled-value-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/disabled-plugin.d.ts +7 -0
- package/dist/components/chat-input/plugins/disabled-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/focus-plugin.d.ts +6 -0
- package/dist/components/chat-input/plugins/focus-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/has-value-plugin.d.ts +6 -0
- package/dist/components/chat-input/plugins/has-value-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/hooks.d.ts +2 -0
- package/dist/components/chat-input/plugins/hooks.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/index.d.ts +8 -0
- package/dist/components/chat-input/plugins/index.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/markdown-plain-paste-plugin.d.ts +2 -0
- package/dist/components/chat-input/plugins/markdown-plain-paste-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/utils.d.ts +4 -0
- package/dist/components/chat-input/plugins/utils.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/value-plugin.d.ts +6 -0
- package/dist/components/chat-input/plugins/value-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/transformers.d.ts +3 -0
- package/dist/components/chat-input/transformers.d.ts.map +1 -0
- package/dist/components/chat-list/chat-list-item.d.ts +8 -0
- package/dist/components/chat-list/chat-list-item.d.ts.map +1 -0
- package/dist/components/chat-list/chat-list-items.d.ts +11 -0
- package/dist/components/chat-list/chat-list-items.d.ts.map +1 -0
- package/dist/components/chat-list/chat-list.d.ts +63 -0
- package/dist/components/chat-list/chat-list.d.ts.map +1 -0
- package/dist/components/chat-list/chat-list.stories.d.ts +13 -0
- package/dist/components/chat-list/chat-list.stories.d.ts.map +1 -0
- package/dist/components/chat-list/index.d.ts +4 -0
- package/dist/components/chat-list/index.d.ts.map +1 -0
- package/dist/components/chat-message/chat-message.d.ts +17 -0
- package/dist/components/chat-message/chat-message.d.ts.map +1 -0
- package/dist/components/chat-message/chat-message.stories.d.ts +11 -0
- package/dist/components/chat-message/chat-message.stories.d.ts.map +1 -0
- package/dist/components/chat-message/index.d.ts +2 -0
- package/dist/components/chat-message/index.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts +9 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts +30 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts +11 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/index.d.ts +4 -0
- package/dist/components/chat-message-attachment-card/index.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/utils.d.ts +5 -0
- package/dist/components/chat-message-attachment-card/utils.d.ts.map +1 -0
- package/dist/components/chat-message-history/chat-message-history.d.ts +48 -0
- package/dist/components/chat-message-history/chat-message-history.d.ts.map +1 -0
- package/dist/components/chat-message-history/chat-message-history.stories.d.ts +7 -0
- package/dist/components/chat-message-history/chat-message-history.stories.d.ts.map +1 -0
- package/dist/components/chat-message-history/index.d.ts +2 -0
- package/dist/components/chat-message-history/index.d.ts.map +1 -0
- package/dist/components/chat-message-response/chat-message-response.d.ts +7 -0
- package/dist/components/chat-message-response/chat-message-response.d.ts.map +1 -0
- package/dist/components/chat-message-response/chat-message-response.stories.d.ts +7 -0
- package/dist/components/chat-message-response/chat-message-response.stories.d.ts.map +1 -0
- package/dist/components/chat-message-response/index.d.ts +2 -0
- package/dist/components/chat-message-response/index.d.ts.map +1 -0
- package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts +25 -0
- package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts.map +1 -0
- package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts +7 -0
- package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts.map +1 -0
- package/dist/components/chat-message-toolbar/index.d.ts +2 -0
- package/dist/components/chat-message-toolbar/index.d.ts.map +1 -0
- package/dist/components/chat-messages/chat-messages.d.ts +24 -0
- package/dist/components/chat-messages/chat-messages.d.ts.map +1 -0
- package/dist/components/chat-messages/chat-messages.stories.d.ts +8 -0
- package/dist/components/chat-messages/chat-messages.stories.d.ts.map +1 -0
- package/dist/components/chat-messages/index.d.ts +2 -0
- package/dist/components/chat-messages/index.d.ts.map +1 -0
- package/dist/components/chat-notification-card/chat-notification-card.d.ts +114 -0
- package/dist/components/chat-notification-card/chat-notification-card.d.ts.map +1 -0
- package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts +10 -0
- package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts.map +1 -0
- package/dist/components/chat-notification-card/index.d.ts +4 -0
- package/dist/components/chat-notification-card/index.d.ts.map +1 -0
- package/dist/components/chat-notification-card/types.d.ts +2 -0
- package/dist/components/chat-notification-card/types.d.ts.map +1 -0
- package/dist/components/chat-notification-card/utils.d.ts +3 -0
- package/dist/components/chat-notification-card/utils.d.ts.map +1 -0
- package/dist/components/chat-notification-popup/chat-notification-popup.d.ts +12 -0
- package/dist/components/chat-notification-popup/chat-notification-popup.d.ts.map +1 -0
- package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts +8 -0
- package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts.map +1 -0
- package/dist/components/chat-notification-popup/index.d.ts +2 -0
- package/dist/components/chat-notification-popup/index.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-context.d.ts +17 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-context.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-focus-plugin.d.ts +2 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-focus-plugin.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/chat-prompt-box.d.ts +27 -0
- package/dist/components/chat-prompt-box/chat-prompt-box.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts +9 -0
- package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/index.d.ts +3 -0
- package/dist/components/chat-prompt-box/index.d.ts.map +1 -0
- package/dist/components/chat-reply/chat-reply.d.ts +23 -0
- package/dist/components/chat-reply/chat-reply.d.ts.map +1 -0
- package/dist/components/chat-reply/chat-reply.stories.d.ts +7 -0
- package/dist/components/chat-reply/chat-reply.stories.d.ts.map +1 -0
- package/dist/components/chat-reply/index.d.ts +2 -0
- package/dist/components/chat-reply/index.d.ts.map +1 -0
- package/dist/components/chat-suggestion/chat-suggestion.d.ts +37 -0
- package/dist/components/chat-suggestion/chat-suggestion.d.ts.map +1 -0
- package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts +9 -0
- package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts.map +1 -0
- package/dist/components/chat-suggestion/index.d.ts +2 -0
- package/dist/components/chat-suggestion/index.d.ts.map +1 -0
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts +47 -0
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts.map +1 -0
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts +10 -0
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts.map +1 -0
- package/dist/components/chat-thinking-process/index.d.ts +2 -0
- package/dist/components/chat-thinking-process/index.d.ts.map +1 -0
- package/dist/components/chat-thread/chat-thread.d.ts +78 -0
- package/dist/components/chat-thread/chat-thread.d.ts.map +1 -0
- package/dist/components/chat-thread/chat-thread.stories.d.ts +14 -0
- package/dist/components/chat-thread/chat-thread.stories.d.ts.map +1 -0
- package/dist/components/chat-thread/index.d.ts +2 -0
- package/dist/components/chat-thread/index.d.ts.map +1 -0
- package/dist/components/deprecated-empty-state.d.ts +22 -0
- package/dist/components/deprecated-empty-state.d.ts.map +1 -0
- package/dist/components/index.d.ts +27 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/markdown-viewer/hooks.d.ts +9 -0
- package/dist/components/markdown-viewer/hooks.d.ts.map +1 -0
- package/dist/components/markdown-viewer/index.d.ts +3 -0
- package/dist/components/markdown-viewer/index.d.ts.map +1 -0
- package/dist/components/markdown-viewer/markdown-viewer.d.ts +10 -0
- package/dist/components/markdown-viewer/markdown-viewer.d.ts.map +1 -0
- package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts +9 -0
- package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts.map +1 -0
- package/dist/components/markdown-viewer/types.d.ts +9 -0
- package/dist/components/markdown-viewer/types.d.ts.map +1 -0
- package/dist/components/markdown-viewer/utils.d.ts +3 -0
- package/dist/components/markdown-viewer/utils.d.ts.map +1 -0
- package/dist/components/new-chat-trigger/index.d.ts +2 -0
- package/dist/components/new-chat-trigger/index.d.ts.map +1 -0
- package/dist/components/new-chat-trigger/new-chat-trigger.d.ts +8 -0
- package/dist/components/new-chat-trigger/new-chat-trigger.d.ts.map +1 -0
- package/dist/components/rich-text-area/constants/index.d.ts +3 -0
- package/dist/components/rich-text-area/constants/index.d.ts.map +1 -0
- package/dist/components/rich-text-area/hooks.d.ts +3 -0
- package/dist/components/rich-text-area/hooks.d.ts.map +1 -0
- package/dist/components/rich-text-area/html-config.d.ts +4 -0
- package/dist/components/rich-text-area/html-config.d.ts.map +1 -0
- package/dist/components/rich-text-area/index.d.ts +7 -0
- package/dist/components/rich-text-area/index.d.ts.map +1 -0
- package/dist/components/rich-text-area/nodes/div-block-node.d.ts +18 -0
- package/dist/components/rich-text-area/nodes/div-block-node.d.ts.map +1 -0
- package/dist/components/rich-text-area/nodes/image-node.d.ts +24 -0
- package/dist/components/rich-text-area/nodes/image-node.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/blur-plugin.d.ts +6 -0
- package/dist/components/rich-text-area/plugins/blur-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/controlled-plugin.d.ts +7 -0
- package/dist/components/rich-text-area/plugins/controlled-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/controlled-value-plugin.d.ts +7 -0
- package/dist/components/rich-text-area/plugins/controlled-value-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/disabled-plugin.d.ts +6 -0
- package/dist/components/rich-text-area/plugins/disabled-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/file-attachment-plugin.d.ts +10 -0
- package/dist/components/rich-text-area/plugins/file-attachment-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/focus-plugin.d.ts +6 -0
- package/dist/components/rich-text-area/plugins/focus-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/html-paste-plugin.d.ts +19 -0
- package/dist/components/rich-text-area/plugins/html-paste-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/image-drop-plugin.d.ts +12 -0
- package/dist/components/rich-text-area/plugins/image-drop-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/index.d.ts +11 -0
- package/dist/components/rich-text-area/plugins/index.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/markdown-plain-paste-plugin.d.ts +2 -0
- package/dist/components/rich-text-area/plugins/markdown-plain-paste-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/value-plugin.d.ts +7 -0
- package/dist/components/rich-text-area/plugins/value-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/rich-text-area.d.ts +20 -0
- package/dist/components/rich-text-area/rich-text-area.d.ts.map +1 -0
- package/dist/components/rich-text-area/rich-text-area.stories.d.ts +7 -0
- package/dist/components/rich-text-area/rich-text-area.stories.d.ts.map +1 -0
- package/dist/components/rich-text-area/styled.d.ts +3 -0
- package/dist/components/rich-text-area/styled.d.ts.map +1 -0
- package/dist/components/rich-text-area/transformers.d.ts +16 -0
- package/dist/components/rich-text-area/transformers.d.ts.map +1 -0
- package/dist/components/rich-text-area/types.d.ts +8 -0
- package/dist/components/rich-text-area/types.d.ts.map +1 -0
- package/dist/components/rich-text-area/utils/index.d.ts +6 -0
- package/dist/components/rich-text-area/utils/index.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/alignment-select.d.ts +5 -0
- package/dist/components/rich-text-field/components/alignment-select.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/attachment-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/attachment-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/bold-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/bold-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/clean-format-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/clean-format-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts +11 -0
- package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/image-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/image-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/index.d.ts +14 -0
- package/dist/components/rich-text-field/components/index.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/italic-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/italic-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/link-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/link-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/size-select.d.ts +5 -0
- package/dist/components/rich-text-field/components/size-select.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/text-color-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/text-color-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/toolbar-button.d.ts +6 -0
- package/dist/components/rich-text-field/components/toolbar-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/toolbar-select.d.ts +5 -0
- package/dist/components/rich-text-field/components/toolbar-select.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/typography-select.d.ts +5 -0
- package/dist/components/rich-text-field/components/typography-select.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/underline-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/underline-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/constants.d.ts +57 -0
- package/dist/components/rich-text-field/constants.d.ts.map +1 -0
- package/dist/components/rich-text-field/context.d.ts +26 -0
- package/dist/components/rich-text-field/context.d.ts.map +1 -0
- package/dist/components/rich-text-field/index.d.ts +3 -0
- package/dist/components/rich-text-field/index.d.ts.map +1 -0
- package/dist/components/rich-text-field/rich-text-field.d.ts +17 -0
- package/dist/components/rich-text-field/rich-text-field.d.ts.map +1 -0
- package/dist/components/rich-text-field/rich-text-field.stories.d.ts +10 -0
- package/dist/components/rich-text-field/rich-text-field.stories.d.ts.map +1 -0
- package/dist/components/rich-text-field/utils.d.ts +1759 -0
- package/dist/components/rich-text-field/utils.d.ts.map +1 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.d.ts.map +1 -0
- package/dist/components/spinner/spinner.d.ts +9 -0
- package/dist/components/spinner/spinner.d.ts.map +1 -0
- package/dist/components/spinner/spinner.stories.d.ts +8 -0
- package/dist/components/spinner/spinner.stories.d.ts.map +1 -0
- package/dist/contexts/chat-context/chat-context.d.ts +20 -0
- package/dist/contexts/chat-context/chat-context.d.ts.map +1 -0
- package/dist/contexts/chat-context/index.d.ts +2 -0
- package/dist/contexts/chat-context/index.d.ts.map +1 -0
- package/dist/contexts/chat-context/utils.d.ts +3 -0
- package/dist/contexts/chat-context/utils.d.ts.map +1 -0
- package/dist/contexts/chat-conversation-context/chat-conversation-context.d.ts +20 -0
- package/dist/contexts/chat-conversation-context/chat-conversation-context.d.ts.map +1 -0
- package/dist/contexts/chat-conversation-context/index.d.ts +2 -0
- package/dist/contexts/chat-conversation-context/index.d.ts.map +1 -0
- package/dist/contexts/index.d.ts +3 -0
- package/dist/contexts/index.d.ts.map +1 -0
- package/dist/docs/agent.stories.d.ts +41 -0
- package/dist/docs/agent.stories.d.ts.map +1 -0
- package/dist/docs/chat-panel.d.ts +33 -0
- package/dist/docs/chat-panel.d.ts.map +1 -0
- package/dist/docs/chatbot-panel.d.ts +20 -0
- package/dist/docs/chatbot-panel.d.ts.map +1 -0
- package/dist/docs/chatbot.stories.d.ts +11 -0
- package/dist/docs/chatbot.stories.d.ts.map +1 -0
- package/dist/domain/actions/constants.d.ts +2 -0
- package/dist/domain/actions/constants.d.ts.map +1 -0
- package/dist/domain/actions/hooks/index.d.ts +3 -0
- package/dist/domain/actions/hooks/index.d.ts.map +1 -0
- package/dist/domain/actions/index.d.ts +5 -0
- package/dist/domain/actions/index.d.ts.map +1 -0
- package/dist/domain/actions/types.d.ts +7 -0
- package/dist/domain/actions/types.d.ts.map +1 -0
- package/dist/domain/actions/utils/index.d.ts +11 -0
- package/dist/domain/actions/utils/index.d.ts.map +1 -0
- package/dist/domain/index.d.ts +2 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/use-chat-prompt-placeholder.d.ts +6 -0
- package/dist/hooks/use-chat-prompt-placeholder.d.ts.map +1 -0
- package/dist/hooks/use-chat-stream-message.d.ts +42 -0
- package/dist/hooks/use-chat-stream-message.d.ts.map +1 -0
- package/dist/hooks/use-current-chat-id.d.ts +2 -0
- package/dist/hooks/use-current-chat-id.d.ts.map +1 -0
- package/dist/hooks/use-is-current-chat-new.d.ts +2 -0
- package/dist/hooks/use-is-current-chat-new.d.ts.map +1 -0
- package/dist/hooks/use-loaded-chat-ids.d.ts +9 -0
- package/dist/hooks/use-loaded-chat-ids.d.ts.map +1 -0
- package/dist/hooks/use-on-chat-changed.d.ts +9 -0
- package/dist/hooks/use-on-chat-changed.d.ts.map +1 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +4404 -0
- package/dist/index.es.js.map +1 -0
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts +95 -0
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts.map +1 -0
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts +24 -0
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts.map +1 -0
- package/dist/layouts/chat-card-list-layout/index.d.ts +3 -0
- package/dist/layouts/chat-card-list-layout/index.d.ts.map +1 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.d.ts +84 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.d.ts.map +1 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.sizing.d.ts +45 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.sizing.d.ts.map +1 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts +37 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts.map +1 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.variants.d.ts +81 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.variants.d.ts.map +1 -0
- package/dist/layouts/chat-card-three-column-layout/index.d.ts +5 -0
- package/dist/layouts/chat-card-three-column-layout/index.d.ts.map +1 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts +31 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts.map +1 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.sizing.d.ts +12 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.sizing.d.ts.map +1 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts +19 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts.map +1 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.variants.d.ts +35 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.variants.d.ts.map +1 -0
- package/dist/layouts/chat-card-two-column-layout/index.d.ts +4 -0
- package/dist/layouts/chat-card-two-column-layout/index.d.ts.map +1 -0
- package/dist/layouts/index.d.ts +4 -0
- package/dist/layouts/index.d.ts.map +1 -0
- package/dist/types.d.ts +22 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/use-streaming-markdown.d.ts +18 -0
- package/dist/utils/use-streaming-markdown.d.ts.map +1 -0
- package/package.json +155 -0
- package/src/__tests__/setup.ts +5 -0
- package/src/components/canvas-shell/canvas-shell.json +126 -0
- package/src/components/canvas-shell/canvas-shell.stories.tsx +194 -0
- package/src/components/canvas-shell/canvas-shell.test.tsx +205 -0
- package/src/components/canvas-shell/canvas-shell.tsx +250 -0
- package/src/components/canvas-shell/index.ts +19 -0
- package/src/components/card-item-picker/__tests__/card-item-picker.spec.tsx +279 -0
- package/src/components/card-item-picker/card-item-picker-context.tsx +44 -0
- package/src/components/card-item-picker/card-item-picker-list.tsx +95 -0
- package/src/components/card-item-picker/card-item-picker-row-parts.tsx +96 -0
- package/src/components/card-item-picker/card-item-picker-row.tsx +109 -0
- package/src/components/card-item-picker/card-item-picker.json +147 -0
- package/src/components/card-item-picker/card-item-picker.stories.tsx +158 -0
- package/src/components/card-item-picker/index.ts +24 -0
- package/src/components/chat-card/__tests__/chat-card.spec.tsx +118 -0
- package/src/components/chat-card/chat-card.json +162 -0
- package/src/components/chat-card/chat-card.stories.tsx +349 -0
- package/src/components/chat-card/chat-card.tsx +106 -0
- package/src/components/chat-card/components/chat-card-body.tsx +115 -0
- package/src/components/chat-card/components/chat-card-footer.tsx +95 -0
- package/src/components/chat-card/components/chat-card-form.tsx +120 -0
- package/src/components/chat-card/components/chat-card-header.tsx +240 -0
- package/src/components/chat-card/components/index.ts +4 -0
- package/src/components/chat-card/context.tsx +34 -0
- package/src/components/chat-card/contexts.tsx +42 -0
- package/src/components/chat-card/hooks.ts +51 -0
- package/src/components/chat-card/index.ts +5 -0
- package/src/components/chat-card/types.ts +23 -0
- package/src/components/chat-card-container/chat-card-container.json +84 -0
- package/src/components/chat-card-container/chat-card-container.stories.tsx +149 -0
- package/src/components/chat-card-container/chat-card-container.tsx +75 -0
- package/src/components/chat-card-container/index.ts +2 -0
- package/src/components/chat-container/chat-container.json +93 -0
- package/src/components/chat-container/chat-container.stories.tsx +179 -0
- package/src/components/chat-container/chat-container.tsx +231 -0
- package/src/components/chat-container/index.ts +2 -0
- package/src/components/chat-input/chat-input.json +106 -0
- package/src/components/chat-input/chat-input.stories.tsx +291 -0
- package/src/components/chat-input/chat-input.tsx +220 -0
- package/src/components/chat-input/index.ts +2 -0
- package/src/components/chat-input/plugins/auto-focus-plugin.tsx +43 -0
- package/src/components/chat-input/plugins/controlled-value-plugin.tsx +47 -0
- package/src/components/chat-input/plugins/disabled-plugin.tsx +18 -0
- package/src/components/chat-input/plugins/focus-plugin.tsx +44 -0
- package/src/components/chat-input/plugins/has-value-plugin.tsx +51 -0
- package/src/components/chat-input/plugins/hooks.ts +7 -0
- package/src/components/chat-input/plugins/index.ts +7 -0
- package/src/components/chat-input/plugins/markdown-plain-paste-plugin.tsx +63 -0
- package/src/components/chat-input/plugins/utils.ts +48 -0
- package/src/components/chat-input/plugins/value-plugin.tsx +35 -0
- package/src/components/chat-input/transformers.ts +4 -0
- package/src/components/chat-list/chat-list-item.tsx +33 -0
- package/src/components/chat-list/chat-list-items.tsx +144 -0
- package/src/components/chat-list/chat-list.json +117 -0
- package/src/components/chat-list/chat-list.stories.tsx +332 -0
- package/src/components/chat-list/chat-list.tsx +278 -0
- package/src/components/chat-list/index.ts +18 -0
- package/src/components/chat-message/chat-message.json +105 -0
- package/src/components/chat-message/chat-message.stories.tsx +95 -0
- package/src/components/chat-message/chat-message.tsx +66 -0
- package/src/components/chat-message/index.ts +1 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card-icon.tsx +74 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.json +110 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.stories.tsx +131 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.tsx +142 -0
- package/src/components/chat-message-attachment-card/index.ts +12 -0
- package/src/components/chat-message-attachment-card/utils.ts +41 -0
- package/src/components/chat-message-history/chat-message-history.json +99 -0
- package/src/components/chat-message-history/chat-message-history.stories.tsx +136 -0
- package/src/components/chat-message-history/chat-message-history.tsx +277 -0
- package/src/components/chat-message-history/index.ts +13 -0
- package/src/components/chat-message-response/chat-message-response.json +68 -0
- package/src/components/chat-message-response/chat-message-response.stories.tsx +63 -0
- package/src/components/chat-message-response/chat-message-response.tsx +24 -0
- package/src/components/chat-message-response/index.ts +1 -0
- package/src/components/chat-message-toolbar/chat-message-toolbar.json +100 -0
- package/src/components/chat-message-toolbar/chat-message-toolbar.stories.tsx +62 -0
- package/src/components/chat-message-toolbar/chat-message-toolbar.tsx +97 -0
- package/src/components/chat-message-toolbar/index.ts +6 -0
- package/src/components/chat-messages/chat-messages.json +95 -0
- package/src/components/chat-messages/chat-messages.stories.tsx +284 -0
- package/src/components/chat-messages/chat-messages.tsx +264 -0
- package/src/components/chat-messages/index.ts +10 -0
- package/src/components/chat-notification-card/chat-notification-card.json +135 -0
- package/src/components/chat-notification-card/chat-notification-card.stories.tsx +290 -0
- package/src/components/chat-notification-card/chat-notification-card.tsx +684 -0
- package/src/components/chat-notification-card/index.ts +3 -0
- package/src/components/chat-notification-card/types.ts +1 -0
- package/src/components/chat-notification-card/utils.ts +34 -0
- package/src/components/chat-notification-popup/chat-notification-popup.json +97 -0
- package/src/components/chat-notification-popup/chat-notification-popup.stories.tsx +80 -0
- package/src/components/chat-notification-popup/chat-notification-popup.tsx +36 -0
- package/src/components/chat-notification-popup/index.ts +1 -0
- package/src/components/chat-prompt-box/chat-prompt-box-context.tsx +62 -0
- package/src/components/chat-prompt-box/chat-prompt-box-focus-plugin.tsx +22 -0
- package/src/components/chat-prompt-box/chat-prompt-box.json +106 -0
- package/src/components/chat-prompt-box/chat-prompt-box.stories.tsx +117 -0
- package/src/components/chat-prompt-box/chat-prompt-box.tsx +296 -0
- package/src/components/chat-prompt-box/index.ts +16 -0
- package/src/components/chat-reply/chat-reply.json +79 -0
- package/src/components/chat-reply/chat-reply.stories.tsx +72 -0
- package/src/components/chat-reply/chat-reply.tsx +103 -0
- package/src/components/chat-reply/index.ts +1 -0
- package/src/components/chat-suggestion/chat-suggestion.json +108 -0
- package/src/components/chat-suggestion/chat-suggestion.stories.tsx +147 -0
- package/src/components/chat-suggestion/chat-suggestion.tsx +184 -0
- package/src/components/chat-suggestion/index.ts +8 -0
- package/src/components/chat-thinking-process/chat-thinking-process.json +110 -0
- package/src/components/chat-thinking-process/chat-thinking-process.stories.tsx +202 -0
- package/src/components/chat-thinking-process/chat-thinking-process.tsx +268 -0
- package/src/components/chat-thinking-process/index.ts +9 -0
- package/src/components/chat-thread/__tests__/chat-thread.spec.tsx +385 -0
- package/src/components/chat-thread/chat-thread.json +120 -0
- package/src/components/chat-thread/chat-thread.stories.tsx +218 -0
- package/src/components/chat-thread/chat-thread.tsx +549 -0
- package/src/components/chat-thread/index.ts +18 -0
- package/src/components/deprecated-empty-state.ts +39 -0
- package/src/components/index.ts +26 -0
- package/src/components/markdown-viewer/hooks.ts +59 -0
- package/src/components/markdown-viewer/index.ts +2 -0
- package/src/components/markdown-viewer/markdown-viewer.json +84 -0
- package/src/components/markdown-viewer/markdown-viewer.stories.tsx +110 -0
- package/src/components/markdown-viewer/markdown-viewer.tsx +95 -0
- package/src/components/markdown-viewer/types.ts +10 -0
- package/src/components/markdown-viewer/utils.ts +5 -0
- package/src/components/new-chat-trigger/index.ts +1 -0
- package/src/components/new-chat-trigger/new-chat-trigger.tsx +29 -0
- package/src/components/rich-text-area/constants/index.ts +10 -0
- package/src/components/rich-text-area/hooks.ts +24 -0
- package/src/components/rich-text-area/html-config.ts +195 -0
- package/src/components/rich-text-area/index.ts +6 -0
- package/src/components/rich-text-area/nodes/div-block-node.tsx +145 -0
- package/src/components/rich-text-area/nodes/image-node.tsx +100 -0
- package/src/components/rich-text-area/plugins/blur-plugin.tsx +36 -0
- package/src/components/rich-text-area/plugins/controlled-plugin.tsx +23 -0
- package/src/components/rich-text-area/plugins/controlled-value-plugin.tsx +101 -0
- package/src/components/rich-text-area/plugins/disabled-plugin.tsx +17 -0
- package/src/components/rich-text-area/plugins/file-attachment-plugin.tsx +57 -0
- package/src/components/rich-text-area/plugins/focus-plugin.tsx +44 -0
- package/src/components/rich-text-area/plugins/html-paste-plugin.tsx +104 -0
- package/src/components/rich-text-area/plugins/image-drop-plugin.tsx +56 -0
- package/src/components/rich-text-area/plugins/index.ts +10 -0
- package/src/components/rich-text-area/plugins/markdown-plain-paste-plugin.tsx +63 -0
- package/src/components/rich-text-area/plugins/value-plugin.tsx +46 -0
- package/src/components/rich-text-area/rich-text-area.json +102 -0
- package/src/components/rich-text-area/rich-text-area.stories.tsx +140 -0
- package/src/components/rich-text-area/rich-text-area.tsx +156 -0
- package/src/components/rich-text-area/styled.tsx +20 -0
- package/src/components/rich-text-area/transformers.ts +175 -0
- package/src/components/rich-text-area/types.ts +8 -0
- package/src/components/rich-text-area/utils/index.ts +77 -0
- package/src/components/rich-text-field/components/alignment-select.tsx +103 -0
- package/src/components/rich-text-field/components/attachment-button.tsx +25 -0
- package/src/components/rich-text-field/components/bold-button.tsx +21 -0
- package/src/components/rich-text-field/components/clean-format-button.tsx +44 -0
- package/src/components/rich-text-field/components/formatting-toolbar-plugin.tsx +69 -0
- package/src/components/rich-text-field/components/image-button.tsx +11 -0
- package/src/components/rich-text-field/components/index.ts +14 -0
- package/src/components/rich-text-field/components/italic-button.tsx +21 -0
- package/src/components/rich-text-field/components/link-button.tsx +11 -0
- package/src/components/rich-text-field/components/size-select.tsx +27 -0
- package/src/components/rich-text-field/components/text-color-button.tsx +41 -0
- package/src/components/rich-text-field/components/toolbar-button.tsx +27 -0
- package/src/components/rich-text-field/components/toolbar-select.tsx +19 -0
- package/src/components/rich-text-field/components/typography-select.tsx +27 -0
- package/src/components/rich-text-field/components/underline-button.tsx +21 -0
- package/src/components/rich-text-field/constants.ts +33 -0
- package/src/components/rich-text-field/context.tsx +251 -0
- package/src/components/rich-text-field/index.tsx +6 -0
- package/src/components/rich-text-field/rich-text-field.json +118 -0
- package/src/components/rich-text-field/rich-text-field.stories.tsx +218 -0
- package/src/components/rich-text-field/rich-text-field.tsx +93 -0
- package/src/components/rich-text-field/utils.ts +532 -0
- package/src/components/spinner/index.ts +1 -0
- package/src/components/spinner/spinner.json +73 -0
- package/src/components/spinner/spinner.stories.tsx +41 -0
- package/src/components/spinner/spinner.tsx +32 -0
- package/src/contexts/chat-context/chat-context.tsx +97 -0
- package/src/contexts/chat-context/index.ts +1 -0
- package/src/contexts/chat-context/utils.ts +7 -0
- package/src/contexts/chat-conversation-context/chat-conversation-context.tsx +608 -0
- package/src/contexts/chat-conversation-context/index.ts +1 -0
- package/src/contexts/index.ts +2 -0
- package/src/docs/agent.stories.tsx +567 -0
- package/src/docs/chat-panel.tsx +174 -0
- package/src/docs/chatbot-panel.tsx +381 -0
- package/src/docs/chatbot.mdx +144 -0
- package/src/docs/chatbot.stories.tsx +63 -0
- package/src/domain/actions/constants.ts +1 -0
- package/src/domain/actions/hooks/index.ts +22 -0
- package/src/domain/actions/index.ts +4 -0
- package/src/domain/actions/types.ts +6 -0
- package/src/domain/actions/utils/index.ts +112 -0
- package/src/domain/index.ts +1 -0
- package/src/hooks/index.tsx +10 -0
- package/src/hooks/use-chat-prompt-placeholder.ts +7 -0
- package/src/hooks/use-chat-stream-message.ts +189 -0
- package/src/hooks/use-current-chat-id.ts +6 -0
- package/src/hooks/use-is-current-chat-new.ts +6 -0
- package/src/hooks/use-loaded-chat-ids.ts +32 -0
- package/src/hooks/use-on-chat-changed.ts +33 -0
- package/src/index.css +1 -0
- package/src/index.ts +6 -0
- package/src/layouts/chat-card-list-layout/__tests__/chat-card-list-layout.spec.tsx +204 -0
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.json +116 -0
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.stories.tsx +190 -0
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.tsx +250 -0
- package/src/layouts/chat-card-list-layout/index.ts +11 -0
- package/src/layouts/chat-card-three-column-layout/__tests__/chat-card-three-column-layout.sizing.test.ts +73 -0
- package/src/layouts/chat-card-three-column-layout/__tests__/chat-card-three-column-layout.spec.tsx +282 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.json +131 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.sizing.ts +78 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.tsx +273 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.tsx +291 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.variants.ts +135 -0
- package/src/layouts/chat-card-three-column-layout/index.ts +24 -0
- package/src/layouts/chat-card-two-column-layout/__tests__/chat-card-two-column-layout.spec.tsx +109 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.json +97 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.sizing.ts +21 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.tsx +138 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.tsx +132 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.variants.ts +65 -0
- package/src/layouts/chat-card-two-column-layout/index.ts +17 -0
- package/src/layouts/index.ts +3 -0
- package/src/types.ts +29 -0
- package/src/utils/use-streaming-markdown.ts +113 -0
- package/tailwind.css +7 -0
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { useEffect, useRef, useState, type ReactNode } from 'react';
|
|
3
|
+
import { expect, waitFor, within } from 'storybook/test';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
CopyIcon,
|
|
7
|
+
DatabaseSearchIcon,
|
|
8
|
+
ErrorIcon,
|
|
9
|
+
TableIcon,
|
|
10
|
+
ThumbsDownIcon,
|
|
11
|
+
ThumbsUpIcon,
|
|
12
|
+
ToolIcon,
|
|
13
|
+
WarningIcon,
|
|
14
|
+
} from '@swisper.ai/icons';
|
|
15
|
+
import { TooltipProvider } from '@swisper.ai/ui';
|
|
16
|
+
|
|
17
|
+
import { ChatMessage, ChatMessageActions, ChatMessageContent } from '../components/chat-message';
|
|
18
|
+
import {
|
|
19
|
+
ChatMessageToolbar,
|
|
20
|
+
ChatMessageToolbarActionButton,
|
|
21
|
+
ChatMessageToolbarActions,
|
|
22
|
+
ChatMessageToolbarTimestamp,
|
|
23
|
+
} from '../components/chat-message-toolbar';
|
|
24
|
+
import {
|
|
25
|
+
ChatThinkingProcess,
|
|
26
|
+
ChatThinkingProcessContent,
|
|
27
|
+
ChatThinkingProcessContentItem,
|
|
28
|
+
ChatThinkingProcessTrigger,
|
|
29
|
+
ChatThinkingProcessTriggerArrow,
|
|
30
|
+
ChatThinkingProcessTriggerIcon,
|
|
31
|
+
ChatThinkingProcessTriggerLabel,
|
|
32
|
+
} from '../components/chat-thinking-process';
|
|
33
|
+
import {
|
|
34
|
+
ChatThread,
|
|
35
|
+
ChatThreadAnswer,
|
|
36
|
+
ChatThreadGroup,
|
|
37
|
+
ChatThreadProvider,
|
|
38
|
+
ChatThreadQuestion,
|
|
39
|
+
} from '../components/chat-thread';
|
|
40
|
+
import { MarkdownViewer } from '../components/markdown-viewer';
|
|
41
|
+
import type { Markdown } from '../types';
|
|
42
|
+
|
|
43
|
+
import { ChatComposer } from './chat-panel';
|
|
44
|
+
|
|
45
|
+
// Fixtures
|
|
46
|
+
|
|
47
|
+
interface TextStep {
|
|
48
|
+
kind: 'text';
|
|
49
|
+
markdown: Markdown;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface ToolStep {
|
|
53
|
+
kind: 'tool';
|
|
54
|
+
/** Tool name as the agent calls it, shown in mono */
|
|
55
|
+
name: string;
|
|
56
|
+
/** One-line result shown on the collapsed call */
|
|
57
|
+
summary: string;
|
|
58
|
+
icon: ReactNode;
|
|
59
|
+
/** Output lines, printed one by one while the tool runs */
|
|
60
|
+
lines: string[];
|
|
61
|
+
status: 'done' | 'stopped';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type AgentStep = TextStep | ToolStep;
|
|
65
|
+
|
|
66
|
+
interface Run {
|
|
67
|
+
id: string;
|
|
68
|
+
prompt: string;
|
|
69
|
+
steps: AgentStep[];
|
|
70
|
+
time: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
type Script = AgentStep[];
|
|
74
|
+
|
|
75
|
+
const SUBSCRIPTIONS_PROMPT = 'Find my recurring payments and total them';
|
|
76
|
+
const RECONCILE_PROMPT = 'Reconcile my May statement and flag anything unusual';
|
|
77
|
+
|
|
78
|
+
const SCRIPTS: Record<string, Script> = {
|
|
79
|
+
[SUBSCRIPTIONS_PROMPT]: [
|
|
80
|
+
{
|
|
81
|
+
kind: 'text',
|
|
82
|
+
markdown: "I'll look for payments that repeat every month across your accounts.",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
kind: 'tool',
|
|
86
|
+
name: 'search_recurring',
|
|
87
|
+
summary: '4 subscriptions',
|
|
88
|
+
icon: <DatabaseSearchIcon />,
|
|
89
|
+
lines: [
|
|
90
|
+
'Scanning 12 months across UBS Private and Revolut CHF',
|
|
91
|
+
'Netflix CHF 20.90 monthly, 14th',
|
|
92
|
+
'Spotify CHF 13.95 monthly, 2nd',
|
|
93
|
+
'iCloud+ CHF 3.00 monthly, 21st',
|
|
94
|
+
'Tamedia digital CHF 52.05 monthly, 28th',
|
|
95
|
+
],
|
|
96
|
+
status: 'done',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
kind: 'text',
|
|
100
|
+
markdown:
|
|
101
|
+
'You pay **CHF 89.90 a month** for four subscriptions. You haven’t opened Tamedia in 60 days; cancelling it would save CHF 624.60 a year.',
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
[RECONCILE_PROMPT]: [
|
|
105
|
+
{
|
|
106
|
+
kind: 'text',
|
|
107
|
+
markdown:
|
|
108
|
+
"I'll pull May's transactions, match them against your UBS statement, then check for anything unusual.",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
kind: 'tool',
|
|
112
|
+
name: 'search_transactions',
|
|
113
|
+
summary: 'May 2026 · 110 transactions',
|
|
114
|
+
icon: <DatabaseSearchIcon />,
|
|
115
|
+
lines: [
|
|
116
|
+
'Accounts: UBS Private, Revolut CHF',
|
|
117
|
+
'Date range: 1 May – 31 May 2026',
|
|
118
|
+
'UBS Private: 87 transactions',
|
|
119
|
+
'Revolut CHF: 23 transactions',
|
|
120
|
+
'Money in: CHF 9,450.00',
|
|
121
|
+
'Money out: CHF 6,812.40',
|
|
122
|
+
'Done in 1.2 s',
|
|
123
|
+
],
|
|
124
|
+
status: 'done',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
kind: 'tool',
|
|
128
|
+
name: 'match_statement',
|
|
129
|
+
summary: '106 of 110 matched',
|
|
130
|
+
icon: <TableIcon />,
|
|
131
|
+
lines: [
|
|
132
|
+
'Reading UBS_statement_2026-05.pdf (6 pages)',
|
|
133
|
+
'Statement lines: 110',
|
|
134
|
+
'Matching on amount, date ±2 days and merchant',
|
|
135
|
+
'Matched: 106',
|
|
136
|
+
'Unmatched: 4',
|
|
137
|
+
'Coop Pronto Bern CHF 12.80 30 May pending',
|
|
138
|
+
'SBB Mobile CHF 24.00 31 May pending',
|
|
139
|
+
'Galaxus.ch CHF 139.00 31 May pending',
|
|
140
|
+
'Zalando CHF 89.95 31 May pending',
|
|
141
|
+
'All 4 are card authorisations that post in June',
|
|
142
|
+
],
|
|
143
|
+
status: 'done',
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
kind: 'text',
|
|
147
|
+
markdown:
|
|
148
|
+
'The 4 unmatched lines are pending card payments, not errors. Next I’ll categorise the month and look for anything out of the ordinary.',
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
kind: 'tool',
|
|
152
|
+
name: 'categorise',
|
|
153
|
+
summary: '110 transactions in 7 categories',
|
|
154
|
+
icon: <ToolIcon />,
|
|
155
|
+
lines: [
|
|
156
|
+
'Rent CHF 2,150.00',
|
|
157
|
+
'Travel CHF 1,180.40',
|
|
158
|
+
'Groceries CHF 412.30',
|
|
159
|
+
'Dining CHF 286.15',
|
|
160
|
+
'Transport CHF 154.00',
|
|
161
|
+
'Subscriptions CHF 89.90',
|
|
162
|
+
'Shopping & other CHF 2,539.65',
|
|
163
|
+
],
|
|
164
|
+
status: 'done',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
kind: 'tool',
|
|
168
|
+
name: 'detect_anomalies',
|
|
169
|
+
summary: '3 findings',
|
|
170
|
+
icon: <WarningIcon />,
|
|
171
|
+
lines: [
|
|
172
|
+
'Checking duplicates, new merchants and fee spikes',
|
|
173
|
+
'Duplicate: Migros Zürich HB CHF 84.20 × 2, 12 May 18:04 and 18:06',
|
|
174
|
+
'New merchant: Nordwind Digital GmbH CHF 249.00, 19 May',
|
|
175
|
+
'FX fees: CHF 38.60 this month, 3-month average CHF 12.40',
|
|
176
|
+
'Nothing else unusual in 110 transactions',
|
|
177
|
+
],
|
|
178
|
+
status: 'done',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
kind: 'text',
|
|
182
|
+
markdown: [
|
|
183
|
+
'**May is reconciled.** 106 of 110 transactions match your UBS statement; the other 4 are pending and will post in June.',
|
|
184
|
+
'',
|
|
185
|
+
'Three things are worth a look:',
|
|
186
|
+
'',
|
|
187
|
+
'1. **Possible duplicate** – Migros Zürich HB charged CHF 84.20 twice on 12 May, two minutes apart.',
|
|
188
|
+
'2. **New merchant** – CHF 249.00 to Nordwind Digital GmbH on 19 May. You haven’t paid them before.',
|
|
189
|
+
'3. **Higher FX fees** – CHF 38.60 in foreign-transaction fees, three times your usual, mostly from the Lisbon trip.',
|
|
190
|
+
'',
|
|
191
|
+
'Should I dispute the Migros duplicate with UBS?',
|
|
192
|
+
].join('\n'),
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const FALLBACK_SCRIPT: Script = [
|
|
198
|
+
{
|
|
199
|
+
kind: 'tool',
|
|
200
|
+
name: 'search_transactions',
|
|
201
|
+
summary: 'No matches',
|
|
202
|
+
icon: <DatabaseSearchIcon />,
|
|
203
|
+
lines: ['Accounts: UBS Private, Revolut CHF', 'No transactions match the request'],
|
|
204
|
+
status: 'done',
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
kind: 'text',
|
|
208
|
+
markdown:
|
|
209
|
+
"I couldn't find anything to work on for that. Try a task like reconciling a month or finding recurring payments.",
|
|
210
|
+
},
|
|
211
|
+
];
|
|
212
|
+
|
|
213
|
+
const HISTORY: Run[] = [
|
|
214
|
+
{
|
|
215
|
+
id: 'run-1',
|
|
216
|
+
prompt: SUBSCRIPTIONS_PROMPT,
|
|
217
|
+
steps: SCRIPTS[SUBSCRIPTIONS_PROMPT],
|
|
218
|
+
time: '09:41',
|
|
219
|
+
},
|
|
220
|
+
];
|
|
221
|
+
|
|
222
|
+
// Simulated run
|
|
223
|
+
|
|
224
|
+
/** Milliseconds between ticks */
|
|
225
|
+
const TICK_MS = 40;
|
|
226
|
+
/** Ticks between two output lines of a running tool */
|
|
227
|
+
const TICKS_PER_LINE = 6;
|
|
228
|
+
/** Ticks a finished tool stays open before the next step starts */
|
|
229
|
+
const TICKS_AFTER_TOOL = 8;
|
|
230
|
+
/** Characters of text revealed per tick */
|
|
231
|
+
const CHARS_PER_TICK = 6;
|
|
232
|
+
|
|
233
|
+
interface Progress {
|
|
234
|
+
runId: string;
|
|
235
|
+
/** Index of the step in progress; earlier steps are complete */
|
|
236
|
+
stepIndex: number;
|
|
237
|
+
/** Output lines printed, or characters revealed, of the step in progress */
|
|
238
|
+
count: number;
|
|
239
|
+
/** Ticks spent on the step in progress */
|
|
240
|
+
tick: number;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function advance(progress: Progress, steps: AgentStep[]): Progress | null {
|
|
244
|
+
const step = steps[progress.stepIndex];
|
|
245
|
+
const tick = progress.tick + 1;
|
|
246
|
+
const next = { ...progress, stepIndex: progress.stepIndex + 1, count: 0, tick: 0 };
|
|
247
|
+
|
|
248
|
+
if (step.kind === 'tool') {
|
|
249
|
+
if (progress.count < step.lines.length) {
|
|
250
|
+
return {
|
|
251
|
+
...progress,
|
|
252
|
+
tick,
|
|
253
|
+
count: tick % TICKS_PER_LINE === 0 ? progress.count + 1 : progress.count,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (tick < step.lines.length * TICKS_PER_LINE + TICKS_AFTER_TOOL) {
|
|
258
|
+
return { ...progress, tick };
|
|
259
|
+
}
|
|
260
|
+
} else if (progress.count < step.markdown.length) {
|
|
261
|
+
return { ...progress, tick, count: progress.count + CHARS_PER_TICK };
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return next.stepIndex < steps.length ? next : null;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** The part of a step shown so far: every step before `progress.stepIndex` is complete */
|
|
268
|
+
function visibleStep(step: AgentStep, count: number): AgentStep {
|
|
269
|
+
return step.kind === 'tool'
|
|
270
|
+
? { ...step, lines: step.lines.slice(0, count) }
|
|
271
|
+
: { ...step, markdown: step.markdown.slice(0, count) };
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function formatTime(date: Date) {
|
|
275
|
+
return date.toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit' });
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Demo
|
|
279
|
+
|
|
280
|
+
interface AgentPanelProps {
|
|
281
|
+
/** Runs already in the transcript when the panel opens */
|
|
282
|
+
initialRuns: Run[];
|
|
283
|
+
/** Task started as soon as the panel opens, to show the transcript following the output */
|
|
284
|
+
initialPrompt?: string;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function AgentPanel({ initialRuns, initialPrompt }: AgentPanelProps) {
|
|
288
|
+
const [runs, setRuns] = useState(initialRuns);
|
|
289
|
+
const [progress, setProgress] = useState<Progress | null>(null);
|
|
290
|
+
const [draft, setDraft] = useState('');
|
|
291
|
+
const hasStartedInitialPrompt = useRef(false);
|
|
292
|
+
|
|
293
|
+
const isRunning = progress !== null;
|
|
294
|
+
const activeSteps = runs.find((run) => run.id === progress?.runId)?.steps;
|
|
295
|
+
|
|
296
|
+
useEffect(() => {
|
|
297
|
+
if (!isRunning || !activeSteps) return;
|
|
298
|
+
|
|
299
|
+
const interval = window.setInterval(() => {
|
|
300
|
+
setProgress((current) => (current ? advance(current, activeSteps) : current));
|
|
301
|
+
}, TICK_MS);
|
|
302
|
+
|
|
303
|
+
return () => window.clearInterval(interval);
|
|
304
|
+
}, [isRunning, activeSteps]);
|
|
305
|
+
|
|
306
|
+
function start(text: string) {
|
|
307
|
+
const prompt = text.trim();
|
|
308
|
+
|
|
309
|
+
if (!prompt || isRunning) return;
|
|
310
|
+
|
|
311
|
+
const run: Run = {
|
|
312
|
+
id: `run-${Date.now()}`,
|
|
313
|
+
prompt,
|
|
314
|
+
steps: SCRIPTS[prompt] ?? FALLBACK_SCRIPT,
|
|
315
|
+
time: formatTime(new Date()),
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
setRuns((current) => [...current, run]);
|
|
319
|
+
setProgress({ runId: run.id, stepIndex: 0, count: 0, tick: 0 });
|
|
320
|
+
setDraft('');
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
function stop() {
|
|
324
|
+
if (!progress) return;
|
|
325
|
+
|
|
326
|
+
// Keep what the agent had produced, and say that the run was stopped
|
|
327
|
+
setRuns((current) =>
|
|
328
|
+
current.map((run) => {
|
|
329
|
+
if (run.id !== progress.runId) return run;
|
|
330
|
+
|
|
331
|
+
const partial = visibleStep(run.steps[progress.stepIndex], progress.count);
|
|
332
|
+
|
|
333
|
+
return {
|
|
334
|
+
...run,
|
|
335
|
+
steps: [
|
|
336
|
+
...run.steps.slice(0, progress.stepIndex),
|
|
337
|
+
partial.kind === 'tool' ? { ...partial, status: 'stopped' as const } : partial,
|
|
338
|
+
{ kind: 'text' as const, markdown: 'Stopped. Nothing was changed in your accounts.' },
|
|
339
|
+
],
|
|
340
|
+
};
|
|
341
|
+
}),
|
|
342
|
+
);
|
|
343
|
+
setProgress(null);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
useEffect(() => {
|
|
347
|
+
if (initialPrompt && !hasStartedInitialPrompt.current) {
|
|
348
|
+
hasStartedInitialPrompt.current = true;
|
|
349
|
+
start(initialPrompt);
|
|
350
|
+
}
|
|
351
|
+
// Start once on open only
|
|
352
|
+
}, []);
|
|
353
|
+
|
|
354
|
+
return (
|
|
355
|
+
// A centered agent panel, like Cursor's or Claude Code's: the transcript fills the height and
|
|
356
|
+
// the composer sits under it
|
|
357
|
+
<main aria-label="Swisper agent" className="flex size-full justify-center bg-paper-elevation-0">
|
|
358
|
+
<div className="flex size-full max-w-[600px] flex-col">
|
|
359
|
+
<div className="min-h-0 flex-1">
|
|
360
|
+
<ChatThreadProvider
|
|
361
|
+
conversationId="agent-transcript"
|
|
362
|
+
groupIds={runs.map((run) => run.id)}
|
|
363
|
+
isStreaming={isRunning}
|
|
364
|
+
scrollMode="follow"
|
|
365
|
+
>
|
|
366
|
+
<ChatThread
|
|
367
|
+
className="h-full"
|
|
368
|
+
contentClassName="gap-32 px-16 pt-24 pb-16"
|
|
369
|
+
scrollButtonTooltip="Jump to latest"
|
|
370
|
+
>
|
|
371
|
+
{runs.map((run) => (
|
|
372
|
+
<AgentRun
|
|
373
|
+
key={run.id}
|
|
374
|
+
run={run}
|
|
375
|
+
progress={progress?.runId === run.id ? progress : null}
|
|
376
|
+
/>
|
|
377
|
+
))}
|
|
378
|
+
</ChatThread>
|
|
379
|
+
</ChatThreadProvider>
|
|
380
|
+
</div>
|
|
381
|
+
|
|
382
|
+
<ChatComposer
|
|
383
|
+
className="px-16 pt-8 pb-24"
|
|
384
|
+
draft={draft}
|
|
385
|
+
onDraftChange={setDraft}
|
|
386
|
+
onSend={() => start(draft)}
|
|
387
|
+
placeholder="Give Swisper a task"
|
|
388
|
+
isBusy={isRunning}
|
|
389
|
+
onStop={stop}
|
|
390
|
+
/>
|
|
391
|
+
</div>
|
|
392
|
+
</main>
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
interface AgentRunProps {
|
|
397
|
+
run: Run;
|
|
398
|
+
/** Where the run is when it's still in progress */
|
|
399
|
+
progress: Progress | null;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
function AgentRun({ run, progress }: AgentRunProps) {
|
|
403
|
+
const steps = progress
|
|
404
|
+
? [
|
|
405
|
+
...run.steps.slice(0, progress.stepIndex),
|
|
406
|
+
visibleStep(run.steps[progress.stepIndex], progress.count),
|
|
407
|
+
]
|
|
408
|
+
: run.steps;
|
|
409
|
+
|
|
410
|
+
return (
|
|
411
|
+
<ChatThreadGroup groupId={run.id} className="gap-16">
|
|
412
|
+
<ChatThreadQuestion messageId={`${run.id}-prompt`}>
|
|
413
|
+
<ChatMessage isQuestion>
|
|
414
|
+
<ChatMessageContent>{run.prompt}</ChatMessageContent>
|
|
415
|
+
</ChatMessage>
|
|
416
|
+
</ChatThreadQuestion>
|
|
417
|
+
|
|
418
|
+
<ChatThreadAnswer messageId={`${run.id}-transcript`}>
|
|
419
|
+
<ChatMessage className="gap-12">
|
|
420
|
+
{steps.map((step, index) => {
|
|
421
|
+
const isActive = progress !== null && index === steps.length - 1;
|
|
422
|
+
|
|
423
|
+
return step.kind === 'tool' ? (
|
|
424
|
+
<AgentToolCall key={index} step={step} isRunning={isActive} />
|
|
425
|
+
) : (
|
|
426
|
+
<ChatMessageContent key={index}>
|
|
427
|
+
<MarkdownViewer
|
|
428
|
+
markdown={step.markdown}
|
|
429
|
+
isStreaming={isActive}
|
|
430
|
+
hasCaret={isActive}
|
|
431
|
+
/>
|
|
432
|
+
</ChatMessageContent>
|
|
433
|
+
);
|
|
434
|
+
})}
|
|
435
|
+
|
|
436
|
+
{!progress && (
|
|
437
|
+
<ChatMessageActions>
|
|
438
|
+
<ChatMessageToolbar>
|
|
439
|
+
<ChatMessageToolbarTimestamp>{run.time}</ChatMessageToolbarTimestamp>
|
|
440
|
+
<ChatMessageToolbarActions>
|
|
441
|
+
<ChatMessageToolbarActionButton tooltip="Copy" aria-label="Copy">
|
|
442
|
+
<CopyIcon />
|
|
443
|
+
</ChatMessageToolbarActionButton>
|
|
444
|
+
<ChatMessageToolbarActionButton
|
|
445
|
+
tooltip="Good response"
|
|
446
|
+
aria-label="Good response"
|
|
447
|
+
>
|
|
448
|
+
<ThumbsUpIcon />
|
|
449
|
+
</ChatMessageToolbarActionButton>
|
|
450
|
+
<ChatMessageToolbarActionButton tooltip="Bad response" aria-label="Bad response">
|
|
451
|
+
<ThumbsDownIcon />
|
|
452
|
+
</ChatMessageToolbarActionButton>
|
|
453
|
+
</ChatMessageToolbarActions>
|
|
454
|
+
</ChatMessageToolbar>
|
|
455
|
+
</ChatMessageActions>
|
|
456
|
+
)}
|
|
457
|
+
</ChatMessage>
|
|
458
|
+
</ChatThreadAnswer>
|
|
459
|
+
</ChatThreadGroup>
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
interface AgentToolCallProps {
|
|
464
|
+
step: ToolStep;
|
|
465
|
+
isRunning: boolean;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* One tool call. It stays open while the tool runs, so its output prints line by line and pushes the
|
|
470
|
+
* transcript down; once done it folds to a one-line summary the reader can expand.
|
|
471
|
+
*/
|
|
472
|
+
function AgentToolCall({ step, isRunning }: AgentToolCallProps) {
|
|
473
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
474
|
+
const isStopped = step.status === 'stopped';
|
|
475
|
+
|
|
476
|
+
return (
|
|
477
|
+
<ChatThinkingProcess
|
|
478
|
+
isStreaming={isRunning}
|
|
479
|
+
open={isRunning || isExpanded}
|
|
480
|
+
onOpenChange={setIsExpanded}
|
|
481
|
+
>
|
|
482
|
+
<ChatThinkingProcessTrigger>
|
|
483
|
+
<ChatThinkingProcessTriggerIcon className="text-text-secondary">
|
|
484
|
+
{isStopped ? <ErrorIcon /> : step.icon}
|
|
485
|
+
</ChatThinkingProcessTriggerIcon>
|
|
486
|
+
<ChatThinkingProcessTriggerLabel className="min-w-0 truncate">
|
|
487
|
+
<span className="font-ibm-plex-mono">{step.name}</span>
|
|
488
|
+
{' · '}
|
|
489
|
+
{isRunning ? 'Running…' : isStopped ? 'Stopped' : step.summary}
|
|
490
|
+
</ChatThinkingProcessTriggerLabel>
|
|
491
|
+
<ChatThinkingProcessTriggerArrow />
|
|
492
|
+
</ChatThinkingProcessTrigger>
|
|
493
|
+
|
|
494
|
+
<ChatThinkingProcessContent
|
|
495
|
+
hasLastMessagePreview={false}
|
|
496
|
+
itemsClassName="font-ibm-plex-mono whitespace-pre-wrap"
|
|
497
|
+
>
|
|
498
|
+
{step.lines.map((line, index) => (
|
|
499
|
+
<ChatThinkingProcessContentItem key={index} className="text-xs">
|
|
500
|
+
{line}
|
|
501
|
+
</ChatThinkingProcessContentItem>
|
|
502
|
+
))}
|
|
503
|
+
</ChatThinkingProcessContent>
|
|
504
|
+
</ChatThinkingProcess>
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
const meta: Meta<typeof AgentPanel> = {
|
|
509
|
+
title: 'Chatbot/Agent',
|
|
510
|
+
component: AgentPanel,
|
|
511
|
+
parameters: {
|
|
512
|
+
layout: 'fullscreen',
|
|
513
|
+
// The panel is size-full, so the story needs a sized parent. On the docs page, an iframe
|
|
514
|
+
// gives the viewport (and so `h-dvh` below) a fixed height instead of the whole docs page.
|
|
515
|
+
docs: { story: { inline: false, height: '720px' } },
|
|
516
|
+
},
|
|
517
|
+
decorators: [
|
|
518
|
+
(Story) => (
|
|
519
|
+
<TooltipProvider>
|
|
520
|
+
<div className="h-dvh">
|
|
521
|
+
<Story />
|
|
522
|
+
</div>
|
|
523
|
+
</TooltipProvider>
|
|
524
|
+
),
|
|
525
|
+
],
|
|
526
|
+
args: {
|
|
527
|
+
initialRuns: HISTORY,
|
|
528
|
+
},
|
|
529
|
+
argTypes: {
|
|
530
|
+
initialRuns: {
|
|
531
|
+
control: false,
|
|
532
|
+
description: 'Runs already in the transcript when the panel opens.',
|
|
533
|
+
},
|
|
534
|
+
initialPrompt: {
|
|
535
|
+
control: 'text',
|
|
536
|
+
description:
|
|
537
|
+
'Task started as soon as the panel opens, to show the transcript following the output.',
|
|
538
|
+
},
|
|
539
|
+
},
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
export default meta;
|
|
543
|
+
type Story = StoryObj<typeof AgentPanel>;
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* An agent running a multi-step task. Tool output prints line by line and the view follows it; scroll up
|
|
547
|
+
* to read earlier output and the view stays put until you jump back to the latest.
|
|
548
|
+
*/
|
|
549
|
+
export const Agent: Story = {
|
|
550
|
+
name: 'Agent',
|
|
551
|
+
args: {
|
|
552
|
+
initialPrompt: RECONCILE_PROMPT,
|
|
553
|
+
},
|
|
554
|
+
play: async ({ canvasElement }) => {
|
|
555
|
+
const canvas = within(canvasElement);
|
|
556
|
+
const viewport = canvas.getByRole('region', { name: 'Chat message history' });
|
|
557
|
+
|
|
558
|
+
await canvas.findByText('match_statement', {}, { timeout: 4000 });
|
|
559
|
+
|
|
560
|
+
await waitFor(() =>
|
|
561
|
+
expect(
|
|
562
|
+
viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight,
|
|
563
|
+
).toBeLessThanOrEqual(8),
|
|
564
|
+
);
|
|
565
|
+
await expect(canvas.getByRole('button', { name: 'Stop' })).toBeVisible();
|
|
566
|
+
},
|
|
567
|
+
};
|