@major-tech/ui 0.0.0-stage → 1.0.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/CHANGELOG.md +101 -0
- package/THIRD_PARTY_NOTICES.md +27 -0
- package/dist/components/accordion.d.ts +33 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +51 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/activity-chart.d.ts +26 -0
- package/dist/components/activity-chart.d.ts.map +1 -0
- package/dist/components/activity-chart.js +56 -0
- package/dist/components/activity-chart.js.map +1 -0
- package/dist/components/alert-dialog.d.ts +28 -0
- package/dist/components/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog.js +51 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/alert.d.ts +34 -0
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +59 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/ask-user-question.d.ts +103 -0
- package/dist/components/ask-user-question.d.ts.map +1 -0
- package/dist/components/ask-user-question.js +401 -0
- package/dist/components/ask-user-question.js.map +1 -0
- package/dist/components/attachment-gallery.d.ts +137 -0
- package/dist/components/attachment-gallery.d.ts.map +1 -0
- package/dist/components/attachment-gallery.js +317 -0
- package/dist/components/attachment-gallery.js.map +1 -0
- package/dist/components/avatar.d.ts +37 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +62 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +29 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +50 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/brand-tile.d.ts +33 -0
- package/dist/components/brand-tile.d.ts.map +1 -0
- package/dist/components/brand-tile.js +36 -0
- package/dist/components/brand-tile.js.map +1 -0
- package/dist/components/button.d.ts +51 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +90 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/calendar.d.ts +18 -0
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +78 -0
- package/dist/components/calendar.js.map +1 -0
- package/dist/components/card.d.ts +18 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +34 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/carousel.d.ts +48 -0
- package/dist/components/carousel.d.ts.map +1 -0
- package/dist/components/carousel.js +227 -0
- package/dist/components/carousel.js.map +1 -0
- package/dist/components/catalog-card.d.ts +29 -0
- package/dist/components/catalog-card.d.ts.map +1 -0
- package/dist/components/catalog-card.js +20 -0
- package/dist/components/catalog-card.js.map +1 -0
- package/dist/components/chart.d.ts +118 -0
- package/dist/components/chart.d.ts.map +1 -0
- package/dist/components/chart.js +209 -0
- package/dist/components/chart.js.map +1 -0
- package/dist/components/checkbox.d.ts +8 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +14 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/chip.d.ts +68 -0
- package/dist/components/chip.d.ts.map +1 -0
- package/dist/components/chip.js +100 -0
- package/dist/components/chip.js.map +1 -0
- package/dist/components/code-block.d.ts +99 -0
- package/dist/components/code-block.d.ts.map +1 -0
- package/dist/components/code-block.js +144 -0
- package/dist/components/code-block.js.map +1 -0
- package/dist/components/collapsible.d.ts +17 -0
- package/dist/components/collapsible.d.ts.map +1 -0
- package/dist/components/collapsible.js +25 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/command.d.ts +51 -0
- package/dist/components/command.d.ts.map +1 -0
- package/dist/components/command.js +120 -0
- package/dist/components/command.js.map +1 -0
- package/dist/components/composer.d.ts +211 -0
- package/dist/components/composer.d.ts.map +1 -0
- package/dist/components/composer.js +605 -0
- package/dist/components/composer.js.map +1 -0
- package/dist/components/connector-request.d.ts +63 -0
- package/dist/components/connector-request.d.ts.map +1 -0
- package/dist/components/connector-request.js +57 -0
- package/dist/components/connector-request.js.map +1 -0
- package/dist/components/context-menu.d.ts +26 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +33 -0
- package/dist/components/context-menu.js.map +1 -0
- package/dist/components/data-table.d.ts +61 -0
- package/dist/components/data-table.d.ts.map +1 -0
- package/dist/components/data-table.js +79 -0
- package/dist/components/data-table.js.map +1 -0
- package/dist/components/date-range-picker.d.ts +54 -0
- package/dist/components/date-range-picker.d.ts.map +1 -0
- package/dist/components/date-range-picker.js +451 -0
- package/dist/components/date-range-picker.js.map +1 -0
- package/dist/components/dialog.d.ts +46 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +75 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/drawer.d.ts +85 -0
- package/dist/components/drawer.d.ts.map +1 -0
- package/dist/components/drawer.js +166 -0
- package/dist/components/drawer.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +77 -0
- package/dist/components/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu.js +112 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/editor-tabs.d.ts +49 -0
- package/dist/components/editor-tabs.d.ts.map +1 -0
- package/dist/components/editor-tabs.js +157 -0
- package/dist/components/editor-tabs.js.map +1 -0
- package/dist/components/empty-state.d.ts +21 -0
- package/dist/components/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state.js +14 -0
- package/dist/components/empty-state.js.map +1 -0
- package/dist/components/entity-card.d.ts +301 -0
- package/dist/components/entity-card.d.ts.map +1 -0
- package/dist/components/entity-card.js +392 -0
- package/dist/components/entity-card.js.map +1 -0
- package/dist/components/entity-row.d.ts +37 -0
- package/dist/components/entity-row.d.ts.map +1 -0
- package/dist/components/entity-row.js +65 -0
- package/dist/components/entity-row.js.map +1 -0
- package/dist/components/env-var-request.d.ts +51 -0
- package/dist/components/env-var-request.d.ts.map +1 -0
- package/dist/components/env-var-request.js +50 -0
- package/dist/components/env-var-request.js.map +1 -0
- package/dist/components/field.d.ts +30 -0
- package/dist/components/field.d.ts.map +1 -0
- package/dist/components/field.js +48 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/file-upload.d.ts +108 -0
- package/dist/components/file-upload.d.ts.map +1 -0
- package/dist/components/file-upload.js +217 -0
- package/dist/components/file-upload.js.map +1 -0
- package/dist/components/hover-card.d.ts +18 -0
- package/dist/components/hover-card.d.ts.map +1 -0
- package/dist/components/hover-card.js +84 -0
- package/dist/components/hover-card.js.map +1 -0
- package/dist/components/input-group.d.ts +29 -0
- package/dist/components/input-group.d.ts.map +1 -0
- package/dist/components/input-group.js +61 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input.d.ts +9 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +13 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/island.d.ts +18 -0
- package/dist/components/island.d.ts.map +1 -0
- package/dist/components/island.js +30 -0
- package/dist/components/island.js.map +1 -0
- package/dist/components/kbd.d.ts +7 -0
- package/dist/components/kbd.d.ts.map +1 -0
- package/dist/components/kbd.js +11 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/label.d.ts +8 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +12 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/markdown.d.ts +24 -0
- package/dist/components/markdown.d.ts.map +1 -0
- package/dist/components/markdown.js +38 -0
- package/dist/components/markdown.js.map +1 -0
- package/dist/components/message.d.ts +38 -0
- package/dist/components/message.d.ts.map +1 -0
- package/dist/components/message.js +25 -0
- package/dist/components/message.js.map +1 -0
- package/dist/components/page-header.d.ts +31 -0
- package/dist/components/page-header.d.ts.map +1 -0
- package/dist/components/page-header.js +94 -0
- package/dist/components/page-header.js.map +1 -0
- package/dist/components/pagination.d.ts +22 -0
- package/dist/components/pagination.d.ts.map +1 -0
- package/dist/components/pagination.js +36 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/password-input.d.ts +5 -0
- package/dist/components/password-input.d.ts.map +1 -0
- package/dist/components/password-input.js +12 -0
- package/dist/components/password-input.js.map +1 -0
- package/dist/components/pepper.d.ts +92 -0
- package/dist/components/pepper.d.ts.map +1 -0
- package/dist/components/pepper.js +1279 -0
- package/dist/components/pepper.js.map +1 -0
- package/dist/components/permission-request.d.ts +53 -0
- package/dist/components/permission-request.d.ts.map +1 -0
- package/dist/components/permission-request.js +54 -0
- package/dist/components/permission-request.js.map +1 -0
- package/dist/components/popover.d.ts +42 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +76 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/progress.d.ts +9 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +12 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/progressive-blur.d.ts +31 -0
- package/dist/components/progressive-blur.d.ts.map +1 -0
- package/dist/components/progressive-blur.js +44 -0
- package/dist/components/progressive-blur.js.map +1 -0
- package/dist/components/radio-group.d.ts +8 -0
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +15 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/request-card.d.ts +34 -0
- package/dist/components/request-card.d.ts.map +1 -0
- package/dist/components/request-card.js +50 -0
- package/dist/components/request-card.js.map +1 -0
- package/dist/components/resizable.d.ts +24 -0
- package/dist/components/resizable.d.ts.map +1 -0
- package/dist/components/resizable.js +40 -0
- package/dist/components/resizable.js.map +1 -0
- package/dist/components/responsive-overlay.d.ts +136 -0
- package/dist/components/responsive-overlay.d.ts.map +1 -0
- package/dist/components/responsive-overlay.js +302 -0
- package/dist/components/responsive-overlay.js.map +1 -0
- package/dist/components/scroll-shadows.d.ts +11 -0
- package/dist/components/scroll-shadows.d.ts.map +1 -0
- package/dist/components/scroll-shadows.js +53 -0
- package/dist/components/scroll-shadows.js.map +1 -0
- package/dist/components/search-field.d.ts +16 -0
- package/dist/components/search-field.d.ts.map +1 -0
- package/dist/components/search-field.js +50 -0
- package/dist/components/search-field.js.map +1 -0
- package/dist/components/searchable-select.d.ts +43 -0
- package/dist/components/searchable-select.d.ts.map +1 -0
- package/dist/components/searchable-select.js +39 -0
- package/dist/components/searchable-select.js.map +1 -0
- package/dist/components/select.d.ts +60 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +94 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +7 -0
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/separator.js +12 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/settings-section.d.ts +41 -0
- package/dist/components/settings-section.d.ts.map +1 -0
- package/dist/components/settings-section.js +50 -0
- package/dist/components/settings-section.js.map +1 -0
- package/dist/components/sidebar-item.d.ts +41 -0
- package/dist/components/sidebar-item.d.ts.map +1 -0
- package/dist/components/sidebar-item.js +59 -0
- package/dist/components/sidebar-item.js.map +1 -0
- package/dist/components/skeleton.d.ts +7 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +11 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.d.ts +10 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +36 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/sonner.d.ts +8 -0
- package/dist/components/sonner.d.ts.map +1 -0
- package/dist/components/sonner.js +21 -0
- package/dist/components/sonner.js.map +1 -0
- package/dist/components/spinner.d.ts +7 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +12 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/stat-strip.d.ts +20 -0
- package/dist/components/stat-strip.d.ts.map +1 -0
- package/dist/components/stat-strip.js +11 -0
- package/dist/components/stat-strip.js.map +1 -0
- package/dist/components/status-dot.d.ts +25 -0
- package/dist/components/status-dot.d.ts.map +1 -0
- package/dist/components/status-dot.js +31 -0
- package/dist/components/status-dot.js.map +1 -0
- package/dist/components/subagent-run.d.ts +27 -0
- package/dist/components/subagent-run.d.ts.map +1 -0
- package/dist/components/subagent-run.js +38 -0
- package/dist/components/subagent-run.js.map +1 -0
- package/dist/components/switch.d.ts +8 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +13 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/system-notice.d.ts +34 -0
- package/dist/components/system-notice.d.ts.map +1 -0
- package/dist/components/system-notice.js +52 -0
- package/dist/components/system-notice.js.map +1 -0
- package/dist/components/table.d.ts +27 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +37 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +40 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +52 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/textarea.d.ts +5 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +9 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/thinking-indicator.d.ts +21 -0
- package/dist/components/thinking-indicator.d.ts.map +1 -0
- package/dist/components/thinking-indicator.js +136 -0
- package/dist/components/thinking-indicator.js.map +1 -0
- package/dist/components/thread-status.d.ts +25 -0
- package/dist/components/thread-status.d.ts.map +1 -0
- package/dist/components/thread-status.js +41 -0
- package/dist/components/thread-status.js.map +1 -0
- package/dist/components/todo-list.d.ts +52 -0
- package/dist/components/todo-list.d.ts.map +1 -0
- package/dist/components/todo-list.js +137 -0
- package/dist/components/todo-list.js.map +1 -0
- package/dist/components/toggle-group.d.ts +17 -0
- package/dist/components/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group.js +26 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.d.ts +27 -0
- package/dist/components/toggle.d.ts.map +1 -0
- package/dist/components/toggle.js +44 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/tool-call.d.ts +60 -0
- package/dist/components/tool-call.d.ts.map +1 -0
- package/dist/components/tool-call.js +94 -0
- package/dist/components/tool-call.js.map +1 -0
- package/dist/components/tool-result.d.ts +127 -0
- package/dist/components/tool-result.d.ts.map +1 -0
- package/dist/components/tool-result.js +155 -0
- package/dist/components/tool-result.js.map +1 -0
- package/dist/components/tooltip.d.ts +18 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +38 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/trace.d.ts +38 -0
- package/dist/components/trace.d.ts.map +1 -0
- package/dist/components/trace.js +52 -0
- package/dist/components/trace.js.map +1 -0
- package/dist/components/turn-summary.d.ts +17 -0
- package/dist/components/turn-summary.d.ts.map +1 -0
- package/dist/components/turn-summary.js +19 -0
- package/dist/components/turn-summary.js.map +1 -0
- package/dist/components/usage-meter.d.ts +16 -0
- package/dist/components/usage-meter.d.ts.map +1 -0
- package/dist/components/usage-meter.js +10 -0
- package/dist/components/usage-meter.js.map +1 -0
- package/dist/components/view-switcher.d.ts +25 -0
- package/dist/components/view-switcher.d.ts.map +1 -0
- package/dist/components/view-switcher.js +196 -0
- package/dist/components/view-switcher.js.map +1 -0
- package/dist/docs/components/accordion.md +151 -0
- package/dist/docs/components/activity-chart.md +104 -0
- package/dist/docs/components/alert-dialog.md +216 -0
- package/dist/docs/components/alert.md +203 -0
- package/dist/docs/components/ask-user-question.md +429 -0
- package/dist/docs/components/attachment-gallery.md +377 -0
- package/dist/docs/components/avatar.md +197 -0
- package/dist/docs/components/badge.md +162 -0
- package/dist/docs/components/brand-tile.md +138 -0
- package/dist/docs/components/button.md +392 -0
- package/dist/docs/components/calendar.md +113 -0
- package/dist/docs/components/card.md +157 -0
- package/dist/docs/components/carousel.md +144 -0
- package/dist/docs/components/catalog-card.md +136 -0
- package/dist/docs/components/chart.md +608 -0
- package/dist/docs/components/checkbox.md +164 -0
- package/dist/docs/components/chip.md +411 -0
- package/dist/docs/components/code-block.md +389 -0
- package/dist/docs/components/collapsible.md +93 -0
- package/dist/docs/components/command.md +276 -0
- package/dist/docs/components/composer.md +1092 -0
- package/dist/docs/components/connector-request.md +497 -0
- package/dist/docs/components/context-menu.md +127 -0
- package/dist/docs/components/data-table.md +462 -0
- package/dist/docs/components/date-range-picker.md +425 -0
- package/dist/docs/components/dialog.md +263 -0
- package/dist/docs/components/drawer.md +505 -0
- package/dist/docs/components/dropdown-menu.md +336 -0
- package/dist/docs/components/editor-tabs.md +283 -0
- package/dist/docs/components/empty-state.md +134 -0
- package/dist/docs/components/entity-card.md +640 -0
- package/dist/docs/components/entity-row.md +291 -0
- package/dist/docs/components/env-var-request.md +223 -0
- package/dist/docs/components/field.md +272 -0
- package/dist/docs/components/file-upload.md +255 -0
- package/dist/docs/components/hover-card.md +335 -0
- package/dist/docs/components/input-group.md +134 -0
- package/dist/docs/components/input.md +97 -0
- package/dist/docs/components/island.md +97 -0
- package/dist/docs/components/kbd.md +91 -0
- package/dist/docs/components/markdown.md +180 -0
- package/dist/docs/components/message.md +336 -0
- package/dist/docs/components/page-header.md +203 -0
- package/dist/docs/components/pagination.md +211 -0
- package/dist/docs/components/password-input.md +68 -0
- package/dist/docs/components/pepper.md +238 -0
- package/dist/docs/components/permission-request.md +265 -0
- package/dist/docs/components/popover.md +206 -0
- package/dist/docs/components/progress.md +142 -0
- package/dist/docs/components/progressive-blur.md +195 -0
- package/dist/docs/components/radio-group.md +129 -0
- package/dist/docs/components/request-card.md +305 -0
- package/dist/docs/components/resizable.md +318 -0
- package/dist/docs/components/responsive-overlay.md +449 -0
- package/dist/docs/components/scroll-shadows.md +161 -0
- package/dist/docs/components/search-field.md +86 -0
- package/dist/docs/components/searchable-select.md +144 -0
- package/dist/docs/components/select.md +331 -0
- package/dist/docs/components/separator.md +80 -0
- package/dist/docs/components/settings-section.md +246 -0
- package/dist/docs/components/sidebar-item.md +307 -0
- package/dist/docs/components/skeleton.md +107 -0
- package/dist/docs/components/slider.md +171 -0
- package/dist/docs/components/sonner.md +122 -0
- package/dist/docs/components/spinner.md +112 -0
- package/dist/docs/components/stat-strip.md +85 -0
- package/dist/docs/components/status-dot.md +190 -0
- package/dist/docs/components/subagent-run.md +196 -0
- package/dist/docs/components/switch.md +91 -0
- package/dist/docs/components/system-notice.md +144 -0
- package/dist/docs/components/table.md +201 -0
- package/dist/docs/components/tabs.md +233 -0
- package/dist/docs/components/textarea.md +89 -0
- package/dist/docs/components/thinking-indicator.md +164 -0
- package/dist/docs/components/thread-status.md +143 -0
- package/dist/docs/components/todo-list.md +225 -0
- package/dist/docs/components/toggle-group.md +117 -0
- package/dist/docs/components/toggle.md +132 -0
- package/dist/docs/components/tool-call.md +237 -0
- package/dist/docs/components/tool-result.md +418 -0
- package/dist/docs/components/tooltip.md +136 -0
- package/dist/docs/components/trace.md +319 -0
- package/dist/docs/components/turn-summary.md +218 -0
- package/dist/docs/components/usage-meter.md +69 -0
- package/dist/docs/components/view-switcher.md +193 -0
- package/dist/docs/foundations/colors.md +83 -0
- package/dist/docs/foundations/elevation.md +19 -0
- package/dist/docs/foundations/iconography.md +34 -0
- package/dist/docs/foundations/layout.md +42 -0
- package/dist/docs/foundations/logo.md +111 -0
- package/dist/docs/foundations/motion.md +91 -0
- package/dist/docs/foundations/radius.md +13 -0
- package/dist/docs/foundations/spacing.md +23 -0
- package/dist/docs/foundations/typography.md +42 -0
- package/dist/docs/getting-started/installation.md +116 -0
- package/dist/docs/getting-started/releases.md +59 -0
- package/dist/docs/getting-started/theming.md +58 -0
- package/dist/docs/guidelines/accessibility.md +28 -0
- package/dist/docs/guidelines/content.md +36 -0
- package/dist/docs/guidelines/forms.md +36 -0
- package/dist/docs/guidelines/principles.md +30 -0
- package/dist/docs/hooks/use-is-mobile.md +134 -0
- package/dist/docs/index.md +182 -0
- package/dist/docs/overview.md +35 -0
- package/dist/docs/patterns/chat.md +477 -0
- package/dist/docs/patterns/index.md +13 -0
- package/dist/docs/patterns/login.md +311 -0
- package/dist/docs/patterns/share.md +415 -0
- package/dist/hooks/use-is-mobile.d.ts +9 -0
- package/dist/hooks/use-is-mobile.d.ts.map +1 -0
- package/dist/hooks/use-is-mobile.js +26 -0
- package/dist/hooks/use-is-mobile.js.map +1 -0
- package/dist/lib/cn.d.ts +4 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +31 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/lib/code-language.d.ts +8 -0
- package/dist/lib/code-language.d.ts.map +1 -0
- package/dist/lib/code-language.js +48 -0
- package/dist/lib/code-language.js.map +1 -0
- package/dist/lib/date-range.d.ts +122 -0
- package/dist/lib/date-range.d.ts.map +1 -0
- package/dist/lib/date-range.js +281 -0
- package/dist/lib/date-range.js.map +1 -0
- package/dist/lib/major-tokens.d.ts +40 -0
- package/dist/lib/major-tokens.d.ts.map +1 -0
- package/dist/lib/major-tokens.js +602 -0
- package/dist/lib/major-tokens.js.map +1 -0
- package/dist/lib/markdown.d.ts +25 -0
- package/dist/lib/markdown.d.ts.map +1 -0
- package/dist/lib/markdown.js +87 -0
- package/dist/lib/markdown.js.map +1 -0
- package/dist/lib/overlay-portal-branch.d.ts +6 -0
- package/dist/lib/overlay-portal-branch.d.ts.map +1 -0
- package/dist/lib/overlay-portal-branch.js +15 -0
- package/dist/lib/overlay-portal-branch.js.map +1 -0
- package/dist/lib/pepper-matcap.d.ts +2 -0
- package/dist/lib/pepper-matcap.d.ts.map +1 -0
- package/dist/lib/pepper-matcap.js +4 -0
- package/dist/lib/pepper-matcap.js.map +1 -0
- package/dist/lib/scroll-fade.d.ts +28 -0
- package/dist/lib/scroll-fade.d.ts.map +1 -0
- package/dist/lib/scroll-fade.js +57 -0
- package/dist/lib/scroll-fade.js.map +1 -0
- package/dist/tailwind.css +7 -0
- package/dist/theme.css +428 -0
- package/package.json +145 -3
- package/tokens.json +841 -0
- package/README.md +0 -3
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
export type ToolResultTerminalProps = Omit<ComponentProps<"div">, "children"> & {
|
|
3
|
+
/** The command as it ran; Copy copies it. */
|
|
4
|
+
command: string;
|
|
5
|
+
/** What it printed, stdout and stderr together. */
|
|
6
|
+
output?: string;
|
|
7
|
+
/** Shown under the output when it isn't 0. Leave it out while unknown. */
|
|
8
|
+
exitCode?: number | null;
|
|
9
|
+
/** The command keeps running after the call: “Running in the background” stands for its output. */
|
|
10
|
+
isBackground?: boolean;
|
|
11
|
+
/** The call itself failed: the block turns danger. A non-zero exit code does too. */
|
|
12
|
+
isError?: boolean;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A Bash call as a terminal: the command after a `faint` prompt, its output in `ink-2`, and the exit code in danger
|
|
16
|
+
* when it failed. Lines wrap; the block scrolls past 320px.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ToolResultTerminal({ command, output, exitCode, isBackground, isError, className, ...props }: ToolResultTerminalProps): import("react").JSX.Element;
|
|
19
|
+
export type ToolResultFileProps = ComponentProps<"div"> & {
|
|
20
|
+
/** The file's path, in the header. */
|
|
21
|
+
path: string;
|
|
22
|
+
/** The file's text: what Copy copies, and the lines unless `children` gives them. */
|
|
23
|
+
code: string;
|
|
24
|
+
/** The first line's number, for a part of a file (a Read from line 40). */
|
|
25
|
+
startLine?: number;
|
|
26
|
+
/** The Prism language the lines are highlighted in. By default it's read off the path's extension. */
|
|
27
|
+
language?: string;
|
|
28
|
+
/** Lines of your own, as CodeBlockLines, in place of the highlighted `code`. */
|
|
29
|
+
children?: ReactNode;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* A Read or Write call: the file's path with Wrap and Copy, and its numbered lines with syntax colours in the file's
|
|
33
|
+
* language (from its extension, or `language`).
|
|
34
|
+
*/
|
|
35
|
+
export declare function ToolResultFile({ path, code, startLine, language, children, className, ...props }: ToolResultFileProps): import("react").JSX.Element;
|
|
36
|
+
/** One replacement an Edit made: the text it removed and the text it put in. */
|
|
37
|
+
export interface ToolResultDiffEdit {
|
|
38
|
+
removed?: string;
|
|
39
|
+
added?: string;
|
|
40
|
+
}
|
|
41
|
+
export type ToolResultDiffProps = ComponentProps<"div"> & {
|
|
42
|
+
/** The edited file's path, in the header. */
|
|
43
|
+
path: string;
|
|
44
|
+
/** Each replacement, in order: its removed lines, then its added ones, with a `⋯` line between replacements. */
|
|
45
|
+
edits?: ToolResultDiffEdit[];
|
|
46
|
+
/** The Prism language the lines are highlighted in. By default it's read off the path's extension. */
|
|
47
|
+
language?: string;
|
|
48
|
+
/** Lines of your own, as CodeBlockLines with the added and removed variants. Replaces `edits`. */
|
|
49
|
+
children?: ReactNode;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* An Edit call as a diff: the file's path with Wrap, then each replacement's removed and added lines, with syntax
|
|
53
|
+
* colours in the file's language.
|
|
54
|
+
*/
|
|
55
|
+
export declare function ToolResultDiff({ path, edits, language, children, className, ...props }: ToolResultDiffProps): import("react").JSX.Element;
|
|
56
|
+
/** One matching line of a file. */
|
|
57
|
+
export interface ToolResultMatchLine {
|
|
58
|
+
/** Its line number, when the search reported one. */
|
|
59
|
+
line?: number | null;
|
|
60
|
+
text: string;
|
|
61
|
+
}
|
|
62
|
+
/** A file the search matched, with its matching lines. */
|
|
63
|
+
export interface ToolResultMatchFile {
|
|
64
|
+
path: string;
|
|
65
|
+
lines: ToolResultMatchLine[];
|
|
66
|
+
/** How many matches the file has, when the search counted them (more than the lines shown, perhaps). */
|
|
67
|
+
count?: number | null;
|
|
68
|
+
}
|
|
69
|
+
/** “3 matches in 2 files”, “2 files” when the search listed files only, or “No matches”: a Grep line's description. */
|
|
70
|
+
export declare function summarizeMatches(files: ToolResultMatchFile[]): string;
|
|
71
|
+
export type ToolResultMatchesProps = Omit<ComponentProps<"div">, "children"> & {
|
|
72
|
+
/** The matched files, in the search's order. */
|
|
73
|
+
files: ToolResultMatchFile[];
|
|
74
|
+
/** The search pattern: its matches are marked when it is a literal or literals joined by `|`. */
|
|
75
|
+
pattern?: string;
|
|
76
|
+
isCaseInsensitive?: boolean;
|
|
77
|
+
/** A line under the matches: “Results capped at 100 lines”. */
|
|
78
|
+
note?: ReactNode;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* A Grep call's matches by file: the summary with Wrap, then each file's path and its matching lines with their
|
|
82
|
+
* numbers, the matched text in `warn-soft`.
|
|
83
|
+
*/
|
|
84
|
+
export declare function ToolResultMatches({ files, pattern, isCaseInsensitive, note, className, ...props }: ToolResultMatchesProps): import("react").JSX.Element;
|
|
85
|
+
/** A list call's rows (apps, agents, sandboxes, branches) in place of their JSON; it scrolls past 320px. */
|
|
86
|
+
export declare function ToolResultList({ className, children, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
87
|
+
export type ToolResultListItemProps = Omit<ComponentProps<"li">, "title"> & {
|
|
88
|
+
/** Its name, in 12px `ink`. */
|
|
89
|
+
title: ReactNode;
|
|
90
|
+
/** One line under the name, in `muted`. */
|
|
91
|
+
description?: ReactNode;
|
|
92
|
+
/** Short facts at the end of the row in mono `faint`, joined by “ · ”: a slug, a status, a count. */
|
|
93
|
+
meta?: string[];
|
|
94
|
+
/** A dot before the name: green when it is live, grey and pulsing while it starts. Leave it out for no dot. */
|
|
95
|
+
isLive?: boolean;
|
|
96
|
+
};
|
|
97
|
+
/** One row of a ToolResultList. */
|
|
98
|
+
export declare function ToolResultListItem({ title, description, meta, isLive, className, ...props }: ToolResultListItemProps): import("react").JSX.Element;
|
|
99
|
+
export declare const TOOL_RESULT_SANDBOX_STATES: {
|
|
100
|
+
readonly READY: "ready";
|
|
101
|
+
/** The dot pulses. */
|
|
102
|
+
readonly STARTING: "starting";
|
|
103
|
+
readonly IN_USE: "in-use";
|
|
104
|
+
readonly NO_ACCESS: "no-access";
|
|
105
|
+
readonly FAILED: "failed";
|
|
106
|
+
};
|
|
107
|
+
export type ToolResultSandboxState = (typeof TOOL_RESULT_SANDBOX_STATES)[keyof typeof TOOL_RESULT_SANDBOX_STATES];
|
|
108
|
+
export type ToolResultCreatedProps = Omit<ComponentProps<"div">, "children"> & {
|
|
109
|
+
/** The app's name, in the header. */
|
|
110
|
+
name: string;
|
|
111
|
+
description?: string;
|
|
112
|
+
/** Its URL handle, in mono. */
|
|
113
|
+
slug?: string;
|
|
114
|
+
/** Whether its sandbox is up: a green dot when ready or starting (pulsing), warn otherwise. */
|
|
115
|
+
sandbox: ToolResultSandboxState;
|
|
116
|
+
};
|
|
117
|
+
/** The app a Create call made: its name, its description, its URL handle and whether its sandbox is up. */
|
|
118
|
+
export declare function ToolResultCreated({ name, description, slug, sandbox, className, ...props }: ToolResultCreatedProps): import("react").JSX.Element;
|
|
119
|
+
export type ToolResultErrorProps = ComponentProps<"div"> & {
|
|
120
|
+
/** The file the failed call was about, as the header. */
|
|
121
|
+
path?: string;
|
|
122
|
+
/** The error's text, as the tool returned it. */
|
|
123
|
+
children: ReactNode;
|
|
124
|
+
};
|
|
125
|
+
/** A failed call: its error in a destructive block, under the file's path when the call was about one. */
|
|
126
|
+
export declare function ToolResultError({ path, children, className, ...props }: ToolResultErrorProps): import("react").JSX.Element;
|
|
127
|
+
//# sourceMappingURL=tool-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-result.d.ts","sourceRoot":"","sources":["../../src/components/tool-result.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAkDtE,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAC9E,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,mGAAmG;IACnG,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qFAAqF;IACrF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF;;;G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AAC;AAEF,mCAAmC;AACnC,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,IAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,uBAAuB,+BAoBzH;AAED,eAAO,MAAM,0BAA0B;;IAErC,sBAAsB;;;;;CAKd,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,OAAO,0BAA0B,CAAC,CAAC;AAelH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAC7E,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+FAA+F;IAC/F,OAAO,EAAE,sBAAsB,CAAC;CACjC,CAAC;AAEF,2GAA2G;AAC3G,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,+BA6BlH;AAED,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACzD,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,0GAA0G;AAC1G,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,+BAe5F"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { AppWindow, FileText, Search, SquareTerminal, TextWrap } from "lucide-react";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
import { findCodeLanguage } from "../lib/code-language.js";
|
|
7
|
+
import { BUTTON_SIZES, BUTTON_VARIANTS, Button } from "./button.js";
|
|
8
|
+
import { CODE_BLOCK_LINE_VARIANTS, CODE_BLOCK_SIZES, CODE_BLOCK_VARIANTS, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockHighlightedLines, CodeBlockLine, CodeBlockTitle, } from "./code-block.js";
|
|
9
|
+
import { STATUS_DOT_TONES, StatusDot } from "./status-dot.js";
|
|
10
|
+
/** Long lines wrap or scroll sideways. */
|
|
11
|
+
function WrapToggle({ isWrapped, onToggle }) {
|
|
12
|
+
return (_jsx(Button, { variant: BUTTON_VARIANTS.GHOST, size: BUTTON_SIZES.ICON_SM, "aria-label": "Wrap lines", "aria-pressed": isWrapped, className: cn(isWrapped && "text-ink"), onClick: onToggle, children: _jsx(TextWrap, {}) }));
|
|
13
|
+
}
|
|
14
|
+
/** The file's path after a file icon, with the header's buttons. */
|
|
15
|
+
function FileHeader({ path, children }) {
|
|
16
|
+
return (_jsxs(CodeBlockHeader, { children: [_jsxs(CodeBlockTitle, { title: path, children: [_jsx(FileText, {}), _jsx("span", { className: "truncate", children: path })] }), children && _jsx(CodeBlockActions, { children: children })] }));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A Bash call as a terminal: the command after a `faint` prompt, its output in `ink-2`, and the exit code in danger
|
|
20
|
+
* when it failed. Lines wrap; the block scrolls past 320px.
|
|
21
|
+
*/
|
|
22
|
+
export function ToolResultTerminal({ command, output = "", exitCode = null, isBackground = false, isError = false, className, ...props }) {
|
|
23
|
+
const hasFailedExit = exitCode !== null && exitCode !== 0;
|
|
24
|
+
const shownOutput = isBackground ? "Running in the background" : output.replace(/\n$/, "");
|
|
25
|
+
return (_jsxs(CodeBlock, { "data-slot": "tool-result-terminal", size: CODE_BLOCK_SIZES.SM, variant: isError || hasFailedExit ? CODE_BLOCK_VARIANTS.DESTRUCTIVE : CODE_BLOCK_VARIANTS.DEFAULT, className: className, ...props, children: [_jsxs(CodeBlockHeader, { children: [_jsxs(CodeBlockTitle, { children: [_jsx(SquareTerminal, {}), "Terminal"] }), _jsx(CodeBlockActions, { children: _jsx(CodeBlockCopyButton, { value: command }) })] }), _jsxs(CodeBlockContent, { wrap: true, className: "max-h-80", children: [_jsxs(CodeBlockLine, { children: [_jsx("span", { className: "select-none text-faint", children: "$ " }), _jsx("span", { className: "text-ink", children: command })] }), shownOutput.length > 0 &&
|
|
26
|
+
shownOutput.split("\n").map((line, index) => (_jsx(CodeBlockLine, { className: "text-ink-2", children: line }, index)))] }), hasFailedExit && _jsxs(CodeBlockFooter, { className: "text-danger", children: ["exit code ", exitCode] })] }));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A Read or Write call: the file's path with Wrap and Copy, and its numbered lines with syntax colours in the file's
|
|
30
|
+
* language (from its extension, or `language`).
|
|
31
|
+
*/
|
|
32
|
+
export function ToolResultFile({ path, code, startLine = 1, language, children, className, ...props }) {
|
|
33
|
+
const [isWrapped, setIsWrapped] = useState(false);
|
|
34
|
+
return (_jsxs(CodeBlock, { "data-slot": "tool-result-file", size: CODE_BLOCK_SIZES.SM, className: className, ...props, children: [_jsxs(FileHeader, { path: path, children: [_jsx(WrapToggle, { isWrapped: isWrapped, onToggle: () => setIsWrapped(!isWrapped) }), _jsx(CodeBlockCopyButton, { value: code })] }), _jsx(CodeBlockContent, { lineNumbers: true, startLine: startLine, wrap: isWrapped, className: "max-h-80", children: children ?? _jsx(CodeBlockHighlightedLines, { code: code, language: language ?? findCodeLanguage(path) }) })] }));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* An Edit call as a diff: the file's path with Wrap, then each replacement's removed and added lines, with syntax
|
|
38
|
+
* colours in the file's language.
|
|
39
|
+
*/
|
|
40
|
+
export function ToolResultDiff({ path, edits = [], language, children, className, ...props }) {
|
|
41
|
+
const [isWrapped, setIsWrapped] = useState(false);
|
|
42
|
+
const codeLanguage = language ?? findCodeLanguage(path);
|
|
43
|
+
return (_jsxs(CodeBlock, { "data-slot": "tool-result-diff", size: CODE_BLOCK_SIZES.SM, className: className, ...props, children: [_jsx(FileHeader, { path: path, children: _jsx(WrapToggle, { isWrapped: isWrapped, onToggle: () => setIsWrapped(!isWrapped) }) }), _jsx(CodeBlockContent, { wrap: isWrapped, className: "max-h-80", children: children ??
|
|
44
|
+
edits.map((edit, index) => (_jsxs("span", { className: "contents", children: [index > 0 && _jsx(CodeBlockLine, { className: "text-faint", children: "\u22EF" }), edit.removed && (_jsx(CodeBlockHighlightedLines, { code: edit.removed, language: codeLanguage, variant: CODE_BLOCK_LINE_VARIANTS.REMOVED })), edit.added && (_jsx(CodeBlockHighlightedLines, { code: edit.added, language: codeLanguage, variant: CODE_BLOCK_LINE_VARIANTS.ADDED }))] }, index))) })] }));
|
|
45
|
+
}
|
|
46
|
+
const pluralize = (count, one, many) => `${count} ${count === 1 ? one : many}`;
|
|
47
|
+
/** “3 matches in 2 files”, “2 files” when the search listed files only, or “No matches”: a Grep line's description. */
|
|
48
|
+
export function summarizeMatches(files) {
|
|
49
|
+
if (files.length === 0) {
|
|
50
|
+
return "No matches";
|
|
51
|
+
}
|
|
52
|
+
const matchCount = files.reduce((total, file) => total + (file.count ?? file.lines.length), 0);
|
|
53
|
+
const fileCount = pluralize(files.length, "file", "files");
|
|
54
|
+
return matchCount > 0 ? `${pluralize(matchCount, "match", "matches")} in ${fileCount}` : fileCount;
|
|
55
|
+
}
|
|
56
|
+
// Characters that make a regex more than a literal. An escaped one ("\.") is a literal again.
|
|
57
|
+
const REGEX_META_CHARACTERS = new Set([".", "^", "$", "*", "+", "?", "(", ")", "[", "]", "{", "}"]);
|
|
58
|
+
// Escapes that mean a class or an anchor ("\d", "\b"), not the letter itself.
|
|
59
|
+
const REGEX_CLASS_ESCAPE_PATTERN = /[a-zA-Z0-9]/;
|
|
60
|
+
/**
|
|
61
|
+
* The literal strings a pattern matches when it is a plain literal or an alternation of literals ("PricingTable",
|
|
62
|
+
* "foo|bar"); null for any other regex. Patterns come from the model and replaying them in JavaScript's backtracking
|
|
63
|
+
* engine can hang the page, so only literal matches are marked.
|
|
64
|
+
*/
|
|
65
|
+
function findLiteralAlternatives(pattern) {
|
|
66
|
+
const alternatives = [];
|
|
67
|
+
let current = "";
|
|
68
|
+
for (let index = 0; index < pattern.length; index++) {
|
|
69
|
+
const character = pattern[index];
|
|
70
|
+
if (character === "\\") {
|
|
71
|
+
const escaped = pattern[index + 1];
|
|
72
|
+
if (escaped === undefined || REGEX_CLASS_ESCAPE_PATTERN.test(escaped)) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
current += escaped;
|
|
76
|
+
index++;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (character === "|") {
|
|
80
|
+
alternatives.push(current);
|
|
81
|
+
current = "";
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (REGEX_META_CHARACTERS.has(character)) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
current += character;
|
|
88
|
+
}
|
|
89
|
+
alternatives.push(current);
|
|
90
|
+
return alternatives.every((alternative) => alternative.length > 0) ? alternatives : null;
|
|
91
|
+
}
|
|
92
|
+
/** The text with every occurrence of the literals in a `warn-soft` mark, left to right without overlaps. */
|
|
93
|
+
function markLiterals(text, literals, isCaseInsensitive) {
|
|
94
|
+
if (!literals) {
|
|
95
|
+
return text;
|
|
96
|
+
}
|
|
97
|
+
// One regex over the escaped literals finds matches in the text itself, so case folding never shifts them.
|
|
98
|
+
const source = literals.map((literal) => literal.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
99
|
+
const matcher = new RegExp(source, isCaseInsensitive ? "giu" : "gu");
|
|
100
|
+
const parts = [];
|
|
101
|
+
let cursor = 0;
|
|
102
|
+
for (const match of text.matchAll(matcher)) {
|
|
103
|
+
parts.push(text.slice(cursor, match.index));
|
|
104
|
+
parts.push(_jsx("mark", { className: "rounded-sm bg-warn-soft text-ink", children: match[0] }, match.index));
|
|
105
|
+
cursor = match.index + match[0].length;
|
|
106
|
+
}
|
|
107
|
+
parts.push(text.slice(cursor));
|
|
108
|
+
return parts;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* A Grep call's matches by file: the summary with Wrap, then each file's path and its matching lines with their
|
|
112
|
+
* numbers, the matched text in `warn-soft`.
|
|
113
|
+
*/
|
|
114
|
+
export function ToolResultMatches({ files, pattern, isCaseInsensitive = false, note, className, ...props }) {
|
|
115
|
+
const [isWrapped, setIsWrapped] = useState(false);
|
|
116
|
+
const literals = pattern ? findLiteralAlternatives(pattern) : null;
|
|
117
|
+
return (_jsxs(CodeBlock, { "data-slot": "tool-result-matches", size: CODE_BLOCK_SIZES.SM, className: className, ...props, children: [_jsxs(CodeBlockHeader, { children: [_jsxs(CodeBlockTitle, { children: [_jsx(Search, {}), summarizeMatches(files)] }), _jsx(CodeBlockActions, { children: _jsx(WrapToggle, { isWrapped: isWrapped, onToggle: () => setIsWrapped(!isWrapped) }) })] }), _jsx(CodeBlockContent, { wrap: isWrapped, className: "max-h-80", children: files.map((file, fileIndex) => (_jsxs("span", { className: "contents", children: [_jsxs(CodeBlockLine, { className: cn("text-ink-2", fileIndex > 0 && "mt-2"), children: [file.path, file.count != null && _jsxs("span", { className: "text-muted", children: [" \u00B7 ", pluralize(file.count, "match", "matches")] })] }), file.lines.map((line, lineIndex) => (_jsxs(CodeBlockLine, { className: "text-muted", children: [_jsx("span", { className: "inline-block min-w-8 select-none pe-3 text-end text-faint", children: line.line ?? "" }), markLiterals(line.text, literals, isCaseInsensitive)] }, lineIndex)))] }, `${file.path}-${fileIndex}`))) }), note && _jsx(CodeBlockFooter, { children: note })] }));
|
|
118
|
+
}
|
|
119
|
+
/** A list call's rows (apps, agents, sandboxes, branches) in place of their JSON; it scrolls past 320px. */
|
|
120
|
+
export function ToolResultList({ className, children, ...props }) {
|
|
121
|
+
return (_jsx(CodeBlock, { "data-slot": "tool-result-list", size: CODE_BLOCK_SIZES.SM, className: className, ...props, children: _jsx("ul", { className: "m-0 max-h-80 list-none divide-y divide-line overflow-auto p-0 font-sans", children: children }) }));
|
|
122
|
+
}
|
|
123
|
+
/** One row of a ToolResultList. */
|
|
124
|
+
export function ToolResultListItem({ title, description, meta = [], isLive, className, ...props }) {
|
|
125
|
+
return (_jsxs("li", { "data-slot": "tool-result-list-item", className: cn("flex min-w-0 items-baseline gap-3 px-space-10 py-1.5", className), ...props, children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [isLive !== undefined && (_jsx(StatusDot, { tone: isLive ? STATUS_DOT_TONES.OK : STATUS_DOT_TONES.OFF, role: "img", "aria-label": isLive ? "Live" : "Starting", className: cn("shrink-0", !isLive && "animate-pulse motion-reduce:animate-none") })), _jsx("span", { className: "truncate text-small text-ink", children: title })] }), description && _jsx("p", { className: "m-0 truncate text-small text-muted", children: description })] }), meta.length > 0 && _jsx("span", { className: "shrink-0 font-mono text-small text-faint", children: meta.join(" · ") })] }));
|
|
126
|
+
}
|
|
127
|
+
export const TOOL_RESULT_SANDBOX_STATES = {
|
|
128
|
+
READY: "ready",
|
|
129
|
+
/** The dot pulses. */
|
|
130
|
+
STARTING: "starting",
|
|
131
|
+
IN_USE: "in-use",
|
|
132
|
+
NO_ACCESS: "no-access",
|
|
133
|
+
FAILED: "failed",
|
|
134
|
+
};
|
|
135
|
+
const SANDBOX_STATE_LABELS = {
|
|
136
|
+
[TOOL_RESULT_SANDBOX_STATES.READY]: "Sandbox ready",
|
|
137
|
+
[TOOL_RESULT_SANDBOX_STATES.STARTING]: "Sandbox starting",
|
|
138
|
+
[TOOL_RESULT_SANDBOX_STATES.IN_USE]: "Sandbox in use",
|
|
139
|
+
[TOOL_RESULT_SANDBOX_STATES.NO_ACCESS]: "No sandbox access",
|
|
140
|
+
[TOOL_RESULT_SANDBOX_STATES.FAILED]: "Sandbox failed to start",
|
|
141
|
+
};
|
|
142
|
+
const HEALTHY_SANDBOX_STATES = new Set([
|
|
143
|
+
TOOL_RESULT_SANDBOX_STATES.READY,
|
|
144
|
+
TOOL_RESULT_SANDBOX_STATES.STARTING,
|
|
145
|
+
]);
|
|
146
|
+
/** The app a Create call made: its name, its description, its URL handle and whether its sandbox is up. */
|
|
147
|
+
export function ToolResultCreated({ name, description, slug, sandbox, className, ...props }) {
|
|
148
|
+
const isSandboxHealthy = HEALTHY_SANDBOX_STATES.has(sandbox);
|
|
149
|
+
return (_jsxs(CodeBlock, { "data-slot": "tool-result-created", size: CODE_BLOCK_SIZES.SM, className: className, ...props, children: [_jsx(CodeBlockHeader, { children: _jsxs(CodeBlockTitle, { children: [_jsx(AppWindow, {}), name] }) }), _jsxs("div", { className: "space-y-space-6 px-space-10 py-space-8 font-sans", children: [description && _jsx("p", { className: "m-0 text-ui-sm text-ink-2", children: description }), _jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-small text-muted", children: [slug && _jsx("span", { className: "font-mono", children: slug }), _jsx(StatusDot, { tone: isSandboxHealthy ? STATUS_DOT_TONES.OK : STATUS_DOT_TONES.WARN, className: cn("text-small text-muted", sandbox === TOOL_RESULT_SANDBOX_STATES.STARTING && "animate-pulse motion-reduce:animate-none"), children: SANDBOX_STATE_LABELS[sandbox] })] })] })] }));
|
|
150
|
+
}
|
|
151
|
+
/** A failed call: its error in a destructive block, under the file's path when the call was about one. */
|
|
152
|
+
export function ToolResultError({ path, children, className, ...props }) {
|
|
153
|
+
return (_jsxs(CodeBlock, { "data-slot": "tool-result-error", size: CODE_BLOCK_SIZES.SM, variant: CODE_BLOCK_VARIANTS.DESTRUCTIVE, className: className, ...props, children: [path && _jsx(FileHeader, { path: path }), _jsx(CodeBlockContent, { wrap: true, className: "max-h-60", children: children })] }));
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=tool-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-result.js","sourceRoot":"","sources":["../../src/components/tool-result.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAuC,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,aAAc,CAAC;AACrE,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,EACnB,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,aAAa,EACb,cAAc,GACf,MAAM,iBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,iBAAkB,CAAC;AAE/D,0CAA0C;AAC1C,SAAS,UAAU,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAgD;IACvF,OAAO,CACL,KAAC,MAAM,IACL,OAAO,EAAE,eAAe,CAAC,KAAK,EAC9B,IAAI,EAAE,YAAY,CAAC,OAAO,gBACf,YAAY,kBACT,SAAS,EACvB,SAAS,EAAE,EAAE,CAAC,SAAS,IAAI,UAAU,CAAC,EACtC,OAAO,EAAE,QAAQ,YAEjB,KAAC,QAAQ,KAAG,GACL,CACV,CAAC;AACJ,CAAC;AAED,oEAAoE;AACpE,SAAS,UAAU,CAAC,EAAE,IAAI,EAAE,QAAQ,EAA0C;IAC5E,OAAO,CACL,MAAC,eAAe,eACd,MAAC,cAAc,IAAC,KAAK,EAAE,IAAI,aACzB,KAAC,QAAQ,KAAG,EACZ,eAAM,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,CAAC,EAAE,EACzB,OAAO,EAAE,mBAAmB,CAAC,WAAW,EACxC,SAAS,EAAE,SAAS,KAChB,KAAK,aAER,IAAI,IAAI,KAAC,UAAU,IAAC,IAAI,EAAE,IAAI,GAAI,EACnC,KAAC,gBAAgB,IAAC,IAAI,QAAC,SAAS,EAAC,UAAU,YACxC,QAAQ,GACQ,IACT,CACb,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport { useState, type ComponentProps, type ReactNode } from \"react\";\nimport { AppWindow, FileText, Search, SquareTerminal, TextWrap } from \"lucide-react\";\nimport { cn } from \"../lib/cn.ts\";\nimport { findCodeLanguage } from \"../lib/code-language.ts\";\nimport { BUTTON_SIZES, BUTTON_VARIANTS, Button } from \"./button.tsx\";\nimport {\n CODE_BLOCK_LINE_VARIANTS,\n CODE_BLOCK_SIZES,\n CODE_BLOCK_VARIANTS,\n CodeBlock,\n CodeBlockActions,\n CodeBlockContent,\n CodeBlockCopyButton,\n CodeBlockFooter,\n CodeBlockHeader,\n CodeBlockHighlightedLines,\n CodeBlockLine,\n CodeBlockTitle,\n} from \"./code-block.tsx\";\nimport { STATUS_DOT_TONES, StatusDot } from \"./status-dot.tsx\";\n\n/** Long lines wrap or scroll sideways. */\nfunction WrapToggle({ isWrapped, onToggle }: { isWrapped: boolean; onToggle: () => void }) {\n return (\n <Button\n variant={BUTTON_VARIANTS.GHOST}\n size={BUTTON_SIZES.ICON_SM}\n aria-label=\"Wrap lines\"\n aria-pressed={isWrapped}\n className={cn(isWrapped && \"text-ink\")}\n onClick={onToggle}\n >\n <TextWrap />\n </Button>\n );\n}\n\n/** The file's path after a file icon, with the header's buttons. */\nfunction FileHeader({ path, children }: { path: string; children?: ReactNode }) {\n return (\n <CodeBlockHeader>\n <CodeBlockTitle title={path}>\n <FileText />\n <span className=\"truncate\">{path}</span>\n </CodeBlockTitle>\n {children && <CodeBlockActions>{children}</CodeBlockActions>}\n </CodeBlockHeader>\n );\n}\n\nexport type ToolResultTerminalProps = Omit<ComponentProps<\"div\">, \"children\"> & {\n /** The command as it ran; Copy copies it. */\n command: string;\n /** What it printed, stdout and stderr together. */\n output?: string;\n /** Shown under the output when it isn't 0. Leave it out while unknown. */\n exitCode?: number | null;\n /** The command keeps running after the call: “Running in the background” stands for its output. */\n isBackground?: boolean;\n /** The call itself failed: the block turns danger. A non-zero exit code does too. */\n isError?: boolean;\n};\n\n/**\n * A Bash call as a terminal: the command after a `faint` prompt, its output in `ink-2`, and the exit code in danger\n * when it failed. Lines wrap; the block scrolls past 320px.\n */\nexport function ToolResultTerminal({\n command,\n output = \"\",\n exitCode = null,\n isBackground = false,\n isError = false,\n className,\n ...props\n}: ToolResultTerminalProps) {\n const hasFailedExit = exitCode !== null && exitCode !== 0;\n const shownOutput = isBackground ? \"Running in the background\" : output.replace(/\\n$/, \"\");\n\n return (\n <CodeBlock\n data-slot=\"tool-result-terminal\"\n size={CODE_BLOCK_SIZES.SM}\n variant={isError || hasFailedExit ? CODE_BLOCK_VARIANTS.DESTRUCTIVE : CODE_BLOCK_VARIANTS.DEFAULT}\n className={className}\n {...props}\n >\n <CodeBlockHeader>\n <CodeBlockTitle>\n <SquareTerminal />\n Terminal\n </CodeBlockTitle>\n <CodeBlockActions>\n <CodeBlockCopyButton value={command} />\n </CodeBlockActions>\n </CodeBlockHeader>\n <CodeBlockContent wrap className=\"max-h-80\">\n <CodeBlockLine>\n <span className=\"select-none text-faint\">$ </span>\n <span className=\"text-ink\">{command}</span>\n </CodeBlockLine>\n {shownOutput.length > 0 &&\n shownOutput.split(\"\\n\").map((line, index) => (\n <CodeBlockLine key={index} className=\"text-ink-2\">\n {line}\n </CodeBlockLine>\n ))}\n </CodeBlockContent>\n {hasFailedExit && <CodeBlockFooter className=\"text-danger\">exit code {exitCode}</CodeBlockFooter>}\n </CodeBlock>\n );\n}\n\nexport type ToolResultFileProps = ComponentProps<\"div\"> & {\n /** The file's path, in the header. */\n path: string;\n /** The file's text: what Copy copies, and the lines unless `children` gives them. */\n code: string;\n /** The first line's number, for a part of a file (a Read from line 40). */\n startLine?: number;\n /** The Prism language the lines are highlighted in. By default it's read off the path's extension. */\n language?: string;\n /** Lines of your own, as CodeBlockLines, in place of the highlighted `code`. */\n children?: ReactNode;\n};\n\n/**\n * A Read or Write call: the file's path with Wrap and Copy, and its numbered lines with syntax colours in the file's\n * language (from its extension, or `language`).\n */\nexport function ToolResultFile({ path, code, startLine = 1, language, children, className, ...props }: ToolResultFileProps) {\n const [isWrapped, setIsWrapped] = useState(false);\n\n return (\n <CodeBlock data-slot=\"tool-result-file\" size={CODE_BLOCK_SIZES.SM} className={className} {...props}>\n <FileHeader path={path}>\n <WrapToggle isWrapped={isWrapped} onToggle={() => setIsWrapped(!isWrapped)} />\n <CodeBlockCopyButton value={code} />\n </FileHeader>\n <CodeBlockContent lineNumbers startLine={startLine} wrap={isWrapped} className=\"max-h-80\">\n {children ?? <CodeBlockHighlightedLines code={code} language={language ?? findCodeLanguage(path)} />}\n </CodeBlockContent>\n </CodeBlock>\n );\n}\n\n/** One replacement an Edit made: the text it removed and the text it put in. */\nexport interface ToolResultDiffEdit {\n removed?: string;\n added?: string;\n}\n\nexport type ToolResultDiffProps = ComponentProps<\"div\"> & {\n /** The edited file's path, in the header. */\n path: string;\n /** Each replacement, in order: its removed lines, then its added ones, with a `⋯` line between replacements. */\n edits?: ToolResultDiffEdit[];\n /** The Prism language the lines are highlighted in. By default it's read off the path's extension. */\n language?: string;\n /** Lines of your own, as CodeBlockLines with the added and removed variants. Replaces `edits`. */\n children?: ReactNode;\n};\n\n/**\n * An Edit call as a diff: the file's path with Wrap, then each replacement's removed and added lines, with syntax\n * colours in the file's language.\n */\nexport function ToolResultDiff({ path, edits = [], language, children, className, ...props }: ToolResultDiffProps) {\n const [isWrapped, setIsWrapped] = useState(false);\n const codeLanguage = language ?? findCodeLanguage(path);\n\n return (\n <CodeBlock data-slot=\"tool-result-diff\" size={CODE_BLOCK_SIZES.SM} className={className} {...props}>\n <FileHeader path={path}>\n <WrapToggle isWrapped={isWrapped} onToggle={() => setIsWrapped(!isWrapped)} />\n </FileHeader>\n <CodeBlockContent wrap={isWrapped} className=\"max-h-80\">\n {children ??\n edits.map((edit, index) => (\n <span key={index} className=\"contents\">\n {index > 0 && <CodeBlockLine className=\"text-faint\">⋯</CodeBlockLine>}\n {edit.removed && (\n <CodeBlockHighlightedLines code={edit.removed} language={codeLanguage} variant={CODE_BLOCK_LINE_VARIANTS.REMOVED} />\n )}\n {edit.added && (\n <CodeBlockHighlightedLines code={edit.added} language={codeLanguage} variant={CODE_BLOCK_LINE_VARIANTS.ADDED} />\n )}\n </span>\n ))}\n </CodeBlockContent>\n </CodeBlock>\n );\n}\n\n/** One matching line of a file. */\nexport interface ToolResultMatchLine {\n /** Its line number, when the search reported one. */\n line?: number | null;\n text: string;\n}\n\n/** A file the search matched, with its matching lines. */\nexport interface ToolResultMatchFile {\n path: string;\n lines: ToolResultMatchLine[];\n /** How many matches the file has, when the search counted them (more than the lines shown, perhaps). */\n count?: number | null;\n}\n\nconst pluralize = (count: number, one: string, many: string) => `${count} ${count === 1 ? one : many}`;\n\n/** “3 matches in 2 files”, “2 files” when the search listed files only, or “No matches”: a Grep line's description. */\nexport function summarizeMatches(files: ToolResultMatchFile[]): string {\n if (files.length === 0) {\n return \"No matches\";\n }\n\n const matchCount = files.reduce((total, file) => total + (file.count ?? file.lines.length), 0);\n const fileCount = pluralize(files.length, \"file\", \"files\");\n\n return matchCount > 0 ? `${pluralize(matchCount, \"match\", \"matches\")} in ${fileCount}` : fileCount;\n}\n\n// Characters that make a regex more than a literal. An escaped one (\"\\.\") is a literal again.\nconst REGEX_META_CHARACTERS = new Set([\".\", \"^\", \"$\", \"*\", \"+\", \"?\", \"(\", \")\", \"[\", \"]\", \"{\", \"}\"]);\n// Escapes that mean a class or an anchor (\"\\d\", \"\\b\"), not the letter itself.\nconst REGEX_CLASS_ESCAPE_PATTERN = /[a-zA-Z0-9]/;\n\n/**\n * The literal strings a pattern matches when it is a plain literal or an alternation of literals (\"PricingTable\",\n * \"foo|bar\"); null for any other regex. Patterns come from the model and replaying them in JavaScript's backtracking\n * engine can hang the page, so only literal matches are marked.\n */\nfunction findLiteralAlternatives(pattern: string): string[] | null {\n const alternatives: string[] = [];\n let current = \"\";\n\n for (let index = 0; index < pattern.length; index++) {\n const character = pattern[index];\n\n if (character === \"\\\\\") {\n const escaped = pattern[index + 1];\n\n if (escaped === undefined || REGEX_CLASS_ESCAPE_PATTERN.test(escaped)) {\n return null;\n }\n\n current += escaped;\n index++;\n continue;\n }\n\n if (character === \"|\") {\n alternatives.push(current);\n current = \"\";\n continue;\n }\n\n if (REGEX_META_CHARACTERS.has(character)) {\n return null;\n }\n\n current += character;\n }\n\n alternatives.push(current);\n\n return alternatives.every((alternative) => alternative.length > 0) ? alternatives : null;\n}\n\n/** The text with every occurrence of the literals in a `warn-soft` mark, left to right without overlaps. */\nfunction markLiterals(text: string, literals: string[] | null, isCaseInsensitive: boolean): ReactNode {\n if (!literals) {\n return text;\n }\n\n // One regex over the escaped literals finds matches in the text itself, so case folding never shifts them.\n const source = literals.map((literal) => literal.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")).join(\"|\");\n const matcher = new RegExp(source, isCaseInsensitive ? \"giu\" : \"gu\");\n const parts: ReactNode[] = [];\n let cursor = 0;\n\n for (const match of text.matchAll(matcher)) {\n parts.push(text.slice(cursor, match.index));\n parts.push(\n <mark key={match.index} className=\"rounded-sm bg-warn-soft text-ink\">\n {match[0]}\n </mark>\n );\n cursor = match.index + match[0].length;\n }\n\n parts.push(text.slice(cursor));\n\n return parts;\n}\n\nexport type ToolResultMatchesProps = Omit<ComponentProps<\"div\">, \"children\"> & {\n /** The matched files, in the search's order. */\n files: ToolResultMatchFile[];\n /** The search pattern: its matches are marked when it is a literal or literals joined by `|`. */\n pattern?: string;\n isCaseInsensitive?: boolean;\n /** A line under the matches: “Results capped at 100 lines”. */\n note?: ReactNode;\n};\n\n/**\n * A Grep call's matches by file: the summary with Wrap, then each file's path and its matching lines with their\n * numbers, the matched text in `warn-soft`.\n */\nexport function ToolResultMatches({ files, pattern, isCaseInsensitive = false, note, className, ...props }: ToolResultMatchesProps) {\n const [isWrapped, setIsWrapped] = useState(false);\n const literals = pattern ? findLiteralAlternatives(pattern) : null;\n\n return (\n <CodeBlock data-slot=\"tool-result-matches\" size={CODE_BLOCK_SIZES.SM} className={className} {...props}>\n <CodeBlockHeader>\n <CodeBlockTitle>\n <Search />\n {summarizeMatches(files)}\n </CodeBlockTitle>\n <CodeBlockActions>\n <WrapToggle isWrapped={isWrapped} onToggle={() => setIsWrapped(!isWrapped)} />\n </CodeBlockActions>\n </CodeBlockHeader>\n <CodeBlockContent wrap={isWrapped} className=\"max-h-80\">\n {files.map((file, fileIndex) => (\n <span key={`${file.path}-${fileIndex}`} className=\"contents\">\n <CodeBlockLine className={cn(\"text-ink-2\", fileIndex > 0 && \"mt-2\")}>\n {file.path}\n {file.count != null && <span className=\"text-muted\"> · {pluralize(file.count, \"match\", \"matches\")}</span>}\n </CodeBlockLine>\n {file.lines.map((line, lineIndex) => (\n <CodeBlockLine key={lineIndex} className=\"text-muted\">\n <span className=\"inline-block min-w-8 select-none pe-3 text-end text-faint\">{line.line ?? \"\"}</span>\n {markLiterals(line.text, literals, isCaseInsensitive)}\n </CodeBlockLine>\n ))}\n </span>\n ))}\n </CodeBlockContent>\n {note && <CodeBlockFooter>{note}</CodeBlockFooter>}\n </CodeBlock>\n );\n}\n\n/** A list call's rows (apps, agents, sandboxes, branches) in place of their JSON; it scrolls past 320px. */\nexport function ToolResultList({ className, children, ...props }: ComponentProps<\"div\">) {\n return (\n <CodeBlock data-slot=\"tool-result-list\" size={CODE_BLOCK_SIZES.SM} className={className} {...props}>\n {/* The block is set in mono for code; the rows are prose with mono facts. */}\n <ul className=\"m-0 max-h-80 list-none divide-y divide-line overflow-auto p-0 font-sans\">{children}</ul>\n </CodeBlock>\n );\n}\n\nexport type ToolResultListItemProps = Omit<ComponentProps<\"li\">, \"title\"> & {\n /** Its name, in 12px `ink`. */\n title: ReactNode;\n /** One line under the name, in `muted`. */\n description?: ReactNode;\n /** Short facts at the end of the row in mono `faint`, joined by “ · ”: a slug, a status, a count. */\n meta?: string[];\n /** A dot before the name: green when it is live, grey and pulsing while it starts. Leave it out for no dot. */\n isLive?: boolean;\n};\n\n/** One row of a ToolResultList. */\nexport function ToolResultListItem({ title, description, meta = [], isLive, className, ...props }: ToolResultListItemProps) {\n return (\n <li data-slot=\"tool-result-list-item\" className={cn(\"flex min-w-0 items-baseline gap-3 px-space-10 py-1.5\", className)} {...props}>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex min-w-0 items-center gap-1.5\">\n {isLive !== undefined && (\n <StatusDot\n tone={isLive ? STATUS_DOT_TONES.OK : STATUS_DOT_TONES.OFF}\n role=\"img\"\n aria-label={isLive ? \"Live\" : \"Starting\"}\n className={cn(\"shrink-0\", !isLive && \"animate-pulse motion-reduce:animate-none\")}\n />\n )}\n <span className=\"truncate text-small text-ink\">{title}</span>\n </div>\n {description && <p className=\"m-0 truncate text-small text-muted\">{description}</p>}\n </div>\n {meta.length > 0 && <span className=\"shrink-0 font-mono text-small text-faint\">{meta.join(\" · \")}</span>}\n </li>\n );\n}\n\nexport const TOOL_RESULT_SANDBOX_STATES = {\n READY: \"ready\",\n /** The dot pulses. */\n STARTING: \"starting\",\n IN_USE: \"in-use\",\n NO_ACCESS: \"no-access\",\n FAILED: \"failed\",\n} as const;\n\nexport type ToolResultSandboxState = (typeof TOOL_RESULT_SANDBOX_STATES)[keyof typeof TOOL_RESULT_SANDBOX_STATES];\n\nconst SANDBOX_STATE_LABELS = {\n [TOOL_RESULT_SANDBOX_STATES.READY]: \"Sandbox ready\",\n [TOOL_RESULT_SANDBOX_STATES.STARTING]: \"Sandbox starting\",\n [TOOL_RESULT_SANDBOX_STATES.IN_USE]: \"Sandbox in use\",\n [TOOL_RESULT_SANDBOX_STATES.NO_ACCESS]: \"No sandbox access\",\n [TOOL_RESULT_SANDBOX_STATES.FAILED]: \"Sandbox failed to start\",\n} satisfies Record<ToolResultSandboxState, string>;\n\nconst HEALTHY_SANDBOX_STATES: ReadonlySet<ToolResultSandboxState> = new Set([\n TOOL_RESULT_SANDBOX_STATES.READY,\n TOOL_RESULT_SANDBOX_STATES.STARTING,\n]);\n\nexport type ToolResultCreatedProps = Omit<ComponentProps<\"div\">, \"children\"> & {\n /** The app's name, in the header. */\n name: string;\n description?: string;\n /** Its URL handle, in mono. */\n slug?: string;\n /** Whether its sandbox is up: a green dot when ready or starting (pulsing), warn otherwise. */\n sandbox: ToolResultSandboxState;\n};\n\n/** The app a Create call made: its name, its description, its URL handle and whether its sandbox is up. */\nexport function ToolResultCreated({ name, description, slug, sandbox, className, ...props }: ToolResultCreatedProps) {\n const isSandboxHealthy = HEALTHY_SANDBOX_STATES.has(sandbox);\n\n return (\n <CodeBlock data-slot=\"tool-result-created\" size={CODE_BLOCK_SIZES.SM} className={className} {...props}>\n <CodeBlockHeader>\n <CodeBlockTitle>\n <AppWindow />\n {name}\n </CodeBlockTitle>\n </CodeBlockHeader>\n {/* The block is set in mono for code; this is prose. */}\n <div className=\"space-y-space-6 px-space-10 py-space-8 font-sans\">\n {description && <p className=\"m-0 text-ui-sm text-ink-2\">{description}</p>}\n <div className=\"flex flex-wrap items-center gap-x-3 gap-y-1 text-small text-muted\">\n {slug && <span className=\"font-mono\">{slug}</span>}\n <StatusDot\n tone={isSandboxHealthy ? STATUS_DOT_TONES.OK : STATUS_DOT_TONES.WARN}\n className={cn(\n \"text-small text-muted\",\n sandbox === TOOL_RESULT_SANDBOX_STATES.STARTING && \"animate-pulse motion-reduce:animate-none\"\n )}\n >\n {SANDBOX_STATE_LABELS[sandbox]}\n </StatusDot>\n </div>\n </div>\n </CodeBlock>\n );\n}\n\nexport type ToolResultErrorProps = ComponentProps<\"div\"> & {\n /** The file the failed call was about, as the header. */\n path?: string;\n /** The error's text, as the tool returned it. */\n children: ReactNode;\n};\n\n/** A failed call: its error in a destructive block, under the file's path when the call was about one. */\nexport function ToolResultError({ path, children, className, ...props }: ToolResultErrorProps) {\n return (\n <CodeBlock\n data-slot=\"tool-result-error\"\n size={CODE_BLOCK_SIZES.SM}\n variant={CODE_BLOCK_VARIANTS.DESTRUCTIVE}\n className={className}\n {...props}\n >\n {path && <FileHeader path={path} />}\n <CodeBlockContent wrap className=\"max-h-60\">\n {children}\n </CodeBlockContent>\n </CodeBlock>\n );\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
2
|
+
/**
|
|
3
|
+
* Shares the open delay between tooltips, and opening one closes the one that was open. Mount it once at the app
|
|
4
|
+
* root; a `Tooltip` outside one brings its own, with the same 300ms delay.
|
|
5
|
+
*/
|
|
6
|
+
export declare function TooltipProvider({ delay, children, ...props }: TooltipPrimitive.Provider.Props): import("react").JSX.Element;
|
|
7
|
+
/** The name of an icon-only control, or a short fact about something truncated. No arrow, no actions inside. */
|
|
8
|
+
export declare function Tooltip(props: TooltipPrimitive.Root.Props): import("react").JSX.Element;
|
|
9
|
+
/** Pass the control as `render`: `<TooltipTrigger render={<Button … />} />`. A custom control must forward its ref. */
|
|
10
|
+
export declare function TooltipTrigger(props: TooltipPrimitive.Trigger.Props): import("react").JSX.Element;
|
|
11
|
+
type TooltipContentProps = TooltipPrimitive.Popup.Props & Pick<TooltipPrimitive.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset" | "collisionPadding" | "collisionAvoidance">;
|
|
12
|
+
/**
|
|
13
|
+
* Inverted: `tooltip` fill, `panel` text, 12px, `rounded-md`, 6px above the trigger. Fades in over 160ms.
|
|
14
|
+
* A `<kbd>` inside renders as a key hint: `Search <kbd>/</kbd>`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function TooltipContent({ className, side, sideOffset, align, alignOffset, collisionPadding, collisionAvoidance, ...props }: TooltipContentProps): import("react").JSX.Element;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/components/tooltip.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAerE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,KAAwB,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,CAAC,QAAQ,CAAC,KAAK,+BAMhH;AAED,gHAAgH;AAChH,wBAAgB,OAAO,CAAC,KAAK,EAAE,gBAAgB,CAAC,IAAI,CAAC,KAAK,+BAIzD;AAED,uHAAuH;AACvH,wBAAgB,cAAc,CAAC,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,+BAEnE;AAED,KAAK,mBAAmB,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAK,GACrD,IAAI,CACF,gBAAgB,CAAC,UAAU,CAAC,KAAK,EACjC,OAAO,GAAG,aAAa,GAAG,MAAM,GAAG,YAAY,GAAG,kBAAkB,GAAG,oBAAoB,CAC5F,CAAC;AAEJ;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,IAAY,EACZ,UAAc,EACd,KAAgB,EAChB,WAAe,EACf,gBAAoB,EACpB,kBAAwC,EACxC,GAAG,KAAK,EACT,EAAE,mBAAmB,+BAwBrB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, use } from "react";
|
|
4
|
+
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
/**
|
|
7
|
+
* Collision handling as before the move to Base UI: flip to the opposite side, slide along it to stay on screen,
|
|
8
|
+
* never flip the alignment or move to another axis.
|
|
9
|
+
*/
|
|
10
|
+
const COLLISION_AVOIDANCE = { side: "flip", align: "shift", fallbackAxisSide: "none" };
|
|
11
|
+
/** Tooltips open after 300ms on hover, straight away on keyboard focus. */
|
|
12
|
+
const TOOLTIP_DELAY_MS = 300;
|
|
13
|
+
/** Whether a TooltipProvider is mounted above, so a Tooltip joins its group instead of bringing its own. */
|
|
14
|
+
const TooltipProviderPresence = createContext(false);
|
|
15
|
+
/**
|
|
16
|
+
* Shares the open delay between tooltips, and opening one closes the one that was open. Mount it once at the app
|
|
17
|
+
* root; a `Tooltip` outside one brings its own, with the same 300ms delay.
|
|
18
|
+
*/
|
|
19
|
+
export function TooltipProvider({ delay = TOOLTIP_DELAY_MS, children, ...props }) {
|
|
20
|
+
return (_jsx(TooltipPrimitive.Provider, { "data-slot": "tooltip-provider", delay: delay, ...props, children: _jsx(TooltipProviderPresence, { value: true, children: children }) }));
|
|
21
|
+
}
|
|
22
|
+
/** The name of an icon-only control, or a short fact about something truncated. No arrow, no actions inside. */
|
|
23
|
+
export function Tooltip(props) {
|
|
24
|
+
const tooltip = _jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props });
|
|
25
|
+
return use(TooltipProviderPresence) ? tooltip : _jsx(TooltipProvider, { children: tooltip });
|
|
26
|
+
}
|
|
27
|
+
/** Pass the control as `render`: `<TooltipTrigger render={<Button … />} />`. A custom control must forward its ref. */
|
|
28
|
+
export function TooltipTrigger(props) {
|
|
29
|
+
return _jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Inverted: `tooltip` fill, `panel` text, 12px, `rounded-md`, 6px above the trigger. Fades in over 160ms.
|
|
33
|
+
* A `<kbd>` inside renders as a key hint: `Search <kbd>/</kbd>`.
|
|
34
|
+
*/
|
|
35
|
+
export function TooltipContent({ className, side = "top", sideOffset = 6, align = "center", alignOffset = 0, collisionPadding = 0, collisionAvoidance = COLLISION_AVOIDANCE, ...props }) {
|
|
36
|
+
return (_jsx(TooltipPrimitive.Portal, { children: _jsx(TooltipPrimitive.Positioner, { side: side, sideOffset: sideOffset, align: align, alignOffset: alignOffset, collisionPadding: collisionPadding, collisionAvoidance: collisionAvoidance, className: "isolate z-50", children: _jsx(TooltipPrimitive.Popup, { "data-slot": "tooltip-content", className: cn("z-50 inline-flex items-center gap-space-6 whitespace-nowrap rounded-md bg-tooltip px-space-8 py-1.25 font-sans text-small text-panel data-open:animate-fade-in", "[&_kbd]:rounded-[0.1875rem] [&_kbd]:bg-panel/18 [&_kbd]:px-space-4 [&_kbd]:font-mono [&_kbd]:text-2xs [&_kbd]:font-normal [&_kbd]:opacity-75", className), ...props }) }) }));
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../src/components/tooltip.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC;;;GAGG;AACH,MAAM,mBAAmB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAW,CAAC;AAEhG,2EAA2E;AAC3E,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,4GAA4G;AAC5G,MAAM,uBAAuB,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAErD;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,EAAE,KAAK,GAAG,gBAAgB,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAmC;IAC/G,OAAO,CACL,KAAC,gBAAgB,CAAC,QAAQ,iBAAW,kBAAkB,EAAC,KAAK,EAAE,KAA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ooltipPrimitive } from \"@base-ui/react/tooltip\";\nimport { cn } from \"../lib/cn.ts\";\n\n/**\n * Collision handling as before the move to Base UI: flip to the opposite side, slide along it to stay on screen,\n * never flip the alignment or move to another axis.\n */\nconst COLLISION_AVOIDANCE = { side: \"flip\", align: \"shift\", fallbackAxisSide: \"none\" } as const;\n\n/** Tooltips open after 300ms on hover, straight away on keyboard focus. */\nconst TOOLTIP_DELAY_MS = 300;\n\n/** Whether a TooltipProvider is mounted above, so a Tooltip joins its group instead of bringing its own. */\nconst TooltipProviderPresence = createContext(false);\n\n/**\n * Shares the open delay between tooltips, and opening one closes the one that was open. Mount it once at the app\n * root; a `Tooltip` outside one brings its own, with the same 300ms delay.\n */\nexport function TooltipProvider({ delay = TOOLTIP_DELAY_MS, children, ...props }: TooltipPrimitive.Provider.Props) {\n return (\n <TooltipPrimitive.Provider data-slot=\"tooltip-provider\" delay={delay} {...props}>\n <TooltipProviderPresence value={true}>{children}</TooltipProviderPresence>\n </TooltipPrimitive.Provider>\n );\n}\n\n/** The name of an icon-only control, or a short fact about something truncated. No arrow, no actions inside. */\nexport function Tooltip(props: TooltipPrimitive.Root.Props) {\n const tooltip = <TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />;\n\n return use(TooltipProviderPresence) ? tooltip : <TooltipProvider>{tooltip}</TooltipProvider>;\n}\n\n/** Pass the control as `render`: `<TooltipTrigger render={<Button … />} />`. A custom control must forward its ref. */\nexport function TooltipTrigger(props: TooltipPrimitive.Trigger.Props) {\n return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />;\n}\n\ntype TooltipContentProps = TooltipPrimitive.Popup.Props &\n Pick<\n TooltipPrimitive.Positioner.Props,\n \"align\" | \"alignOffset\" | \"side\" | \"sideOffset\" | \"collisionPadding\" | \"collisionAvoidance\"\n >;\n\n/**\n * Inverted: `tooltip` fill, `panel` text, 12px, `rounded-md`, 6px above the trigger. Fades in over 160ms.\n * A `<kbd>` inside renders as a key hint: `Search <kbd>/</kbd>`.\n */\nexport function TooltipContent({\n className,\n side = \"top\",\n sideOffset = 6,\n align = \"center\",\n alignOffset = 0,\n collisionPadding = 0,\n collisionAvoidance = COLLISION_AVOIDANCE,\n ...props\n}: TooltipContentProps) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n collisionPadding={collisionPadding}\n collisionAvoidance={collisionAvoidance}\n className=\"isolate z-50\"\n >\n <TooltipPrimitive.Popup\n data-slot=\"tooltip-content\"\n className={cn(\n \"z-50 inline-flex items-center gap-space-6 whitespace-nowrap rounded-md bg-tooltip px-space-8 py-1.25 font-sans text-small text-panel data-open:animate-fade-in\",\n \"[&_kbd]:rounded-[0.1875rem] [&_kbd]:bg-panel/18 [&_kbd]:px-space-4 [&_kbd]:font-mono [&_kbd]:text-2xs [&_kbd]:font-normal [&_kbd]:opacity-75\",\n className\n )}\n {...props}\n />\n </TooltipPrimitive.Positioner>\n </TooltipPrimitive.Portal>\n );\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
|
|
3
|
+
export declare const TRACE_STATUSES: {
|
|
4
|
+
/** The title shimmers and reads in the present tense. */
|
|
5
|
+
readonly RUNNING: "running";
|
|
6
|
+
readonly ERROR: "error";
|
|
7
|
+
/** Not started. */
|
|
8
|
+
readonly PENDING: "pending";
|
|
9
|
+
};
|
|
10
|
+
export type TraceStatus = (typeof TRACE_STATUSES)[keyof typeof TRACE_STATUSES];
|
|
11
|
+
/** The steps an agent takes, one line each, shown above its reply in chat. 13.5px lines. */
|
|
12
|
+
export declare function Trace({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
13
|
+
/** The steps a summary line opens, behind a `line` rule on the left. */
|
|
14
|
+
export declare function TraceSteps({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
15
|
+
export type TraceLineProps = ComponentProps<"span"> & {
|
|
16
|
+
/** No status means done. */
|
|
17
|
+
status?: TraceStatus;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* One step: at least 24px tall, 7px from icon to title. The status sits on `data-trace-status`. A span, so it can
|
|
21
|
+
* sit in a TraceCollapsibleTrigger's button.
|
|
22
|
+
*/
|
|
23
|
+
export declare function TraceLine({ className, status, ...props }: TraceLineProps): import("react").JSX.Element;
|
|
24
|
+
/** The step's 14px icon, in `muted` (`danger` on an error, `faint` while pending). */
|
|
25
|
+
export declare function TraceIcon({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|
|
26
|
+
/** The step's one-line title; it shimmers while the step runs (still with reduced motion). */
|
|
27
|
+
export declare function TraceTitle({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|
|
28
|
+
/** 13px `muted` detail beside the title ("+1 −0"). */
|
|
29
|
+
export declare function TraceDescription({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|
|
30
|
+
/** A line that opens: the summary line over the steps, or a step over its output. */
|
|
31
|
+
export declare function TraceCollapsible({ className, ...props }: CollapsiblePrimitive.Root.Props): import("react").JSX.Element;
|
|
32
|
+
/** Wraps a TraceLine; the whole line is the toggle, with a chevron after it that turns when open. */
|
|
33
|
+
export declare function TraceCollapsibleTrigger({ className, children, ...props }: CollapsiblePrimitive.Trigger.Props): import("react").JSX.Element;
|
|
34
|
+
/** `keepMounted` keeps a closed one in the DOM, hidden. */
|
|
35
|
+
export type TraceCollapsibleContentProps = CollapsiblePrimitive.Panel.Props;
|
|
36
|
+
/** Opens with a height animation. */
|
|
37
|
+
export declare function TraceCollapsibleContent({ className, ...props }: TraceCollapsibleContentProps): import("react").JSX.Element;
|
|
38
|
+
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/components/trace.tsx"],"names":[],"mappings":"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rG,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,OAAO,CAAC,KAAK,+BAiBpC;AAED,2DAA2D;AAC3D,MAAM,MAAM,4BAA4B,GAAG,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAC;AAE5E,qCAAqC;AACrC,wBAAgB,uBAAuB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,4BAA4B,+BAW5F"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
|
|
4
|
+
import { ChevronRight } from "lucide-react";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
export const TRACE_STATUSES = {
|
|
7
|
+
/** The title shimmers and reads in the present tense. */
|
|
8
|
+
RUNNING: "running",
|
|
9
|
+
ERROR: "error",
|
|
10
|
+
/** Not started. */
|
|
11
|
+
PENDING: "pending",
|
|
12
|
+
};
|
|
13
|
+
/** The steps an agent takes, one line each, shown above its reply in chat. 13.5px lines. */
|
|
14
|
+
export function Trace({ className, ...props }) {
|
|
15
|
+
return _jsx("div", { "data-slot": "trace", className: cn("flex flex-col gap-px text-nav", className), ...props });
|
|
16
|
+
}
|
|
17
|
+
/** The steps a summary line opens, behind a `line` rule on the left. */
|
|
18
|
+
export function TraceSteps({ className, ...props }) {
|
|
19
|
+
return _jsx(Trace, { className: cn("mt-space-4 mb-0.5 border-l border-line pl-2.5", className), ...props });
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One step: at least 24px tall, 7px from icon to title. The status sits on `data-trace-status`. A span, so it can
|
|
23
|
+
* sit in a TraceCollapsibleTrigger's button.
|
|
24
|
+
*/
|
|
25
|
+
export function TraceLine({ className, status, ...props }) {
|
|
26
|
+
return (_jsx("span", { "data-slot": "trace-line", "data-trace-status": status, className: cn("group/trace-line flex min-h-6 min-w-0 items-center gap-1.75 text-ink-2", "data-[trace-status=error]:text-danger data-[trace-status=pending]:text-faint", className), ...props }));
|
|
27
|
+
}
|
|
28
|
+
/** The step's 14px icon, in `muted` (`danger` on an error, `faint` while pending). */
|
|
29
|
+
export function TraceIcon({ className, ...props }) {
|
|
30
|
+
return (_jsx("span", { "data-slot": "trace-icon", "aria-hidden": true, className: cn("grid shrink-0 place-items-center text-muted [&_svg]:size-3.5", "group-data-[trace-status=error]/trace-line:text-danger group-data-[trace-status=pending]/trace-line:text-faint", className), ...props }));
|
|
31
|
+
}
|
|
32
|
+
/** The step's one-line title; it shimmers while the step runs (still with reduced motion). */
|
|
33
|
+
export function TraceTitle({ className, ...props }) {
|
|
34
|
+
return (_jsx("span", { "data-slot": "trace-title", className: cn("min-w-0 truncate group-data-[trace-status=running]/trace-line:shimmer-text", className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
/** 13px `muted` detail beside the title ("+1 −0"). */
|
|
37
|
+
export function TraceDescription({ className, ...props }) {
|
|
38
|
+
return (_jsx("span", { "data-slot": "trace-description", className: cn("text-ui text-muted group-data-[trace-status=error]/trace-line:text-danger", className), ...props }));
|
|
39
|
+
}
|
|
40
|
+
/** A line that opens: the summary line over the steps, or a step over its output. */
|
|
41
|
+
export function TraceCollapsible({ className, ...props }) {
|
|
42
|
+
return (_jsx(CollapsiblePrimitive.Root, { "data-slot": "trace-collapsible", className: cn("group/trace-collapsible flex flex-col", className), ...props }));
|
|
43
|
+
}
|
|
44
|
+
/** Wraps a TraceLine; the whole line is the toggle, with a chevron after it that turns when open. */
|
|
45
|
+
export function TraceCollapsibleTrigger({ className, children, ...props }) {
|
|
46
|
+
return (_jsxs(CollapsiblePrimitive.Trigger, { "data-slot": "trace-collapsible-trigger", className: cn("group/trace-trigger flex w-fit max-w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm border-0 bg-transparent p-0 text-left font-sans text-[length:inherit] outline-none focus-visible:ring-2 focus-visible:ring-faint [&_[data-slot=trace-line]]:hover:text-ink", className), ...props, children: [children, _jsx(ChevronRight, { "aria-hidden": true, className: "size-3 shrink-0 text-faint transition-transform duration-180 group-data-panel-open/trace-trigger:rotate-90" })] }));
|
|
47
|
+
}
|
|
48
|
+
/** Opens with a height animation. */
|
|
49
|
+
export function TraceCollapsibleContent({ className, ...props }) {
|
|
50
|
+
return (_jsx(CollapsiblePrimitive.Panel, { "data-slot": "trace-collapsible-content", className: cn("min-w-0 overflow-hidden data-open:animate-collapsible-open data-closed:animate-collapsible-close", className), ...props }));
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.js","sourceRoot":"","sources":["../../src/components/trace.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,yDAAyD;IACzD,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,mBAAmB;IACnB,OAAO,EAAE,SAAS;CACV,CAAC;AAIX,4FAA4F;AAC5F,MAAM,UAAU,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAyB;IAClE,OAAO,2BAAe,OAAO,EAAC,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAAC;AACzG,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAyB;IACvE,OAAO,KAAC,KAAK,IAAC,SAAS,EAAE,EAAE,CAAC,+CAA+C,EAAE,SAAS,CAAC,KAAM,KAAK,G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AC2B;IACnC,OAAO,CACL,MAAC,oBAAoB,CAAC,OAAO,iBACjB,2BAA2B,EACrC,SAAS,EAAE,EAAE,CACX,6QAA6Q,EAC7Q,SAAS,CACV,KACG,KAAK,aAER,QAAQ,EACT,KAAC,YAAY,yBAEX,SAAS,EAAC,4GAA4G,GACtH,IAC2B,CAChC,CAAC;AACJ,CAAC;AAKD,qCAAqC;AACrC,MAAM,UAAU,uBAAuB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAgC;IAC3F,OAAO,CACL,KAAC,oBAAoB,CAAC,KAAK,iBACf,2BAA2B,EACrC,SAAS,EAAE,EAAE,CACX,kGAAkG,EAClG,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { Collapsible as CollapsiblePrimitive } from \"@base-ui/react/collapsible\";\nimport { ChevronRight } from \"lucide-react\";\nimport { cn } from \"../lib/cn.ts\";\n\nexport const TRACE_STATUSES = {\n /** The title shimmers and reads in the present tense. */\n RUNNING: \"running\",\n ERROR: \"error\",\n /** Not started. */\n PENDING: \"pending\",\n} as const;\n\nexport type TraceStatus = (typeof TRACE_STATUSES)[keyof typeof TRACE_STATUSES];\n\n/** The steps an agent takes, one line each, shown above its reply in chat. 13.5px lines. */\nexport function Trace({ className, ...props }: ComponentProps<\"div\">) {\n return <div data-slot=\"trace\" className={cn(\"flex flex-col gap-px text-nav\", className)} {...props} />;\n}\n\n/** The steps a summary line opens, behind a `line` rule on the left. */\nexport function TraceSteps({ className, ...props }: ComponentProps<\"div\">) {\n return <Trace className={cn(\"mt-space-4 mb-0.5 border-l border-line pl-2.5\", className)} {...props} />;\n}\n\nexport type TraceLineProps = ComponentProps<\"span\"> & {\n /** No status means done. */\n status?: TraceStatus;\n};\n\n/**\n * One step: at least 24px tall, 7px from icon to title. The status sits on `data-trace-status`. A span, so it can\n * sit in a TraceCollapsibleTrigger's button.\n */\nexport function TraceLine({ className, status, ...props }: TraceLineProps) {\n return (\n <span\n data-slot=\"trace-line\"\n data-trace-status={status}\n className={cn(\n \"group/trace-line flex min-h-6 min-w-0 items-center gap-1.75 text-ink-2\",\n \"data-[trace-status=error]:text-danger data-[trace-status=pending]:text-faint\",\n className\n )}\n {...props}\n />\n );\n}\n\n/** The step's 14px icon, in `muted` (`danger` on an error, `faint` while pending). */\nexport function TraceIcon({ className, ...props }: ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"trace-icon\"\n aria-hidden\n className={cn(\n \"grid shrink-0 place-items-center text-muted [&_svg]:size-3.5\",\n \"group-data-[trace-status=error]/trace-line:text-danger group-data-[trace-status=pending]/trace-line:text-faint\",\n className\n )}\n {...props}\n />\n );\n}\n\n/** The step's one-line title; it shimmers while the step runs (still with reduced motion). */\nexport function TraceTitle({ className, ...props }: ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"trace-title\"\n className={cn(\"min-w-0 truncate group-data-[trace-status=running]/trace-line:shimmer-text\", className)}\n {...props}\n />\n );\n}\n\n/** 13px `muted` detail beside the title (\"+1 −0\"). */\nexport function TraceDescription({ className, ...props }: ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"trace-description\"\n className={cn(\"text-ui text-muted group-data-[trace-status=error]/trace-line:text-danger\", className)}\n {...props}\n />\n );\n}\n\n/** A line that opens: the summary line over the steps, or a step over its output. */\nexport function TraceCollapsible({ className, ...props }: CollapsiblePrimitive.Root.Props) {\n return (\n <CollapsiblePrimitive.Root\n data-slot=\"trace-collapsible\"\n className={cn(\"group/trace-collapsible flex flex-col\", className)}\n {...props}\n />\n );\n}\n\n/** Wraps a TraceLine; the whole line is the toggle, with a chevron after it that turns when open. */\nexport function TraceCollapsibleTrigger({\n className,\n children,\n ...props\n}: CollapsiblePrimitive.Trigger.Props) {\n return (\n <CollapsiblePrimitive.Trigger\n data-slot=\"trace-collapsible-trigger\"\n className={cn(\n \"group/trace-trigger flex w-fit max-w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm border-0 bg-transparent p-0 text-left font-sans text-[length:inherit] outline-none focus-visible:ring-2 focus-visible:ring-faint [&_[data-slot=trace-line]]:hover:text-ink\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRight\n aria-hidden\n className=\"size-3 shrink-0 text-faint transition-transform duration-180 group-data-panel-open/trace-trigger:rotate-90\"\n />\n </CollapsiblePrimitive.Trigger>\n );\n}\n\n/** `keepMounted` keeps a closed one in the DOM, hidden. */\nexport type TraceCollapsibleContentProps = CollapsiblePrimitive.Panel.Props;\n\n/** Opens with a height animation. */\nexport function TraceCollapsibleContent({ className, ...props }: TraceCollapsibleContentProps) {\n return (\n <CollapsiblePrimitive.Panel\n data-slot=\"trace-collapsible-content\"\n className={cn(\n \"min-w-0 overflow-hidden data-open:animate-collapsible-open data-closed:animate-collapsible-close\",\n className\n )}\n {...props}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
export type TurnSummaryProps = ComponentProps<"div"> & {
|
|
3
|
+
/** How long the turn took, already formatted (“42s”): “Worked for 42s”. With none the line reads “Worked”. */
|
|
4
|
+
duration?: string;
|
|
5
|
+
/** Tool calls and subagents in the turn, after the duration as “· 5 steps”. */
|
|
6
|
+
stepCount?: number;
|
|
7
|
+
/** While the turn runs its steps show as they come, with no summary line. */
|
|
8
|
+
isRunning?: boolean;
|
|
9
|
+
defaultOpen?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A turn's work above Major's reply. While the turn runs, its steps (ToolCall, ToolCallGroup, SubagentRun) show as
|
|
13
|
+
* they come; once it ends they fold behind one quiet `faint` line, “Worked for 42s · 5 steps”, that opens them as one
|
|
14
|
+
* flat list behind a `line` rule. Renders nothing without steps.
|
|
15
|
+
*/
|
|
16
|
+
export declare function TurnSummary({ duration, stepCount, isRunning, defaultOpen, className, children, ...props }: TurnSummaryProps): import("react").JSX.Element | null;
|
|
17
|
+
//# sourceMappingURL=turn-summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-summary.d.ts","sourceRoot":"","sources":["../../src/components/turn-summary.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAYtD,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACrD,8GAA8G;IAC9G,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,SAAa,EACb,SAAiB,EACjB,WAAmB,EACnB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,gBAAgB,sCAiClB"}
|