meowtail 0.0.0-stage → 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/ASSISTANT.md +52 -0
- package/JSON.md +48 -0
- package/LICENSE +21 -0
- package/README.md +474 -2
- package/THIRD_PARTY_NOTICES.md +27 -0
- package/dist/src/chat/assistant-composer.d.ts +8 -0
- package/dist/src/chat/assistant-composer.js +246 -0
- package/dist/src/chat/assistant-content.d.ts +20 -0
- package/dist/src/chat/assistant-content.js +66 -0
- package/dist/src/chat/assistant-draft.d.ts +5 -0
- package/dist/src/chat/assistant-draft.js +23 -0
- package/dist/src/chat/assistant-markdown.d.ts +11 -0
- package/dist/src/chat/assistant-markdown.js +33 -0
- package/dist/src/chat/assistant-question.d.ts +12 -0
- package/dist/src/chat/assistant-question.js +95 -0
- package/dist/src/chat/assistant-scroll.d.ts +7 -0
- package/dist/src/chat/assistant-scroll.js +72 -0
- package/dist/src/chat/assistant-types.d.ts +174 -0
- package/dist/src/chat/assistant-types.js +40 -0
- package/dist/src/chat/assistant.d.ts +9 -0
- package/dist/src/chat/assistant.js +294 -0
- package/dist/src/chat/attachments.d.ts +23 -0
- package/dist/src/chat/attachments.js +81 -0
- package/dist/src/chat/bubble.d.ts +17 -0
- package/dist/src/chat/bubble.js +18 -0
- package/dist/src/chat/composer.d.ts +36 -0
- package/dist/src/chat/composer.js +31 -0
- package/dist/src/chat/conversation-scroll.d.ts +9 -0
- package/dist/src/chat/conversation-scroll.js +36 -0
- package/dist/src/chat/conversation.d.ts +16 -0
- package/dist/src/chat/conversation.js +62 -0
- package/dist/src/chat/frame.d.ts +9 -0
- package/dist/src/chat/frame.js +6 -0
- package/dist/src/chat/header.d.ts +14 -0
- package/dist/src/chat/header.js +15 -0
- package/dist/src/chat/index.d.ts +15 -0
- package/dist/src/chat/index.js +15 -0
- package/dist/src/chat/message-actions.d.ts +9 -0
- package/dist/src/chat/message-actions.js +6 -0
- package/dist/src/chat/message-context.d.ts +2 -0
- package/dist/src/chat/message-context.js +2 -0
- package/dist/src/chat/message-list.d.ts +25 -0
- package/dist/src/chat/message-list.js +23 -0
- package/dist/src/chat/message.d.ts +24 -0
- package/dist/src/chat/message.js +36 -0
- package/dist/src/chat/process.d.ts +11 -0
- package/dist/src/chat/process.js +9 -0
- package/dist/src/chat/question.d.ts +15 -0
- package/dist/src/chat/question.js +7 -0
- package/dist/src/chat/sources.d.ts +15 -0
- package/dist/src/chat/sources.js +19 -0
- package/dist/src/chat/status.d.ts +18 -0
- package/dist/src/chat/status.js +16 -0
- package/dist/src/chat/tool-call.d.ts +21 -0
- package/dist/src/chat/tool-call.js +40 -0
- package/dist/src/clipboard.d.ts +2 -0
- package/dist/src/clipboard.js +44 -0
- package/dist/src/components/add-button.d.ts +4 -0
- package/dist/src/components/add-button.js +8 -0
- package/dist/src/components/alert.d.ts +20 -0
- package/dist/src/components/alert.js +16 -0
- package/dist/src/components/aspect-ratio.d.ts +11 -0
- package/dist/src/components/aspect-ratio.js +19 -0
- package/dist/src/components/badge.d.ts +18 -0
- package/dist/src/components/badge.js +16 -0
- package/dist/src/components/breadcrumb.d.ts +15 -0
- package/dist/src/components/breadcrumb.js +10 -0
- package/dist/src/components/button.d.ts +31 -0
- package/dist/src/components/button.js +26 -0
- package/dist/src/components/card-action.d.ts +9 -0
- package/dist/src/components/card-action.js +6 -0
- package/dist/src/components/card-content.d.ts +9 -0
- package/dist/src/components/card-content.js +6 -0
- package/dist/src/components/card-description.d.ts +9 -0
- package/dist/src/components/card-description.js +6 -0
- package/dist/src/components/card-footer.d.ts +9 -0
- package/dist/src/components/card-footer.js +6 -0
- package/dist/src/components/card-header.d.ts +9 -0
- package/dist/src/components/card-header.js +6 -0
- package/dist/src/components/card-title.d.ts +10 -0
- package/dist/src/components/card-title.js +6 -0
- package/dist/src/components/card.d.ts +17 -0
- package/dist/src/components/card.js +19 -0
- package/dist/src/components/checkbox.d.ts +18 -0
- package/dist/src/components/checkbox.js +44 -0
- package/dist/src/components/choice-group.d.ts +27 -0
- package/dist/src/components/choice-group.js +85 -0
- package/dist/src/components/choice-select.d.ts +31 -0
- package/dist/src/components/choice-select.js +353 -0
- package/dist/src/components/code-block.d.ts +13 -0
- package/dist/src/components/code-block.js +71 -0
- package/dist/src/components/container.d.ts +17 -0
- package/dist/src/components/container.js +16 -0
- package/dist/src/components/credential-source.d.ts +22 -0
- package/dist/src/components/credential-source.js +34 -0
- package/dist/src/components/description-list.d.ts +20 -0
- package/dist/src/components/description-list.js +13 -0
- package/dist/src/components/detail-section.d.ts +16 -0
- package/dist/src/components/detail-section.js +12 -0
- package/dist/src/components/dialog.d.ts +43 -0
- package/dist/src/components/dialog.js +29 -0
- package/dist/src/components/diff-block.d.ts +21 -0
- package/dist/src/components/diff-block.js +24 -0
- package/dist/src/components/disclosure.d.ts +15 -0
- package/dist/src/components/disclosure.js +14 -0
- package/dist/src/components/drawer.d.ts +19 -0
- package/dist/src/components/drawer.js +56 -0
- package/dist/src/components/empty-state.d.ts +19 -0
- package/dist/src/components/empty-state.js +11 -0
- package/dist/src/components/field-group.d.ts +13 -0
- package/dist/src/components/field-group.js +20 -0
- package/dist/src/components/field.d.ts +16 -0
- package/dist/src/components/field.js +48 -0
- package/dist/src/components/grid.d.ts +27 -0
- package/dist/src/components/grid.js +29 -0
- package/dist/src/components/hover-card.d.ts +22 -0
- package/dist/src/components/hover-card.js +147 -0
- package/dist/src/components/icon-button.d.ts +17 -0
- package/dist/src/components/icon-button.js +17 -0
- package/dist/src/components/icon-rail.d.ts +20 -0
- package/dist/src/components/icon-rail.js +14 -0
- package/dist/src/components/image-lightbox.d.ts +14 -0
- package/dist/src/components/image-lightbox.js +51 -0
- package/dist/src/components/image-preview.d.ts +16 -0
- package/dist/src/components/image-preview.js +42 -0
- package/dist/src/components/index.d.ts +88 -0
- package/dist/src/components/index.js +87 -0
- package/dist/src/components/inline.d.ts +14 -0
- package/dist/src/components/inline.js +23 -0
- package/dist/src/components/input.d.ts +10 -0
- package/dist/src/components/input.js +6 -0
- package/dist/src/components/item.d.ts +26 -0
- package/dist/src/components/item.js +19 -0
- package/dist/src/components/json-block.d.ts +18 -0
- package/dist/src/components/json-block.js +49 -0
- package/dist/src/components/json-tree.d.ts +16 -0
- package/dist/src/components/json-tree.js +76 -0
- package/dist/src/components/layout-item.d.ts +15 -0
- package/dist/src/components/layout-item.js +16 -0
- package/dist/src/components/layout-types.d.ts +18 -0
- package/dist/src/components/layout-types.js +13 -0
- package/dist/src/components/list-group.d.ts +30 -0
- package/dist/src/components/list-group.js +32 -0
- package/dist/src/components/menu.d.ts +45 -0
- package/dist/src/components/menu.js +227 -0
- package/dist/src/components/nav-item.d.ts +13 -0
- package/dist/src/components/nav-item.js +19 -0
- package/dist/src/components/output-block.d.ts +20 -0
- package/dist/src/components/output-block.js +66 -0
- package/dist/src/components/page-frame.d.ts +21 -0
- package/dist/src/components/page-frame.js +16 -0
- package/dist/src/components/page-header.d.ts +15 -0
- package/dist/src/components/page-header.js +9 -0
- package/dist/src/components/path-label.d.ts +11 -0
- package/dist/src/components/path-label.js +37 -0
- package/dist/src/components/path-picker.d.ts +18 -0
- package/dist/src/components/path-picker.js +83 -0
- package/dist/src/components/pill.d.ts +11 -0
- package/dist/src/components/pill.js +14 -0
- package/dist/src/components/popover.d.ts +31 -0
- package/dist/src/components/popover.js +232 -0
- package/dist/src/components/process-group.d.ts +17 -0
- package/dist/src/components/process-group.js +8 -0
- package/dist/src/components/process-step.d.ts +13 -0
- package/dist/src/components/process-step.js +7 -0
- package/dist/src/components/rail-item.d.ts +25 -0
- package/dist/src/components/rail-item.js +16 -0
- package/dist/src/components/rail-section.d.ts +18 -0
- package/dist/src/components/rail-section.js +11 -0
- package/dist/src/components/read-block.d.ts +24 -0
- package/dist/src/components/read-block.js +82 -0
- package/dist/src/components/region-layout-types.d.ts +19 -0
- package/dist/src/components/region-layout-types.js +78 -0
- package/dist/src/components/region-layout.d.ts +19 -0
- package/dist/src/components/region-layout.js +254 -0
- package/dist/src/components/resource-card.d.ts +22 -0
- package/dist/src/components/resource-card.js +20 -0
- package/dist/src/components/resource-link.d.ts +18 -0
- package/dist/src/components/resource-link.js +14 -0
- package/dist/src/components/risk-confirmation.d.ts +22 -0
- package/dist/src/components/risk-confirmation.js +45 -0
- package/dist/src/components/search-block.d.ts +28 -0
- package/dist/src/components/search-block.js +40 -0
- package/dist/src/components/search-input.d.ts +18 -0
- package/dist/src/components/search-input.js +13 -0
- package/dist/src/components/segmented-control.d.ts +24 -0
- package/dist/src/components/segmented-control.js +63 -0
- package/dist/src/components/select.d.ts +17 -0
- package/dist/src/components/select.js +6 -0
- package/dist/src/components/separator.d.ts +10 -0
- package/dist/src/components/separator.js +11 -0
- package/dist/src/components/shortcut-keys.d.ts +12 -0
- package/dist/src/components/shortcut-keys.js +7 -0
- package/dist/src/components/skeleton-boundary.d.ts +12 -0
- package/dist/src/components/skeleton-boundary.js +73 -0
- package/dist/src/components/skeleton.d.ts +17 -0
- package/dist/src/components/skeleton.js +15 -0
- package/dist/src/components/spinner.d.ts +10 -0
- package/dist/src/components/spinner.js +7 -0
- package/dist/src/components/stack.d.ts +13 -0
- package/dist/src/components/stack.js +22 -0
- package/dist/src/components/state-dot.d.ts +14 -0
- package/dist/src/components/state-dot.js +28 -0
- package/dist/src/components/status-dot.d.ts +34 -0
- package/dist/src/components/status-dot.js +25 -0
- package/dist/src/components/switch.d.ts +9 -0
- package/dist/src/components/switch.js +8 -0
- package/dist/src/components/tabs.d.ts +24 -0
- package/dist/src/components/tabs.js +90 -0
- package/dist/src/components/tag.d.ts +23 -0
- package/dist/src/components/tag.js +16 -0
- package/dist/src/components/terminal-block.d.ts +24 -0
- package/dist/src/components/terminal-block.js +103 -0
- package/dist/src/components/text-shimmer.d.ts +15 -0
- package/dist/src/components/text-shimmer.js +17 -0
- package/dist/src/components/textarea.d.ts +9 -0
- package/dist/src/components/textarea.js +6 -0
- package/dist/src/components/timeline.d.ts +26 -0
- package/dist/src/components/timeline.js +17 -0
- package/dist/src/components/toast.d.ts +14 -0
- package/dist/src/components/toast.js +7 -0
- package/dist/src/components/toolbar.d.ts +12 -0
- package/dist/src/components/toolbar.js +155 -0
- package/dist/src/components/tooltip.d.ts +19 -0
- package/dist/src/components/tooltip.js +81 -0
- package/dist/src/components/web-block.d.ts +24 -0
- package/dist/src/components/web-block.js +40 -0
- package/dist/src/components/window-title-bar.d.ts +25 -0
- package/dist/src/components/window-title-bar.js +16 -0
- package/dist/src/components/work-card.d.ts +21 -0
- package/dist/src/components/work-card.js +11 -0
- package/dist/src/icons/LUCIDE-LICENSE +43 -0
- package/dist/src/icons/README.md +9 -0
- package/dist/src/icons/doodle-cat.d.ts +5 -0
- package/dist/src/icons/doodle-cat.js +8 -0
- package/dist/src/icons/external-arrow.d.ts +2 -0
- package/dist/src/icons/external-arrow.js +5 -0
- package/dist/src/icons/file-type-icon.d.ts +29 -0
- package/dist/src/icons/file-type-icon.js +211 -0
- package/dist/src/icons/github.d.ts +2 -0
- package/dist/src/icons/github.js +5 -0
- package/dist/src/icons/icon.d.ts +51 -0
- package/dist/src/icons/icon.js +135 -0
- package/dist/src/icons/index.d.ts +10 -0
- package/dist/src/icons/index.js +10 -0
- package/dist/src/icons/meowland-mark.d.ts +5 -0
- package/dist/src/icons/meowland-mark.js +5 -0
- package/dist/src/icons/notes.d.ts +2 -0
- package/dist/src/icons/notes.js +5 -0
- package/dist/src/icons/plus.d.ts +2 -0
- package/dist/src/icons/plus.js +5 -0
- package/dist/src/icons/search.d.ts +2 -0
- package/dist/src/icons/search.js +5 -0
- package/dist/src/icons/tasks.d.ts +2 -0
- package/dist/src/icons/tasks.js +5 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +5 -0
- package/dist/src/json/catalog.d.ts +169 -0
- package/dist/src/json/catalog.js +164 -0
- package/dist/src/json/index.d.ts +1 -0
- package/dist/src/json/index.js +1 -0
- package/dist/src/registry/index.d.ts +833 -0
- package/dist/src/registry/index.js +235 -0
- package/dist/src/registry.d.ts +1 -0
- package/dist/src/registry.js +1 -0
- package/dist/src/shared/dom-root.d.ts +3 -0
- package/dist/src/shared/dom-root.js +8 -0
- package/dist/src/shared/layout-style.d.ts +4 -0
- package/dist/src/shared/layout-style.js +13 -0
- package/dist/src/syntax-highlight.d.ts +26 -0
- package/dist/src/syntax-highlight.js +116 -0
- package/dist/src/theme/base.styles.d.ts +2 -0
- package/dist/src/theme/base.styles.js +26 -0
- package/dist/src/theme/chat/assistant.styles.d.ts +2 -0
- package/dist/src/theme/chat/assistant.styles.js +289 -0
- package/dist/src/theme/chat/attachments.styles.d.ts +1 -0
- package/dist/src/theme/chat/attachments.styles.js +255 -0
- package/dist/src/theme/chat/composer.styles.d.ts +1 -0
- package/dist/src/theme/chat/composer.styles.js +519 -0
- package/dist/src/theme/chat/conversation.styles.d.ts +1 -0
- package/dist/src/theme/chat/conversation.styles.js +57 -0
- package/dist/src/theme/chat/frame.styles.d.ts +1 -0
- package/dist/src/theme/chat/frame.styles.js +107 -0
- package/dist/src/theme/chat/header.styles.d.ts +1 -0
- package/dist/src/theme/chat/header.styles.js +93 -0
- package/dist/src/theme/chat/message.styles.d.ts +1 -0
- package/dist/src/theme/chat/message.styles.js +423 -0
- package/dist/src/theme/chat/question.styles.d.ts +1 -0
- package/dist/src/theme/chat/question.styles.js +57 -0
- package/dist/src/theme/chat/records.styles.d.ts +1 -0
- package/dist/src/theme/chat/records.styles.js +546 -0
- package/dist/src/theme/chat/status.styles.d.ts +1 -0
- package/dist/src/theme/chat/status.styles.js +75 -0
- package/dist/src/theme/components/alert.styles.d.ts +1 -0
- package/dist/src/theme/components/alert.styles.js +28 -0
- package/dist/src/theme/components/badge.styles.d.ts +1 -0
- package/dist/src/theme/components/badge.styles.js +66 -0
- package/dist/src/theme/components/breadcrumb.styles.d.ts +1 -0
- package/dist/src/theme/components/breadcrumb.styles.js +44 -0
- package/dist/src/theme/components/button.styles.d.ts +1 -0
- package/dist/src/theme/components/button.styles.js +143 -0
- package/dist/src/theme/components/card.styles.d.ts +1 -0
- package/dist/src/theme/components/card.styles.js +108 -0
- package/dist/src/theme/components/choice-group.styles.d.ts +1 -0
- package/dist/src/theme/components/choice-group.styles.js +87 -0
- package/dist/src/theme/components/choice-select.styles.d.ts +1 -0
- package/dist/src/theme/components/choice-select.styles.js +182 -0
- package/dist/src/theme/components/code-block.styles.d.ts +1 -0
- package/dist/src/theme/components/code-block.styles.js +77 -0
- package/dist/src/theme/components/description-list.styles.d.ts +1 -0
- package/dist/src/theme/components/description-list.styles.js +39 -0
- package/dist/src/theme/components/detail-section.styles.d.ts +1 -0
- package/dist/src/theme/components/detail-section.styles.js +43 -0
- package/dist/src/theme/components/dialog.styles.d.ts +1 -0
- package/dist/src/theme/components/dialog.styles.js +91 -0
- package/dist/src/theme/components/disclosure.styles.d.ts +1 -0
- package/dist/src/theme/components/disclosure.styles.js +79 -0
- package/dist/src/theme/components/drawer.styles.d.ts +2 -0
- package/dist/src/theme/components/drawer.styles.js +67 -0
- package/dist/src/theme/components/empty-state.styles.d.ts +1 -0
- package/dist/src/theme/components/empty-state.styles.js +51 -0
- package/dist/src/theme/components/field-group.styles.d.ts +1 -0
- package/dist/src/theme/components/field-group.styles.js +31 -0
- package/dist/src/theme/components/field.styles.d.ts +1 -0
- package/dist/src/theme/components/field.styles.js +31 -0
- package/dist/src/theme/components/hover-card.styles.d.ts +1 -0
- package/dist/src/theme/components/hover-card.styles.js +59 -0
- package/dist/src/theme/components/icon-rail.styles.d.ts +1 -0
- package/dist/src/theme/components/icon-rail.styles.js +236 -0
- package/dist/src/theme/components/image-lightbox.styles.d.ts +1 -0
- package/dist/src/theme/components/image-lightbox.styles.js +67 -0
- package/dist/src/theme/components/image-preview.styles.d.ts +1 -0
- package/dist/src/theme/components/image-preview.styles.js +68 -0
- package/dist/src/theme/components/item.styles.d.ts +1 -0
- package/dist/src/theme/components/item.styles.js +101 -0
- package/dist/src/theme/components/json.styles.d.ts +1 -0
- package/dist/src/theme/components/json.styles.js +127 -0
- package/dist/src/theme/components/layout.styles.d.ts +1 -0
- package/dist/src/theme/components/layout.styles.js +103 -0
- package/dist/src/theme/components/list-group.styles.d.ts +1 -0
- package/dist/src/theme/components/list-group.styles.js +98 -0
- package/dist/src/theme/components/menu.styles.d.ts +1 -0
- package/dist/src/theme/components/menu.styles.js +77 -0
- package/dist/src/theme/components/native-input.styles.d.ts +1 -0
- package/dist/src/theme/components/native-input.styles.js +113 -0
- package/dist/src/theme/components/nav-item.styles.d.ts +1 -0
- package/dist/src/theme/components/nav-item.styles.js +68 -0
- package/dist/src/theme/components/output-block.styles.d.ts +1 -0
- package/dist/src/theme/components/output-block.styles.js +226 -0
- package/dist/src/theme/components/page-frame.styles.d.ts +1 -0
- package/dist/src/theme/components/page-frame.styles.js +57 -0
- package/dist/src/theme/components/page-header.styles.d.ts +1 -0
- package/dist/src/theme/components/page-header.styles.js +39 -0
- package/dist/src/theme/components/path-label.styles.d.ts +1 -0
- package/dist/src/theme/components/path-label.styles.js +27 -0
- package/dist/src/theme/components/path-picker.styles.d.ts +1 -0
- package/dist/src/theme/components/path-picker.styles.js +33 -0
- package/dist/src/theme/components/pill.styles.d.ts +1 -0
- package/dist/src/theme/components/pill.styles.js +39 -0
- package/dist/src/theme/components/popover.styles.d.ts +1 -0
- package/dist/src/theme/components/popover.styles.js +49 -0
- package/dist/src/theme/components/process-group.styles.d.ts +1 -0
- package/dist/src/theme/components/process-group.styles.js +141 -0
- package/dist/src/theme/components/region-layout.styles.d.ts +1 -0
- package/dist/src/theme/components/region-layout.styles.js +57 -0
- package/dist/src/theme/components/resource-card.styles.d.ts +1 -0
- package/dist/src/theme/components/resource-card.styles.js +105 -0
- package/dist/src/theme/components/resource-card.tokens.d.ts +5 -0
- package/dist/src/theme/components/resource-card.tokens.js +6 -0
- package/dist/src/theme/components/resource-link.styles.d.ts +1 -0
- package/dist/src/theme/components/resource-link.styles.js +78 -0
- package/dist/src/theme/components/risk-confirmation.styles.d.ts +1 -0
- package/dist/src/theme/components/risk-confirmation.styles.js +9 -0
- package/dist/src/theme/components/search-input.styles.d.ts +1 -0
- package/dist/src/theme/components/search-input.styles.js +63 -0
- package/dist/src/theme/components/segmented-control.styles.d.ts +1 -0
- package/dist/src/theme/components/segmented-control.styles.js +63 -0
- package/dist/src/theme/components/separator.styles.d.ts +1 -0
- package/dist/src/theme/components/separator.styles.js +15 -0
- package/dist/src/theme/components/shortcut-keys.styles.d.ts +1 -0
- package/dist/src/theme/components/shortcut-keys.styles.js +34 -0
- package/dist/src/theme/components/skeleton.styles.d.ts +1 -0
- package/dist/src/theme/components/skeleton.styles.js +43 -0
- package/dist/src/theme/components/spinner.styles.d.ts +1 -0
- package/dist/src/theme/components/spinner.styles.js +27 -0
- package/dist/src/theme/components/state-dot.styles.d.ts +1 -0
- package/dist/src/theme/components/state-dot.styles.js +68 -0
- package/dist/src/theme/components/status-dot.styles.d.ts +1 -0
- package/dist/src/theme/components/status-dot.styles.js +72 -0
- package/dist/src/theme/components/tabs.styles.d.ts +1 -0
- package/dist/src/theme/components/tabs.styles.js +93 -0
- package/dist/src/theme/components/tag.styles.d.ts +1 -0
- package/dist/src/theme/components/tag.styles.js +55 -0
- package/dist/src/theme/components/text-shimmer.styles.d.ts +1 -0
- package/dist/src/theme/components/text-shimmer.styles.js +59 -0
- package/dist/src/theme/components/timeline.styles.d.ts +1 -0
- package/dist/src/theme/components/timeline.styles.js +87 -0
- package/dist/src/theme/components/toast.styles.d.ts +1 -0
- package/dist/src/theme/components/toast.styles.js +48 -0
- package/dist/src/theme/components/toggle.styles.d.ts +1 -0
- package/dist/src/theme/components/toggle.styles.js +85 -0
- package/dist/src/theme/components/toolbar.styles.d.ts +1 -0
- package/dist/src/theme/components/toolbar.styles.js +22 -0
- package/dist/src/theme/components/tooltip.styles.d.ts +1 -0
- package/dist/src/theme/components/tooltip.styles.js +26 -0
- package/dist/src/theme/components/web-block.styles.d.ts +1 -0
- package/dist/src/theme/components/web-block.styles.js +48 -0
- package/dist/src/theme/components/window-title-bar.styles.d.ts +6 -0
- package/dist/src/theme/components/window-title-bar.styles.js +57 -0
- package/dist/src/theme/components/work-card.styles.d.ts +1 -0
- package/dist/src/theme/components/work-card.styles.js +78 -0
- package/dist/src/theme/icons/icons.styles.d.ts +1 -0
- package/dist/src/theme/icons/icons.styles.js +29 -0
- package/dist/src/theme/index.d.ts +3 -0
- package/dist/src/theme/index.js +168 -0
- package/dist/src/theme/palette.d.ts +55 -0
- package/dist/src/theme/palette.js +56 -0
- package/dist/src/theme/shared/code-highlight.styles.d.ts +1 -0
- package/dist/src/theme/shared/code-highlight.styles.js +20 -0
- package/dist/src/theme/shared/code-highlight.tokens.d.ts +12 -0
- package/dist/src/theme/shared/code-highlight.tokens.js +13 -0
- package/dist/src/theme/tokens.d.ts +111 -0
- package/dist/src/theme/tokens.js +128 -0
- package/package.json +62 -4
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type { Child, MaybeSignal, Props } from "meowjsx";
|
|
2
|
+
import type { ChatAttachmentItem } from "./attachments.js";
|
|
3
|
+
import type { ChatMessageRole, ChatMessageStatus } from "./message.js";
|
|
4
|
+
import type { StatusDotState } from "../components/status-dot.js";
|
|
5
|
+
export interface AssistantAttachment extends Omit<ChatAttachmentItem, "onRemove"> {
|
|
6
|
+
/** Optional local source. The component never uploads or persists files. */
|
|
7
|
+
file?: File;
|
|
8
|
+
}
|
|
9
|
+
export interface AssistantDraft {
|
|
10
|
+
text: string;
|
|
11
|
+
attachments: readonly AssistantAttachment[];
|
|
12
|
+
}
|
|
13
|
+
export interface AssistantProcessStep {
|
|
14
|
+
id: string;
|
|
15
|
+
title: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
statusText?: string;
|
|
18
|
+
tone?: StatusDotState;
|
|
19
|
+
}
|
|
20
|
+
export type AssistantMessagePart = {
|
|
21
|
+
id: string;
|
|
22
|
+
kind: "text";
|
|
23
|
+
text: string;
|
|
24
|
+
} | {
|
|
25
|
+
id: string;
|
|
26
|
+
kind: "code";
|
|
27
|
+
code: string;
|
|
28
|
+
language?: string;
|
|
29
|
+
} | {
|
|
30
|
+
id: string;
|
|
31
|
+
kind: "process";
|
|
32
|
+
title: string;
|
|
33
|
+
statusText?: string;
|
|
34
|
+
steps: readonly AssistantProcessStep[];
|
|
35
|
+
defaultOpen?: boolean;
|
|
36
|
+
} | {
|
|
37
|
+
id: string;
|
|
38
|
+
kind: "attachments";
|
|
39
|
+
items: readonly AssistantAttachment[];
|
|
40
|
+
};
|
|
41
|
+
export interface AssistantMessage {
|
|
42
|
+
id: string;
|
|
43
|
+
role: ChatMessageRole;
|
|
44
|
+
author: string;
|
|
45
|
+
timestamp?: string;
|
|
46
|
+
status?: ChatMessageStatus;
|
|
47
|
+
parts: readonly AssistantMessagePart[];
|
|
48
|
+
}
|
|
49
|
+
export interface AssistantActivity {
|
|
50
|
+
title: string;
|
|
51
|
+
statusText: string;
|
|
52
|
+
tone?: StatusDotState;
|
|
53
|
+
description?: string;
|
|
54
|
+
steps?: readonly AssistantProcessStep[];
|
|
55
|
+
}
|
|
56
|
+
/** Display facts supplied by the owner. Returned execution and a published reply are distinct. */
|
|
57
|
+
export interface AssistantWork {
|
|
58
|
+
id: string;
|
|
59
|
+
title: string;
|
|
60
|
+
summary?: string;
|
|
61
|
+
statusText: string;
|
|
62
|
+
tone?: StatusDotState;
|
|
63
|
+
executionText?: string;
|
|
64
|
+
replyText?: string;
|
|
65
|
+
detail?: string;
|
|
66
|
+
readState?: "ready" | "loading" | "error" | "unavailable";
|
|
67
|
+
feedback?: string;
|
|
68
|
+
steps?: readonly AssistantProcessStep[];
|
|
69
|
+
}
|
|
70
|
+
export interface AssistantQuestion {
|
|
71
|
+
id: string;
|
|
72
|
+
title: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
options?: readonly {
|
|
75
|
+
value: string;
|
|
76
|
+
label: string;
|
|
77
|
+
}[];
|
|
78
|
+
state: "open" | "submitting" | "answered" | "unavailable";
|
|
79
|
+
feedback?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface AssistantChoice {
|
|
82
|
+
value: string;
|
|
83
|
+
label: string;
|
|
84
|
+
disabled?: boolean;
|
|
85
|
+
}
|
|
86
|
+
export interface AssistantViewProps extends Props {
|
|
87
|
+
title?: string;
|
|
88
|
+
description?: string;
|
|
89
|
+
messages: MaybeSignal<readonly AssistantMessage[]>;
|
|
90
|
+
/** First loading, empty, and refresh failure with retained messages are separate states. */
|
|
91
|
+
readState?: MaybeSignal<"ready" | "loading" | "error">;
|
|
92
|
+
readFeedback?: MaybeSignal<string>;
|
|
93
|
+
activity?: MaybeSignal<AssistantActivity | undefined>;
|
|
94
|
+
work?: MaybeSignal<readonly AssistantWork[]>;
|
|
95
|
+
questions?: MaybeSignal<readonly AssistantQuestion[]>;
|
|
96
|
+
/** Supplying draft makes the host its sole owner, even for a plain value. */
|
|
97
|
+
draft?: MaybeSignal<AssistantDraft>;
|
|
98
|
+
defaultDraft?: AssistantDraft;
|
|
99
|
+
readOnly?: boolean;
|
|
100
|
+
onDraftChange?: (draft: AssistantDraft) => void;
|
|
101
|
+
/** Only an explicit accepted:true may clear an unchanged submitted snapshot. */
|
|
102
|
+
onSubmit?: (draft: AssistantDraft) => {
|
|
103
|
+
accepted: boolean;
|
|
104
|
+
} | Promise<{
|
|
105
|
+
accepted: boolean;
|
|
106
|
+
}>;
|
|
107
|
+
/** Host attachment ingestion. Return normalized entries or update controlled draft. No upload is implicit. */
|
|
108
|
+
onAttach?: (files: readonly File[]) => readonly AssistantAttachment[] | void | Promise<readonly AssistantAttachment[] | void>;
|
|
109
|
+
/** Disable local file selection when the host supports only already-normalized attachments. */
|
|
110
|
+
allowAttachments?: boolean;
|
|
111
|
+
disabled?: MaybeSignal<boolean>;
|
|
112
|
+
disabledReason?: MaybeSignal<string>;
|
|
113
|
+
models?: MaybeSignal<readonly AssistantChoice[]>;
|
|
114
|
+
model?: MaybeSignal<string>;
|
|
115
|
+
onModelChange?: (value: string) => void;
|
|
116
|
+
reasoningOptions?: MaybeSignal<readonly AssistantChoice[]>;
|
|
117
|
+
reasoning?: MaybeSignal<string>;
|
|
118
|
+
onReasoningChange?: (value: string) => void;
|
|
119
|
+
onAnswer?: (questionId: string, answer: string) => void | Promise<void>;
|
|
120
|
+
onDismissQuestion?: (questionId: string) => void;
|
|
121
|
+
onRefreshWork?: (workId: string) => void;
|
|
122
|
+
onLoadOlder?: () => void;
|
|
123
|
+
loadingOlder?: MaybeSignal<boolean>;
|
|
124
|
+
/** Return undefined to keep the default renderer for this one part. */
|
|
125
|
+
renderPart?: (part: AssistantMessagePart, message: AssistantMessage) => Child | undefined;
|
|
126
|
+
renderWorkDetail?: (work: AssistantWork) => Child | undefined;
|
|
127
|
+
composerTrailing?: Child;
|
|
128
|
+
headerActions?: Child;
|
|
129
|
+
className?: string;
|
|
130
|
+
labels?: Partial<AssistantLabels>;
|
|
131
|
+
}
|
|
132
|
+
/** Central default copy, overridable through the component's data and localized host wrappers. */
|
|
133
|
+
export declare const assistantCopy: {
|
|
134
|
+
readonly title: "Assistant";
|
|
135
|
+
readonly messages: "Messages";
|
|
136
|
+
readonly latest: "Back to latest";
|
|
137
|
+
readonly older: "Load older messages";
|
|
138
|
+
readonly loading: "Loading messages…";
|
|
139
|
+
readonly empty: "How can I help?";
|
|
140
|
+
readonly emptyDescription: "Write a message or attach a file to begin.";
|
|
141
|
+
readonly readError: "Messages could not be refreshed. Previously read messages are retained.";
|
|
142
|
+
readonly composer: "Message";
|
|
143
|
+
readonly placeholder: "Write a message…";
|
|
144
|
+
readonly send: "Send message";
|
|
145
|
+
readonly attach: "Attach files";
|
|
146
|
+
readonly model: "Model";
|
|
147
|
+
readonly reasoning: "Reasoning";
|
|
148
|
+
readonly rejected: "The message was not accepted. Your draft is retained.";
|
|
149
|
+
readonly submitError: "The message could not be sent. Your draft is retained.";
|
|
150
|
+
readonly attachError: "The files could not be attached. Your draft is retained.";
|
|
151
|
+
readonly activity: "Activity";
|
|
152
|
+
readonly close: "Close activity";
|
|
153
|
+
readonly back: "Back to activity";
|
|
154
|
+
readonly current: "Current activity";
|
|
155
|
+
readonly noActivity: "No current activity reported.";
|
|
156
|
+
readonly background: "Background work";
|
|
157
|
+
readonly noWork: "No background work reported.";
|
|
158
|
+
readonly questions: "Needs your answer";
|
|
159
|
+
readonly answer: "Answer";
|
|
160
|
+
readonly answerPlaceholder: "Write your answer…";
|
|
161
|
+
readonly dismiss: "Dismiss";
|
|
162
|
+
readonly answerError: "The answer could not be submitted. Your answer is retained.";
|
|
163
|
+
readonly questionSubmitting: "Submitting answer…";
|
|
164
|
+
readonly questionAnswered: "Answer received";
|
|
165
|
+
readonly questionUnavailable: "This question is no longer available.";
|
|
166
|
+
readonly workLoading: "Loading details…";
|
|
167
|
+
readonly workError: "Details could not be refreshed. Previously read content is retained.";
|
|
168
|
+
readonly workUnavailable: "These details are no longer available.";
|
|
169
|
+
readonly refresh: "Refresh details";
|
|
170
|
+
readonly details: "Details";
|
|
171
|
+
};
|
|
172
|
+
export type AssistantLabels = {
|
|
173
|
+
readonly [Key in keyof typeof assistantCopy]: string;
|
|
174
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Central default copy, overridable through the component's data and localized host wrappers. */
|
|
2
|
+
export const assistantCopy = {
|
|
3
|
+
title: "Assistant",
|
|
4
|
+
messages: "Messages",
|
|
5
|
+
latest: "Back to latest",
|
|
6
|
+
older: "Load older messages",
|
|
7
|
+
loading: "Loading messages…",
|
|
8
|
+
empty: "How can I help?",
|
|
9
|
+
emptyDescription: "Write a message or attach a file to begin.",
|
|
10
|
+
readError: "Messages could not be refreshed. Previously read messages are retained.",
|
|
11
|
+
composer: "Message",
|
|
12
|
+
placeholder: "Write a message…",
|
|
13
|
+
send: "Send message",
|
|
14
|
+
attach: "Attach files",
|
|
15
|
+
model: "Model",
|
|
16
|
+
reasoning: "Reasoning",
|
|
17
|
+
rejected: "The message was not accepted. Your draft is retained.",
|
|
18
|
+
submitError: "The message could not be sent. Your draft is retained.",
|
|
19
|
+
attachError: "The files could not be attached. Your draft is retained.",
|
|
20
|
+
activity: "Activity",
|
|
21
|
+
close: "Close activity",
|
|
22
|
+
back: "Back to activity",
|
|
23
|
+
current: "Current activity",
|
|
24
|
+
noActivity: "No current activity reported.",
|
|
25
|
+
background: "Background work",
|
|
26
|
+
noWork: "No background work reported.",
|
|
27
|
+
questions: "Needs your answer",
|
|
28
|
+
answer: "Answer",
|
|
29
|
+
answerPlaceholder: "Write your answer…",
|
|
30
|
+
dismiss: "Dismiss",
|
|
31
|
+
answerError: "The answer could not be submitted. Your answer is retained.",
|
|
32
|
+
questionSubmitting: "Submitting answer…",
|
|
33
|
+
questionAnswered: "Answer received",
|
|
34
|
+
questionUnavailable: "This question is no longer available.",
|
|
35
|
+
workLoading: "Loading details…",
|
|
36
|
+
workError: "Details could not be refreshed. Previously read content is retained.",
|
|
37
|
+
workUnavailable: "These details are no longer available.",
|
|
38
|
+
refresh: "Refresh details",
|
|
39
|
+
details: "Details",
|
|
40
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type AssistantViewProps } from "./assistant-types.js";
|
|
2
|
+
export declare const assistantViewContract: {
|
|
3
|
+
readonly name: "assistant-view";
|
|
4
|
+
readonly parts: readonly ["root", "layout", "messages", "viewport", "content", "latest", "composer", "feedback", "empty", "activity", "activityHeader", "activityBody", "section", "workDetail", "status"];
|
|
5
|
+
};
|
|
6
|
+
/** A complete default Assistant surface. Data, permissions, network and business lifetime stay with the host. */
|
|
7
|
+
export declare const AssistantView: import("meowjsx").Component<AssistantViewProps, "assistant-view", "activity" | "activityBody" | "activityHeader" | "composer" | "content" | "empty" | "feedback" | "latest" | "layout" | "messages" | "root" | "section" | "status" | "viewport" | "workDetail">;
|
|
8
|
+
export type { AssistantViewProps, AssistantDraft, AssistantAttachment, AssistantMessage, AssistantMessagePart, AssistantProcessStep, AssistantActivity, AssistantWork, AssistantQuestion, AssistantChoice, AssistantLabels, } from "./assistant-types.js";
|
|
9
|
+
export { assistantCopy } from "./assistant-types.js";
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { defineComponent, h, keyed, unwrap } from "meowjsx";
|
|
2
|
+
import { PageFrame } from "../components/page-frame.js";
|
|
3
|
+
import { Button } from "../components/button.js";
|
|
4
|
+
import { WorkCard } from "../components/work-card.js";
|
|
5
|
+
import { StatusDot } from "../components/status-dot.js";
|
|
6
|
+
import { Dialog } from "../components/dialog.js";
|
|
7
|
+
import { ChatHeader } from "./header.js";
|
|
8
|
+
import { ChatMessageList } from "./message-list.js";
|
|
9
|
+
import { AssistantComposer } from "./assistant-composer.js";
|
|
10
|
+
import { AssistantMessageView, AssistantSteps, assistantDerived } from "./assistant-content.js";
|
|
11
|
+
import { AssistantQuestionView } from "./assistant-question.js";
|
|
12
|
+
import { AssistantMarkdown } from "./assistant-markdown.js";
|
|
13
|
+
import { assistantScroll } from "./assistant-scroll.js";
|
|
14
|
+
import { assistantCopy as defaultAssistantCopy, } from "./assistant-types.js";
|
|
15
|
+
export const assistantViewContract = {
|
|
16
|
+
name: "assistant-view",
|
|
17
|
+
parts: [
|
|
18
|
+
"root",
|
|
19
|
+
"layout",
|
|
20
|
+
"messages",
|
|
21
|
+
"viewport",
|
|
22
|
+
"content",
|
|
23
|
+
"latest",
|
|
24
|
+
"composer",
|
|
25
|
+
"feedback",
|
|
26
|
+
"empty",
|
|
27
|
+
"activity",
|
|
28
|
+
"activityHeader",
|
|
29
|
+
"activityBody",
|
|
30
|
+
"section",
|
|
31
|
+
"workDetail",
|
|
32
|
+
"status",
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
const AssistantWorkRow = defineComponent({ name: "assistant-work-row", parts: ["root"] }, ({ value, onOpen, actionLabel }, context) => h(WorkCard, {
|
|
36
|
+
action: actionLabel,
|
|
37
|
+
title: assistantDerived(context, () => value.value.title),
|
|
38
|
+
state: assistantDerived(context, () => value.value.tone ?? "unknown"),
|
|
39
|
+
status: assistantDerived(context, () => value.value.statusText),
|
|
40
|
+
detail: assistantDerived(context, () => [value.value.executionText, value.value.replyText].filter(Boolean).join(" · ")),
|
|
41
|
+
onClick: (event) => onOpen(value.value.id, event.currentTarget),
|
|
42
|
+
}));
|
|
43
|
+
const AssistantWorkDetail = defineComponent({ name: "assistant-work-detail", parts: ["root", "feedback", "facts"] }, ({ value, options }, context) => {
|
|
44
|
+
const assistantCopy = { ...defaultAssistantCopy, ...options.labels };
|
|
45
|
+
const hidden = assistantDerived(context, () => value.value?.readState === "unavailable");
|
|
46
|
+
const feedback = assistantDerived(context, () => {
|
|
47
|
+
const work = value.value;
|
|
48
|
+
return (work?.feedback ||
|
|
49
|
+
(work?.readState === "unavailable"
|
|
50
|
+
? assistantCopy.workUnavailable
|
|
51
|
+
: work?.readState === "loading"
|
|
52
|
+
? assistantCopy.workLoading
|
|
53
|
+
: work?.readState === "error"
|
|
54
|
+
? assistantCopy.workError
|
|
55
|
+
: ""));
|
|
56
|
+
});
|
|
57
|
+
const detail = h(AssistantMarkdown, {
|
|
58
|
+
text: assistantDerived(context, () => value.value?.readState === "unavailable"
|
|
59
|
+
? ""
|
|
60
|
+
: (value.value?.detail ?? value.value?.summary ?? "")),
|
|
61
|
+
});
|
|
62
|
+
const custom = options.renderWorkDetail
|
|
63
|
+
? assistantDerived(context, () => value.value && value.value.readState !== "unavailable"
|
|
64
|
+
? (options.renderWorkDetail(value.value) ?? detail)
|
|
65
|
+
: null)
|
|
66
|
+
: detail;
|
|
67
|
+
return context.part("root", "section", null, context.part("feedback", "p", { role: "status", hidden: assistantDerived(context, () => !feedback.value) }, feedback), context.part("facts", "div", { hidden }, h("h3", null, assistantDerived(context, () => value.value?.title ?? "")), h("p", null, h(StatusDot, { state: assistantDerived(context, () => value.value?.tone ?? "unknown") }), " ", assistantDerived(context, () => value.value?.statusText ?? "")), h("p", null, assistantDerived(context, () => value.value?.executionText ?? "")), h("p", null, assistantDerived(context, () => value.value?.replyText ?? "")), custom, h(AssistantSteps, { steps: assistantDerived(context, () => value.value?.steps ?? []) })), options.onRefreshWork
|
|
68
|
+
? h(Button, {
|
|
69
|
+
variant: "outline",
|
|
70
|
+
size: "small",
|
|
71
|
+
onClick: () => {
|
|
72
|
+
if (value.value)
|
|
73
|
+
options.onRefreshWork(value.value.id);
|
|
74
|
+
},
|
|
75
|
+
children: assistantCopy.refresh,
|
|
76
|
+
})
|
|
77
|
+
: null);
|
|
78
|
+
});
|
|
79
|
+
/** A complete default Assistant surface. Data, permissions, network and business lifetime stay with the host. */
|
|
80
|
+
export const AssistantView = defineComponent(assistantViewContract, (options, context) => {
|
|
81
|
+
const assistantCopy = { ...defaultAssistantCopy, ...options.labels };
|
|
82
|
+
const messages = assistantDerived(context, () => unwrap(options.messages));
|
|
83
|
+
const work = assistantDerived(context, () => unwrap(options.work ?? []));
|
|
84
|
+
const questions = assistantDerived(context, () => unwrap(options.questions ?? []));
|
|
85
|
+
const activity = assistantDerived(context, () => unwrap(options.activity));
|
|
86
|
+
const panelOpen = context.signal(false);
|
|
87
|
+
const selected = context.signal("");
|
|
88
|
+
const selectedWork = assistantDerived(context, () => work.value.find((item) => item.id === selected.value));
|
|
89
|
+
const latestHidden = context.signal(true);
|
|
90
|
+
const bodyHidden = assistantDerived(context, () => !!selected.value);
|
|
91
|
+
const detailHidden = assistantDerived(context, () => !selected.value);
|
|
92
|
+
let content;
|
|
93
|
+
let scroll;
|
|
94
|
+
let dialog;
|
|
95
|
+
let root;
|
|
96
|
+
let activityTrigger;
|
|
97
|
+
let detailOpener;
|
|
98
|
+
let compact = false;
|
|
99
|
+
let disposed = false;
|
|
100
|
+
const close = () => {
|
|
101
|
+
panelOpen.value = false;
|
|
102
|
+
queueMicrotask(() => {
|
|
103
|
+
if (!disposed && !panelOpen.value && activityTrigger?.isConnected)
|
|
104
|
+
activityTrigger.focus({ preventScroll: true });
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
const back = () => {
|
|
108
|
+
selected.value = "";
|
|
109
|
+
const opener = detailOpener;
|
|
110
|
+
queueMicrotask(() => {
|
|
111
|
+
if (!disposed && !selected.value && opener?.isConnected)
|
|
112
|
+
opener.focus({ preventScroll: true });
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
const syncDialog = () => {
|
|
116
|
+
const opened = panelOpen.value;
|
|
117
|
+
if (!dialog?.isConnected)
|
|
118
|
+
return;
|
|
119
|
+
const nextCompact = !!root && root.clientWidth < 760;
|
|
120
|
+
const active = dialog.ownerDocument.activeElement;
|
|
121
|
+
if (dialog.open && (!opened || nextCompact !== compact))
|
|
122
|
+
dialog.close();
|
|
123
|
+
compact = nextCompact;
|
|
124
|
+
if (opened && !dialog.open) {
|
|
125
|
+
if (compact)
|
|
126
|
+
dialog.showModal();
|
|
127
|
+
else
|
|
128
|
+
dialog.show();
|
|
129
|
+
if (active instanceof HTMLElement && dialog.contains(active))
|
|
130
|
+
active.focus({ preventScroll: true });
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
context.effect(syncDialog);
|
|
134
|
+
context.effect(() => {
|
|
135
|
+
if (selected.value && !selectedWork.value)
|
|
136
|
+
selected.value = "";
|
|
137
|
+
});
|
|
138
|
+
context.onCleanup(() => {
|
|
139
|
+
disposed = true;
|
|
140
|
+
scroll?.dispose();
|
|
141
|
+
if (dialog?.open)
|
|
142
|
+
dialog.close();
|
|
143
|
+
});
|
|
144
|
+
const transcript = keyed(messages, (message) => message.id, (value) => h(AssistantMessageView, { value, renderPart: options.renderPart }));
|
|
145
|
+
const messageRegion = context.part("messages", "section", null, context.part("viewport", "div", {
|
|
146
|
+
role: "region",
|
|
147
|
+
"aria-label": assistantCopy.messages,
|
|
148
|
+
tabIndex: 0,
|
|
149
|
+
ref: (element) => {
|
|
150
|
+
queueMicrotask(() => {
|
|
151
|
+
if (disposed || !content)
|
|
152
|
+
return;
|
|
153
|
+
scroll = assistantScroll(element, content, (latest) => {
|
|
154
|
+
latestHidden.value = latest;
|
|
155
|
+
});
|
|
156
|
+
let queued = false;
|
|
157
|
+
const stop = messages.subscribe(() => {
|
|
158
|
+
// Signal item changes patch synchronously. A microtask handles final layout once.
|
|
159
|
+
if (!queued) {
|
|
160
|
+
queued = true;
|
|
161
|
+
queueMicrotask(() => {
|
|
162
|
+
queued = false;
|
|
163
|
+
if (!disposed)
|
|
164
|
+
scroll?.afterUpdate();
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
context.onCleanup(stop);
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
}, context.part("content", "div", {
|
|
172
|
+
ref: (element) => {
|
|
173
|
+
content = element;
|
|
174
|
+
},
|
|
175
|
+
}, options.onLoadOlder
|
|
176
|
+
? h(Button, {
|
|
177
|
+
variant: "quiet",
|
|
178
|
+
size: "small",
|
|
179
|
+
disabled: options.loadingOlder,
|
|
180
|
+
onClick: () => {
|
|
181
|
+
scroll?.beforeUpdate();
|
|
182
|
+
options.onLoadOlder();
|
|
183
|
+
},
|
|
184
|
+
children: assistantCopy.older,
|
|
185
|
+
})
|
|
186
|
+
: null, context.part("feedback", "p", {
|
|
187
|
+
role: "status",
|
|
188
|
+
hidden: assistantDerived(context, () => unwrap(options.readState ?? "ready") === "ready"),
|
|
189
|
+
}, assistantDerived(context, () => unwrap(options.readFeedback ?? "") ||
|
|
190
|
+
(unwrap(options.readState ?? "ready") === "loading"
|
|
191
|
+
? assistantCopy.loading
|
|
192
|
+
: assistantCopy.readError))), context.part("empty", "div", {
|
|
193
|
+
hidden: assistantDerived(context, () => messages.value.length > 0 || unwrap(options.readState ?? "ready") !== "ready"),
|
|
194
|
+
}, h("h2", null, assistantCopy.empty), h("p", null, assistantCopy.emptyDescription)), h(ChatMessageList, { ariaLabel: assistantCopy.messages, children: transcript }))), context.part("latest", "div", null, h(Button, {
|
|
195
|
+
variant: "outline",
|
|
196
|
+
size: "small",
|
|
197
|
+
hidden: latestHidden,
|
|
198
|
+
onClick: () => scroll?.latest(),
|
|
199
|
+
children: assistantCopy.latest,
|
|
200
|
+
})));
|
|
201
|
+
const activityList = context.part("activityBody", "div", { hidden: bodyHidden }, context.part("section", "section", null, h("h3", null, assistantCopy.current), context.part("status", "p", null, h(StatusDot, { state: assistantDerived(context, () => activity.value?.tone ?? "idle") }), assistantDerived(context, () => activity.value?.statusText ?? assistantCopy.noActivity)), h("strong", null, assistantDerived(context, () => activity.value?.title ?? "")), h("p", null, assistantDerived(context, () => activity.value?.description ?? "")), h(AssistantSteps, { steps: assistantDerived(context, () => activity.value?.steps ?? []) })), context.part("section", "section", null, h("h3", null, assistantCopy.background), h("p", { hidden: assistantDerived(context, () => work.value.length > 0) }, assistantCopy.noWork), keyed(work, (item) => item.id, (value) => h(AssistantWorkRow, {
|
|
202
|
+
value,
|
|
203
|
+
actionLabel: assistantCopy.details,
|
|
204
|
+
onOpen: (id, button) => {
|
|
205
|
+
detailOpener = button;
|
|
206
|
+
selected.value = id;
|
|
207
|
+
queueMicrotask(() => {
|
|
208
|
+
if (!disposed && panelOpen.value && selected.value === id)
|
|
209
|
+
dialog?.querySelector("[data-assistant-back]")?.focus();
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
}))), context.part("section", "section", { hidden: assistantDerived(context, () => questions.value.length === 0) }, h("h3", null, assistantCopy.questions), keyed(questions, (question) => question.id, (value) => h(AssistantQuestionView, {
|
|
213
|
+
value,
|
|
214
|
+
labels: options.labels,
|
|
215
|
+
onAnswer: options.onAnswer,
|
|
216
|
+
onDismiss: options.onDismissQuestion,
|
|
217
|
+
}))));
|
|
218
|
+
const activityPanel = h(Dialog, {
|
|
219
|
+
labelledBy: undefined,
|
|
220
|
+
"aria-label": assistantCopy.activity,
|
|
221
|
+
"data-assistant-panel": true,
|
|
222
|
+
ref: (element) => {
|
|
223
|
+
dialog = element;
|
|
224
|
+
queueMicrotask(syncDialog);
|
|
225
|
+
},
|
|
226
|
+
onCancel: (event) => {
|
|
227
|
+
event.preventDefault();
|
|
228
|
+
close();
|
|
229
|
+
},
|
|
230
|
+
onKeyDown: (event) => {
|
|
231
|
+
if (event.key === "Escape" && !compact && !event.defaultPrevented) {
|
|
232
|
+
event.preventDefault();
|
|
233
|
+
close();
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
children: [
|
|
237
|
+
context.part("activityHeader", "header", null, h(Button, {
|
|
238
|
+
variant: "quiet",
|
|
239
|
+
size: "small",
|
|
240
|
+
"data-assistant-back": true,
|
|
241
|
+
hidden: detailHidden,
|
|
242
|
+
onClick: back,
|
|
243
|
+
children: assistantCopy.back,
|
|
244
|
+
}), h("h2", null, assistantCopy.activity), h(Button, {
|
|
245
|
+
variant: "quiet",
|
|
246
|
+
size: "small",
|
|
247
|
+
onClick: close,
|
|
248
|
+
"aria-label": assistantCopy.close,
|
|
249
|
+
children: "×",
|
|
250
|
+
})),
|
|
251
|
+
activityList,
|
|
252
|
+
context.part("workDetail", "div", { hidden: detailHidden }, h(AssistantWorkDetail, { value: selectedWork, options })),
|
|
253
|
+
],
|
|
254
|
+
});
|
|
255
|
+
return context.part("root", "section", {
|
|
256
|
+
id: options.id,
|
|
257
|
+
style: options.style,
|
|
258
|
+
"aria-label": options["aria-label"],
|
|
259
|
+
className: options.className,
|
|
260
|
+
"data-activity-open": assistantDerived(context, () => String(panelOpen.value)),
|
|
261
|
+
ref: (element) => {
|
|
262
|
+
root = element;
|
|
263
|
+
const observer = new ResizeObserver(syncDialog);
|
|
264
|
+
observer.observe(element);
|
|
265
|
+
return () => {
|
|
266
|
+
observer.disconnect();
|
|
267
|
+
root = undefined;
|
|
268
|
+
};
|
|
269
|
+
},
|
|
270
|
+
}, h(PageFrame, {
|
|
271
|
+
variant: "workspace",
|
|
272
|
+
header: h(ChatHeader, {
|
|
273
|
+
title: options.title ?? assistantCopy.title,
|
|
274
|
+
description: options.description,
|
|
275
|
+
actions: [
|
|
276
|
+
options.headerActions,
|
|
277
|
+
h(Button, {
|
|
278
|
+
variant: "quiet",
|
|
279
|
+
size: "small",
|
|
280
|
+
"aria-expanded": assistantDerived(context, () => String(panelOpen.value)),
|
|
281
|
+
ref: (element) => {
|
|
282
|
+
activityTrigger = element;
|
|
283
|
+
},
|
|
284
|
+
onClick: () => {
|
|
285
|
+
panelOpen.value = !panelOpen.value;
|
|
286
|
+
},
|
|
287
|
+
children: assistantCopy.activity,
|
|
288
|
+
}),
|
|
289
|
+
],
|
|
290
|
+
}),
|
|
291
|
+
children: context.part("layout", "div", null, messageRegion, context.part("composer", "div", null, h(AssistantComposer, { options })), activityPanel),
|
|
292
|
+
}));
|
|
293
|
+
});
|
|
294
|
+
export { assistantCopy } from "./assistant-types.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Props } from "meowjsx";
|
|
2
|
+
export declare const chatAttachmentsContract: {
|
|
3
|
+
readonly name: "chat-attachments";
|
|
4
|
+
readonly parts: readonly ["root", "image", "preview", "file", "icon", "details", "name", "size", "entry", "previewButton", "remove"];
|
|
5
|
+
};
|
|
6
|
+
export interface ChatAttachmentItem {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
url: string;
|
|
10
|
+
mediaType: string;
|
|
11
|
+
sizeBytes?: number;
|
|
12
|
+
onPreview?: () => void;
|
|
13
|
+
/** Let the host download a file while retaining the default anchor without a hook. */
|
|
14
|
+
onDownload?: () => void;
|
|
15
|
+
/** Present only while this attachment can still be removed from the host's draft. */
|
|
16
|
+
onRemove?: () => void;
|
|
17
|
+
}
|
|
18
|
+
export interface ChatAttachmentsProps extends Props {
|
|
19
|
+
items: readonly ChatAttachmentItem[];
|
|
20
|
+
label?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const ChatAttachments: import("meowjsx").Component<ChatAttachmentsProps, "chat-attachments", "details" | "entry" | "file" | "icon" | "image" | "name" | "preview" | "previewButton" | "remove" | "root" | "size">;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { defineComponent, h } from "meowjsx";
|
|
2
|
+
import { Icon } from "../icons/icon.js";
|
|
3
|
+
import { FileTypeIcon, fileExtension } from "../icons/file-type-icon.js";
|
|
4
|
+
import { ImagePreview } from "../components/image-preview.js";
|
|
5
|
+
export const chatAttachmentsContract = {
|
|
6
|
+
name: "chat-attachments",
|
|
7
|
+
parts: [
|
|
8
|
+
"root",
|
|
9
|
+
"image",
|
|
10
|
+
"preview",
|
|
11
|
+
"file",
|
|
12
|
+
"icon",
|
|
13
|
+
"details",
|
|
14
|
+
"name",
|
|
15
|
+
"size",
|
|
16
|
+
"entry",
|
|
17
|
+
"previewButton",
|
|
18
|
+
"remove",
|
|
19
|
+
],
|
|
20
|
+
};
|
|
21
|
+
export const ChatAttachments = defineComponent(chatAttachmentsContract, ({ items, label = "消息附件", className, ...props }, context) => context.part("root", "div", {
|
|
22
|
+
...props,
|
|
23
|
+
className,
|
|
24
|
+
role: "group",
|
|
25
|
+
"aria-label": label,
|
|
26
|
+
}, items.map((item) => {
|
|
27
|
+
const remove = item.onRemove
|
|
28
|
+
? context.part("remove", "button", {
|
|
29
|
+
type: "button",
|
|
30
|
+
onClick: item.onRemove,
|
|
31
|
+
"aria-label": `移除 ${item.name}`,
|
|
32
|
+
}, h(Icon, { name: "x" }))
|
|
33
|
+
: null;
|
|
34
|
+
return item.mediaType.startsWith("image/")
|
|
35
|
+
? context.part("entry", "div", { key: item.id, "data-kind": "image" }, context.part("image", item.onPreview ? "button" : "a", item.onPreview
|
|
36
|
+
? {
|
|
37
|
+
type: "button",
|
|
38
|
+
onClick: item.onPreview,
|
|
39
|
+
"aria-label": `预览 ${item.name}`,
|
|
40
|
+
}
|
|
41
|
+
: {
|
|
42
|
+
href: item.url,
|
|
43
|
+
target: "_blank",
|
|
44
|
+
rel: "noreferrer",
|
|
45
|
+
"aria-label": `打开图片 ${item.name}`,
|
|
46
|
+
}, context.part("preview", "span", null, h(ImagePreview, { src: item.url, alt: item.name }))), remove)
|
|
47
|
+
: context.part("entry", "div", { key: item.id, "data-kind": "file" }, context.part("file", "a", {
|
|
48
|
+
key: item.id,
|
|
49
|
+
href: item.url,
|
|
50
|
+
download: item.name,
|
|
51
|
+
onClick: item.onDownload
|
|
52
|
+
? (event) => {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
item.onDownload();
|
|
55
|
+
}
|
|
56
|
+
: undefined,
|
|
57
|
+
}, context.part("icon", "span", { "aria-hidden": "true" }, h(FileTypeIcon, { path: item.name })), context.part("details", "span", null, context.part("name", "strong", null, item.name), item.sizeBytes !== undefined &&
|
|
58
|
+
Number.isFinite(item.sizeBytes) &&
|
|
59
|
+
item.sizeBytes >= 0
|
|
60
|
+
? context.part("size", "small", null, [
|
|
61
|
+
fileExtension(item.name).toUpperCase().slice(0, 8),
|
|
62
|
+
formatBytes(item.sizeBytes),
|
|
63
|
+
]
|
|
64
|
+
.filter(Boolean)
|
|
65
|
+
.join(" "))
|
|
66
|
+
: null)), item.onPreview
|
|
67
|
+
? context.part("previewButton", "button", { type: "button", onClick: item.onPreview, "aria-label": `预览 ${item.name}` }, "预览")
|
|
68
|
+
: null, remove);
|
|
69
|
+
})));
|
|
70
|
+
function formatBytes(value) {
|
|
71
|
+
if (value < 1024)
|
|
72
|
+
return `${value}B`;
|
|
73
|
+
const units = ["KB", "MB", "GB"];
|
|
74
|
+
let scaled = value / 1024;
|
|
75
|
+
let unit = 0;
|
|
76
|
+
while (scaled >= 1024 && unit < units.length - 1) {
|
|
77
|
+
scaled /= 1024;
|
|
78
|
+
unit++;
|
|
79
|
+
}
|
|
80
|
+
return `${scaled < 10 ? scaled.toFixed(1) : Math.round(scaled)}${units[unit]}`;
|
|
81
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ThemedProps } from "meowcss/meowjsx";
|
|
2
|
+
import { type Props } from "meowjsx";
|
|
3
|
+
export declare const chatBubbleOptions: import("meowcss").Options<{
|
|
4
|
+
readonly variant: readonly ["auto", "plain", "filled"];
|
|
5
|
+
}>;
|
|
6
|
+
export declare const chatBubbleContract: {
|
|
7
|
+
readonly name: "chat-bubble";
|
|
8
|
+
readonly parts: readonly ["root"];
|
|
9
|
+
readonly styleProps: import("meowcss/meowjsx").StylePropsBinding<import("meowcss").Options<{
|
|
10
|
+
readonly variant: readonly ["auto", "plain", "filled"];
|
|
11
|
+
}>>;
|
|
12
|
+
};
|
|
13
|
+
export interface ChatBubbleProps extends Props, ThemedProps<typeof chatBubbleOptions> {
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/** A message surface; placement and author metadata belong to ChatMessage. */
|
|
17
|
+
export declare const ChatBubble: import("meowjsx").Component<ChatBubbleProps, "chat-bubble", "root">;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineOptions } from "meowcss";
|
|
2
|
+
import { defineStyleProps } from "meowcss/meowjsx";
|
|
3
|
+
import { defineComponent, useContext } from "meowjsx";
|
|
4
|
+
import { messageRoleContext } from "./message-context.js";
|
|
5
|
+
export const chatBubbleOptions = defineOptions("chat-bubble", {
|
|
6
|
+
variant: ["auto", "plain", "filled"],
|
|
7
|
+
});
|
|
8
|
+
export const chatBubbleContract = {
|
|
9
|
+
name: "chat-bubble",
|
|
10
|
+
parts: ["root"],
|
|
11
|
+
styleProps: defineStyleProps(chatBubbleOptions, { defaults: { variant: "auto" } }),
|
|
12
|
+
};
|
|
13
|
+
/** A message surface; placement and author metadata belong to ChatMessage. */
|
|
14
|
+
export const ChatBubble = defineComponent(chatBubbleContract, ({ children, className, ...props }, context) => context.part("root", "div", {
|
|
15
|
+
...props,
|
|
16
|
+
className,
|
|
17
|
+
"data-chat-role": useContext(messageRoleContext),
|
|
18
|
+
}, children));
|